Module Name: src
Committed By: knakahara
Date: Mon Jun 20 08:24:36 UTC 2016
Modified Files:
src/sys/net: if.h
Log Message:
introduce if_start_lock()
if_start_lock() calls ifp->if_start() holding KERNEL_LOCK if it is required.
To generate a diff of this commit:
cvs rdiff -u -r1.210 -r1.211 src/sys/net/if.h
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.h
diff -u src/sys/net/if.h:1.210 src/sys/net/if.h:1.211
--- src/sys/net/if.h:1.210 Mon Jun 20 08:18:59 2016
+++ src/sys/net/if.h Mon Jun 20 08:24:36 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: if.h,v 1.210 2016/06/20 08:18:59 knakahara Exp $ */
+/* $NetBSD: if.h,v 1.211 2016/06/20 08:24:36 knakahara Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -406,6 +406,26 @@ if_output_lock(struct ifnet *cifp, struc
return ret;
}
}
+
+static inline bool
+if_start_is_mpsafe(struct ifnet *ifp)
+{
+
+ return ((ifp->if_extflags & IFEF_START_MPSAFE) != 0);
+}
+
+static inline void
+if_start_lock(struct ifnet *ifp)
+{
+
+ if (if_start_is_mpsafe(ifp)) {
+ (*ifp->if_start)(ifp);
+ } else {
+ KERNEL_LOCK(1, NULL);
+ (*ifp->if_start)(ifp);
+ KERNEL_UNLOCK_ONE(NULL);
+ }
+}
#endif /* _KERNEL */
#define IFFBITS \