patch 'net/nfp: fix configuration BAR' has been queued to stable release 23.11.2
Xueming Li
xuemingl at nvidia.com
Fri Jul 12 12:44:13 CEST 2024
Hi,
FYI, your patch has been queued to stable release 23.11.2
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/14/24. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging
This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=a683a82c9836e74b15bbaeca69d72807575b30d0
Thanks.
Xueming Li <xuemingl at nvidia.com>
---
>From a683a82c9836e74b15bbaeca69d72807575b30d0 Mon Sep 17 00:00:00 2001
From: Chaoyong He <chaoyong.he at corigine.com>
Date: Fri, 19 Apr 2024 13:23:43 +0800
Subject: [PATCH] net/nfp: fix configuration BAR
Cc: Xueming Li <xuemingl at nvidia.com>
[ upstream commit debb9e735adb1bccb2f75ee1372ea2e6c6b20673 ]
All the configuration bars are sit in an array, and the initial logic
sort all the configuration BAR from small to large based on size and
index, which result all valid bars are behind the invalid bars.
But the BAR alloc logic search this array from the very beginning and
only try limited times (equal to the valid bars number).
It's ok for primary process because which has enough valid bars, and
finally it can find one to use.
But for secondary process and run with igb_uio driver, the valid bars
are very limit, and it can not find one, and the logic will fail.
Fix this by drop the sort logic, and search the bar array from the end
to begin.
Fixes: 1fbe51cd9c3a ("net/nfp: extend usage of BAR from 8 to 24")
Signed-off-by: Chaoyong He <chaoyong.he at corigine.com>
Reviewed-by: Long Wu <long.wu at corigine.com>
Reviewed-by: Peng Zhang <peng.zhang at corigine.com>
---
drivers/net/nfp/nfpcore/nfp6000_pcie.c | 34 +++++++++-----------------
1 file changed, 11 insertions(+), 23 deletions(-)
diff --git a/drivers/net/nfp/nfpcore/nfp6000_pcie.c b/drivers/net/nfp/nfpcore/nfp6000_pcie.c
index a6fd89b6c8..ef1ffd6d01 100644
--- a/drivers/net/nfp/nfpcore/nfp6000_pcie.c
+++ b/drivers/net/nfp/nfpcore/nfp6000_pcie.c
@@ -263,19 +263,6 @@ nfp_bitsize_calc(uint64_t mask)
return bit_size;
}
-static int
-nfp_cmp_bars(const void *ptr_a,
- const void *ptr_b)
-{
- const struct nfp_bar *a = ptr_a;
- const struct nfp_bar *b = ptr_b;
-
- if (a->bitsize == b->bitsize)
- return a->index - b->index;
- else
- return a->bitsize - b->bitsize;
-}
-
static bool
nfp_bars_for_secondary(uint32_t index)
{
@@ -383,9 +370,6 @@ nfp_enable_bars(struct nfp_pcie_user *nfp)
if (nfp_bar_write(nfp, bar, barcfg_msix_general) < 0)
return -EIO;
- /* Sort bars by bit size - use the smallest possible first. */
- qsort(&nfp->bar[0], nfp->bars, sizeof(nfp->bar[0]), nfp_cmp_bars);
-
return 0;
}
@@ -466,16 +450,18 @@ find_matching_bar(struct nfp_pcie_user *nfp,
int width)
{
uint32_t n;
+ uint32_t index;
- for (n = 0; n < nfp->bars; n++) {
- struct nfp_bar *bar = &nfp->bar[n];
+ for (n = RTE_DIM(nfp->bar) ; n > 0; n--) {
+ index = n - 1;
+ struct nfp_bar *bar = &nfp->bar[index];
if (bar->lock)
continue;
if (matching_bar_exist(bar, target, action, token,
offset, size, width))
- return n;
+ return index;
}
return -1;
@@ -493,10 +479,12 @@ find_unused_bar_noblock(struct nfp_pcie_user *nfp,
{
int ret;
uint32_t n;
+ uint32_t index;
const struct nfp_bar *bar;
- for (n = 0; n < nfp->bars; n++) {
- bar = &nfp->bar[n];
+ for (n = RTE_DIM(nfp->bar); n > 0; n--) {
+ index = n - 1;
+ bar = &nfp->bar[index];
if (bar->bitsize == 0)
continue;
@@ -508,7 +496,7 @@ find_unused_bar_noblock(struct nfp_pcie_user *nfp,
continue;
if (!bar->lock)
- return n;
+ return index;
}
return -EAGAIN;
@@ -561,7 +549,7 @@ nfp_disable_bars(struct nfp_pcie_user *nfp)
uint32_t i;
struct nfp_bar *bar;
- for (i = 0; i < nfp->bars; i++) {
+ for (i = 0; i < RTE_DIM(nfp->bar); i++) {
bar = &nfp->bar[i];
if (bar->iomem != NULL) {
bar->iomem = NULL;
--
2.34.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2024-07-12 18:40:15.468468363 +0800
+++ 0027-net-nfp-fix-configuration-BAR.patch 2024-07-12 18:40:13.986594241 +0800
@@ -1 +1 @@
-From debb9e735adb1bccb2f75ee1372ea2e6c6b20673 Mon Sep 17 00:00:00 2001
+From a683a82c9836e74b15bbaeca69d72807575b30d0 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit debb9e735adb1bccb2f75ee1372ea2e6c6b20673 ]
@@ -21 +23,0 @@
-Cc: stable at dpdk.org
More information about the stable
mailing list