Module Name:    src
Committed By:   ozaki-r
Date:           Wed Oct  7 08:48:04 UTC 2015

Modified Files:
        src/sys/net: if_bridge.c

Log Message:
Enqueue frames to a curcpu's pktqueue

Currently RX can run on a CPU other than CPU#0, so always enqueuing
to a pktqueue of CPU#0 makes no sense. Let's use a curcpu's pktqueue,
although bridge_foward softint doesn't run in parallel without
NET_MPSAFE.

This is a temporal solution. We need a fundamental solution.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/net/if_bridge.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.102 src/sys/net/if_bridge.c:1.103
--- src/sys/net/if_bridge.c:1.102	Fri Aug 28 14:23:18 2015
+++ src/sys/net/if_bridge.c	Wed Oct  7 08:48:04 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.102 2015/08/28 14:23:18 rjs Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.103 2015/10/07 08:48:04 ozaki-r Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.102 2015/08/28 14:23:18 rjs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.103 2015/10/07 08:48:04 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -1971,8 +1971,16 @@ out:
 	bridge_release_member(sc, bif);
 
 	/* Queue the packet for bridge forwarding. */
-	if (__predict_false(!pktq_enqueue(sc->sc_fwd_pktq, m, 0)))
-		m_freem(m);
+	{
+		/*
+		 * Force to enqueue to curcpu's pktq (RX can run on a CPU
+		 * other than CPU#0). XXX need fundamental solution.
+		 */
+		const unsigned hash = curcpu()->ci_index;
+
+		if (__predict_false(!pktq_enqueue(sc->sc_fwd_pktq, m, hash)))
+			m_freem(m);
+	}
 }
 
 /*

Reply via email to