On Fri, Aug 11, 2017 at 01:56:28PM -0400, Martin Pieuchot wrote:
> I believe it's time to move forward and completely remove the
> argument.  This will allow us to do more funky dances with the
> NET_LOCK().

OK bluhm@

> diff --git sys/dev/usb/if_umb.c sys/dev/usb/if_umb.c
> index 1fbf2ea9c15..8c6c9ccfbe9 100644
> --- sys/dev/usb/if_umb.c
> +++ sys/dev/usb/if_umb.c
> @@ -947,7 +947,7 @@ umb_state_task(void *arg)
>       struct ifnet *ifp = GET_IFP(sc);
>       struct ifreq ifr;
>       struct in_aliasreq ifra;
> -     int      s, ns;
> +     int      s;
>       int      state;
>  
>       s = splnet();
> @@ -971,7 +971,7 @@ umb_state_task(void *arg)
>                        */
>                       memset(sc->sc_info.ipv4dns, 0,
>                           sizeof (sc->sc_info.ipv4dns));
> -                     NET_LOCK(ns);
> +                     NET_LOCK();
>                       if (in_ioctl(SIOCGIFADDR, (caddr_t)&ifr, ifp, 1) == 0 &&
>                           satosin(&ifr.ifr_addr)->sin_addr.s_addr !=
>                           INADDR_ANY) {
> @@ -980,7 +980,7 @@ umb_state_task(void *arg)
>                                   sizeof (ifra.ifra_addr));
>                               in_ioctl(SIOCDIFADDR, (caddr_t)&ifra, ifp, 1);
>                       }
> -                     NET_UNLOCK(ns);
> +                     NET_UNLOCK();
>               }
>               if_link_state_change(ifp);
>       }
> @@ -1613,7 +1613,7 @@ umb_decode_ip_configuration(struct umb_softc *sc, void 
> *data, int len)
>  {
>       struct mbim_cid_ip_configuration_info *ic = data;
>       struct ifnet *ifp = GET_IFP(sc);
> -     int      s, ns;
> +     int      s;
>       uint32_t avail;
>       uint32_t val;
>       int      n, i;
> @@ -1667,9 +1667,9 @@ umb_decode_ip_configuration(struct umb_softc *sc, void 
> *data, int len)
>               sin->sin_len = sizeof (ifra.ifra_mask);
>               in_len2mask(&sin->sin_addr, ipv4elem.prefixlen);
>  
> -             NET_LOCK(ns);
> +             NET_LOCK();
>               rv = in_ioctl(SIOCAIFADDR, (caddr_t)&ifra, ifp, 1);
> -             NET_UNLOCK(ns);
> +             NET_UNLOCK();
>               if (rv == 0) {
>                       if (ifp->if_flags & IFF_DEBUG)
>                               log(LOG_INFO, "%s: IPv4 addr %s, mask %s, "
> diff --git sys/kern/kern_sysctl.c sys/kern/kern_sysctl.c
> index 7b71ccfde26..3eca46534e0 100644
> --- sys/kern/kern_sysctl.c
> +++ sys/kern/kern_sysctl.c
> @@ -1302,9 +1302,8 @@ sysctl_file(int *name, u_int namelen, char *where, 
> size_t *sizep,
>                       extern struct inpcbtable rawin6pcbtable;
>  #endif
>                       struct inpcb *inp;
> -                     int s;
>  
> -                     NET_LOCK(s);
> +                     NET_LOCK();
>                       TAILQ_FOREACH(inp, &tcbtable.inpt_queue, inp_queue)
>                               FILLSO(inp->inp_socket);
>                       TAILQ_FOREACH(inp, &udbtable.inpt_queue, inp_queue)
> @@ -1316,7 +1315,7 @@ sysctl_file(int *name, u_int namelen, char *where, 
> size_t *sizep,
>                           inp_queue)
>                               FILLSO(inp->inp_socket);
>  #endif
> -                     NET_UNLOCK(s);
> +                     NET_UNLOCK();
>               }
>               fp = LIST_FIRST(&filehead);
>               /* don't FREF when f_count == 0 to avoid race in fdrop() */
> diff --git sys/kern/sys_socket.c sys/kern/sys_socket.c
> index d842d0bd5c1..03883df1ece 100644
> --- sys/kern/sys_socket.c
> +++ sys/kern/sys_socket.c
> @@ -125,9 +125,9 @@ soo_ioctl(struct file *fp, u_long cmd, caddr_t data, 
> struct proc *p)
>                * different entry since a socket's unnecessary
>                */
>               if (IOCGROUP(cmd) == 'i') {
> -                     NET_LOCK(s);
> +                     NET_LOCK();
>                       error = ifioctl(so, cmd, data, p);
> -                     NET_UNLOCK(s);
> +                     NET_UNLOCK();
>                       return (error);
>               }
>               if (IOCGROUP(cmd) == 'r')
> diff --git sys/kern/uipc_domain.c sys/kern/uipc_domain.c
> index ce7091b540c..aad485b865f 100644
> --- sys/kern/uipc_domain.c
> +++ sys/kern/uipc_domain.c
> @@ -165,7 +165,7 @@ net_sysctl(int *name, u_int namelen, void *oldp, size_t 
> *oldlenp, void *newp,
>  {
>       struct domain *dp;
>       struct protosw *pr;
> -     int s, error, family, protocol;
> +     int error, family, protocol;
>  
>       /*
>        * All sysctl names at this level are nonterminal.
> @@ -207,10 +207,10 @@ net_sysctl(int *name, u_int namelen, void *oldp, size_t 
> *oldlenp, void *newp,
>       protocol = name[1];
>       for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
>               if (pr->pr_protocol == protocol && pr->pr_sysctl) {
> -                     NET_LOCK(s);
> +                     NET_LOCK();
>                       error = (*pr->pr_sysctl)(name + 2, namelen - 2,
>                           oldp, oldlenp, newp, newlen);
> -                     NET_UNLOCK(s);
> +                     NET_UNLOCK();
>                       return (error);
>               }
>       return (ENOPROTOOPT);
> @@ -238,15 +238,15 @@ pfslowtimo(void *arg)
>       struct timeout *to = (struct timeout *)arg;
>       struct domain *dp;
>       struct protosw *pr;
> -     int i, s;
> +     int i;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       for (i = 0; (dp = domains[i]) != NULL; i++) {
>               for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
>                       if (pr->pr_slowtimo)
>                               (*pr->pr_slowtimo)();
>       }
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       timeout_add_msec(to, 500);
>  }
>  
> @@ -256,14 +256,14 @@ pffasttimo(void *arg)
>       struct timeout *to = (struct timeout *)arg;
>       struct domain *dp;
>       struct protosw *pr;
> -     int i, s;
> +     int i;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       for (i = 0; (dp = domains[i]) != NULL; i++) {
>               for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
>                       if (pr->pr_fasttimo)
>                               (*pr->pr_fasttimo)();
>       }
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       timeout_add_msec(to, 200);
>  }
> diff --git sys/kern/uipc_socket2.c sys/kern/uipc_socket2.c
> index edfdc993bb9..5c8f85c9718 100644
> --- sys/kern/uipc_socket2.c
> +++ sys/kern/uipc_socket2.c
> @@ -276,12 +276,12 @@ socantrcvmore(struct socket *so)
>  int
>  solock(struct socket *so)
>  {
> -     int s;
> +     int s = 0;
>  
>       if ((so->so_proto->pr_domain->dom_family != PF_LOCAL) &&
>           (so->so_proto->pr_domain->dom_family != PF_ROUTE) &&
>           (so->so_proto->pr_domain->dom_family != PF_KEY))
> -             NET_LOCK(s);
> +             NET_LOCK();
>       else
>               s = -42;
>  
> @@ -292,7 +292,7 @@ void
>  sounlock(int s)
>  {
>       if (s != -42)
> -             NET_UNLOCK(s);
> +             NET_UNLOCK();
>  }
>  
>  void
> diff --git sys/net/bpf.c sys/net/bpf.c
> index 2d8ebb7bbda..eac81a95fab 100644
> --- sys/net/bpf.c
> +++ sys/net/bpf.c
> @@ -580,7 +580,7 @@ bpfwrite(dev_t dev, struct uio *uio, int ioflag)
>       struct mbuf *m;
>       struct bpf_program *bf;
>       struct bpf_insn *fcode = NULL;
> -     int error, s;
> +     int error;
>       struct sockaddr_storage dst;
>       u_int dlt;
>  
> @@ -626,9 +626,9 @@ bpfwrite(dev_t dev, struct uio *uio, int ioflag)
>       if (d->bd_hdrcmplt && dst.ss_family == AF_UNSPEC)
>               dst.ss_family = pseudo_AF_HDRCMPLT;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       error = ifp->if_output(ifp, m, sstosa(&dst), NULL);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>  out:
>       bpf_put(d);
> diff --git sys/net/if.c sys/net/if.c
> index f65b0d3800f..edbb4f87655 100644
> --- sys/net/if.c
> +++ sys/net/if.c
> @@ -511,25 +511,21 @@ if_attachdomain(struct ifnet *ifp)
>  void
>  if_attachhead(struct ifnet *ifp)
>  {
> -     int s;
> -
>       if_attach_common(ifp);
> -     NET_LOCK(s);
> +     NET_LOCK();
>       TAILQ_INSERT_HEAD(&ifnet, ifp, if_list);
>       if_attachsetup(ifp);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  void
>  if_attach(struct ifnet *ifp)
>  {
> -     int s;
> -
>       if_attach_common(ifp);
> -     NET_LOCK(s);
> +     NET_LOCK();
>       TAILQ_INSERT_TAIL(&ifnet, ifp, if_list);
>       if_attachsetup(ifp);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  void
> @@ -875,7 +871,7 @@ if_input_process(void *xifidx)
>       struct ifnet *ifp;
>       struct ifih *ifih;
>       struct srp_ref sr;
> -     int s, s2;
> +     int s;
>  #ifdef IPSEC
>       int locked = 0;
>  #endif /* IPSEC */
> @@ -916,7 +912,7 @@ if_input_process(void *xifidx)
>        * to PF globals, pipex globals, unicast and multicast addresses
>        * lists.
>        */
> -     NET_LOCK(s2);
> +     NET_LOCK();
>       s = splnet();
>       while ((m = ml_dequeue(&ml)) != NULL) {
>               /*
> @@ -933,7 +929,7 @@ if_input_process(void *xifidx)
>                       m_freem(m);
>       }
>       splx(s);
> -     NET_UNLOCK(s2);
> +     NET_UNLOCK();
>  
>  #ifdef IPSEC
>       if (locked)
> @@ -947,17 +943,16 @@ void
>  if_netisr(void *unused)
>  {
>       int n, t = 0;
> -     int s;
>  
>       KERNEL_LOCK();
> -     NET_LOCK(s);
> +     NET_LOCK();
>  
>       while ((n = netisr) != 0) {
>               /* Like sched_pause() but with a rwlock dance. */
>               if (curcpu()->ci_schedstate.spc_schedflags & SPCF_SHOULDYIELD) {
> -                     NET_UNLOCK(s);
> +                     NET_UNLOCK();
>                       yield();
> -                     NET_LOCK(s);
> +                     NET_LOCK();
>               }
>  
>               atomic_clearbits_int(&netisr, n);
> @@ -1000,16 +995,14 @@ if_netisr(void *unused)
>               pfsyncintr();
>  #endif
>  
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       KERNEL_UNLOCK();
>  }
>  
>  void
>  if_deactivate(struct ifnet *ifp)
>  {
> -     int s;
> -
> -     NET_LOCK(s);
> +     NET_LOCK();
>       /*
>        * Call detach hooks from head to tail.  To make sure detach
>        * hooks are executed in the reverse order they were added, all
> @@ -1022,7 +1015,7 @@ if_deactivate(struct ifnet *ifp)
>       if (ifp->if_carp && ifp->if_type != IFT_CARP)
>               carp_ifdetach(ifp);
>  #endif
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  /*
> @@ -1035,7 +1028,7 @@ if_detach(struct ifnet *ifp)
>       struct ifaddr *ifa;
>       struct ifg_list *ifg;
>       struct domain *dp;
> -     int i, s, s2;
> +     int i, s;
>  
>       /* Undo pseudo-driver changes. */
>       if_deactivate(ifp);
> @@ -1045,8 +1038,8 @@ if_detach(struct ifnet *ifp)
>       /* Other CPUs must not have a reference before we start destroying. */
>       if_idxmap_remove(ifp);
>  
> -     NET_LOCK(s);
> -     s2 = splnet();
> +     NET_LOCK();
> +     s = splnet();
>       ifp->if_qstart = if_detached_qstart;
>       ifp->if_ioctl = if_detached_ioctl;
>       ifp->if_watchdog = NULL;
> @@ -1118,8 +1111,8 @@ if_detach(struct ifnet *ifp)
>  
>       /* Announce that the interface is gone. */
>       rtm_ifannounce(ifp, IFAN_DEPARTURE);
> -     splx(s2);
> -     NET_UNLOCK(s);
> +     splx(s);
> +     NET_UNLOCK();
>  
>       for (i = 0; i < ifp->if_nifqs; i++)
>               ifq_destroy(ifp->if_ifqs[i]);
> @@ -1523,9 +1516,8 @@ if_downall(void)
>  {
>       struct ifreq ifrq;      /* XXX only partly built */
>       struct ifnet *ifp;
> -     int s;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       TAILQ_FOREACH(ifp, &ifnet, if_list) {
>               if ((ifp->if_flags & IFF_UP) == 0)
>                       continue;
> @@ -1536,7 +1528,7 @@ if_downall(void)
>                           (caddr_t)&ifrq);
>               }
>       }
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  /*
> @@ -1585,17 +1577,16 @@ if_linkstate_task(void *xifidx)
>  {
>       unsigned int ifidx = (unsigned long)xifidx;
>       struct ifnet *ifp;
> -     int s;
>  
>       KERNEL_LOCK();
> -     NET_LOCK(s);
> +     NET_LOCK();
>  
>       ifp = if_get(ifidx);
>       if (ifp != NULL)
>               if_linkstate(ifp);
>       if_put(ifp);
>  
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       KERNEL_UNLOCK();
>  }
>  
> diff --git sys/net/if_enc.c sys/net/if_enc.c
> index a12ce47e2d1..3f0ba1956ae 100644
> --- sys/net/if_enc.c
> +++ sys/net/if_enc.c
> @@ -72,7 +72,7 @@ enc_clone_create(struct if_clone *ifc, int unit)
>       struct ifnet            *ifp;
>       struct ifnet            **new;
>       size_t                   newlen;
> -     int                      s, error;
> +     int                      error;
>  
>       if (unit > ENC_MAX_UNITS)
>               return (EINVAL);
> @@ -111,10 +111,10 @@ enc_clone_create(struct if_clone *ifc, int unit)
>  #if NBPFILTER > 0
>       bpfattach(&ifp->if_bpf, ifp, DLT_ENC, ENC_HDRLEN);
>  #endif
> -     NET_LOCK(s);
> +     NET_LOCK();
>       error = enc_setif(ifp, 0);
>       if (error != 0) {
> -             NET_UNLOCK(s);
> +             NET_UNLOCK();
>               if_detach(ifp);
>               free(sc, M_DEVBUF, 0);
>               return (error);
> @@ -123,7 +123,7 @@ enc_clone_create(struct if_clone *ifc, int unit)
>       if (unit == 0 || unit > enc_max_unit) {
>               if ((new = mallocarray(unit + 1, sizeof(struct ifnet *),
>                   M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL) {
> -                     NET_UNLOCK(s);
> +                     NET_UNLOCK();
>                       return (ENOBUFS);
>               }
>               newlen = sizeof(struct ifnet *) * (unit + 1);
> @@ -137,7 +137,7 @@ enc_clone_create(struct if_clone *ifc, int unit)
>               enc_max_unit = unit;
>       }
>       enc_allifps[unit] = ifp;
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       return (0);
>  }
> @@ -146,16 +146,15 @@ int
>  enc_clone_destroy(struct ifnet *ifp)
>  {
>       struct enc_softc        *sc = ifp->if_softc;
> -     int                      s;
>  
>       /* Protect users from removing enc0 */
>       if (sc->sc_unit == 0)
>               return (EPERM);
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       enc_allifps[sc->sc_unit] = NULL;
>       enc_unsetif(ifp);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       if_detach(ifp);
>       free(sc, M_DEVBUF, 0);
> diff --git sys/net/if_gif.c sys/net/if_gif.c
> index 3b46296a63e..742c856864c 100644
> --- sys/net/if_gif.c
> +++ sys/net/if_gif.c
> @@ -106,7 +106,6 @@ int
>  gif_clone_create(struct if_clone *ifc, int unit)
>  {
>       struct gif_softc *sc;
> -     int s;
>  
>       sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT|M_ZERO);
>       if (!sc)
> @@ -130,9 +129,9 @@ gif_clone_create(struct if_clone *ifc, int unit)
>  #if NBPFILTER > 0
>       bpfattach(&sc->gif_if.if_bpf, &sc->gif_if, DLT_LOOP, sizeof(u_int32_t));
>  #endif
> -     NET_LOCK(s);
> +     NET_LOCK();
>       LIST_INSERT_HEAD(&gif_softc_list, sc, gif_list);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       return (0);
>  }
> @@ -141,11 +140,10 @@ int
>  gif_clone_destroy(struct ifnet *ifp)
>  {
>       struct gif_softc *sc = ifp->if_softc;
> -     int s;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       LIST_REMOVE(sc, gif_list);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       if_detach(ifp);
>  
> diff --git sys/net/if_gre.c sys/net/if_gre.c
> index b3d24c1f988..fd73fb55922 100644
> --- sys/net/if_gre.c
> +++ sys/net/if_gre.c
> @@ -121,7 +121,6 @@ int
>  gre_clone_create(struct if_clone *ifc, int unit)
>  {
>       struct gre_softc *sc;
> -     int s;
>  
>       sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT|M_ZERO);
>       if (!sc)
> @@ -163,9 +162,9 @@ gre_clone_create(struct if_clone *ifc, int unit)
>  #if NBPFILTER > 0
>       bpfattach(&sc->sc_if.if_bpf, &sc->sc_if, DLT_LOOP, sizeof(u_int32_t));
>  #endif
> -     NET_LOCK(s);
> +     NET_LOCK();
>       LIST_INSERT_HEAD(&gre_softc_list, sc, sc_list);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       return (0);
>  }
> @@ -174,13 +173,12 @@ int
>  gre_clone_destroy(struct ifnet *ifp)
>  {
>       struct gre_softc *sc = ifp->if_softc;
> -     int s;
>  
>       timeout_del(&sc->sc_ka_snd);
>       timeout_del(&sc->sc_ka_hold);
> -     NET_LOCK(s);
> +     NET_LOCK();
>       LIST_REMOVE(sc, sc_list);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       if_detach(ifp);
>  
> @@ -612,7 +610,6 @@ gre_send_keepalive(void *arg)
>       struct ip *ip;
>       struct gre_h *gh;
>       struct sockaddr dst;
> -     int s;
>  
>       if (sc->sc_ka_timout)
>               timeout_add_sec(&sc->sc_ka_snd, sc->sc_ka_timout);
> @@ -658,10 +655,10 @@ gre_send_keepalive(void *arg)
>       bzero(&dst, sizeof(dst));
>       dst.sa_family = AF_INET;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       /* should we care about the error? */
>       gre_output(&sc->sc_if, m, &dst, NULL);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  void
> diff --git sys/net/if_pflog.c sys/net/if_pflog.c
> index fc8e1c60b3c..6ec6e277e4d 100644
> --- sys/net/if_pflog.c
> +++ sys/net/if_pflog.c
> @@ -136,7 +136,6 @@ pflog_clone_create(struct if_clone *ifc, int unit)
>  {
>       struct ifnet *ifp;
>       struct pflog_softc *pflogif;
> -     int s;
>  
>       if ((pflogif = malloc(sizeof(*pflogif),
>           M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL)
> @@ -161,13 +160,13 @@ pflog_clone_create(struct if_clone *ifc, int unit)
>       bpfattach(&pflogif->sc_if.if_bpf, ifp, DLT_PFLOG, PFLOG_HDRLEN);
>  #endif
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       if (unit + 1 > npflogifs && pflogifs_resize(unit + 1) != 0) {
> -             NET_UNLOCK(s);
> +             NET_UNLOCK();
>               return (ENOMEM);
>       }
>       pflogifs[unit] = ifp;
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       return (0);
>  }
> @@ -176,15 +175,15 @@ int
>  pflog_clone_destroy(struct ifnet *ifp)
>  {
>       struct pflog_softc      *pflogif = ifp->if_softc;
> -     int                      s, i;
> +     int                      i;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       pflogifs[pflogif->sc_unit] = NULL;
>       for (i = npflogifs; i > 0 && pflogifs[i - 1] == NULL; i--)
>               ; /* nothing */
>       if (i < npflogifs)
>               pflogifs_resize(i);     /* error harmless here */
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       if_detach(ifp);
>       free(pflogif, M_DEVBUF, 0);
> diff --git sys/net/if_pflow.c sys/net/if_pflow.c
> index 64a7e916a51..976b411a8b8 100644
> --- sys/net/if_pflow.c
> +++ sys/net/if_pflow.c
> @@ -145,7 +145,6 @@ pflow_clone_create(struct if_clone *ifc, int unit)
>  {
>       struct ifnet            *ifp;
>       struct pflow_softc      *pflowif;
> -     int                      s;
>  
>       if ((pflowif = malloc(sizeof(*pflowif),
>           M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL)
> @@ -267,9 +266,9 @@ pflow_clone_create(struct if_clone *ifc, int unit)
>       task_set(&pflowif->sc_outputtask, pflow_output_process, pflowif);
>  
>       /* Insert into list of pflows */
> -     NET_LOCK(s);
> +     NET_LOCK();
>       SLIST_INSERT_HEAD(&pflowif_list, pflowif, sc_next);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       return (0);
>  }
>  
> @@ -277,7 +276,7 @@ int
>  pflow_clone_destroy(struct ifnet *ifp)
>  {
>       struct pflow_softc      *sc = ifp->if_softc;
> -     int                      s, error;
> +     int                      error;
>  
>       error = 0;
>  
> @@ -300,9 +299,9 @@ pflow_clone_destroy(struct ifnet *ifp)
>       if (sc->sc_flowsrc != NULL)
>               free(sc->sc_flowsrc, M_DEVBUF, sc->sc_flowsrc->sa_len);
>       if_detach(ifp);
> -     NET_LOCK(s);
> +     NET_LOCK();
>       SLIST_REMOVE(&pflowif_list, sc, pflow_softc, sc_next);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       free(sc, M_DEVBUF, sizeof(*sc));
>       return (error);
>  }
> diff --git sys/net/if_pfsync.c sys/net/if_pfsync.c
> index bda5a865a42..197c530072d 100644
> --- sys/net/if_pfsync.c
> +++ sys/net/if_pfsync.c
> @@ -1794,11 +1794,9 @@ pfsync_undefer(struct pfsync_deferral *pd, int drop)
>  void
>  pfsync_defer_tmo(void *arg)
>  {
> -     int s;
> -
> -     NET_LOCK(s);
> +     NET_LOCK();
>       pfsync_undefer(arg, 0);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  void
> @@ -2212,9 +2210,8 @@ pfsync_bulk_update(void *arg)
>       struct pfsync_softc *sc = arg;
>       struct pf_state *st;
>       int i = 0;
> -     int s;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       st = sc->sc_bulk_next;
>  
>       for (;;) {
> @@ -2245,7 +2242,7 @@ pfsync_bulk_update(void *arg)
>                       break;
>               }
>       }
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  void
> @@ -2275,10 +2272,8 @@ void
>  pfsync_bulk_fail(void *arg)
>  {
>       struct pfsync_softc *sc = arg;
> -     int s;
> -
> -     NET_LOCK(s);
>  
> +     NET_LOCK();
>       if (sc->sc_bulk_tries++ < PFSYNC_MAX_BULKTRIES) {
>               /* Try again */
>               timeout_add_sec(&sc->sc_bulkfail_tmo, 5);
> @@ -2303,7 +2298,7 @@ pfsync_bulk_fail(void *arg)
>               sc->sc_link_demoted = 0;
>               DPFPRINTF(LOG_ERR, "failed to receive bulk update");
>       }
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  void
> @@ -2350,11 +2345,9 @@ pfsync_state_in_use(struct pf_state *st)
>  void
>  pfsync_timeout(void *arg)
>  {
> -     int s;
> -
> -     NET_LOCK(s);
> +     NET_LOCK();
>       pfsync_sendout();
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  /* this is a softnet/netisr handler */
> diff --git sys/net/if_ppp.c sys/net/if_ppp.c
> index fb970b1302f..24f38fe88fe 100644
> --- sys/net/if_ppp.c
> +++ sys/net/if_ppp.c
> @@ -204,7 +204,6 @@ int
>  ppp_clone_create(struct if_clone *ifc, int unit)
>  {
>       struct ppp_softc *sc;
> -     int s;
>  
>       sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT|M_ZERO);
>       if (!sc)
> @@ -230,9 +229,9 @@ ppp_clone_create(struct if_clone *ifc, int unit)
>  #if NBPFILTER > 0
>       bpfattach(&sc->sc_bpf, &sc->sc_if, DLT_PPP, PPP_HDRLEN);
>  #endif
> -     NET_LOCK(s);
> +     NET_LOCK();
>       LIST_INSERT_HEAD(&ppp_softc_list, sc, sc_list);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       return (0);
>  }
> @@ -241,14 +240,13 @@ int
>  ppp_clone_destroy(struct ifnet *ifp)
>  {
>       struct ppp_softc *sc = ifp->if_softc;
> -     int s;
>  
>       if (sc->sc_devp != NULL)
>               return (EBUSY);
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       LIST_REMOVE(sc, sc_list);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       if_detach(ifp);
>  
> @@ -262,14 +260,14 @@ ppp_clone_destroy(struct ifnet *ifp)
>  struct ppp_softc *
>  pppalloc(pid_t pid)
>  {
> -     int i, s;
> +     int i;
>       struct ppp_softc *sc;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       LIST_FOREACH(sc, &ppp_softc_list, sc_list) {
>               if (sc->sc_xfer == pid) {
>                       sc->sc_xfer = 0;
> -                     NET_UNLOCK(s);
> +                     NET_UNLOCK();
>                       return sc;
>               }
>       }
> @@ -277,7 +275,7 @@ pppalloc(pid_t pid)
>               if (sc->sc_devp == NULL)
>                       break;
>       }
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       if (sc == NULL)
>               return NULL;
>  
> @@ -309,9 +307,8 @@ void
>  pppdealloc(struct ppp_softc *sc)
>  {
>       struct ppp_pkt *pkt;
> -     int s;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       if_down(&sc->sc_if);
>       sc->sc_if.if_flags &= ~IFF_RUNNING;
>       sc->sc_devp = NULL;
> @@ -346,7 +343,7 @@ pppdealloc(struct ppp_softc *sc)
>               sc->sc_comp = 0;
>       }
>  #endif
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  /*
> diff --git sys/net/if_pppoe.c sys/net/if_pppoe.c
> index 04116ef1ee2..b8f7cdde17f 100644
> --- sys/net/if_pppoe.c
> +++ sys/net/if_pppoe.c
> @@ -196,7 +196,6 @@ pppoe_clone_create(struct if_clone *ifc, int unit)
>  {
>       struct pppoe_softc *sc, *tmpsc;
>       u_int32_t unique;
> -     int s;
>  
>          sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_CANFAIL|M_ZERO);
>          if (sc == NULL)
> @@ -232,7 +231,7 @@ pppoe_clone_create(struct if_clone *ifc, int unit)
>       bpfattach(&sc->sc_sppp.pp_if.if_bpf, &sc->sc_sppp.pp_if, DLT_PPP_ETHER, 
> 0);
>  #endif
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>  retry:
>       unique = arc4random();
>       LIST_FOREACH(tmpsc, &pppoe_softc_list, sc_list)
> @@ -240,7 +239,7 @@ retry:
>                       goto retry;
>       sc->sc_unique = unique;
>       LIST_INSERT_HEAD(&pppoe_softc_list, sc, sc_list);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       return (0);
>  }
> @@ -250,11 +249,10 @@ int
>  pppoe_clone_destroy(struct ifnet *ifp)
>  {
>       struct pppoe_softc *sc = ifp->if_softc;
> -     int s;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       LIST_REMOVE(sc, sc_list);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       timeout_del(&sc->sc_timeout);
>  
> @@ -1054,11 +1052,11 @@ static void
>  pppoe_timeout(void *arg)
>  {
>       struct pppoe_softc *sc = (struct pppoe_softc *)arg;
> -     int s, x, retry_wait, err;
> +     int x, retry_wait, err;
>  
>       PPPOEDEBUG(("%s: timeout\n", sc->sc_sppp.pp_if.if_xname));
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>  
>       switch (sc->sc_state) {
>       case PPPOE_STATE_PADI_SENT:
> @@ -1130,7 +1128,7 @@ pppoe_timeout(void *arg)
>               break;  /* all done, work in peace */
>       }
>  
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  /* Start a connection (i.e. initiate discovery phase). */
> diff --git sys/net/if_pppx.c sys/net/if_pppx.c
> index 1bb9e45dc2f..b2957ff5d10 100644
> --- sys/net/if_pppx.c
> +++ sys/net/if_pppx.c
> @@ -277,7 +277,6 @@ pppxread(dev_t dev, struct uio *uio, int ioflag)
>       struct pppx_dev *pxd = pppx_dev2pxd(dev);
>       struct mbuf *m, *m0;
>       int error = 0;
> -     int s;
>       size_t len;
>  
>       if (!pxd)
> @@ -287,11 +286,11 @@ pppxread(dev_t dev, struct uio *uio, int ioflag)
>               if (ISSET(ioflag, IO_NDELAY))
>                       return (EWOULDBLOCK);
>  
> -             NET_LOCK(s);
> +             NET_LOCK();
>               pxd->pxd_waiting = 1;
>               error = rwsleep(pxd, &netlock,
>                   (PZERO + 1)|PCATCH, "pppxread", 0);
> -             NET_UNLOCK(s);
> +             NET_UNLOCK();
>               if (error != 0) {
>                       return (error);
>               }
> @@ -414,9 +413,9 @@ int
>  pppxioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
>  {
>       struct pppx_dev *pxd = pppx_dev2pxd(dev);
> -     int s, error = 0;
> +     int error = 0;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       switch (cmd) {
>       case PIPEXSMODE:
>               /*
> @@ -466,7 +465,7 @@ pppxioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, 
> struct proc *p)
>               error = ENOTTY;
>               break;
>       }
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       return (error);
>  }
> diff --git sys/net/if_spppsubr.c sys/net/if_spppsubr.c
> index 1c745073c65..0092dc41313 100644
> --- sys/net/if_spppsubr.c
> +++ sys/net/if_spppsubr.c
> @@ -4045,10 +4045,10 @@ void
>  sppp_keepalive(void *dummy)
>  {
>       struct sppp *sp;
> -     int s, sl;
> +     int s;
>       struct timeval tv;
>  
> -     NET_LOCK(sl);
> +     NET_LOCK();
>       s = splnet();
>       getmicrouptime(&tv);
>       for (sp=spppq; sp; sp=sp->pp_next) {
> @@ -4100,7 +4100,7 @@ sppp_keepalive(void *dummy)
>               }
>       }
>       splx(s);
> -     NET_UNLOCK(sl);
> +     NET_UNLOCK();
>       timeout_add_sec(&keepalive_ch, 10);
>  }
>  
> @@ -4189,7 +4189,6 @@ sppp_set_ip_addrs(void *arg1)
>       struct ifaddr *ifa;
>       struct sockaddr_in *si;
>       struct sockaddr_in *dest;
> -     int s;
>  
>       sppp_get_ip_addrs(sp, &myaddr, &hisaddr, NULL);
>       if ((sp->ipcp.flags & IPCP_MYADDR_DYN) &&
> @@ -4200,7 +4199,7 @@ sppp_set_ip_addrs(void *arg1)
>               hisaddr = sp->ipcp.req_hisaddr;
>  
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       /*
>        * Pick the first AF_INET address from the list,
>        * aliases don't make any sense on a p2p link anyway.
> @@ -4244,7 +4243,7 @@ sppp_set_ip_addrs(void *arg1)
>               sppp_update_gw(ifp);
>       }
>  out:
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  /*
> @@ -4261,9 +4260,8 @@ sppp_clear_ip_addrs(void *arg1)
>       struct sockaddr_in *si;
>       struct sockaddr_in *dest;
>       u_int32_t remote;
> -     int s;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>  
>       if (sp->ipcp.flags & IPCP_HISADDR_DYN)
>               remote = sp->ipcp.saved_hisaddr;
> @@ -4305,7 +4303,7 @@ sppp_clear_ip_addrs(void *arg1)
>               sppp_update_gw(ifp);
>       }
>  out:
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  
> @@ -4356,9 +4354,9 @@ sppp_update_ip6_addr(void *arg)
>       struct in6_aliasreq *ifra = &sp->ipv6cp.req_ifid;
>       struct in6_addr mask = in6mask128;
>       struct in6_ifaddr *ia6;
> -     int s, error;
> +     int error;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>  
>       ia6 = in6ifa_ifpforlinklocal(ifp, 0);
>       if (ia6 == NULL) {
> @@ -4399,7 +4397,7 @@ sppp_update_ip6_addr(void *arg)
>                   SPP_ARGS(ifp), error);
>       }
>  out:
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  /*
> diff --git sys/net/if_trunk.c sys/net/if_trunk.c
> index d9a6d9995ee..3048a5b5e3f 100644
> --- sys/net/if_trunk.c
> +++ sys/net/if_trunk.c
> @@ -210,20 +210,20 @@ trunk_clone_destroy(struct ifnet *ifp)
>  {
>       struct trunk_softc *tr = (struct trunk_softc *)ifp->if_softc;
>       struct trunk_port *tp;
> -     int s, error;
> +     int error;
>  
>       /* Remove any multicast groups that we may have joined. */
>       trunk_ether_purgemulti(tr);
>  
>       /* Shutdown and remove trunk ports, return on error */
> -     NET_LOCK(s);
> +     NET_LOCK();
>       while ((tp = SLIST_FIRST(&tr->tr_ports)) != NULL) {
>               if ((error = trunk_port_destroy(tp)) != 0) {
> -                     NET_UNLOCK(s);
> +                     NET_UNLOCK();
>                       return (error);
>               }
>       }
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       ifmedia_delete_instance(&tr->tr_media, IFM_INST_ANY);
>       ether_ifdetach(ifp);
> diff --git sys/net/if_tun.c sys/net/if_tun.c
> index 80eaabff78e..96cd4211dd2 100644
> --- sys/net/if_tun.c
> +++ sys/net/if_tun.c
> @@ -309,12 +309,12 @@ tunopen(dev_t dev, int flag, int mode, struct proc *p)
>  
>       if ((tp = tun_lookup(minor(dev))) == NULL) {    /* create on demand */
>               char    xname[IFNAMSIZ];
> -             int     s, error;
> +             int     error;
>  
>               snprintf(xname, sizeof(xname), "%s%d", "tun", minor(dev));
> -             NET_LOCK(s);
> +             NET_LOCK();
>               error = if_clone_create(xname, rdomain);
> -             NET_UNLOCK(s);
> +             NET_UNLOCK();
>               if (error != 0)
>                       return (error);
>  
> @@ -334,12 +334,12 @@ tapopen(dev_t dev, int flag, int mode, struct proc *p)
>  
>       if ((tp = tap_lookup(minor(dev))) == NULL) {    /* create on demand */
>               char    xname[IFNAMSIZ];
> -             int     s, error;
> +             int     error;
>  
>               snprintf(xname, sizeof(xname), "%s%d", "tap", minor(dev));
> -             NET_LOCK(s);
> +             NET_LOCK();
>               error = if_clone_create(xname, rdomain);
> -             NET_UNLOCK(s);
> +             NET_UNLOCK();
>               if (error != 0)
>                       return (error);
>  
> @@ -399,7 +399,7 @@ tapclose(dev_t dev, int flag, int mode, struct proc *p)
>  int
>  tun_dev_close(struct tun_softc *tp, int flag, int mode, struct proc *p)
>  {
> -     int                      s, error = 0;
> +     int                      error = 0;
>       struct ifnet            *ifp;
>  
>       ifp = &tp->tun_if;
> @@ -415,9 +415,9 @@ tun_dev_close(struct tun_softc *tp, int flag, int mode, 
> struct proc *p)
>       TUNDEBUG(("%s: closed\n", ifp->if_xname));
>  
>       if (!(tp->tun_flags & TUN_STAYUP)) {
> -             NET_LOCK(s);
> +             NET_LOCK();
>               error = if_clone_destroy(ifp->if_xname);
> -             NET_UNLOCK(s);
> +             NET_UNLOCK();
>       } else {
>               tp->tun_pgid = 0;
>               selwakeup(&tp->tun_rsel);
> @@ -837,7 +837,7 @@ tun_dev_write(struct tun_softc *tp, struct uio *uio, int 
> ioflag)
>       struct ifnet            *ifp;
>       u_int32_t               *th;
>       struct mbuf             *top, **mp, *m;
> -     int                     error = 0, tlen, s;
> +     int                     error = 0, tlen;
>       size_t                  mlen;
>  
>       ifp = &tp->tun_if;
> @@ -930,7 +930,7 @@ tun_dev_write(struct tun_softc *tp, struct uio *uio, int 
> ioflag)
>       ifp->if_ipackets++;
>       ifp->if_ibytes += top->m_pkthdr.len;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>  
>       switch (ntohl(*th)) {
>       case AF_INET:
> @@ -947,7 +947,7 @@ tun_dev_write(struct tun_softc *tp, struct uio *uio, int 
> ioflag)
>               break;
>       }
>  
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       return (error);
>  }
> diff --git sys/net/if_vxlan.c sys/net/if_vxlan.c
> index 18a1dfb47bd..22122f63949 100644
> --- sys/net/if_vxlan.c
> +++ sys/net/if_vxlan.c
> @@ -178,11 +178,10 @@ int
>  vxlan_clone_destroy(struct ifnet *ifp)
>  {
>       struct vxlan_softc      *sc = ifp->if_softc;
> -     int                      s;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       vxlan_multicast_cleanup(ifp);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       vxlan_enable--;
>       LIST_REMOVE(sc, sc_entry);
> diff --git sys/net/pf.c sys/net/pf.c
> index f8c2e49e1d4..b009841f925 100644
> --- sys/net/pf.c
> +++ sys/net/pf.c
> @@ -1213,10 +1213,9 @@ void
>  pf_purge(void *xnloops)
>  {
>       int *nloops = xnloops;
> -     int s;
>  
>       KERNEL_LOCK();
> -     NET_LOCK(s);
> +     NET_LOCK();
>  
>       PF_LOCK();
>       /* process a fraction of the state table every second */
> @@ -1237,7 +1236,7 @@ pf_purge(void *xnloops)
>               pf_purge_expired_fragments();
>               *nloops = 0;
>       }
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       KERNEL_UNLOCK();
>  
>       timeout_add(&pf_purge_to, 1 * hz);
> diff --git sys/net/pf_ioctl.c sys/net/pf_ioctl.c
> index f6711c89b63..4e66aa46107 100644
> --- sys/net/pf_ioctl.c
> +++ sys/net/pf_ioctl.c
> @@ -905,7 +905,6 @@ pf_addr_copyout(struct pf_addr_wrap *addr)
>  int
>  pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
>  {
> -     int                      s;
>       int                      error = 0;
>  
>       /* XXX keep in sync with switch() below */
> @@ -1003,7 +1002,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, 
> struct proc *p)
>                       return (EACCES);
>               }
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       PF_LOCK();
>       switch (cmd) {
>  
> @@ -2476,7 +2475,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, 
> struct proc *p)
>       }
>  fail:
>       PF_UNLOCK();
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       return (error);
>  }
>  
> diff --git sys/net/pfkeyv2.c sys/net/pfkeyv2.c
> index ad6f6cb89d1..d56716c59ab 100644
> --- sys/net/pfkeyv2.c
> +++ sys/net/pfkeyv2.c
> @@ -934,7 +934,7 @@ pfkeyv2_get_proto_alg(u_int8_t satype, u_int8_t *sproto, 
> int *alg)
>  int
>  pfkeyv2_send(struct socket *so, void *message, int len)
>  {
> -     int i, j, s, rval = 0, mode = PFKEYV2_SENDMESSAGE_BROADCAST;
> +     int i, j, rval = 0, mode = PFKEYV2_SENDMESSAGE_BROADCAST;
>       int delflag = 0;
>       struct sockaddr_encap encapdst, encapnetmask;
>       struct ipsec_policy *ipo, *tmpipo;
> @@ -959,7 +959,7 @@ pfkeyv2_send(struct socket *so, void *message, int len)
>  
>       u_int rdomain;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>  
>       /* Verify that we received this over a legitimate pfkeyv2 socket */
>       bzero(headers, sizeof(headers));
> @@ -1833,7 +1833,7 @@ ret:
>       rval = pfkeyv2_sendmessage(headers, mode, so, 0, 0, rdomain);
>  
>  realret:
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       if (freeme)
>               free(freeme, M_PFKEY, 0);
> diff --git sys/net/pipex.c sys/net/pipex.c
> index 10ee07029f3..00e22b0bb90 100644
> --- sys/net/pipex.c
> +++ sys/net/pipex.c
> @@ -203,9 +203,9 @@ pipex_iface_fini(struct pipex_iface_context *pipex_iface)
>  int
>  pipex_ioctl(struct pipex_iface_context *pipex_iface, u_long cmd, caddr_t 
> data)
>  {
> -     int s, pipexmode, ret = 0;
> +     int pipexmode, ret = 0;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       switch (cmd) {
>       case PIPEXSMODE:
>               pipexmode = *(int *)data;
> @@ -248,7 +248,7 @@ pipex_ioctl(struct pipex_iface_context *pipex_iface, 
> u_long cmd, caddr_t data)
>               ret = ENOTTY;
>               break;
>       }
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       return (ret);
>  }
> @@ -749,13 +749,12 @@ pipex_timer_stop(void)
>  Static void
>  pipex_timer(void *ignored_arg)
>  {
> -     int s;
>       struct pipex_session *session;
>       struct pipex_session *session_next;
>  
>       timeout_add_sec(&pipex_timer_ch, pipex_prune);
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       /* walk through */
>       for (session = LIST_FIRST(&pipex_session_list); session;
>           session = session_next) {
> @@ -800,7 +799,7 @@ pipex_timer(void *ignored_arg)
>               }
>       }
>  
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  /***********************************************************************
> diff --git sys/net/route.c sys/net/route.c
> index 8327614ca79..4d3e3dd6f05 100644
> --- sys/net/route.c
> +++ sys/net/route.c
> @@ -1414,11 +1414,10 @@ rt_timer_timer(void *arg)
>       struct rttimer_queue    *rtq;
>       struct rttimer          *r;
>       long                     current_time;
> -     int                      s;
>  
>       current_time = time_uptime;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       LIST_FOREACH(rtq, &rttimer_queue_head, rtq_link) {
>               while ((r = TAILQ_FIRST(&rtq->rtq_head)) != NULL &&
>                   (r->rtt_time + rtq->rtq_timeout) < current_time) {
> @@ -1432,7 +1431,7 @@ rt_timer_timer(void *arg)
>                               printf("rt_timer_timer: rtq_count reached 0\n");
>               }
>       }
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       timeout_add_sec(to, 1);
>  }
> diff --git sys/net/rtsock.c sys/net/rtsock.c
> index 21ab1150770..f8bac9cb7fb 100644
> --- sys/net/rtsock.c
> +++ sys/net/rtsock.c
> @@ -746,9 +746,8 @@ rtm_output(struct rt_msghdr *rtm, struct rtentry **prt,
>       struct sockaddr_mpls    *psa_mpls;
>  #endif
>       int                      plen, newgate = 0, error = 0;
> -     int                      s;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       switch (rtm->rtm_type) {
>       case RTM_ADD:
>               if (info->rti_info[RTAX_GATEWAY] == NULL) {
> @@ -1025,7 +1024,7 @@ change:
>                       error = ESRCH;
>               break;
>       }
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       *prt = rt;
>       return (error);
> diff --git sys/net/switchctl.c sys/net/switchctl.c
> index b90b1576892..17f401092f2 100644
> --- sys/net/switchctl.c
> +++ sys/net/switchctl.c
> @@ -88,9 +88,9 @@ switchopen(dev_t dev, int flags, int mode, struct proc *p)
>  
>       if ((sc = switch_dev2sc(dev)) == NULL) {
>               snprintf(name, sizeof(name), "switch%d", minor(dev));
> -             NET_LOCK(s);
> +             NET_LOCK();
>               rv = if_clone_create(name, rdomain);
> -             NET_UNLOCK(s);
> +             NET_UNLOCK();
>               if (rv != 0)
>                       return (rv);
>               if ((sc = switch_dev2sc(dev)) == NULL)
> diff --git sys/netinet/if_ether.c sys/netinet/if_ether.c
> index 9625c1fbb52..19cddb800a4 100644
> --- sys/netinet/if_ether.c
> +++ sys/netinet/if_ether.c
> @@ -111,9 +111,8 @@ arptimer(void *arg)
>  {
>       struct timeout *to = (struct timeout *)arg;
>       struct llinfo_arp *la, *nla;
> -     int s;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       timeout_add_sec(to, arpt_prune);
>       LIST_FOREACH_SAFE(la, &arp_list, la_list, nla) {
>               struct rtentry *rt = la->la_rt;
> @@ -121,7 +120,7 @@ arptimer(void *arg)
>               if (rt->rt_expire && rt->rt_expire <= time_uptime)
>                       arptfree(rt); /* timer has expired; clear */
>       }
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  void
> diff --git sys/netinet/ip_ah.c sys/netinet/ip_ah.c
> index fa7db0497d4..2c55aa38b33 100644
> --- sys/netinet/ip_ah.c
> +++ sys/netinet/ip_ah.c
> @@ -700,7 +700,7 @@ ah_input(struct mbuf *m, struct tdb *tdb, int skip, int 
> protoff)
>  void
>  ah_input_cb(struct cryptop *crp)
>  {
> -     int s, roff, rplen, skip, protoff;
> +     int roff, rplen, skip, protoff;
>       unsigned char calc[AH_ALEN_MAX];
>       struct mbuf *m1, *m0, *m;
>       struct auth_hash *ahx;
> @@ -727,7 +727,7 @@ ah_input_cb(struct cryptop *crp)
>               return;
>       }
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>  
>       tdb = gettdb(tc->tc_rdomain, tc->tc_spi, &tc->tc_dst, tc->tc_proto);
>       if (tdb == NULL) {
> @@ -745,7 +745,7 @@ ah_input_cb(struct cryptop *crp)
>                       /* Reset the session ID */
>                       if (tdb->tdb_cryptoid != 0)
>                               tdb->tdb_cryptoid = crp->crp_sid;
> -                     NET_UNLOCK(s);
> +                     NET_UNLOCK();
>                       crypto_dispatch(crp);
>                       return;
>               }
> @@ -830,7 +830,7 @@ ah_input_cb(struct cryptop *crp)
>       m1 = m_getptr(m, skip, &roff);
>       if (m1 == NULL) {
>               ahstat.ahs_hdrops++;
> -             NET_UNLOCK(s);
> +             NET_UNLOCK();
>               m_freem(m);
>  
>               DPRINTF(("ah_input(): bad mbuf chain for packet in SA "
> @@ -898,11 +898,11 @@ ah_input_cb(struct cryptop *crp)
>               }
>  
>       ipsec_common_input_cb(m, tdb, skip, protoff);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       return;
>  
>   baddone:
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       m_freem(m);
>  
> @@ -1193,7 +1193,6 @@ ah_output_cb(struct cryptop *crp)
>       struct tdb *tdb;
>       struct mbuf *m;
>       caddr_t ptr;
> -     int s;
>  
>       tc = (struct tdb_crypto *) crp->crp_opaque;
>       skip = tc->tc_skip;
> @@ -1210,7 +1209,7 @@ ah_output_cb(struct cryptop *crp)
>               return;
>       }
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>  
>       tdb = gettdb(tc->tc_rdomain, tc->tc_spi, &tc->tc_dst, tc->tc_proto);
>       if (tdb == NULL) {
> @@ -1226,7 +1225,7 @@ ah_output_cb(struct cryptop *crp)
>                       /* Reset the session ID */
>                       if (tdb->tdb_cryptoid != 0)
>                               tdb->tdb_cryptoid = crp->crp_sid;
> -                     NET_UNLOCK(s);
> +                     NET_UNLOCK();
>                       crypto_dispatch(crp);
>                       return;
>               }
> @@ -1249,11 +1248,11 @@ ah_output_cb(struct cryptop *crp)
>  
>       if (ipsp_process_done(m, tdb))
>               ahstat.ahs_outfail++;
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       return;
>  
>   baddone:
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       m_freem(m);
>  
> diff --git sys/netinet/ip_carp.c sys/netinet/ip_carp.c
> index 5e3a0c26faf..43d136dc20f 100644
> --- sys/netinet/ip_carp.c
> +++ sys/netinet/ip_carp.c
> @@ -870,11 +870,10 @@ int
>  carp_clone_destroy(struct ifnet *ifp)
>  {
>       struct carp_softc *sc = ifp->if_softc;
> -     int s;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       carpdetach(sc);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       ether_ifdetach(ifp);
>       if_detach(ifp);
> @@ -1036,11 +1035,9 @@ carp_vhe_send_ad_all(struct carp_softc *sc)
>  void
>  carp_timer_ad(void *v)
>  {
> -     int s;
> -
> -     NET_LOCK(s);
> +     NET_LOCK();
>       carp_send_ad(v);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  void
> @@ -1548,11 +1545,9 @@ done:
>  void
>  carp_timer_down(void *v)
>  {
> -     int s;
> -
> -     NET_LOCK(s);
> +     NET_LOCK();
>       carp_master_down(v);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  void
> diff --git sys/netinet/ip_esp.c sys/netinet/ip_esp.c
> index f118e4e4583..953278c2ecd 100644
> --- sys/netinet/ip_esp.c
> +++ sys/netinet/ip_esp.c
> @@ -531,7 +531,7 @@ void
>  esp_input_cb(struct cryptop *crp)
>  {
>       u_int8_t lastthree[3], aalg[AH_HMAC_MAX_HASHLEN];
> -     int s, hlen, roff, skip, protoff;
> +     int hlen, roff, skip, protoff;
>       struct mbuf *m1, *mo, *m;
>       struct auth_hash *esph;
>       struct tdb_crypto *tc;
> @@ -556,7 +556,7 @@ esp_input_cb(struct cryptop *crp)
>               return;
>       }
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>  
>       tdb = gettdb(tc->tc_rdomain, tc->tc_spi, &tc->tc_dst, tc->tc_proto);
>       if (tdb == NULL) {
> @@ -574,7 +574,7 @@ esp_input_cb(struct cryptop *crp)
>                       /* Reset the session ID */
>                       if (tdb->tdb_cryptoid != 0)
>                               tdb->tdb_cryptoid = crp->crp_sid;
> -                     NET_UNLOCK(s);
> +                     NET_UNLOCK();
>                       crypto_dispatch(crp);
>                       return;
>               }
> @@ -662,7 +662,7 @@ esp_input_cb(struct cryptop *crp)
>       m1 = m_getptr(m, skip, &roff);
>       if (m1 == NULL) {
>               espstat.esps_hdrops++;
> -             NET_UNLOCK(s);
> +             NET_UNLOCK();
>               DPRINTF(("esp_input_cb(): bad mbuf chain, SA %s/%08x\n",
>                   ipsp_address(&tdb->tdb_dst, buf, sizeof(buf)),
>                   ntohl(tdb->tdb_spi)));
> @@ -720,7 +720,7 @@ esp_input_cb(struct cryptop *crp)
>       /* Verify pad length */
>       if (lastthree[1] + 2 > m->m_pkthdr.len - skip) {
>               espstat.esps_badilen++;
> -             NET_UNLOCK(s);
> +             NET_UNLOCK();
>               DPRINTF(("esp_input_cb(): invalid padding length %d for "
>                   "packet in SA %s/%08x\n", lastthree[1],
>                   ipsp_address(&tdb->tdb_dst, buf, sizeof(buf)),
> @@ -732,7 +732,7 @@ esp_input_cb(struct cryptop *crp)
>       /* Verify correct decryption by checking the last padding bytes */
>       if ((lastthree[1] != lastthree[0]) && (lastthree[1] != 0)) {
>               espstat.esps_badenc++;
> -             NET_UNLOCK(s);
> +             NET_UNLOCK();
>               DPRINTF(("esp_input(): decryption failed for packet in "
>                   "SA %s/%08x\n", ipsp_address(&tdb->tdb_dst, buf,
>                   sizeof(buf)), ntohl(tdb->tdb_spi)));
> @@ -748,11 +748,11 @@ esp_input_cb(struct cryptop *crp)
>  
>       /* Back to generic IPsec input processing */
>       ipsec_common_input_cb(m, tdb, skip, protoff);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       return;
>  
>   baddone:
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       m_freem(m);
>  
> @@ -1041,7 +1041,6 @@ esp_output_cb(struct cryptop *crp)
>       struct tdb_crypto *tc;
>       struct tdb *tdb;
>       struct mbuf *m;
> -     int s;
>  
>       tc = (struct tdb_crypto *) crp->crp_opaque;
>  
> @@ -1057,7 +1056,7 @@ esp_output_cb(struct cryptop *crp)
>       }
>  
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>  
>       tdb = gettdb(tc->tc_rdomain, tc->tc_spi, &tc->tc_dst, tc->tc_proto);
>       if (tdb == NULL) {
> @@ -1073,7 +1072,7 @@ esp_output_cb(struct cryptop *crp)
>                       /* Reset the session ID */
>                       if (tdb->tdb_cryptoid != 0)
>                               tdb->tdb_cryptoid = crp->crp_sid;
> -                     NET_UNLOCK(s);
> +                     NET_UNLOCK();
>                       crypto_dispatch(crp);
>                       return;
>               }
> @@ -1091,11 +1090,11 @@ esp_output_cb(struct cryptop *crp)
>       /* Call the IPsec input callback. */
>       if (ipsp_process_done(m, tdb))
>               espstat.esps_outfail++;
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       return;
>  
>   baddone:
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       m_freem(m);
>  
> diff --git sys/netinet/ip_input.c sys/netinet/ip_input.c
> index e1f7483f409..4d1f7831d47 100644
> --- sys/netinet/ip_input.c
> +++ sys/netinet/ip_input.c
> @@ -1794,7 +1794,6 @@ ip_send_dispatch(void *xmq)
>       struct mbuf_queue *mq = xmq;
>       struct mbuf *m;
>       struct mbuf_list ml;
> -     int s;
>  #ifdef IPSEC
>       int locked = 0;
>  #endif /* IPSEC */
> @@ -1816,11 +1815,11 @@ ip_send_dispatch(void *xmq)
>       }
>  #endif /* IPSEC */
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       while ((m = ml_dequeue(&ml)) != NULL) {
>               ip_output(m, NULL, NULL, 0, NULL, NULL, 0);
>       }
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>  #ifdef IPSEC
>       if (locked)
> diff --git sys/netinet/ip_ipcomp.c sys/netinet/ip_ipcomp.c
> index 163f4d00002..ed817a2c67c 100644
> --- sys/netinet/ip_ipcomp.c
> +++ sys/netinet/ip_ipcomp.c
> @@ -192,7 +192,7 @@ ipcomp_input(struct mbuf *m, struct tdb *tdb, int skip, 
> int protoff)
>  void
>  ipcomp_input_cb(struct cryptop *crp)
>  {
> -     int s, skip, protoff, roff, hlen = IPCOMP_HLENGTH, clen;
> +     int skip, protoff, roff, hlen = IPCOMP_HLENGTH, clen;
>       u_int8_t nproto;
>       struct mbuf *m, *m1, *mo;
>       struct tdb_crypto *tc;
> @@ -217,7 +217,7 @@ ipcomp_input_cb(struct cryptop *crp)
>               return;
>       }
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>  
>       tdb = gettdb(tc->tc_rdomain, tc->tc_spi, &tc->tc_dst, tc->tc_proto);
>       if (tdb == NULL) {
> @@ -252,7 +252,7 @@ ipcomp_input_cb(struct cryptop *crp)
>                       /* Reset the session ID */
>                       if (tdb->tdb_cryptoid != 0)
>                               tdb->tdb_cryptoid = crp->crp_sid;
> -                     NET_UNLOCK(s);
> +                     NET_UNLOCK();
>                       crypto_dispatch(crp);
>                       return;
>               }
> @@ -332,11 +332,11 @@ ipcomp_input_cb(struct cryptop *crp)
>  
>       /* Back to generic IPsec input processing */
>       ipsec_common_input_cb(m, tdb, skip, protoff);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       return;
>  
>  baddone:
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       m_freem(m);
>  
> @@ -523,7 +523,7 @@ ipcomp_output_cb(struct cryptop *crp)
>       struct tdb_crypto *tc;
>       struct tdb *tdb;
>       struct mbuf *m, *mo;
> -     int s, skip, rlen, roff;
> +     int skip, rlen, roff;
>       u_int16_t cpi;
>       struct ip *ip;
>  #ifdef INET6
> @@ -549,7 +549,7 @@ ipcomp_output_cb(struct cryptop *crp)
>               return;
>       }
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>  
>       tdb = gettdb(tc->tc_rdomain, tc->tc_spi, &tc->tc_dst, tc->tc_proto);
>       if (tdb == NULL) {
> @@ -565,7 +565,7 @@ ipcomp_output_cb(struct cryptop *crp)
>                       /* Reset the session ID */
>                       if (tdb->tdb_cryptoid != 0)
>                               tdb->tdb_cryptoid = crp->crp_sid;
> -                     NET_UNLOCK(s);
> +                     NET_UNLOCK();
>                       crypto_dispatch(crp);
>                       return;
>               }
> @@ -583,7 +583,7 @@ ipcomp_output_cb(struct cryptop *crp)
>               crypto_freereq(crp);
>               if (ipsp_process_done(m, tdb))
>                       ipcompstat.ipcomps_outfail++;
> -             NET_UNLOCK(s);
> +             NET_UNLOCK();
>               return;
>       }
>  
> @@ -632,11 +632,11 @@ ipcomp_output_cb(struct cryptop *crp)
>  
>       if (ipsp_process_done(m, tdb))
>               ipcompstat.ipcomps_outfail++;
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       return;
>  
>  baddone:
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>       m_freem(m);
>  
> diff --git sys/netinet/ip_ipsp.c sys/netinet/ip_ipsp.c
> index 085557cf2bd..7c40e4c2ded 100644
> --- sys/netinet/ip_ipsp.c
> +++ sys/netinet/ip_ipsp.c
> @@ -536,67 +536,63 @@ void
>  tdb_timeout(void *v)
>  {
>       struct tdb *tdb = v;
> -     int s;
>  
>       if (!(tdb->tdb_flags & TDBF_TIMER))
>               return;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       /* If it's an "invalid" TDB do a silent expiration. */
>       if (!(tdb->tdb_flags & TDBF_INVALID))
>               pfkeyv2_expire(tdb, SADB_EXT_LIFETIME_HARD);
>       tdb_delete(tdb);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  void
>  tdb_firstuse(void *v)
>  {
>       struct tdb *tdb = v;
> -     int s;
>  
>       if (!(tdb->tdb_flags & TDBF_SOFT_FIRSTUSE))
>               return;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       /* If the TDB hasn't been used, don't renew it. */
>       if (tdb->tdb_first_use != 0)
>               pfkeyv2_expire(tdb, SADB_EXT_LIFETIME_HARD);
>       tdb_delete(tdb);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  void
>  tdb_soft_timeout(void *v)
>  {
>       struct tdb *tdb = v;
> -     int s;
>  
>       if (!(tdb->tdb_flags & TDBF_SOFT_TIMER))
>               return;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       /* Soft expirations. */
>       pfkeyv2_expire(tdb, SADB_EXT_LIFETIME_SOFT);
>       tdb->tdb_flags &= ~TDBF_SOFT_TIMER;
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  void
>  tdb_soft_firstuse(void *v)
>  {
>       struct tdb *tdb = v;
> -     int s;
>  
>       if (!(tdb->tdb_flags & TDBF_SOFT_FIRSTUSE))
>               return;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       /* If the TDB hasn't been used, don't renew it. */
>       if (tdb->tdb_first_use != 0)
>               pfkeyv2_expire(tdb, SADB_EXT_LIFETIME_SOFT);
>       tdb->tdb_flags &= ~TDBF_SOFT_FIRSTUSE;
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  void
> @@ -993,18 +989,17 @@ void
>  ipsp_ids_timeout(void *arg)
>  {
>       struct ipsec_ids *ids = arg;
> -     int s;
>  
>       DPRINTF(("%s: ids %p count %d\n", __func__, ids, ids->id_refcount));
>       KASSERT(ids->id_refcount == 0);
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       RBT_REMOVE(ipsec_ids_tree, &ipsec_ids_tree, ids);
>       RBT_REMOVE(ipsec_ids_flows, &ipsec_ids_flows, ids);
>       free(ids->id_local, M_CREDENTIALS, 0);
>       free(ids->id_remote, M_CREDENTIALS, 0);
>       free(ids, M_CREDENTIALS, 0);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  /* decrements refcount, actual free happens in timeout */
> diff --git sys/netinet/tcp_input.c sys/netinet/tcp_input.c
> index c847ceec16d..d88bed9e9a3 100644
> --- sys/netinet/tcp_input.c
> +++ sys/netinet/tcp_input.c
> @@ -3455,9 +3455,8 @@ void
>  syn_cache_timer(void *arg)
>  {
>       struct syn_cache *sc = arg;
> -     int s;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       if (sc->sc_flags & SCF_DEAD)
>               goto out;
>  
> @@ -3483,14 +3482,14 @@ syn_cache_timer(void *arg)
>       SYN_CACHE_TIMER_ARM(sc);
>  
>   out:
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       return;
>  
>   dropit:
>       tcpstat_inc(tcps_sc_timed_out);
>       syn_cache_rm(sc);
>       syn_cache_put(sc);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  void
> diff --git sys/netinet/tcp_timer.c sys/netinet/tcp_timer.c
> index 3d4bc5d0600..4757cd4a4a2 100644
> --- sys/netinet/tcp_timer.c
> +++ sys/netinet/tcp_timer.c
> @@ -105,20 +105,19 @@ void
>  tcp_delack(void *arg)
>  {
>       struct tcpcb *tp = arg;
> -     int s;
>  
>       /*
>        * If tcp_output() wasn't able to transmit the ACK
>        * for whatever reason, it will restart the delayed
>        * ACK callout.
>        */
> -     NET_LOCK(s);
> +     NET_LOCK();
>       if (tp->t_flags & TF_DEAD)
>               goto out;
>       tp->t_flags |= TF_ACKNOW;
>       (void) tcp_output(tp);
>   out:
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  /*
> @@ -187,9 +186,8 @@ tcp_timer_rexmt(void *arg)
>  {
>       struct tcpcb *tp = arg;
>       uint32_t rto;
> -     int s;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       if (tp->t_flags & TF_DEAD)
>               goto out;
>  
> @@ -369,7 +367,7 @@ tcp_timer_rexmt(void *arg)
>       (void) tcp_output(tp);
>  
>   out:
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  void
> @@ -377,9 +375,8 @@ tcp_timer_persist(void *arg)
>  {
>       struct tcpcb *tp = arg;
>       uint32_t rto;
> -     int s;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       if ((tp->t_flags & TF_DEAD) ||
>              TCP_TIMER_ISARMED(tp, TCPT_REXMT)) {
>               goto out;
> @@ -407,16 +404,15 @@ tcp_timer_persist(void *arg)
>       (void) tcp_output(tp);
>       tp->t_force = 0;
>   out:
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  void
>  tcp_timer_keep(void *arg)
>  {
>       struct tcpcb *tp = arg;
> -     int s;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       if (tp->t_flags & TF_DEAD)
>               goto out;
>  
> @@ -448,22 +444,21 @@ tcp_timer_keep(void *arg)
>       } else
>               TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepidle);
>   out:
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       return;
>  
>   dropit:
>       tcpstat_inc(tcps_keepdrops);
>       tp = tcp_drop(tp, ETIMEDOUT);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  void
>  tcp_timer_2msl(void *arg)
>  {
>       struct tcpcb *tp = arg;
> -     int s;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       if (tp->t_flags & TF_DEAD)
>               goto out;
>  
> @@ -478,5 +473,5 @@ tcp_timer_2msl(void *arg)
>               tp = tcp_close(tp);
>  
>   out:
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
> diff --git sys/netinet6/ip6_input.c sys/netinet6/ip6_input.c
> index 63c7a635d10..071dd96064c 100644
> --- sys/netinet6/ip6_input.c
> +++ sys/netinet6/ip6_input.c
> @@ -1442,7 +1442,6 @@ ip6_send_dispatch(void *xmq)
>       struct mbuf_queue *mq = xmq;
>       struct mbuf *m;
>       struct mbuf_list ml;
> -     int s;
>  #ifdef IPSEC
>       int locked = 0;
>  #endif /* IPSEC */
> @@ -1464,11 +1463,11 @@ ip6_send_dispatch(void *xmq)
>       }
>  #endif /* IPSEC */
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       while ((m = ml_dequeue(&ml)) != NULL) {
>               ip6_output(m, NULL, NULL, IPV6_MINMTU, NULL, NULL);
>       }
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  
>  #ifdef IPSEC
>       if (locked)
> diff --git sys/netinet6/nd6.c sys/netinet6/nd6.c
> index c93413369e4..e44a2c9b69c 100644
> --- sys/netinet6/nd6.c
> +++ sys/netinet6/nd6.c
> @@ -311,21 +311,20 @@ nd6_llinfo_settimer(struct llinfo_nd6 *ln, int secs)
>  void
>  nd6_llinfo_timer(void *arg)
>  {
> -     int s;
>       struct llinfo_nd6 *ln;
>       struct rtentry *rt;
>       struct sockaddr_in6 *dst;
>       struct ifnet *ifp;
>       struct nd_ifinfo *ndi = NULL;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>  
>       ln = (struct llinfo_nd6 *)arg;
>  
>       if ((rt = ln->ln_rt) == NULL)
>               panic("ln->ln_rt == NULL");
>       if ((ifp = if_get(rt->rt_ifidx)) == NULL) {
> -             NET_UNLOCK(s);
> +             NET_UNLOCK();
>               return;
>       }
>       ndi = ND_IFINFO(ifp);
> @@ -409,7 +408,7 @@ nd6_llinfo_timer(void *arg)
>       }
>  
>       if_put(ifp);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  void
> @@ -457,10 +456,9 @@ void
>  nd6_expire(void *unused)
>  {
>       struct ifnet *ifp;
> -     int s;
>  
>       KERNEL_LOCK();
> -     NET_LOCK(s);
> +     NET_LOCK();
>  
>       TAILQ_FOREACH(ifp, &ifnet, if_list) {
>               struct ifaddr *ifa, *nifa;
> @@ -481,7 +479,7 @@ nd6_expire(void *unused)
>               }
>       }
>  
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       KERNEL_UNLOCK();
>  }
>  
> @@ -1293,9 +1291,8 @@ nd6_slowtimo(void *ignored_arg)
>  {
>       struct nd_ifinfo *nd6if;
>       struct ifnet *ifp;
> -     int s;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>  
>       timeout_add_sec(&nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL);
>  
> @@ -1313,7 +1310,7 @@ nd6_slowtimo(void *ignored_arg)
>                       nd6if->reachable = 
> ND_COMPUTE_RTIME(nd6if->basereachable);
>               }
>       }
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  int
> diff --git sys/netinet6/nd6_nbr.c sys/netinet6/nd6_nbr.c
> index 90086d33d65..0a6416995d5 100644
> --- sys/netinet6/nd6_nbr.c
> +++ sys/netinet6/nd6_nbr.c
> @@ -1173,9 +1173,8 @@ nd6_dad_timer(void *xifa)
>       struct in6_ifaddr *ia6 = ifatoia6(ifa);
>       struct dadq *dp;
>       char addr[INET6_ADDRSTRLEN];
> -     int s;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>  
>       /* Sanity check */
>       if (ia6 == NULL) {
> @@ -1266,7 +1265,7 @@ nd6_dad_timer(void *xifa)
>       }
>  
>  done:
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>  }
>  
>  void
> diff --git sys/nfs/nfs_boot.c sys/nfs/nfs_boot.c
> index 814b7902c7b..8a4850d715a 100644
> --- sys/nfs/nfs_boot.c
> +++ sys/nfs/nfs_boot.c
> @@ -122,7 +122,7 @@ nfs_boot_init(struct nfs_diskless *nd, struct proc *procp)
>       struct socket *so;
>       struct ifaddr *ifa;
>       char addr[INET_ADDRSTRLEN];
> -     int s, error;
> +     int error;
>  
>       /*
>        * Find an interface, rarp for its ip address, stuff it, the
> @@ -159,15 +159,15 @@ nfs_boot_init(struct nfs_diskless *nd, struct proc 
> *procp)
>        */
>       if ((error = socreate(AF_INET, &so, SOCK_DGRAM, 0)) != 0)
>               panic("nfs_boot: socreate, error=%d", error);
> -     NET_LOCK(s);
> +     NET_LOCK();
>       error = ifioctl(so, SIOCGIFFLAGS, (caddr_t)&ireq, procp);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       if (error)
>               panic("nfs_boot: GIFFLAGS, error=%d", error);
>       ireq.ifr_flags |= IFF_UP;
> -     NET_LOCK(s);
> +     NET_LOCK();
>       error = ifioctl(so, SIOCSIFFLAGS, (caddr_t)&ireq, procp);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       if (error)
>               panic("nfs_boot: SIFFLAGS, error=%d", error);
>  
> @@ -190,9 +190,9 @@ nfs_boot_init(struct nfs_diskless *nd, struct proc *procp)
>       sin->sin_len = sizeof(*sin);
>       sin->sin_family = AF_INET;
>       sin->sin_addr.s_addr = my_ip.s_addr;
> -     NET_LOCK(s);
> +     NET_LOCK();
>       error = ifioctl(so, SIOCAIFADDR, (caddr_t)&ifra, procp);
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       if (error)
>               panic("nfs_boot: set if addr, error=%d", error);
>  
> diff --git sys/nfs/nfs_socket.c sys/nfs/nfs_socket.c
> index 2d3f95abafc..bfecea7d329 100644
> --- sys/nfs/nfs_socket.c
> +++ sys/nfs/nfs_socket.c
> @@ -1127,9 +1127,9 @@ nfs_timer(void *arg)
>       struct nfsreq *rep;
>       struct mbuf *m;
>       struct socket *so;
> -     int timeo, s, error;
> +     int timeo, error;
>  
> -     NET_LOCK(s);
> +     NET_LOCK();
>       TAILQ_FOREACH(rep, &nmp->nm_reqsq, r_chain) {
>               if (rep->r_mrep || (rep->r_flags & R_SOFTTERM))
>                       continue;
> @@ -1212,7 +1212,7 @@ nfs_timer(void *arg)
>                       }
>               }
>       }
> -     NET_UNLOCK(s);
> +     NET_UNLOCK();
>       timeout_add(&nmp->nm_rtimeout, nfs_ticks);
>  }
>  
> diff --git sys/sys/systm.h sys/sys/systm.h
> index f83c12ffcdd..2ee42ae0fed 100644
> --- sys/sys/systm.h
> +++ sys/sys/systm.h
> @@ -296,15 +296,13 @@ int     uiomove(void *, size_t, struct uio *);
>  
>  extern struct rwlock netlock;
>  
> -#define      NET_LOCK(s)                                                     
> \
> +#define      NET_LOCK()                                                      
> \
>  do {                                                                 \
>       rw_enter_write(&netlock);                                       \
> -     s = IPL_SOFTNET;                                                \
>  } while (0)
>  
> -#define      NET_UNLOCK(s)                                                   
> \
> +#define      NET_UNLOCK()                                                    
> \
>  do {                                                                 \
> -     (void)s;                                                        \
>       rw_exit_write(&netlock);                                        \
>  } while (0)
>  

Reply via email to