Skip to contentSkip to conversation

mlx5 fixes 2023-08-16

GIT PULL Applied Saeed Mahameed 2 participants 4 messages Aug 16, 2023 – Aug 17, 2023

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

From: Saeed Mahameed <[email protected]>

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(-)
#1 lore raw

PATCH 1/2 net/mlx5e: XDP, Fix fifo overrun on XDP_REDIRECT

From: Dragos Tatulea <[email protected]>

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.

Fixes 3f734b8c594b ("net/mlx5e: XDP, Use multiple single-entry objects in xdpi_fifo")
---
 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(-)
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h +2 -0
index 9e8e6184f9e4..ecfe93a479da 100644
@@ -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 {
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +5 -3
index c27df14df145..f7b494125eee 100644
@@ -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)
Signature · 1 line
2.41.0
#2 lore raw

Re: [net 1/2] net/mlx5e: XDP, Fix fifo overrun on XDP_REDIRECT

This series was applied to netdev/net.git (main) by Saeed Mahameed <[email protected]>:

Hello:

This series was applied to netdev/net.git (main)
by Saeed Mahameed <[email protected]>:

Quoted 8 lines · On Wed, 16 Aug 2023 13:41:07 -0700 you wrote:

From: Dragos Tatulea <[email protected]>

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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#3 lore raw

PATCH 2/2 net/mlx5: Fix mlx5_cmd_update_root_ft() error flow

In reply to Saeed Mahameed

From: Shay Drory <[email protected]>

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")
---
 drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c +9 -1
index aab7059bf6e9..244cfd470903 100644
@@ -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);
Signature · 1 line
2.41.0