Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Oct 2018 00:13:25 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r339342 - head/sys/dev/cxgbe
Message-ID:  <201810130013.w9D0DPKO069587@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Sat Oct 13 00:13:24 2018
New Revision: 339342
URL: https://svnweb.freebsd.org/changeset/base/339342

Log:
  cxgbe(4): Fix a divide-by-zero that occurs when hw.cxgbe.toecaps_allowed
  is set to 0 with a kernel that has both TCP_OFFLOAD and RATELIMIT.
  
  Approved by:	re@ (gjb@)
  Sponsored by:	Chelsio Communications

Modified:
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/t4_sge.c
==============================================================================
--- head/sys/dev/cxgbe/t4_sge.c	Fri Oct 12 23:48:10 2018	(r339341)
+++ head/sys/dev/cxgbe/t4_sge.c	Sat Oct 13 00:13:24 2018	(r339342)
@@ -1245,15 +1245,16 @@ t4_setup_vi_queues(struct vi_info *vi)
 
 		snprintf(name, sizeof(name), "%s ofld_txq%d",
 		    device_get_nameunit(vi->dev), i);
-#ifdef TCP_OFFLOAD
-		iqidx = vi->first_ofld_rxq + (i % vi->nofldrxq);
-		init_eq(sc, &ofld_txq->eq, EQ_OFLD, vi->qsize_txq, pi->tx_chan,
-		    sc->sge.ofld_rxq[iqidx].iq.cntxt_id, name);
-#else
-		iqidx = vi->first_rxq + (i % vi->nrxq);
-		init_eq(sc, &ofld_txq->eq, EQ_OFLD, vi->qsize_txq, pi->tx_chan,
-		    sc->sge.rxq[iqidx].iq.cntxt_id, name);
-#endif
+		if (vi->nofldrxq > 0) {
+			iqidx = vi->first_ofld_rxq + (i % vi->nofldrxq);
+			init_eq(sc, &ofld_txq->eq, EQ_OFLD, vi->qsize_txq,
+			    pi->tx_chan, sc->sge.ofld_rxq[iqidx].iq.cntxt_id,
+			    name);
+		} else {
+			iqidx = vi->first_rxq + (i % vi->nrxq);
+			init_eq(sc, &ofld_txq->eq, EQ_OFLD, vi->qsize_txq,
+			    pi->tx_chan, sc->sge.rxq[iqidx].iq.cntxt_id, name);
+		}
 
 		snprintf(name, sizeof(name), "%d", i);
 		oid2 = SYSCTL_ADD_NODE(&vi->ctx, SYSCTL_CHILDREN(oid), OID_AUTO,



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