Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152785011
D37813.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
27 KB
Referenced Files
None
Subscribers
None
D37813.diff
View Options
diff --git a/sys/dev/etherswitch/ar40xx/ar40xx_main.c b/sys/dev/etherswitch/ar40xx/ar40xx_main.c
--- a/sys/dev/etherswitch/ar40xx/ar40xx_main.c
+++ b/sys/dev/etherswitch/ar40xx/ar40xx_main.c
@@ -627,7 +627,7 @@
struct ar40xx_softc *sc = device_get_softc(dev);
struct ifmedia *ifm;
struct mii_data *mii;
- struct ifnet *ifp;
+ if_t ifp;
int ret;
if (p->es_port < 0 || p->es_port > sc->sc_info.es_nports)
diff --git a/sys/dev/etherswitch/ar40xx/ar40xx_phy.h b/sys/dev/etherswitch/ar40xx/ar40xx_phy.h
--- a/sys/dev/etherswitch/ar40xx/ar40xx_phy.h
+++ b/sys/dev/etherswitch/ar40xx/ar40xx_phy.h
@@ -32,7 +32,7 @@
extern int ar40xx_hw_phy_get_ids(struct ar40xx_softc *sc);
extern struct mii_data * ar40xx_phy_miiforport(struct ar40xx_softc *sc,
int port);
-extern struct ifnet * ar40xx_phy_ifpforport(struct ar40xx_softc *sc,
+extern if_t ar40xx_phy_ifpforport(struct ar40xx_softc *sc,
int port);
#endif /* __AR40XX_PHY_H__ */
diff --git a/sys/dev/etherswitch/ar40xx/ar40xx_phy.c b/sys/dev/etherswitch/ar40xx/ar40xx_phy.c
--- a/sys/dev/etherswitch/ar40xx/ar40xx_phy.c
+++ b/sys/dev/etherswitch/ar40xx/ar40xx_phy.c
@@ -147,7 +147,7 @@
return (device_get_softc(sc->sc_phys.miibus[phy]));
}
-struct ifnet *
+if_t
ar40xx_phy_ifpforport(struct ar40xx_softc *sc, int port)
{
int phy;
@@ -159,13 +159,13 @@
}
static int
-ar40xx_ifmedia_upd(struct ifnet *ifp)
+ar40xx_ifmedia_upd(if_t ifp)
{
- struct ar40xx_softc *sc = ifp->if_softc;
- struct mii_data *mii = ar40xx_phy_miiforport(sc, ifp->if_dunit);
+ struct ar40xx_softc *sc = if_getsoftc(ifp);
+ struct mii_data *mii = ar40xx_phy_miiforport(sc, ifp->if_dunit); /* XXX - DRVAPI */
AR40XX_DPRINTF(sc, AR40XX_DBG_PORT_STATUS, "%s: called, PHY %d\n",
- __func__, ifp->if_dunit);
+ __func__, ifp->if_dunit); /* XXX - DRVAPI */
if (mii == NULL)
return (ENXIO);
@@ -174,13 +174,13 @@
}
static void
-ar40xx_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
+ar40xx_ifmedia_sts(if_t ifp, struct ifmediareq *ifmr)
{
- struct ar40xx_softc *sc = ifp->if_softc;
- struct mii_data *mii = ar40xx_phy_miiforport(sc, ifp->if_dunit);
+ struct ar40xx_softc *sc = if_getsoftc(ifp);
+ struct mii_data *mii = ar40xx_phy_miiforport(sc, ifp->if_dunit); /* XXX - DRVAPI */
AR40XX_DPRINTF(sc, AR40XX_DBG_PORT_STATUS, "%s: called, PHY %d\n",
- __func__, ifp->if_dunit);
+ __func__, ifp->if_dunit); /* XXX - DRVAPI */
if (mii == NULL)
return;
diff --git a/sys/dev/etherswitch/ar40xx/ar40xx_var.h b/sys/dev/etherswitch/ar40xx/ar40xx_var.h
--- a/sys/dev/etherswitch/ar40xx/ar40xx_var.h
+++ b/sys/dev/etherswitch/ar40xx/ar40xx_var.h
@@ -120,7 +120,7 @@
struct {
char *ifname[AR40XX_NUM_PHYS];
device_t miibus[AR40XX_NUM_PHYS];
- struct ifnet *ifp[AR40XX_NUM_PHYS];
+ if_t ifp[AR40XX_NUM_PHYS];
} sc_phys;
/* ATU (address table unit) support */
diff --git a/sys/dev/etherswitch/arswitch/arswitch.c b/sys/dev/etherswitch/arswitch/arswitch.c
--- a/sys/dev/etherswitch/arswitch/arswitch.c
+++ b/sys/dev/etherswitch/arswitch/arswitch.c
@@ -85,8 +85,8 @@
static inline int arswitch_portforphy(int phy);
static void arswitch_tick(void *arg);
-static int arswitch_ifmedia_upd(struct ifnet *);
-static void arswitch_ifmedia_sts(struct ifnet *, struct ifmediareq *);
+static int arswitch_ifmedia_upd(if_t );
+static void arswitch_ifmedia_sts(if_t , struct ifmediareq *);
static int ar8xxx_port_vlan_setup(struct arswitch_softc *sc,
etherswitch_port_t *p);
static int ar8xxx_port_vlan_get(struct arswitch_softc *sc,
@@ -183,9 +183,9 @@
break;
}
- sc->ifp[phy]->if_softc = sc;
- sc->ifp[phy]->if_flags |= IFF_UP | IFF_BROADCAST |
- IFF_DRV_RUNNING | IFF_SIMPLEX;
+ if_setsoftc(sc->ifp[phy], sc);
+ if_setflagbits(sc->ifp[phy], IFF_UP | IFF_BROADCAST |
+ IFF_DRV_RUNNING | IFF_SIMPLEX, 0);
sc->ifname[phy] = malloc(strlen(name)+1, M_DEVBUF, M_WAITOK);
bcopy(name, sc->ifname[phy], strlen(name)+1);
if_initname(sc->ifp[phy], sc->ifname[phy],
@@ -748,7 +748,7 @@
return (device_get_softc(sc->miibus[phy]));
}
-static inline struct ifnet *
+static inline if_t
arswitch_ifpforport(struct arswitch_softc *sc, int port)
{
int phy = port-1;
@@ -1052,7 +1052,7 @@
struct arswitch_softc *sc;
struct ifmedia *ifm;
struct mii_data *mii;
- struct ifnet *ifp;
+ if_t ifp;
sc = device_get_softc(dev);
if (p->es_port < 0 || p->es_port > sc->info.es_nports)
@@ -1122,10 +1122,10 @@
}
static int
-arswitch_ifmedia_upd(struct ifnet *ifp)
+arswitch_ifmedia_upd(if_t ifp)
{
- struct arswitch_softc *sc = ifp->if_softc;
- struct mii_data *mii = arswitch_miiforport(sc, ifp->if_dunit);
+ struct arswitch_softc *sc = if_getsoftc(ifp);
+ struct mii_data *mii = arswitch_miiforport(sc, if_getdunit(ifp));
if (mii == NULL)
return (ENXIO);
@@ -1134,10 +1134,10 @@
}
static void
-arswitch_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
+arswitch_ifmedia_sts(if_t ifp, struct ifmediareq *ifmr)
{
- struct arswitch_softc *sc = ifp->if_softc;
- struct mii_data *mii = arswitch_miiforport(sc, ifp->if_dunit);
+ struct arswitch_softc *sc = if_getsoftc(ifp);
+ struct mii_data *mii = arswitch_miiforport(sc, if_getdunit(ifp));
DPRINTF(sc, ARSWITCH_DBG_POLL, "%s\n", __func__);
diff --git a/sys/dev/etherswitch/arswitch/arswitchvar.h b/sys/dev/etherswitch/arswitch/arswitchvar.h
--- a/sys/dev/etherswitch/arswitch/arswitchvar.h
+++ b/sys/dev/etherswitch/arswitch/arswitchvar.h
@@ -76,7 +76,7 @@
/* should be the max of both pre-AR8327 and AR8327 ports */
char *ifname[ARSWITCH_NUM_PHYS];
device_t miibus[ARSWITCH_NUM_PHYS];
- struct ifnet *ifp[ARSWITCH_NUM_PHYS];
+ if_t ifp[ARSWITCH_NUM_PHYS];
struct arswitch_dev_led dev_led[ARSWITCH_NUM_PHYS][ARSWITCH_NUM_LEDS];
struct callout callout_tick;
etherswitch_info_t info;
diff --git a/sys/dev/etherswitch/e6000sw/e6000sw.c b/sys/dev/etherswitch/e6000sw/e6000sw.c
--- a/sys/dev/etherswitch/e6000sw/e6000sw.c
+++ b/sys/dev/etherswitch/e6000sw/e6000sw.c
@@ -77,7 +77,7 @@
phandle_t node;
struct sx sx;
- struct ifnet *ifp[E6000SW_MAX_PORTS];
+ if_t ifp[E6000SW_MAX_PORTS];
char *ifname[E6000SW_MAX_PORTS];
device_t miibus[E6000SW_MAX_PORTS];
struct taskqueue *sc_tq;
@@ -136,8 +136,8 @@
static int e6000sw_vtu_update(e6000sw_softc_t *, int, int, int, int, int);
static __inline void e6000sw_writereg(e6000sw_softc_t *, int, int, int);
static __inline uint32_t e6000sw_readreg(e6000sw_softc_t *, int, int);
-static int e6000sw_ifmedia_upd(struct ifnet *);
-static void e6000sw_ifmedia_sts(struct ifnet *, struct ifmediareq *);
+static int e6000sw_ifmedia_upd(if_t );
+static void e6000sw_ifmedia_sts(if_t , struct ifmediareq *);
static int e6000sw_atu_mac_table(device_t, e6000sw_softc_t *, struct atu_opt *,
int);
static int e6000sw_get_pvid(e6000sw_softc_t *, int, int *);
@@ -368,9 +368,9 @@
sc->ifp[port] = if_alloc(IFT_ETHER);
if (sc->ifp[port] == NULL)
return (ENOMEM);
- sc->ifp[port]->if_softc = sc;
- sc->ifp[port]->if_flags |= IFF_UP | IFF_BROADCAST |
- IFF_DRV_RUNNING | IFF_SIMPLEX;
+ if_setsoftc(sc->ifp[port], sc);
+ if_setflagbits(sc->ifp[port], IFF_UP | IFF_BROADCAST |
+ IFF_DRV_RUNNING | IFF_SIMPLEX, 0);
sc->ifname[port] = malloc(strlen(name) + 1, M_E6000SW, M_NOWAIT);
if (sc->ifname[port] == NULL) {
if_free(sc->ifp[port]);
@@ -1280,13 +1280,13 @@
}
static int
-e6000sw_ifmedia_upd(struct ifnet *ifp)
+e6000sw_ifmedia_upd(if_t ifp)
{
e6000sw_softc_t *sc;
struct mii_data *mii;
- sc = ifp->if_softc;
- mii = e6000sw_miiforphy(sc, ifp->if_dunit);
+ sc = if_getsoftc(ifp);
+ mii = e6000sw_miiforphy(sc, if_getdunit(ifp));
if (mii == NULL)
return (ENXIO);
mii_mediachg(mii);
@@ -1295,13 +1295,13 @@
}
static void
-e6000sw_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
+e6000sw_ifmedia_sts(if_t ifp, struct ifmediareq *ifmr)
{
e6000sw_softc_t *sc;
struct mii_data *mii;
- sc = ifp->if_softc;
- mii = e6000sw_miiforphy(sc, ifp->if_dunit);
+ sc = if_getsoftc(ifp);
+ mii = e6000sw_miiforphy(sc, if_getdunit(ifp));
if (mii == NULL)
return;
diff --git a/sys/dev/etherswitch/e6000sw/e6060sw.c b/sys/dev/etherswitch/e6000sw/e6060sw.c
--- a/sys/dev/etherswitch/e6000sw/e6060sw.c
+++ b/sys/dev/etherswitch/e6000sw/e6060sw.c
@@ -120,7 +120,7 @@
int *portphy;
char **ifname;
device_t **miibus;
- struct ifnet **ifp;
+ if_t *ifp;
struct callout callout_tick;
etherswitch_info_t info;
int smi_offset;
@@ -150,8 +150,8 @@
static inline int e6060sw_portforphy(struct e6060sw_softc *, int);
static void e6060sw_tick(void *);
-static int e6060sw_ifmedia_upd(struct ifnet *);
-static void e6060sw_ifmedia_sts(struct ifnet *, struct ifmediareq *);
+static int e6060sw_ifmedia_upd(if_t );
+static void e6060sw_ifmedia_sts(if_t , struct ifmediareq *);
static void e6060sw_setup(device_t dev);
static int e6060sw_read_vtu(device_t dev, int num, int *data1, int *data2);
@@ -300,7 +300,7 @@
e6060sw_setup(dev);
- sc->ifp = malloc(sizeof(struct ifnet *) * sc->numports, M_E6060SW,
+ sc->ifp = malloc(sizeof(if_t ) * sc->numports, M_E6060SW,
M_WAITOK | M_ZERO);
sc->ifname = malloc(sizeof(char *) * sc->numports, M_E6060SW,
M_WAITOK | M_ZERO);
@@ -383,7 +383,7 @@
return (device_get_softc(*sc->miibus[port]));
}
-static inline struct ifnet *
+static inline if_t
e6060sw_ifpforport(struct e6060sw_softc *sc, int port)
{
@@ -516,7 +516,7 @@
struct e6060sw_softc *sc;
struct ifmedia *ifm;
struct mii_data *mii;
- struct ifnet *ifp;
+ if_t ifp;
int err;
int data;
@@ -883,13 +883,13 @@
}
static int
-e6060sw_ifmedia_upd(struct ifnet *ifp)
+e6060sw_ifmedia_upd(if_t ifp)
{
struct e6060sw_softc *sc;
struct mii_data *mii;
- sc = ifp->if_softc;
- mii = e6060sw_miiforport(sc, ifp->if_dunit);
+ sc = if_getsoftc(ifp);
+ mii = e6060sw_miiforport(sc, ifp->if_dunit); /* XXX - DRVAPI */
DPRINTF(sc->sc_dev, "%s\n", __func__);
if (mii == NULL)
@@ -899,13 +899,13 @@
}
static void
-e6060sw_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
+e6060sw_ifmedia_sts(if_t ifp, struct ifmediareq *ifmr)
{
struct e6060sw_softc *sc;
struct mii_data *mii;
- sc = ifp->if_softc;
- mii = e6060sw_miiforport(sc, ifp->if_dunit);
+ sc = if_getsoftc(ifp);
+ mii = e6060sw_miiforport(sc, ifp->if_dunit); /* XXX - DRVAPI */
DPRINTF(sc->sc_dev, "%s\n", __func__);
diff --git a/sys/dev/etherswitch/felix/felix.c b/sys/dev/etherswitch/felix/felix.c
--- a/sys/dev/etherswitch/felix/felix.c
+++ b/sys/dev/etherswitch/felix/felix.c
@@ -88,8 +88,8 @@
static void felix_setup_port(felix_softc_t, int);
static void felix_tick(void *);
-static int felix_ifmedia_upd(struct ifnet *);
-static void felix_ifmedia_sts(struct ifnet *, struct ifmediareq *);
+static int felix_ifmedia_upd(if_t );
+static void felix_ifmedia_sts(if_t , struct ifmediareq *);
static void felix_get_port_cfg(felix_softc_t, etherswitch_port_t *);
static void felix_set_port_cfg(felix_softc_t, etherswitch_port_t *);
@@ -246,9 +246,9 @@
if (sc->ports[port].ifp == NULL)
return (ENOMEM);
- sc->ports[port].ifp->if_softc = sc;
- sc->ports[port].ifp->if_flags = IFF_UP | IFF_BROADCAST | IFF_MULTICAST |
- IFF_DRV_RUNNING | IFF_SIMPLEX;
+ if_setsoftc(sc->ports[port].ifp, sc);
+ if_setflags(sc->ports[port].ifp, IFF_UP | IFF_BROADCAST | IFF_MULTICAST |
+ IFF_DRV_RUNNING | IFF_SIMPLEX);
sc->ports[port].ifname = malloc(strlen(name) + 1, M_FELIX, M_NOWAIT);
if (sc->ports[port].ifname == NULL) {
if_free(sc->ports[port].ifp);
@@ -964,13 +964,13 @@
}
static int
-felix_ifmedia_upd(struct ifnet *ifp)
+felix_ifmedia_upd(if_t ifp)
{
struct mii_data *mii;
felix_softc_t sc;
- sc = ifp->if_softc;
- mii = felix_miiforport(sc, ifp->if_dunit);
+ sc = if_getsoftc(ifp);
+ mii = felix_miiforport(sc, ifp->if_dunit); /* XXX - DRVAPI */
if (mii == NULL)
return (ENXIO);
@@ -979,13 +979,13 @@
}
static void
-felix_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
+felix_ifmedia_sts(if_t ifp, struct ifmediareq *ifmr)
{
felix_softc_t sc;
struct mii_data *mii;
- sc = ifp->if_softc;
- mii = felix_miiforport(sc, ifp->if_dunit);
+ sc = if_getsoftc(ifp);
+ mii = felix_miiforport(sc, ifp->if_dunit); /* XXX - DRVAPI */
if (mii == NULL)
return;
diff --git a/sys/dev/etherswitch/felix/felix_var.h b/sys/dev/etherswitch/felix/felix_var.h
--- a/sys/dev/etherswitch/felix/felix_var.h
+++ b/sys/dev/etherswitch/felix/felix_var.h
@@ -79,7 +79,7 @@
};
struct felix_port {
- struct ifnet *ifp;
+ if_t ifp;
device_t miibus;
char *ifname;
diff --git a/sys/dev/etherswitch/infineon/adm6996fc.c b/sys/dev/etherswitch/infineon/adm6996fc.c
--- a/sys/dev/etherswitch/infineon/adm6996fc.c
+++ b/sys/dev/etherswitch/infineon/adm6996fc.c
@@ -100,7 +100,7 @@
int *portphy;
char **ifname;
device_t **miibus;
- struct ifnet **ifp;
+ if_t *ifp;
struct callout callout_tick;
etherswitch_info_t info;
};
@@ -122,8 +122,8 @@
static inline int adm6996fc_portforphy(struct adm6996fc_softc *, int);
static void adm6996fc_tick(void *);
-static int adm6996fc_ifmedia_upd(struct ifnet *);
-static void adm6996fc_ifmedia_sts(struct ifnet *, struct ifmediareq *);
+static int adm6996fc_ifmedia_upd(if_t );
+static void adm6996fc_ifmedia_sts(if_t , struct ifmediareq *);
#define ADM6996FC_READREG(dev, x) \
MDIO_READREG(dev, ((x) >> 5), ((x) & 0x1f));
@@ -254,7 +254,7 @@
sc->info.es_nvlangroups = 16;
sc->info.es_vlan_caps = ETHERSWITCH_VLAN_PORT | ETHERSWITCH_VLAN_DOT1Q;
- sc->ifp = malloc(sizeof(struct ifnet *) * sc->numports, M_ADM6996FC,
+ sc->ifp = malloc(sizeof(if_t ) * sc->numports, M_ADM6996FC,
M_WAITOK | M_ZERO);
sc->ifname = malloc(sizeof(char *) * sc->numports, M_ADM6996FC,
M_WAITOK | M_ZERO);
@@ -355,7 +355,7 @@
return (device_get_softc(*sc->miibus[port]));
}
-static inline struct ifnet *
+static inline if_t
adm6996fc_ifpforport(struct adm6996fc_softc *sc, int port)
{
@@ -504,7 +504,7 @@
struct adm6996fc_softc *sc;
struct ifmedia *ifm;
struct mii_data *mii;
- struct ifnet *ifp;
+ if_t ifp;
device_t parent;
int err;
int data;
@@ -721,13 +721,13 @@
}
static int
-adm6996fc_ifmedia_upd(struct ifnet *ifp)
+adm6996fc_ifmedia_upd(if_t ifp)
{
struct adm6996fc_softc *sc;
struct mii_data *mii;
- sc = ifp->if_softc;
- mii = adm6996fc_miiforport(sc, ifp->if_dunit);
+ sc = if_getsoftc(ifp);
+ mii = adm6996fc_miiforport(sc, ifp->if_dunit); /* XXX - DRVAPI */
DPRINTF(sc->sc_dev, "%s\n", __func__);
if (mii == NULL)
@@ -737,13 +737,13 @@
}
static void
-adm6996fc_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
+adm6996fc_ifmedia_sts(if_t ifp, struct ifmediareq *ifmr)
{
struct adm6996fc_softc *sc;
struct mii_data *mii;
- sc = ifp->if_softc;
- mii = adm6996fc_miiforport(sc, ifp->if_dunit);
+ sc = if_getsoftc(ifp);
+ mii = adm6996fc_miiforport(sc, ifp->if_dunit); /* XXX - DRVAPI */
DPRINTF(sc->sc_dev, "%s\n", __func__);
diff --git a/sys/dev/etherswitch/ip17x/ip17x.c b/sys/dev/etherswitch/ip17x/ip17x.c
--- a/sys/dev/etherswitch/ip17x/ip17x.c
+++ b/sys/dev/etherswitch/ip17x/ip17x.c
@@ -79,8 +79,8 @@
MALLOC_DEFINE(M_IP17X, "ip17x", "ip17x data structures");
static void ip17x_tick(void *);
-static int ip17x_ifmedia_upd(struct ifnet *);
-static void ip17x_ifmedia_sts(struct ifnet *, struct ifmediareq *);
+static int ip17x_ifmedia_upd(if_t );
+static void ip17x_ifmedia_sts(if_t , struct ifmediareq *);
static void
ip17x_identify(driver_t *driver, device_t parent)
@@ -180,9 +180,9 @@
break;
}
- sc->ifp[port]->if_softc = sc;
- sc->ifp[port]->if_flags |= IFF_UP | IFF_BROADCAST |
- IFF_DRV_RUNNING | IFF_SIMPLEX;
+ if_setsoftc(sc->ifp[port], sc);
+ if_setflags(sc->ifp[port], IFF_UP | IFF_BROADCAST |
+ IFF_DRV_RUNNING | IFF_SIMPLEX);
if_initname(sc->ifp[port], name, port);
sc->miibus[port] = malloc(sizeof(device_t), M_IP17X,
M_WAITOK | M_ZERO);
@@ -191,7 +191,7 @@
BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0);
DPRINTF(sc->sc_dev, "%s attached to pseudo interface %s\n",
device_get_nameunit(*sc->miibus[port]),
- sc->ifp[port]->if_xname);
+ if_name(sc->ifp[port]));
if (err != 0) {
device_printf(sc->sc_dev,
"attaching PHY %d failed\n",
@@ -240,7 +240,7 @@
/* Always attach the cpu port. */
sc->phymask |= (1 << sc->cpuport);
- sc->ifp = malloc(sizeof(struct ifnet *) * sc->numports, M_IP17X,
+ sc->ifp = malloc(sizeof(if_t ) * sc->numports, M_IP17X,
M_WAITOK | M_ZERO);
sc->pvid = malloc(sizeof(uint32_t) * sc->numports, M_IP17X,
M_WAITOK | M_ZERO);
@@ -324,7 +324,7 @@
return (device_get_softc(*sc->miibus[port]));
}
-static inline struct ifnet *
+static inline if_t
ip17x_ifpforport(struct ip17x_softc *sc, int port)
{
@@ -459,7 +459,7 @@
{
struct ip17x_softc *sc;
struct ifmedia *ifm;
- struct ifnet *ifp;
+ if_t ifp;
struct mii_data *mii;
int phy;
@@ -524,14 +524,14 @@
}
static int
-ip17x_ifmedia_upd(struct ifnet *ifp)
+ip17x_ifmedia_upd(if_t ifp)
{
struct ip17x_softc *sc;
struct mii_data *mii;
- sc = ifp->if_softc;
+ sc = if_getsoftc(ifp);
DPRINTF(sc->sc_dev, "%s\n", __func__);
- mii = ip17x_miiforport(sc, ifp->if_dunit);
+ mii = ip17x_miiforport(sc, if_getdunit(ifp));
if (mii == NULL)
return (ENXIO);
mii_mediachg(mii);
@@ -540,14 +540,14 @@
}
static void
-ip17x_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
+ip17x_ifmedia_sts(if_t ifp, struct ifmediareq *ifmr)
{
struct ip17x_softc *sc;
struct mii_data *mii;
- sc = ifp->if_softc;
+ sc = if_getsoftc(ifp);
DPRINTF(sc->sc_dev, "%s\n", __func__);
- mii = ip17x_miiforport(sc, ifp->if_dunit);
+ mii = ip17x_miiforport(sc, if_getdunit(ifp));
if (mii == NULL)
return;
mii_pollstat(mii);
diff --git a/sys/dev/etherswitch/ip17x/ip17x_var.h b/sys/dev/etherswitch/ip17x/ip17x_var.h
--- a/sys/dev/etherswitch/ip17x/ip17x_var.h
+++ b/sys/dev/etherswitch/ip17x/ip17x_var.h
@@ -59,7 +59,7 @@
etherswitch_info_t info;
ip17x_switch_type sc_switchtype;
struct callout callout_tick;
- struct ifnet **ifp;
+ if_t *ifp;
struct mtx sc_mtx; /* serialize access to softc */
struct ip17x_vlan vlan[IP17X_MAX_VLANS];
diff --git a/sys/dev/etherswitch/micrel/ksz8995ma.c b/sys/dev/etherswitch/micrel/ksz8995ma.c
--- a/sys/dev/etherswitch/micrel/ksz8995ma.c
+++ b/sys/dev/etherswitch/micrel/ksz8995ma.c
@@ -151,7 +151,7 @@
int *portphy;
char **ifname;
device_t **miibus;
- struct ifnet **ifp;
+ if_t *ifp;
struct callout callout_tick;
etherswitch_info_t info;
};
@@ -173,8 +173,8 @@
static inline int ksz8995ma_portforphy(struct ksz8995ma_softc *, int);
static void ksz8995ma_tick(void *);
-static int ksz8995ma_ifmedia_upd(struct ifnet *);
-static void ksz8995ma_ifmedia_sts(struct ifnet *, struct ifmediareq *);
+static int ksz8995ma_ifmedia_upd(if_t );
+static void ksz8995ma_ifmedia_sts(if_t , struct ifmediareq *);
static int ksz8995ma_readreg(device_t dev, int addr);
static int ksz8995ma_writereg(device_t dev, int addr, int value);
static void ksz8995ma_portvlanreset(device_t dev);
@@ -304,7 +304,7 @@
sc->info.es_nvlangroups = 16;
sc->info.es_vlan_caps = ETHERSWITCH_VLAN_PORT | ETHERSWITCH_VLAN_DOT1Q;
- sc->ifp = malloc(sizeof(struct ifnet *) * sc->numports, M_KSZ8995MA,
+ sc->ifp = malloc(sizeof(if_t ) * sc->numports, M_KSZ8995MA,
M_WAITOK | M_ZERO);
sc->ifname = malloc(sizeof(char *) * sc->numports, M_KSZ8995MA,
M_WAITOK | M_ZERO);
@@ -413,7 +413,7 @@
return (device_get_softc(*sc->miibus[port]));
}
-static inline struct ifnet *
+static inline if_t
ksz8995ma_ifpforport(struct ksz8995ma_softc *sc, int port)
{
@@ -565,7 +565,7 @@
struct ksz8995ma_softc *sc;
struct mii_data *mii;
struct ifmedia *ifm;
- struct ifnet *ifp;
+ if_t ifp;
int phy, err;
int portreg;
@@ -771,13 +771,13 @@
}
static int
-ksz8995ma_ifmedia_upd(struct ifnet *ifp)
+ksz8995ma_ifmedia_upd(if_t ifp)
{
struct ksz8995ma_softc *sc;
struct mii_data *mii;
- sc = ifp->if_softc;
- mii = ksz8995ma_miiforport(sc, ifp->if_dunit);
+ sc = if_getsoftc(ifp);
+ mii = ksz8995ma_miiforport(sc, ifp->if_dunit); /* XXX - DRVAPI */
DPRINTF(sc->sc_dev, "%s\n", __func__);
if (mii == NULL)
@@ -787,13 +787,13 @@
}
static void
-ksz8995ma_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
+ksz8995ma_ifmedia_sts(if_t ifp, struct ifmediareq *ifmr)
{
struct ksz8995ma_softc *sc;
struct mii_data *mii;
- sc = ifp->if_softc;
- mii = ksz8995ma_miiforport(sc, ifp->if_dunit);
+ sc = if_getsoftc(ifp);
+ mii = ksz8995ma_miiforport(sc, ifp->if_dunit); /* XXX - DRVAPI */
DPRINTF(sc->sc_dev, "%s\n", __func__);
diff --git a/sys/dev/etherswitch/mtkswitch/mtkswitch.c b/sys/dev/etherswitch/mtkswitch/mtkswitch.c
--- a/sys/dev/etherswitch/mtkswitch/mtkswitch.c
+++ b/sys/dev/etherswitch/mtkswitch/mtkswitch.c
@@ -69,8 +69,8 @@
#endif
static inline int mtkswitch_portforphy(int phy);
-static int mtkswitch_ifmedia_upd(struct ifnet *ifp);
-static void mtkswitch_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr);
+static int mtkswitch_ifmedia_upd(if_t ifp);
+static void mtkswitch_ifmedia_sts(if_t ifp, struct ifmediareq *ifmr);
static void mtkswitch_tick(void *arg);
static const struct ofw_compat_data compat_data[] = {
@@ -303,7 +303,7 @@
return (device_get_softc(sc->miibus[phy]));
}
-static inline struct ifnet *
+static inline if_t
mtkswitch_ifpforport(struct mtkswitch_softc *sc, int port)
{
int phy = mtkswitch_phyforport(port);
@@ -484,7 +484,7 @@
struct mtkswitch_softc *sc;
struct ifmedia *ifm;
struct mii_data *mii;
- struct ifnet *ifp;
+ if_t ifp;
sc = device_get_softc(dev);
if (p->es_port < 0 || p->es_port > sc->info.es_nports)
@@ -519,10 +519,10 @@
}
static int
-mtkswitch_ifmedia_upd(struct ifnet *ifp)
+mtkswitch_ifmedia_upd(if_t ifp)
{
- struct mtkswitch_softc *sc = ifp->if_softc;
- struct mii_data *mii = mtkswitch_miiforport(sc, ifp->if_dunit);
+ struct mtkswitch_softc *sc = if_getsoftc(ifp);
+ struct mii_data *mii = mtkswitch_miiforport(sc, ifp->if_dunit); /* XXX - DRVAPI */
if (mii == NULL)
return (ENXIO);
@@ -531,10 +531,10 @@
}
static void
-mtkswitch_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
+mtkswitch_ifmedia_sts(if_t ifp, struct ifmediareq *ifmr)
{
- struct mtkswitch_softc *sc = ifp->if_softc;
- struct mii_data *mii = mtkswitch_miiforport(sc, ifp->if_dunit);
+ struct mtkswitch_softc *sc = if_getsoftc(ifp);
+ struct mii_data *mii = mtkswitch_miiforport(sc, ifp->if_dunit); /* XXX - DRVAPI */
DPRINTF(sc->sc_dev, "%s\n", __func__);
diff --git a/sys/dev/etherswitch/mtkswitch/mtkswitchvar.h b/sys/dev/etherswitch/mtkswitch/mtkswitchvar.h
--- a/sys/dev/etherswitch/mtkswitch/mtkswitchvar.h
+++ b/sys/dev/etherswitch/mtkswitch/mtkswitchvar.h
@@ -68,7 +68,7 @@
mtk_switch_type sc_switchtype;
char *ifname[MTKSWITCH_MAX_PHYS];
device_t miibus[MTKSWITCH_MAX_PHYS];
- struct ifnet *ifp[MTKSWITCH_MAX_PHYS];
+ if_t ifp[MTKSWITCH_MAX_PHYS];
struct callout callout_tick;
etherswitch_info_t info;
diff --git a/sys/dev/etherswitch/rtl8366/rtl8366rb.c b/sys/dev/etherswitch/rtl8366/rtl8366rb.c
--- a/sys/dev/etherswitch/rtl8366/rtl8366rb.c
+++ b/sys/dev/etherswitch/rtl8366/rtl8366rb.c
@@ -75,7 +75,7 @@
int vid[RTL8366_NUM_VLANS];
char *ifname[RTL8366_NUM_PHYS];
device_t miibus[RTL8366_NUM_PHYS];
- struct ifnet *ifp[RTL8366_NUM_PHYS];
+ if_t ifp[RTL8366_NUM_PHYS];
struct callout callout_tick;
etherswitch_info_t info;
int chip_type;
@@ -126,8 +126,8 @@
static int smi_write(device_t dev, uint16_t addr, uint16_t data, int sleep);
static int smi_rmw(device_t dev, uint16_t addr, uint16_t mask, uint16_t data, int sleep);
static void rtl8366rb_tick(void *arg);
-static int rtl8366rb_ifmedia_upd(struct ifnet *);
-static void rtl8366rb_ifmedia_sts(struct ifnet *, struct ifmediareq *);
+static int rtl8366rb_ifmedia_upd(if_t );
+static void rtl8366rb_ifmedia_sts(if_t , struct ifmediareq *);
static void
rtl8366rb_identify(driver_t *driver, device_t parent)
@@ -246,9 +246,9 @@
break;
}
- sc->ifp[i]->if_softc = sc;
- sc->ifp[i]->if_flags |= IFF_UP | IFF_BROADCAST | IFF_DRV_RUNNING
- | IFF_SIMPLEX;
+ if_setsoftc(sc->ifp[i], sc);
+ if_setflagbits(sc->ifp[i], IFF_UP | IFF_BROADCAST | IFF_DRV_RUNNING
+ | IFF_SIMPLEX, 0);
snprintf(name, IFNAMSIZ, "%sport", device_get_nameunit(dev));
sc->ifname[i] = malloc(strlen(name)+1, M_DEVBUF, M_WAITOK);
bcopy(name, sc->ifname[i], strlen(name)+1);
@@ -895,26 +895,26 @@
}
static int
-rtl8366rb_ifmedia_upd(struct ifnet *ifp)
+rtl8366rb_ifmedia_upd(if_t ifp)
{
struct rtl8366rb_softc *sc;
struct mii_data *mii;
- sc = ifp->if_softc;
- mii = device_get_softc(sc->miibus[ifp->if_dunit]);
+ sc = if_getsoftc(ifp);
+ mii = device_get_softc(sc->miibus[if_getdunit(ifp)]);
mii_mediachg(mii);
return (0);
}
static void
-rtl8366rb_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
+rtl8366rb_ifmedia_sts(if_t ifp, struct ifmediareq *ifmr)
{
struct rtl8366rb_softc *sc;
struct mii_data *mii;
- sc = ifp->if_softc;
- mii = device_get_softc(sc->miibus[ifp->if_dunit]);
+ sc = if_getsoftc(ifp);
+ mii = device_get_softc(sc->miibus[if_getdunit(ifp)]);
mii_pollstat(mii);
ifmr->ifm_active = mii->mii_media_active;
diff --git a/sys/dev/etherswitch/ukswitch/ukswitch.c b/sys/dev/etherswitch/ukswitch/ukswitch.c
--- a/sys/dev/etherswitch/ukswitch/ukswitch.c
+++ b/sys/dev/etherswitch/ukswitch/ukswitch.c
@@ -75,7 +75,7 @@
int *portphy;
char **ifname;
device_t **miibus;
- struct ifnet **ifp;
+ if_t *ifp;
struct callout callout_tick;
etherswitch_info_t info;
};
@@ -97,8 +97,8 @@
static inline int ukswitch_portforphy(struct ukswitch_softc *, int);
static void ukswitch_tick(void *);
-static int ukswitch_ifmedia_upd(struct ifnet *);
-static void ukswitch_ifmedia_sts(struct ifnet *, struct ifmediareq *);
+static int ukswitch_ifmedia_upd(if_t );
+static void ukswitch_ifmedia_sts(if_t , struct ifmediareq *);
static int
ukswitch_probe(device_t dev)
@@ -132,9 +132,9 @@
break;
}
- sc->ifp[port]->if_softc = sc;
- sc->ifp[port]->if_flags |= IFF_UP | IFF_BROADCAST |
- IFF_DRV_RUNNING | IFF_SIMPLEX;
+ if_setsoftc(sc->ifp[port], sc);
+ if_setflags(sc->ifp[port], IFF_UP | IFF_BROADCAST |
+ IFF_DRV_RUNNING | IFF_SIMPLEX);
sc->ifname[port] = malloc(strlen(name)+1, M_UKSWITCH, M_WAITOK);
bcopy(name, sc->ifname[port], strlen(name)+1);
if_initname(sc->ifp[port], sc->ifname[port], port);
@@ -145,7 +145,7 @@
BMSR_DEFCAPMASK, phy + sc->phyoffset, MII_OFFSET_ANY, 0);
DPRINTF(sc->sc_dev, "%s attached to pseudo interface %s\n",
device_get_nameunit(*sc->miibus[port]),
- sc->ifp[port]->if_xname);
+ if_name(sc->ifp[port]));
if (err != 0) {
device_printf(sc->sc_dev,
"attaching PHY %d failed\n",
@@ -201,7 +201,7 @@
/* We do not support any vlan groups. */
sc->info.es_nvlangroups = 0;
- sc->ifp = malloc(sizeof(struct ifnet *) * sc->numports, M_UKSWITCH,
+ sc->ifp = malloc(sizeof(if_t ) * sc->numports, M_UKSWITCH,
M_WAITOK | M_ZERO);
sc->ifname = malloc(sizeof(char *) * sc->numports, M_UKSWITCH,
M_WAITOK | M_ZERO);
@@ -280,7 +280,7 @@
return (device_get_softc(*sc->miibus[port]));
}
-static inline struct ifnet *
+static inline if_t
ukswitch_ifpforport(struct ukswitch_softc *sc, int port)
{
@@ -396,7 +396,7 @@
struct ukswitch_softc *sc = device_get_softc(dev);
struct ifmedia *ifm;
struct mii_data *mii;
- struct ifnet *ifp;
+ if_t ifp;
int err;
if (p->es_port < 0 || p->es_port >= sc->numports)
@@ -444,10 +444,10 @@
}
static int
-ukswitch_ifmedia_upd(struct ifnet *ifp)
+ukswitch_ifmedia_upd(if_t ifp)
{
- struct ukswitch_softc *sc = ifp->if_softc;
- struct mii_data *mii = ukswitch_miiforport(sc, ifp->if_dunit);
+ struct ukswitch_softc *sc = if_getsoftc(ifp);
+ struct mii_data *mii = ukswitch_miiforport(sc, if_getdunit(ifp));
DPRINTF(sc->sc_dev, "%s\n", __func__);
if (mii == NULL)
@@ -457,10 +457,10 @@
}
static void
-ukswitch_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
+ukswitch_ifmedia_sts(if_t ifp, struct ifmediareq *ifmr)
{
- struct ukswitch_softc *sc = ifp->if_softc;
- struct mii_data *mii = ukswitch_miiforport(sc, ifp->if_dunit);
+ struct ukswitch_softc *sc = if_getsoftc(ifp);
+ struct mii_data *mii = ukswitch_miiforport(sc, if_getdunit(ifp));
DPRINTF(sc->sc_dev, "%s\n", __func__);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 18, 2:30 AM (5 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31692846
Default Alt Text
D37813.diff (27 KB)
Attached To
Mode
D37813: Mechanically convert etherswitch drivers to DrvAPI
Attached
Detach File
Event Timeline
Log In to Comment