aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Kiyanovski <akiyano@amazon.com>2018-10-11 04:26:23 -0400
committerDavid S. Miller <davem@davemloft.net>2018-10-11 13:13:51 -0400
commit0574bb806dad29a3dada0ee42b01645477d48282 (patch)
tree90ca00914c5a65cb39a81bb496f9c22dee112ba7
parentbd791175a6432d24fc5d7b348304276027372545 (diff)
net: ena: limit refill Rx threshold to 256 to avoid latency issues
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>
-rw-r--r--drivers/net/ethernet/amazon/ena/ena_netdev.c4
-rw-r--r--drivers/net/ethernet/amazon/ena/ena_netdev.h5
2 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 9927a5b76d7d..e71bf82ba753 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -1122,7 +1122,9 @@ static int ena_clean_rx_irq(struct ena_ring *rx_ring, struct napi_struct *napi,
1122 rx_ring->next_to_clean = next_to_clean; 1122 rx_ring->next_to_clean = next_to_clean;
1123 1123
1124 refill_required = ena_com_free_desc(rx_ring->ena_com_io_sq); 1124 refill_required = ena_com_free_desc(rx_ring->ena_com_io_sq);
1125 refill_threshold = rx_ring->ring_size / ENA_RX_REFILL_THRESH_DIVIDER; 1125 refill_threshold =
1126 min_t(int, rx_ring->ring_size / ENA_RX_REFILL_THRESH_DIVIDER,
1127 ENA_RX_REFILL_THRESH_PACKET);
1126 1128
1127 /* Optimization, try to batch new rx buffers */ 1129 /* Optimization, try to batch new rx buffers */
1128 if (refill_required > refill_threshold) { 1130 if (refill_required > refill_threshold) {
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.h b/drivers/net/ethernet/amazon/ena/ena_netdev.h
index a16baf0124d5..0cf35ae77884 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.h
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.h
@@ -106,10 +106,11 @@
106 */ 106 */
107#define ENA_TX_POLL_BUDGET_DIVIDER 4 107#define ENA_TX_POLL_BUDGET_DIVIDER 4
108 108
109/* Refill Rx queue when number of available descriptors is below 109/* Refill Rx queue when number of required descriptors is above
110 * QUEUE_SIZE / ENA_RX_REFILL_THRESH_DIVIDER 110 * QUEUE_SIZE / ENA_RX_REFILL_THRESH_DIVIDER or ENA_RX_REFILL_THRESH_PACKET
111 */ 111 */
112#define ENA_RX_REFILL_THRESH_DIVIDER 8 112#define ENA_RX_REFILL_THRESH_DIVIDER 8
113#define ENA_RX_REFILL_THRESH_PACKET 256
113 114
114/* Number of queues to check for missing queues per timer service */ 115/* Number of queues to check for missing queues per timer service */
115#define ENA_MONITORED_TX_QUEUES 4 116#define ENA_MONITORED_TX_QUEUES 4