aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorPaul Chavent <Paul.Chavent@onera.fr>2012-11-06 18:10:47 -0500
committerDavid S. Miller <davem@davemloft.net>2012-11-07 18:54:30 -0500
commit5920cd3a41f1aefc30e9ce86384fc2fe9f5fe0c0 (patch)
treececc965a19e1ffe6957d8dcf2e55566562f93e0c /Documentation
parent7da716aee2532399e213a14f656d304098f67a11 (diff)
packet: tx_ring: allow the user to choose tx data offset
The tx data offset of packet mmap tx ring used to be : (TPACKET2_HDRLEN - sizeof(struct sockaddr_ll)) The problem is that, with SOCK_RAW socket, the payload (14 bytes after the beginning of the user data) is misaligned. This patch allows to let the user gives an offset for it's tx data if he desires. Set sock option PACKET_TX_HAS_OFF to 1, then specify in each frame of your tx ring tp_net for SOCK_DGRAM, or tp_mac for SOCK_RAW. Signed-off-by: Paul Chavent <paul.chavent@onera.fr> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/networking/packet_mmap.txt13
1 files changed, 13 insertions, 0 deletions
diff --git a/Documentation/networking/packet_mmap.txt b/Documentation/networking/packet_mmap.txt
index 1c08a4b0981f..7cd879eba5dc 100644
--- a/Documentation/networking/packet_mmap.txt
+++ b/Documentation/networking/packet_mmap.txt
@@ -163,6 +163,19 @@ As capture, each frame contains two parts:
163 163
164 A complete tutorial is available at: http://wiki.gnu-log.net/ 164 A complete tutorial is available at: http://wiki.gnu-log.net/
165 165
166By default, the user should put data at :
167 frame base + TPACKET_HDRLEN - sizeof(struct sockaddr_ll)
168
169So, whatever you choose for the socket mode (SOCK_DGRAM or SOCK_RAW),
170the beginning of the user data will be at :
171 frame base + TPACKET_ALIGN(sizeof(struct tpacket_hdr))
172
173If you wish to put user data at a custom offset from the beginning of
174the frame (for payload alignment with SOCK_RAW mode for instance) you
175can set tp_net (with SOCK_DGRAM) or tp_mac (with SOCK_RAW). In order
176to make this work it must be enabled previously with setsockopt()
177and the PACKET_TX_HAS_OFF option.
178
166-------------------------------------------------------------------------------- 179--------------------------------------------------------------------------------
167+ PACKET_MMAP settings 180+ PACKET_MMAP settings
168-------------------------------------------------------------------------------- 181--------------------------------------------------------------------------------