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/dev/awi | |
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/dev/awi')
-rw-r--r-- | sys/dev/awi/awi.c | 40 | ||||
-rw-r--r-- | sys/dev/awi/awivar.h | 1 |
2 files changed, 20 insertions, 21 deletions
diff --git a/sys/dev/awi/awi.c b/sys/dev/awi/awi.c index 84a3df3..0325995 100644 --- a/sys/dev/awi/awi.c +++ b/sys/dev/awi/awi.c @@ -258,7 +258,7 @@ int awi_attach(struct awi_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; - struct ifnet *ifp = &sc->sc_if; + struct ifnet *ifp = AC2IFP(&sc->sc_arp); int s, i, error, nrate; int mword; enum ieee80211_phymode mode; @@ -372,7 +372,7 @@ awi_attach(struct awi_softc *sc) int awi_detach(struct awi_softc *sc) { - struct ifnet *ifp = &sc->sc_if; + struct ifnet *ifp = AC2IFP(&sc->sc_arp); int s; if (!sc->sc_attached) @@ -402,7 +402,7 @@ int awi_activate(struct device *self, enum devact act) { struct awi_softc *sc = (struct awi_softc *)self; - struct ifnet *ifp = &sc->sc_if; + struct ifnet *ifp = AC2IFP(&sc->sc_arp); int s, error = 0; s = splnet(); @@ -423,7 +423,7 @@ void awi_power(int why, void *arg) { struct awi_softc *sc = arg; - struct ifnet *ifp = &sc->sc_if; + struct ifnet *ifp = AC2IFP(&sc->sc_arp); int s; int ocansleep; @@ -456,7 +456,7 @@ void awi_shutdown(void *arg) { struct awi_softc *sc = arg; - struct ifnet *ifp = &sc->sc_if; + struct ifnet *ifp = AC2IFP(&sc->sc_arp); if (sc->sc_attached) awi_stop(ifp, 1); @@ -542,7 +542,7 @@ awi_init0(void *arg) { struct awi_softc *sc = arg; - (void)awi_init(&sc->sc_if); + (void)awi_init(AC2IFP(&sc->sc_arp)); } #endif @@ -1125,7 +1125,7 @@ awi_media_status(struct ifnet *ifp, struct ifmediareq *imr) static int awi_mode_init(struct awi_softc *sc) { - struct ifnet *ifp = &sc->sc_if; + struct ifnet *ifp = AC2IFP(&sc->sc_arp); int n, error; #ifdef __FreeBSD__ struct ifmultiaddr *ifma; @@ -1197,7 +1197,7 @@ static void awi_rx_int(struct awi_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; - struct ifnet *ifp = &sc->sc_if; + struct ifnet *ifp = AC2IFP(&sc->sc_arp); struct ieee80211_node *ni; u_int8_t state, rate, rssi; u_int16_t len; @@ -1274,7 +1274,7 @@ awi_rx_int(struct awi_softc *sc) static void awi_tx_int(struct awi_softc *sc) { - struct ifnet *ifp = &sc->sc_if; + struct ifnet *ifp = AC2IFP(&sc->sc_arp); u_int8_t flags; while (sc->sc_txdone != sc->sc_txnext) { @@ -1296,7 +1296,7 @@ awi_tx_int(struct awi_softc *sc) static struct mbuf * awi_devget(struct awi_softc *sc, u_int32_t off, u_int16_t len) { - struct ifnet *ifp = &sc->sc_if; + struct ifnet *ifp = AC2IFP(&sc->sc_arp); struct mbuf *m; struct mbuf *top, **mp; u_int tlen; @@ -1397,7 +1397,7 @@ awi_hw_init(struct awi_softc *sc) return ENXIO; if (i >= AWI_SELFTEST_TIMEOUT*hz/1000) { printf("%s: failed to complete selftest (timeout)\n", - sc->sc_if.if_xname); + AC2IFP(&sc->sc_arp)->if_xname); return ENXIO; } status = awi_read_1(sc, AWI_SELFTEST); @@ -1413,7 +1413,7 @@ awi_hw_init(struct awi_softc *sc) } if (status != AWI_SELFTEST_PASSED) { printf("%s: failed to complete selftest (code %x)\n", - sc->sc_if.if_xname, status); + AC2IFP(&sc->sc_arp)->if_xname, status); return ENXIO; } @@ -1421,7 +1421,7 @@ awi_hw_init(struct awi_softc *sc) awi_read_bytes(sc, AWI_BANNER, sc->sc_banner, AWI_BANNER_LEN); if (memcmp(sc->sc_banner, "PCnetMobile:", 12) != 0) { printf("%s: failed to complete selftest (bad banner)\n", - sc->sc_if.if_xname); + AC2IFP(&sc->sc_arp)->if_xname); for (i = 0; i < AWI_BANNER_LEN; i++) printf("%s%02x", i ? ":" : "\t", sc->sc_banner[i]); printf("\n"); @@ -1446,7 +1446,7 @@ awi_hw_init(struct awi_softc *sc) error = awi_cmd(sc, AWI_CMD_NOP, AWI_WAIT); if (error) { printf("%s: failed to complete selftest", - sc->sc_if.if_xname); + AC2IFP(&sc->sc_arp)->if_xname); if (error == ENXIO) printf(" (no hardware)\n"); else if (error != EWOULDBLOCK) @@ -1484,7 +1484,7 @@ awi_init_mibs(struct awi_softc *sc) (error = awi_mib(sc, AWI_CMD_GET_MIB, AWI_MIB_MGT, AWI_WAIT)) || (error = awi_mib(sc, AWI_CMD_GET_MIB, AWI_MIB_PHY, AWI_WAIT))) { printf("%s: failed to get default mib value (error %d)\n", - sc->sc_if.if_xname, error); + AC2IFP(&sc->sc_arp)->if_xname, error); return error; } @@ -1492,7 +1492,7 @@ awi_init_mibs(struct awi_softc *sc) for (cs = awi_chanset; ; cs++) { if (cs->cs_type == 0) { printf("%s: failed to set available channel\n", - sc->sc_if.if_xname); + AC2IFP(&sc->sc_arp)->if_xname); return ENXIO; } if (cs->cs_type == sc->sc_mib_phy.IEEE_PHY_Type && @@ -1672,7 +1672,7 @@ awi_cmd(struct awi_softc *sc, u_int8_t cmd, int wflag) return EINVAL; default: printf("%s: command %d failed %x\n", - sc->sc_if.if_xname, cmd, status); + AC2IFP(&sc->sc_arp)->if_xname, cmd, status); return ENXIO; } return 0; @@ -1689,7 +1689,7 @@ awi_cmd_wait(struct awi_softc *sc) return ENXIO; if (awi_read_1(sc, AWI_CMD) != sc->sc_cmd_inprog) { printf("%s: failed to access hardware\n", - sc->sc_if.if_xname); + AC2IFP(&sc->sc_arp)->if_xname); sc->sc_invalid = 1; return ENXIO; } @@ -1734,7 +1734,7 @@ awi_cmd_done(struct awi_softc *sc) if (status != AWI_STAT_OK) { printf("%s: command %d failed %x\n", - sc->sc_if.if_xname, cmd, status); + AC2IFP(&sc->sc_arp)->if_xname, cmd, status); sc->sc_substate = AWI_ST_NONE; return; } @@ -1849,7 +1849,7 @@ awi_intr_lock(struct awi_softc *sc) } if (status != 0) { printf("%s: failed to lock interrupt\n", - sc->sc_if.if_xname); + AC2IFP(&sc->sc_arp)->if_xname); return ENXIO; } return 0; diff --git a/sys/dev/awi/awivar.h b/sys/dev/awi/awivar.h index 64da83d..25934ab 100644 --- a/sys/dev/awi/awivar.h +++ b/sys/dev/awi/awivar.h @@ -79,7 +79,6 @@ struct awi_softc { #endif #ifdef __FreeBSD__ struct arpcom sc_arp; -#define sc_if sc_arp.ac_if device_t sc_dev; #endif struct am79c930_softc sc_chip; |