o make debug_mpsafenet globally visible
o move it from subr_bus.c to netisr.c where it more properly belongs o add NET_PICKUP_GIANT and NET_DROP_GIANT macros that will be used to grab Giant as needed when MPSAFE operation is enabled Supported by: FreeBSD Foundation
This commit is contained in:
parent
09e99681c0
commit
0927f68a45
@ -2133,16 +2133,6 @@ bus_release_resource(device_t dev, int type, int rid, struct resource *r)
|
||||
return (BUS_RELEASE_RESOURCE(dev->parent, dev, type, rid, r));
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX this is a temporary measure to allow folks to
|
||||
* XXX disable INTR_MPSAFE in network drivers without
|
||||
* XXX recompiling--in case of problems.
|
||||
*/
|
||||
int debug_mpsafenet = 0;
|
||||
TUNABLE_INT("debug.mpsafenet", &debug_mpsafenet);
|
||||
SYSCTL_INT(_debug, OID_AUTO, mpsafenet, CTLFLAG_RW, &debug_mpsafenet, 0,
|
||||
"Enable/disable MPSAFE network support");
|
||||
|
||||
int
|
||||
bus_setup_intr(device_t dev, struct resource *r, int flags,
|
||||
driver_intr_t handler, void *arg, void **cookiep)
|
||||
|
@ -53,6 +53,16 @@
|
||||
#include <net/if_var.h>
|
||||
#include <net/netisr.h>
|
||||
|
||||
/*
|
||||
* XXX this is a temporary measure to allow folks to
|
||||
* XXX disable Giant locking in the network code without
|
||||
* XXX recompiling--in case of problems.
|
||||
*/
|
||||
int debug_mpsafenet = 0;
|
||||
TUNABLE_INT("debug.mpsafenet", &debug_mpsafenet);
|
||||
SYSCTL_INT(_debug, OID_AUTO, mpsafenet, CTLFLAG_RD, &debug_mpsafenet, 0,
|
||||
"Enable/disable MPSAFE network support");
|
||||
|
||||
volatile unsigned int netisr; /* scheduling bits for network */
|
||||
|
||||
struct netisr {
|
||||
|
@ -339,6 +339,27 @@ do { \
|
||||
WITNESS_RESTORE(&Giant.mtx_object, Giant)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Network MPSAFE temporary workarounds. When debug_mpsafenet
|
||||
* is 1 the network is assumed to operate without Giant on the
|
||||
* input path and protocols that require Giant must collect it
|
||||
* on entry. When 0 Giant is grabbed in the network interface
|
||||
* ISR's and in the netisr path and there is no need to grab
|
||||
* the Giant lock.
|
||||
*
|
||||
* This mechanism is intended as temporary until everything of
|
||||
* importance is properly locked.
|
||||
*/
|
||||
extern int debug_mpsafenet; /* defined in net/netisr.c */
|
||||
#define NET_PICKUP_GIANT() do { \
|
||||
if (debug_mpsafenet) \
|
||||
mtx_lock(&Giant); \
|
||||
} while (0)
|
||||
#define NET_DROP_GIANT() do { \
|
||||
if (debug_mpsafenet) \
|
||||
mtx_unlock(&Giant); \
|
||||
} while (0)
|
||||
|
||||
#define UGAR(rval) do { \
|
||||
int _val = (rval); \
|
||||
mtx_unlock(&Giant); \
|
||||
|
Loading…
x
Reference in New Issue
Block a user