* [pull request][net 0/2] mlx5 fixes 2023-08-16
@ 2023-08-16 20:41 Saeed Mahameed
2023-08-16 20:41 ` [net 1/2] net/mlx5e: XDP, Fix fifo overrun on XDP_REDIRECT Saeed Mahameed
2023-08-16 20:41 ` [net 2/2] net/mlx5: Fix mlx5_cmd_update_root_ft() error flow Saeed Mahameed
0 siblings, 2 replies; 4+ messages in thread
From: Saeed Mahameed @ 2023-08-16 20:41 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
Cc: Saeed Mahameed, netdev, Tariq Toukan
From: Saeed Mahameed <saeedm@nvidia.com>
This series provides bug fixes to mlx5 driver.
Please pull and let me know if there is any problem.
Thanks,
Saeed.
The following changes since commit de4c5efeeca7172306bdc2e3efc0c6c3953bb338:
Merge tag 'nf-23-08-16' of https://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf (2023-08-16 11:11:24 +0100)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-fixes-2023-08-16
for you to fetch changes up to 0fd23db0cc74cf6d28d26ce5e7802e982608d830:
net/mlx5: Fix mlx5_cmd_update_root_ft() error flow (2023-08-16 13:39:28 -0700)
----------------------------------------------------------------
mlx5-fixes-2023-08-16
----------------------------------------------------------------
Dragos Tatulea (1):
net/mlx5e: XDP, Fix fifo overrun on XDP_REDIRECT
Shay Drory (1):
net/mlx5: Fix mlx5_cmd_update_root_ft() error flow
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h | 2 ++
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 8 +++++---
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c | 10 +++++++++-
3 files changed, 16 insertions(+), 4 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [net 1/2] net/mlx5e: XDP, Fix fifo overrun on XDP_REDIRECT
2023-08-16 20:41 [pull request][net 0/2] mlx5 fixes 2023-08-16 Saeed Mahameed
@ 2023-08-16 20:41 ` Saeed Mahameed
2023-08-17 19:00 ` patchwork-bot+netdevbpf
2023-08-16 20:41 ` [net 2/2] net/mlx5: Fix mlx5_cmd_update_root_ft() error flow Saeed Mahameed
1 sibling, 1 reply; 4+ messages in thread
From: Saeed Mahameed @ 2023-08-16 20:41 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
Cc: Saeed Mahameed, netdev, Tariq Toukan, Dragos Tatulea
From: Dragos Tatulea <dtatulea@nvidia.com>
Before this fix, running high rate traffic through XDP_REDIRECT
with multibuf could overrun the fifo used to release the
xdp frames after tx completion. This resulted in corrupted data
being consumed on the free side.
The culplirt was a miscalculation of the fifo size: the maximum ratio
between fifo entries / data segments was incorrect. This ratio serves to
calculate the max fifo size for a full sq where each packet uses the
worst case number of entries in the fifo.
This patch fixes the formula and names the constant. It also makes sure
that future values will use a power of 2 number of entries for the fifo
mask to work.
Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
Fixes: 3f734b8c594b ("net/mlx5e: XDP, Use multiple single-entry objects in xdpi_fifo")
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h | 2 ++
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 8 +++++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h
index 9e8e6184f9e4..ecfe93a479da 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h
@@ -84,6 +84,8 @@ enum mlx5e_xdp_xmit_mode {
* MLX5E_XDP_XMIT_MODE_XSK:
* none.
*/
+#define MLX5E_XDP_FIFO_ENTRIES2DS_MAX_RATIO 4
+
union mlx5e_xdp_info {
enum mlx5e_xdp_xmit_mode mode;
union {
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index c27df14df145..f7b494125eee 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1298,11 +1298,13 @@ static int mlx5e_alloc_xdpsq_fifo(struct mlx5e_xdpsq *sq, int numa)
{
struct mlx5e_xdp_info_fifo *xdpi_fifo = &sq->db.xdpi_fifo;
int wq_sz = mlx5_wq_cyc_get_size(&sq->wq);
- int entries = wq_sz * MLX5_SEND_WQEBB_NUM_DS * 2; /* upper bound for maximum num of
- * entries of all xmit_modes.
- */
+ int entries;
size_t size;
+ /* upper bound for maximum num of entries of all xmit_modes. */
+ entries = roundup_pow_of_two(wq_sz * MLX5_SEND_WQEBB_NUM_DS *
+ MLX5E_XDP_FIFO_ENTRIES2DS_MAX_RATIO);
+
size = array_size(sizeof(*xdpi_fifo->xi), entries);
xdpi_fifo->xi = kvzalloc_node(size, GFP_KERNEL, numa);
if (!xdpi_fifo->xi)
--
2.41.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [net 2/2] net/mlx5: Fix mlx5_cmd_update_root_ft() error flow
2023-08-16 20:41 [pull request][net 0/2] mlx5 fixes 2023-08-16 Saeed Mahameed
2023-08-16 20:41 ` [net 1/2] net/mlx5e: XDP, Fix fifo overrun on XDP_REDIRECT Saeed Mahameed
@ 2023-08-16 20:41 ` Saeed Mahameed
1 sibling, 0 replies; 4+ messages in thread
From: Saeed Mahameed @ 2023-08-16 20:41 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
Cc: Saeed Mahameed, netdev, Tariq Toukan, Shay Drory, Roi Dayan
From: Shay Drory <shayd@nvidia.com>
The cited patch change mlx5_cmd_update_root_ft() to work with multiple
peer devices. However, it didn't align the error flow as well.
Hence, Fix the error code to work with multiple peer devices.
Fixes: 222dd185833e ("{net/RDMA}/mlx5: introduce lag_for_each_peer")
Signed-off-by: Shay Drory <shayd@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
index aab7059bf6e9..244cfd470903 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
@@ -245,12 +245,20 @@ static int mlx5_cmd_update_root_ft(struct mlx5_flow_root_namespace *ns,
mlx5_lag_is_shared_fdb(dev) &&
mlx5_lag_is_master(dev)) {
struct mlx5_core_dev *peer_dev;
- int i;
+ int i, j;
mlx5_lag_for_each_peer_mdev(dev, peer_dev, i) {
err = mlx5_cmd_set_slave_root_fdb(dev, peer_dev, !disconnect,
(!disconnect) ? ft->id : 0);
if (err && !disconnect) {
+ mlx5_lag_for_each_peer_mdev(dev, peer_dev, j) {
+ if (j < i)
+ mlx5_cmd_set_slave_root_fdb(dev, peer_dev, 1,
+ ns->root_ft->id);
+ else
+ break;
+ }
+
MLX5_SET(set_flow_table_root_in, in, op_mod, 0);
MLX5_SET(set_flow_table_root_in, in, table_id,
ns->root_ft->id);
--
2.41.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [net 1/2] net/mlx5e: XDP, Fix fifo overrun on XDP_REDIRECT
2023-08-16 20:41 ` [net 1/2] net/mlx5e: XDP, Fix fifo overrun on XDP_REDIRECT Saeed Mahameed
@ 2023-08-17 19:00 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-08-17 19:00 UTC (permalink / raw)
To: Saeed Mahameed
Cc: davem, kuba, pabeni, edumazet, saeedm, netdev, tariqt, dtatulea
Hello:
This series was applied to netdev/net.git (main)
by Saeed Mahameed <saeedm@nvidia.com>:
On Wed, 16 Aug 2023 13:41:07 -0700 you wrote:
> From: Dragos Tatulea <dtatulea@nvidia.com>
>
> Before this fix, running high rate traffic through XDP_REDIRECT
> with multibuf could overrun the fifo used to release the
> xdp frames after tx completion. This resulted in corrupted data
> being consumed on the free side.
>
> [...]
Here is the summary with links:
- [net,1/2] net/mlx5e: XDP, Fix fifo overrun on XDP_REDIRECT
https://git.kernel.org/netdev/net/c/34a79876d9f7
- [net,2/2] net/mlx5: Fix mlx5_cmd_update_root_ft() error flow
https://git.kernel.org/netdev/net/c/0fd23db0cc74
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-17 19:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-16 20:41 [pull request][net 0/2] mlx5 fixes 2023-08-16 Saeed Mahameed
2023-08-16 20:41 ` [net 1/2] net/mlx5e: XDP, Fix fifo overrun on XDP_REDIRECT Saeed Mahameed
2023-08-17 19:00 ` patchwork-bot+netdevbpf
2023-08-16 20:41 ` [net 2/2] net/mlx5: Fix mlx5_cmd_update_root_ft() error flow Saeed Mahameed
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).