Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 May 2019 13:31:36 +0000 (UTC)
From:      Marcin Wojtas <mw@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r348404 - head/sys/dev/ena
Message-ID:  <201905301331.x4UDVaxK067588@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mw
Date: Thu May 30 13:31:35 2019
New Revision: 348404
URL: https://svnweb.freebsd.org/changeset/base/348404

Log:
  Limit maximum size of Rx refill threshold in ENA
  
  The Rx ring size can be as high as 8k. Because of that we want to limit
  the cleanup threshold by maximum value of 256.
  
  Submitted by:  Michal Krawczyk <mk@semihalf.com>
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  head/sys/dev/ena/ena.c
  head/sys/dev/ena/ena.h

Modified: head/sys/dev/ena/ena.c
==============================================================================
--- head/sys/dev/ena/ena.c	Thu May 30 13:30:52 2019	(r348403)
+++ head/sys/dev/ena/ena.c	Thu May 30 13:31:35 2019	(r348404)
@@ -1781,7 +1781,9 @@ ena_rx_cleanup(struct ena_ring *rx_ring)
 	rx_ring->next_to_clean = next_to_clean;
 
 	refill_required = ena_com_free_desc(io_sq);
-	refill_threshold = rx_ring->ring_size / ENA_RX_REFILL_THRESH_DIVIDER;
+	refill_threshold = min_t(int,
+	    rx_ring->ring_size / ENA_RX_REFILL_THRESH_DIVIDER,
+	    ENA_RX_REFILL_THRESH_PACKET);
 
 	if (refill_required > refill_threshold) {
 		ena_com_update_dev_comp_head(rx_ring->ena_com_io_cq);

Modified: head/sys/dev/ena/ena.h
==============================================================================
--- head/sys/dev/ena/ena.h	Thu May 30 13:30:52 2019	(r348403)
+++ head/sys/dev/ena/ena.h	Thu May 30 13:31:35 2019	(r348404)
@@ -70,7 +70,12 @@
 
 #define	ENA_DEFAULT_RING_SIZE		1024
 
+/*
+ * Refill Rx queue when number of required descriptors is above
+ * QUEUE_SIZE / ENA_RX_REFILL_THRESH_DIVIDER or ENA_RX_REFILL_THRESH_PACKET
+ */
 #define	ENA_RX_REFILL_THRESH_DIVIDER	8
+#define	ENA_RX_REFILL_THRESH_PACKET	256
 
 #define	ENA_IRQNAME_SIZE		40
 



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