aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2014-08-31 12:48:13 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2014-08-31 12:48:13 +0000
commit09a8241fc976f1de6de368ece7e29a6d733d2576 (patch)
tree460f7e16f18cc1dd02566ab61235a6a7bb98214f
parent997d2d833f4cf600fbbd116fa88c433e0aeebf52 (diff)
downloadsrc-09a8241fc976f1de6de368ece7e29a6d733d2576.tar.gz
src-09a8241fc976f1de6de368ece7e29a6d733d2576.zip
It is actually possible to have if_t a typedef to non-void type,
and keep both converted to drvapi and non-converted drivers compilable. o Make if_t typedef to struct ifnet *. o Remove shim functions. Sponsored by: Netflix Sponsored by: Nginx, Inc.
Notes
Notes: svn path=/head/; revision=270876
-rw-r--r--sys/dev/bge/if_bge.c2
-rw-r--r--sys/dev/bxe/bxe.c32
-rw-r--r--sys/dev/e1000/if_em.c24
-rw-r--r--sys/dev/e1000/if_lem.c24
-rw-r--r--sys/dev/fxp/if_fxp.c18
-rw-r--r--sys/dev/mii/mii.c4
-rw-r--r--sys/dev/nfe/if_nfe.c18
-rw-r--r--sys/net/if.c91
-rw-r--r--sys/net/if_var.h40
9 files changed, 73 insertions, 180 deletions
diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c
index 80715ef97236..384c8f40f1c5 100644
--- a/sys/dev/bge/if_bge.c
+++ b/sys/dev/bge/if_bge.c
@@ -3837,7 +3837,7 @@ bge_attach(device_t dev)
sc->bge_phy_flags |= BGE_PHY_NO_WIRESPEED;
if (sc->bge_flags & BGE_FLAG_TBI) {
- ifmedia_init_drv(&sc->bge_ifmedia, IFM_IMASK, bge_ifmedia_upd,
+ ifmedia_init(&sc->bge_ifmedia, IFM_IMASK, bge_ifmedia_upd,
bge_ifmedia_sts);
ifmedia_add(&sc->bge_ifmedia, IFM_ETHER | IFM_1000_SX, 0, NULL);
ifmedia_add(&sc->bge_ifmedia, IFM_ETHER | IFM_1000_SX | IFM_FDX,
diff --git a/sys/dev/bxe/bxe.c b/sys/dev/bxe/bxe.c
index fe7b49ed6df1..50106bf71e20 100644
--- a/sys/dev/bxe/bxe.c
+++ b/sys/dev/bxe/bxe.c
@@ -4934,7 +4934,7 @@ bxe_ioctl(if_t ifp,
BLOGD(sc, DBG_IOCTL,
"Received SIOCSIFMEDIA/SIOCGIFMEDIA ioctl (cmd=%lu)\n",
(command & 0xff));
- error = ifmedia_ioctl_drv(ifp, ifr, &sc->ifmedia, command);
+ error = ifmedia_ioctl(ifp, ifr, &sc->ifmedia, command);
break;
case SIOCGPRIVATE_0:
@@ -4970,7 +4970,7 @@ bxe_ioctl(if_t ifp,
default:
BLOGD(sc, DBG_IOCTL, "Received Unknown Ioctl (cmd=%lu)\n",
(command & 0xff));
- error = ether_ioctl_drv(ifp, command, data);
+ error = ether_ioctl(ifp, command, data);
break;
}
@@ -6095,7 +6095,7 @@ bxe_mq_flush(struct ifnet *ifp)
}
}
- if_qflush_drv(ifp);
+ if_qflush(ifp);
}
#endif /* FreeBSD_version >= 800000 */
@@ -12254,7 +12254,7 @@ bxe_link_report_locked(struct bxe_softc *sc)
if (bxe_test_bit(BXE_LINK_REPORT_LINK_DOWN,
&cur_data.link_report_flags)) {
- if_linkstate_change_drv(sc->ifp, LINK_STATE_DOWN);
+ if_link_state_change(sc->ifp, LINK_STATE_DOWN);
BLOGI(sc, "NIC Link is Down\n");
} else {
const char *duplex;
@@ -12295,7 +12295,7 @@ bxe_link_report_locked(struct bxe_softc *sc)
flow = "none";
}
- if_linkstate_change_drv(sc->ifp, LINK_STATE_UP);
+ if_link_state_change(sc->ifp, LINK_STATE_UP);
BLOGI(sc, "NIC Link is Up, %d Mbps %s duplex, Flow control: %s\n",
cur_data.line_speed, duplex, flow);
}
@@ -12581,7 +12581,7 @@ bxe_set_uc_list(struct bxe_softc *sc)
#if __FreeBSD_version < 800000
IF_ADDR_LOCK(ifp);
#else
- if_addr_rlock_drv(ifp);
+ if_addr_rlock(ifp);
#endif
/* first schedule a cleanup up of old configuration */
@@ -12591,7 +12591,7 @@ bxe_set_uc_list(struct bxe_softc *sc)
#if __FreeBSD_version < 800000
IF_ADDR_UNLOCK(ifp);
#else
- if_addr_runlock_drv(ifp);
+ if_addr_runlock(ifp);
#endif
return (rc);
}
@@ -12614,7 +12614,7 @@ bxe_set_uc_list(struct bxe_softc *sc)
#if __FreeBSD_version < 800000
IF_ADDR_UNLOCK(ifp);
#else
- if_addr_runlock_drv(ifp);
+ if_addr_runlock(ifp);
#endif
return (rc);
}
@@ -12625,7 +12625,7 @@ bxe_set_uc_list(struct bxe_softc *sc)
#if __FreeBSD_version < 800000
IF_ADDR_UNLOCK(ifp);
#else
- if_addr_runlock_drv(ifp);
+ if_addr_runlock(ifp);
#endif
/* Execute the pending commands */
@@ -13275,7 +13275,7 @@ bxe_init_ifnet(struct bxe_softc *sc)
}
if_setsoftc(ifp, sc);
- if_initname_drv(ifp, device_get_name(sc->dev), device_get_unit(sc->dev));
+ if_initname(ifp, device_get_name(sc->dev), device_get_unit(sc->dev));
if_setflags(ifp, (IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST));
if_setioctlfn(ifp, bxe_ioctl);
if_setstartfn(ifp, bxe_tx_start);
@@ -13325,7 +13325,7 @@ bxe_init_ifnet(struct bxe_softc *sc)
sc->ifp = ifp;
/* attach to the Ethernet interface list */
- ether_ifattach_drv(ifp, sc->link_params.mac_addr);
+ ether_ifattach(ifp, sc->link_params.mac_addr);
return (0);
}
@@ -16391,7 +16391,7 @@ bxe_attach(device_t dev)
/* allocate device interrupts */
if (bxe_interrupt_alloc(sc) != 0) {
if (sc->ifp != NULL) {
- ether_ifdetach_drv(sc->ifp);
+ ether_ifdetach(sc->ifp);
}
ifmedia_removeall(&sc->ifmedia);
bxe_release_mutexes(sc);
@@ -16404,7 +16404,7 @@ bxe_attach(device_t dev)
if (bxe_alloc_ilt_mem(sc) != 0) {
bxe_interrupt_free(sc);
if (sc->ifp != NULL) {
- ether_ifdetach_drv(sc->ifp);
+ ether_ifdetach(sc->ifp);
}
ifmedia_removeall(&sc->ifmedia);
bxe_release_mutexes(sc);
@@ -16418,7 +16418,7 @@ bxe_attach(device_t dev)
bxe_free_ilt_mem(sc);
bxe_interrupt_free(sc);
if (sc->ifp != NULL) {
- ether_ifdetach_drv(sc->ifp);
+ ether_ifdetach(sc->ifp);
}
ifmedia_removeall(&sc->ifmedia);
bxe_release_mutexes(sc);
@@ -16508,7 +16508,7 @@ bxe_detach(device_t dev)
/* release the network interface */
if (ifp != NULL) {
- ether_ifdetach_drv(ifp);
+ ether_ifdetach(ifp);
}
ifmedia_removeall(&sc->ifmedia);
@@ -16531,7 +16531,7 @@ bxe_detach(device_t dev)
/* Release the FreeBSD interface. */
if (sc->ifp != NULL) {
- if_free_drv(sc->ifp);
+ if_free(sc->ifp);
}
pci_disable_busmaster(dev);
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index 3eba0b267b93..99ecbf359aa0 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -751,7 +751,7 @@ err_late:
em_free_receive_structures(adapter);
em_release_hw_control(adapter);
if (adapter->ifp != (void *)NULL)
- if_free_drv(adapter->ifp);
+ if_free(adapter->ifp);
err_pci:
em_free_pci_resources(adapter);
free(adapter->mta, M_DEVBUF);
@@ -809,7 +809,7 @@ em_detach(device_t dev)
if (adapter->vlan_detach != NULL)
EVENTHANDLER_DEREGISTER(vlan_unconfig, adapter->vlan_detach);
- ether_ifdetach_drv(adapter->ifp);
+ ether_ifdetach(adapter->ifp);
callout_drain(&adapter->timer);
#ifdef DEV_NETMAP
@@ -818,7 +818,7 @@ em_detach(device_t dev)
em_free_pci_resources(adapter);
bus_generic_detach(dev);
- if_free_drv(ifp);
+ if_free(ifp);
em_free_transmit_structures(adapter);
em_free_receive_structures(adapter);
@@ -1100,10 +1100,10 @@ em_ioctl(if_t ifp, u_long command, caddr_t data)
em_init(adapter);
#ifdef INET
if (!(if_getflags(ifp) & IFF_NOARP))
- arp_ifinit_drv(ifp, ifa);
+ arp_ifinit(ifp, ifa);
#endif
} else
- error = ether_ioctl_drv(ifp, command, data);
+ error = ether_ioctl(ifp, command, data);
break;
case SIOCSIFMTU:
{
@@ -1195,7 +1195,7 @@ em_ioctl(if_t ifp, u_long command, caddr_t data)
case SIOCGIFMEDIA:
IOCTL_DEBUGOUT("ioctl rcv'd: \
SIOCxIFMEDIA (Get/Set Interface Media)");
- error = ifmedia_ioctl_drv(ifp, ifr, &adapter->media, command);
+ error = ifmedia_ioctl(ifp, ifr, &adapter->media, command);
break;
case SIOCSIFCAP:
{
@@ -1258,7 +1258,7 @@ em_ioctl(if_t ifp, u_long command, caddr_t data)
}
default:
- error = ether_ioctl_drv(ifp, command, data);
+ error = ether_ioctl(ifp, command, data);
break;
}
@@ -2331,7 +2331,7 @@ em_update_link_status(struct adapter *adapter)
adapter->link_active = 1;
adapter->smartspeed = 0;
if_setbaudrate(ifp, adapter->link_speed * 1000000);
- if_linkstate_change_drv(ifp, LINK_STATE_UP);
+ if_link_state_change(ifp, LINK_STATE_UP);
} else if (!link_check && (adapter->link_active == 1)) {
if_setbaudrate(ifp, 0);
adapter->link_speed = 0;
@@ -2342,7 +2342,7 @@ em_update_link_status(struct adapter *adapter)
/* Link down, disable watchdog */
for (int i = 0; i < adapter->num_queues; i++, txr++)
txr->queue_status = EM_QUEUE_IDLE;
- if_linkstate_change_drv(ifp, LINK_STATE_DOWN);
+ if_link_state_change(ifp, LINK_STATE_DOWN);
}
}
@@ -2934,7 +2934,7 @@ em_setup_interface(device_t dev, struct adapter *adapter)
device_printf(dev, "can not allocate ifnet structure\n");
return (-1);
}
- if_initname_drv(ifp, device_get_name(dev), device_get_unit(dev));
+ if_initname(ifp, device_get_name(dev), device_get_unit(dev));
if_setdev(ifp, dev);
if_setinitfn(ifp, em_init);
if_setsoftc(ifp, adapter);
@@ -2950,7 +2950,7 @@ em_setup_interface(device_t dev, struct adapter *adapter)
if_setsendqready(ifp);
#endif
- ether_ifattach_drv(ifp, adapter->hw.mac.addr);
+ ether_ifattach(ifp, adapter->hw.mac.addr);
if_setcapabilities(ifp, 0);
if_setcapenable(ifp, 0);
@@ -2991,7 +2991,7 @@ em_setup_interface(device_t dev, struct adapter *adapter)
* Specify the media types supported by this adapter and register
* callbacks to update media and link information
*/
- ifmedia_init_drv(&adapter->media, IFM_IMASK,
+ ifmedia_init(&adapter->media, IFM_IMASK,
em_media_change, em_media_status);
if ((adapter->hw.phy.media_type == e1000_media_type_fiber) ||
(adapter->hw.phy.media_type == e1000_media_type_internal_serdes)) {
diff --git a/sys/dev/e1000/if_lem.c b/sys/dev/e1000/if_lem.c
index 53dc92118429..8424870c7570 100644
--- a/sys/dev/e1000/if_lem.c
+++ b/sys/dev/e1000/if_lem.c
@@ -752,7 +752,7 @@ err_csb:
err_pci:
if (adapter->ifp != (void *)NULL)
- if_free_drv(adapter->ifp);
+ if_free(adapter->ifp);
lem_free_pci_resources(adapter);
free(adapter->mta, M_DEVBUF);
EM_TX_LOCK_DESTROY(adapter);
@@ -811,7 +811,7 @@ lem_detach(device_t dev)
if (adapter->vlan_detach != NULL)
EVENTHANDLER_DEREGISTER(vlan_unconfig, adapter->vlan_detach);
- ether_ifdetach_drv(adapter->ifp);
+ ether_ifdetach(adapter->ifp);
callout_drain(&adapter->timer);
callout_drain(&adapter->tx_fifo_timer);
@@ -820,7 +820,7 @@ lem_detach(device_t dev)
#endif /* DEV_NETMAP */
lem_free_pci_resources(adapter);
bus_generic_detach(dev);
- if_free_drv(ifp);
+ if_free(ifp);
lem_free_transmit_structures(adapter);
lem_free_receive_structures(adapter);
@@ -1020,10 +1020,10 @@ lem_ioctl(if_t ifp, u_long command, caddr_t data)
lem_init(adapter);
#ifdef INET
if (!(if_getflags(ifp) & IFF_NOARP))
- arp_ifinit_drv(ifp, ifa);
+ arp_ifinit(ifp, ifa);
#endif
} else
- error = ether_ioctl_drv(ifp, command, data);
+ error = ether_ioctl(ifp, command, data);
break;
case SIOCSIFMTU:
{
@@ -1106,7 +1106,7 @@ lem_ioctl(if_t ifp, u_long command, caddr_t data)
case SIOCGIFMEDIA:
IOCTL_DEBUGOUT("ioctl rcv'd: \
SIOCxIFMEDIA (Get/Set Interface Media)");
- error = ifmedia_ioctl_drv(ifp, ifr, &adapter->media, command);
+ error = ifmedia_ioctl(ifp, ifr, &adapter->media, command);
break;
case SIOCSIFCAP:
{
@@ -1157,7 +1157,7 @@ lem_ioctl(if_t ifp, u_long command, caddr_t data)
}
default:
- error = ether_ioctl_drv(ifp, command, data);
+ error = ether_ioctl(ifp, command, data);
break;
}
@@ -2159,7 +2159,7 @@ lem_update_link_status(struct adapter *adapter)
adapter->link_active = 1;
adapter->smartspeed = 0;
if_setbaudrate(ifp, adapter->link_speed * 1000000);
- if_linkstate_change_drv(ifp, LINK_STATE_UP);
+ if_link_state_change(ifp, LINK_STATE_UP);
} else if (!link_check && (adapter->link_active == 1)) {
if_setbaudrate(ifp, 0);
adapter->link_speed = 0;
@@ -2169,7 +2169,7 @@ lem_update_link_status(struct adapter *adapter)
adapter->link_active = 0;
/* Link down, disable watchdog */
adapter->watchdog_check = FALSE;
- if_linkstate_change_drv(ifp, LINK_STATE_DOWN);
+ if_link_state_change(ifp, LINK_STATE_DOWN);
}
}
@@ -2458,7 +2458,7 @@ lem_setup_interface(device_t dev, struct adapter *adapter)
device_printf(dev, "can not allocate ifnet structure\n");
return (-1);
}
- if_initname_drv(ifp, device_get_name(dev), device_get_unit(dev));
+ if_initname(ifp, device_get_name(dev), device_get_unit(dev));
if_setinitfn(ifp, lem_init);
if_setsoftc(ifp, adapter);
if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST);
@@ -2467,7 +2467,7 @@ lem_setup_interface(device_t dev, struct adapter *adapter)
if_setsendqlen(ifp, adapter->num_tx_desc - 1);
if_setsendqready(ifp);
- ether_ifattach_drv(ifp, adapter->hw.mac.addr);
+ ether_ifattach(ifp, adapter->hw.mac.addr);
if_setcapabilities(ifp, 0);
@@ -2507,7 +2507,7 @@ lem_setup_interface(device_t dev, struct adapter *adapter)
* Specify the media types supported by this adapter and register
* callbacks to update media and link information
*/
- ifmedia_init_drv(&adapter->media, IFM_IMASK,
+ ifmedia_init(&adapter->media, IFM_IMASK,
lem_media_change, lem_media_status);
if ((adapter->hw.phy.media_type == e1000_media_type_fiber) ||
(adapter->hw.phy.media_type == e1000_media_type_internal_serdes)) {
diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c
index 7df9ac3e7564..4b288bc9c707 100644
--- a/sys/dev/fxp/if_fxp.c
+++ b/sys/dev/fxp/if_fxp.c
@@ -439,7 +439,7 @@ fxp_attach(device_t dev)
mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
MTX_DEF);
callout_init_mtx(&sc->stat_ch, &sc->sc_mtx, 0);
- ifmedia_init_drv(&sc->sc_media, 0, fxp_serial_ifmedia_upd,
+ ifmedia_init(&sc->sc_media, 0, fxp_serial_ifmedia_upd,
fxp_serial_ifmedia_sts);
ifp = sc->ifp = if_gethandle(IFT_ETHER);
@@ -837,7 +837,7 @@ fxp_attach(device_t dev)
}
}
- if_initname_drv(ifp, device_get_name(dev), device_get_unit(dev));
+ if_initname(ifp, device_get_name(dev), device_get_unit(dev));
if_setdev(ifp, dev);
if_setinitfn(ifp, fxp_init);
if_setsoftc(ifp, sc);
@@ -873,7 +873,7 @@ fxp_attach(device_t dev)
/*
* Attach the interface.
*/
- ether_ifattach_drv(ifp, eaddr);
+ ether_ifattach(ifp, eaddr);
/*
* Tell the upper layer(s) we support long frames.
@@ -904,7 +904,7 @@ fxp_attach(device_t dev)
NULL, fxp_intr, sc, &sc->ih);
if (error) {
device_printf(dev, "could not setup irq\n");
- ether_ifdetach_drv(sc->ifp);
+ ether_ifdetach(sc->ifp);
goto fail;
}
@@ -993,7 +993,7 @@ fxp_release(struct fxp_softc *sc)
if (sc->mcs_tag)
bus_dma_tag_destroy(sc->mcs_tag);
if (sc->ifp)
- if_free_drv(sc->ifp);
+ if_free(sc->ifp);
mtx_destroy(&sc->sc_mtx);
}
@@ -1023,7 +1023,7 @@ fxp_detach(device_t dev)
/*
* Close down routes etc.
*/
- ether_ifdetach_drv(sc->ifp);
+ ether_ifdetach(sc->ifp);
/*
* Unhook interrupt before dropping lock. This is to prevent
@@ -2874,10 +2874,10 @@ fxp_ioctl(if_t ifp, u_long command, caddr_t data)
case SIOCGIFMEDIA:
if (sc->miibus != NULL) {
mii = device_get_softc(sc->miibus);
- error = ifmedia_ioctl_drv(ifp, ifr,
+ error = ifmedia_ioctl(ifp, ifr,
&mii->mii_media, command);
} else {
- error = ifmedia_ioctl_drv(ifp, ifr, &sc->sc_media, command);
+ error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, command);
}
break;
@@ -2966,7 +2966,7 @@ fxp_ioctl(if_t ifp, u_long command, caddr_t data)
break;
default:
- error = ether_ioctl_drv(ifp, command, data);
+ error = ether_ioctl(ifp, command, data);
}
return (error);
}
diff --git a/sys/dev/mii/mii.c b/sys/dev/mii/mii.c
index bdd3349ec41e..555dc0599d1c 100644
--- a/sys/dev/mii/mii.c
+++ b/sys/dev/mii/mii.c
@@ -330,7 +330,7 @@ miibus_linkchg(device_t dev)
link_state = LINK_STATE_DOWN;
} else
link_state = LINK_STATE_UNKNOWN;
- if_linkstate_change_drv(mii->mii_ifp, link_state);
+ if_link_state_change(mii->mii_ifp, link_state);
}
static void
@@ -358,7 +358,7 @@ miibus_mediainit(device_t dev)
* the PHYs to the network interface driver parent.
*/
int
-mii_attach(device_t dev, device_t *miibus, void *ifp,
+mii_attach(device_t dev, device_t *miibus, if_t ifp,
ifm_change_cb_t ifmedia_upd, ifm_stat_cb_t ifmedia_sts, int capmask,
int phyloc, int offloc, int flags)
{
diff --git a/sys/dev/nfe/if_nfe.c b/sys/dev/nfe/if_nfe.c
index 85821b10d8c7..0c0ae5cf60f4 100644
--- a/sys/dev/nfe/if_nfe.c
+++ b/sys/dev/nfe/if_nfe.c
@@ -591,7 +591,7 @@ nfe_attach(device_t dev)
nfe_sysctl_node(sc);
if_setsoftc(ifp, sc);
- if_initname_drv(ifp, device_get_name(dev), device_get_unit(dev));
+ if_initname(ifp, device_get_name(dev), device_get_unit(dev));
if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST);
if_setioctlfn(ifp, nfe_ioctl);
if_setstartfn(ifp, nfe_start);
@@ -624,8 +624,8 @@ nfe_attach(device_t dev)
/*
* Tell the upper layer(s) we support long frames.
- * Must appear after the call to ether_ifattach_drv() because
- * ether_ifattach_drv() sets ifi_hdrlen to the default value.
+ * Must appear after the call to ether_ifattach() because
+ * ether_ifattach() sets ifi_hdrlen to the default value.
*/
if_setifheaderlen(ifp, sizeof(struct ether_vlan_header));
@@ -649,7 +649,7 @@ nfe_attach(device_t dev)
device_printf(dev, "attaching PHYs failed\n");
goto fail;
}
- ether_ifattach_drv(ifp, sc->eaddr);
+ ether_ifattach(ifp, sc->eaddr);
TASK_INIT(&sc->nfe_int_task, 0, nfe_int_task, sc);
sc->nfe_tq = taskqueue_create_fast("nfe_taskq", M_WAITOK,
@@ -674,7 +674,7 @@ nfe_attach(device_t dev)
device_printf(dev, "couldn't set up irq\n");
taskqueue_free(sc->nfe_tq);
sc->nfe_tq = NULL;
- ether_ifdetach_drv(ifp);
+ ether_ifdetach(ifp);
goto fail;
}
@@ -708,7 +708,7 @@ nfe_detach(device_t dev)
if_setflagbits(ifp, 0, IFF_UP);
NFE_UNLOCK(sc);
callout_drain(&sc->nfe_stat_ch);
- ether_ifdetach_drv(ifp);
+ ether_ifdetach(ifp);
}
if (ifp) {
@@ -720,7 +720,7 @@ nfe_detach(device_t dev)
} else
bcopy(sc->eaddr, eaddr, ETHER_ADDR_LEN);
nfe_set_macaddr(sc, eaddr);
- if_free_drv(ifp);
+ if_free(ifp);
}
if (sc->nfe_miibus)
device_delete_child(dev, sc->nfe_miibus);
@@ -1775,7 +1775,7 @@ nfe_ioctl(if_t ifp, u_long cmd, caddr_t data)
case SIOCSIFMEDIA:
case SIOCGIFMEDIA:
mii = device_get_softc(sc->nfe_miibus);
- error = ifmedia_ioctl_drv(ifp, ifr, &mii->mii_media, cmd);
+ error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, cmd);
break;
case SIOCSIFCAP:
mask = ifr->ifr_reqcap ^ if_getcapenable(ifp);
@@ -1853,7 +1853,7 @@ nfe_ioctl(if_t ifp, u_long cmd, caddr_t data)
if_vlancap(ifp);
break;
default:
- error = ether_ioctl_drv(ifp, cmd, data);
+ error = ether_ioctl(ifp, cmd, data);
break;
}
diff --git a/sys/net/if.c b/sys/net/if.c
index 853f887e0c21..06993e3cb46e 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -3529,9 +3529,8 @@ if_deregister_com_alloc(u_char type)
/* API for driver access to network stack owned ifnet.*/
uint64_t
-if_setbaudrate(void *arg, uint64_t baudrate)
+if_setbaudrate(struct ifnet *ifp, uint64_t baudrate)
{
- struct ifnet *ifp = arg;
uint64_t oldbrate;
oldbrate = ifp->if_baudrate;
@@ -4035,13 +4034,13 @@ if_setinitfn(if_t ifp, void (*init_fn)(void *))
}
void
-if_setioctlfn(if_t ifp, int (*ioctl_fn)(void *, u_long, caddr_t))
+if_setioctlfn(if_t ifp, int (*ioctl_fn)(if_t, u_long, caddr_t))
{
((struct ifnet *)ifp)->if_ioctl = (void *)ioctl_fn;
}
void
-if_setstartfn(if_t ifp, void (*start_fn)(void *))
+if_setstartfn(if_t ifp, void (*start_fn)(if_t))
{
((struct ifnet *)ifp)->if_start = (void *)start_fn;
}
@@ -4058,90 +4057,6 @@ void if_setqflushfn(if_t ifp, if_qflush_fn_t flush_fn)
}
-/* These wrappers are hopefully temporary, till all drivers use drvapi */
-#ifdef INET
-void
-arp_ifinit_drv(if_t ifh, struct ifaddr *ifa)
-{
- arp_ifinit((struct ifnet *)ifh, ifa);
-}
-#endif
-
-void
-ether_ifattach_drv(if_t ifh, const u_int8_t *lla)
-{
- ether_ifattach((struct ifnet *)ifh, lla);
-}
-
-void
-ether_ifdetach_drv(if_t ifh)
-{
- ether_ifdetach((struct ifnet *)ifh);
-}
-
-int
-ether_ioctl_drv(if_t ifh, u_long cmd, caddr_t data)
-{
- struct ifnet *ifp = (struct ifnet *)ifh;
-
- return (ether_ioctl(ifp, cmd, data));
-}
-
-int
-ifmedia_ioctl_drv(if_t ifh, struct ifreq *ifr, struct ifmedia *ifm,
- u_long cmd)
-{
- struct ifnet *ifp = (struct ifnet *)ifh;
-
- return (ifmedia_ioctl(ifp, ifr, ifm, cmd));
-}
-
-void
-if_free_drv(if_t ifh)
-{
- if_free((struct ifnet *)ifh);
-}
-
-void
-if_initname_drv(if_t ifh, const char *name, int unit)
-{
- if_initname((struct ifnet *)ifh, name, unit);
-}
-
-void
-if_linkstate_change_drv(if_t ifh, int link_state)
-{
- if_link_state_change((struct ifnet *)ifh, link_state);
-}
-
-void
-ifmedia_init_drv(struct ifmedia *ifm, int ncmask, int (*chg_cb)(void *),
- void (*sts_cb)(void *, struct ifmediareq *))
-{
- ifmedia_init(ifm, ncmask, (ifm_change_cb_t)chg_cb,
- (ifm_stat_cb_t)sts_cb);
-}
-
-void
-if_addr_rlock_drv(if_t ifh)
-{
-
- if_addr_runlock((struct ifnet *)ifh);
-}
-
-void
-if_addr_runlock_drv(if_t ifh)
-{
- if_addr_runlock((struct ifnet *)ifh);
-}
-
-void
-if_qflush_drv(if_t ifh)
-{
- if_qflush((struct ifnet *)ifh);
-
-}
-
/* Revisit these - These are inline functions originally. */
int
drbr_inuse_drv(if_t ifh, struct buf_ring *br)
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index 8844892d90c2..adff88636819 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -110,15 +110,14 @@ typedef enum {
IFCOUNTER_NOPROTO,
} ifnet_counter;
-typedef void (*if_start_fn_t)(struct ifnet *);
-typedef int (*if_ioctl_fn_t)(struct ifnet *, u_long, caddr_t);
-typedef void (*if_init_fn_t)(void *);
-typedef void (*if_qflush_fn_t)(struct ifnet *);
-typedef int (*if_transmit_fn_t)(struct ifnet *, struct mbuf *);
-typedef uint64_t (*if_get_counter_t)(struct ifnet *, ifnet_counter);
+typedef struct ifnet * if_t;
-/* Opaque object pointing to interface structure (ifnet) */
-typedef void *if_t;
+typedef void (*if_start_fn_t)(if_t);
+typedef int (*if_ioctl_fn_t)(if_t, u_long, caddr_t);
+typedef void (*if_init_fn_t)(void *);
+typedef void (*if_qflush_fn_t)(if_t);
+typedef int (*if_transmit_fn_t)(if_t, struct mbuf *);
+typedef uint64_t (*if_get_counter_t)(if_t, ifnet_counter);
/*
* Structure defining a network interface.
@@ -585,9 +584,6 @@ int if_multiaddr_count(if_t ifp, int max);
int if_getamcount(if_t ifp);
struct ifaddr * if_getifaddr(if_t ifp);
-/* Shim for drivers using drvapi */
-int ifmedia_ioctl_drv(if_t ifp, struct ifreq *ifr, struct ifmedia *ifm,
- u_long cmd);
/* Statistics */
@@ -612,29 +608,11 @@ int if_setimcasts(if_t ifp, int pkts);
/* Functions */
void if_setinitfn(if_t ifp, void (*)(void *));
-void if_setioctlfn(if_t ifp, int (*)(void *, u_long, caddr_t));
-void if_setstartfn(if_t ifp, void (*)(void *));
+void if_setioctlfn(if_t ifp, int (*)(if_t, u_long, caddr_t));
+void if_setstartfn(if_t ifp, void (*)(if_t));
void if_settransmitfn(if_t ifp, if_transmit_fn_t);
void if_setqflushfn(if_t ifp, if_qflush_fn_t);
-
-/* Shim functions till all drivers use drvapi */
-void arp_ifinit_drv(if_t ifp, struct ifaddr *ifa);
-void ether_ifattach_drv(if_t ifp, const u_int8_t *lla);
-void ether_ifdetach_drv(if_t ifp);
-int ether_ioctl_drv(if_t ifp, u_long cmd, caddr_t data);
-void if_free_drv(if_t ifp);
-void if_initname_drv(if_t ifp, const char *name, int unit);
-void if_linkstate_change_drv(if_t ifp, int link_state);
-
-struct ifmedia;
-void ifmedia_init_drv(struct ifmedia *, int, int (*)(void *),
- void (*)(void *, struct ifmediareq *));
-
-void if_addr_rlock_drv(if_t ifp);
-void if_addr_runlock_drv(if_t ifp);
-void if_qflush_drv(if_t ifp);
-
/* Revisit the below. These are inline functions originally */
int drbr_inuse_drv(if_t ifp, struct buf_ring *br);
struct mbuf* drbr_dequeue_drv(if_t ifp, struct buf_ring *br);