Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102194179
D37836.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
7 KB
Referenced Files
None
Subscribers
None
D37836.diff
View Options
diff --git a/sys/dev/ffec/if_ffec.c b/sys/dev/ffec/if_ffec.c
--- a/sys/dev/ffec/if_ffec.c
+++ b/sys/dev/ffec/if_ffec.c
@@ -152,7 +152,7 @@
device_t dev;
device_t miibus;
struct mii_data * mii_softc;
- struct ifnet *ifp;
+ if_t ifp;
int if_flags;
struct mtx mtx;
struct resource *irq_res[MAX_IRQ_COUNT];
@@ -441,13 +441,13 @@
}
static void
-ffec_media_status(struct ifnet * ifp, struct ifmediareq *ifmr)
+ffec_media_status(if_t ifp, struct ifmediareq *ifmr)
{
struct ffec_softc *sc;
struct mii_data *mii;
- sc = ifp->if_softc;
+ sc = if_getsoftc(ifp);
mii = sc->mii_softc;
FFEC_LOCK(sc);
mii_pollstat(mii);
@@ -464,12 +464,12 @@
}
static int
-ffec_media_change(struct ifnet * ifp)
+ffec_media_change(if_t ifp)
{
struct ffec_softc *sc;
int error;
- sc = ifp->if_softc;
+ sc = if_getsoftc(ifp);
FFEC_LOCK(sc);
error = ffec_media_change_locked(sc);
@@ -519,7 +519,7 @@
static void
ffec_harvest_stats(struct ffec_softc *sc)
{
- struct ifnet *ifp;
+ if_t ifp;
ifp = sc->ifp;
@@ -553,7 +553,7 @@
ffec_tick(void *arg)
{
struct ffec_softc *sc;
- struct ifnet *ifp;
+ if_t ifp;
int link_was_up;
sc = arg;
@@ -562,7 +562,7 @@
ifp = sc->ifp;
- if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
+ if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING))
return;
/*
@@ -649,7 +649,7 @@
static void
ffec_txstart_locked(struct ffec_softc *sc)
{
- struct ifnet *ifp;
+ if_t ifp;
struct mbuf *m;
int enqueued;
@@ -660,21 +660,21 @@
ifp = sc->ifp;
- if (ifp->if_drv_flags & IFF_DRV_OACTIVE)
+ if (if_getdrvflags(ifp) & IFF_DRV_OACTIVE)
return;
enqueued = 0;
for (;;) {
if (sc->txcount == (TX_DESC_COUNT-1)) {
- ifp->if_drv_flags |= IFF_DRV_OACTIVE;
+ if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0);
break;
}
- IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
+ m = if_dequeue(ifp);
if (m == NULL)
break;
if (ffec_setup_txbuf(sc, sc->tx_idx_head, &m) != 0) {
- IFQ_DRV_PREPEND(&ifp->if_snd, m);
+ if_sendq_prepend(ifp, m);
break;
}
BPF_MTAP(ifp, m);
@@ -691,9 +691,9 @@
}
static void
-ffec_txstart(struct ifnet *ifp)
+ffec_txstart(if_t ifp)
{
- struct ffec_softc *sc = ifp->if_softc;
+ struct ffec_softc *sc = if_getsoftc(ifp);
FFEC_LOCK(sc);
ffec_txstart_locked(sc);
@@ -703,7 +703,7 @@
static void
ffec_txfinish_locked(struct ffec_softc *sc)
{
- struct ifnet *ifp;
+ if_t ifp;
struct ffec_hwdesc *desc;
struct ffec_bufmap *bmap;
boolean_t retired_buffer;
@@ -735,7 +735,7 @@
* the descriptor ring, go try to start some new output.
*/
if (retired_buffer) {
- ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+ if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE);
ffec_txstart_locked(sc);
}
@@ -858,7 +858,7 @@
bcopy(src, dst, len);
m->m_data = dst;
}
- sc->ifp->if_input(sc->ifp, m);
+ if_input(sc->ifp, m);
FFEC_LOCK(sc);
@@ -991,7 +991,7 @@
static void
ffec_setup_rxfilter(struct ffec_softc *sc)
{
- struct ifnet *ifp;
+ if_t ifp;
uint8_t *eaddr;
uint64_t ghash, ihash;
@@ -1002,7 +1002,7 @@
/*
* Set the multicast (group) filter hash.
*/
- if ((ifp->if_flags & IFF_ALLMULTI))
+ if ((if_getflags(ifp) & IFF_ALLMULTI))
ghash = 0xffffffffffffffffLLU;
else {
ghash = 0;
@@ -1018,7 +1018,7 @@
* seems to support the concept of MAC address aliases, does such a
* thing even exist?
*/
- if ((ifp->if_flags & IFF_PROMISC))
+ if ((if_getflags(ifp) & IFF_PROMISC))
ihash = 0xffffffffffffffffLLU;
else {
ihash = 0;
@@ -1029,7 +1029,7 @@
/*
* Set the primary address.
*/
- eaddr = IF_LLADDR(ifp);
+ eaddr = if_getlladdr(ifp);
WR4(sc, FEC_PALR_REG, (eaddr[0] << 24) | (eaddr[1] << 16) |
(eaddr[2] << 8) | eaddr[3]);
WR4(sc, FEC_PAUR_REG, (eaddr[4] << 24) | (eaddr[5] << 16));
@@ -1038,7 +1038,7 @@
static void
ffec_stop_locked(struct ffec_softc *sc)
{
- struct ifnet *ifp;
+ if_t ifp;
struct ffec_hwdesc *desc;
struct ffec_bufmap *bmap;
int idx;
@@ -1046,7 +1046,7 @@
FFEC_ASSERT_LOCKED(sc);
ifp = sc->ifp;
- ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
+ if_setdrvflagbits(ifp, 0, (IFF_DRV_RUNNING | IFF_DRV_OACTIVE));
sc->tx_watchdog_count = 0;
/*
@@ -1101,7 +1101,7 @@
static void
ffec_init_locked(struct ffec_softc *sc)
{
- struct ifnet *ifp = sc->ifp;
+ if_t ifp = sc->ifp;
uint32_t maxbuf, maxfl, regval;
FFEC_ASSERT_LOCKED(sc);
@@ -1126,7 +1126,7 @@
maxbuf = MCLBYTES - roundup(ETHER_ALIGN, sc->rxbuf_align);
maxfl = min(maxbuf, 0x7ff);
- if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+ if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
return;
/* Mask all interrupts and clear all current interrupt status bits. */
@@ -1257,7 +1257,7 @@
regval |= FEC_ECR_ETHEREN;
WR4(sc, FEC_ECR_REG, regval);
- ifp->if_drv_flags |= IFF_DRV_RUNNING;
+ if_setdrvflagbits(ifp, IFF_DRV_RUNNING, 0);
/*
* Call mii_mediachg() which will call back into ffec_miibus_statchg() to
@@ -1326,23 +1326,23 @@
}
static int
-ffec_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
+ffec_ioctl(if_t ifp, u_long cmd, caddr_t data)
{
struct ffec_softc *sc;
struct mii_data *mii;
struct ifreq *ifr;
int mask, error;
- sc = ifp->if_softc;
+ sc = if_getsoftc(ifp);
ifr = (struct ifreq *)data;
error = 0;
switch (cmd) {
case SIOCSIFFLAGS:
FFEC_LOCK(sc);
- if (ifp->if_flags & IFF_UP) {
- if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
- if ((ifp->if_flags ^ sc->if_flags) &
+ if (if_getflags(ifp) & IFF_UP) {
+ if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) {
+ if ((if_getflags(ifp) ^ sc->if_flags) &
(IFF_PROMISC | IFF_ALLMULTI))
ffec_setup_rxfilter(sc);
} else {
@@ -1350,16 +1350,16 @@
ffec_init_locked(sc);
}
} else {
- if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+ if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
ffec_stop_locked(sc);
}
- sc->if_flags = ifp->if_flags;
+ sc->if_flags = if_getflags(ifp);
FFEC_UNLOCK(sc);
break;
case SIOCADDMULTI:
case SIOCDELMULTI:
- if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
+ if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) {
FFEC_LOCK(sc);
ffec_setup_rxfilter(sc);
FFEC_UNLOCK(sc);
@@ -1373,10 +1373,10 @@
break;
case SIOCSIFCAP:
- mask = ifp->if_capenable ^ ifr->ifr_reqcap;
+ mask = if_getcapenable(ifp) ^ ifr->ifr_reqcap;
if (mask & IFCAP_VLAN_MTU) {
/* No work to do except acknowledge the change took. */
- ifp->if_capenable ^= IFCAP_VLAN_MTU;
+ if_togglecapenable(ifp, IFCAP_VLAN_MTU);
}
break;
@@ -1468,7 +1468,7 @@
ffec_attach(device_t dev)
{
struct ffec_softc *sc;
- struct ifnet *ifp = NULL;
+ if_t ifp = NULL;
struct mbuf *m;
void *dummy;
uintptr_t typeflags;
@@ -1739,22 +1739,21 @@
/* Set up the ethernet interface. */
sc->ifp = ifp = if_alloc(IFT_ETHER);
- ifp->if_softc = sc;
+ if_setsoftc(ifp, sc);
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
- ifp->if_capabilities = IFCAP_VLAN_MTU;
- ifp->if_capenable = ifp->if_capabilities;
- ifp->if_start = ffec_txstart;
- ifp->if_ioctl = ffec_ioctl;
- ifp->if_init = ffec_init;
- IFQ_SET_MAXLEN(&ifp->if_snd, TX_DESC_COUNT - 1);
- ifp->if_snd.ifq_drv_maxlen = TX_DESC_COUNT - 1;
- IFQ_SET_READY(&ifp->if_snd);
- ifp->if_hdrlen = sizeof(struct ether_vlan_header);
+ if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST);
+ if_setcapabilities(ifp, IFCAP_VLAN_MTU);
+ if_setcapenable(ifp, if_getcapabilities(ifp));
+ if_setstartfn(ifp, ffec_txstart);
+ if_setioctlfn(ifp, ffec_ioctl);
+ if_setinitfn(ifp, ffec_init);
+ if_setsendqlen(ifp, TX_DESC_COUNT - 1);
+ if_setsendqready(ifp);
+ if_setifheaderlen(ifp, sizeof(struct ether_vlan_header));
#if 0 /* XXX The hardware keeps stats we could use for these. */
- ifp->if_linkmib = &sc->mibdata;
- ifp->if_linkmiblen = sizeof(sc->mibdata);
+ if_setlinkmib(ifp, &sc->mibdata);
+ if_setlinkmiblen(ifp, sizeof(sc->mibdata));
#endif
/* Set up the miigasket hardware (if any). */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 9, 7:03 PM (20 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14564525
Default Alt Text
D37836.diff (7 KB)
Attached To
Mode
D37836: Mechanically convert ffec(4) to DrvAPI
Attached
Detach File
Event Timeline
Log In to Comment