From ddaf4d42d31fdf61e3448ac000274c876fb60d68 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Mon, 28 Jan 2013 17:45:50 +0800 Subject: [PATCH] igb: Add per-TX ring enable flag. For TX rings' whose enable flag are not set, which could happen during polling entering/exiting, its corresponding subqueue will be purged. --- sys/dev/netif/igb/if_igb.c | 6 +++++- sys/dev/netif/igb/if_igb.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/dev/netif/igb/if_igb.c b/sys/dev/netif/igb/if_igb.c index f588b4a40c..03d1c60918 100644 --- a/sys/dev/netif/igb/if_igb.c +++ b/sys/dev/netif/igb/if_igb.c @@ -1293,6 +1293,7 @@ igb_stop(struct igb_softc *sc) for (i = 0; i < sc->tx_ring_cnt; ++i) { ifsq_clr_oactive(sc->tx_rings[i].ifsq); ifsq_watchdog_stop(&sc->tx_rings[i].tx_watchdog); + sc->tx_rings[i].tx_flags &= ~IGB_TXFLAG_ENABLED; } e1000_reset_hw(&sc->hw); @@ -1856,6 +1857,9 @@ igb_init_tx_ring(struct igb_tx_ring *txr) /* Set number of descriptors available */ txr->tx_avail = txr->num_tx_desc; + + /* Enable this TX ring */ + txr->tx_flags |= IGB_TXFLAG_ENABLED; } static void @@ -3369,7 +3373,7 @@ igb_start(struct ifnet *ifp, struct ifaltq_subque *ifsq) if ((ifp->if_flags & IFF_RUNNING) == 0 || ifsq_is_oactive(ifsq)) return; - if (!sc->link_active) { + if (!sc->link_active || (txr->tx_flags & IGB_TXFLAG_ENABLED) == 0) { ifsq_purge(ifsq); return; } diff --git a/sys/dev/netif/igb/if_igb.h b/sys/dev/netif/igb/if_igb.h index faae39e542..b0a59841c0 100644 --- a/sys/dev/netif/igb/if_igb.h +++ b/sys/dev/netif/igb/if_igb.h @@ -228,6 +228,7 @@ struct igb_tx_ring { uint32_t me; uint32_t tx_flags; #define IGB_TXFLAG_TSO_IPLEN0 0x1 +#define IGB_TXFLAG_ENABLED 0x2 struct e1000_tx_desc *tx_base; int num_tx_desc; uint32_t next_avail_desc; -- 2.41.0