History

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.

Paul Chavent committed 14 years ago

Commit 5920cd31 parent 7da716a4 files · +60 −1Browse files

Showing the changes to include/uapi (1 of 4 files). Show all

Unified · Split

include/uapi/linux/if_packet.h+1−0
@@ -50,6 +50,7 @@ struct sockaddr_ll { · 49 unmodified lines
50#define PACKET_TX_TIMESTAMP 1650#define PACKET_TX_TIMESTAMP 16
51#define PACKET_TIMESTAMP 1751#define PACKET_TIMESTAMP 17
52#define PACKET_FANOUT 1852#define PACKET_FANOUT 18
53#define PACKET_TX_HAS_OFF 19
53 54
54#define PACKET_FANOUT_HASH 055#define PACKET_FANOUT_HASH 0
55#define PACKET_FANOUT_LB 156#define PACKET_FANOUT_LB 1