Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Apr 2011 18:18:07 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r220795 - stable/8/sys/dev/cxgbe
Message-ID:  <201104181818.p3III7D0080245@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Mon Apr 18 18:18:07 2011
New Revision: 220795
URL: http://svn.freebsd.org/changeset/base/220795

Log:
  MFC r220643:
  
  There is no need to request a tx credit flush if such a request is already
  pending.

Modified:
  stable/8/sys/dev/cxgbe/adapter.h
  stable/8/sys/dev/cxgbe/t4_main.c
  stable/8/sys/dev/cxgbe/t4_sge.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/cxgbe/adapter.h
==============================================================================
--- stable/8/sys/dev/cxgbe/adapter.h	Mon Apr 18 17:43:16 2011	(r220794)
+++ stable/8/sys/dev/cxgbe/adapter.h	Mon Apr 18 18:18:07 2011	(r220795)
@@ -260,7 +260,7 @@ enum {
 	/* eq flags */
 	EQ_ALLOCATED	= (1 << 1),	/* firmware resources allocated */
 	EQ_STARTED	= (1 << 2),	/* started */
-	EQ_STALLED	= (1 << 3),	/* currently stalled */
+	EQ_CRFLUSHED	= (1 << 3),	/* expecting an update from SGE */
 };
 
 /*

Modified: stable/8/sys/dev/cxgbe/t4_main.c
==============================================================================
--- stable/8/sys/dev/cxgbe/t4_main.c	Mon Apr 18 17:43:16 2011	(r220794)
+++ stable/8/sys/dev/cxgbe/t4_main.c	Mon Apr 18 18:18:07 2011	(r220795)
@@ -2673,6 +2673,7 @@ cxgbe_txq_start(void *arg, int count)
 	struct sge_txq *txq = arg;
 
 	TXQ_LOCK(txq);
+	txq->eq.flags &= ~EQ_CRFLUSHED;
 	txq_start(txq->ifp, txq);
 	TXQ_UNLOCK(txq);
 }

Modified: stable/8/sys/dev/cxgbe/t4_sge.c
==============================================================================
--- stable/8/sys/dev/cxgbe/t4_sge.c	Mon Apr 18 17:43:16 2011	(r220794)
+++ stable/8/sys/dev/cxgbe/t4_sge.c	Mon Apr 18 18:18:07 2011	(r220795)
@@ -876,7 +876,7 @@ doorbell:
 	 * WR that reduced it to 0 so we don't need another flush (we don't have
 	 * any descriptor for a flush WR anyway, duh).
 	 */
-	if (m && eq->avail > 0)
+	if (m && eq->avail > 0 && !(eq->flags & EQ_CRFLUSHED))
 		write_eqflush_wr(eq);
 	txq->m = m;
 
@@ -1882,8 +1882,11 @@ write_txpkt_wr(struct port_info *pi, str
 	wr->op_immdlen = htobe32(V_FW_WR_OP(FW_ETH_TX_PKT_WR) |
 	    V_FW_WR_IMMDLEN(ctrl));
 	ctrl = V_FW_WR_LEN16(howmany(nflits, 2));
-	if (eq->avail == ndesc)
+	if (eq->avail == ndesc && !(eq->flags & EQ_CRFLUSHED)) {
 		ctrl |= F_FW_WR_EQUEQ | F_FW_WR_EQUIQ;
+		eq->flags |= EQ_CRFLUSHED;
+	}
+
 	wr->equiq_to_len16 = htobe32(ctrl);
 	wr->r3 = 0;
 
@@ -2071,8 +2074,10 @@ write_txpkts_wr(struct sge_txq *txq, str
 	wr->op_immdlen = htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS_WR) |
 	    V_FW_WR_IMMDLEN(0)); /* immdlen does not matter in this WR */
 	ctrl = V_FW_WR_LEN16(howmany(txpkts->nflits, 2));
-	if (eq->avail == ndesc)
+	if (eq->avail == ndesc && !(eq->flags & EQ_CRFLUSHED)) {
 		ctrl |= F_FW_WR_EQUEQ | F_FW_WR_EQUIQ;
+		eq->flags |= EQ_CRFLUSHED;
+	}
 	wr->equiq_to_len16 = htobe32(ctrl);
 	wr->plen = htobe16(txpkts->plen);
 	wr->npkt = txpkts->npkt;
@@ -2083,7 +2088,7 @@ write_txpkts_wr(struct sge_txq *txq, str
 	txsd = &eq->sdesc[eq->pidx];
 	txsd->desc_used = ndesc;
 
-	KASSERT(eq->avail >= ndesc, ("%s: out ouf descriptors", __func__));
+	KASSERT(eq->avail >= ndesc, ("%s: out of descriptors", __func__));
 
 	eq->pending += ndesc;
 	eq->avail -= ndesc;
@@ -2384,6 +2389,7 @@ write_eqflush_wr(struct sge_eq *eq)
 	txsd->desc_used = 1;
 	txsd->map_used = 0;
 
+	eq->flags |= EQ_CRFLUSHED;
 	eq->pending++;
 	eq->avail--;
 	if (++eq->pidx == eq->cap)
@@ -2438,6 +2444,10 @@ handle_sge_egr_update(struct adapter *sc
 	struct port_info *pi;
 
 	txq = (void *)s->eqmap[qid - s->eq_start];
+
+	KASSERT(txq->eq.flags & EQ_CRFLUSHED,
+	    ("%s: tx queue %p not expecting an update.", __func__, txq));
+
 	pi = txq->ifp->if_softc;
 	taskqueue_enqueue(pi->tq, &txq->resume_tx);
 	txq->egr_update++;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104181818.p3III7D0080245>