if_ipending flags ==> if_flags
Joerg Sonnenberger
joerg at britannica.bec.de
Thu Apr 15 08:28:21 PDT 2004
Hi all,
the attached patch moves IFF_PROMISC and IFF_POLLING into ifnet.if_flags
where they belong. It also adjust the ioctl code to use if_flags for the
lower and higher word. Some of the uses were definitely buggy.
I'll commit this tomorrow, if noone objects.
Joerg
Index: dev/netif/dc/if_dc.c
===================================================================
RCS file: /home/joerg/wd/repo/dragonflybsd/src/sys/dev/netif/dc/if_dc.c,v
retrieving revision 1.11
diff -u -u -r1.11 if_dc.c
--- dev/netif/dc/if_dc.c 7 Apr 2004 05:45:27 -0000 1.11
+++ dev/netif/dc/if_dc.c 15 Apr 2004 13:46:00 -0000
@@ -2486,7 +2486,7 @@
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 @@
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 @@
* 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
Index: dev/netif/em/if_em.c
===================================================================
RCS file: /home/joerg/wd/repo/dragonflybsd/src/sys/dev/netif/em/if_em.c,v
retrieving revision 1.10
diff -u -u -r1.10 if_em.c
--- dev/netif/em/if_em.c 7 Apr 2004 05:45:27 -0000 1.10
+++ dev/netif/em/if_em.c 15 Apr 2004 13:45:51 -0000
@@ -866,7 +866,7 @@
* 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 @@
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)) {
Index: dev/netif/fxp/if_fxp.c
===================================================================
RCS file: /home/joerg/wd/repo/dragonflybsd/src/sys/dev/netif/fxp/if_fxp.c,v
retrieving revision 1.10
diff -u -u -r1.10 if_fxp.c
--- dev/netif/fxp/if_fxp.c 7 Apr 2004 05:45:28 -0000 1.10
+++ dev/netif/fxp/if_fxp.c 15 Apr 2004 13:45:45 -0000
@@ -1212,7 +1212,7 @@
#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 @@
* ... 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 */
Index: dev/netif/nge/if_nge.c
===================================================================
RCS file: /home/joerg/wd/repo/dragonflybsd/src/sys/dev/netif/nge/if_nge.c,v
retrieving revision 1.9
diff -u -u -r1.9 if_nge.c
--- dev/netif/nge/if_nge.c 7 Apr 2004 05:45:29 -0000 1.9
+++ dev/netif/nge/if_nge.c 15 Apr 2004 13:45:40 -0000
@@ -1379,7 +1379,7 @@
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 @@
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 @@
* ... 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 */
Index: dev/netif/rl/if_rl.c
===================================================================
RCS file: /home/joerg/wd/repo/dragonflybsd/src/sys/dev/netif/rl/if_rl.c,v
retrieving revision 1.9
diff -u -u -r1.9 if_rl.c
--- dev/netif/rl/if_rl.c 23 Mar 2004 22:19:02 -0000 1.9
+++ dev/netif/rl/if_rl.c 15 Apr 2004 13:45:33 -0000
@@ -1090,7 +1090,7 @@
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 @@
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 @@
/*
* 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 */
Index: dev/netif/sis/if_sis.c
===================================================================
RCS file: /home/joerg/wd/repo/dragonflybsd/src/sys/dev/netif/sis/if_sis.c,v
retrieving revision 1.12
diff -u -u -r1.12 if_sis.c
--- dev/netif/sis/if_sis.c 14 Apr 2004 18:24:34 -0000 1.12
+++ dev/netif/sis/if_sis.c 15 Apr 2004 13:45:22 -0000
@@ -1501,7 +1501,7 @@
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 @@
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 @@
* ... 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 */
Index: kern/kern_poll.c
===================================================================
RCS file: /home/joerg/wd/repo/dragonflybsd/src/sys/kern/kern_poll.c,v
retrieving revision 1.10
diff -u -u -r1.10 kern_poll.c
--- kern/kern_poll.c 11 Apr 2004 05:14:47 -0000 1.10
+++ kern/kern_poll.c 15 Apr 2004 13:45:01 -0000
@@ -409,7 +409,7 @@
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 @@
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 @@
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 @@
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");
Index: net/if.c
===================================================================
RCS file: /home/joerg/wd/repo/dragonflybsd/src/sys/net/if.c,v
retrieving revision 1.16
diff -u -u -r1.16 if.c
--- net/if.c 24 Mar 2004 02:08:33 -0000 1.16
+++ net/if.c 15 Apr 2004 14:18:19 -0000
@@ -1032,7 +1032,7 @@
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 @@
}
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 @@
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 @@
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 (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 @@
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 ((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
Index: net/if.h
===================================================================
RCS file: /home/joerg/wd/repo/dragonflybsd/src/sys/net/if.h,v
retrieving revision 1.9
diff -u -u -r1.9 if.h
--- net/if.h 16 Mar 2004 16:58:16 -0000 1.9
+++ net/if.h 15 Apr 2004 13:41:45 -0000
@@ -140,14 +140,6 @@
#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 */
Index: net/if_ethersubr.c
===================================================================
RCS file: /home/joerg/wd/repo/dragonflybsd/src/sys/net/if_ethersubr.c,v
retrieving revision 1.12
diff -u -u -r1.12 if_ethersubr.c
--- net/if_ethersubr.c 16 Mar 2004 23:06:11 -0000 1.12
+++ net/if_ethersubr.c 15 Apr 2004 14:09:01 -0000
@@ -663,7 +663,7 @@
&& (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;
}
More information about the Submit
mailing list