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 <m...@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
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to