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/firewire/if_fwip.c | |
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/firewire/if_fwip.c')
-rw-r--r-- | sys/dev/firewire/if_fwip.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/sys/dev/firewire/if_fwip.c b/sys/dev/firewire/if_fwip.c index 23e812a..3d12ad2 100644 --- a/sys/dev/firewire/if_fwip.c +++ b/sys/dev/firewire/if_fwip.c @@ -55,6 +55,7 @@ #include <net/if.h> #include <net/firewire.h> #include <net/if_arp.h> +#include <net/if_types.h> #ifdef __DragonFly__ #include <bus/firewire/firewire.h> #include <bus/firewire/firewirereg.h> @@ -170,6 +171,9 @@ fwip_attach(device_t dev) fwip = ((struct fwip_softc *)device_get_softc(dev)); unit = device_get_unit(dev); + ifp = fwip->fw_softc.fwip_ifp = if_alloc(IFT_IEEE1394); + if (ifp == NULL) + return (ENOSPC); bzero(fwip, sizeof(struct fwip_softc)); /* XXX */ @@ -188,7 +192,7 @@ fwip_attach(device_t dev) /* * Encode our hardware the way that arp likes it. */ - hwaddr = &fwip->fw_softc.fwcom.fc_hwaddr; + hwaddr = &IFP2FWC(fwip->fw_softc.fwip_ifp)->fc_hwaddr; hwaddr->sender_unique_ID_hi = htonl(fwip->fd.fc->eui.hi); hwaddr->sender_unique_ID_lo = htonl(fwip->fd.fc->eui.lo); hwaddr->sender_max_rec = fwip->fd.fc->maxrec; @@ -197,7 +201,6 @@ fwip_attach(device_t dev) hwaddr->sender_unicast_FIFO_lo = htonl((uint32_t)INET_FIFO); /* fill the rest and attach interface */ - ifp = &fwip->fwip_if; ifp->if_softc = &fwip->fw_softc; #if __FreeBSD_version >= 501113 || defined(__DragonFly__) @@ -226,7 +229,7 @@ fwip_stop(struct fwip_softc *fwip) { struct firewire_comm *fc; struct fw_xferq *xferq; - struct ifnet *ifp = &fwip->fwip_if; + struct ifnet *ifp = fwip->fw_softc.fwip_ifp; struct fw_xfer *xfer, *next; int i; @@ -279,7 +282,8 @@ fwip_detach(device_t dev) s = splimp(); fwip_stop(fwip); - firewire_ifdetach(&fwip->fwip_if); + firewire_ifdetach(fwip->fw_softc.fwip_ifp); + if_free(fwip->fw_softc.fwip_ifp); splx(s); return 0; @@ -290,7 +294,7 @@ fwip_init(void *arg) { struct fwip_softc *fwip = ((struct fwip_eth_softc *)arg)->fwip; struct firewire_comm *fc; - struct ifnet *ifp = &fwip->fwip_if; + struct ifnet *ifp = fwip->fw_softc.fwip_ifp; struct fw_xferq *xferq; struct fw_xfer *xfer; struct mbuf *m; @@ -473,7 +477,7 @@ fwip_post_busreset(void *arg) fwip->last_dest.hi = 0; fwip->last_dest.lo = 0; - firewire_busreset(&fwip->fwip_if); + firewire_busreset(fwip->fw_softc.fwip_ifp); } static void @@ -486,7 +490,7 @@ fwip_output_callback(struct fw_xfer *xfer) GIANT_REQUIRED; fwip = (struct fwip_softc *)xfer->sc; - ifp = &fwip->fwip_if; + ifp = fwip->fw_softc.fwip_ifp; /* XXX error check */ FWIPDEBUG(ifp, "resp = %d\n", xfer->resp); if (xfer->resp != 0) @@ -728,7 +732,7 @@ fwip_stream_input(struct fw_xferq *xferq) GIANT_REQUIRED; fwip = (struct fwip_softc *)xferq->sc; - ifp = &fwip->fwip_if; + ifp = fwip->fw_softc.fwip_ifp; #if 0 FWIP_POLL_REGISTER(fwip_poll, fwip, ifp); #endif @@ -858,7 +862,7 @@ fwip_unicast_input(struct fw_xfer *xfer) GIANT_REQUIRED; fwip = (struct fwip_softc *)xfer->sc; - ifp = &fwip->fwip_if; + ifp = fwip->fw_softc.fwip_ifp; m = xfer->mbuf; xfer->mbuf = 0; fp = &xfer->recv.hdr; |