From: Joe Damato <jdamato@fastly.com>
To: netdev@vger.kernel.org
Cc: sridhar.samudrala@intel.com, Joe Damato <jdamato@fastly.com>,
Donald Hunter <donald.hunter@gmail.com>,
Jakub Kicinski <kuba@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Xuan Zhuo <xuanzhuo@linux.alibaba.com>,
Mina Almasry <almasrymina@google.com>,
Martin Karsten <mkarsten@uwaterloo.ca>,
Amritha Nambiar <amritha.nambiar@intel.com>,
Stanislav Fomichev <sdf@fomichev.me>,
Daniel Jurgens <danielj@nvidia.com>,
linux-kernel@vger.kernel.org (open list)
Subject: [RFC net-next 1/2] netdev-genl: Add an XSK attribute to queues
Date: Wed, 29 Jan 2025 17:24:24 +0000 [thread overview]
Message-ID: <20250129172431.65773-2-jdamato@fastly.com> (raw)
In-Reply-To: <20250129172431.65773-1-jdamato@fastly.com>
Expose a new per-queue attribute, xsk, which indicates that a queue is
being used for AF_XDP. Update the documentation to more explicitly state
which queue types are linked.
Signed-off-by: Joe Damato <jdamato@fastly.com>
---
Documentation/netlink/specs/netdev.yaml | 10 +++++++++-
include/uapi/linux/netdev.h | 1 +
net/core/netdev-genl.c | 6 ++++++
tools/include/uapi/linux/netdev.h | 1 +
4 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/Documentation/netlink/specs/netdev.yaml b/Documentation/netlink/specs/netdev.yaml
index cbb544bd6c84..7a72788cce03 100644
--- a/Documentation/netlink/specs/netdev.yaml
+++ b/Documentation/netlink/specs/netdev.yaml
@@ -286,6 +286,8 @@ attribute-sets:
-
name: type
doc: Queue type as rx, tx. Each queue type defines a separate ID space.
+ XDP TX queues allocated in the kernel are not linked to NAPIs and
+ thus not listed. AF_XDP queues have the xsk attribute set.
type: u32
enum: queue-type
-
@@ -296,7 +298,12 @@ attribute-sets:
name: dmabuf
doc: ID of the dmabuf attached to this queue, if any.
type: u32
-
+ -
+ name: xsk
+ doc: Non-zero for queues which are used for XSK (AF_XDP), 0 otherwise.
+ type: u32
+ checks:
+ max: 1
-
name: qstats
doc: |
@@ -637,6 +644,7 @@ operations:
- napi-id
- ifindex
- dmabuf
+ - xsk
dump:
request:
attributes:
diff --git a/include/uapi/linux/netdev.h b/include/uapi/linux/netdev.h
index e4be227d3ad6..4d2dcf4960ec 100644
--- a/include/uapi/linux/netdev.h
+++ b/include/uapi/linux/netdev.h
@@ -136,6 +136,7 @@ enum {
NETDEV_A_QUEUE_TYPE,
NETDEV_A_QUEUE_NAPI_ID,
NETDEV_A_QUEUE_DMABUF,
+ NETDEV_A_QUEUE_XSK,
__NETDEV_A_QUEUE_MAX,
NETDEV_A_QUEUE_MAX = (__NETDEV_A_QUEUE_MAX - 1)
diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
index 715f85c6b62e..964aebfcb079 100644
--- a/net/core/netdev-genl.c
+++ b/net/core/netdev-genl.c
@@ -394,12 +394,18 @@ netdev_nl_queue_fill_one(struct sk_buff *rsp, struct net_device *netdev,
nla_put_u32(rsp, NETDEV_A_QUEUE_DMABUF, binding->id))
goto nla_put_failure;
+ if (nla_put_u32(rsp, NETDEV_A_QUEUE_XSK, !!rxq->pool))
+ goto nla_put_failure;
+
break;
case NETDEV_QUEUE_TYPE_TX:
txq = netdev_get_tx_queue(netdev, q_idx);
if (txq->napi && nla_put_u32(rsp, NETDEV_A_QUEUE_NAPI_ID,
txq->napi->napi_id))
goto nla_put_failure;
+
+ if (nla_put_u32(rsp, NETDEV_A_QUEUE_XSK, !!txq->pool))
+ goto nla_put_failure;
}
genlmsg_end(rsp, hdr);
diff --git a/tools/include/uapi/linux/netdev.h b/tools/include/uapi/linux/netdev.h
index e4be227d3ad6..4d2dcf4960ec 100644
--- a/tools/include/uapi/linux/netdev.h
+++ b/tools/include/uapi/linux/netdev.h
@@ -136,6 +136,7 @@ enum {
NETDEV_A_QUEUE_TYPE,
NETDEV_A_QUEUE_NAPI_ID,
NETDEV_A_QUEUE_DMABUF,
+ NETDEV_A_QUEUE_XSK,
__NETDEV_A_QUEUE_MAX,
NETDEV_A_QUEUE_MAX = (__NETDEV_A_QUEUE_MAX - 1)
--
2.25.1
next prev parent reply other threads:[~2025-01-29 17:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-29 17:24 [RFC net-next 0/2] netdevgenl: Add an xsk attribute to queues Joe Damato
2025-01-29 17:24 ` Joe Damato [this message]
2025-01-30 1:52 ` [RFC net-next 1/2] netdev-genl: Add an XSK " Jakub Kicinski
2025-01-30 16:26 ` Joe Damato
2025-01-30 18:06 ` Joe Damato
2025-01-30 18:13 ` Jakub Kicinski
2025-01-29 17:24 ` [RFC net-next 2/2] selftests: drv-net: Test queue xsk attribute Joe Damato
2025-01-30 2:07 ` Jakub Kicinski
2025-01-30 16:29 ` Joe Damato
2025-01-29 17:34 ` [RFC net-next 0/2] netdevgenl: Add an xsk attribute to queues Joe Damato
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250129172431.65773-2-jdamato@fastly.com \
--to=jdamato@fastly.com \
--cc=almasrymina@google.com \
--cc=amritha.nambiar@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=danielj@nvidia.com \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkarsten@uwaterloo.ca \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=sridhar.samudrala@intel.com \
--cc=xuanzhuo@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).