summaryrefslogtreecommitdiff
path: root/ring_rx.h
diff options
context:
space:
mode:
authorMichał Purzyński <michalpurzynski1@gmail.com>2015-04-21 11:12:44 +0200
committerDaniel Borkmann <daniel@iogearbox.net>2015-04-21 11:48:38 +0200
commitf00d4d54f28c0374cc57e6ca07dd648d7684c69c (patch)
tree3670c9ad317a1fd65da88f0515c84fcd06c392c9 /ring_rx.h
parentfb1c7820fd6a30224f98175b481b981efadf7673 (diff)
netsniff-ng: add packet fanout support
This work adds packet fanout support to netsniff-ng. Multiple netsniff-ng instances can join the same fanout group with a particular id in order to improve scaling. Based on different fanout disciplines, e.g. distribute to fanout member by packet hash, round-robin, by arrival cpu, by random, by socket rollover (if one members socket queue is full, switch to next one, etc), by hardware queue mapping, traffic can be distributed to one of the fanout members. Moreover, we also allow the user to specify additional aux arguments, e.g. whether to defrag incoming traffic for the fanout group or not, and whether to roll over a socket in case other disciplines than socket rollover have been used. All that is configurable via command line option. Signed-off-by: Michał Purzyński <michalpurzynski1@gmail.com> [ dbkm made some bigger changes to get this upstream ready ] Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'ring_rx.h')
-rw-r--r--ring_rx.h36
1 files changed, 35 insertions, 1 deletions
diff --git a/ring_rx.h b/ring_rx.h
index edd0feb..1f33018 100644
--- a/ring_rx.h
+++ b/ring_rx.h
@@ -13,7 +13,7 @@
extern void ring_rx_setup(struct ring *ring, int sock, size_t size, int ifindex,
struct pollfd *poll, bool v3, bool jumbo_support,
- bool verbose);
+ bool verbose, uint32_t fanout_group, uint32_t fanout_type);
extern void destroy_rx_ring(int sock, struct ring *ring);
extern void sock_rx_net_stats(int sock, unsigned long seen);
@@ -39,4 +39,38 @@ static inline void kernel_may_pull_from_rx_block(struct block_desc *pbd)
}
#endif /* HAVE_TPACKET3 */
+/* Fanout types. */
+
+#ifndef PACKET_FANOUT_HASH
+# define PACKET_FANOUT_HASH 0
+#endif
+
+#ifndef PACKET_FANOUT_LB
+# define PACKET_FANOUT_LB 1
+#endif
+
+#ifndef PACKET_FANOUT_CPU
+# define PACKET_FANOUT_CPU 2
+#endif
+
+#ifndef PACKET_FANOUT_ROLLOVER
+# define PACKET_FANOUT_ROLLOVER 3
+#endif
+
+#ifndef PACKET_FANOUT_RND
+# define PACKET_FANOUT_RND 4
+#endif
+
+#ifndef PACKET_FANOUT_QM
+# define PACKET_FANOUT_QM 5
+#endif
+
+#ifndef PACKET_FANOUT_FLAG_ROLLOVER
+# define PACKET_FANOUT_FLAG_ROLLOVER 0x1000
+#endif
+
+#ifndef PACKET_FANOUT_FLAG_DEFRAG
+# define PACKET_FANOUT_FLAG_DEFRAG 0x8000
+#endif
+
#endif /* RX_RING_H */