From: John Fastabend <john.fastabend@gmail.com>
To: dborkman@redhat.com, fw@strlen.de, gerlitz.or@gmail.com,
hannes@stressinduktion.org
Cc: netdev@vger.kernel.org, john.ronciak@intel.com,
amirv@mellanox.com, eric.dumazet@gmail.com, danny.zhou@intel.com
Subject: [net-next PATCH v1 3/3] net: packet: Document PACKET_DEV_QPAIR_SPLIT and friends
Date: Sun, 05 Oct 2014 17:07:36 -0700 [thread overview]
Message-ID: <20141006000735.32055.98724.stgit@nitbit.x32> (raw)
In-Reply-To: <20141006000629.32055.2295.stgit@nitbit.x32>
This adds a section to the packet interface kernel documentation
describing the set of socket options to get direct queue
assignment working.
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---
Documentation/networking/packet_mmap.txt | 44 ++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/Documentation/networking/packet_mmap.txt b/Documentation/networking/packet_mmap.txt
index a6d7cb9..ad26194 100644
--- a/Documentation/networking/packet_mmap.txt
+++ b/Documentation/networking/packet_mmap.txt
@@ -1047,6 +1047,50 @@ See include/linux/net_tstamp.h and Documentation/networking/timestamping
for more information on hardware timestamps.
-------------------------------------------------------------------------------
++ PACKET_RXTX_QPAIRS_SPLIT and friends
+-------------------------------------------------------------------------------
+
+The PACKET_RXTX_QPAIRS_SLIT setting allows direct access to the hardware
+packet rings. If your NIC is capable of supporting hardware packet steering
+and the driver has this feature enabled you can use the hardware to steer
+packets directly to user mapped memory and use user space descriptor rings.
+
+The user space flow should be,
+
+ bind(fd, &sockaddr, sizeof(sockaddr));
+
+ /* Get the device type and info */
+ getsockopt(fd, SOL_PACKET, PACKET_DEV_DESC_INFO, &def_info,
+ &optlen);
+
+ /* With device info we can look up descriptor format */
+
+ /* Get the layout of ring space offset, page_sz, cnt */
+ getsockopt(fd, SOL_PACKET, PACKET_DEV_QPAIR_MAP_REGION_INFO,
+ &info, &optlen);
+
+ /* request some queues from the driver */
+ setsockopt(fd, SOL_PACKET, PACKET_RXTX_QPAIRS_SPLIT,
+ &qpairs_info, sizeof(qpairs_info));
+
+ /* if we let the driver pick us queues learn which queues
+ * we were given
+ */
+ getsockopt(fd, SOL_PACKET, PACKET_RXTX_QPAIRS_SPLIT,
+ &qpairs_info, sizeof(qpairs_info));
+
+ /* And mmap queue pairs to user space */
+ mmap(NULL, info.tp_dev_bar_sz, PROT_READ | PROT_WRITE,
+ MAP_SHARED, fd, 0);
+
+ /* Now we have some user space queues to read/write to*/
+
+After this user space can directly manipulate the drivers descriptor rings.
+The descriptor rings use the native descriptor format of the hardware device.
+The device specifics are returned from the PACKET_DEV_DESC_INFO call which
+allows user space to determine the correct descriptor format to use.
+
+-------------------------------------------------------------------------------
+ Miscellaneous bits
-------------------------------------------------------------------------------
next prev parent reply other threads:[~2014-10-06 0:07 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-06 0:06 [net-next PATCH v1 1/3] net: sched: af_packet support for direct ring access John Fastabend
2014-10-06 0:07 ` [net-next PATCH v1 2/3] net: sched: add direct ring acces via af_packet to ixgbe John Fastabend
2014-10-06 0:07 ` John Fastabend [this message]
2014-10-06 0:29 ` [net-next PATCH v1 1/3] net: sched: af_packet support for direct ring access Florian Westphal
2014-10-06 1:09 ` David Miller
2014-10-06 1:18 ` John Fastabend
2014-10-06 1:12 ` John Fastabend
2014-10-06 9:49 ` Daniel Borkmann
2014-10-06 15:01 ` John Fastabend
2014-10-06 16:35 ` Jesper Dangaard Brouer
2014-10-06 17:03 ` Hannes Frederic Sowa
2014-10-06 20:37 ` John Fastabend
2014-10-06 23:26 ` Hannes Frederic Sowa
2014-10-07 18:59 ` Neil Horman
2014-10-08 17:20 ` John Fastabend
2014-10-09 13:36 ` [PATCH] af_packet: Add Doorbell transmit mode to AF_PACKET sockets Neil Horman
2014-10-09 15:01 ` John Fastabend
2014-10-09 16:05 ` Neil Horman
2014-10-06 16:55 ` [net-next PATCH v1 1/3] net: sched: af_packet support for direct ring access Stephen Hemminger
2014-10-06 20:42 ` John Fastabend
2014-10-06 21:42 ` David Miller
2014-10-07 4:25 ` John Fastabend
2014-10-07 4:24 ` Willem de Bruijn
2014-10-07 9:27 ` David Laight
2014-10-07 15:43 ` David Miller
2014-10-07 15:59 ` David Laight
2014-10-07 16:08 ` David Miller
2014-10-07 15:21 ` Zhou, Danny
2014-10-07 15:46 ` Willem de Bruijn
2014-10-07 15:55 ` John Fastabend
2014-10-07 16:06 ` Zhou, Danny
2014-10-07 16:05 ` David Miller
2014-10-10 3:49 ` Zhou, Danny
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=20141006000735.32055.98724.stgit@nitbit.x32 \
--to=john.fastabend@gmail.com \
--cc=amirv@mellanox.com \
--cc=danny.zhou@intel.com \
--cc=dborkman@redhat.com \
--cc=eric.dumazet@gmail.com \
--cc=fw@strlen.de \
--cc=gerlitz.or@gmail.com \
--cc=hannes@stressinduktion.org \
--cc=john.ronciak@intel.com \
--cc=netdev@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.