Source-Changes-HG archive

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

[src/trunk]: src/sys/net make bridge_output MP-safe, so that bridge(4) can en...



details:   https://anonhg.NetBSD.org/src/rev/dc00866bc619
branches:  trunk
changeset: 346034:dc00866bc619
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Mon Jun 20 07:06:06 2016 +0000

description:
make bridge_output MP-safe, so that bridge(4) can enable IFEF_OUTPUT_MPSAFE.

making MP-scalable is future work.

diffstat:

 sys/net/if_bridge.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (51 lines):

diff -r abc87c95c3a9 -r dc00866bc619 sys/net/if_bridge.c
--- a/sys/net/if_bridge.c       Mon Jun 20 07:01:45 2016 +0000
+++ b/sys/net/if_bridge.c       Mon Jun 20 07:06:06 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bridge.c,v 1.125 2016/06/10 13:31:44 ozaki-r Exp $  */
+/*     $NetBSD: if_bridge.c,v 1.126 2016/06/20 07:06:06 knakahara Exp $        */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.125 2016/06/10 13:31:44 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.126 2016/06/20 07:06:06 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -424,6 +424,7 @@
 
        if_initname(ifp, ifc->ifc_name, unit);
        ifp->if_softc = sc;
+       ifp->if_extflags = IFEF_OUTPUT_MPSAFE;
        ifp->if_mtu = ETHERMTU;
        ifp->if_ioctl = bridge_ioctl;
        ifp->if_output = bridge_output;
@@ -1378,6 +1379,7 @@
        }
 
 #ifdef ALTQ
+       KERNEL_LOCK(1, NULL);
        /*
         * If ALTQ is enabled on the member interface, do
         * classification; the queueing discipline might
@@ -1388,6 +1390,7 @@
                /* XXX IFT_ETHER */
                altq_etherclassify(&dst_ifp->if_snd, m);
        }
+       KERNEL_UNLOCK_ONE(NULL);
 #endif /* ALTQ */
 
        len = m->m_pkthdr.len;
@@ -1425,6 +1428,8 @@
        struct bridge_softc *sc;
        int s;
 
+       KASSERT(ifp->if_extflags & IFEF_OUTPUT_MPSAFE);
+
        if (m->m_len < ETHER_HDR_LEN) {
                m = m_pullup(m, ETHER_HDR_LEN);
                if (m == NULL)



Home | Main Index | Thread Index | Old Index