summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2009-03-15 14:21:05 +0000
committerrwatson <rwatson@FreeBSD.org>2009-03-15 14:21:05 +0000
commit70b6a8119c02ed07bc12918814c950d358cb1885 (patch)
tree27cbcf88d527d4a8b421eca8e088d73a000fb83f /sys/netinet
parent0592710988a69ee8c560a0e065d714f7ff578d43 (diff)
downloadFreeBSD-src-70b6a8119c02ed07bc12918814c950d358cb1885.zip
FreeBSD-src-70b6a8119c02ed07bc12918814c950d358cb1885.tar.gz
Remove IFF_NEEDSGIANT, a compatibility infrastructure introduced
in FreeBSD 5.x to allow network device drivers to run with Giant despite the network stack being Giant-free. This significantly simplifies calls into ioctl() on network interfaces, especially in the multicast code, as well as eliminates deferred invocation of interface if_start routines. Disable the build on device drivers still depending on IFF_NEEDSGIANT as they no longer compile. They will be removed in a few weeks if they haven't been made MPSAFE in that time. Disabled drivers: if_ar if_axe if_aue if_cdce if_cue if_kue if_ray if_rue if_rum if_sr if_udav if_ural if_zyd Drivers that were already disabled because of tty changes: if_ppp if_sl Discussed on: arch@
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/in.c11
-rw-r--r--sys/netinet/in_mcast.c24
2 files changed, 2 insertions, 33 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index e2834bf..1927b5c 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -397,10 +397,8 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
oldaddr = ia->ia_dstaddr;
ia->ia_dstaddr = *(struct sockaddr_in *)&ifr->ifr_dstaddr;
if (ifp->if_ioctl != NULL) {
- IFF_LOCKGIANT(ifp);
error = (*ifp->if_ioctl)(ifp, SIOCSIFDSTADDR,
(caddr_t)ia);
- IFF_UNLOCKGIANT(ifp);
if (error) {
ia->ia_dstaddr = oldaddr;
return (error);
@@ -507,10 +505,7 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
default:
if (ifp == NULL || ifp->if_ioctl == NULL)
return (EOPNOTSUPP);
- IFF_LOCKGIANT(ifp);
- error = (*ifp->if_ioctl)(ifp, cmd, data);
- IFF_UNLOCKGIANT(ifp);
- return (error);
+ return ((*ifp->if_ioctl)(ifp, cmd, data));
}
/*
@@ -531,7 +526,6 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
IFP_TO_IA(ifp, oia);
if (oia == NULL) {
ii = ((struct in_ifinfo *)ifp->if_afdata[AF_INET]);
- IFF_LOCKGIANT(ifp);
IN_MULTI_LOCK();
if (ii->ii_allhosts) {
(void)in_leavegroup_locked(ii->ii_allhosts,
@@ -539,7 +533,6 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
ii->ii_allhosts = NULL;
}
IN_MULTI_UNLOCK();
- IFF_UNLOCKGIANT(ifp);
}
}
IFAFREE(&ia->ia_ifa);
@@ -753,9 +746,7 @@ in_ifinit(struct ifnet *ifp, struct in_ifaddr *ia, struct sockaddr_in *sin,
* and to validate the address if necessary.
*/
if (ifp->if_ioctl != NULL) {
- IFF_LOCKGIANT(ifp);
error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (caddr_t)ia);
- IFF_UNLOCKGIANT(ifp);
if (error) {
splx(s);
/* LIST_REMOVE(ia, ia_hash) is done in in_control */
diff --git a/sys/netinet/in_mcast.c b/sys/netinet/in_mcast.c
index 0c7e7e1..e91a5bf 100644
--- a/sys/netinet/in_mcast.c
+++ b/sys/netinet/in_mcast.c
@@ -1100,11 +1100,9 @@ in_joingroup(struct ifnet *ifp, const struct in_addr *gina,
{
int error;
- IFF_LOCKGIANT(ifp);
IN_MULTI_LOCK();
error = in_joingroup_locked(ifp, gina, imf, pinm);
IN_MULTI_UNLOCK();
- IFF_UNLOCKGIANT(ifp);
return (error);
}
@@ -1181,20 +1179,14 @@ int
in_leavegroup(struct in_multi *inm, /*const*/ struct in_mfilter *imf)
{
struct ifnet *ifp;
- int detached, error;
+ int error;
- detached = inm_is_ifp_detached(inm);
ifp = inm->inm_ifp;
- if (!detached)
- IFF_LOCKGIANT(ifp);
IN_MULTI_LOCK();
error = in_leavegroup_locked(inm, imf);
IN_MULTI_UNLOCK();
- if (!detached)
- IFF_UNLOCKGIANT(ifp);
-
return (error);
}
@@ -1396,8 +1388,6 @@ inp_block_unblock_source(struct inpcb *inp, struct sockopt *sopt)
if (!IN_MULTICAST(ntohl(gsa->sin.sin_addr.s_addr)))
return (EINVAL);
- IFF_LOCKGIANT(ifp);
-
/*
* Check if we are actually a member of this group.
*/
@@ -1486,7 +1476,6 @@ out_imf_rollback:
out_inp_locked:
INP_WUNLOCK(inp);
- IFF_UNLOCKGIANT(ifp);
return (error);
}
@@ -1978,8 +1967,6 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt)
if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0)
return (EADDRNOTAVAIL);
- IFF_LOCKGIANT(ifp);
-
/*
* MCAST_JOIN_SOURCE on an exclusive membership is an error.
* On an existing inclusive membership, it just adds the
@@ -2102,7 +2089,6 @@ out_imo_free:
out_inp_locked:
INP_WUNLOCK(inp);
- IFF_UNLOCKGIANT(ifp);
return (error);
}
@@ -2215,9 +2201,6 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sopt)
if (!IN_MULTICAST(ntohl(gsa->sin.sin_addr.s_addr)))
return (EINVAL);
- if (ifp)
- IFF_LOCKGIANT(ifp);
-
/*
* Find the membership in the membership array.
*/
@@ -2312,8 +2295,6 @@ out_imf_rollback:
out_inp_locked:
INP_WUNLOCK(inp);
- if (ifp)
- IFF_UNLOCKGIANT(ifp);
return (error);
}
@@ -2432,8 +2413,6 @@ inp_set_source_filters(struct inpcb *inp, struct sockopt *sopt)
if (ifp == NULL)
return (EADDRNOTAVAIL);
- IFF_LOCKGIANT(ifp);
-
/*
* Take the INP write lock.
* Check if this socket is a member of this group.
@@ -2551,7 +2530,6 @@ out_imf_rollback:
out_inp_locked:
INP_WUNLOCK(inp);
- IFF_UNLOCKGIANT(ifp);
return (error);
}
OpenPOWER on IntegriCloud