]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.10
authorSasha Levin <sashal@kernel.org>
Mon, 26 Jul 2021 12:16:16 +0000 (08:16 -0400)
committerSasha Levin <sashal@kernel.org>
Mon, 26 Jul 2021 12:16:16 +0000 (08:16 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-5.10/series
queue-5.10/sfc-ensure-correct-number-of-xdp-queues.patch [new file with mode: 0644]

index 05c2531d0d999e21e5dcb3dc49bc8fa707c7c83a..62e33604f94713f9f70922bb5f8754a67f43abc2 100644 (file)
@@ -163,3 +163,4 @@ documentation-fix-intiramfs-script-name.patch
 perf-inject-close-inject.output-on-exit.patch
 usb-ehci-prevent-missed-ehci-interrupts-with-edge-triggered-msi.patch
 drm-i915-gvt-clear-d3_entered-on-elsp-cmd-submission.patch
+sfc-ensure-correct-number-of-xdp-queues.patch
diff --git a/queue-5.10/sfc-ensure-correct-number-of-xdp-queues.patch b/queue-5.10/sfc-ensure-correct-number-of-xdp-queues.patch
new file mode 100644 (file)
index 0000000..f4af960
--- /dev/null
@@ -0,0 +1,82 @@
+From 135864d6e6096bb9a6e8c9c9d78b50a91326d4a4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 13 Jul 2021 16:21:28 +0200
+Subject: sfc: ensure correct number of XDP queues
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Íñigo Huguet <ihuguet@redhat.com>
+
+[ Upstream commit 788bc000d4c2f25232db19ab3a0add0ba4e27671 ]
+
+Commit 99ba0ea616aa ("sfc: adjust efx->xdp_tx_queue_count with the real
+number of initialized queues") intended to fix a problem caused by a
+round up when calculating the number of XDP channels and queues.
+However, this was not the real problem. The real problem was that the
+number of XDP TX queues had been reduced to half in
+commit e26ca4b53582 ("sfc: reduce the number of requested xdp ev queues"),
+but the variable xdp_tx_queue_count had remained the same.
+
+Once the correct number of XDP TX queues is created again in the
+previous patch of this series, this also can be reverted since the error
+doesn't actually exist.
+
+Only in the case that there is a bug in the code we can have different
+values in xdp_queue_number and efx->xdp_tx_queue_count. Because of this,
+and per Edward Cree's suggestion, I add instead a WARN_ON to catch if it
+happens again in the future.
+
+Note that the number of allocated queues can be higher than the number
+of used ones due to the round up, as explained in the existing comment
+in the code. That's why we also have to stop increasing xdp_queue_number
+beyond efx->xdp_tx_queue_count.
+
+Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/sfc/efx_channels.c | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/net/ethernet/sfc/efx_channels.c b/drivers/net/ethernet/sfc/efx_channels.c
+index a4a626e9cd9a..0a8799a208cf 100644
+--- a/drivers/net/ethernet/sfc/efx_channels.c
++++ b/drivers/net/ethernet/sfc/efx_channels.c
+@@ -889,18 +889,20 @@ int efx_set_channels(struct efx_nic *efx)
+                       if (efx_channel_is_xdp_tx(channel)) {
+                               efx_for_each_channel_tx_queue(tx_queue, channel) {
+                                       tx_queue->queue = next_queue++;
+-                                      netif_dbg(efx, drv, efx->net_dev, "Channel %u TXQ %u is XDP %u, HW %u\n",
+-                                                channel->channel, tx_queue->label,
+-                                                xdp_queue_number, tx_queue->queue);
++
+                                       /* We may have a few left-over XDP TX
+                                        * queues owing to xdp_tx_queue_count
+                                        * not dividing evenly by EFX_MAX_TXQ_PER_CHANNEL.
+                                        * We still allocate and probe those
+                                        * TXQs, but never use them.
+                                        */
+-                                      if (xdp_queue_number < efx->xdp_tx_queue_count)
++                                      if (xdp_queue_number < efx->xdp_tx_queue_count) {
++                                              netif_dbg(efx, drv, efx->net_dev, "Channel %u TXQ %u is XDP %u, HW %u\n",
++                                                        channel->channel, tx_queue->label,
++                                                        xdp_queue_number, tx_queue->queue);
+                                               efx->xdp_tx_queues[xdp_queue_number] = tx_queue;
+-                                      xdp_queue_number++;
++                                              xdp_queue_number++;
++                                      }
+                               }
+                       } else {
+                               efx_for_each_channel_tx_queue(tx_queue, channel) {
+@@ -912,6 +914,7 @@ int efx_set_channels(struct efx_nic *efx)
+                       }
+               }
+       }
++      WARN_ON(xdp_queue_number != efx->xdp_tx_queue_count);
+       rc = netif_set_real_num_tx_queues(efx->net_dev, efx->n_tx_channels);
+       if (rc)
+-- 
+2.30.2
+