@@ -12,6 +12,7 @@
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/module.h>
+#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/slab.h>
@@ -35,11 +36,15 @@
#define MACVLAN_HASH_BITS 8
#define MACVLAN_HASH_SIZE (1<<MACVLAN_HASH_BITS)
-#define MACVLAN_BC_QUEUE_LEN 1000
+#define MACVLAN_DEFAULT_BC_QUEUE_LEN 1000
#define MACVLAN_F_PASSTHRU 1
#define MACVLAN_F_ADDRCHANGE 2
+static uint bc_queue_len = MACVLAN_DEFAULT_BC_QUEUE_LEN;
+module_param(bc_queue_len, uint, 0444);
+MODULE_PARM_DESC(bc_queue_len, "The maximum length of the broadcast/multicast work queue");
+
struct macvlan_port {
struct net_device *dev;
struct hlist_head vlan_hash[MACVLAN_HASH_SIZE];
@@ -354,7 +359,7 @@ static void macvlan_broadcast_enqueue(struct macvlan_port *port,
MACVLAN_SKB_CB(nskb)->src = src;
spin_lock(&port->bc_queue.lock);
- if (skb_queue_len(&port->bc_queue) < MACVLAN_BC_QUEUE_LEN) {
+ if (skb_queue_len(&port->bc_queue) < bc_queue_len) {
if (src)
dev_hold(src->dev);
__skb_queue_tail(&port->bc_queue, nskb);
Background: Broadcast and multicast packages are enqueued for later processing. This queue was previously hardcoded to 1000. This proved insufficient for handling very high packet rates. This resulted in packet drops for multicast. While at the same time unicast worked fine. The change: This patch make the queue len adjustable to accommodate for environments with very high multicast packet rate. But still keeps the default value of 1000 unless specified. The queue len is specified using the bc_queue_len module parameter. Signed-off-by: Thomas Karlsson <thomas.karlsson@paneda.se> --- v2: Patch created on top of 'net-next' instead of 'torvalds/linux' -- 2.28.0