aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2005-06-10 16:49:24 +0000
committerBrooks Davis <brooks@FreeBSD.org>2005-06-10 16:49:24 +0000
commitfc74a9f93a5fbc83262aa12084404ac953c854b5 (patch)
treef65b6d7834b40dfcd48534829a0a1e9529ab87ee /sys/dev/usb
parent7f1d8b7517a6a93379974243551e0ec0a96cb54e (diff)
Notes
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/if_aue.c30
-rw-r--r--sys/dev/usb/if_auereg.h2
-rw-r--r--sys/dev/usb/if_axe.c28
-rw-r--r--sys/dev/usb/if_axereg.h2
-rw-r--r--sys/dev/usb/if_cdce.c10
-rw-r--r--sys/dev/usb/if_cdcereg.h4
-rw-r--r--sys/dev/usb/if_cue.c28
-rw-r--r--sys/dev/usb/if_cuereg.h2
-rw-r--r--sys/dev/usb/if_kue.c27
-rw-r--r--sys/dev/usb/if_kuereg.h2
-rw-r--r--sys/dev/usb/if_rue.c34
-rw-r--r--sys/dev/usb/if_ruereg.h2
-rw-r--r--sys/dev/usb/if_udav.c19
-rw-r--r--sys/dev/usb/if_udavreg.h6
-rw-r--r--sys/dev/usb/if_ural.c5
-rw-r--r--sys/dev/usb/if_uralvar.h2
16 files changed, 120 insertions, 83 deletions
diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c
index 501d94fa22dd..3118baa06add 100644
--- a/sys/dev/usb/if_aue.c
+++ b/sys/dev/usb/if_aue.c
@@ -76,6 +76,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>
@@ -524,7 +525,7 @@ aue_setmulti(struct aue_softc *sc)
struct ifmultiaddr *ifma;
u_int32_t h = 0, i;
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->aue_ifp;
if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) {
AUE_SETBIT(sc, AUE_CTL0, AUE_CTL0_ALLMULTI);
@@ -709,9 +710,11 @@ USB_ATTACH(aue)
*/
aue_read_eeprom(sc, (caddr_t)&eaddr, 0, 3, 0);
- bcopy(eaddr, (char *)&sc->arpcom.ac_enaddr, ETHER_ADDR_LEN);
-
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->aue_ifp = if_alloc(IFT_ETHER);
+ if (ifp == NULL) {
+ printf("aue%d: can not if_alloc()\n", sc->aue_unit);
+ USB_ATTACH_ERROR_RETURN;
+ }
ifp->if_softc = sc;
if_initname(ifp, "aue", sc->aue_unit);
ifp->if_mtu = ETHERMTU;
@@ -774,7 +777,7 @@ aue_detach(device_ptr_t dev)
sc = device_get_softc(dev);
AUE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->aue_ifp;
sc->aue_dying = 1;
untimeout(aue_tick, sc, sc->aue_stat_ch);
@@ -782,6 +785,7 @@ aue_detach(device_ptr_t dev)
ether_ifdetach(ifp);
#else
ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
+ if_free(ifp);
#endif
if (sc->aue_ep[AUE_ENDPT_TX] != NULL)
@@ -810,7 +814,7 @@ aue_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
struct aue_intrpkt *p;
AUE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->aue_ifp;
if (!(ifp->if_flags & IFF_RUNNING)) {
AUE_UNLOCK(sc);
@@ -889,7 +893,7 @@ aue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
if (sc->aue_dying)
return;
AUE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->aue_ifp;
if (!(ifp->if_flags & IFF_RUNNING)) {
AUE_UNLOCK(sc);
@@ -931,7 +935,7 @@ aue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
total_len -= (4 + ETHER_CRC_LEN);
ifp->if_ipackets++;
- m->m_pkthdr.rcvif = (struct ifnet *)&sc->aue_qdat;
+ m->m_pkthdr.rcvif = (void *)&sc->aue_qdat;
m->m_pkthdr.len = m->m_len = total_len;
/* Put the packet on the special USB input queue. */
@@ -964,7 +968,7 @@ aue_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
usbd_status err;
AUE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->aue_ifp;
if (status != USBD_NORMAL_COMPLETION) {
if (status == USBD_NOT_STARTED || status == USBD_CANCELLED) {
@@ -1011,7 +1015,7 @@ aue_tick(void *xsc)
AUE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->aue_ifp;
mii = GET_MII(sc);
if (mii == NULL) {
AUE_UNLOCK(sc);
@@ -1128,7 +1132,7 @@ Static void
aue_init(void *xsc)
{
struct aue_softc *sc = xsc;
- struct ifnet *ifp = &sc->arpcom.ac_if;
+ struct ifnet *ifp = sc->aue_ifp;
struct mii_data *mii = GET_MII(sc);
struct ue_chain *c;
usbd_status err;
@@ -1148,7 +1152,7 @@ aue_init(void *xsc)
/* Set MAC address */
for (i = 0; i < ETHER_ADDR_LEN; i++)
- aue_csr_write_1(sc, AUE_PAR0 + i, sc->arpcom.ac_enaddr[i]);
+ aue_csr_write_1(sc, AUE_PAR0 + i, IFP2ENADDR(sc->aue_ifp)[i]);
/* If we want promiscuous mode, set the allframes bit. */
if (ifp->if_flags & IFF_PROMISC)
@@ -1355,7 +1359,7 @@ aue_stop(struct aue_softc *sc)
struct ifnet *ifp;
AUE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->aue_ifp;
ifp->if_timer = 0;
aue_csr_write_1(sc, AUE_CTL0, 0);
diff --git a/sys/dev/usb/if_auereg.h b/sys/dev/usb/if_auereg.h
index b9e4dd731e79..d161acdc6a17 100644
--- a/sys/dev/usb/if_auereg.h
+++ b/sys/dev/usb/if_auereg.h
@@ -206,7 +206,7 @@ struct aue_softc {
#elif defined(__OpenBSD__)
#define GET_MII(sc) (&(sc)->aue_mii)
#endif
- struct arpcom arpcom;
+ struct ifnet *aue_ifp;
device_t aue_dev;
device_t aue_miibus;
usbd_device_handle aue_udev;
diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c
index f4bb89f0a1cf..95516491ea85 100644
--- a/sys/dev/usb/if_axe.c
+++ b/sys/dev/usb/if_axe.c
@@ -81,6 +81,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>
@@ -324,7 +325,7 @@ axe_setmulti(struct axe_softc *sc)
u_int16_t rxmode;
u_int8_t hashtbl[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->axe_ifp;
AXE_LOCK(sc);
axe_cmd(sc, AXE_CMD_RXCTL_READ, 0, 0, (void *)&rxmode);
@@ -479,9 +480,11 @@ USB_ATTACH(axe)
*/
sc->axe_phyaddrs[0] = sc->axe_phyaddrs[1] = 0xFF;
- bcopy(eaddr, (char *)&sc->arpcom.ac_enaddr, ETHER_ADDR_LEN);
-
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->axe_ifp = if_alloc(IFT_ETHER);
+ if (ifp == NULL) {
+ printf("axe%d: can not if_alloc()\n", sc->axe_unit);
+ USB_ATTACH_ERROR_RETURN;
+ }
ifp->if_softc = sc;
if_initname(ifp, "axe", sc->axe_unit);
ifp->if_mtu = ETHERMTU;
@@ -534,7 +537,7 @@ axe_detach(device_ptr_t dev)
sc = device_get_softc(dev);
AXE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->axe_ifp;
sc->axe_dying = 1;
untimeout(axe_tick, sc, sc->axe_stat_ch);
@@ -542,6 +545,7 @@ axe_detach(device_ptr_t dev)
ether_ifdetach(ifp);
#else
ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
+ if_free(ifp);
#endif
if (sc->axe_ep[AXE_ENDPT_TX] != NULL)
@@ -604,7 +608,7 @@ axe_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
c = priv;
sc = c->ue_sc;
AXE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->axe_ifp;
if (!(ifp->if_flags & IFF_RUNNING)) {
AXE_UNLOCK(sc);
@@ -634,7 +638,7 @@ axe_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
}
ifp->if_ipackets++;
- m->m_pkthdr.rcvif = (struct ifnet *)&sc->axe_qdat;
+ m->m_pkthdr.rcvif = (void *)&sc->axe_qdat;
m->m_pkthdr.len = m->m_len = total_len;
/* Put the packet on the special USB input queue. */
@@ -669,7 +673,7 @@ axe_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
c = priv;
sc = c->ue_sc;
AXE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->axe_ifp;
if (status != USBD_NORMAL_COMPLETION) {
if (status == USBD_NOT_STARTED || status == USBD_CANCELLED) {
@@ -718,7 +722,7 @@ axe_tick(void *xsc)
AXE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->axe_ifp;
mii = GET_MII(sc);
if (mii == NULL) {
AXE_UNLOCK(sc);
@@ -824,7 +828,7 @@ Static void
axe_init(void *xsc)
{
struct axe_softc *sc = xsc;
- struct ifnet *ifp = &sc->arpcom.ac_if;
+ struct ifnet *ifp = sc->axe_ifp;
struct ue_chain *c;
usbd_status err;
int i;
@@ -843,7 +847,7 @@ axe_init(void *xsc)
#ifdef notdef
/* Set MAC address */
- axe_mac(sc, sc->arpcom.ac_enaddr, 1);
+ axe_mac(sc, IFP2ENADDR(sc->axe_ifp), 1);
#endif
/* Enable RX logic. */
@@ -1023,7 +1027,7 @@ axe_stop(struct axe_softc *sc)
AXE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->axe_ifp;
ifp->if_timer = 0;
untimeout(axe_tick, sc, sc->axe_stat_ch);
diff --git a/sys/dev/usb/if_axereg.h b/sys/dev/usb/if_axereg.h
index d825d79533dd..c89ac275dcd1 100644
--- a/sys/dev/usb/if_axereg.h
+++ b/sys/dev/usb/if_axereg.h
@@ -127,7 +127,7 @@ struct axe_softc {
#elif defined(__OpenBSD__)
#define GET_MII(sc) (&(sc)->axe_mii)
#endif
- struct arpcom arpcom;
+ struct ifnet *axe_ifp;
device_t axe_miibus;
device_t axe_dev;
usbd_device_handle axe_udev;
diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c
index af2d1da57618..fabbbbeabdc2 100644
--- a/sys/dev/usb/if_cdce.c
+++ b/sys/dev/usb/if_cdce.c
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
#include <net/if.h>
#include <net/if_arp.h>
#include <net/ethernet.h>
+#include <net/if_types.h>
#include <net/bpf.h>
@@ -282,9 +283,11 @@ USB_ATTACH(cdce)
}
}
- bcopy(eaddr, (char *)&sc->arpcom.ac_enaddr, ETHER_ADDR_LEN);
-
- ifp = GET_IFP(sc);
+ ifp = GET_IFP(sc) = if_alloc(IFT_ETHER);
+ if (ifp == NULL) {
+ printf("%s: can not if_alloc()\n", USBDEVNAME(sc->cdce_dev));
+ USB_ATTACH_ERROR_RETURN;
+ }
ifp->if_softc = sc;
if_initname(ifp, "cdce", sc->cdce_unit);
ifp->if_mtu = ETHERMTU;
@@ -323,6 +326,7 @@ USB_DETACH(cdce)
cdce_shutdown(sc->cdce_dev);
ether_ifdetach(ifp);
+ if_free(ifp);
CDCE_UNLOCK(sc);
mtx_destroy(&sc->cdce_mtx);
diff --git a/sys/dev/usb/if_cdcereg.h b/sys/dev/usb/if_cdcereg.h
index 6ac8c21a3cdd..73433154d645 100644
--- a/sys/dev/usb/if_cdcereg.h
+++ b/sys/dev/usb/if_cdcereg.h
@@ -43,8 +43,8 @@ struct cdce_type {
};
struct cdce_softc {
- struct arpcom arpcom;
-#define GET_IFP(sc) (&(sc)->arpcom.ac_if)
+ struct ifnet *cdce_ifp;
+#define GET_IFP(sc) ((sc)->cdce_ifp)
usbd_device_handle cdce_udev;
usbd_interface_handle cdce_data_iface;
diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c
index b0ef7e695c1e..604f9c5b4c18 100644
--- a/sys/dev/usb/if_cue.c
+++ b/sys/dev/usb/if_cue.c
@@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
#include <net/if_arp.h>
#include <net/ethernet.h>
#include <net/if_dl.h>
+#include <net/if_types.h>
#include <net/bpf.h>
@@ -340,7 +341,7 @@ cue_setmulti(struct cue_softc *sc)
struct ifmultiaddr *ifma;
u_int32_t h = 0, i;
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->cue_ifp;
if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) {
for (i = 0; i < CUE_MCAST_TABLE_LEN; i++)
@@ -499,9 +500,11 @@ USB_ATTACH(cue)
*/
cue_getmac(sc, &eaddr);
- bcopy(eaddr, (char *)&sc->arpcom.ac_enaddr, ETHER_ADDR_LEN);
-
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->cue_ifp = if_alloc(IFT_ETHER);
+ if (ifp == NULL) {
+ printf("cue%d: can not if_alloc()\n", sc->cue_unit);
+ USB_ATTACH_ERROR_RETURN;
+ }
ifp->if_softc = sc;
if_initname(ifp, "cue", sc->cue_unit);
ifp->if_mtu = ETHERMTU;
@@ -541,7 +544,7 @@ cue_detach(device_ptr_t dev)
sc = device_get_softc(dev);
CUE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->cue_ifp;
sc->cue_dying = 1;
untimeout(cue_tick, sc, sc->cue_stat_ch);
@@ -549,6 +552,7 @@ cue_detach(device_ptr_t dev)
ether_ifdetach(ifp);
#else
ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
+ if_free(ifp);
#endif
if (sc->cue_ep[CUE_ENDPT_TX] != NULL)
@@ -612,7 +616,7 @@ cue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
c = priv;
sc = c->ue_sc;
CUE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->cue_ifp;
if (!(ifp->if_flags & IFF_RUNNING)) {
CUE_UNLOCK(sc);
@@ -647,7 +651,7 @@ cue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
ifp->if_ipackets++;
m_adj(m, sizeof(u_int16_t));
- m->m_pkthdr.rcvif = (struct ifnet *)&sc->cue_qdat;
+ m->m_pkthdr.rcvif = (void *)&sc->cue_qdat;
m->m_pkthdr.len = m->m_len = total_len;
/* Put the packet on the special USB input queue. */
@@ -682,7 +686,7 @@ cue_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
c = priv;
sc = c->ue_sc;
CUE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->cue_ifp;
if (status != USBD_NORMAL_COMPLETION) {
if (status == USBD_NOT_STARTED || status == USBD_CANCELLED) {
@@ -730,7 +734,7 @@ cue_tick(void *xsc)
CUE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->cue_ifp;
ifp->if_collisions += cue_csr_read_2(sc, CUE_TX_SINGLECOLL);
ifp->if_collisions += cue_csr_read_2(sc, CUE_TX_MULTICOLL);
@@ -831,7 +835,7 @@ Static void
cue_init(void *xsc)
{
struct cue_softc *sc = xsc;
- struct ifnet *ifp = &sc->arpcom.ac_if;
+ struct ifnet *ifp = sc->cue_ifp;
struct ue_chain *c;
usbd_status err;
int i;
@@ -850,7 +854,7 @@ cue_init(void *xsc)
/* Set MAC address */
for (i = 0; i < ETHER_ADDR_LEN; i++)
- cue_csr_write_1(sc, CUE_PAR0 - i, sc->arpcom.ac_enaddr[i]);
+ cue_csr_write_1(sc, CUE_PAR0 - i, IFP2ENADDR(sc->cue_ifp)[i]);
/* Enable RX logic. */
cue_csr_write_1(sc, CUE_ETHCTL, CUE_ETHCTL_RX_ON|CUE_ETHCTL_MCAST_ON);
@@ -1013,7 +1017,7 @@ cue_stop(struct cue_softc *sc)
CUE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->cue_ifp;
ifp->if_timer = 0;
cue_csr_write_1(sc, CUE_ETHCTL, 0);
diff --git a/sys/dev/usb/if_cuereg.h b/sys/dev/usb/if_cuereg.h
index a3a861df51bc..f20aeed586c9 100644
--- a/sys/dev/usb/if_cuereg.h
+++ b/sys/dev/usb/if_cuereg.h
@@ -142,7 +142,7 @@ struct cue_type {
#define CUE_INC(x, y) (x) = (x + 1) % y
struct cue_softc {
- struct arpcom arpcom;
+ struct ifnet *cue_ifp;
device_t cue_dev;
usbd_device_handle cue_udev;
usbd_interface_handle cue_iface;
diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c
index 7401eb1c8a86..b4c65e47d6a6 100644
--- a/sys/dev/usb/if_kue.c
+++ b/sys/dev/usb/if_kue.c
@@ -79,6 +79,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>
@@ -315,7 +316,7 @@ kue_setmulti(struct kue_softc *sc)
struct ifmultiaddr *ifma;
int i = 0;
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->kue_ifp;
if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) {
sc->kue_rxfilt |= KUE_RXFILT_ALLMULTI;
@@ -472,10 +473,11 @@ USB_ATTACH(kue)
sc->kue_mcfilters = malloc(KUE_MCFILTCNT(sc) * ETHER_ADDR_LEN,
M_USBDEV, M_NOWAIT);
- bcopy(sc->kue_desc.kue_macaddr,
- (char *)&sc->arpcom.ac_enaddr, ETHER_ADDR_LEN);
-
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->kue_ifp = if_alloc(IFT_ETHER);
+ if (ifp == NULL) {
+ printf("kue%d: can not if_alloc()\n", sc->kue_unit);
+ USB_ATTACH_ERROR_RETURN;
+ }
ifp->if_softc = sc;
if_initname(ifp, "kue", sc->kue_unit);
ifp->if_mtu = ETHERMTU;
@@ -515,7 +517,7 @@ kue_detach(device_ptr_t dev)
sc = device_get_softc(dev);
KUE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->kue_ifp;
sc->kue_dying = 1;
@@ -524,6 +526,7 @@ kue_detach(device_ptr_t dev)
ether_ifdetach(ifp);
#else
ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
+ if_free(ifp);
#endif
if (sc->kue_ep[KUE_ENDPT_TX] != NULL)
@@ -591,7 +594,7 @@ Static void kue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv,
c = priv;
sc = c->ue_sc;
KUE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->kue_ifp;
if (!(ifp->if_flags & IFF_RUNNING)) {
KUE_UNLOCK(sc);
@@ -628,7 +631,7 @@ Static void kue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv,
}
ifp->if_ipackets++;
- m->m_pkthdr.rcvif = (struct ifnet *)&sc->kue_qdat;
+ m->m_pkthdr.rcvif = (void *)&sc->kue_qdat;
m->m_pkthdr.len = m->m_len = total_len;
/* Put the packet on the special USB input queue. */
@@ -665,7 +668,7 @@ kue_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
sc = c->ue_sc;
KUE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->kue_ifp;
ifp->if_timer = 0;
ifp->if_flags &= ~IFF_OACTIVE;
@@ -786,7 +789,7 @@ Static void
kue_init(void *xsc)
{
struct kue_softc *sc = xsc;
- struct ifnet *ifp = &sc->arpcom.ac_if;
+ struct ifnet *ifp = sc->kue_ifp;
struct ue_chain *c;
usbd_status err;
int i;
@@ -800,7 +803,7 @@ kue_init(void *xsc)
/* Set MAC address */
kue_ctl(sc, KUE_CTL_WRITE, KUE_CMD_SET_MAC,
- 0, sc->arpcom.ac_enaddr, ETHER_ADDR_LEN);
+ 0, IFP2ENADDR(sc->kue_ifp), ETHER_ADDR_LEN);
sc->kue_rxfilt = KUE_RXFILT_UNICAST|KUE_RXFILT_BROADCAST;
@@ -956,7 +959,7 @@ kue_stop(struct kue_softc *sc)
struct ifnet *ifp;
KUE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->kue_ifp;
ifp->if_timer = 0;
/* Stop transfers. */
diff --git a/sys/dev/usb/if_kuereg.h b/sys/dev/usb/if_kuereg.h
index 298526d3e7c7..904ef12112b4 100644
--- a/sys/dev/usb/if_kuereg.h
+++ b/sys/dev/usb/if_kuereg.h
@@ -135,7 +135,7 @@ struct kue_type {
#define KUE_INC(x, y) (x) = (x + 1) % y
struct kue_softc {
- struct arpcom arpcom;
+ struct ifnet *kue_ifp;
device_t kue_dev;
usbd_device_handle kue_udev;
usbd_interface_handle kue_iface;
diff --git a/sys/dev/usb/if_rue.c b/sys/dev/usb/if_rue.c
index d5d3a89f56f7..9990da1ccbae 100644
--- a/sys/dev/usb/if_rue.c
+++ b/sys/dev/usb/if_rue.c
@@ -79,6 +79,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>
@@ -481,7 +482,7 @@ rue_setmulti(struct rue_softc *sc)
u_int32_t rxcfg;
int mcnt = 0;
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->rue_ifp;
rxcfg = rue_csr_read_2(sc, RUE_RCR);
@@ -664,9 +665,11 @@ USB_ATTACH(rue)
goto error1;
}
- bcopy(eaddr, (char *)&sc->arpcom.ac_enaddr, ETHER_ADDR_LEN);
-
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->rue_ifp = if_alloc(IFT_ETHER);
+ if (ifp == NULL) {
+ printf("rue%d: can not if_alloc()\n", sc->rue_unit);
+ goto error1;
+ }
ifp->if_softc = sc;
if_initname(ifp, "rue", sc->rue_unit);
ifp->if_mtu = ETHERMTU;
@@ -683,7 +686,7 @@ USB_ATTACH(rue)
if (mii_phy_probe(self, &sc->rue_miibus,
rue_ifmedia_upd, rue_ifmedia_sts)) {
printf("rue%d: MII without any PHY!\n", sc->rue_unit);
- goto error1;
+ goto error2;
}
sc->rue_qdat.ifp = ifp;
@@ -703,6 +706,8 @@ USB_ATTACH(rue)
free(devinfo, M_USBDEV);
USB_ATTACH_SUCCESS_RETURN;
+ error2:
+ if_free(ifp);
error1:
RUE_UNLOCK(sc);
#if __FreeBSD_version >= 500000
@@ -721,7 +726,7 @@ rue_detach(device_ptr_t dev)
sc = device_get_softc(dev);
RUE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->rue_ifp;
sc->rue_dying = 1;
untimeout(rue_tick, sc, sc->rue_stat_ch);
@@ -757,7 +762,7 @@ rue_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
struct rue_intrpkt *p;
RUE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->rue_ifp;
if (!(ifp->if_flags & IFF_RUNNING)) {
RUE_UNLOCK(sc);
@@ -833,7 +838,7 @@ rue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
if (sc->rue_dying)
return;
RUE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->rue_ifp;
if (!(ifp->if_flags & IFF_RUNNING)) {
RUE_UNLOCK(sc);
@@ -873,7 +878,7 @@ rue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
total_len -= ETHER_CRC_LEN;
ifp->if_ipackets++;
- m->m_pkthdr.rcvif = (struct ifnet *)&sc->rue_qdat;
+ m->m_pkthdr.rcvif = (void *)&sc->rue_qdat;
m->m_pkthdr.len = m->m_len = total_len;
/* Put the packet on the special USB input queue. */
@@ -906,7 +911,7 @@ rue_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
RUE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->rue_ifp;
if (status != USBD_NORMAL_COMPLETION) {
if (status == USBD_NOT_STARTED || status == USBD_CANCELLED) {
@@ -951,7 +956,7 @@ rue_tick(void *xsc)
RUE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->rue_ifp;
mii = GET_MII(sc);
if (mii == NULL) {
RUE_UNLOCK(sc);
@@ -1063,7 +1068,7 @@ Static void
rue_init(void *xsc)
{
struct rue_softc *sc = xsc;
- struct ifnet *ifp = &sc->arpcom.ac_if;
+ struct ifnet *ifp = sc->rue_ifp;
struct mii_data *mii = GET_MII(sc);
struct ue_chain *c;
usbd_status err;
@@ -1083,7 +1088,8 @@ rue_init(void *xsc)
rue_reset(sc);
/* Set MAC address */
- rue_write_mem(sc, RUE_IDR0, sc->arpcom.ac_enaddr, ETHER_ADDR_LEN);
+ rue_write_mem(sc, RUE_IDR0, IFP2ENADDR(sc->rue_ifp),
+ ETHER_ADDR_LEN);
/* Init TX ring. */
if (usb_ether_tx_list_init(sc, &sc->rue_cdata,
@@ -1308,7 +1314,7 @@ rue_stop(struct rue_softc *sc)
RUE_LOCK(sc);
- ifp = &sc->arpcom.ac_if;
+ ifp = sc->rue_ifp;
ifp->if_timer = 0;
rue_csr_write_1(sc, RUE_CR, 0x00);
diff --git a/sys/dev/usb/if_ruereg.h b/sys/dev/usb/if_ruereg.h
index 206cc7e1e44e..5a1b5f7754b8 100644
--- a/sys/dev/usb/if_ruereg.h
+++ b/sys/dev/usb/if_ruereg.h
@@ -187,7 +187,7 @@ struct rue_type {
};
struct rue_softc {
- struct arpcom arpcom;
+ struct ifnet *rue_ifp;
device_t rue_dev;
device_t rue_miibus;
usbd_device_handle rue_udev;
diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c
index 8d744eea7c6b..daa426d81769 100644
--- a/sys/dev/usb/if_udav.c
+++ b/sys/dev/usb/if_udav.c
@@ -87,6 +87,7 @@ __FBSDID("$FreeBSD$");
#include <net/if_dl.h>
#include <net/if_media.h>
#include <net/ethernet.h>
+#include <net/if_types.h>
#if NBPFILTER > 0
#include <net/bpf.h>
@@ -384,12 +385,17 @@ USB_ATTACH(udav)
/* Print Ethernet Address */
printf("%s: Ethernet address %s\n", devname, ether_sprintf(eaddr));
-#if defined(__FreeBSD__)
- bcopy(eaddr, (char *)&sc->sc_ac.ac_enaddr, ETHER_ADDR_LEN);
-#endif
-
/* initialize interface infomation */
+#if defined(__FreeBSD__)
+ ifp = GET_IFP(sc) = if_alloc(IFT_ETHER);
+ if (ifp == NULL) {
+ printf("%s: can not if_alloc\n", devname);
+ UDAV_UNLOCK(sc);
+ goto bad;
+ }
+#else
ifp = GET_IFP(sc);
+#endif
ifp->if_softc = sc;
ifp->if_mtu = ETHERMTU;
#if defined(__NetBSD__)
@@ -527,6 +533,9 @@ USB_DETACH(udav)
#if defined(__NetBSD__)
if_detach(ifp);
#endif
+#if defined(__FreeBSD__)
+ if_free(ifp);
+#endif
#ifdef DIAGNOSTIC
if (sc->sc_pipe_tx != NULL)
@@ -836,7 +845,7 @@ udav_init(void *xsc)
#if defined(__NetBSD__)
eaddr = LLADDR(ifp->if_sadl);
#elif defined(__FreeBSD__)
- eaddr = sc->sc_ac.ac_enaddr ;
+ eaddr = IFP2ENADDR(ifp);
#endif
udav_csr_write(sc, UDAV_PAR, eaddr, ETHER_ADDR_LEN);
diff --git a/sys/dev/usb/if_udavreg.h b/sys/dev/usb/if_udavreg.h
index 404c9cb26961..5982857bfc75 100644
--- a/sys/dev/usb/if_udavreg.h
+++ b/sys/dev/usb/if_udavreg.h
@@ -137,7 +137,9 @@
#define UDAV_GPR_GEPIO1 (1<<1) /* General purpose 1 */
#define UDAV_GPR_GEPIO0 (1<<0) /* General purpose 0 */
-#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__)
+#define GET_IFP(sc) ((sc)->sc_ifp)
+#elif defined(__OpenBSD__)
#define GET_IFP(sc) (&(sc)->sc_ac.ac_if)
#elif defined(__NetBSD__)
#define GET_IFP(sc) (&(sc)->sc_ec.ec_if)
@@ -160,7 +162,7 @@
struct udav_softc {
#if defined(__FreeBSD__)
- struct arpcom sc_ac ; /* struct ifnet must be top of softc */
+ struct ifnet *sc_ifp;
#endif
USBBASEDEVICE sc_dev; /* base device */
usbd_device_handle sc_udev;
diff --git a/sys/dev/usb/if_ural.c b/sys/dev/usb/if_ural.c
index bf220cd38a94..ea8f6bad1cbe 100644
--- a/sys/dev/usb/if_ural.c
+++ b/sys/dev/usb/if_ural.c
@@ -345,7 +345,7 @@ USB_MATCH(ural)
USB_ATTACH(ural)
{
USB_ATTACH_START(ural, sc, uaa);
- struct ifnet *ifp = &sc->sc_arp.ac_if;
+ struct ifnet *ifp;
struct ieee80211com *ic = &sc->sc_ic;
usb_interface_descriptor_t *id;
usb_endpoint_descriptor_t *ed;
@@ -408,7 +408,8 @@ USB_ATTACH(ural)
printf("%s: MAC/BBP RT2570 (rev 0x%02x), RF %s\n",
USBDEVNAME(sc->sc_dev), sc->asic_rev, ural_get_rf(sc->rf_rev));
-
+
+ ifp = sc->sc_ifp = if_alloc(IFT_ETHER);
ifp->if_softc = sc;
if_initname(ifp, "ural", USBDEVUNIT(sc->sc_dev));
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST |
diff --git a/sys/dev/usb/if_uralvar.h b/sys/dev/usb/if_uralvar.h
index 225a43ad148b..634c3db0c66e 100644
--- a/sys/dev/usb/if_uralvar.h
+++ b/sys/dev/usb/if_uralvar.h
@@ -68,7 +68,7 @@ struct ural_rx_data {
};
struct ural_softc {
- struct arpcom sc_arp;
+ struct ifnet *sc_ifp;
struct ieee80211com sc_ic;
int (*sc_newstate)(struct ieee80211com *,
enum ieee80211_state, int);