From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>
Cc: Saeed Mahameed <saeedm@nvidia.com>,
netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
Parav Pandit <parav@nvidia.com>,
Daniel Jurgens <danielj@nvidia.com>
Subject: [net V2 03/14] net/mlx5: Fix setting ec_function bit in MANAGE_PAGES
Date: Wed, 15 Mar 2023 15:58:36 -0700 [thread overview]
Message-ID: <20230315225847.360083-4-saeed@kernel.org> (raw)
In-Reply-To: <20230315225847.360083-1-saeed@kernel.org>
From: Parav Pandit <parav@nvidia.com>
When ECPF is a page supplier, reclaim pages missed to honor the
ec_function bit provided by the firmware. It always used the ec_function
to true during driver unload flow for ECPF. This is incorrect.
Honor the ec_function bit provided by device during page allocation
request event.
Fixes: d6945242f45d ("net/mlx5: Hold pages RB tree per VF")
Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
.../ethernet/mellanox/mlx5/core/pagealloc.c | 22 ++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
index 64d4e7125e9b..95dc67fb3001 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
@@ -82,6 +82,16 @@ static u16 func_id_to_type(struct mlx5_core_dev *dev, u16 func_id, bool ec_funct
return func_id <= mlx5_core_max_vfs(dev) ? MLX5_VF : MLX5_SF;
}
+static u32 mlx5_get_ec_function(u32 function)
+{
+ return function >> 16;
+}
+
+static u32 mlx5_get_func_id(u32 function)
+{
+ return function & 0xffff;
+}
+
static struct rb_root *page_root_per_function(struct mlx5_core_dev *dev, u32 function)
{
struct rb_root *root;
@@ -665,20 +675,22 @@ static int optimal_reclaimed_pages(void)
}
static int mlx5_reclaim_root_pages(struct mlx5_core_dev *dev,
- struct rb_root *root, u16 func_id)
+ struct rb_root *root, u32 function)
{
u64 recl_pages_to_jiffies = msecs_to_jiffies(mlx5_tout_ms(dev, RECLAIM_PAGES));
unsigned long end = jiffies + recl_pages_to_jiffies;
while (!RB_EMPTY_ROOT(root)) {
+ u32 ec_function = mlx5_get_ec_function(function);
+ u32 function_id = mlx5_get_func_id(function);
int nclaimed;
int err;
- err = reclaim_pages(dev, func_id, optimal_reclaimed_pages(),
- &nclaimed, false, mlx5_core_is_ecpf(dev));
+ err = reclaim_pages(dev, function_id, optimal_reclaimed_pages(),
+ &nclaimed, false, ec_function);
if (err) {
- mlx5_core_warn(dev, "failed reclaiming pages (%d) for func id 0x%x\n",
- err, func_id);
+ mlx5_core_warn(dev, "reclaim_pages err (%d) func_id=0x%x ec_func=0x%x\n",
+ err, function_id, ec_function);
return err;
}
--
2.39.2
next prev parent reply other threads:[~2023-03-15 22:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-15 22:58 [pull request][net V2 00/14] mlx5 fixes 2023-03-15 Saeed Mahameed
2023-03-15 22:58 ` [net V2 01/14] net/mlx5e: Fix macsec ASO context alignment Saeed Mahameed
2023-03-17 4:30 ` patchwork-bot+netdevbpf
2023-03-15 22:58 ` [net V2 02/14] net/mlx5e: Don't cache tunnel offloads capability Saeed Mahameed
2023-03-15 22:58 ` Saeed Mahameed [this message]
2023-03-15 22:58 ` [net V2 04/14] net/mlx5: Disable eswitch before waiting for VF pages Saeed Mahameed
2023-03-15 22:58 ` [net V2 05/14] net/mlx5: E-switch, Fix wrong usage of source port rewrite in split rules Saeed Mahameed
2023-03-15 22:58 ` [net V2 06/14] net/mlx5: E-switch, Fix missing set of split_count when forward to ovs internal port Saeed Mahameed
2023-03-15 22:58 ` [net V2 07/14] net/mlx5e: Fix cleanup null-ptr deref on encap lock Saeed Mahameed
2023-03-15 22:58 ` [net V2 08/14] net/mlx5e: kTLS, Fix missing error unwind on unsupported cipher type Saeed Mahameed
2023-03-15 22:58 ` [net V2 09/14] net/mlx5: Set BREAK_FW_WAIT flag first when removing driver Saeed Mahameed
2023-03-15 22:58 ` [net V2 10/14] net/mlx5e: Lower maximum allowed MTU in XSK to match XDP prerequisites Saeed Mahameed
2023-03-15 22:58 ` [net V2 11/14] net/sched: TC, fix raw counter initialization Saeed Mahameed
2023-03-15 22:58 ` [net V2 12/14] net/mlx5e: TC, fix missing error code Saeed Mahameed
2023-03-15 22:58 ` [net V2 13/14] net/mlx5e: TC, fix cloned flow attribute Saeed Mahameed
2023-03-15 22:58 ` [net V2 14/14] net/mlx5e: TC, Remove error message log print Saeed Mahameed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230315225847.360083-4-saeed@kernel.org \
--to=saeed@kernel.org \
--cc=danielj@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=parav@nvidia.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).