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).
This commit is contained in:
Robert Watson 2004-03-28 23:12:19 +00:00
parent 323eaa7554
commit 7101d752b2
2 changed files with 3 additions and 5 deletions

View file

@ -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);

View file

@ -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)