diff options
author | brooks <brooks@FreeBSD.org> | 2005-06-10 16:49:24 +0000 |
---|---|---|
committer | brooks <brooks@FreeBSD.org> | 2005-06-10 16:49:24 +0000 |
commit | 567ba9b00a248431e7c1147c4e079fd7a11b9ecf (patch) | |
tree | f65b6d7834b40dfcd48534829a0a1e9529ab87ee /sys/pci | |
parent | 3eaa67c3ad947d85be5350e0e184cd6ee5b93a52 (diff) | |
download | FreeBSD-src-567ba9b00a248431e7c1147c4e079fd7a11b9ecf.zip FreeBSD-src-567ba9b00a248431e7c1147c4e079fd7a11b9ecf.tar.gz |
Stop embedding struct ifnet at the top of driver softcs. Instead the
struct ifnet or the layer 2 common structure it was embedded in have
been replaced with a struct ifnet pointer to be filled by a call to the
new function, if_alloc(). The layer 2 common structure is also allocated
via if_alloc() based on the interface type. It is hung off the new
struct ifnet member, if_l2com.
This change removes the size of these structures from the kernel ABI and
will allow us to better manage them as interfaces come and go.
Other changes of note:
- Struct arpcom is no longer referenced in normal interface code.
Instead the Ethernet address is accessed via the IFP2ENADDR() macro.
To enforce this ac_enaddr has been renamed to _ac_enaddr.
- The second argument to ether_ifattach is now always the mac address
from driver private storage rather than sometimes being ac_enaddr.
Reviewed by: sobomax, sam
Diffstat (limited to 'sys/pci')
-rw-r--r-- | sys/pci/if_dc.c | 54 | ||||
-rw-r--r-- | sys/pci/if_dcreg.h | 2 | ||||
-rw-r--r-- | sys/pci/if_de.c | 287 | ||||
-rw-r--r-- | sys/pci/if_devar.h | 6 | ||||
-rw-r--r-- | sys/pci/if_mn.c | 2 | ||||
-rw-r--r-- | sys/pci/if_pcn.c | 33 | ||||
-rw-r--r-- | sys/pci/if_pcnreg.h | 2 | ||||
-rw-r--r-- | sys/pci/if_rl.c | 40 | ||||
-rw-r--r-- | sys/pci/if_rlreg.h | 2 | ||||
-rw-r--r-- | sys/pci/if_sf.c | 37 | ||||
-rw-r--r-- | sys/pci/if_sfreg.h | 2 | ||||
-rw-r--r-- | sys/pci/if_sis.c | 41 | ||||
-rw-r--r-- | sys/pci/if_sisreg.h | 2 | ||||
-rw-r--r-- | sys/pci/if_sk.c | 52 | ||||
-rw-r--r-- | sys/pci/if_skreg.h | 2 | ||||
-rw-r--r-- | sys/pci/if_ste.c | 35 | ||||
-rw-r--r-- | sys/pci/if_stereg.h | 2 | ||||
-rw-r--r-- | sys/pci/if_ti.c | 64 | ||||
-rw-r--r-- | sys/pci/if_tireg.h | 2 | ||||
-rw-r--r-- | sys/pci/if_tl.c | 48 | ||||
-rw-r--r-- | sys/pci/if_tlreg.h | 2 | ||||
-rw-r--r-- | sys/pci/if_vr.c | 29 | ||||
-rw-r--r-- | sys/pci/if_vrreg.h | 2 | ||||
-rw-r--r-- | sys/pci/if_wb.c | 31 | ||||
-rw-r--r-- | sys/pci/if_wbreg.h | 2 | ||||
-rw-r--r-- | sys/pci/if_xl.c | 93 | ||||
-rw-r--r-- | sys/pci/if_xlreg.h | 2 |
27 files changed, 481 insertions, 395 deletions
diff --git a/sys/pci/if_dc.c b/sys/pci/if_dc.c index ae92c8d..f86d4e4 100644 --- a/sys/pci/if_dc.c +++ b/sys/pci/if_dc.c @@ -1084,7 +1084,7 @@ dc_setfilt_21143(struct dc_softc *sc) struct ifnet *ifp; int i; - ifp = &sc->arpcom.ac_if; + ifp = sc->dc_ifp; i = sc->dc_cdata.dc_tx_prod; DC_INC(sc->dc_cdata.dc_tx_prod, DC_TX_LIST_CNT); @@ -1124,9 +1124,9 @@ dc_setfilt_21143(struct dc_softc *sc) } /* Set our MAC address */ - sp[39] = DC_SP_MAC(((u_int16_t *)sc->arpcom.ac_enaddr)[0]); - sp[40] = DC_SP_MAC(((u_int16_t *)sc->arpcom.ac_enaddr)[1]); - sp[41] = DC_SP_MAC(((u_int16_t *)sc->arpcom.ac_enaddr)[2]); + sp[39] = DC_SP_MAC(((u_int16_t *)IFP2ENADDR(sc->dc_ifp))[0]); + sp[40] = DC_SP_MAC(((u_int16_t *)IFP2ENADDR(sc->dc_ifp))[1]); + sp[41] = DC_SP_MAC(((u_int16_t *)IFP2ENADDR(sc->dc_ifp))[2]); sframe->dc_status = htole32(DC_TXSTAT_OWN); CSR_WRITE_4(sc, DC_TXSTART, 0xFFFFFFFF); @@ -1150,11 +1150,11 @@ dc_setfilt_admtek(struct dc_softc *sc) int h = 0; u_int32_t hashes[2] = { 0, 0 }; - ifp = &sc->arpcom.ac_if; + ifp = sc->dc_ifp; /* Init our MAC address. */ - CSR_WRITE_4(sc, DC_AL_PAR0, *(u_int32_t *)(&sc->arpcom.ac_enaddr[0])); - CSR_WRITE_4(sc, DC_AL_PAR1, *(u_int32_t *)(&sc->arpcom.ac_enaddr[4])); + CSR_WRITE_4(sc, DC_AL_PAR0, *(u_int32_t *)(&IFP2ENADDR(sc->dc_ifp)[0])); + CSR_WRITE_4(sc, DC_AL_PAR1, *(u_int32_t *)(&IFP2ENADDR(sc->dc_ifp)[4])); /* If we want promiscuous mode, set the allframes bit. */ if (ifp->if_flags & IFF_PROMISC) @@ -1206,15 +1206,15 @@ dc_setfilt_asix(struct dc_softc *sc) int h = 0; u_int32_t hashes[2] = { 0, 0 }; - ifp = &sc->arpcom.ac_if; + ifp = sc->dc_ifp; /* Init our MAC address */ CSR_WRITE_4(sc, DC_AX_FILTIDX, DC_AX_FILTIDX_PAR0); CSR_WRITE_4(sc, DC_AX_FILTDATA, - *(u_int32_t *)(&sc->arpcom.ac_enaddr[0])); + *(u_int32_t *)(&IFP2ENADDR(sc->dc_ifp)[0])); CSR_WRITE_4(sc, DC_AX_FILTIDX, DC_AX_FILTIDX_PAR1); CSR_WRITE_4(sc, DC_AX_FILTDATA, - *(u_int32_t *)(&sc->arpcom.ac_enaddr[4])); + *(u_int32_t *)(&IFP2ENADDR(sc->dc_ifp)[4])); /* If we want promiscuous mode, set the allframes bit. */ if (ifp->if_flags & IFF_PROMISC) @@ -1275,7 +1275,7 @@ dc_setfilt_xircom(struct dc_softc *sc) u_int32_t h, *sp; int i; - ifp = &sc->arpcom.ac_if; + ifp = sc->dc_ifp; DC_CLRBIT(sc, DC_NETCFG, (DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)); i = sc->dc_cdata.dc_tx_prod; @@ -1316,9 +1316,9 @@ dc_setfilt_xircom(struct dc_softc *sc) } /* Set our MAC address */ - sp[0] = DC_SP_MAC(((u_int16_t *)sc->arpcom.ac_enaddr)[0]); - sp[1] = DC_SP_MAC(((u_int16_t *)sc->arpcom.ac_enaddr)[1]); - sp[2] = DC_SP_MAC(((u_int16_t *)sc->arpcom.ac_enaddr)[2]); + sp[0] = DC_SP_MAC(((u_int16_t *)IFP2ENADDR(sc->dc_ifp))[0]); + sp[1] = DC_SP_MAC(((u_int16_t *)IFP2ENADDR(sc->dc_ifp))[1]); + sp[2] = DC_SP_MAC(((u_int16_t *)IFP2ENADDR(sc->dc_ifp))[2]); DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_TX_ON); DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ON); @@ -2090,7 +2090,6 @@ dc_attach(device_t dev) } sc->dc_unit = unit; - bcopy(eaddr, &sc->arpcom.ac_enaddr, ETHER_ADDR_LEN); /* Allocate a busdma tag and DMA safe memory for TX/RX descriptors. */ error = bus_dma_tag_create(NULL, PAGE_SIZE, 0, BUS_SPACE_MAXADDR_32BIT, @@ -2180,7 +2179,12 @@ dc_attach(device_t dev) goto fail; } - ifp = &sc->arpcom.ac_if; + ifp = sc->dc_ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + printf("dc%d: can not if_alloc()\n", unit); + error = ENOSPC; + goto fail; + } ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); /* XXX: bleah, MTU gets overwritten in ether_ifattach() */ @@ -2309,6 +2313,7 @@ dc_attach(device_t dev) if (error) { printf("dc%d: couldn't set up irq\n", unit); ether_ifdetach(ifp); + if_free(ifp); goto fail; } @@ -2337,12 +2342,13 @@ dc_detach(device_t dev) KASSERT(mtx_initialized(&sc->dc_mtx), ("dc mutex not initialized")); DC_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->dc_ifp; /* These should only be active if attach succeeded */ if (device_is_attached(dev)) { dc_stop(sc); ether_ifdetach(ifp); + if_free(ifp); } if (sc->dc_miibus) device_delete_child(dev, sc->dc_miibus); @@ -2687,7 +2693,7 @@ dc_rxeof(struct dc_softc *sc) DC_LOCK_ASSERT(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->dc_ifp; i = sc->dc_cdata.dc_rx_prod; bus_dmamap_sync(sc->dc_ltag, sc->dc_lmap, BUS_DMASYNC_POSTREAD); @@ -2801,7 +2807,7 @@ dc_txeof(struct dc_softc *sc) int idx; u_int32_t ctl, txstat; - ifp = &sc->arpcom.ac_if; + ifp = sc->dc_ifp; /* * Go through our tx list and free mbufs for those @@ -2909,7 +2915,7 @@ dc_tick(void *xsc) sc = xsc; DC_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->dc_ifp; mii = device_get_softc(sc->dc_miibus); if (sc->dc_flags & DC_REDUCED_MII_POLL) { @@ -3100,7 +3106,7 @@ dc_intr(void *arg) return; DC_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->dc_ifp; #ifdef DEVICE_POLLING if (ifp->if_flags & IFF_POLLING) goto done; @@ -3377,7 +3383,7 @@ static void dc_init(void *xsc) { struct dc_softc *sc = xsc; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->dc_ifp; struct mii_data *mii; DC_LOCK(sc); @@ -3705,7 +3711,7 @@ dc_stop(struct dc_softc *sc) DC_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->dc_ifp; ifp->if_timer = 0; ld = sc->dc_ldata; cd = &sc->dc_cdata; @@ -3791,7 +3797,7 @@ dc_resume(device_t dev) s = splimp(); sc = device_get_softc(dev); - ifp = &sc->arpcom.ac_if; + ifp = sc->dc_ifp; /* reinitialize interface if necessary */ if (ifp->if_flags & IFF_UP) diff --git a/sys/pci/if_dcreg.h b/sys/pci/if_dcreg.h index 5cc5049..a851a72 100644 --- a/sys/pci/if_dcreg.h +++ b/sys/pci/if_dcreg.h @@ -716,7 +716,7 @@ struct dc_mii_frame { struct dc_softc { - struct arpcom arpcom; /* interface info */ + struct ifnet *dc_ifp; /* interface info */ bus_space_handle_t dc_bhandle; /* bus space handle */ bus_space_tag_t dc_btag; /* bus space tag */ bus_dma_tag_t dc_ltag; /* tag for descriptor ring */ diff --git a/sys/pci/if_de.c b/sys/pci/if_de.c index da2310f..c8bf575 100644 --- a/sys/pci/if_de.c +++ b/sys/pci/if_de.c @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include <net/if_arp.h> #include <net/ethernet.h> #include <net/if_media.h> +#include <net/if_types.h> #include <net/if_dl.h> #ifdef TULIP_USE_SOFTINTR #include <net/netisr.h> @@ -207,8 +208,8 @@ tulip_txprobe( /* * Construct a LLC TEST message which will point to ourselves. */ - bcopy(sc->tulip_enaddr, mtod(m, struct ether_header *)->ether_dhost, 6); - bcopy(sc->tulip_enaddr, mtod(m, struct ether_header *)->ether_shost, 6); + bcopy(IFP2ENADDR(sc->tulip_ifp), mtod(m, struct ether_header *)->ether_dhost, 6); + bcopy(IFP2ENADDR(sc->tulip_ifp), mtod(m, struct ether_header *)->ether_shost, 6); mtod(m, struct ether_header *)->ether_type = htons(3); mtod(m, unsigned char *)[14] = 0; mtod(m, unsigned char *)[15] = 0; @@ -229,7 +230,7 @@ tulip_txprobe( } #ifdef BIG_PACKET -#define TULIP_SIAGEN_WATCHDOG (sc->tulip_if.if_mtu > ETHERMTU ? TULIP_WATCHDOG_RXDISABLE|TULIP_WATCHDOG_TXDISABLE : 0) +#define TULIP_SIAGEN_WATCHDOG (sc->tulip_ifp->if_mtu > ETHERMTU ? TULIP_WATCHDOG_RXDISABLE|TULIP_WATCHDOG_TXDISABLE : 0) #else #define TULIP_SIAGEN_WATCHDOG 0 #endif @@ -336,10 +337,10 @@ tulip_linkup( if ((sc->tulip_flags & TULIP_LINKUP) == 0) sc->tulip_flags |= TULIP_PRINTLINKUP; sc->tulip_flags |= TULIP_LINKUP; - sc->tulip_if.if_flags &= ~IFF_OACTIVE; + sc->tulip_ifp->if_flags &= ~IFF_OACTIVE; #if 0 /* XXX how does with work with ifmedia? */ if ((sc->tulip_flags & TULIP_DIDNWAY) == 0) { - if (sc->tulip_if.if_flags & IFF_FULLDUPLEX) { + if (sc->tulip_ifp->if_flags & IFF_FULLDUPLEX) { if (TULIP_CAN_MEDIA_FD(media) && sc->tulip_mediums[TULIP_FD_MEDIA_OF(media)] != NULL) media = TULIP_FD_MEDIA_OF(media); @@ -386,15 +387,16 @@ static void tulip_media_print( tulip_softc_t * const sc) { + struct ifnet *ifp = sc->tulip_ifp; + if ((sc->tulip_flags & TULIP_LINKUP) == 0) return; if (sc->tulip_flags & TULIP_PRINTMEDIA) { - printf("%s: enabling %s port\n", - sc->tulip_xname, + if_printf(ifp, "enabling %s port\n", tulip_mediums[sc->tulip_media]); sc->tulip_flags &= ~(TULIP_PRINTMEDIA|TULIP_PRINTLINKUP); } else if (sc->tulip_flags & TULIP_PRINTLINKUP) { - printf("%s: link up\n", sc->tulip_xname); + if_printf(ifp, "link up\n"); sc->tulip_flags &= ~TULIP_PRINTLINKUP; } } @@ -404,6 +406,7 @@ static tulip_media_t tulip_21140_gpr_media_sense( tulip_softc_t * const sc) { + struct ifnet *ifp sc->tulip_ifp; tulip_media_t maybe_media = TULIP_MEDIA_UNKNOWN; tulip_media_t last_media = TULIP_MEDIA_UNKNOWN; tulip_media_t media; @@ -441,8 +444,8 @@ tulip_21140_gpr_media_sense( continue; #if defined(TULIP_DEBUG) - printf("%s: gpr_media_sense: %s: 0x%02x & 0x%02x == 0x%02x\n", - sc->tulip_xname, tulip_mediums[media], + if_printf(ifp, "gpr_media_sense: %s: 0x%02x & 0x%02x == 0x%02x\n", + tulip_mediums[media], TULIP_CSR_READ(sc, csr_gp) & 0xFF, mi->mi_actmask, mi->mi_actdata); #endif @@ -466,6 +469,7 @@ static tulip_link_status_t tulip_media_link_monitor( tulip_softc_t * const sc) { + struct ifnet *ifp = sc->tulip_ifp; const tulip_media_info_t * const mi = sc->tulip_mediums[sc->tulip_media]; tulip_link_status_t linkup = TULIP_LINK_DOWN; @@ -506,7 +510,7 @@ tulip_media_link_monitor( if (abilities != sc->tulip_abilities) { #if defined(TULIP_DEBUG) loudprintf("%s(phy%d): autonegotiation changed: 0x%04x -> 0x%04x\n", - sc->tulip_xname, sc->tulip_phyaddr, + ifp->if_xname, sc->tulip_phyaddr, sc->tulip_abilities, abilities); #endif if (tulip_mii_map_abilities(sc, abilities)) { @@ -548,7 +552,7 @@ tulip_media_link_monitor( linkup = TULIP_LINK_UP; #if defined(TULIP_DEBUG) if (sc->tulip_probe_timeout <= 0) - printf("%s: sia status = 0x%08x\n", sc->tulip_xname, + if_printf(ifp, "sia status = 0x%08x\n", TULIP_CSR_READ(sc, csr_sia_status)); #endif } else if (mi->mi_type == TULIP_MEDIAINFO_SYM) { @@ -564,7 +568,7 @@ tulip_media_link_monitor( return TULIP_LINK_UP; sc->tulip_flags &= ~TULIP_LINKUP; - printf("%s: link down: cable problem?\n", sc->tulip_xname); + if_printf(ifp, "link down: cable problem?\n"); } #if defined(TULIP_DEBUG) sc->tulip_dbg.dbg_link_downed++; @@ -577,6 +581,8 @@ tulip_media_poll( tulip_softc_t * const sc, tulip_mediapoll_event_t event) { + struct ifnet *ifp = sc->tulip_ifp; + #if defined(TULIP_DEBUG) sc->tulip_dbg.dbg_events[event]++; #endif @@ -613,7 +619,7 @@ tulip_media_poll( sc->tulip_dbg.dbg_link_failures++; #endif sc->tulip_media = TULIP_MEDIA_UNKNOWN; - if (sc->tulip_if.if_flags & IFF_UP) + if (sc->tulip_ifp->if_flags & IFF_UP) tulip_reset(sc); /* restart probe */ } return; @@ -624,7 +630,7 @@ tulip_media_poll( } if (event == TULIP_MEDIAPOLL_START) { - sc->tulip_if.if_flags |= IFF_OACTIVE; + sc->tulip_ifp->if_flags |= IFF_OACTIVE; if (sc->tulip_probe_state != TULIP_PROBE_INACTIVE) return; sc->tulip_probe_mediamask = 0; @@ -695,8 +701,8 @@ tulip_media_poll( if (sc->tulip_probe_timeout > 0) { tulip_media_t new_probe_media = tulip_21140_gpr_media_sense(sc); #if defined(TULIP_DEBUG) - printf("%s: media_poll: gpr sensing = %s\n", - sc->tulip_xname, tulip_mediums[new_probe_media]); + if_printf(ifp, "media_poll: gpr sensing = %s\n", + tulip_mediums[new_probe_media]); #endif if (new_probe_media != TULIP_MEDIA_UNKNOWN) { if (new_probe_media == sc->tulip_probe_media) { @@ -782,8 +788,7 @@ tulip_media_poll( if (/* event == TULIP_MEDIAPOLL_TXPROBE_FAILED || */ sc->tulip_probe_timeout <= 0) { #if defined(TULIP_DEBUG) if (sc->tulip_probe_media == TULIP_MEDIA_UNKNOWN) { - printf("%s: poll media unknown!\n", - sc->tulip_xname); + if_printf(ifp, "poll media unknown!\n"); sc->tulip_probe_media = TULIP_MEDIA_MAX; } #endif @@ -795,10 +800,9 @@ tulip_media_poll( sc->tulip_probe_media -= 1; if (sc->tulip_probe_media == TULIP_MEDIA_UNKNOWN) { if (++sc->tulip_probe_passes == 3) { - printf("%s: autosense failed: cable problem?\n", - sc->tulip_xname); - if ((sc->tulip_if.if_flags & IFF_UP) == 0) { - sc->tulip_if.if_flags &= ~IFF_RUNNING; + if_printf(ifp, "autosense failed: cable problem?\n"); + if ((sc->tulip_ifp->if_flags & IFF_UP) == 0) { + sc->tulip_ifp->if_flags &= ~IFF_RUNNING; sc->tulip_probe_state = TULIP_PROBE_INACTIVE; return; } @@ -812,7 +816,7 @@ tulip_media_poll( || TULIP_IS_MEDIA_FD(sc->tulip_probe_media)); #if defined(TULIP_DEBUG) - printf("%s: %s: probing %s\n", sc->tulip_xname, + if_printf(ifp, "%s: probing %s\n", event == TULIP_MEDIAPOLL_TXPROBE_FAILED ? "txprobe failed" : "timeout", tulip_mediums[sc->tulip_probe_media]); #endif @@ -892,7 +896,7 @@ tulip_21040_mediainfo_init( { sc->tulip_cmdmode |= TULIP_CMD_CAPTREFFCT|TULIP_CMD_THRSHLD160 |TULIP_CMD_BACKOFFCTR; - sc->tulip_if.if_baudrate = 10000000; + sc->tulip_ifp->if_baudrate = 10000000; if (media == TULIP_MEDIA_10BASET || media == TULIP_MEDIA_UNKNOWN) { TULIP_MEDIAINFO_SIA_INIT(sc, &sc->tulip_mediainfo[0], 21040, 10BASET); @@ -1005,7 +1009,7 @@ static void tulip_21041_media_probe( tulip_softc_t * const sc) { - sc->tulip_if.if_baudrate = 10000000; + sc->tulip_ifp->if_baudrate = 10000000; sc->tulip_cmdmode |= TULIP_CMD_CAPTREFFCT|TULIP_CMD_ENHCAPTEFFCT |TULIP_CMD_THRSHLD160|TULIP_CMD_BACKOFFCTR; sc->tulip_intrmask |= TULIP_STS_LINKPASS|TULIP_STS_LINKFAIL; @@ -1037,7 +1041,7 @@ tulip_21041_media_poll( * restart the probe (and reset the tulip to a known state). */ if (event == TULIP_MEDIAPOLL_START) { - sc->tulip_if.if_flags |= IFF_OACTIVE; + sc->tulip_ifp->if_flags |= IFF_OACTIVE; sc->tulip_cmdmode &= ~(TULIP_CMD_FULLDUPLEX|TULIP_CMD_RXRUN); #ifdef notyet if (sc->tulip_revinfo >= 0x20) { @@ -1141,10 +1145,10 @@ tulip_21041_media_poll( sc->tulip_flags &= ~TULIP_WANTRXACT; sc->tulip_probe_timeout = TULIP_21041_PROBE_AUIBNC_TIMEOUT; } else { - printf("%s: autosense failed: cable problem?\n", - sc->tulip_xname); - if ((sc->tulip_if.if_flags & IFF_UP) == 0) { - sc->tulip_if.if_flags &= ~IFF_RUNNING; + if_printf(sc->tulip_ifp, + "autosense failed: cable problem?\n"); + if ((sc->tulip_ifp->if_flags & IFF_UP) == 0) { + sc->tulip_ifp->if_flags &= ~IFF_RUNNING; sc->tulip_probe_state = TULIP_PROBE_INACTIVE; return; } @@ -1335,6 +1339,8 @@ tulip_mii_autonegotiate( tulip_softc_t * const sc, const unsigned phyaddr) { + struct ifnet *ifp = sc->tulip_ifp; + switch (sc->tulip_probe_state) { case TULIP_PROBE_MEDIATEST: case TULIP_PROBE_INACTIVE: { @@ -1354,17 +1360,17 @@ tulip_mii_autonegotiate( return; } printf("%s(phy%d): error: reset of PHY never completed!\n", - sc->tulip_xname, phyaddr); + ifp->if_xname, phyaddr); sc->tulip_flags &= ~TULIP_TXPROBE_ACTIVE; sc->tulip_probe_state = TULIP_PROBE_FAILED; - sc->tulip_if.if_flags &= ~(IFF_UP|IFF_RUNNING); + sc->tulip_ifp->if_flags &= ~(IFF_UP|IFF_RUNNING); return; } status = tulip_mii_readreg(sc, phyaddr, PHYREG_STATUS); if ((status & PHYSTS_CAN_AUTONEG) == 0) { #if defined(TULIP_DEBUG) loudprintf("%s(phy%d): autonegotiation disabled\n", - sc->tulip_xname, phyaddr); + ifp->if_xname, phyaddr); #endif sc->tulip_flags &= ~TULIP_DIDNWAY; sc->tulip_probe_state = TULIP_PROBE_MEDIATEST; @@ -1377,10 +1383,10 @@ tulip_mii_autonegotiate( #if defined(TULIP_DEBUG) if ((data & PHYCTL_AUTONEG_ENABLE) == 0) loudprintf("%s(phy%d): oops: enable autonegotiation failed: 0x%04x\n", - sc->tulip_xname, phyaddr, data); + ifp->if_xname, phyaddr, data); else loudprintf("%s(phy%d): autonegotiation restarted: 0x%04x\n", - sc->tulip_xname, phyaddr, data); + ifp->if_xname, phyaddr, data); sc->tulip_dbg.dbg_nway_starts++; #endif sc->tulip_probe_state = TULIP_PROBE_PHYAUTONEG; @@ -1397,7 +1403,7 @@ tulip_mii_autonegotiate( } #if defined(TULIP_DEBUG) loudprintf("%s(phy%d): autonegotiation timeout: sts=0x%04x, ctl=0x%04x\n", - sc->tulip_xname, phyaddr, status, + ifp->if_xname, phyaddr, status, tulip_mii_readreg(sc, phyaddr, PHYREG_CONTROL)); #endif sc->tulip_flags &= ~TULIP_DIDNWAY; @@ -1407,7 +1413,7 @@ tulip_mii_autonegotiate( data = tulip_mii_readreg(sc, phyaddr, PHYREG_AUTONEG_ABILITIES); #if defined(TULIP_DEBUG) loudprintf("%s(phy%d): autonegotiation complete: 0x%04x\n", - sc->tulip_xname, phyaddr, data); + ifp->if_xname, phyaddr, data); #endif data = (data << 6) & status; if (!tulip_mii_map_abilities(sc, data)) @@ -1423,7 +1429,7 @@ tulip_mii_autonegotiate( } #if defined(TULIP_DEBUG) loudprintf("%s(phy%d): autonegotiation failure: state = %d\n", - sc->tulip_xname, phyaddr, sc->tulip_probe_state); + ifp->if_xname, phyaddr, sc->tulip_probe_state); sc->tulip_dbg.dbg_nway_failures++; #endif } @@ -1458,8 +1464,7 @@ tulip_2114x_media_preset( } #if defined(TULIP_DEBUG) } else { - printf("%s: preset: bad media %d!\n", - sc->tulip_xname, media); + if_printf(sc->tulip_ifp, "preset: bad media %d!\n", media); } #endif } @@ -1469,13 +1474,13 @@ tulip_2114x_media_preset( case TULIP_MEDIA_10BASET: { sc->tulip_cmdmode &= ~TULIP_CMD_FULLDUPLEX; sc->tulip_cmdmode |= TULIP_CMD_TXTHRSHLDCTL; - sc->tulip_if.if_baudrate = 10000000; + sc->tulip_ifp->if_baudrate = 10000000; sc->tulip_flags |= TULIP_SQETEST; break; } case TULIP_MEDIA_10BASET_FD: { sc->tulip_cmdmode |= TULIP_CMD_FULLDUPLEX|TULIP_CMD_TXTHRSHLDCTL; - sc->tulip_if.if_baudrate = 10000000; + sc->tulip_ifp->if_baudrate = 10000000; break; } case TULIP_MEDIA_100BASEFX: @@ -1483,14 +1488,14 @@ tulip_2114x_media_preset( case TULIP_MEDIA_100BASETX: { sc->tulip_cmdmode &= ~(TULIP_CMD_FULLDUPLEX|TULIP_CMD_TXTHRSHLDCTL); sc->tulip_cmdmode |= TULIP_CMD_PORTSELECT; - sc->tulip_if.if_baudrate = 100000000; + sc->tulip_ifp->if_baudrate = 100000000; break; } case TULIP_MEDIA_100BASEFX_FD: case TULIP_MEDIA_100BASETX_FD: { sc->tulip_cmdmode |= TULIP_CMD_FULLDUPLEX|TULIP_CMD_PORTSELECT; sc->tulip_cmdmode &= ~TULIP_CMD_TXTHRSHLDCTL; - sc->tulip_if.if_baudrate = 100000000; + sc->tulip_ifp->if_baudrate = 100000000; break; } default: { @@ -1514,8 +1519,7 @@ tulip_null_media_poll( sc->tulip_dbg.dbg_events[event]++; #endif #if defined(DIAGNOSTIC) - printf("%s: botch(media_poll) at line %d\n", - sc->tulip_xname, __LINE__); + if_printf(sc->tulip_ifp, "botch(media_poll) at line %d\n", __LINE__); #endif } @@ -2261,7 +2265,7 @@ tulip_identify_asante_nic( mi->mi_phyaddr = tulip_mii_get_phyaddr(sc, 0); } if (mi->mi_phyaddr == TULIP_MII_NOPHY) { - printf("%s: can't find phy 0\n", sc->tulip_xname); + if_printf(sc->tulip_ifp, "can't find phy 0\n"); return; } @@ -2312,7 +2316,7 @@ tulip_identify_compex_nic( root_sc->tulip_slaves = sc; } else if(sc->tulip_features & TULIP_HAVE_SLAVEDINTR) { printf("\nCannot find master device for %s interrupts", - sc->tulip_xname); + sc->tulip_ifp->if_xname); } } else { strcat(sc->tulip_boardid, "unknown "); @@ -2514,8 +2518,8 @@ tulip_srom_decode( } if (mi->mi_phyaddr == TULIP_MII_NOPHY) { #if defined(TULIP_DEBUG) - printf("%s: can't find phy %d\n", - sc->tulip_xname, phyno); + if_printf(sc->tulip_ifp, "can't find phy %d\n", + phyno); #endif break; } @@ -2615,8 +2619,8 @@ tulip_srom_decode( } if (mi->mi_phyaddr == TULIP_MII_NOPHY) { #if defined(TULIP_DEBUG) - printf("%s: can't find phy %d\n", - sc->tulip_xname, phyno); + if_printf(sc->tulip_ifp, "can't find phy %d\n", + phyno); #endif break; } @@ -2994,18 +2998,18 @@ tulip_addr_filter( sc->tulip_cmdmode &= ~TULIP_CMD_RXRUN; sc->tulip_intrmask &= ~TULIP_STS_RXSTOPPED; #if defined(IFF_ALLMULTI) - if (sc->tulip_if.if_flags & IFF_ALLMULTI) + if (sc->tulip_ifp->if_flags & IFF_ALLMULTI) sc->tulip_flags |= TULIP_ALLMULTI ; #endif multicnt = 0; - TAILQ_FOREACH(ifma, &sc->tulip_if.if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &sc->tulip_ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family == AF_LINK) multicnt++; } - sc->tulip_if.if_start = tulip_ifstart; /* so the setup packet gets queued */ + sc->tulip_ifp->if_start = tulip_ifstart; /* so the setup packet gets queued */ if (multicnt > 14) { u_int32_t *sp = sc->tulip_setupdata; unsigned hash; @@ -3027,7 +3031,7 @@ tulip_addr_filter( */ bzero(sc->tulip_setupdata, sizeof(sc->tulip_setupdata)); - TAILQ_FOREACH(ifma, &sc->tulip_if.if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &sc->tulip_ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -3044,14 +3048,14 @@ tulip_addr_filter( * receiving every multicast. */ if ((sc->tulip_flags & TULIP_ALLMULTI) == 0) { - hash = tulip_mchash(sc->tulip_if.if_broadcastaddr); + hash = tulip_mchash(sc->tulip_ifp->if_broadcastaddr); #if BYTE_ORDER == BIG_ENDIAN sp[hash >> 4] |= bswap32(1 << (hash & 0xF)); #else sp[hash >> 4] |= 1 << (hash & 0xF); #endif if (sc->tulip_flags & TULIP_WANTHASHONLY) { - hash = tulip_mchash(sc->tulip_enaddr); + hash = tulip_mchash(IFP2ENADDR(sc->tulip_ifp)); #if BYTE_ORDER == BIG_ENDIAN sp[hash >> 4] |= bswap32(1 << (hash & 0xF)); #else @@ -3059,13 +3063,13 @@ tulip_addr_filter( #endif } else { #if BYTE_ORDER == BIG_ENDIAN - sp[39] = ((u_int16_t *) sc->tulip_enaddr)[0] << 16; - sp[40] = ((u_int16_t *) sc->tulip_enaddr)[1] << 16; - sp[41] = ((u_int16_t *) sc->tulip_enaddr)[2] << 16; + sp[39] = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[0] << 16; + sp[40] = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[1] << 16; + sp[41] = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[2] << 16; #else - sp[39] = ((u_int16_t *) sc->tulip_enaddr)[0]; - sp[40] = ((u_int16_t *) sc->tulip_enaddr)[1]; - sp[41] = ((u_int16_t *) sc->tulip_enaddr)[2]; + sp[39] = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[0]; + sp[40] = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[1]; + sp[41] = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[2]; #endif } } @@ -3077,7 +3081,7 @@ tulip_addr_filter( /* * Else can get perfect filtering for 16 addresses. */ - TAILQ_FOREACH(ifma, &sc->tulip_if.if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &sc->tulip_ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; addrp = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); @@ -3111,19 +3115,19 @@ tulip_addr_filter( */ for (; idx < 16; idx++) { #if BYTE_ORDER == BIG_ENDIAN - *sp++ = ((u_int16_t *) sc->tulip_enaddr)[0] << 16; - *sp++ = ((u_int16_t *) sc->tulip_enaddr)[1] << 16; - *sp++ = ((u_int16_t *) sc->tulip_enaddr)[2] << 16; + *sp++ = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[0] << 16; + *sp++ = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[1] << 16; + *sp++ = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[2] << 16; #else - *sp++ = ((u_int16_t *) sc->tulip_enaddr)[0]; - *sp++ = ((u_int16_t *) sc->tulip_enaddr)[1]; - *sp++ = ((u_int16_t *) sc->tulip_enaddr)[2]; + *sp++ = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[0]; + *sp++ = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[1]; + *sp++ = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[2]; #endif } } #if defined(IFF_ALLMULTI) if (sc->tulip_flags & TULIP_ALLMULTI) - sc->tulip_if.if_flags |= IFF_ALLMULTI; + sc->tulip_ifp->if_flags |= IFF_ALLMULTI; #endif } @@ -3154,8 +3158,8 @@ tulip_reset( if (!inreset) { sc->tulip_flags |= TULIP_INRESET; sc->tulip_flags &= ~(TULIP_NEEDRESET|TULIP_RXBUFSLOW); - sc->tulip_if.if_flags &= ~IFF_OACTIVE; - sc->tulip_if.if_start = tulip_ifstart; + sc->tulip_ifp->if_flags &= ~IFF_OACTIVE; + sc->tulip_ifp->if_start = tulip_ifstart; } #if defined(TULIP_BUS_DMA) && !defined(TULIP_BUS_DMA_NOTX) @@ -3259,8 +3263,8 @@ tulip_reset( (*sc->tulip_boardsw->bd_media_select)(sc); #if defined(TULIP_DEBUG) if ((sc->tulip_flags & TULIP_NEEDRESET) == TULIP_NEEDRESET) - printf("%s: tulip_reset: additional reset needed?!?\n", - sc->tulip_xname); + if_printf(sc->tulip_ifp, + "tulip_reset: additional reset needed?!?\n"); #endif if (bootverbose) tulip_media_print(sc); @@ -3284,13 +3288,13 @@ static void tulip_init( tulip_softc_t * const sc) { - if (sc->tulip_if.if_flags & IFF_UP) { - if ((sc->tulip_if.if_flags & IFF_RUNNING) == 0) { + if (sc->tulip_ifp->if_flags & IFF_UP) { + if ((sc->tulip_ifp->if_flags & IFF_RUNNING) == 0) { /* initialize the media */ tulip_reset(sc); } - sc->tulip_if.if_flags |= IFF_RUNNING; - if (sc->tulip_if.if_flags & IFF_PROMISC) { + sc->tulip_ifp->if_flags |= IFF_RUNNING; + if (sc->tulip_ifp->if_flags & IFF_PROMISC) { sc->tulip_flags |= TULIP_PROMISC; sc->tulip_cmdmode |= TULIP_CMD_PROMISCUOUS; sc->tulip_intrmask |= TULIP_STS_TXINTR; @@ -3309,7 +3313,7 @@ tulip_init( sc->tulip_cmdmode |= TULIP_CMD_RXRUN; sc->tulip_intrmask |= TULIP_STS_RXSTOPPED; } else { - sc->tulip_if.if_flags |= IFF_OACTIVE; + sc->tulip_ifp->if_flags |= IFF_OACTIVE; sc->tulip_cmdmode &= ~TULIP_CMD_RXRUN; sc->tulip_intrmask &= ~TULIP_STS_RXSTOPPED; } @@ -3318,7 +3322,7 @@ tulip_init( if ((sc->tulip_flags & (TULIP_WANTSETUP|TULIP_TXPROBE_ACTIVE)) == TULIP_WANTSETUP) tulip_txput_setup(sc); } else { - sc->tulip_if.if_flags &= ~IFF_RUNNING; + sc->tulip_ifp->if_flags &= ~IFF_RUNNING; tulip_reset(sc); } } @@ -3329,7 +3333,7 @@ tulip_rx_intr( { TULIP_PERFSTART(rxintr) tulip_ringinfo_t * const ri = &sc->tulip_rxinfo; - struct ifnet * const ifp = &sc->tulip_if; + struct ifnet * const ifp = sc->tulip_ifp; int fillok = 1; #if defined(TULIP_DEBUG) int cnt = 0; @@ -3431,7 +3435,7 @@ tulip_rx_intr( if ((sc->tulip_flags & TULIP_RXIGNORE) == 0 && ((eop->d_status & TULIP_DSTS_ERRSUM) == 0 #ifdef BIG_PACKET - || (total_len <= sc->tulip_if.if_mtu + sizeof(struct ether_header) && + || (total_len <= sc->tulip_ifp->if_mtu + sizeof(struct ether_header) && (eop->d_status & (TULIP_DSTS_RxBADLENGTH|TULIP_DSTS_RxRUNT| TULIP_DSTS_RxCOLLSEEN|TULIP_DSTS_RxBADCRC| TULIP_DSTS_RxOVERFLOW)) == 0) @@ -3451,7 +3455,7 @@ tulip_rx_intr( #endif /* TULIP_BUS_DMA */ #ifndef __FreeBSD__ - if (sc->tulip_if.if_bpf != NULL) { + if (sc->tulip_ifp->if_bpf != NULL) { if (me == ms) bpf_tap(&sc->tulip_if, mtod(ms, caddr_t), total_len); else @@ -3489,8 +3493,7 @@ tulip_rx_intr( } #if defined(TULIP_VERBOSE) if (error != NULL && (sc->tulip_flags & TULIP_NOMESSAGES) == 0) { - printf("%s: receive: %6D: %s\n", - sc->tulip_xname, + if_printf(sc->tulip_ifp, "receive: %6D: %s\n", mtod(ms, u_char *) + 6, ":", error); sc->tulip_flags |= TULIP_NOMESSAGES; @@ -3601,8 +3604,8 @@ tulip_rx_intr( error = bus_dmamap_load(sc->tulip_dmatag, map, mtod(ms, void *), TULIP_RX_BUFLEN, NULL, BUS_DMA_NOWAIT); if (error) { - printf("%s: unable to load rx map, " - "error = %d\n", sc->tulip_xname, error); + if_printf(sc->tulip_ifp, + "unable to load rx map, error = %d\n", error); panic("tulip_rx_intr"); /* XXX */ } nextout->d_addr1 = map->dm_segs[0].ds_addr; @@ -3693,8 +3696,8 @@ tulip_tx_intr( m_freem(m); #if defined(TULIP_DEBUG) } else { - printf("%s: tx_intr: failed to dequeue mbuf?!?\n", - sc->tulip_xname); + if_printf(sc->tulip_ifp, + "tx_intr: failed to dequeue mbuf?!?\n"); #endif } if (sc->tulip_flags & TULIP_TXPROBE_ACTIVE) { @@ -3716,7 +3719,7 @@ tulip_tx_intr( } else { xmits++; if (d_status & TULIP_DSTS_ERRSUM) { - sc->tulip_if.if_oerrors++; + sc->tulip_ifp->if_oerrors++; if (d_status & TULIP_DSTS_TxEXCCOLL) sc->tulip_dot3stats.dot3StatsExcessiveCollisions++; if (d_status & TULIP_DSTS_TxLATECOLL) @@ -3733,7 +3736,7 @@ tulip_tx_intr( u_int32_t collisions = (d_status & TULIP_DSTS_TxCOLLMASK) >> TULIP_DSTS_V_TxCOLLCNT; - sc->tulip_if.if_collisions += collisions; + sc->tulip_ifp->if_collisions += collisions; if (collisions == 1) sc->tulip_dot3stats.dot3StatsSingleCollisionFrames++; else if (collisions > 1) @@ -3757,7 +3760,7 @@ tulip_tx_intr( ri->ri_nextin = ri->ri_first; if ((sc->tulip_flags & TULIP_TXPROBE_ACTIVE) == 0) - sc->tulip_if.if_flags &= ~IFF_OACTIVE; + sc->tulip_ifp->if_flags &= ~IFF_OACTIVE; } /* * If nothing left to transmit, disable the timer. @@ -3767,7 +3770,7 @@ tulip_tx_intr( sc->tulip_txtimer = 0; else if (xmits > 0) sc->tulip_txtimer = TULIP_TXTIMER; - sc->tulip_if.if_opackets += xmits; + sc->tulip_ifp->if_opackets += xmits; TULIP_PERFEND(txintr); return descs; } @@ -3783,7 +3786,7 @@ tulip_print_abnormal_interrupt( const char thrsh[] = "72|128\0\0\0" "96|256\0\0\0" "128|512\0\0" "160|1024"; csr &= (1 << (sizeof(tulip_status_bits)/sizeof(tulip_status_bits[0]))) - 1; - printf("%s: abnormal interrupt:", sc->tulip_xname); + if_printf(sc->tulip_ifp, "abnormal interrupt:"); for (sep = " ", mask = 1; mask <= csr; mask <<= 1, msgp++) { if ((csr & mask) && *msgp != NULL) { printf("%s%s", sep, *msgp); @@ -3819,8 +3822,7 @@ tulip_intr_handler( if (sc->tulip_flags & TULIP_NOMESSAGES) { sc->tulip_flags |= TULIP_SYSTEMERROR; } else { - printf("%s: system error: %s\n", - sc->tulip_xname, + if_printf(sc->tulip_ifp, "system error: %s\n", tulip_system_errors[sc->tulip_last_system_error]); } sc->tulip_flags |= TULIP_NEEDRESET; @@ -3891,7 +3893,7 @@ tulip_intr_handler( if (sc->tulip_flags & (TULIP_WANTTXSTART|TULIP_TXPROBE_ACTIVE|TULIP_DOINGSETUP|TULIP_PROMISC)) { tulip_tx_intr(sc); if ((sc->tulip_flags & TULIP_TXPROBE_ACTIVE) == 0) - tulip_ifstart(&sc->tulip_if); + tulip_ifstart(sc->tulip_ifp); } } if (sc->tulip_flags & TULIP_NEEDRESET) { @@ -4116,8 +4118,7 @@ tulip_txput( #if defined(TULIP_DEBUG) if ((sc->tulip_cmdmode & TULIP_CMD_TXRUN) == 0) { - printf("%s: txput%s: tx not running\n", - sc->tulip_xname, + if_printf(sc->tulip_ifp, "txput%s: tx not running\n", (sc->tulip_flags & TULIP_TXPROBE_ACTIVE) ? "(probe)" : ""); sc->tulip_flags |= TULIP_WANTTXSTART; sc->tulip_dbg.dbg_txput_finishes[0]++; @@ -4188,8 +4189,8 @@ tulip_txput( error = bus_dmamap_load_mbuf(sc->tulip_dmatag, map, m, BUS_DMA_NOWAIT); } if (error != 0) { - printf("%s: unable to load tx map, " - "error = %d\n", sc->tulip_xname, error); + if_printf(sc->tulip_ifp, + "unable to load tx map, error = %d\n", error); #if defined(TULIP_DEBUG) sc->tulip_dbg.dbg_txput_finishes[3]++; #endif @@ -4317,7 +4318,7 @@ tulip_txput( /* * bounce a copy to the bpf listener, if any. */ - BPF_MTAP(&sc->tulip_if, m); + BPF_MTAP(sc->tulip_ifp, m); /* * The descriptors have been filled in. Now get ready @@ -4381,8 +4382,8 @@ tulip_txput( if (sc->tulip_flags & TULIP_TXPROBE_ACTIVE) { TULIP_CSR_WRITE(sc, csr_txpoll, 1); - sc->tulip_if.if_flags |= IFF_OACTIVE; - sc->tulip_if.if_start = tulip_ifstart; + sc->tulip_ifp->if_flags |= IFF_OACTIVE; + sc->tulip_ifp->if_start = tulip_ifstart; TULIP_PERFEND(txput); return NULL; } @@ -4411,8 +4412,8 @@ tulip_txput( sc->tulip_dbg.dbg_txput_finishes[6]++; #endif if (sc->tulip_flags & (TULIP_WANTTXSTART|TULIP_DOINGSETUP)) { - sc->tulip_if.if_flags |= IFF_OACTIVE; - sc->tulip_if.if_start = tulip_ifstart; + sc->tulip_ifp->if_flags |= IFF_OACTIVE; + sc->tulip_ifp->if_start = tulip_ifstart; if ((sc->tulip_intrmask & TULIP_STS_TXINTR) == 0) { sc->tulip_intrmask |= TULIP_STS_TXINTR; TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask); @@ -4441,10 +4442,9 @@ tulip_txput_setup( #if defined(TULIP_DEBUG) if ((sc->tulip_cmdmode & TULIP_CMD_TXRUN) == 0) { - printf("%s: txput_setup: tx not running\n", - sc->tulip_xname); + if_printf(sc->tulip_ifp, "txput_setup: tx not running\n"); sc->tulip_flags |= TULIP_WANTTXSTART; - sc->tulip_if.if_start = tulip_ifstart; + sc->tulip_ifp->if_start = tulip_ifstart; return; } #endif @@ -4455,7 +4455,7 @@ tulip_txput_setup( tulip_tx_intr(sc); if ((sc->tulip_flags & TULIP_DOINGSETUP) || ri->ri_free == 1) { sc->tulip_flags |= TULIP_WANTTXSTART; - sc->tulip_if.if_start = tulip_ifstart; + sc->tulip_ifp->if_start = tulip_ifstart; return; } bcopy(sc->tulip_setupdata, sc->tulip_setupbuf, @@ -4620,18 +4620,18 @@ tulip_ifstart( TULIP_PERFSTART(ifstart) tulip_softc_t * const sc = (tulip_softc_t *)ifp->if_softc; - if (sc->tulip_if.if_flags & IFF_RUNNING) { + if (sc->tulip_ifp->if_flags & IFF_RUNNING) { if ((sc->tulip_flags & (TULIP_WANTSETUP|TULIP_TXPROBE_ACTIVE)) == TULIP_WANTSETUP) tulip_txput_setup(sc); - while (!IFQ_DRV_IS_EMPTY(&sc->tulip_if.if_snd)) { + while (!IFQ_DRV_IS_EMPTY(&sc->tulip_ifp->if_snd)) { struct mbuf *m; - IFQ_DRV_DEQUEUE(&sc->tulip_if.if_snd, m); + IFQ_DRV_DEQUEUE(&sc->tulip_ifp->if_snd, m); if(m == NULL) break; if ((m = tulip_txput(sc, m)) != NULL) { - IFQ_DRV_PREPEND(&sc->tulip_if.if_snd, m); + IFQ_DRV_PREPEND(&sc->tulip_ifp->if_snd, m); break; } } @@ -4661,7 +4661,7 @@ tulip_ifwatchdog( sc->tulip_dbg.dbg_last_rxintrs = sc->tulip_dbg.dbg_rxintrs; #endif /* TULIP_DEBUG */ - sc->tulip_if.if_timer = 1; + sc->tulip_ifp->if_timer = 1; /* * These should be rare so do a bulk test up front so we can just skip * them if needed. @@ -4674,8 +4674,8 @@ tulip_ifwatchdog( tulip_rx_intr(sc); if (sc->tulip_flags & TULIP_SYSTEMERROR) { - printf("%s: %d system errors: last was %s\n", - sc->tulip_xname, sc->tulip_system_errors, + if_printf(sc->tulip_ifp, "%d system errors: last was %s\n", + sc->tulip_system_errors, tulip_system_errors[sc->tulip_last_system_error]); } if (sc->tulip_statusbits) { @@ -4689,7 +4689,7 @@ tulip_ifwatchdog( if (sc->tulip_txtimer) tulip_tx_intr(sc); if (sc->tulip_txtimer && --sc->tulip_txtimer == 0) { - printf("%s: transmission timeout\n", sc->tulip_xname); + if_printf(sc->tulip_ifp, "transmission timeout\n"); if (TULIP_DO_AUTOSENSE(sc)) { sc->tulip_media = TULIP_MEDIA_UNKNOWN; sc->tulip_probe_state = TULIP_PROBE_INACTIVE; @@ -4733,11 +4733,13 @@ static void tulip_attach( tulip_softc_t * const sc) { - struct ifnet * const ifp = &sc->tulip_if; + struct ifnet *ifp; + + ifp = sc->tulip_ifp = if_alloc(IFT_ETHER); /* XXX: driver name/unit should be set some other way */ - ifp->if_dname = "de"; - ifp->if_dunit = sc->tulip_unit; + if_initname(ifp, "de", sc->tulip_unit); + ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST|IFF_NEEDSGIANT; ifp->if_ioctl = tulip_ifioctl; ifp->if_start = tulip_ifstart; @@ -4745,8 +4747,7 @@ tulip_attach( ifp->if_timer = 1; ifp->if_init = tulip_ifinit; - printf("%s: %s%s pass %d.%d%s\n", - sc->tulip_xname, + if_printf(ifp, "%s%s pass %d.%d%s\n", sc->tulip_boardid, tulip_chipdescs[sc->tulip_chipid], (sc->tulip_revinfo & 0xF0) >> 4, @@ -4754,8 +4755,7 @@ tulip_attach( (sc->tulip_features & (TULIP_HAVE_ISVSROM|TULIP_HAVE_OKSROM)) == TULIP_HAVE_ISVSROM ? " (invalid EESPROM checksum)" : ""); #ifndef __FreeBSD__ - printf("%s: address %6D\n", - sc->tulip_xname, sc->tulip_enaddr, ":"); + if_printf(ifp, "address %6D\n", sc->tulip_enaddr, ":"); #endif #if defined(__alpha__) @@ -4776,7 +4776,7 @@ tulip_attach( tulip_reset(sc); - ether_ifattach(&(sc)->tulip_if, sc->tulip_enaddr); + ether_ifattach(sc->tulip_ifp, sc->tulip_enaddr); IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); @@ -5029,8 +5029,7 @@ tulip_pci_attach(device_t dev) unit = device_get_unit(dev); if (unit >= TULIP_MAX_DEVICES) { - printf("de%d", unit); - printf(": not configured; limit of %d reached or exceeded\n", + device_printf(dev, "not configured; limit of %d reached or exceeded\n", TULIP_MAX_DEVICES); return ENXIO; } @@ -5059,13 +5058,14 @@ tulip_pci_attach(device_t dev) return ENXIO; if (chipid == TULIP_21040 && revinfo < 0x20) { - printf("de%d", unit); - printf(": not configured; 21040 pass 2.0 required (%d.%d found)\n", - revinfo >> 4, revinfo & 0x0f); + device_printf(dev, + "not configured; 21040 pass 2.0 required (%d.%d found)\n", + revinfo >> 4, revinfo & 0x0f); return ENXIO; } else if (chipid == TULIP_21140 && revinfo < 0x11) { - printf("de%d: not configured; 21140 pass 1.1 required (%d.%d found)\n", - unit, revinfo >> 4, revinfo & 0x0f); + device_printf(dev, + "not configured; 21140 pass 1.1 required (%d.%d found)\n", + revinfo >> 4, revinfo & 0x0f); return ENXIO; } @@ -5117,9 +5117,7 @@ tulip_pci_attach(device_t dev) #endif sc->tulip_unit = unit; - snprintf(sc->tulip_xname, IFNAMSIZ, "de%d", sc->tulip_unit); sc->tulip_revinfo = revinfo; - sc->tulip_if.if_softc = sc; #if defined(TULIP_IOMAPPED) rid = PCI_CBIO; res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE); @@ -5146,7 +5144,7 @@ tulip_pci_attach(device_t dev) sc->tulip_rxdescs = (tulip_desc_t *) malloc(sizeof(tulip_desc_t) * TULIP_RXDESCS, M_DEVBUF, M_NOWAIT); sc->tulip_txdescs = (tulip_desc_t *) malloc(sizeof(tulip_desc_t) * TULIP_TXDESCS, M_DEVBUF, M_NOWAIT); if (sc->tulip_rxdescs == NULL || sc->tulip_txdescs == NULL) { - printf("malloc failed\n"); + device_printf(dev, "malloc failed\n"); if (sc->tulip_rxdescs) free((caddr_t) sc->tulip_rxdescs, M_DEVBUF); if (sc->tulip_txdescs) @@ -5167,16 +5165,14 @@ tulip_pci_attach(device_t dev) bit longer anyways) */ if ((retval = tulip_read_macaddr(sc)) < 0) { - printf("%s", sc->tulip_xname); - printf(": can't read ENET ROM (why=%d) (", retval); + device_printf(dev, "can't read ENET ROM (why=%d) (", retval); for (idx = 0; idx < 32; idx++) printf("%02x", sc->tulip_rombuf[idx]); printf("\n"); - printf("%s: %s%s pass %d.%d\n", - sc->tulip_xname, + device_printf(dev, "%s%s pass %d.%d\n", sc->tulip_boardid, tulip_chipdescs[sc->tulip_chipid], (sc->tulip_revinfo & 0xF0) >> 4, sc->tulip_revinfo & 0x0F); - printf("%s: address unknown\n", sc->tulip_xname); + device_printf(dev, "address unknown\n"); } else { int s; void (*intr_rtn)(void *) = tulip_intr_normal; @@ -5192,8 +5188,7 @@ tulip_pci_attach(device_t dev) RF_SHAREABLE | RF_ACTIVE); if (res == 0 || bus_setup_intr(dev, res, INTR_TYPE_NET, intr_rtn, sc, &ih)) { - printf("%s: couldn't map interrupt\n", - sc->tulip_xname); + device_printf(dev, "couldn't map interrupt\n"); free((caddr_t) sc->tulip_rxdescs, M_DEVBUF); free((caddr_t) sc->tulip_txdescs, M_DEVBUF); return ENXIO; diff --git a/sys/pci/if_devar.h b/sys/pci/if_devar.h index ee02be5..54ed8d6 100644 --- a/sys/pci/if_devar.h +++ b/sys/pci/if_devar.h @@ -521,7 +521,8 @@ struct tulip_softc { unsigned int tulip_rxmaps_free; #endif #endif - struct arpcom tulip_ac; /* XXX should be at start */ + struct ifnet *tulip_ifp; + u_char tulip_enaddr[6]; bus_space_tag_t tulip_csrs_bst; bus_space_handle_t tulip_csrs_bsh; tulip_regfile_t tulip_csrs; @@ -584,9 +585,6 @@ struct tulip_softc { tulip_desc_t *tulip_rxdescs; tulip_desc_t *tulip_txdescs; }; -#define tulip_if tulip_ac.ac_if -#define tulip_xname tulip_if.if_xname -#define tulip_enaddr tulip_ac.ac_enaddr #define tulip_curperfstats tulip_perfstats[TULIP_PERF_CURRENT] #define tulip_probe_count tulip_probe.probe_count diff --git a/sys/pci/if_mn.c b/sys/pci/if_mn.c index aa8ef46..3a10bb1 100644 --- a/sys/pci/if_mn.c +++ b/sys/pci/if_mn.c @@ -1060,7 +1060,7 @@ f54_intr(struct mn_softc *sc) if (!sc->ch[i]) continue; sp = &sc->ch[i]->ifsppp; - if (!(sp->pp_if.if_flags & IFF_UP)) + if (!(SP2IFP(sp)->if_flags & IFF_UP)) continue; if (s) timeout((timeout_t *)sp->pp_down, sp, 1 * hz); diff --git a/sys/pci/if_pcn.c b/sys/pci/if_pcn.c index 640c827..7dec359 100644 --- a/sys/pci/if_pcn.c +++ b/sys/pci/if_pcn.c @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include <net/ethernet.h> #include <net/if_dl.h> #include <net/if_media.h> +#include <net/if_types.h> #include <net/bpf.h> @@ -334,7 +335,7 @@ pcn_setmulti(sc) u_int32_t h, i; u_int16_t hashes[4] = { 0, 0, 0, 0 }; - ifp = &sc->arpcom.ac_if; + ifp = sc->pcn_ifp; PCN_CSR_SETBIT(sc, PCN_CSR_EXTCTL1, PCN_EXTCTL1_SPND); @@ -581,7 +582,6 @@ pcn_attach(dev) */ eaddr[0] = CSR_READ_4(sc, PCN_IO32_APROM00); eaddr[1] = CSR_READ_4(sc, PCN_IO32_APROM01); - bcopy(eaddr, (char *)&sc->arpcom.ac_enaddr, ETHER_ADDR_LEN); sc->pcn_unit = unit; callout_handle_init(&sc->pcn_stat_ch); @@ -596,7 +596,12 @@ pcn_attach(dev) } bzero(sc->pcn_ldata, sizeof(struct pcn_list_data)); - ifp = &sc->arpcom.ac_if; + ifp = sc->pcn_ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + printf("pcn%d: can not if_alloc()\n", unit); + error = ENOSPC; + goto fail; + } ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_mtu = ETHERMTU; @@ -615,6 +620,7 @@ pcn_attach(dev) if (mii_phy_probe(dev, &sc->pcn_miibus, pcn_ifmedia_upd, pcn_ifmedia_sts)) { printf("pcn%d: MII without any PHY!\n", sc->pcn_unit); + if_free(ifp); error = ENXIO; goto fail; } @@ -656,7 +662,7 @@ pcn_detach(dev) struct ifnet *ifp; sc = device_get_softc(dev); - ifp = &sc->arpcom.ac_if; + ifp = sc->pcn_ifp; KASSERT(mtx_initialized(&sc->pcn_mtx), ("pcn mutex not initialized")); PCN_LOCK(sc); @@ -666,6 +672,7 @@ pcn_detach(dev) pcn_reset(sc); pcn_stop(sc); ether_ifdetach(ifp); + if_free(ifp); } if (sc->pcn_miibus) device_delete_child(dev, sc->pcn_miibus); @@ -795,7 +802,7 @@ pcn_rxeof(sc) PCN_LOCK_ASSERT(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->pcn_ifp; i = sc->pcn_cdata.pcn_rx_prod; while(PCN_OWN_RXDESC(&sc->pcn_ldata->pcn_rx_list[i])) { @@ -855,7 +862,7 @@ pcn_txeof(sc) struct ifnet *ifp; u_int32_t idx; - ifp = &sc->arpcom.ac_if; + ifp = sc->pcn_ifp; /* * Go through our tx list and free mbufs for those @@ -914,7 +921,7 @@ pcn_tick(xsc) struct ifnet *ifp; sc = xsc; - ifp = &sc->arpcom.ac_if; + ifp = sc->pcn_ifp; PCN_LOCK(sc); mii = device_get_softc(sc->pcn_miibus); @@ -948,7 +955,7 @@ pcn_intr(arg) u_int32_t status; sc = arg; - ifp = &sc->arpcom.ac_if; + ifp = sc->pcn_ifp; /* Suppress unwanted interrupts */ if (!(ifp->if_flags & IFF_UP)) { @@ -1129,7 +1136,7 @@ pcn_init(xsc) void *xsc; { struct pcn_softc *sc = xsc; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->pcn_ifp; struct mii_data *mii = NULL; PCN_LOCK(sc); @@ -1144,11 +1151,11 @@ pcn_init(xsc) /* Set MAC address */ pcn_csr_write(sc, PCN_CSR_PAR0, - ((u_int16_t *)sc->arpcom.ac_enaddr)[0]); + ((u_int16_t *)IFP2ENADDR(sc->pcn_ifp))[0]); pcn_csr_write(sc, PCN_CSR_PAR1, - ((u_int16_t *)sc->arpcom.ac_enaddr)[1]); + ((u_int16_t *)IFP2ENADDR(sc->pcn_ifp))[1]); pcn_csr_write(sc, PCN_CSR_PAR2, - ((u_int16_t *)sc->arpcom.ac_enaddr)[2]); + ((u_int16_t *)IFP2ENADDR(sc->pcn_ifp))[2]); /* Init circular RX list. */ if (pcn_list_rx_init(sc) == ENOBUFS) { @@ -1378,7 +1385,7 @@ pcn_stop(sc) register int i; struct ifnet *ifp; - ifp = &sc->arpcom.ac_if; + ifp = sc->pcn_ifp; PCN_LOCK(sc); ifp->if_timer = 0; diff --git a/sys/pci/if_pcnreg.h b/sys/pci/if_pcnreg.h index 220629c..2294854 100644 --- a/sys/pci/if_pcnreg.h +++ b/sys/pci/if_pcnreg.h @@ -451,7 +451,7 @@ struct pcn_type { }; struct pcn_softc { - struct arpcom arpcom; /* interface info */ + struct ifnet *pcn_ifp; bus_space_handle_t pcn_bhandle; bus_space_tag_t pcn_btag; struct resource *pcn_res; diff --git a/sys/pci/if_rl.c b/sys/pci/if_rl.c index 4f2fd9b..63a661c 100644 --- a/sys/pci/if_rl.c +++ b/sys/pci/if_rl.c @@ -98,6 +98,7 @@ __FBSDID("$FreeBSD$"); #include <net/ethernet.h> #include <net/if_dl.h> #include <net/if_media.h> +#include <net/if_types.h> #include <net/bpf.h> @@ -583,7 +584,7 @@ rl_miibus_readreg(device_t dev, int phy, int reg) rval = CSR_READ_1(sc, RL_MEDIASTAT); return (rval); default: - if_printf(&sc->arpcom.ac_if, "bad phy register\n"); + if_printf(sc->rl_ifp, "bad phy register\n"); return (0); } rval = CSR_READ_2(sc, rl8139_reg); @@ -633,7 +634,7 @@ rl_miibus_writereg(device_t dev, int phy, int reg, int data) return (0); break; default: - if_printf(&sc->arpcom.ac_if, "bad phy register\n"); + if_printf(sc->rl_ifp, "bad phy register\n"); return (0); } CSR_WRITE_2(sc, rl8139_reg, data); @@ -660,7 +661,7 @@ rl_miibus_statchg(device_t dev) static void rl_setmulti(struct rl_softc *sc) { - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->rl_ifp; int h = 0; uint32_t hashes[2] = { 0, 0 }; struct ifmultiaddr *ifma; @@ -721,7 +722,7 @@ rl_reset(struct rl_softc *sc) break; } if (i == RL_TIMEOUT) - if_printf(&sc->arpcom.ac_if, "reset never completed!\n"); + if_printf(sc->rl_ifp, "reset never completed!\n"); } /* @@ -861,7 +862,6 @@ rl_attach(device_t dev) } sc->rl_unit = unit; - bcopy(eaddr, (char *)&sc->arpcom.ac_enaddr, ETHER_ADDR_LEN); /* * Now read the exact device type from the EEPROM to find @@ -946,7 +946,12 @@ rl_attach(device_t dev) goto fail; } - ifp = &sc->arpcom.ac_if; + ifp = sc->rl_ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + device_printf(dev, "can not if_alloc()\n"); + error = ENOSPC; + goto fail; + } ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_mtu = ETHERMTU; @@ -978,6 +983,7 @@ rl_attach(device_t dev) if (error) { if_printf(ifp, "couldn't set up irq\n"); ether_ifdetach(ifp); + if_free(ifp); } fail: @@ -1002,13 +1008,15 @@ rl_detach(device_t dev) int attached; sc = device_get_softc(dev); - ifp = &sc->arpcom.ac_if; + ifp = sc->rl_ifp; KASSERT(mtx_initialized(&sc->rl_mtx), ("rl mutex not initialized")); attached = device_is_attached(dev); /* These should only be active if attach succeeded */ - if (attached) + if (attached) { ether_ifdetach(ifp); + if_free(ifp); + } RL_LOCK(sc); #if 0 sc->suspended = 1; @@ -1090,7 +1098,7 @@ static void rl_rxeof(struct rl_softc *sc) { struct mbuf *m; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->rl_ifp; uint8_t *rxbufpos; int total_len = 0; int wrap = 0; @@ -1207,7 +1215,7 @@ rl_rxeof(struct rl_softc *sc) static void rl_txeof(struct rl_softc *sc) { - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->rl_ifp; uint32_t txstat; RL_LOCK_ASSERT(sc); @@ -1338,7 +1346,7 @@ static void rl_intr(void *arg) { struct rl_softc *sc = arg; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->rl_ifp; uint16_t status; RL_LOCK(sc); @@ -1504,7 +1512,7 @@ rl_init(void *xsc) static void rl_init_locked(struct rl_softc *sc) { - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->rl_ifp; struct mii_data *mii; uint32_t rxcfg = 0; @@ -1524,9 +1532,9 @@ rl_init_locked(struct rl_softc *sc) */ CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_WRITECFG); CSR_WRITE_STREAM_4(sc, RL_IDR0, - *(uint32_t *)(&sc->arpcom.ac_enaddr[0])); + *(uint32_t *)(&IFP2ENADDR(sc->rl_ifp)[0])); CSR_WRITE_STREAM_4(sc, RL_IDR4, - *(uint32_t *)(&sc->arpcom.ac_enaddr[4])); + *(uint32_t *)(&IFP2ENADDR(sc->rl_ifp)[4])); CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); /* Init the RX buffer pointer register. */ @@ -1703,7 +1711,7 @@ static void rl_stop(struct rl_softc *sc) { register int i; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->rl_ifp; RL_LOCK_ASSERT(sc); @@ -1767,7 +1775,7 @@ rl_resume(device_t dev) struct ifnet *ifp; sc = device_get_softc(dev); - ifp = &sc->arpcom.ac_if; + ifp = sc->rl_ifp; RL_LOCK(sc); diff --git a/sys/pci/if_rlreg.h b/sys/pci/if_rlreg.h index 29c7baf..ba571c5 100644 --- a/sys/pci/if_rlreg.h +++ b/sys/pci/if_rlreg.h @@ -678,7 +678,7 @@ struct rl_list_data { }; struct rl_softc { - struct arpcom arpcom; /* interface info */ + struct ifnet *rl_ifp; /* interface info */ bus_space_handle_t rl_bhandle; /* bus space handle */ bus_space_tag_t rl_btag; /* bus space tag */ struct resource *rl_res; diff --git a/sys/pci/if_sf.c b/sys/pci/if_sf.c index 5593d52..85d6819 100644 --- a/sys/pci/if_sf.c +++ b/sys/pci/if_sf.c @@ -93,6 +93,7 @@ __FBSDID("$FreeBSD$"); #include <net/ethernet.h> #include <net/if_dl.h> #include <net/if_media.h> +#include <net/if_types.h> #include <net/bpf.h> @@ -415,7 +416,7 @@ sf_setmulti(sc) struct ifmultiaddr *ifma; u_int8_t dummy[] = { 0, 0, 0, 0, 0, 0 }; - ifp = &sc->arpcom.ac_if; + ifp = sc->sf_ifp; /* First zot all the existing filters. */ for (i = 1; i < SF_RXFILT_PERFECT_CNT; i++) @@ -641,6 +642,7 @@ sf_attach(dev) struct sf_softc *sc; struct ifnet *ifp; int unit, rid, error = 0; + u_char eaddr[6]; sc = device_get_softc(dev); unit = device_get_unit(dev); @@ -683,7 +685,7 @@ sf_attach(dev) * Get station address from the EEPROM. */ for (i = 0; i < ETHER_ADDR_LEN; i++) - sc->arpcom.ac_enaddr[i] = + eaddr[i] = sf_read_eeprom(sc, SF_EE_NODEADDR + ETHER_ADDR_LEN - i); sc->sf_unit = unit; @@ -708,7 +710,12 @@ sf_attach(dev) goto fail; } - ifp = &sc->arpcom.ac_if; + ifp = sc->sf_ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + printf("sf%d: can not if_alloc()\n", sc->sf_unit); + error = ENOSPC; + goto fail; + } ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_mtu = ETHERMTU; @@ -730,7 +737,7 @@ sf_attach(dev) /* * Call MI attach routine. */ - ether_ifattach(ifp, sc->arpcom.ac_enaddr); + ether_ifattach(ifp, eaddr); /* Hook interrupt last to avoid having to lock softc */ error = bus_setup_intr(dev, sc->sf_irq, INTR_TYPE_NET, @@ -739,6 +746,7 @@ sf_attach(dev) if (error) { printf("sf%d: couldn't set up irq\n", unit); ether_ifdetach(ifp); + if_free(ifp); goto fail; } @@ -766,12 +774,13 @@ sf_detach(dev) sc = device_get_softc(dev); KASSERT(mtx_initialized(&sc->sf_mtx), ("sf mutex not initialized")); SF_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->sf_ifp; /* These should only be active if attach succeeded */ if (device_is_attached(dev)) { sf_stop(sc); ether_ifdetach(ifp); + if_free(ifp); } if (sc->sf_miibus) device_delete_child(dev, sc->sf_miibus); @@ -904,7 +913,7 @@ sf_rxeof(sc) SF_LOCK_ASSERT(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->sf_ifp; rxcons = csr_read_4(sc, SF_CQ_CONSIDX); rxprod = csr_read_4(sc, SF_RXDQ_PTR_Q1); @@ -973,7 +982,7 @@ sf_txeof(sc) struct sf_tx_bufdesc_type0 *cur_tx; struct ifnet *ifp; - ifp = &sc->arpcom.ac_if; + ifp = sc->sf_ifp; txcons = csr_read_4(sc, SF_CQ_CONSIDX); cmpprodidx = SF_IDX_HI(csr_read_4(sc, SF_CQ_PRODIDX)); @@ -1098,7 +1107,7 @@ sf_intr(arg) sc = arg; SF_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->sf_ifp; #ifdef DEVICE_POLLING if (ifp->if_flags & IFF_POLLING) @@ -1173,7 +1182,7 @@ sf_init(xsc) sc = xsc; SF_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->sf_ifp; mii = device_get_softc(sc->sf_miibus); sf_stop(sc); @@ -1190,9 +1199,9 @@ sf_init(xsc) (i + sizeof(u_int32_t)), 0); /* Init our MAC address */ - csr_write_4(sc, SF_PAR0, *(u_int32_t *)(&sc->arpcom.ac_enaddr[0])); - csr_write_4(sc, SF_PAR1, *(u_int32_t *)(&sc->arpcom.ac_enaddr[4])); - sf_setperf(sc, 0, (caddr_t)&sc->arpcom.ac_enaddr); + csr_write_4(sc, SF_PAR0, *(u_int32_t *)(&IFP2ENADDR(sc->sf_ifp)[0])); + csr_write_4(sc, SF_PAR1, *(u_int32_t *)(&IFP2ENADDR(sc->sf_ifp)[4])); + sf_setperf(sc, 0, (caddr_t)&IFP2ENADDR(sc->sf_ifp)); if (sf_init_rx_ring(sc) == ENOBUFS) { printf("sf%d: initialization failed: no " @@ -1435,7 +1444,7 @@ sf_stop(sc) SF_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->sf_ifp; untimeout(sf_stats_update, sc, sc->sf_stat_ch); @@ -1494,7 +1503,7 @@ sf_stats_update(xsc) sc = xsc; SF_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->sf_ifp; mii = device_get_softc(sc->sf_miibus); ptr = (u_int32_t *)&stats; diff --git a/sys/pci/if_sfreg.h b/sys/pci/if_sfreg.h index 4738f46..bbd704c 100644 --- a/sys/pci/if_sfreg.h +++ b/sys/pci/if_sfreg.h @@ -1031,7 +1031,7 @@ struct sf_list_data { }; struct sf_softc { - struct arpcom arpcom; /* interface info */ + struct ifnet *sf_ifp; /* interface info */ bus_space_handle_t sf_bhandle; /* bus space handle */ bus_space_tag_t sf_btag; /* bus space tag */ void *sf_intrhand; /* interrupt handler cookie */ diff --git a/sys/pci/if_sis.c b/sys/pci/if_sis.c index ad7e1b3..19a9f92 100644 --- a/sys/pci/if_sis.c +++ b/sys/pci/if_sis.c @@ -740,7 +740,7 @@ sis_setmulti_ns(struct sis_softc *sc) u_int32_t h = 0, i, filtsave; int bit, index; - ifp = &sc->arpcom.ac_if; + ifp = sc->sis_ifp; if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) { SIS_CLRBIT(sc, SIS_RXFILT_CTL, NS_RXFILTCTL_MCHASH); @@ -789,7 +789,7 @@ sis_setmulti_sis(struct sis_softc *sc) u_int32_t h, i, n, ctl; u_int16_t hashes[16]; - ifp = &sc->arpcom.ac_if; + ifp = sc->sis_ifp; /* hash table size */ if (sc->sis_rev >= SIS_REV_635 || @@ -1069,7 +1069,6 @@ sis_attach(device_t dev) callout_init(&sc->sis_stat_ch, CALLOUT_MPSAFE); else callout_init(&sc->sis_stat_ch, 0); - bcopy(eaddr, (char *)&sc->arpcom.ac_enaddr, ETHER_ADDR_LEN); /* * Allocate the parent bus DMA tag appropriate for PCI. @@ -1192,7 +1191,12 @@ sis_attach(device_t dev) * rings which we'll need later in the init routine. */ - ifp = &sc->arpcom.ac_if; + ifp = sc->sis_ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + printf("sis%d: can not if_alloc()\n", sc->sis_unit); + error = ENOSPC; + goto fail; + } ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_mtu = ETHERMTU; @@ -1212,6 +1216,7 @@ sis_attach(device_t dev) if (mii_phy_probe(dev, &sc->sis_miibus, sis_ifmedia_upd, sis_ifmedia_sts)) { printf("sis%d: MII without any PHY!\n", sc->sis_unit); + if_free(ifp); error = ENXIO; goto fail; } @@ -1239,6 +1244,7 @@ sis_attach(device_t dev) if (error) { printf("sis%d: couldn't set up irq\n", unit); ether_ifdetach(ifp); + if_free(ifp); goto fail; } @@ -1265,13 +1271,14 @@ sis_detach(device_t dev) sc = device_get_softc(dev); KASSERT(mtx_initialized(&sc->sis_mtx), ("sis mutex not initialized")); SIS_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->sis_ifp; /* These should only be active if attach succeeded. */ if (device_is_attached(dev)) { sis_reset(sc); sis_stop(sc); ether_ifdetach(ifp); + if_free(ifp); } if (sc->sis_miibus) device_delete_child(dev, sc->sis_miibus); @@ -1407,7 +1414,7 @@ sis_rxeof(struct sis_softc *sc) SIS_LOCK_ASSERT(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->sis_ifp; for(cur_rx = sc->sis_rx_pdsc; SIS_OWNDESC(cur_rx); cur_rx = cur_rx->sis_nextdesc) { @@ -1501,7 +1508,7 @@ sis_txeof(struct sis_softc *sc) u_int32_t idx; SIS_LOCK_ASSERT(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->sis_ifp; /* * Go through our tx list and free mbufs for those @@ -1558,7 +1565,7 @@ sis_tick(void *xsc) sc = xsc; SIS_LOCK(sc); sc->in_tick = 1; - ifp = &sc->arpcom.ac_if; + ifp = sc->sis_ifp; mii = device_get_softc(sc->sis_miibus); mii_tick(mii); @@ -1636,7 +1643,7 @@ sis_intr(void *arg) u_int32_t status; sc = arg; - ifp = &sc->arpcom.ac_if; + ifp = sc->sis_ifp; if (sc->sis_stopped) /* Most likely shared interrupt */ return; @@ -1853,7 +1860,7 @@ sis_init(void *xsc) static void sis_initl(struct sis_softc *sc) { - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->sis_ifp; struct mii_data *mii; SIS_LOCK_ASSERT(sc); @@ -1880,23 +1887,23 @@ sis_initl(struct sis_softc *sc) if (sc->sis_type == SIS_TYPE_83815) { CSR_WRITE_4(sc, SIS_RXFILT_CTL, NS_FILTADDR_PAR0); CSR_WRITE_4(sc, SIS_RXFILT_DATA, - ((u_int16_t *)sc->arpcom.ac_enaddr)[0]); + ((u_int16_t *)IFP2ENADDR(sc->sis_ifp))[0]); CSR_WRITE_4(sc, SIS_RXFILT_CTL, NS_FILTADDR_PAR1); CSR_WRITE_4(sc, SIS_RXFILT_DATA, - ((u_int16_t *)sc->arpcom.ac_enaddr)[1]); + ((u_int16_t *)IFP2ENADDR(sc->sis_ifp))[1]); CSR_WRITE_4(sc, SIS_RXFILT_CTL, NS_FILTADDR_PAR2); CSR_WRITE_4(sc, SIS_RXFILT_DATA, - ((u_int16_t *)sc->arpcom.ac_enaddr)[2]); + ((u_int16_t *)IFP2ENADDR(sc->sis_ifp))[2]); } else { CSR_WRITE_4(sc, SIS_RXFILT_CTL, SIS_FILTADDR_PAR0); CSR_WRITE_4(sc, SIS_RXFILT_DATA, - ((u_int16_t *)sc->arpcom.ac_enaddr)[0]); + ((u_int16_t *)IFP2ENADDR(sc->sis_ifp))[0]); CSR_WRITE_4(sc, SIS_RXFILT_CTL, SIS_FILTADDR_PAR1); CSR_WRITE_4(sc, SIS_RXFILT_DATA, - ((u_int16_t *)sc->arpcom.ac_enaddr)[1]); + ((u_int16_t *)IFP2ENADDR(sc->sis_ifp))[1]); CSR_WRITE_4(sc, SIS_RXFILT_CTL, SIS_FILTADDR_PAR2); CSR_WRITE_4(sc, SIS_RXFILT_DATA, - ((u_int16_t *)sc->arpcom.ac_enaddr)[2]); + ((u_int16_t *)IFP2ENADDR(sc->sis_ifp))[2]); } /* Init circular TX/RX lists. */ @@ -2192,7 +2199,7 @@ sis_stop(struct sis_softc *sc) if (sc->sis_stopped) return; SIS_LOCK_ASSERT(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->sis_ifp; ifp->if_timer = 0; callout_stop(&sc->sis_stat_ch); diff --git a/sys/pci/if_sisreg.h b/sys/pci/if_sisreg.h index b820924..03ac3cc 100644 --- a/sys/pci/if_sisreg.h +++ b/sys/pci/if_sisreg.h @@ -430,7 +430,7 @@ struct sis_mii_frame { #define SIS_TYPE_83816 4 struct sis_softc { - struct arpcom arpcom; /* interface info */ + struct ifnet *sis_ifp; /* interface info */ bus_space_handle_t sis_bhandle; bus_space_tag_t sis_btag; struct resource *sis_res; diff --git a/sys/pci/if_sk.c b/sys/pci/if_sk.c index 1703e2f..bcc4b03 100644 --- a/sys/pci/if_sk.c +++ b/sys/pci/if_sk.c @@ -101,6 +101,7 @@ __FBSDID("$FreeBSD$"); #include <net/ethernet.h> #include <net/if_dl.h> #include <net/if_media.h> +#include <net/if_types.h> #include <net/bpf.h> @@ -790,7 +791,7 @@ sk_setmulti(sc_if) struct sk_if_softc *sc_if; { struct sk_softc *sc = sc_if->sk_softc; - struct ifnet *ifp = &sc_if->arpcom.ac_if; + struct ifnet *ifp = sc_if->sk_ifp; u_int32_t hashes[2] = { 0, 0 }; int h = 0, i; struct ifmultiaddr *ifma; @@ -881,7 +882,7 @@ sk_setpromisc(sc_if) struct sk_if_softc *sc_if; { struct sk_softc *sc = sc_if->sk_softc; - struct ifnet *ifp = &sc_if->arpcom.ac_if; + struct ifnet *ifp = sc_if->sk_ifp; switch(sc->sk_type) { case SK_GENESIS: @@ -1400,6 +1401,7 @@ sk_attach(dev) struct sk_if_softc *sc_if; struct ifnet *ifp; int i, port, error; + u_char eaddr[6]; if (dev == NULL) return(EINVAL); @@ -1437,7 +1439,12 @@ sk_attach(dev) goto fail; } - ifp = &sc_if->arpcom.ac_if; + ifp = sc_if->sk_ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + printf("sk%d: can not if_alloc()\n", sc_if->sk_unit); + error = ENOSPC; + goto fail; + } ifp->if_softc = sc_if; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_mtu = ETHERMTU; @@ -1464,7 +1471,7 @@ sk_attach(dev) */ SK_LOCK(sc); for (i = 0; i < ETHER_ADDR_LEN; i++) - sc_if->arpcom.ac_enaddr[i] = + eaddr[i] = sk_win_read_1(sc, SK_MAC0_0 + (port * 8) + i); /* @@ -1517,6 +1524,7 @@ sk_attach(dev) sc->sk_unit, sc_if->sk_phytype); error = ENODEV; SK_UNLOCK(sc); + if_free(ifp); goto fail; } @@ -1525,7 +1533,7 @@ sk_attach(dev) * Call MI attach routine. Can't hold locks when calling into ether_*. */ SK_UNLOCK(sc); - ether_ifattach(ifp, sc_if->arpcom.ac_enaddr); + ether_ifattach(ifp, eaddr); SK_LOCK(sc); /* @@ -1547,6 +1555,7 @@ sk_attach(dev) sk_ifmedia_upd, sk_ifmedia_sts)) { printf("skc%d: no PHY found!\n", sc_if->sk_unit); ether_ifdetach(ifp); + if_free(ifp); error = ENXIO; goto fail; } @@ -1892,13 +1901,14 @@ sk_detach(dev) ("sk mutex not initialized in sk_detach")); SK_IF_LOCK(sc_if); - ifp = &sc_if->arpcom.ac_if; + ifp = sc_if->sk_ifp; /* These should only be active if attach_xmac succeeded */ if (device_is_attached(dev)) { sk_stop(sc_if); /* Can't hold locks while calling detach */ SK_IF_UNLOCK(sc_if); ether_ifdetach(ifp); + if_free(ifp); SK_IF_LOCK(sc_if); } /* @@ -2115,7 +2125,7 @@ sk_rxeof(sc_if) u_int32_t rxstat; sc = sc_if->sk_softc; - ifp = &sc_if->arpcom.ac_if; + ifp = sc_if->sk_ifp; i = sc_if->sk_cdata.sk_rx_prod; cur_rx = &sc_if->sk_cdata.sk_rx_chain[i]; @@ -2182,7 +2192,7 @@ sk_txeof(sc_if) u_int32_t idx; sc = sc_if->sk_softc; - ifp = &sc_if->arpcom.ac_if; + ifp = sc_if->sk_ifp; /* * Go through our tx ring and free mbufs for those @@ -2225,7 +2235,7 @@ sk_tick(xsc_if) sc_if = xsc_if; SK_IF_LOCK(sc_if); - ifp = &sc_if->arpcom.ac_if; + ifp = sc_if->sk_ifp; mii = device_get_softc(sc_if->sk_miibus); if (!(ifp->if_flags & IFF_UP)) { @@ -2275,7 +2285,7 @@ sk_intr_bcom(sc_if) struct ifnet *ifp; int status; mii = device_get_softc(sc_if->sk_miibus); - ifp = &sc_if->arpcom.ac_if; + ifp = sc_if->sk_ifp; SK_XM_CLRBIT_2(sc_if, XM_MMUCMD, XM_MMUCMD_TX_ENB|XM_MMUCMD_RX_ENB); @@ -2383,9 +2393,9 @@ sk_intr(xsc) sc_if1 = sc->sk_if[SK_PORT_B]; if (sc_if0 != NULL) - ifp0 = &sc_if0->arpcom.ac_if; + ifp0 = sc_if0->sk_ifp; if (sc_if1 != NULL) - ifp1 = &sc_if1->arpcom.ac_if; + ifp1 = sc_if1->sk_ifp; for (;;) { status = CSR_READ_4(sc, SK_ISSR); @@ -2466,7 +2476,7 @@ sk_init_xmac(sc_if) { 0, 0 } }; sc = sc_if->sk_softc; - ifp = &sc_if->arpcom.ac_if; + ifp = sc_if->sk_ifp; /* Unreset the XMAC. */ SK_IF_WRITE_2(sc_if, 0, SK_TXF1_MACCTL, SK_TXMACCTL_XMAC_UNRESET); @@ -2522,11 +2532,11 @@ sk_init_xmac(sc_if) /* Set station address */ SK_XM_WRITE_2(sc_if, XM_PAR0, - *(u_int16_t *)(&sc_if->arpcom.ac_enaddr[0])); + *(u_int16_t *)(&IFP2ENADDR(sc_if->sk_ifp)[0])); SK_XM_WRITE_2(sc_if, XM_PAR1, - *(u_int16_t *)(&sc_if->arpcom.ac_enaddr[2])); + *(u_int16_t *)(&IFP2ENADDR(sc_if->sk_ifp)[2])); SK_XM_WRITE_2(sc_if, XM_PAR2, - *(u_int16_t *)(&sc_if->arpcom.ac_enaddr[4])); + *(u_int16_t *)(&IFP2ENADDR(sc_if->sk_ifp)[4])); SK_XM_SETBIT_4(sc_if, XM_MODE, XM_MODE_RX_USE_STATION); if (ifp->if_flags & IFF_BROADCAST) { @@ -2629,7 +2639,7 @@ sk_init_yukon(sc_if) int i; sc = sc_if->sk_softc; - ifp = &sc_if->arpcom.ac_if; + ifp = sc_if->sk_ifp; if (sc->sk_type == SK_YUKON_LITE && sc->sk_rev == SK_YUKON_LITE_REV_A3) { @@ -2697,8 +2707,8 @@ sk_init_yukon(sc_if) for (i = 0; i < 3; i++) { /* Write Source Address 1 (unicast filter) */ SK_YU_WRITE_2(sc_if, YUKON_SAL1 + i * 4, - sc_if->arpcom.ac_enaddr[i * 2] | - sc_if->arpcom.ac_enaddr[i * 2 + 1] << 8); + IFP2ENADDR(sc_if->sk_ifp)[i * 2] | + IFP2ENADDR(sc_if->sk_ifp)[i * 2 + 1] << 8); } for (i = 0; i < 3; i++) { @@ -2744,7 +2754,7 @@ sk_init(xsc) SK_IF_LOCK(sc_if); - ifp = &sc_if->arpcom.ac_if; + ifp = sc_if->sk_ifp; sc = sc_if->sk_softc; mii = device_get_softc(sc_if->sk_miibus); @@ -2895,7 +2905,7 @@ sk_stop(sc_if) SK_IF_LOCK(sc_if); sc = sc_if->sk_softc; - ifp = &sc_if->arpcom.ac_if; + ifp = sc_if->sk_ifp; untimeout(sk_tick, sc_if, sc_if->sk_tick_ch); diff --git a/sys/pci/if_skreg.h b/sys/pci/if_skreg.h index 9b91625..e8b6b8a 100644 --- a/sys/pci/if_skreg.h +++ b/sys/pci/if_skreg.h @@ -1461,7 +1461,7 @@ struct sk_softc { /* Softc for each logical interface */ struct sk_if_softc { - struct arpcom arpcom; /* interface info */ + struct ifnet *sk_ifp; /* interface info */ device_t sk_miibus; u_int8_t sk_unit; /* interface number */ u_int8_t sk_port; /* port # on controller */ diff --git a/sys/pci/if_ste.c b/sys/pci/if_ste.c index 7c51421..7088ba6 100644 --- a/sys/pci/if_ste.c +++ b/sys/pci/if_ste.c @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include <net/ethernet.h> #include <net/if_dl.h> #include <net/if_media.h> +#include <net/if_types.h> #include <net/if_vlan_var.h> #include <net/bpf.h> @@ -564,7 +565,7 @@ ste_setmulti(sc) u_int32_t hashes[2] = { 0, 0 }; struct ifmultiaddr *ifma; - ifp = &sc->arpcom.ac_if; + ifp = sc->ste_ifp; if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) { STE_SETBIT1(sc, STE_RX_MODE, STE_RXMODE_ALLMULTI); STE_CLRBIT1(sc, STE_RX_MODE, STE_RXMODE_MULTIHASH); @@ -661,7 +662,7 @@ ste_intr(xsc) sc = xsc; STE_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->ste_ifp; #ifdef DEVICE_POLLING if (ifp->if_flags & IFF_POLLING) @@ -765,7 +766,7 @@ ste_rxeof(sc) STE_LOCK_ASSERT(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->ste_ifp; while((rxstat = sc->ste_cdata.ste_rx_head->ste_ptr->ste_status) & STE_RXSTAT_DMADONE) { @@ -847,7 +848,7 @@ ste_txeoc(sc) u_int8_t txstat; struct ifnet *ifp; - ifp = &sc->arpcom.ac_if; + ifp = sc->ste_ifp; while ((txstat = CSR_READ_1(sc, STE_TX_STATUS)) & STE_TXSTATUS_TXDONE) { @@ -887,7 +888,7 @@ ste_txeof(sc) struct ifnet *ifp; int idx; - ifp = &sc->arpcom.ac_if; + ifp = sc->ste_ifp; idx = sc->ste_cdata.ste_tx_cons; while(idx != sc->ste_cdata.ste_tx_prod) { @@ -920,7 +921,7 @@ ste_stats_update(xsc) sc = xsc; STE_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->ste_ifp; mii = device_get_softc(sc->ste_miibus); ifp->if_collisions += CSR_READ_1(sc, STE_LATE_COLLS) @@ -984,6 +985,7 @@ ste_attach(dev) struct ste_softc *sc; struct ifnet *ifp; int unit, error = 0, rid; + u_char eaddr[6]; sc = device_get_softc(dev); unit = device_get_unit(dev); @@ -1037,7 +1039,7 @@ ste_attach(dev) /* * Get station address from the EEPROM. */ - if (ste_read_eeprom(sc, (caddr_t)&sc->arpcom.ac_enaddr, + if (ste_read_eeprom(sc, eaddr, STE_EEADDR_NODE0, 3, 0)) { printf("ste%d: failed to read station address\n", unit); error = ENXIO;; @@ -1066,7 +1068,12 @@ ste_attach(dev) goto fail; } - ifp = &sc->arpcom.ac_if; + ifp = sc->ste_ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + printf("ste%d: can not if_alloc()\n", sc->ste_unit); + error = ENOSPC; + goto fail; + } ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_mtu = ETHERMTU; @@ -1084,7 +1091,7 @@ ste_attach(dev) /* * Call MI attach routine. */ - ether_ifattach(ifp, sc->arpcom.ac_enaddr); + ether_ifattach(ifp, eaddr); /* * Tell the upper layer(s) we support long frames. @@ -1103,6 +1110,7 @@ ste_attach(dev) if (error) { printf("ste%d: couldn't set up irq\n", unit); ether_ifdetach(ifp); + if_free(ifp); goto fail; } @@ -1130,12 +1138,13 @@ ste_detach(dev) sc = device_get_softc(dev); KASSERT(mtx_initialized(&sc->ste_mtx), ("ste mutex not initialized")); STE_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->ste_ifp; /* These should only be active if attach succeeded */ if (device_is_attached(dev)) { ste_stop(sc); ether_ifdetach(ifp); + if_free(ifp); } if (sc->ste_miibus) device_delete_child(dev, sc->ste_miibus); @@ -1266,13 +1275,13 @@ ste_init(xsc) sc = xsc; STE_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->ste_ifp; ste_stop(sc); /* Init our MAC address */ for (i = 0; i < ETHER_ADDR_LEN; i++) { - CSR_WRITE_1(sc, STE_PAR0 + i, sc->arpcom.ac_enaddr[i]); + CSR_WRITE_1(sc, STE_PAR0 + i, IFP2ENADDR(sc->ste_ifp)[i]); } /* Init RX list */ @@ -1379,7 +1388,7 @@ ste_stop(sc) struct ifnet *ifp; STE_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->ste_ifp; untimeout(ste_stats_update, sc, sc->ste_stat_ch); ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE); diff --git a/sys/pci/if_stereg.h b/sys/pci/if_stereg.h index 80e8b3d..25bd6ad 100644 --- a/sys/pci/if_stereg.h +++ b/sys/pci/if_stereg.h @@ -504,7 +504,7 @@ struct ste_chain_data { }; struct ste_softc { - struct arpcom arpcom; + struct ifnet *ste_ifp; bus_space_tag_t ste_btag; bus_space_handle_t ste_bhandle; struct resource *ste_res; diff --git a/sys/pci/if_ti.c b/sys/pci/if_ti.c index 4af3b29..b6a3a7f 100644 --- a/sys/pci/if_ti.c +++ b/sys/pci/if_ti.c @@ -1111,7 +1111,7 @@ ti_newbuf_std(sc, i, m) TI_HOSTADDR(r->ti_addr) = vtophys(mtod(m_new, caddr_t)); r->ti_type = TI_BDTYPE_RECV_BD; r->ti_flags = 0; - if (sc->arpcom.ac_if.if_hwassist) + if (sc->ti_ifp->if_hwassist) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_len = m_new->m_len; r->ti_idx = i; @@ -1150,7 +1150,7 @@ ti_newbuf_mini(sc, i, m) TI_HOSTADDR(r->ti_addr) = vtophys(mtod(m_new, caddr_t)); r->ti_type = TI_BDTYPE_RECV_BD; r->ti_flags = TI_BDFLAG_MINI_RING; - if (sc->arpcom.ac_if.if_hwassist) + if (sc->ti_ifp->if_hwassist) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_len = m_new->m_len; r->ti_idx = i; @@ -1209,7 +1209,7 @@ ti_newbuf_jumbo(sc, i, m) TI_HOSTADDR(r->ti_addr) = vtophys(mtod(m_new, caddr_t)); r->ti_type = TI_BDTYPE_RECV_JUMBO_BD; r->ti_flags = TI_BDFLAG_JUMBO_RING; - if (sc->arpcom.ac_if.if_hwassist) + if (sc->ti_ifp->if_hwassist) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_len = m_new->m_len; r->ti_idx = i; @@ -1348,7 +1348,7 @@ ti_newbuf_jumbo(sc, idx, m_old) r->ti_flags = TI_BDFLAG_JUMBO_RING|TI_RCB_FLAG_USE_EXT_RX_BD; - if (sc->arpcom.ac_if.if_hwassist) + if (sc->ti_ifp->if_hwassist) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM|TI_BDFLAG_IP_CKSUM; r->ti_idx = idx; @@ -1599,7 +1599,7 @@ ti_setmulti(sc) struct ti_mc_entry *mc; u_int32_t intrs; - ifp = &sc->arpcom.ac_if; + ifp = sc->ti_ifp; if (ifp->if_flags & IFF_ALLMULTI) { TI_DO_CMD(TI_CMD_SET_ALLMULTI, TI_CMD_CODE_ALLMULTI_ENB, 0); @@ -1681,10 +1681,10 @@ ti_chipinit(sc) /* Initialize link to down state. */ sc->ti_linkstat = TI_EV_CODE_LINK_DOWN; - if (sc->arpcom.ac_if.if_capenable & IFCAP_HWCSUM) - sc->arpcom.ac_if.if_hwassist = TI_CSUM_FEATURES; + if (sc->ti_ifp->if_capenable & IFCAP_HWCSUM) + sc->ti_ifp->if_hwassist = TI_CSUM_FEATURES; else - sc->arpcom.ac_if.if_hwassist = 0; + sc->ti_ifp->if_hwassist = 0; /* Set endianness before we access any non-PCI registers. */ #if BYTE_ORDER == BIG_ENDIAN @@ -1815,7 +1815,7 @@ ti_chipinit(sc) * the firmware racks up lots of nicDmaReadRingFull * errors. This is not compatible with hardware checksums. */ - if (sc->arpcom.ac_if.if_hwassist == 0) + if (sc->ti_ifp->if_hwassist == 0) TI_SETBIT(sc, TI_GCR_OPMODE, TI_OPMODE_1_DMA_ACTIVE); /* Recommended settings from Tigon manual. */ @@ -1846,7 +1846,7 @@ ti_gibinit(sc) struct ifnet *ifp; uint32_t rdphys; - ifp = &sc->arpcom.ac_if; + ifp = sc->ti_ifp; rdphys = sc->ti_rdata_phys; /* Disable interrupts for now. */ @@ -1905,7 +1905,7 @@ ti_gibinit(sc) TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_std_ring); rcb->ti_max_len = TI_FRAMELEN; rcb->ti_flags = 0; - if (sc->arpcom.ac_if.if_hwassist) + if (sc->ti_ifp->if_hwassist) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; @@ -1921,7 +1921,7 @@ ti_gibinit(sc) rcb->ti_max_len = PAGE_SIZE; rcb->ti_flags = TI_RCB_FLAG_USE_EXT_RX_BD; #endif - if (sc->arpcom.ac_if.if_hwassist) + if (sc->ti_ifp->if_hwassist) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; @@ -1938,7 +1938,7 @@ ti_gibinit(sc) rcb->ti_flags = TI_RCB_FLAG_RING_DISABLED; else rcb->ti_flags = 0; - if (sc->arpcom.ac_if.if_hwassist) + if (sc->ti_ifp->if_hwassist) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; @@ -1975,7 +1975,7 @@ ti_gibinit(sc) else rcb->ti_flags = TI_RCB_FLAG_HOST_RING; rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; - if (sc->arpcom.ac_if.if_hwassist) + if (sc->ti_ifp->if_hwassist) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; rcb->ti_max_len = TI_TX_RING_CNT; @@ -2058,6 +2058,7 @@ ti_attach(dev) struct ifnet *ifp; struct ti_softc *sc; int unit, error = 0, rid; + u_char eaddr[6]; sc = device_get_softc(dev); unit = device_get_unit(dev); @@ -2065,9 +2066,9 @@ ti_attach(dev) mtx_init(&sc->ti_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF | MTX_RECURSE); ifmedia_init(&sc->ifmedia, IFM_IMASK, ti_ifmedia_upd, ti_ifmedia_sts); - sc->arpcom.ac_if.if_capabilities = IFCAP_HWCSUM | + sc->ti_ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; - sc->arpcom.ac_if.if_capenable = sc->arpcom.ac_if.if_capabilities; + sc->ti_ifp->if_capenable = sc->ti_ifp->if_capabilities; /* * Map control/status registers. @@ -2125,7 +2126,7 @@ ti_attach(dev) * the NIC). This means the MAC address is actually preceded * by two zero bytes. We need to skip over those. */ - if (ti_read_eeprom(sc, (caddr_t)&sc->arpcom.ac_enaddr, + if (ti_read_eeprom(sc, eaddr, TI_EE_MAC_OFFSET + 2, ETHER_ADDR_LEN)) { printf("ti%d: failed to read station address\n", unit); error = ENXIO; @@ -2221,7 +2222,12 @@ ti_attach(dev) sc->ti_tx_buf_ratio = 21; /* Set up ifnet structure */ - ifp = &sc->arpcom.ac_if; + ifp = sc->ti_ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + printf("ti%d: can not if_alloc()\n", sc->ti_unit); + error = ENOSPC; + goto fail; + } ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST | @@ -2276,7 +2282,7 @@ ti_attach(dev) /* * Call MI attach routine. */ - ether_ifattach(ifp, sc->arpcom.ac_enaddr); + ether_ifattach(ifp, eaddr); /* Hook interrupt last to avoid having to lock softc */ error = bus_setup_intr(dev, sc->ti_irq, INTR_TYPE_NET, @@ -2285,6 +2291,7 @@ ti_attach(dev) if (error) { printf("ti%d: couldn't set up irq\n", unit); ether_ifdetach(ifp); + if_free(ifp); goto fail; } @@ -2314,12 +2321,13 @@ ti_detach(dev) destroy_dev(sc->dev); KASSERT(mtx_initialized(&sc->ti_mtx), ("ti mutex not initialized")); TI_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->ti_ifp; /* These should only be active if attach succeeded */ if (device_is_attached(dev)) { ti_stop(sc); ether_ifdetach(ifp); + if_free(ifp); bus_generic_detach(dev); } ifmedia_removeall(&sc->ifmedia); @@ -2430,7 +2438,7 @@ ti_rxeof(sc) TI_LOCK_ASSERT(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->ti_ifp; while (sc->ti_rx_saved_considx != sc->ti_return_prodidx.ti_idx) { struct ti_rx_desc *cur_rx; @@ -2547,7 +2555,7 @@ ti_txeof(sc) struct ti_tx_desc *cur_tx = NULL; struct ifnet *ifp; - ifp = &sc->arpcom.ac_if; + ifp = sc->ti_ifp; /* * Go through our tx ring and free mbufs for those @@ -2597,7 +2605,7 @@ ti_intr(xsc) sc = xsc; TI_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->ti_ifp; /*#ifdef notdef*/ /* Avoid this for now -- checking this register is expensive. */ @@ -2636,7 +2644,7 @@ ti_stats_update(sc) { struct ifnet *ifp; - ifp = &sc->arpcom.ac_if; + ifp = sc->ti_ifp; ifp->if_collisions += (sc->ti_rdata->ti_info.ti_stats.dot3StatsSingleCollisionFrames + @@ -2676,7 +2684,7 @@ ti_encap(sc, m_head, txidx) csum_flags |= TI_BDFLAG_IP_FRAG; } - mtag = VLAN_OUTPUT_TAG(&sc->arpcom.ac_if, m); + mtag = VLAN_OUTPUT_TAG(sc->ti_ifp, m); /* * Start packing the mbufs in this chain into @@ -2842,7 +2850,7 @@ static void ti_init2(sc) struct ifmedia *ifm; int tmp; - ifp = &sc->arpcom.ac_if; + ifp = sc->ti_ifp; /* Specify MTU and interface index. */ CSR_WRITE_4(sc, TI_GCR_IFINDEX, sc->ti_unit); @@ -2851,7 +2859,7 @@ static void ti_init2(sc) TI_DO_CMD(TI_CMD_UPDATE_GENCOM, 0, 0); /* Load our MAC address. */ - m = (u_int16_t *)&sc->arpcom.ac_enaddr[0]; + m = (u_int16_t *)&IFP2ENADDR(sc->ti_ifp)[0]; CSR_WRITE_4(sc, TI_GCR_PAR0, htons(m[0])); CSR_WRITE_4(sc, TI_GCR_PAR1, (htons(m[1]) << 16) | htons(m[2])); TI_DO_CMD(TI_CMD_SET_MAC_ADDR, 0, 0); @@ -3489,7 +3497,7 @@ ti_stop(sc) TI_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->ti_ifp; /* Disable host interrupts. */ CSR_WRITE_4(sc, TI_MB_HOSTINTR, 1); diff --git a/sys/pci/if_tireg.h b/sys/pci/if_tireg.h index 6e438d4..1bcdfbc 100644 --- a/sys/pci/if_tireg.h +++ b/sys/pci/if_tireg.h @@ -987,7 +987,7 @@ typedef enum { struct ti_softc { STAILQ_ENTRY(ti_softc) ti_links; - struct arpcom arpcom; /* interface info */ + struct ifnet *ti_ifp; bus_space_handle_t ti_bhandle; vm_offset_t ti_vhandle; bus_space_tag_t ti_btag; diff --git a/sys/pci/if_tl.c b/sys/pci/if_tl.c index 0f70a32..3dde56a 100644 --- a/sys/pci/if_tl.c +++ b/sys/pci/if_tl.c @@ -191,6 +191,7 @@ __FBSDID("$FreeBSD$"); #include <net/ethernet.h> #include <net/if_dl.h> #include <net/if_media.h> +#include <net/if_types.h> #include <net/bpf.h> @@ -523,7 +524,7 @@ static u_int8_t tl_eeprom_getbyte(sc, addr, dest) { register int i; u_int8_t byte = 0; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->tl_ifp; tl_dio_write8(sc, TL_NETSIO, 0); @@ -945,7 +946,7 @@ tl_setmulti(sc) int h, i; struct ifmultiaddr *ifma; u_int8_t dummy[] = { 0, 0, 0, 0, 0 ,0 }; - ifp = &sc->arpcom.ac_if; + ifp = sc->tl_ifp; /* First, zot all the existing filters. */ for (i = 1; i < 4; i++) @@ -1115,6 +1116,7 @@ tl_attach(dev) struct ifnet *ifp; struct tl_softc *sc; int unit, error = 0, rid; + u_char eaddr[6]; vid = pci_get_vendor(dev); did = pci_get_device(dev); @@ -1227,8 +1229,7 @@ tl_attach(dev) /* * Get station address from the EEPROM. */ - if (tl_read_eeprom(sc, (caddr_t)&sc->arpcom.ac_enaddr, - sc->tl_eeaddr, ETHER_ADDR_LEN)) { + if (tl_read_eeprom(sc, eaddr, sc->tl_eeaddr, ETHER_ADDR_LEN)) { device_printf(dev, "failed to read station address\n"); error = ENXIO; goto fail; @@ -1251,12 +1252,17 @@ tl_attach(dev) if (sc->tl_dinfo->tl_vid == OLICOM_VENDORID) { for (i = 0; i < ETHER_ADDR_LEN; i += 2) { u_int16_t *p; - p = (u_int16_t *)&sc->arpcom.ac_enaddr[i]; + p = (u_int16_t *)&eaddr[i]; *p = ntohs(*p); } } - ifp = &sc->arpcom.ac_if; + ifp = sc->tl_ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + device_printf(dev, "can not if_alloc()\n"); + error = ENOSPC; + goto fail; + } ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST | @@ -1299,7 +1305,7 @@ tl_attach(dev) /* * Call MI attach routine. */ - ether_ifattach(ifp, sc->arpcom.ac_enaddr); + ether_ifattach(ifp, eaddr); /* Hook interrupt last to avoid having to lock softc */ error = bus_setup_intr(dev, sc->tl_irq, INTR_TYPE_NET, @@ -1308,6 +1314,7 @@ tl_attach(dev) if (error) { device_printf(dev, "couldn't set up irq\n"); ether_ifdetach(ifp); + if_free(ifp); goto fail; } @@ -1335,12 +1342,13 @@ tl_detach(dev) sc = device_get_softc(dev); KASSERT(mtx_initialized(&sc->tl_mtx), ("tl mutex not initialized")); TL_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->tl_ifp; /* These should only be active if attach succeeded */ if (device_is_attached(dev)) { tl_stop(sc); ether_ifdetach(ifp); + if_free(ifp); } if (sc->tl_miibus) device_delete_child(dev, sc->tl_miibus); @@ -1494,7 +1502,7 @@ tl_intvec_rxeof(xsc, type) struct tl_chain_onefrag *cur_rx; sc = xsc; - ifp = &sc->arpcom.ac_if; + ifp = sc->tl_ifp; TL_LOCK_ASSERT(sc); @@ -1528,7 +1536,7 @@ tl_intvec_rxeof(xsc, type) */ eh = mtod(m, struct ether_header *); /*if (ifp->if_flags & IFF_PROMISC && */ - if (!bcmp(eh->ether_shost, sc->arpcom.ac_enaddr, + if (!bcmp(eh->ether_shost, IFP2ENADDR(sc->tl_ifp), ETHER_ADDR_LEN)) { m_freem(m); continue; @@ -1639,7 +1647,7 @@ tl_intvec_txeoc(xsc, type) u_int32_t cmd; sc = xsc; - ifp = &sc->arpcom.ac_if; + ifp = sc->tl_ifp; /* Clear the timeout timer. */ ifp->if_timer = 0; @@ -1676,7 +1684,7 @@ tl_intvec_adchk(xsc, type) sc = xsc; if (type) - if_printf(&sc->arpcom.ac_if, "adapter check: %x\n", + if_printf(sc->tl_ifp, "adapter check: %x\n", (unsigned int)CSR_READ_4(sc, TL_CH_PARM)); tl_softreset(sc, 1); @@ -1700,7 +1708,7 @@ tl_intvec_netsts(xsc, type) netsts = tl_dio_read16(sc, TL_NETSTS); tl_dio_write16(sc, TL_NETSTS, netsts); - if_printf(&sc->arpcom.ac_if, "network status: %x\n", netsts); + if_printf(sc->tl_ifp, "network status: %x\n", netsts); return(1); } @@ -1726,7 +1734,7 @@ tl_intr(xsc) ivec = (ints & TL_VEC_MASK) >> 5; ints = (ints & TL_INT_MASK) >> 2; - ifp = &sc->arpcom.ac_if; + ifp = sc->tl_ifp; switch(ints) { case (TL_INTR_INVALID): @@ -1795,7 +1803,7 @@ tl_stats_update(xsc) sc = xsc; TL_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->tl_ifp; p = (u_int32_t *)&tl_stats; @@ -1854,7 +1862,7 @@ tl_encap(sc, c, m_head) struct tl_frag *f = NULL; int total_len; struct mbuf *m; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->tl_ifp; /* * Start packing the mbufs in this chain into @@ -2040,12 +2048,12 @@ tl_init(xsc) void *xsc; { struct tl_softc *sc = xsc; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->tl_ifp; struct mii_data *mii; TL_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->tl_ifp; /* * Cancel pending I/O. @@ -2078,7 +2086,7 @@ tl_init(xsc) tl_dio_write16(sc, TL_MAXRX, MCLBYTES); /* Init our MAC address */ - tl_setfilt(sc, (caddr_t)&sc->arpcom.ac_enaddr, 0); + tl_setfilt(sc, (caddr_t)&IFP2ENADDR(sc->tl_ifp), 0); /* Init multicast filter, if needed. */ tl_setmulti(sc); @@ -2273,7 +2281,7 @@ tl_stop(sc) TL_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->tl_ifp; /* Stop the stats updater. */ untimeout(tl_stats_update, sc, sc->tl_stat_ch); diff --git a/sys/pci/if_tlreg.h b/sys/pci/if_tlreg.h index a8d3128..792ba70 100644 --- a/sys/pci/if_tlreg.h +++ b/sys/pci/if_tlreg.h @@ -109,7 +109,7 @@ struct tl_chain_data { }; struct tl_softc { - struct arpcom arpcom; /* interface info */ + struct ifnet *tl_ifp; struct ifmedia ifmedia; /* media info */ bus_space_handle_t tl_bhandle; bus_space_tag_t tl_btag; diff --git a/sys/pci/if_vr.c b/sys/pci/if_vr.c index 502deb1..23194f7 100644 --- a/sys/pci/if_vr.c +++ b/sys/pci/if_vr.c @@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$"); #include <net/ethernet.h> #include <net/if_dl.h> #include <net/if_media.h> +#include <net/if_types.h> #include <net/bpf.h> @@ -508,7 +509,7 @@ vr_miibus_statchg(device_t dev) static void vr_setmulti(struct vr_softc *sc) { - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->vr_ifp; int h = 0; uint32_t hashes[2] = { 0, 0 }; struct ifmultiaddr *ifma; @@ -709,7 +710,6 @@ vr_attach(dev) eaddr[i] = CSR_READ_1(sc, VR_PAR0 + i); sc->vr_unit = unit; - bcopy(eaddr, (char *)&sc->arpcom.ac_enaddr, ETHER_ADDR_LEN); sc->vr_ldata = contigmalloc(sizeof(struct vr_list_data), M_DEVBUF, M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0); @@ -722,7 +722,12 @@ vr_attach(dev) bzero(sc->vr_ldata, sizeof(struct vr_list_data)); - ifp = &sc->arpcom.ac_if; + ifp = sc->vr_ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + printf("vr%d: can not if_alloc()\n", unit); + error = ENOSPC; + goto fail; + } ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_mtu = ETHERMTU; @@ -762,6 +767,7 @@ vr_attach(dev) if (error) { printf("vr%d: couldn't set up irq\n", unit); ether_ifdetach(ifp); + if_free(ifp); goto fail; } @@ -783,7 +789,7 @@ static int vr_detach(device_t dev) { struct vr_softc *sc = device_get_softc(dev); - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->vr_ifp; KASSERT(mtx_initialized(&sc->vr_mtx), ("vr mutex not initialized")); @@ -796,6 +802,7 @@ vr_detach(device_t dev) vr_stop(sc); VR_UNLOCK(sc); /* XXX: Avoid recursive acquire. */ ether_ifdetach(ifp); + if_free(ifp); VR_LOCK(sc); } if (sc->vr_miibus) @@ -938,7 +945,7 @@ vr_rxeof(struct vr_softc *sc) uint32_t rxstat; VR_LOCK_ASSERT(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->vr_ifp; while (!((rxstat = sc->vr_cdata.vr_rx_head->vr_ptr->vr_status) & VR_RXSTAT_OWN)) { @@ -1014,7 +1021,7 @@ vr_rxeof(struct vr_softc *sc) static void vr_rxeoc(struct vr_softc *sc) { - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->vr_ifp; int i; VR_LOCK_ASSERT(sc); @@ -1052,7 +1059,7 @@ static void vr_txeof(struct vr_softc *sc) { struct vr_chain *cur_tx; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->vr_ifp; VR_LOCK_ASSERT(sc); @@ -1224,7 +1231,7 @@ static void vr_intr(void *arg) { struct vr_softc *sc = arg; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->vr_ifp; uint16_t status; VR_LOCK(sc); @@ -1444,7 +1451,7 @@ vr_init(void *xsc) static void vr_init_locked(struct vr_softc *sc) { - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->vr_ifp; struct mii_data *mii; int i; @@ -1458,7 +1465,7 @@ vr_init_locked(struct vr_softc *sc) /* Set our station address. */ for (i = 0; i < ETHER_ADDR_LEN; i++) - CSR_WRITE_1(sc, VR_PAR0 + i, sc->arpcom.ac_enaddr[i]); + CSR_WRITE_1(sc, VR_PAR0 + i, IFP2ENADDR(sc->vr_ifp)[i]); /* Set DMA size. */ VR_CLRBIT(sc, VR_BCR0, VR_BCR0_DMA_LENGTH); @@ -1648,7 +1655,7 @@ vr_stop(struct vr_softc *sc) VR_LOCK_ASSERT(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->vr_ifp; ifp->if_timer = 0; untimeout(vr_tick, sc, sc->vr_stat_ch); diff --git a/sys/pci/if_vrreg.h b/sys/pci/if_vrreg.h index cbf4147..7d42656 100644 --- a/sys/pci/if_vrreg.h +++ b/sys/pci/if_vrreg.h @@ -452,7 +452,7 @@ struct vr_mii_frame { #define VR_FLAG_DELAYTIMEO 3 struct vr_softc { - struct arpcom arpcom; /* interface info */ + struct ifnet *vr_ifp; /* interface info */ bus_space_handle_t vr_bhandle; /* bus space handle */ bus_space_tag_t vr_btag; /* bus space tag */ struct resource *vr_res; diff --git a/sys/pci/if_wb.c b/sys/pci/if_wb.c index 8b460ec..0677fca 100644 --- a/sys/pci/if_wb.c +++ b/sys/pci/if_wb.c @@ -100,6 +100,7 @@ __FBSDID("$FreeBSD$"); #include <net/ethernet.h> #include <net/if_dl.h> #include <net/if_media.h> +#include <net/if_types.h> #include <net/bpf.h> @@ -596,7 +597,7 @@ wb_setmulti(sc) u_int32_t rxfilt; int mcnt = 0; - ifp = &sc->arpcom.ac_if; + ifp = sc->wb_ifp; rxfilt = CSR_READ_4(sc, WB_NETCFG); @@ -735,7 +736,7 @@ wb_fixmedia(sc) return; mii = device_get_softc(sc->wb_miibus); - ifp = &sc->arpcom.ac_if; + ifp = sc->wb_ifp; mii_pollstat(mii); if (IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T) { @@ -834,7 +835,6 @@ wb_attach(dev) wb_read_eeprom(sc, (caddr_t)&eaddr, 0, 3, 0); sc->wb_unit = unit; - bcopy(eaddr, (char *)&sc->arpcom.ac_enaddr, ETHER_ADDR_LEN); sc->wb_ldata = contigmalloc(sizeof(struct wb_list_data) + 8, M_DEVBUF, M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0); @@ -847,7 +847,12 @@ wb_attach(dev) bzero(sc->wb_ldata, sizeof(struct wb_list_data)); - ifp = &sc->arpcom.ac_if; + ifp = sc->wb_ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + printf("wb%d: can not if_alloc()\n", unit); + error = ENOSPC; + goto fail; + } ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_mtu = ETHERMTU; @@ -881,6 +886,7 @@ wb_attach(dev) if (error) { printf("wb%d: couldn't set up irq\n", unit); ether_ifdetach(ifp); + if_free(ifp); goto fail; } @@ -908,7 +914,7 @@ wb_detach(dev) sc = device_get_softc(dev); KASSERT(mtx_initialized(&sc->wb_mtx), ("wb mutex not initialized")); WB_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->wb_ifp; /* * Delete any miibus and phy devices attached to this interface. @@ -917,6 +923,7 @@ wb_detach(dev) if (device_is_attached(dev)) { wb_stop(sc); ether_ifdetach(ifp); + if_free(ifp); } if (sc->wb_miibus) device_delete_child(dev, sc->wb_miibus); @@ -1070,7 +1077,7 @@ wb_rxeof(sc) WB_LOCK_ASSERT(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->wb_ifp; while(!((rxstat = sc->wb_cdata.wb_rx_head->wb_ptr->wb_status) & WB_RXSTAT_OWN)) { @@ -1156,7 +1163,7 @@ wb_txeof(sc) struct wb_chain *cur_tx; struct ifnet *ifp; - ifp = &sc->arpcom.ac_if; + ifp = sc->wb_ifp; /* Clear the timeout timer. */ ifp->if_timer = 0; @@ -1212,7 +1219,7 @@ wb_txeoc(sc) { struct ifnet *ifp; - ifp = &sc->arpcom.ac_if; + ifp = sc->wb_ifp; ifp->if_timer = 0; @@ -1240,7 +1247,7 @@ wb_intr(arg) sc = arg; WB_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->wb_ifp; if (!(ifp->if_flags & IFF_UP)) { WB_UNLOCK(sc); @@ -1535,7 +1542,7 @@ wb_init(xsc) void *xsc; { struct wb_softc *sc = xsc; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->wb_ifp; int i; struct mii_data *mii; @@ -1582,7 +1589,7 @@ wb_init(xsc) /* Init our MAC address */ for (i = 0; i < ETHER_ADDR_LEN; i++) { - CSR_WRITE_1(sc, WB_NODE0 + i, sc->arpcom.ac_enaddr[i]); + CSR_WRITE_1(sc, WB_NODE0 + i, IFP2ENADDR(sc->wb_ifp)[i]); } /* Init circular RX list. */ @@ -1770,7 +1777,7 @@ wb_stop(sc) struct ifnet *ifp; WB_LOCK(sc); - ifp = &sc->arpcom.ac_if; + ifp = sc->wb_ifp; ifp->if_timer = 0; untimeout(wb_tick, sc, sc->wb_stat_ch); diff --git a/sys/pci/if_wbreg.h b/sys/pci/if_wbreg.h index 82bd081..3f640a2 100644 --- a/sys/pci/if_wbreg.h +++ b/sys/pci/if_wbreg.h @@ -362,7 +362,7 @@ struct wb_mii_frame { #define WB_MII_TURNAROUND 0x02 struct wb_softc { - struct arpcom arpcom; /* interface info */ + struct ifnet *wb_ifp; /* interface info */ device_t wb_miibus; bus_space_handle_t wb_bhandle; bus_space_tag_t wb_btag; diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c index 272b70b..f869af2 100644 --- a/sys/pci/if_xl.c +++ b/sys/pci/if_xl.c @@ -116,6 +116,7 @@ __FBSDID("$FreeBSD$"); #include <net/ethernet.h> #include <net/if_dl.h> #include <net/if_media.h> +#include <net/if_types.h> #include <net/bpf.h> @@ -386,7 +387,7 @@ xl_wait(struct xl_softc *sc) } if (i == XL_TIMEOUT) - if_printf(&sc->arpcom.ac_if, "command never completed!\n"); + if_printf(sc->xl_ifp, "command never completed!\n"); } /* @@ -659,7 +660,7 @@ xl_miibus_mediainit(device_t dev) if (sc->xl_type == XL_TYPE_905B && sc->xl_media == XL_MEDIAOPT_10FL) { if (bootverbose) - if_printf(&sc->arpcom.ac_if, + if_printf(sc->xl_ifp, "found 10baseFL\n"); ifmedia_add(ifm, IFM_ETHER | IFM_10_FL, 0, NULL); ifmedia_add(ifm, IFM_ETHER | IFM_10_FL|IFM_HDX, 0, @@ -669,14 +670,14 @@ xl_miibus_mediainit(device_t dev) IFM_ETHER | IFM_10_FL | IFM_FDX, 0, NULL); } else { if (bootverbose) - if_printf(&sc->arpcom.ac_if, "found AUI\n"); + if_printf(sc->xl_ifp, "found AUI\n"); ifmedia_add(ifm, IFM_ETHER | IFM_10_5, 0, NULL); } } if (sc->xl_media & XL_MEDIAOPT_BNC) { if (bootverbose) - if_printf(&sc->arpcom.ac_if, "found BNC\n"); + if_printf(sc->xl_ifp, "found BNC\n"); ifmedia_add(ifm, IFM_ETHER | IFM_10_2, 0, NULL); } } @@ -698,7 +699,7 @@ xl_eeprom_wait(struct xl_softc *sc) } if (i == 100) { - if_printf(&sc->arpcom.ac_if, "eeprom failed to come ready\n"); + if_printf(sc->xl_ifp, "eeprom failed to come ready\n"); return (1); } @@ -760,7 +761,7 @@ xl_read_eeprom(struct xl_softc *sc, caddr_t dest, int off, int cnt, int swap) static void xl_setmulti(struct xl_softc *sc) { - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->xl_ifp; struct ifmultiaddr *ifma; u_int8_t rxfilt; int mcnt = 0; @@ -793,7 +794,7 @@ xl_setmulti(struct xl_softc *sc) static void xl_setmulti_hash(struct xl_softc *sc) { - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->xl_ifp; int h = 0, i; struct ifmultiaddr *ifma; u_int8_t rxfilt; @@ -851,16 +852,16 @@ static void xl_testpacket(struct xl_softc *sc) { struct mbuf *m; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->xl_ifp; MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return; - bcopy(&sc->arpcom.ac_enaddr, + bcopy(&IFP2ENADDR(sc->xl_ifp), mtod(m, struct ether_header *)->ether_dhost, ETHER_ADDR_LEN); - bcopy(&sc->arpcom.ac_enaddr, + bcopy(&IFP2ENADDR(sc->xl_ifp), mtod(m, struct ether_header *)->ether_shost, ETHER_ADDR_LEN); mtod(m, struct ether_header *)->ether_type = htons(3); mtod(m, unsigned char *)[14] = 0; @@ -985,7 +986,7 @@ xl_setmode(struct xl_softc *sc, int media) DELAY(800); XL_SEL_WIN(7); - if_printf(&sc->arpcom.ac_if, "selecting %s, %s duplex\n", pmsg, dmsg); + if_printf(sc->xl_ifp, "selecting %s, %s duplex\n", pmsg, dmsg); } static void @@ -1017,7 +1018,7 @@ xl_reset(struct xl_softc *sc) } if (i == XL_TIMEOUT) - if_printf(&sc->arpcom.ac_if, "reset didn't complete\n"); + if_printf(sc->xl_ifp, "reset didn't complete\n"); /* Reset TX and RX. */ /* Note: the RX reset takes an absurd amount of time @@ -1102,20 +1103,20 @@ xl_mediacheck(struct xl_softc *sc) if (sc->xl_xcvr <= XL_XCVR_AUTO) return; else { - if_printf(&sc->arpcom.ac_if, + if_printf(sc->xl_ifp, "bogus xcvr value in EEPROM (%x)\n", sc->xl_xcvr); - if_printf(&sc->arpcom.ac_if, + if_printf(sc->xl_ifp, "choosing new default based on card type\n"); } } else { if (sc->xl_type == XL_TYPE_905B && sc->xl_media & XL_MEDIAOPT_10FL) return; - if_printf(&sc->arpcom.ac_if, + if_printf(sc->xl_ifp, "WARNING: no media options bits set in the media options register!!\n"); - if_printf(&sc->arpcom.ac_if, + if_printf(sc->xl_ifp, "this could be a manufacturing defect in your adapter or system\n"); - if_printf(&sc->arpcom.ac_if, + if_printf(sc->xl_ifp, "attempting to guess media type; you should probably consult your vendor\n"); } @@ -1140,7 +1141,7 @@ xl_choose_xcvr(struct xl_softc *sc, int verbose) sc->xl_media = XL_MEDIAOPT_BT; sc->xl_xcvr = XL_XCVR_10BT; if (verbose) - if_printf(&sc->arpcom.ac_if, + if_printf(sc->xl_ifp, "guessing 10BaseT transceiver\n"); break; case TC_DEVICEID_BOOMERANG_10BT_COMBO: /* 3c900-COMBO */ @@ -1148,20 +1149,20 @@ xl_choose_xcvr(struct xl_softc *sc, int verbose) sc->xl_media = XL_MEDIAOPT_BT|XL_MEDIAOPT_BNC|XL_MEDIAOPT_AUI; sc->xl_xcvr = XL_XCVR_10BT; if (verbose) - if_printf(&sc->arpcom.ac_if, + if_printf(sc->xl_ifp, "guessing COMBO (AUI/BNC/TP)\n"); break; case TC_DEVICEID_KRAKATOA_10BT_TPC: /* 3c900B-TPC */ sc->xl_media = XL_MEDIAOPT_BT|XL_MEDIAOPT_BNC; sc->xl_xcvr = XL_XCVR_10BT; if (verbose) - if_printf(&sc->arpcom.ac_if, "guessing TPC (BNC/TP)\n"); + if_printf(sc->xl_ifp, "guessing TPC (BNC/TP)\n"); break; case TC_DEVICEID_CYCLONE_10FL: /* 3c900B-FL */ sc->xl_media = XL_MEDIAOPT_10FL; sc->xl_xcvr = XL_XCVR_AUI; if (verbose) - if_printf(&sc->arpcom.ac_if, "guessing 10baseFL\n"); + if_printf(sc->xl_ifp, "guessing 10baseFL\n"); break; case TC_DEVICEID_BOOMERANG_10_100BT: /* 3c905-TX */ case TC_DEVICEID_HURRICANE_555: /* 3c555 */ @@ -1178,14 +1179,14 @@ xl_choose_xcvr(struct xl_softc *sc, int verbose) sc->xl_media = XL_MEDIAOPT_MII; sc->xl_xcvr = XL_XCVR_MII; if (verbose) - if_printf(&sc->arpcom.ac_if, "guessing MII\n"); + if_printf(sc->xl_ifp, "guessing MII\n"); break; case TC_DEVICEID_BOOMERANG_100BT4: /* 3c905-T4 */ case TC_DEVICEID_CYCLONE_10_100BT4: /* 3c905B-T4 */ sc->xl_media = XL_MEDIAOPT_BT4; sc->xl_xcvr = XL_XCVR_MII; if (verbose) - if_printf(&sc->arpcom.ac_if, + if_printf(sc->xl_ifp, "guessing 100baseT4/MII\n"); break; case TC_DEVICEID_HURRICANE_10_100BT: /* 3c905B-TX */ @@ -1197,18 +1198,18 @@ xl_choose_xcvr(struct xl_softc *sc, int verbose) sc->xl_media = XL_MEDIAOPT_BTX; sc->xl_xcvr = XL_XCVR_AUTO; if (verbose) - if_printf(&sc->arpcom.ac_if, + if_printf(sc->xl_ifp, "guessing 10/100 internal\n"); break; case TC_DEVICEID_CYCLONE_10_100_COMBO: /* 3c905B-COMBO */ sc->xl_media = XL_MEDIAOPT_BTX|XL_MEDIAOPT_BNC|XL_MEDIAOPT_AUI; sc->xl_xcvr = XL_XCVR_AUTO; if (verbose) - if_printf(&sc->arpcom.ac_if, + if_printf(sc->xl_ifp, "guessing 10/100 plus BNC/AUI\n"); break; default: - if_printf(&sc->arpcom.ac_if, + if_printf(sc->xl_ifp, "unknown device ID: %x -- defaulting to 10baseT\n", devid); sc->xl_media = XL_MEDIAOPT_BT; break; @@ -1345,7 +1346,12 @@ xl_attach(device_t dev) } /* Initialize interface name. */ - ifp = &sc->arpcom.ac_if; + ifp = sc->xl_ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + device_printf(dev, "can not if_alloc()\n"); + error = ENOSPC; + goto fail; + } ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); @@ -1369,7 +1375,6 @@ xl_attach(device_t dev) sc->xl_unit = unit; callout_handle_init(&sc->xl_stat_ch); TASK_INIT(&sc->xl_task, 0, xl_rxeof_task, sc); - bcopy(eaddr, (char *)&sc->arpcom.ac_enaddr, ETHER_ADDR_LEN); /* * Now allocate a tag for the DMA descriptor lists and a chunk @@ -1620,6 +1625,7 @@ done: if (error) { device_printf(dev, "couldn't set up irq\n"); ether_ifdetach(ifp); + if_free(ifp); goto fail; } @@ -1669,7 +1675,7 @@ xl_choose_media(struct xl_softc *sc, int *media) *media = IFM_ETHER|IFM_100_FX; break; default: - if_printf(&sc->arpcom.ac_if, "unknown XCVR type: %d\n", + if_printf(sc->xl_ifp, "unknown XCVR type: %d\n", sc->xl_xcvr); /* * This will probably be wrong, but it prevents @@ -1697,7 +1703,7 @@ xl_detach(device_t dev) int rid, res; sc = device_get_softc(dev); - ifp = &sc->arpcom.ac_if; + ifp = sc->xl_ifp; KASSERT(mtx_initialized(&sc->xl_mtx), ("xl mutex not initialized")); XL_LOCK(sc); @@ -1715,6 +1721,7 @@ xl_detach(device_t dev) xl_reset(sc); xl_stop(sc); ether_ifdetach(ifp); + if_free(ifp); } if (sc->xl_miibus) device_delete_child(dev, sc->xl_miibus); @@ -1907,7 +1914,7 @@ xl_newbuf(struct xl_softc *sc, struct xl_chain_onefrag *c) xl_dma_map_rxbuf, &baddr, BUS_DMA_NOWAIT); if (error) { m_freem(m_new); - if_printf(&sc->arpcom.ac_if, "can't map mbuf (error %d)\n", + if_printf(sc->xl_ifp, "can't map mbuf (error %d)\n", error); return (error); } @@ -1956,7 +1963,7 @@ static void xl_rxeof(struct xl_softc *sc) { struct mbuf *m; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->xl_ifp; struct xl_chain_onefrag *cur_rx; int total_len = 0; u_int32_t rxstat; @@ -2106,7 +2113,7 @@ static void xl_txeof(struct xl_softc *sc) { struct xl_chain *cur_tx; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->xl_ifp; XL_LOCK_ASSERT(sc); @@ -2157,7 +2164,7 @@ static void xl_txeof_90xB(struct xl_softc *sc) { struct xl_chain *cur_tx = NULL; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->xl_ifp; int idx; XL_LOCK_ASSERT(sc); @@ -2210,7 +2217,7 @@ xl_txeoc(struct xl_softc *sc) if (txstat & XL_TXSTATUS_UNDERRUN || txstat & XL_TXSTATUS_JABBER || txstat & XL_TXSTATUS_RECLAIM) { - if_printf(&sc->arpcom.ac_if, + if_printf(sc->xl_ifp, "transmission error: %x\n", txstat); CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_TX_RESET); xl_wait(sc); @@ -2238,7 +2245,7 @@ xl_txeoc(struct xl_softc *sc) if (txstat & XL_TXSTATUS_UNDERRUN && sc->xl_tx_thresh < XL_PACKET_SIZE) { sc->xl_tx_thresh += XL_MIN_FRAMELEN; - if_printf(&sc->arpcom.ac_if, + if_printf(sc->xl_ifp, "tx underrun, increasing tx start threshold to %d bytes\n", sc->xl_tx_thresh); } CSR_WRITE_2(sc, XL_COMMAND, @@ -2265,7 +2272,7 @@ static void xl_intr(void *arg) { struct xl_softc *sc = arg; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->xl_ifp; u_int16_t status; XL_LOCK(sc); @@ -2431,7 +2438,7 @@ xl_stats_update(void *xsc) static void xl_stats_update_locked(struct xl_softc *sc) { - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->xl_ifp; struct xl_stats xl_stats; u_int8_t *p; int i; @@ -2484,7 +2491,7 @@ xl_encap(struct xl_softc *sc, struct xl_chain *c, struct mbuf *m_head) { int error; u_int32_t status; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->xl_ifp; XL_LOCK_ASSERT(sc); @@ -2794,7 +2801,7 @@ xl_init(void *xsc) static void xl_init_locked(struct xl_softc *sc) { - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->xl_ifp; int error, i; u_int16_t rxfilt = 0; struct mii_data *mii = NULL; @@ -2821,7 +2828,7 @@ xl_init_locked(struct xl_softc *sc) XL_SEL_WIN(2); for (i = 0; i < ETHER_ADDR_LEN; i++) { CSR_WRITE_1(sc, XL_W2_STATION_ADDR_LO + i, - sc->arpcom.ac_enaddr[i]); + IFP2ENADDR(sc->xl_ifp)[i]); } /* Clear the station mask. */ @@ -3259,7 +3266,7 @@ static void xl_stop(struct xl_softc *sc) { register int i; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->xl_ifp; XL_LOCK_ASSERT(sc); @@ -3367,7 +3374,7 @@ xl_resume(device_t dev) struct ifnet *ifp; sc = device_get_softc(dev); - ifp = &sc->arpcom.ac_if; + ifp = sc->xl_ifp; XL_LOCK(sc); diff --git a/sys/pci/if_xlreg.h b/sys/pci/if_xlreg.h index 6b2829f..d1d2e8f 100644 --- a/sys/pci/if_xlreg.h +++ b/sys/pci/if_xlreg.h @@ -580,7 +580,7 @@ struct xl_mii_frame { #define XL_NO_XCVR_PWR_MAGICBITS 0x0900 struct xl_softc { - struct arpcom arpcom; /* interface info */ + struct ifnet *xl_ifp; /* interface info */ struct ifmedia ifmedia; /* media info */ bus_space_handle_t xl_bhandle; bus_space_tag_t xl_btag; |