Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jun 2020 19:58:03 +0000 (UTC)
From:      Vincenzo Maffione <vmaffione@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r362020 - stable/12/sys/dev/netmap
Message-ID:  <202006101958.05AJw3mj025697@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: vmaffione
Date: Wed Jun 10 19:58:03 2020
New Revision: 362020
URL: https://svnweb.freebsd.org/changeset/base/362020

Log:
  MFC r361698
  
  netmap: if_vtnet: avoid netmap ring wraparound
  
  netmap assumes the one "slot" is left unused to distinguish
  the empty ring and full ring conditions. This assumption was
  violated by vtnet_netmap_rxq_populate().

Modified:
  stable/12/sys/dev/netmap/if_vtnet_netmap.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/netmap/if_vtnet_netmap.h
==============================================================================
--- stable/12/sys/dev/netmap/if_vtnet_netmap.h	Wed Jun 10 19:57:10 2020	(r362019)
+++ stable/12/sys/dev/netmap/if_vtnet_netmap.h	Wed Jun 10 19:58:03 2020	(r362020)
@@ -275,8 +275,8 @@ vtnet_netmap_rxq_populate(struct vtnet_rxq *rxq)
 	/* Expose all the RX netmap buffers we can. In case of no indirect
 	 * buffers, the number of netmap slots in the RX ring matches the
 	 * maximum number of 2-elements sglist that the RX virtqueue can
-	 * accommodate. */
-	error = vtnet_netmap_kring_refill(kring, na->num_rx_desc);
+	 * accommodate (minus 1 to avoid netmap ring wraparound). */
+	error = vtnet_netmap_kring_refill(kring, na->num_rx_desc - 1);
 	virtqueue_notify(rxq->vtnrx_vq);
 
 	return error < 0 ? ENXIO : 0;



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