svn commit: r339342 - head/sys/dev/cxgbe

Navdeep Parhar np at FreeBSD.org
Sat Oct 13 00:13:25 UTC 2018


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,


More information about the svn-src-all mailing list