[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250923210026.3870-5-mehdi.benhadjkhelifa@gmail.com>
Date: Tue, 23 Sep 2025 22:00:15 +0100
From: Mehdi Ben Hadj Khelifa <mehdi.benhadjkhelifa@...il.com>
To: davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
donald.hunter@...il.com,
andrew+netdev@...n.ch,
ast@...nel.org,
daniel@...earbox.net,
hawk@...nel.org,
john.fastabend@...il.com,
matttbe@...nel.org,
chuck.lever@...cle.com,
jdamato@...tly.com,
skhawaja@...gle.com,
dw@...idwei.uk,
mkarsten@...terloo.ca,
yoong.siang.song@...el.com,
david.hunter.linux@...il.com,
skhan@...uxfoundation.org
Cc: horms@...nel.org,
sdf@...ichev.me,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
bpf@...r.kernel.org,
linux-kernel-mentees@...ts.linuxfoundation.org,
Mehdi Ben Hadj Khelifa <mehdi.benhadjkhelifa@...il.com>
Subject: [PATCH RFC 4/4] net: veth: Implement RX queue index XDP hint
Implement xmo_rx_queue_index callback in veth driver
to export queue_index for use in eBPF programs.
Signed-off-by: Mehdi Ben Hadj Khelifa <mehdi.benhadjkhelifa@...il.com>
---
drivers/net/veth.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index a3046142cb8e..be76dd292819 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -1692,6 +1692,17 @@ static int veth_xdp_rx_vlan_tag(const struct xdp_md *ctx, __be16 *vlan_proto,
return err;
}
+static int veth_xdp_rx_queue_index(const struct xdp_md *ctx, u32 *queue_index)
+{
+ const struct veth_xdp_buff *_ctx = (void *)ctx;
+
+ if (!_ctx->xdp.rxq)
+ return -ENODATA;
+
+ *queue_index = _ctx->xdp.rxq->queue_index;
+ return 0;
+}
+
static const struct net_device_ops veth_netdev_ops = {
.ndo_init = veth_dev_init,
.ndo_open = veth_open,
@@ -1717,6 +1728,7 @@ static const struct xdp_metadata_ops veth_xdp_metadata_ops = {
.xmo_rx_timestamp = veth_xdp_rx_timestamp,
.xmo_rx_hash = veth_xdp_rx_hash,
.xmo_rx_vlan_tag = veth_xdp_rx_vlan_tag,
+ .xmo_rx_queue_index = veth_xdp_rx_queue_index,
};
#define VETH_FEATURES (NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HW_CSUM | \
--
2.51.0
Powered by blists - more mailing lists