svn commit: r321630 - head/sys/net

Sean Bruno sbruno at FreeBSD.org
Thu Jul 27 22:53:48 UTC 2017


Author: sbruno
Date: Thu Jul 27 22:53:47 2017
New Revision: 321630
URL: https://svnweb.freebsd.org/changeset/base/321630

Log:
  Slight restructure of iflib_busdma_load_mbuf_sg() to fix accounting
  when m_collapse() fails.
  
  Submitted by:	krzystof.galazka at intel.com
  Reviewed by:	Jeb Cramer <cramerj at intel.com>
  Sponsored by:	Intel Corporation
  Differential Revision:	https://reviews.freebsd.org/D11476

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==============================================================================
--- head/sys/net/iflib.c	Thu Jul 27 21:21:43 2017	(r321629)
+++ head/sys/net/iflib.c	Thu Jul 27 22:53:47 2017	(r321630)
@@ -2975,6 +2975,8 @@ iflib_busdma_load_mbuf_sg(iflib_txq_t txq, bus_dma_tag
 #endif
 			ifsd_m[next] = m;
 			while (buflen > 0) {
+				if (i >= max_segs)
+					goto err;
 				max_sgsize = MIN(buflen, maxsegsz);
 				curaddr = pmap_kextract(vaddr);
 				sgsize = PAGE_SIZE - (curaddr & PAGE_MASK);
@@ -2984,8 +2986,6 @@ iflib_busdma_load_mbuf_sg(iflib_txq_t txq, bus_dma_tag
 				vaddr += sgsize;
 				buflen -= sgsize;
 				i++;
-				if (i >= max_segs)
-					goto err;
 			}
 			count++;
 			tmp = m;


More information about the svn-src-all mailing list