#define PACKET_HOST 0 /* To us */ #define PACKET_BROADCAST 1 /* To all */ #define PACKET_MULTICAST 2 /* To group */ #define PACKET_OTHERHOST 3 /* To someone else */ #define PACKET_OUTGOING 4 /* Outgoing of any type */ #define PACKET_LOOPBACK 5 /* MC/BRD frame looped back */ #define PACKET_USER 6 /* To user space */ #define PACKET_KERNEL 7 /* To kernel space */ /* Unused, PACKET_FASTROUTE and PACKET_LOOPBACK are invisible to user space */ #define PACKET_FASTROUTE 6 /* Fastrouted frame */
/* Number of valid bytes (including padding) * blk_len <= tp_block_size
*/
__u32 blk_len;
/* * Quite a few uses of sequence number: * 1. Make sure cache flush etc worked. * Well, one can argue - why not use the increasing ts below? * But look at 2. below first. * 2. When you pass around blocks to other user space decoders, * you can see which blk[s] is[are] outstanding etc. * 3. Validate kernel code.
*/
__aligned_u64 seq_num;
/* * ts_last_pkt: * * Case 1. Block has 'N'(N >=1) packets and TMO'd(timed out) * ts_last_pkt == 'time-stamp of last packet' and NOT the * time when the timer fired and the block was closed. * By providing the ts of the last packet we can absolutely * guarantee that time-stamp wise, the first packet in the * next block will never precede the last packet of the * previous block. * Case 2. Block has zero packets and TMO'd * ts_last_pkt = time when the timer fired and the block * was closed. * Case 3. Block has 'N' packets and NO TMO. * ts_last_pkt = time-stamp of the last pkt in the block. * * ts_first_pkt: * Is always the time-stamp when the block was opened. * Case a) ZERO packets * No packets to deal with but at least you know * the time-interval of this block. * Case b) Non-zero packets * Use the ts of the first packet in the block. *
*/ struct tpacket_bd_ts ts_first_pkt, ts_last_pkt;
};
union tpacket_bd_header_u { struct tpacket_hdr_v1 bh1;
};
- Start. Frame must be aligned to TPACKET_ALIGNMENT=16 - struct tpacket_hdr - pad to TPACKET_ALIGNMENT=16 - struct sockaddr_ll - Gap, chosen so that packet data (Start+tp_net) aligns to TPACKET_ALIGNMENT=16 - Start+tp_mac: [ Optional MAC header ] - Start+tp_net: Packet data, aligned to TPACKET_ALIGNMENT=16. - Pad to align to TPACKET_ALIGNMENT=16
*/
struct tpacket_req { unsignedint tp_block_size; /* Minimal size of contiguous block */ unsignedint tp_block_nr; /* Number of blocks */ unsignedint tp_frame_size; /* Size of frame */ unsignedint tp_frame_nr; /* Total number of frames */
};
struct tpacket_req3 { unsignedint tp_block_size; /* Minimal size of contiguous block */ unsignedint tp_block_nr; /* Number of blocks */ unsignedint tp_frame_size; /* Size of frame */ unsignedint tp_frame_nr; /* Total number of frames */ unsignedint tp_retire_blk_tov; /* timeout in msecs */ unsignedint tp_sizeof_priv; /* offset to private data area */ unsignedint tp_feature_req_word;
};
union tpacket_req_u { struct tpacket_req req; struct tpacket_req3 req3;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.