summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2004-03-28 23:12:19 +0000
committerrwatson <rwatson@FreeBSD.org>2004-03-28 23:12:19 +0000
commit8525af93ba6480437f728263e83854a9a32f73cf (patch)
tree9e3775a969469558ff195cc47f30b057ef9e9c53
parentb1453a6a69890cd0a1c7ebafa1a67fbba3f6a436 (diff)
downloadFreeBSD-src-8525af93ba6480437f728263e83854a9a32f73cf.zip
FreeBSD-src-8525af93ba6480437f728263e83854a9a32f73cf.tar.gz
Invert the logic of NET_LOCK_GIANT(), and remove the one reference to it.
Previously, Giant would be grabbed at entry to the IP local delivery code when debug.mpsafenet was set to true, as that implied Giant wouldn't be grabbed in the driver path. Now, we will use this primitive to conditionally grab Giant in the event the entire network stack isn't running MPSAFE (debug.mpsafenet == 0).
-rw-r--r--sys/netinet/ip_input.c2
-rw-r--r--sys/sys/mutex.h6
2 files changed, 3 insertions, 5 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index b798092..d1c269c 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -936,9 +936,7 @@ DPRINTF(("ip_input: no SP, packet discarded\n"));/*XXX*/
*(struct sockaddr_in **)(mtag+1) = args.next_hop;
m_tag_prepend(m, mtag);
}
- NET_LOCK_GIANT();
(*inetsw[ip_protox[ip->ip_p]].pr_input)(m, hlen);
- NET_UNLOCK_GIANT();
return;
bad:
m_freem(m);
diff --git a/sys/sys/mutex.h b/sys/sys/mutex.h
index f86679d..d31f3ea 100644
--- a/sys/sys/mutex.h
+++ b/sys/sys/mutex.h
@@ -354,15 +354,15 @@ do { \
*/
extern int debug_mpsafenet; /* defined in net/netisr.c */
#define NET_LOCK_GIANT() do { \
- if (debug_mpsafenet) \
+ if (!debug_mpsafenet) \
mtx_lock(&Giant); \
} while (0)
#define NET_UNLOCK_GIANT() do { \
- if (debug_mpsafenet) \
+ if (!debug_mpsafenet) \
mtx_unlock(&Giant); \
} while (0)
#define NET_ASSERT_GIANT() do { \
- if (debug_mpsafenet) \
+ if (!debug_mpsafenet) \
mtx_assert(&Giant, MA_OWNED); \
} while (0)
OpenPOWER on IntegriCloud