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/xe/if_xe.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/xe/if_xe.c')
-rw-r--r-- | sys/dev/xe/if_xe.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/dev/xe/if_xe.c b/sys/dev/xe/if_xe.c index a1db102..38ec6de 100644 --- a/sys/dev/xe/if_xe.c +++ b/sys/dev/xe/if_xe.c @@ -117,6 +117,7 @@ __FBSDID("$FreeBSD$"); #include <net/if_media.h> #include <net/if_mib.h> #include <net/bpf.h> +#include <net/if_types.h> #include <dev/xe/if_xereg.h> #include <dev/xe/if_xevar.h> @@ -225,7 +226,9 @@ xe_attach (device_t dev) /* Initialise stuff... */ scp->dev = dev; - scp->ifp = &scp->arpcom.ac_if; + scp->ifp = scp->ifp = if_alloc(IFT_ETHER); + if (scp->ifp == NULL) + return ENOSPC; scp->ifm = &scp->ifmedia; scp->autoneg_status = XE_AUTONEG_NONE; @@ -294,7 +297,7 @@ xe_attach (device_t dev) } /* Attach the interface */ - ether_ifattach(scp->ifp, scp->arpcom.ac_enaddr); + ether_ifattach(scp->ifp, scp->enaddr); /* Done */ return 0; @@ -374,7 +377,7 @@ xe_init(void *xscp) { /* Put MAC address in first 'individual address' register */ XE_SELECT_PAGE(0x50); for (i = 0; i < 6; i++) - XE_OUTB(0x08 + i, scp->arpcom.ac_enaddr[scp->mohawk ? 5 - i : i]); + XE_OUTB(0x08 + i, IFP2ENADDR(scp->ifp)[scp->mohawk ? 5 - i : i]); /* Set up multicast addresses */ xe_set_multicast(scp); @@ -564,7 +567,7 @@ xe_intr(void *xscp) struct ifnet *ifp; u_int8_t psr, isr, esr, rsr, rst0, txst0, txst1, coll; - ifp = &scp->arpcom.ac_if; + ifp = scp->ifp; /* Disable interrupts */ if (scp->mohawk) @@ -936,7 +939,7 @@ static void xe_setmedia(void *xscp) { case XE_AUTONEG_NONE: DEVPRINTF(2, (scp->dev, "Waiting for idle transmitter\n")); - scp->arpcom.ac_if.if_flags |= IFF_OACTIVE; + scp->ifp->if_flags |= IFF_OACTIVE; scp->autoneg_status = XE_AUTONEG_WAITING; /* FALL THROUGH */ @@ -1254,7 +1257,7 @@ xe_set_multicast(struct xe_softc *scp) { DEVPRINTF(2, (scp->dev, "set_multicast\n")); - ifp = &scp->arpcom.ac_if; + ifp = scp->ifp; XE_SELECT_PAGE(0x42); /* Handle PROMISC flag */ @@ -1312,7 +1315,7 @@ xe_set_multicast(struct xe_softc *scp) { else if (count < 10) { /* Full in any unused Individual Addresses with our MAC address */ for (i = count + 1; i < 10; i++) - xe_set_addr(scp, (u_int8_t *)(&scp->arpcom.ac_enaddr), i); + xe_set_addr(scp, (u_int8_t *)(&IFP2ENADDR(scp->ifp)), i); /* Enable Individual Address matching only */ XE_SELECT_PAGE(0x42); XE_OUTB(XE_SWC1, (XE_INB(XE_SWC1) & ~XE_SWC1_ALLMULTI) | XE_SWC1_IA_ENABLE); |