From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Maxim Mikityanskiy <maximmi@nvidia.com>,
Saeed Mahameed <saeedm@nvidia.com>
Subject: [net-next 12/15] net/mlx5e: Permit XDP with non-linear legacy RQ
Date: Fri, 18 Mar 2022 13:52:45 -0700 [thread overview]
Message-ID: <20220318205248.33367-13-saeed@kernel.org> (raw)
In-Reply-To: <20220318205248.33367-1-saeed@kernel.org>
From: Maxim Mikityanskiy <maximmi@nvidia.com>
Now that legacy RQ implements XDP in the non-linear mode, stop blocking
this configuration. Allow non-linear mode only for programs aware of
multi buffer.
XDP performance with linear mode RQ hasn't changed.
Baseline (MTU 1500, TX MPWQE, legacy RQ, single core):
60-byte packets, XDP_DROP: 11.25 Mpps
60-byte packets, XDP_TX: 9.0 Mpps
60-byte packets, XDP_PASS: 668 kpps
Multi buffer (MTU 9000, TX MPWQE, legacy RQ, single core):
60-byte packets, XDP_DROP: 10.1 Mpps
60-byte packets, XDP_TX: 6.6 Mpps
60-byte packets, XDP_PASS: 658 kpps
8900-byte packets, XDP_DROP: 769 kpps (100% of sent packets)
8900-byte packets, XDP_TX: 674 kpps (100% of sent packets)
8900-byte packets, XDP_PASS: 637 kpps
Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
.../net/ethernet/mellanox/mlx5/core/en_main.c | 39 +++++++++++++------
1 file changed, 27 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 95cec2848685..3256d2c375c3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -3953,6 +3953,31 @@ static bool mlx5e_xsk_validate_mtu(struct net_device *netdev,
return true;
}
+static bool mlx5e_params_validate_xdp(struct net_device *netdev, struct mlx5e_params *params)
+{
+ bool is_linear;
+
+ /* No XSK params: AF_XDP can't be enabled yet at the point of setting
+ * the XDP program.
+ */
+ is_linear = mlx5e_rx_is_linear_skb(params, NULL);
+
+ if (!is_linear && params->rq_wq_type != MLX5_WQ_TYPE_CYCLIC) {
+ netdev_warn(netdev, "XDP is not allowed with striding RQ and MTU(%d) > %d\n",
+ params->sw_mtu,
+ mlx5e_xdp_max_mtu(params, NULL));
+ return false;
+ }
+ if (!is_linear && !params->xdp_prog->aux->xdp_has_frags) {
+ netdev_warn(netdev, "MTU(%d) > %d, too big for an XDP program not aware of multi buffer\n",
+ params->sw_mtu,
+ mlx5e_xdp_max_mtu(params, NULL));
+ return false;
+ }
+
+ return true;
+}
+
int mlx5e_change_mtu(struct net_device *netdev, int new_mtu,
mlx5e_fp_preactivate preactivate)
{
@@ -3972,10 +3997,7 @@ int mlx5e_change_mtu(struct net_device *netdev, int new_mtu,
if (err)
goto out;
- if (params->xdp_prog &&
- !mlx5e_rx_is_linear_skb(&new_params, NULL)) {
- netdev_err(netdev, "MTU(%d) > %d is not allowed while XDP enabled\n",
- new_mtu, mlx5e_xdp_max_mtu(params, NULL));
+ if (new_params.xdp_prog && !mlx5e_params_validate_xdp(netdev, &new_params)) {
err = -EINVAL;
goto out;
}
@@ -4458,15 +4480,8 @@ static int mlx5e_xdp_allowed(struct mlx5e_priv *priv, struct bpf_prog *prog)
new_params = priv->channels.params;
new_params.xdp_prog = prog;
- /* No XSK params: AF_XDP can't be enabled yet at the point of setting
- * the XDP program.
- */
- if (!mlx5e_rx_is_linear_skb(&new_params, NULL)) {
- netdev_warn(netdev, "XDP is not allowed with MTU(%d) > %d\n",
- new_params.sw_mtu,
- mlx5e_xdp_max_mtu(&new_params, NULL));
+ if (!mlx5e_params_validate_xdp(netdev, &new_params))
return -EINVAL;
- }
return 0;
}
--
2.35.1
next prev parent reply other threads:[~2022-03-18 20:53 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-18 20:52 [pull request][net-next 00/15] mlx5 updates 2022-03-18 Saeed Mahameed
2022-03-18 20:52 ` [net-next 01/15] net/mlx5e: Prepare non-linear legacy RQ for XDP multi buffer support Saeed Mahameed
2022-03-19 15:10 ` patchwork-bot+netdevbpf
2022-03-18 20:52 ` [net-next 02/15] net/mlx5e: Use fragments of the same size in non-linear legacy RQ with XDP Saeed Mahameed
2022-03-18 20:52 ` [net-next 03/15] net/mlx5e: Use page-sized fragments with XDP multi buffer Saeed Mahameed
2022-03-18 20:52 ` [net-next 04/15] net/mlx5e: Add XDP multi buffer support to the non-linear legacy RQ Saeed Mahameed
2022-03-18 20:52 ` [net-next 05/15] net/mlx5e: Store DMA address inside struct page Saeed Mahameed
2022-03-18 20:52 ` [net-next 06/15] net/mlx5e: Move mlx5e_xdpi_fifo_push out of xmit_xdp_frame Saeed Mahameed
2022-03-18 20:52 ` [net-next 07/15] net/mlx5e: Remove assignment of inline_hdr.sz on XDP TX Saeed Mahameed
2022-03-18 20:52 ` [net-next 08/15] net/mlx5e: Don't prefill WQEs in XDP SQ in the multi buffer mode Saeed Mahameed
2022-03-18 20:52 ` [net-next 09/15] net/mlx5e: Implement sending multi buffer XDP frames Saeed Mahameed
2022-03-18 20:52 ` [net-next 10/15] net/mlx5e: Unindent the else-block in mlx5e_xmit_xdp_buff Saeed Mahameed
2022-03-18 20:52 ` [net-next 11/15] net/mlx5e: Support multi buffer XDP_TX Saeed Mahameed
2022-03-18 20:52 ` Saeed Mahameed [this message]
2022-03-18 20:52 ` [net-next 13/15] net/mlx5e: Remove MLX5E_XDP_TX_DS_COUNT Saeed Mahameed
2022-03-18 20:52 ` [net-next 14/15] net/mlx5e: Statify function mlx5_cmd_trigger_completions Saeed Mahameed
2022-03-18 20:52 ` [net-next 15/15] net/mlx5e: HTB, remove unused function declaration 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=20220318205248.33367-13-saeed@kernel.org \
--to=saeed@kernel.org \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=maximmi@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=saeedm@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).