Module Name:    src
Committed By:   knakahara
Date:           Mon Jun 20 07:06:06 UTC 2016

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

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

making MP-scalable is future work.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 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.125 src/sys/net/if_bridge.c:1.126
--- src/sys/net/if_bridge.c:1.125	Fri Jun 10 13:31:44 2016
+++ src/sys/net/if_bridge.c	Mon Jun 20 07:06:06 2016
@@ -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 @@ bridge_clone_create(struct if_clone *ifc
 
 	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 @@ bridge_enqueue(struct bridge_softc *sc, 
 	}
 
 #ifdef ALTQ
+	KERNEL_LOCK(1, NULL);
 	/*
 	 * If ALTQ is enabled on the member interface, do
 	 * classification; the queueing discipline might
@@ -1388,6 +1390,7 @@ bridge_enqueue(struct bridge_softc *sc, 
 		/* 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 @@ bridge_output(struct ifnet *ifp, struct 
 	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)

Reply via email to