Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146265512
D37804.id114430.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
11 KB
Referenced Files
None
Subscribers
None
D37804.id114430.diff
View Options
diff --git a/sys/dev/rt/if_rt.c b/sys/dev/rt/if_rt.c
--- a/sys/dev/rt/if_rt.c
+++ b/sys/dev/rt/if_rt.c
@@ -137,8 +137,8 @@
static void rt_init(void *priv);
static void rt_stop_locked(void *priv);
static void rt_stop(void *priv);
-static void rt_start(struct ifnet *ifp);
-static int rt_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data);
+static void rt_start(if_t ifp);
+static int rt_ioctl(if_t ifp, u_long cmd, caddr_t data);
static void rt_tx_watchdog(void *arg);
static void rt_intr(void *arg);
static void rt_rt5350_intr(void *arg);
@@ -183,8 +183,8 @@
static int rt_miibus_readreg(device_t, int, int);
static int rt_miibus_writereg(device_t, int, int, int);
#endif
-static int rt_ifmedia_upd(struct ifnet *);
-static void rt_ifmedia_sts(struct ifnet *, struct ifmediareq *);
+static int rt_ifmedia_upd(if_t );
+static void rt_ifmedia_sts(if_t , struct ifmediareq *);
static SYSCTL_NODE(_hw, OID_AUTO, rt, CTLFLAG_RD | CTLFLAG_MPSAFE, 0,
"RT driver parameters");
@@ -353,7 +353,7 @@
rt_attach(device_t dev)
{
struct rt_softc *sc;
- struct ifnet *ifp;
+ if_t ifp;
int error, i;
#ifdef FDT
phandle_t node;
@@ -526,17 +526,16 @@
goto fail;
}
- ifp->if_softc = sc;
+ if_setsoftc(ifp, sc);
if_initname(ifp, device_get_name(sc->dev), device_get_unit(sc->dev));
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
- ifp->if_init = rt_init;
- ifp->if_ioctl = rt_ioctl;
- ifp->if_start = rt_start;
+ if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST);
+ if_setinitfn(ifp, rt_init);
+ if_setioctlfn(ifp, rt_ioctl);
+ if_setstartfn(ifp, rt_start);
#define RT_TX_QLEN 256
- IFQ_SET_MAXLEN(&ifp->if_snd, RT_TX_QLEN);
- ifp->if_snd.ifq_drv_maxlen = RT_TX_QLEN;
- IFQ_SET_READY(&ifp->if_snd);
+ if_setsendqlen(ifp, RT_TX_QLEN);
+ if_setsendqready(ifp);
#ifdef IF_RT_PHY_SUPPORT
error = mii_attach(dev, &sc->rt_miibus, ifp, rt_ifmedia_upd,
@@ -560,11 +559,11 @@
/*
* Tell the upper layer(s) we support long frames.
*/
- ifp->if_hdrlen = sizeof(struct ether_vlan_header);
- ifp->if_capabilities |= IFCAP_VLAN_MTU;
- ifp->if_capenable |= IFCAP_VLAN_MTU;
- ifp->if_capabilities |= IFCAP_RXCSUM|IFCAP_TXCSUM;
- ifp->if_capenable |= IFCAP_RXCSUM|IFCAP_TXCSUM;
+ if_setifheaderlen(ifp, sizeof(struct ether_vlan_header));
+ if_setcapabilitiesbit(ifp, IFCAP_VLAN_MTU, 0);
+ if_setcapenablebit(ifp, IFCAP_VLAN_MTU, 0);
+ if_setcapabilitiesbit(ifp, IFCAP_RXCSUM|IFCAP_TXCSUM, 0);
+ if_setcapenablebit(ifp, IFCAP_RXCSUM|IFCAP_TXCSUM, 0);
/* init task queue */
NET_TASK_INIT(&sc->rx_done_task, 0, rt_rx_done_task, sc);
@@ -625,7 +624,7 @@
* Set media options.
*/
static int
-rt_ifmedia_upd(struct ifnet *ifp)
+rt_ifmedia_upd(if_t ifp)
{
struct rt_softc *sc;
#ifdef IF_RT_PHY_SUPPORT
@@ -633,7 +632,7 @@
struct mii_softc *miisc;
int error = 0;
- sc = ifp->if_softc;
+ sc = if_getsoftc(ifp);
RT_SOFTC_LOCK(sc);
mii = device_get_softc(sc->rt_miibus);
@@ -649,7 +648,7 @@
struct ifmedia *ifm;
struct ifmedia_entry *ife;
- sc = ifp->if_softc;
+ sc = if_getsoftc(ifp);
ifm = &sc->rt_ifmedia;
ife = ifm->ifm_cur;
@@ -673,13 +672,13 @@
* Report current media status.
*/
static void
-rt_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
+rt_ifmedia_sts(if_t ifp, struct ifmediareq *ifmr)
{
#ifdef IF_RT_PHY_SUPPORT
struct rt_softc *sc;
struct mii_data *mii;
- sc = ifp->if_softc;
+ sc = if_getsoftc(ifp);
RT_SOFTC_LOCK(sc);
mii = device_get_softc(sc->rt_miibus);
@@ -700,7 +699,7 @@
rt_detach(device_t dev)
{
struct rt_softc *sc;
- struct ifnet *ifp;
+ if_t ifp;
int i;
sc = device_get_softc(dev);
@@ -709,7 +708,7 @@
RT_DPRINTF(sc, RT_DEBUG_ANY, "detaching\n");
RT_SOFTC_LOCK(sc);
- ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
+ if_setdrvflagbits(ifp, 0, (IFF_DRV_RUNNING | IFF_DRV_OACTIVE));
callout_stop(&sc->tx_watchdog_ch);
RT_SOFTC_UNLOCK(sc);
@@ -773,14 +772,14 @@
rt_resume(device_t dev)
{
struct rt_softc *sc;
- struct ifnet *ifp;
+ if_t ifp;
sc = device_get_softc(dev);
ifp = sc->ifp;
RT_DPRINTF(sc, RT_DEBUG_ANY, "resuming\n");
- if (ifp->if_flags & IFF_UP)
+ if (if_getflags(ifp) & IFF_UP)
rt_init(sc);
return (0);
@@ -793,7 +792,7 @@
rt_init_locked(void *priv)
{
struct rt_softc *sc;
- struct ifnet *ifp;
+ if_t ifp;
#ifdef IF_RT_PHY_SUPPORT
struct mii_data *mii;
#endif
@@ -935,8 +934,8 @@
if (mii) mii_mediachg(mii);
#endif /* IF_RT_PHY_SUPPORT */
- ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
- ifp->if_drv_flags |= IFF_DRV_RUNNING;
+ if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE);
+ if_setdrvflagbits(ifp, IFF_DRV_RUNNING, 0);
sc->periodic_round = 0;
@@ -969,7 +968,7 @@
rt_stop_locked(void *priv)
{
struct rt_softc *sc;
- struct ifnet *ifp;
+ if_t ifp;
sc = priv;
ifp = sc->ifp;
@@ -978,7 +977,7 @@
RT_SOFTC_ASSERT_LOCKED(sc);
sc->tx_timer = 0;
- ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
+ if_setdrvflagbits(ifp, 0, (IFF_DRV_RUNNING | IFF_DRV_OACTIVE));
callout_stop(&sc->tx_watchdog_ch);
RT_SOFTC_UNLOCK(sc);
taskqueue_block(sc->taskqueue);
@@ -1037,7 +1036,7 @@
static int
rt_tx_data(struct rt_softc *sc, struct mbuf *m, int qid)
{
- struct ifnet *ifp;
+ if_t ifp;
struct rt_softc_tx_ring *ring;
struct rt_softc_tx_data *data;
struct rt_txdesc *desc;
@@ -1118,7 +1117,7 @@
if (sc->rt_chipid != RT_CHIPID_MT7620)
desc->dst = (TXDSCR_DST_PORT_GDMA1);
- if ((ifp->if_capenable & IFCAP_TXCSUM) != 0)
+ if ((if_getcapenable(ifp) & IFCAP_TXCSUM) != 0)
desc->dst |= (TXDSCR_IP_CSUM_GEN |
TXDSCR_UDP_CSUM_GEN | TXDSCR_TCP_CSUM_GEN);
/* Set queue id */
@@ -1187,19 +1186,19 @@
* rt_start - start Transmit/Receive
*/
static void
-rt_start(struct ifnet *ifp)
+rt_start(if_t ifp)
{
struct rt_softc *sc;
struct mbuf *m;
int qid = 0 /* XXX must check QoS priority */;
- sc = ifp->if_softc;
+ sc = if_getsoftc(ifp);
- if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
+ if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING))
return;
for (;;) {
- IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
+ m = if_dequeue(ifp);
if (m == NULL)
break;
@@ -1216,7 +1215,7 @@
m_freem(m);
- ifp->if_drv_flags |= IFF_DRV_OACTIVE;
+ if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0);
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
sc->tx_data_queue_full[qid]++;
@@ -1243,21 +1242,21 @@
* filtering done by attached Ethernet switch.
*/
static void
-rt_update_promisc(struct ifnet *ifp)
+rt_update_promisc(if_t ifp)
{
struct rt_softc *sc;
- sc = ifp->if_softc;
+ sc = if_getsoftc(ifp);
printf("%s: %s promiscuous mode\n",
device_get_nameunit(sc->dev),
- (ifp->if_flags & IFF_PROMISC) ? "entering" : "leaving");
+ (if_getflags(ifp) & IFF_PROMISC) ? "entering" : "leaving");
}
/*
* rt_ioctl - ioctl handler.
*/
static int
-rt_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
+rt_ioctl(if_t ifp, u_long cmd, caddr_t data)
{
struct rt_softc *sc;
struct ifreq *ifr;
@@ -1266,7 +1265,7 @@
#endif /* IF_RT_PHY_SUPPORT */
int error, startall;
- sc = ifp->if_softc;
+ sc = if_getsoftc(ifp);
ifr = (struct ifreq *) data;
error = 0;
@@ -1275,9 +1274,9 @@
case SIOCSIFFLAGS:
startall = 0;
RT_SOFTC_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)
rt_update_promisc(ifp);
} else {
@@ -1285,10 +1284,10 @@
startall = 1;
}
} else {
- if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+ if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
rt_stop_locked(sc);
}
- sc->if_flags = ifp->if_flags;
+ sc->if_flags = if_getflags(ifp);
RT_SOFTC_UNLOCK(sc);
break;
case SIOCGIFMEDIA:
@@ -1314,7 +1313,7 @@
rt_tx_watchdog(void *arg)
{
struct rt_softc *sc;
- struct ifnet *ifp;
+ if_t ifp;
sc = arg;
ifp = sc->ifp;
@@ -1444,7 +1443,7 @@
rt_intr(void *arg)
{
struct rt_softc *sc;
- struct ifnet *ifp;
+ if_t ifp;
uint32_t status;
sc = arg;
@@ -1462,7 +1461,7 @@
sc->interrupts++;
- if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
+ if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING))
return;
if (status & CNT_PPE_AF)
@@ -1527,7 +1526,7 @@
rt_rt5350_intr(void *arg)
{
struct rt_softc *sc;
- struct ifnet *ifp;
+ if_t ifp;
uint32_t status;
sc = arg;
@@ -1545,7 +1544,7 @@
sc->interrupts++;
- if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
+ if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING))
return;
if (status & RT5350_INT_TX_COHERENT)
@@ -1704,7 +1703,7 @@
rt_rx_done_task(void *context, int pending)
{
struct rt_softc *sc;
- struct ifnet *ifp;
+ if_t ifp;
int again;
sc = context;
@@ -1712,7 +1711,7 @@
RT_DPRINTF(sc, RT_DEBUG_RX, "Rx done task\n");
- if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
+ if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING))
return;
sc->intr_pending_mask &= ~sc->int_rx_done_mask;
@@ -1739,7 +1738,7 @@
rt_tx_done_task(void *context, int pending)
{
struct rt_softc *sc;
- struct ifnet *ifp;
+ if_t ifp;
uint32_t intr_mask;
int i;
@@ -1748,7 +1747,7 @@
RT_DPRINTF(sc, RT_DEBUG_TX, "Tx done task\n");
- if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
+ if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING))
return;
for (i = RT_SOFTC_TX_RING_COUNT - 1; i >= 0; i--) {
@@ -1760,7 +1759,7 @@
sc->tx_timer = 0;
- ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+ if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE);
if(sc->rt_chipid == RT_CHIPID_RT5350 ||
sc->rt_chipid == RT_CHIPID_MT7620 ||
@@ -1790,7 +1789,7 @@
RT_SOFTC_UNLOCK(sc);
- if (!IFQ_IS_EMPTY(&ifp->if_snd))
+ if (!if_sendq_empty(ifp))
rt_start(ifp);
}
@@ -1801,7 +1800,7 @@
rt_periodic_task(void *context, int pending)
{
struct rt_softc *sc;
- struct ifnet *ifp;
+ if_t ifp;
sc = context;
ifp = sc->ifp;
@@ -1809,7 +1808,7 @@
RT_DPRINTF(sc, RT_DEBUG_PERIODIC, "periodic task: round=%lu\n",
sc->periodic_round);
- if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
+ if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING))
return;
RT_SOFTC_LOCK(sc);
@@ -1832,7 +1831,7 @@
static int
rt_rx_eof(struct rt_softc *sc, struct rt_softc_rx_ring *ring, int limit)
{
- struct ifnet *ifp;
+ if_t ifp;
/* struct rt_softc_rx_ring *ring; */
struct rt_rxdesc *desc;
struct rt_softc_rx_data *data;
@@ -1937,7 +1936,7 @@
m->m_pkthdr.len = m->m_len = len;
/* check for crc errors */
- if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) {
+ if ((if_getcapenable(ifp) & IFCAP_RXCSUM) != 0) {
/*check for valid checksum*/
if (desc_flags & (sc->csum_fail_ip|sc->csum_fail_l4)) {
RT_DPRINTF(sc, RT_DEBUG_RX,
@@ -1945,7 +1944,7 @@
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
- if (!(ifp->if_flags & IFF_PROMISC)) {
+ if (!(if_getflags(ifp) & IFF_PROMISC)) {
m_freem(m);
goto skip;
}
@@ -1958,7 +1957,7 @@
m->m_flags &= ~M_HASFCS;
}
- (*ifp->if_input)(ifp, m);
+ if_input(ifp, m);
skip:
desc->sdl0 &= ~htole16(RT_RXDESC_SDL0_DDONE);
@@ -1991,7 +1990,7 @@
static void
rt_tx_eof(struct rt_softc *sc, struct rt_softc_tx_ring *ring)
{
- struct ifnet *ifp;
+ if_t ifp;
struct rt_txdesc *desc;
struct rt_softc_tx_data *data;
uint32_t index;
@@ -2060,7 +2059,7 @@
static void
rt_update_stats(struct rt_softc *sc)
{
- struct ifnet *ifp;
+ if_t ifp;
ifp = sc->ifp;
RT_DPRINTF(sc, RT_DEBUG_STATS, "update statistic: \n");
@@ -2160,7 +2159,7 @@
static int
rt_txrx_enable(struct rt_softc *sc)
{
- struct ifnet *ifp;
+ if_t ifp;
uint32_t tmp;
int ntries;
diff --git a/sys/dev/rt/if_rtvar.h b/sys/dev/rt/if_rtvar.h
--- a/sys/dev/rt/if_rtvar.h
+++ b/sys/dev/rt/if_rtvar.h
@@ -211,7 +211,7 @@
bus_space_tag_t bst;
bus_space_handle_t bsh;
- struct ifnet *ifp;
+ if_t ifp;
int if_flags;
struct ifmedia rt_ifmedia;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 2, 5:56 AM (1 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29144893
Default Alt Text
D37804.id114430.diff (11 KB)
Attached To
Mode
D37804: Mechanically convert if_rt(4) to DrvAPI
Attached
Detach File
Event Timeline
Log In to Comment