Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Enqueue frames to a curcpu's pktqueue



details:   https://anonhg.NetBSD.org/src/rev/6d0d1297900a
branches:  trunk
changeset: 340869:6d0d1297900a
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Oct 07 08:48:04 2015 +0000

description:
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.

diffstat:

 sys/net/if_bridge.c |  16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r 568be00ab6a0 -r 6d0d1297900a sys/net/if_bridge.c
--- a/sys/net/if_bridge.c       Wed Oct 07 05:24:41 2015 +0000
+++ b/sys/net/if_bridge.c       Wed Oct 07 08:48:04 2015 +0000
@@ -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 @@
        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);
+       }
 }
 
 /*



Home | Main Index | Thread Index | Old Index