diff options
author | np <np@FreeBSD.org> | 2015-02-24 18:22:24 +0000 |
---|---|---|
committer | np <np@FreeBSD.org> | 2015-02-24 18:22:24 +0000 |
commit | 926d2742507c9065ae8062ceaf356962fe26542e (patch) | |
tree | a190650966837166fc5efe869b913517e87311a7 | |
parent | e277fe83b3e50f9af969b57aea344f4d6e52ca5f (diff) | |
download | FreeBSD-src-926d2742507c9065ae8062ceaf356962fe26542e.zip FreeBSD-src-926d2742507c9065ae8062ceaf356962fe26542e.tar.gz |
cxgbe(4): wait for the hardware to catch up before destroying a netmap txq.
MFC after: 2 weeks
-rw-r--r-- | sys/dev/cxgbe/t4_netmap.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/dev/cxgbe/t4_netmap.c b/sys/dev/cxgbe/t4_netmap.c index 3f8b6ee..ec87637 100644 --- a/sys/dev/cxgbe/t4_netmap.c +++ b/sys/dev/cxgbe/t4_netmap.c @@ -514,12 +514,17 @@ cxgbe_netmap_off(struct adapter *sc, struct port_info *pi, struct ifnet *ifp, if_printf(ifp, "netmap disable_vi failed: %d\n", rc); nm_clear_native_flags(na); - /* - * XXXNM: We need to make sure that the tx queues are quiet and won't - * request any more SGE_EGR_UPDATEs. - */ - for_each_nm_txq(pi, i, nm_txq) { + struct sge_qstat *spg = (void *)&nm_txq->desc[nm_txq->sidx]; + + /* Wait for hw pidx to catch up ... */ + while (be16toh(nm_txq->pidx) != spg->pidx) + pause("nmpidx", 1); + + /* ... and then for the cidx. */ + while (spg->pidx != spg->cidx) + pause("nmcidx", 1); + free_nm_txq_hwq(pi, nm_txq); } for_each_nm_rxq(pi, i, nm_rxq) { |