From 0318355d0e0c749359d4d8d384fb34240e4b1a4e Mon Sep 17 00:00:00 2001 From: Luigi Rizzo Date: Thu, 15 Apr 2004 20:31:10 +0000 Subject: [PATCH] Remove improper use of if_addrhead in device drivers to check if the link-level address has been initialized already. The majority of modern drivers never does this and works fine, which makes me think that the check is totally unnecessary and a residue of cut&paste from other drivers. This change is done to simplify locking because now almost none of the drivers uses this field. The exceptions are "ct" "ctau" and "cx" where i am not sure if i can remove that part. --- sys/dev/arl/if_arl.c | 3 --- sys/dev/cs/if_cs.c | 4 ---- sys/dev/ed/if_ed.c | 4 ---- sys/dev/ex/if_ex.c | 3 --- sys/dev/fe/if_fe.c | 8 -------- sys/dev/lnc/if_lnc.c | 7 ------- sys/dev/sbni/if_sbni.c | 4 ---- sys/dev/sn/if_sn.c | 18 ------------------ sys/dev/wl/if_wl.c | 2 -- sys/dev/xe/if_xe.c | 2 -- 10 files changed, 55 deletions(-) diff --git a/sys/dev/arl/if_arl.c b/sys/dev/arl/if_arl.c index f3495fb09ac5..9a69870ad51d 100644 --- a/sys/dev/arl/if_arl.c +++ b/sys/dev/arl/if_arl.c @@ -701,9 +701,6 @@ arl_init(xsc) D(("init\n")); - if (TAILQ_EMPTY(&ifp->if_addrhead)) - return; - s = splimp(); if (ARL_CHECKREG(sc)) diff --git a/sys/dev/cs/if_cs.c b/sys/dev/cs/if_cs.c index 3b28691cc678..a10d25d7a0ec 100644 --- a/sys/dev/cs/if_cs.c +++ b/sys/dev/cs/if_cs.c @@ -699,10 +699,6 @@ cs_init(void *xsc) struct ifnet *ifp = &sc->arpcom.ac_if; int i, s, rx_cfg; - /* address not known */ - if (TAILQ_EMPTY(&ifp->if_addrhead)) /* unlikely? XXX */ - return; - /* * reset whatchdog timer */ diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c index 5bac677dc94d..9b7a0d4085e8 100644 --- a/sys/dev/ed/if_ed.c +++ b/sys/dev/ed/if_ed.c @@ -1884,10 +1884,6 @@ ed_init(xsc) if (sc->gone) return; - /* address not known */ - if (TAILQ_EMPTY(&ifp->if_addrhead)) /* unlikely? XXX */ - return; - /* * Initialize the NIC in the exact order outlined in the NS manual. * This init procedure is "mandatory"...don't change what or when diff --git a/sys/dev/ex/if_ex.c b/sys/dev/ex/if_ex.c index 9d8b9b069c49..c0a64e0b76cb 100644 --- a/sys/dev/ex/if_ex.c +++ b/sys/dev/ex/if_ex.c @@ -305,9 +305,6 @@ ex_init(void *xsc) DODEBUG(Start_End, printf("%s: ex_init: start\n", ifp->if_xname);); - if (TAILQ_FIRST(&ifp->if_addrhead) == NULL) { - return; - } s = splimp(); ifp->if_timer = 0; diff --git a/sys/dev/fe/if_fe.c b/sys/dev/fe/if_fe.c index 613c76aacf41..ed89b5218f15 100644 --- a/sys/dev/fe/if_fe.c +++ b/sys/dev/fe/if_fe.c @@ -1007,14 +1007,6 @@ fe_init (void * xsc) struct fe_softc *sc = xsc; int s; - /* We need an address. */ - if (TAILQ_EMPTY(&sc->sc_if.if_addrhead)) { /* XXX unlikely */ -#ifdef DIAGNOSTIC - printf("%s: init() without any address\n", sc->sc_xname); -#endif - return; - } - /* Start initializing 86960. */ s = splimp(); diff --git a/sys/dev/lnc/if_lnc.c b/sys/dev/lnc/if_lnc.c index 52b54123b177..d3aabba17057 100644 --- a/sys/dev/lnc/if_lnc.c +++ b/sys/dev/lnc/if_lnc.c @@ -911,13 +911,6 @@ lnc_init(xsc) int s, i; char *lnc_mem; - /* Check that interface has valid address */ - - if (TAILQ_EMPTY(&sc->arpcom.ac_if.if_addrhead)) { /* XXX unlikely */ -printf("XXX no address?\n"); - return; - } - /* Shut down interface */ s = splimp(); diff --git a/sys/dev/sbni/if_sbni.c b/sys/dev/sbni/if_sbni.c index e4cacf2fd7ec..42c6573194bd 100644 --- a/sys/dev/sbni/if_sbni.c +++ b/sys/dev/sbni/if_sbni.c @@ -264,10 +264,6 @@ sbni_init(void *xsc) sc = (struct sbni_softc *)xsc; ifp = &sc->arpcom.ac_if; - /* address not known */ - if (TAILQ_EMPTY(&ifp->if_addrhead)) - return; - /* * kludge to avoid multiple initialization when more than once * protocols configured diff --git a/sys/dev/sn/if_sn.c b/sys/dev/sn/if_sn.c index f65aadaf90e5..57925fa866a6 100644 --- a/sys/dev/sn/if_sn.c +++ b/sys/dev/sn/if_sn.c @@ -215,24 +215,6 @@ sn_attach(device_t dev) ether_ifattach(ifp, sc->arpcom.ac_enaddr); - /* - * Fill the hardware address into ifa_addr if we find an AF_LINK - * entry. We need to do this so bpf's can get the hardware addr of - * this card. netstat likes this too! - */ - ifa = TAILQ_FIRST(&ifp->if_addrhead); - while ((ifa != 0) && (ifa->ifa_addr != 0) && - (ifa->ifa_addr->sa_family != AF_LINK)) - ifa = TAILQ_NEXT(ifa, ifa_link); - - if ((ifa != 0) && (ifa->ifa_addr != 0)) { - sdl = (struct sockaddr_dl *) ifa->ifa_addr; - sdl->sdl_type = IFT_ETHER; - sdl->sdl_alen = ETHER_ADDR_LEN; - sdl->sdl_slen = 0; - bcopy(sc->arpcom.ac_enaddr, LLADDR(sdl), ETHER_ADDR_LEN); - } - /* * Activate the interrupt so we can get card interrupts. This * needs to be done last so that we don't have/hold the lock diff --git a/sys/dev/wl/if_wl.c b/sys/dev/wl/if_wl.c index 47ee64708024..d582b8f33458 100644 --- a/sys/dev/wl/if_wl.c +++ b/sys/dev/wl/if_wl.c @@ -806,8 +806,6 @@ wlinit(void *xsc) if (sc->wl_if.if_flags & IFF_DEBUG) printf("wl%d: entered wlinit()\n",sc->unit); #endif - if (TAILQ_FIRST(&ifp->if_addrhead) == (struct ifaddr *)0) - return; WL_LOCK(sc); oldpri = splimp(); if ((stat = wlhwrst(sc)) == TRUE) { diff --git a/sys/dev/xe/if_xe.c b/sys/dev/xe/if_xe.c index dfb35ee27c34..0d9eb921c52f 100644 --- a/sys/dev/xe/if_xe.c +++ b/sys/dev/xe/if_xe.c @@ -317,8 +317,6 @@ xe_init(void *xscp) { unsigned i; int s; - if (TAILQ_EMPTY(&scp->ifp->if_addrhead)) return; - if (scp->autoneg_status != XE_AUTONEG_NONE) return; DEVPRINTF(2, (scp->dev, "init\n"));