1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-29 08:08:37 +00:00

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
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=127535
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)