packet: tx_ring: allow the user to choose tx data offset
authorPaul Chavent <Paul.Chavent@onera.fr>
Tue, 6 Nov 2012 23:10:47 +0000 (23:10 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 7 Nov 2012 23:54:30 +0000 (18:54 -0500)
commit5920cd3a41f1aefc30e9ce86384fc2fe9f5fe0c0
treececc965a19e1ffe6957d8dcf2e55566562f93e0c
parent7da716aee2532399e213a14f656d304098f67a11
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>
Documentation/networking/packet_mmap.txt
include/uapi/linux/if_packet.h
net/packet/af_packet.c
net/packet/internal.h