Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Oct 2017 17:50:43 +0000 (UTC)
From:      Stephen Hurd <shurd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325241 - head/sys/net
Message-ID:  <201710311750.v9VHohcI095794@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: shurd
Date: Tue Oct 31 17:50:42 2017
New Revision: 325241
URL: https://svnweb.freebsd.org/changeset/base/325241

Log:
  Fix PR221990 - Assertion at iflib.c:1947
  
  ifl_pidx and ifl_credits are going out of sync in _iflib_fl_refill() as they
  use different update log.  Use the same update logic for both, and add a
  final call to isc_rxd_refill() to handle early exits from the loop.
  
  PR:		221990
  Reported by:	pho
  Reviewed by:	sbruno
  Approved by:	sbruno (mentor)
  Sponsored by:	Limelight Networks
  Differential Revision:	https://reviews.freebsd.org/D12798

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==============================================================================
--- head/sys/net/iflib.c	Tue Oct 31 17:16:46 2017	(r325240)
+++ head/sys/net/iflib.c	Tue Oct 31 17:50:42 2017	(r325241)
@@ -1818,20 +1818,22 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun
 	int n, i = 0;
 	uint64_t bus_addr;
 	int err;
+	qidx_t credits;
 
 	sd_m = fl->ifl_sds.ifsd_m;
 	sd_map = fl->ifl_sds.ifsd_map;
 	sd_cl = fl->ifl_sds.ifsd_cl;
 	sd_flags = fl->ifl_sds.ifsd_flags;
 	idx = pidx;
+	credits = fl->ifl_credits;
 
 	n  = count;
 	MPASS(n > 0);
-	MPASS(fl->ifl_credits + n <= fl->ifl_size);
+	MPASS(credits + n <= fl->ifl_size);
 
 	if (pidx < fl->ifl_cidx)
 		MPASS(pidx + n <= fl->ifl_cidx);
-	if (pidx == fl->ifl_cidx && (fl->ifl_credits < fl->ifl_size))
+	if (pidx == fl->ifl_cidx && (credits < fl->ifl_size))
 		MPASS(fl->ifl_gen == 0);
 	if (pidx > fl->ifl_cidx)
 		MPASS(n <= fl->ifl_size - pidx + fl->ifl_cidx);
@@ -1904,9 +1906,9 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun
 		fl->ifl_rxd_idxs[i] = frag_idx;
 		fl->ifl_bus_addrs[i] = bus_addr;
 		fl->ifl_vm_addrs[i] = cl;
-		fl->ifl_credits++;
+		credits++;
 		i++;
-		MPASS(fl->ifl_credits <= fl->ifl_size);
+		MPASS(credits <= fl->ifl_size);
 		if (++idx == fl->ifl_size) {
 			fl->ifl_gen = 1;
 			idx = 0;
@@ -1918,10 +1920,18 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun
 			i = 0;
 			pidx = idx;
 			fl->ifl_pidx = idx;
+			fl->ifl_credits = credits;
 		}
 
 	}
 done:
+	if (i) {
+		iru.iru_pidx = pidx;
+		iru.iru_count = i;
+		ctx->isc_rxd_refill(ctx->ifc_softc, &iru);
+		fl->ifl_pidx = idx;
+		fl->ifl_credits = credits;
+	}
 	DBG_COUNTER_INC(rxd_flush);
 	if (fl->ifl_pidx == 0)
 		pidx = fl->ifl_size - 1;



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