From 46f25451c42b030e52cf0c2581efedf2034a93b0 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Fri, 16 Apr 2004 14:21:58 +0000 Subject: [PATCH] Move IFF_PROMISC and IFF_POLLING from ifnet.ipending to ifnet.if_flags, where they belong. Consistently use the higher bits of if_flags, not ipending. --- sys/dev/netif/dc/if_dc.c | 8 ++++---- sys/dev/netif/em/if_em.c | 6 +++--- sys/dev/netif/fxp/if_fxp.c | 6 +++--- sys/dev/netif/nge/if_nge.c | 8 ++++---- sys/dev/netif/rl/if_rl.c | 8 ++++---- sys/dev/netif/sis/if_sis.c | 8 ++++---- sys/kern/kern_poll.c | 12 ++++++------ sys/net/if.c | 18 ++++++++---------- sys/net/if.h | 10 +--------- sys/net/if_ethersubr.c | 4 ++-- 10 files changed, 39 insertions(+), 49 deletions(-) diff --git a/sys/dev/netif/dc/if_dc.c b/sys/dev/netif/dc/if_dc.c index 2773c0bc97..17965905a3 100644 --- a/sys/dev/netif/dc/if_dc.c +++ b/sys/dev/netif/dc/if_dc.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_dc.c,v 1.9.2.45 2003/06/08 14:31:53 mux Exp $ - * $DragonFly: src/sys/dev/netif/dc/if_dc.c,v 1.11 2004/04/07 05:45:27 dillon Exp $ + * $DragonFly: src/sys/dev/netif/dc/if_dc.c,v 1.12 2004/04/16 14:21:57 joerg Exp $ * * $FreeBSD: src/sys/pci/if_dc.c,v 1.9.2.45 2003/06/08 14:31:53 mux Exp $ */ @@ -2486,7 +2486,7 @@ static void dc_rxeof(sc) while(!(sc->dc_ldata->dc_rx_list[i].dc_status & DC_RXSTAT_OWN)) { #ifdef DEVICE_POLLING - if (ifp->if_ipending & IFF_POLLING) { + if (ifp->if_flags & IFF_POLLING) { if (sc->rxcycles <= 0) break; sc->rxcycles--; @@ -2892,7 +2892,7 @@ static void dc_intr(arg) ifp = &sc->arpcom.ac_if; #ifdef DEVICE_POLLING - if (ifp->if_ipending & IFF_POLLING) + if (ifp->if_flags & IFF_POLLING) return; if (ether_poll_register(dc_poll, ifp)) { /* ok, disable interrupts */ CSR_WRITE_4(sc, DC_IMR, 0x00000000); @@ -3247,7 +3247,7 @@ static void dc_init(xsc) * the case of polling. Some cards (e.g. fxp) turn interrupts on * after a reset. */ - if (ifp->if_ipending & IFF_POLLING) + if (ifp->if_flags & IFF_POLLING) CSR_WRITE_4(sc, DC_IMR, 0x00000000); else #endif diff --git a/sys/dev/netif/em/if_em.c b/sys/dev/netif/em/if_em.c index 9b71ac6ca6..dcba0af2f2 100644 --- a/sys/dev/netif/em/if_em.c +++ b/sys/dev/netif/em/if_em.c @@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ /*$FreeBSD: src/sys/dev/em/if_em.c,v 1.2.2.15 2003/06/09 22:10:15 pdeuskar Exp $*/ -/*$DragonFly: src/sys/dev/netif/em/if_em.c,v 1.10 2004/04/07 05:45:27 dillon Exp $*/ +/*$DragonFly: src/sys/dev/netif/em/if_em.c,v 1.11 2004/04/16 14:21:57 joerg Exp $*/ #include "if_em.h" @@ -866,7 +866,7 @@ em_init(void *arg) * Only enable interrupts if we are not polling, make sure * they are off otherwise. */ - if (ifp->if_ipending & IFF_POLLING) + if (ifp->if_flags & IFF_POLLING) em_disable_intr(adapter); else #endif /* DEVICE_POLLING */ @@ -929,7 +929,7 @@ em_intr(void *arg) ifp = &adapter->interface_data.ac_if; #ifdef DEVICE_POLLING - if (ifp->if_ipending & IFF_POLLING) + if (ifp->if_flags & IFF_POLLING) return; if (ether_poll_register(em_poll, ifp)) { diff --git a/sys/dev/netif/fxp/if_fxp.c b/sys/dev/netif/fxp/if_fxp.c index 60013184f7..83355d5897 100644 --- a/sys/dev/netif/fxp/if_fxp.c +++ b/sys/dev/netif/fxp/if_fxp.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/fxp/if_fxp.c,v 1.110.2.30 2003/06/12 16:47:05 mux Exp $ - * $DragonFly: src/sys/dev/netif/fxp/if_fxp.c,v 1.10 2004/04/07 05:45:28 dillon Exp $ + * $DragonFly: src/sys/dev/netif/fxp/if_fxp.c,v 1.11 2004/04/16 14:21:57 joerg Exp $ */ /* @@ -1212,7 +1212,7 @@ fxp_intr(void *xsc) #ifdef DEVICE_POLLING struct ifnet *ifp = &sc->sc_if; - if (ifp->if_ipending & IFF_POLLING) + if (ifp->if_flags & IFF_POLLING) return; if (ether_poll_register(fxp_poll, ifp)) { /* disable interrupts */ @@ -1808,7 +1808,7 @@ fxp_init(void *xsc) * ... but only do that if we are not polling. And because (presumably) * the default is interrupts on, we need to disable them explicitly! */ - if ( ifp->if_ipending & IFF_POLLING ) + if ( ifp->if_flags & IFF_POLLING ) CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, FXP_SCB_INTR_DISABLE); else #endif /* DEVICE_POLLING */ diff --git a/sys/dev/netif/nge/if_nge.c b/sys/dev/netif/nge/if_nge.c index d9125a66e0..7a1549957d 100644 --- a/sys/dev/netif/nge/if_nge.c +++ b/sys/dev/netif/nge/if_nge.c @@ -31,7 +31,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/nge/if_nge.c,v 1.13.2.13 2003/02/05 22:03:57 mbr Exp $ - * $DragonFly: src/sys/dev/netif/nge/if_nge.c,v 1.9 2004/04/07 05:45:29 dillon Exp $ + * $DragonFly: src/sys/dev/netif/nge/if_nge.c,v 1.10 2004/04/16 14:21:58 joerg Exp $ * * $FreeBSD: src/sys/dev/nge/if_nge.c,v 1.13.2.13 2003/02/05 22:03:57 mbr Exp $ */ @@ -1379,7 +1379,7 @@ static void nge_rxeof(sc) u_int32_t extsts; #ifdef DEVICE_POLLING - if (ifp->if_ipending & IFF_POLLING) { + if (ifp->if_flags & IFF_POLLING) { if (sc->rxcycles <= 0) break; sc->rxcycles--; @@ -1647,7 +1647,7 @@ static void nge_intr(arg) ifp = &sc->arpcom.ac_if; #ifdef DEVICE_POLLING - if (ifp->if_ipending & IFF_POLLING) + if (ifp->if_flags & IFF_POLLING) return; if (ether_poll_register(nge_poll, ifp)) { /* ok, disable interrupts */ CSR_WRITE_4(sc, NGE_IER, 0); @@ -2024,7 +2024,7 @@ static void nge_init(xsc) * ... only enable interrupts if we are not polling, make sure * they are off otherwise. */ - if (ifp->if_ipending & IFF_POLLING) + if (ifp->if_flags & IFF_POLLING) CSR_WRITE_4(sc, NGE_IER, 0); else #endif /* DEVICE_POLLING */ diff --git a/sys/dev/netif/rl/if_rl.c b/sys/dev/netif/rl/if_rl.c index 10508ec13e..bf7e065275 100644 --- a/sys/dev/netif/rl/if_rl.c +++ b/sys/dev/netif/rl/if_rl.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_rl.c,v 1.38.2.16 2003/03/05 18:42:33 njl Exp $ - * $DragonFly: src/sys/dev/netif/rl/if_rl.c,v 1.9 2004/03/23 22:19:02 hsu Exp $ + * $DragonFly: src/sys/dev/netif/rl/if_rl.c,v 1.10 2004/04/16 14:21:58 joerg Exp $ * * $FreeBSD: src/sys/pci/if_rl.c,v 1.38.2.16 2003/03/05 18:42:33 njl Exp $ */ @@ -1090,7 +1090,7 @@ static void rl_rxeof(sc) while((CSR_READ_1(sc, RL_COMMAND) & RL_CMD_EMPTY_RXBUF) == 0) { #ifdef DEVICE_POLLING - if (ifp->if_ipending & IFF_POLLING) { + if (ifp->if_flags & IFF_POLLING) { if (sc->rxcycles <= 0) break; sc->rxcycles--; @@ -1322,7 +1322,7 @@ static void rl_intr(arg) ifp = &sc->arpcom.ac_if; #ifdef DEVICE_POLLING - if (ifp->if_ipending & IFF_POLLING) + if (ifp->if_flags & IFF_POLLING) return; if (ether_poll_register(rl_poll, ifp)) { /* ok, disable interrupts */ CSR_WRITE_2(sc, RL_IMR, 0x0000); @@ -1543,7 +1543,7 @@ static void rl_init(xsc) /* * Only enable interrupts if we are polling, keep them off otherwise. */ - if (ifp->if_ipending & IFF_POLLING) + if (ifp->if_flags & IFF_POLLING) CSR_WRITE_2(sc, RL_IMR, 0); else #endif /* DEVICE_POLLING */ diff --git a/sys/dev/netif/sis/if_sis.c b/sys/dev/netif/sis/if_sis.c index 358f9974c9..cf4ef462e3 100644 --- a/sys/dev/netif/sis/if_sis.c +++ b/sys/dev/netif/sis/if_sis.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_sis.c,v 1.13.4.24 2003/03/05 18:42:33 njl Exp $ - * $DragonFly: src/sys/dev/netif/sis/if_sis.c,v 1.12 2004/04/14 18:24:34 joerg Exp $ + * $DragonFly: src/sys/dev/netif/sis/if_sis.c,v 1.13 2004/04/16 14:21:58 joerg Exp $ * * $FreeBSD: src/sys/pci/if_sis.c,v 1.13.4.24 2003/03/05 18:42:33 njl Exp $ */ @@ -1501,7 +1501,7 @@ sis_rxeof(struct sis_softc *sc) while(SIS_OWNDESC(&sc->sis_ldata.sis_rx_list[i])) { #ifdef DEVICE_POLLING - if (ifp->if_ipending & IFF_POLLING) { + if (ifp->if_flags & IFF_POLLING) { if (sc->rxcycles <= 0) break; sc->rxcycles--; @@ -1718,7 +1718,7 @@ sis_intr(void *arg) ifp = &sc->arpcom.ac_if; #ifdef DEVICE_POLLING - if (ifp->if_ipending & IFF_POLLING) + if (ifp->if_flags & IFF_POLLING) return; if (ether_poll_register(sis_poll, ifp)) { /* ok, disable interrupts */ CSR_WRITE_4(sc, SIS_IER, 0); @@ -2015,7 +2015,7 @@ sis_init(void *xsc) * ... only enable interrupts if we are not polling, make sure * they are off otherwise. */ - if (ifp->if_ipending & IFF_POLLING) + if (ifp->if_flags & IFF_POLLING) CSR_WRITE_4(sc, SIS_IER, 0); else #endif /* DEVICE_POLLING */ diff --git a/sys/kern/kern_poll.c b/sys/kern/kern_poll.c index bf5d06f7c0..1af7d1de7b 100644 --- a/sys/kern/kern_poll.c +++ b/sys/kern/kern_poll.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/kern_poll.c,v 1.2.2.4 2002/06/27 23:26:33 luigi Exp $ - * $DragonFly: src/sys/kern/kern_poll.c,v 1.10 2004/04/11 05:14:47 hsu Exp $ + * $DragonFly: src/sys/kern/kern_poll.c,v 1.11 2004/04/16 14:21:58 joerg Exp $ */ #include @@ -409,7 +409,7 @@ netisr_poll(struct netmsg *msg) for (i = 0 ; i < poll_handlers ; i++) { if (pr[i].handler && pr[i].ifp->if_flags & IFF_RUNNING) { - pr[i].ifp->if_ipending &= ~IFF_POLLING; + pr[i].ifp->if_flags &= ~IFF_POLLING; pr[i].handler(pr[i].ifp, POLL_DEREGISTER, 1); } pr[i].handler=NULL; @@ -442,7 +442,7 @@ ether_poll_register(poll_handler_t *h, struct ifnet *ifp) return 0; if ( !(ifp->if_flags & IFF_UP) ) /* must be up */ return 0; - if (ifp->if_ipending & IFF_POLLING) /* already polling */ + if (ifp->if_flags & IFF_POLLING) /* already polling */ return 0; s = splhigh(); @@ -467,7 +467,7 @@ ether_poll_register(poll_handler_t *h, struct ifnet *ifp) pr[poll_handlers].handler = h; pr[poll_handlers].ifp = ifp; poll_handlers++; - ifp->if_ipending |= IFF_POLLING; + ifp->if_flags |= IFF_POLLING; splx(s); return 1; /* polling enabled in next call */ } @@ -484,14 +484,14 @@ ether_poll_deregister(struct ifnet *ifp) int i; int s = splimp(); - if ( !ifp || !(ifp->if_ipending & IFF_POLLING) ) { + if ( !ifp || !(ifp->if_flags & IFF_POLLING) ) { splx(s); return 0; } for (i = 0 ; i < poll_handlers ; i++) if (pr[i].ifp == ifp) /* found it */ break; - ifp->if_ipending &= ~IFF_POLLING; /* found or not... */ + ifp->if_flags &= ~IFF_POLLING; /* found or not... */ if (i == poll_handlers) { splx(s); printf("ether_poll_deregister: ifp not found!!!\n"); diff --git a/sys/net/if.c b/sys/net/if.c index e8adce08ba..67ba07809b 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -32,7 +32,7 @@ * * @(#)if.c 8.3 (Berkeley) 1/4/94 * $FreeBSD: src/sys/net/if.c,v 1.185 2004/03/13 02:35:03 brooks Exp $ - * $DragonFly: src/sys/net/if.c,v 1.16 2004/03/24 02:08:33 hsu Exp $ + * $DragonFly: src/sys/net/if.c,v 1.17 2004/04/16 14:21:57 joerg Exp $ */ #include "opt_compat.h" @@ -1032,7 +1032,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct thread *td) case SIOCGIFFLAGS: ifr->ifr_flags = ifp->if_flags; - ifr->ifr_flagshigh = ifp->if_ipending >> 16; + ifr->ifr_flagshigh = ifp->if_flags >> 16; break; case SIOCGIFCAP: @@ -1073,8 +1073,6 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct thread *td) } ifp->if_flags = (ifp->if_flags & IFF_CANTCHANGE) | (new_flags &~ IFF_CANTCHANGE); - ifp->if_ipending = (ifp->if_ipending & IFF_CANTCHANGE) | - (new_flags &~ IFF_CANTCHANGE); if (new_flags & IFF_PPROMISC) { /* Permanently promiscuous mode requested */ ifp->if_flags |= IFF_PROMISC; @@ -1334,7 +1332,7 @@ ifpromisc(ifp, pswitch) int oldflags; oldflags = ifp->if_flags; - if (ifp->if_ipending & IFF_PPROMISC) { + if (ifp->if_flags & IFF_PPROMISC) { /* Do nothing if device is in permanently promiscuous mode */ ifp->if_pcount += pswitch ? 1 : -1; return (0); @@ -1359,7 +1357,7 @@ ifpromisc(ifp, pswitch) ifp->if_xname); } ifr.ifr_flags = ifp->if_flags; - ifr.ifr_flagshigh = ifp->if_ipending >> 16; + ifr.ifr_flagshigh = ifp->if_flags >> 16; error = (*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, (caddr_t)&ifr, (struct ucred *)NULL); if (error == 0) @@ -1473,7 +1471,7 @@ if_allmulti(ifp, onswitch) if (ifp->if_amcount++ == 0) { ifp->if_flags |= IFF_ALLMULTI; ifr.ifr_flags = ifp->if_flags; - ifr.ifr_flagshigh = ifp->if_ipending >> 16; + ifr.ifr_flagshigh = ifp->if_flags >> 16; error = ifp->if_ioctl(ifp, SIOCSIFFLAGS, (caddr_t)&ifr, (struct ucred *)NULL); } @@ -1484,7 +1482,7 @@ if_allmulti(ifp, onswitch) ifp->if_amcount = 0; ifp->if_flags &= ~IFF_ALLMULTI; ifr.ifr_flags = ifp->if_flags; - ifr.ifr_flagshigh = ifp->if_ipending >> 16; + ifr.ifr_flagshigh = ifp->if_flags >> 16; error = ifp->if_ioctl(ifp, SIOCSIFFLAGS, (caddr_t)&ifr, (struct ucred *)NULL); } @@ -1702,12 +1700,12 @@ if_setlladdr(struct ifnet *ifp, const u_char *lladdr, int len) if ((ifp->if_flags & IFF_UP) != 0) { ifp->if_flags &= ~IFF_UP; ifr.ifr_flags = ifp->if_flags; - ifr.ifr_flagshigh = ifp->if_ipending >> 16; + ifr.ifr_flagshigh = ifp->if_flags >> 16; (*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, (caddr_t)&ifr, (struct ucred *)NULL); ifp->if_flags |= IFF_UP; ifr.ifr_flags = ifp->if_flags; - ifr.ifr_flagshigh = ifp->if_ipending >> 16; + ifr.ifr_flagshigh = ifp->if_flags >> 16; (*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, (caddr_t)&ifr, (struct ucred *)NULL); #ifdef INET diff --git a/sys/net/if.h b/sys/net/if.h index f84fc06c88..da62fd5ccc 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -32,7 +32,7 @@ * * @(#)if.h 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/net/if.h,v 1.58.2.9 2002/08/30 14:23:38 sobomax Exp $ - * $DragonFly: src/sys/net/if.h,v 1.9 2004/03/16 16:58:16 joerg Exp $ + * $DragonFly: src/sys/net/if.h,v 1.10 2004/04/16 14:21:57 joerg Exp $ */ #ifndef _NET_IF_H_ @@ -140,14 +140,6 @@ struct if_data { #define IFF_LINK2 0x4000 /* per link layer defined bit */ #define IFF_ALTPHYS IFF_LINK2 /* use alternate physical connection */ #define IFF_MULTICAST 0x8000 /* supports multicast */ - -/* - * The following flag(s) ought to go in if_flags, but we cannot change - * struct ifnet because of binary compatibility, so we store them in - * if_ipending, which is not used so far. - * If possible, make sure the value is not conflicting with other - * IFF flags, so we have an easier time when we want to merge them. - */ #define IFF_POLLING 0x10000 /* Interface is in polling mode. */ #define IFF_PPROMISC 0x20000 /* user-requested promisc mode */ diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index bd7058ed3e..b09b0e9165 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -32,7 +32,7 @@ * * @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/net/if_ethersubr.c,v 1.70.2.33 2003/04/28 15:45:53 archie Exp $ - * $DragonFly: src/sys/net/if_ethersubr.c,v 1.12 2004/03/16 23:06:11 joerg Exp $ + * $DragonFly: src/sys/net/if_ethersubr.c,v 1.13 2004/04/16 14:21:57 joerg Exp $ */ #include "opt_atalk.h" @@ -663,7 +663,7 @@ ether_demux(ifp, eh, m) && (eh->ether_dhost[0] & 1) == 0 && bcmp(eh->ether_dhost, IFP2AC(ifp)->ac_enaddr, ETHER_ADDR_LEN) != 0 - && (ifp->if_ipending & IFF_PPROMISC) == 0) { + && (ifp->if_flags & IFF_PPROMISC) == 0) { m_freem(m); return; } -- 2.32.0