]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
net: ena: limit refill Rx threshold to 256 to avoid latency issues
authorArthur Kiyanovski <akiyano@amazon.com>
Thu, 11 Oct 2018 08:26:23 +0000 (11:26 +0300)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fri, 9 Nov 2018 19:00:49 +0000 (17:00 -0200)
BugLink: http://bugs.launchpad.net/bugs/1798182
Currently Rx refill is done when the number of required descriptors is
above 1/8 queue size. With a default of 1024 entries per queue the
threshold is 128 descriptors.
There is intention to increase the queue size to 8196 entries.
In this case threshold of 1024 descriptors is too large and can hurt
latency.
Add another limitation to Rx threshold to be at most 256 descriptors.

Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0574bb806dad29a3dada0ee42b01645477d48282 linux-next)
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Acked-by: Khalid Elmously <khalid.elmously@canonical.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/ethernet/amazon/ena/ena_netdev.c
drivers/net/ethernet/amazon/ena/ena_netdev.h

index 8e9bdcc861e4c75d5a02bce4cae4958f3b910a58..3f08031cc7689af54caab93b6a67723b83e6faee 100644 (file)
@@ -1123,7 +1123,9 @@ static int ena_clean_rx_irq(struct ena_ring *rx_ring, struct napi_struct *napi,
        rx_ring->next_to_clean = next_to_clean;
 
        refill_required = ena_com_free_desc(rx_ring->ena_com_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);
 
        /* Optimization, try to batch new rx buffers */
        if (refill_required > refill_threshold) {
index a16baf0124d5021b11da7e54ae64299b2ec7bbab..0cf35ae778846f36e062d78096d986bc251c6fa6 100644 (file)
  */
 #define ENA_TX_POLL_BUDGET_DIVIDER     4
 
-/* Refill Rx queue when number of available descriptors is below
- * QUEUE_SIZE / ENA_RX_REFILL_THRESH_DIVIDER
+/* 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
 
 /* Number of queues to check for missing queues per timer service */
 #define ENA_MONITORED_TX_QUEUES        4