diff options
| author | Justin Hibbits <jhibbits@FreeBSD.org> | 2022-05-30 19:40:45 +0000 |
|---|---|---|
| committer | Justin Hibbits <jhibbits@FreeBSD.org> | 2023-01-24 19:36:29 +0000 |
| commit | 2e6a8c1ae3ce1efe5510eef495829b2b5c47f16f (patch) | |
| tree | 91f16784f829dae20a1e5cff14cd5087c25e43e3 /sys/dev/etherswitch/ukswitch | |
| parent | d8096b2df282d7a50e56eddba523bcdda1676106 (diff) | |
Diffstat (limited to 'sys/dev/etherswitch/ukswitch')
| -rw-r--r-- | sys/dev/etherswitch/ukswitch/ukswitch.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/sys/dev/etherswitch/ukswitch/ukswitch.c b/sys/dev/etherswitch/ukswitch/ukswitch.c index ee9415e0584b..5ec3a0db0d1e 100644 --- a/sys/dev/etherswitch/ukswitch/ukswitch.c +++ b/sys/dev/etherswitch/ukswitch/ukswitch.c @@ -75,7 +75,7 @@ struct ukswitch_softc { 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 @@ struct ukswitch_softc { 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 @@ ukswitch_attach_phys(struct ukswitch_softc *sc) 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 @@ ukswitch_attach_phys(struct ukswitch_softc *sc) 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 @@ ukswitch_attach(device_t dev) /* 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 @@ ukswitch_miiforport(struct ukswitch_softc *sc, int port) 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 @@ ukswitch_setport(device_t dev, etherswitch_port_t *p) 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 @@ ukswitch_statchg(device_t dev) } 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 @@ ukswitch_ifmedia_upd(struct ifnet *ifp) } 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__); |
