diff options
-rw-r--r-- | sys/mips/cavium/octe/octe.c | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/sys/mips/cavium/octe/octe.c b/sys/mips/cavium/octe/octe.c index daccb36..436a701 100644 --- a/sys/mips/cavium/octe/octe.c +++ b/sys/mips/cavium/octe/octe.c @@ -90,7 +90,7 @@ static int octe_miibus_writereg(device_t, int, int, int); static void octe_init(void *); static void octe_stop(void *); -static void octe_start(struct ifnet *); +static int octe_transmit(struct ifnet *, struct mbuf *); static int octe_mii_medchange(struct ifnet *); static void octe_mii_medstat(struct ifnet *, struct ifmediareq *); @@ -185,7 +185,6 @@ octe_attach(device_t dev) ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST | IFF_ALLMULTI; ifp->if_init = octe_init; ifp->if_ioctl = octe_ioctl; - ifp->if_start = octe_start; priv->if_flags = ifp->if_flags; @@ -198,6 +197,8 @@ octe_attach(device_t dev) ether_ifattach(ifp, priv->mac); + ifp->if_transmit = octe_transmit; + ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_HWCSUM; ifp->if_capenable = ifp->if_capabilities; @@ -317,38 +318,26 @@ octe_stop(void *arg) ifp->if_drv_flags &= ~IFF_DRV_RUNNING; } -static void -octe_start(struct ifnet *ifp) +static int +octe_transmit(struct ifnet *ifp, struct mbuf *m) { cvm_oct_private_t *priv; - struct mbuf *m; int error; priv = ifp->if_softc; - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) - return; - - OCTE_TX_LOCK(priv); - while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { - IFQ_DRV_DEQUEUE(&ifp->if_snd, m); - - OCTE_TX_UNLOCK(priv); - - if (priv->queue != -1) { - error = cvm_oct_xmit(m, ifp); - } else { - error = cvm_oct_xmit_pow(m, ifp); - } - - if (error != 0) { - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - return; - } + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING) { + m_freem(m); + return (0); + } - OCTE_TX_LOCK(priv); + if (priv->queue != -1) { + error = cvm_oct_xmit(m, ifp); + } else { + error = cvm_oct_xmit_pow(m, ifp); } - OCTE_TX_UNLOCK(priv); + return (error); } static int |