2 * netsniff-ng - the packet sniffing beast
3 * By Daniel Borkmann <daniel@netsniff-ng.org>
4 * Copyright 2009, 2010 Daniel Borkmann.
5 * Subject to the GPL, version 2.
14 /* Give userland 10 us time to push packets to the ring */
15 #define TX_KERNEL_PULL_INT 10
17 extern void destroy_tx_ring(int sock
, struct ring
*ring
);
18 extern void create_tx_ring(int sock
, struct ring
*ring
, int verbose
);
19 extern void mmap_tx_ring(int sock
, struct ring
*ring
);
20 extern void alloc_tx_ring_frames(struct ring
*ring
);
21 extern void bind_tx_ring(int sock
, struct ring
*ring
, int ifindex
);
22 extern void setup_tx_ring_layout(int sock
, struct ring
*ring
,
23 unsigned int size
, int jumbo_support
);
24 extern void set_packet_loss_discard(int sock
);
26 static inline int user_may_pull_from_tx(struct tpacket2_hdr
*hdr
)
28 return ((hdr
->tp_status
& TP_STATUS_AVAILABLE
) == TP_STATUS_AVAILABLE
);
31 static inline void kernel_may_pull_from_tx(struct tpacket2_hdr
*hdr
)
33 hdr
->tp_status
= TP_STATUS_SEND_REQUEST
;
36 static inline int pull_and_flush_tx_ring(int sock
)
38 return sendto(sock
, NULL
, 0, MSG_DONTWAIT
, NULL
, 0);
41 #endif /* TX_RING_H */