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>,
Adham Faris <afaris@nvidia.com>
Subject: [net-next 06/15] net/mlx5e: Fail with messages when params are not valid for XSK
Date: Wed, 18 Jan 2023 10:35:53 -0800 [thread overview]
Message-ID: <20230118183602.124323-7-saeed@kernel.org> (raw)
In-Reply-To: <20230118183602.124323-1-saeed@kernel.org>
From: Adham Faris <afaris@nvidia.com>
Current XSK prerequisites validation implementation
(setup.c/mlx5e_validate_xsk_param()) fails silently when xsk
prerequisites are not fulfilled.
Add error messages to the kernel log to help the user understand what
went wrong when params are not valid for XSK.
Signed-off-by: Adham Faris <afaris@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
.../ethernet/mellanox/mlx5/core/en/params.c | 9 +++++++--
.../mellanox/mlx5/core/en/xsk/setup.c | 19 +++++++++++++++++--
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/params.c b/drivers/net/ethernet/mellanox/mlx5/core/en/params.c
index 585bdc8383ee..a17b768b81f1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/params.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/params.c
@@ -581,11 +581,16 @@ int mlx5e_mpwrq_validate_xsk(struct mlx5_core_dev *mdev, struct mlx5e_params *pa
bool unaligned = xsk ? xsk->unaligned : false;
u16 max_mtu_pkts;
- if (!mlx5e_check_fragmented_striding_rq_cap(mdev, page_shift, umr_mode))
+ if (!mlx5e_check_fragmented_striding_rq_cap(mdev, page_shift, umr_mode)) {
+ mlx5_core_err(mdev, "Striding RQ for XSK can't be activated with page_shift %u and umr_mode %d\n",
+ page_shift, umr_mode);
return -EOPNOTSUPP;
+ }
- if (!mlx5e_rx_mpwqe_is_linear_skb(mdev, params, xsk))
+ if (!mlx5e_rx_mpwqe_is_linear_skb(mdev, params, xsk)) {
+ mlx5_core_err(mdev, "Striding RQ linear mode for XSK can't be activated with current params\n");
return -EINVAL;
+ }
/* Current RQ length is too big for the given frame size, the
* needed number of WQEs exceeds the maximum.
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c
index ff03c43833bb..81a567e17264 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c
@@ -7,6 +7,18 @@
#include "en/health.h"
#include <net/xdp_sock_drv.h>
+static int mlx5e_legacy_rq_validate_xsk(struct mlx5_core_dev *mdev,
+ struct mlx5e_params *params,
+ struct mlx5e_xsk_param *xsk)
+{
+ if (!mlx5e_rx_is_linear_skb(mdev, params, xsk)) {
+ mlx5_core_err(mdev, "Legacy RQ linear mode for XSK can't be activated with current params\n");
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
/* The limitation of 2048 can be altered, but shouldn't go beyond the minimal
* stride size of striding RQ.
*/
@@ -17,8 +29,11 @@ bool mlx5e_validate_xsk_param(struct mlx5e_params *params,
struct mlx5_core_dev *mdev)
{
/* AF_XDP doesn't support frames larger than PAGE_SIZE. */
- if (xsk->chunk_size > PAGE_SIZE || xsk->chunk_size < MLX5E_MIN_XSK_CHUNK_SIZE)
+ if (xsk->chunk_size > PAGE_SIZE || xsk->chunk_size < MLX5E_MIN_XSK_CHUNK_SIZE) {
+ mlx5_core_err(mdev, "XSK chunk size %u out of bounds [%u, %lu]\n", xsk->chunk_size,
+ MLX5E_MIN_XSK_CHUNK_SIZE, PAGE_SIZE);
return false;
+ }
/* frag_sz is different for regular and XSK RQs, so ensure that linear
* SKB mode is possible.
@@ -27,7 +42,7 @@ bool mlx5e_validate_xsk_param(struct mlx5e_params *params,
case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
return !mlx5e_mpwrq_validate_xsk(mdev, params, xsk);
default: /* MLX5_WQ_TYPE_CYCLIC */
- return mlx5e_rx_is_linear_skb(mdev, params, xsk);
+ return !mlx5e_legacy_rq_validate_xsk(mdev, params, xsk);
}
}
--
2.39.0
next prev parent reply other threads:[~2023-01-18 18:36 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-18 18:35 [pull request][net-next 00/15] mlx5 updates 2023-01-18 Saeed Mahameed
2023-01-18 18:35 ` [net-next 01/15] net/mlx5e: Suppress Send WQEBB room warning for PAGE_SIZE >= 16KB Saeed Mahameed
2023-01-18 21:31 ` Jacob Keller
2023-01-20 4:00 ` patchwork-bot+netdevbpf
2023-01-18 18:35 ` [net-next 02/15] net/mlx5: Suppress error logging on UCTX creation Saeed Mahameed
2023-01-18 21:32 ` Jacob Keller
2023-01-18 18:35 ` [net-next 03/15] net/mlx5: Add adjphase function to support hardware-only offset control Saeed Mahameed
2023-01-18 21:33 ` Jacob Keller
2023-01-20 3:46 ` Jakub Kicinski
2023-01-20 3:56 ` Rahul Rameshbabu
2023-01-20 4:03 ` Jakub Kicinski
2023-01-20 4:26 ` Rahul Rameshbabu
2023-01-20 5:08 ` Jakub Kicinski
2023-01-20 5:22 ` Rahul Rameshbabu
2023-01-20 5:45 ` Jakub Kicinski
2023-01-20 6:02 ` Rahul Rameshbabu
2023-01-20 17:21 ` Jacob Keller
2023-01-20 18:00 ` Rahul Rameshbabu
2023-01-20 23:58 ` Jacob Keller
2023-01-21 0:06 ` Jakub Kicinski
2023-01-22 21:11 ` Rahul Rameshbabu
2023-01-23 2:22 ` Richard Cochran
2023-01-23 2:48 ` Rahul Rameshbabu
2023-01-23 2:58 ` Richard Cochran
2023-01-23 18:44 ` Rahul Rameshbabu
2023-01-23 19:13 ` Jacob Keller
2023-01-23 22:39 ` Richard Cochran
2023-01-23 22:36 ` Richard Cochran
2023-01-24 10:33 ` Bar Shapira
2023-01-24 19:15 ` Richard Cochran
2023-01-25 0:48 ` Jakub Kicinski
2023-01-25 2:26 ` Rahul Rameshbabu
2023-01-25 8:28 ` Gal Pressman
2023-01-23 2:15 ` Richard Cochran
2023-01-23 18:14 ` Jacob Keller
2023-01-18 18:35 ` [net-next 04/15] net/mlx5: Add hardware extended range support for PTP adjtime and adjphase Saeed Mahameed
2023-01-18 21:35 ` Jacob Keller
2023-01-18 18:35 ` [net-next 05/15] net/mlx5: E-switch, Remove redundant comment about meta rules Saeed Mahameed
2023-01-18 21:40 ` Jacob Keller
2023-01-18 18:35 ` Saeed Mahameed [this message]
2023-01-18 21:41 ` [net-next 06/15] net/mlx5e: Fail with messages when params are not valid for XSK Jacob Keller
2023-01-18 18:35 ` [net-next 07/15] net/mlx5e: Add warning when log WQE size is smaller than log stride size Saeed Mahameed
2023-01-18 21:42 ` Jacob Keller
2023-01-18 18:35 ` [net-next 08/15] net/mlx5e: TC, Pass flow attr to attach/detach mod hdr functions Saeed Mahameed
2023-01-18 21:42 ` Jacob Keller
2023-01-18 18:35 ` [net-next 09/15] net/mlx5e: TC, Add tc prefix to attach/detach " Saeed Mahameed
2023-01-18 21:44 ` Jacob Keller
2023-01-18 18:35 ` [net-next 10/15] net/mlx5e: TC, Use common function allocating flow mod hdr or encap mod hdr Saeed Mahameed
2023-01-18 21:45 ` Jacob Keller
2023-01-18 18:35 ` [net-next 11/15] net/mlx5e: Warn when destroying mod hdr hash table that is not empty Saeed Mahameed
2023-01-18 21:45 ` Jacob Keller
2023-01-18 18:35 ` [net-next 12/15] net/mlx5: E-Switch, Fix typo for egress Saeed Mahameed
2023-01-18 21:46 ` Jacob Keller
2023-01-18 18:36 ` [net-next 13/15] net/mlx5e: Support Geneve and GRE with VF tunnel offload Saeed Mahameed
2023-01-18 21:48 ` Jacob Keller
2023-01-18 18:36 ` [net-next 14/15] net/mlx5e: Remove redundant allocation of spec in create indirect fwd group Saeed Mahameed
2023-01-18 21:50 ` Jacob Keller
2023-01-18 18:36 ` [net-next 15/15] net/mlx5e: Use read lock for eswitch get callbacks Saeed Mahameed
2023-01-18 21:51 ` Jacob Keller
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=20230118183602.124323-7-saeed@kernel.org \
--to=saeed@kernel.org \
--cc=afaris@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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).