From owner-svn-src-all@FreeBSD.ORG Tue Feb 24 18:22:25 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B3E01C85; Tue, 24 Feb 2015 18:22:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A068E14B; Tue, 24 Feb 2015 18:22:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t1OIMPJd056779; Tue, 24 Feb 2015 18:22:25 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t1OIMPXi056778; Tue, 24 Feb 2015 18:22:25 GMT (envelope-from np@FreeBSD.org) Message-Id: <201502241822.t1OIMPXi056778@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 24 Feb 2015 18:22:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r279244 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Feb 2015 18:22:25 -0000 Author: np Date: Tue Feb 24 18:22:24 2015 New Revision: 279244 URL: https://svnweb.freebsd.org/changeset/base/279244 Log: cxgbe(4): wait for the hardware to catch up before destroying a netmap txq. MFC after: 2 weeks Modified: head/sys/dev/cxgbe/t4_netmap.c Modified: head/sys/dev/cxgbe/t4_netmap.c ============================================================================== --- head/sys/dev/cxgbe/t4_netmap.c Tue Feb 24 18:19:25 2015 (r279243) +++ head/sys/dev/cxgbe/t4_netmap.c Tue Feb 24 18:22:24 2015 (r279244) @@ -514,12 +514,17 @@ cxgbe_netmap_off(struct adapter *sc, str 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) {