Skip to contentSkip to conversation

net/mlx5: fix the LACP redirection in Rx domain

PATCH In review Bing Zhao 3 participants 5 messages Nov 13, 2023 – Nov 14, 2023 Network drivers

lore
Share & tools
lore

Bing Zhao

author
#0 lore raw

PATCH 1/1 net/mlx5: fix the LACP redirection in Rx domain

When the "lacp_by_user" is not set from the application in bond mode, the LACP traffic should be handled by the kernel driver by default.

This commit adds the missing support in the template API when "dv_flow_en=2". The behavior will be the same as that in the DV mode with "dv_flow_en=1". The LACP packets will be redirected to the kernel when starting the steering in the NIC Rx domain.

With this commit, the DEFAULT_MISS action usage is refactored a bit. In the HWS, one unique action can be created with supported bits set in the "flag" per port. The *ROOT_FDB and *HWS_FDB flag bits will only be set when the port is in switchdev mode and working as the E-Switch manager proxy port. The SF/VF and all other representors won't have the FDB flag bits when creating the DEFAULT_MISS action.

Fixes 9fa7c1cddb85 ("net/mlx5: create control flow rules with HWS")
---
 drivers/net/mlx5/linux/mlx5_os.c |   8 +-
 drivers/net/mlx5/mlx5.h          |   1 +
 drivers/net/mlx5/mlx5_flow.h     |   1 +
 drivers/net/mlx5/mlx5_flow_hw.c  | 249 +++++++++++++++++++++++++++++--
 drivers/net/mlx5/mlx5_trigger.c  |   3 +
 5 files changed, 249 insertions(+), 13 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +4 -4
index 07f31de5ae..ae82e1e5d8 100644
@@ -474,6 +474,10 @@ mlx5_alloc_shared_dr(struct mlx5_priv *priv)
 	err = mlx5_alloc_table_hash_list(priv);
 	if (err)
 		goto error;
+	sh->default_miss_action =
+			mlx5_glue->dr_create_flow_action_default_miss();
+	if (!sh->default_miss_action)
+		DRV_LOG(WARNING, "Default miss action is not supported.");
 	/* The resources below are only valid with DV support. */
 #ifdef HAVE_IBV_FLOW_DV_SUPPORT
 	/* Init shared flex parsers list, no need lcore_share */
@@ -600,10 +604,6 @@ mlx5_alloc_shared_dr(struct mlx5_priv *priv)
 
 	__mlx5_discovery_misc5_cap(priv);
 #endif /* HAVE_MLX5DV_DR */
-	sh->default_miss_action =
-			mlx5_glue->dr_create_flow_action_default_miss();
-	if (!sh->default_miss_action)
-		DRV_LOG(WARNING, "Default miss action is not supported.");
 	LIST_INIT(&sh->shared_rxqs);
 	return 0;
 error:
drivers/net/mlx5/mlx5.h +1 -0
index 795748eddc..f0d63a0ba5 100644
@@ -1860,6 +1860,7 @@ struct mlx5_priv {
 	struct rte_flow_template_table *hw_esw_sq_miss_tbl;
 	struct rte_flow_template_table *hw_esw_zero_tbl;
 	struct rte_flow_template_table *hw_tx_meta_cpy_tbl;
+	struct rte_flow_template_table *hw_lacp_rx_tbl;
 	struct rte_flow_pattern_template *hw_tx_repr_tagging_pt;
 	struct rte_flow_actions_template *hw_tx_repr_tagging_at;
 	struct rte_flow_template_table *hw_tx_repr_tagging_tbl;
drivers/net/mlx5/mlx5_flow.h +1 -0
index 8c0b9a4b60..6dde9de688 100644
@@ -2880,6 +2880,7 @@ int mlx5_flow_hw_esw_destroy_sq_miss_flow(struct rte_eth_dev *dev,
 int mlx5_flow_hw_esw_create_default_jump_flow(struct rte_eth_dev *dev);
 int mlx5_flow_hw_create_tx_default_mreg_copy_flow(struct rte_eth_dev *dev);
 int mlx5_flow_hw_tx_repr_matching_flow(struct rte_eth_dev *dev, uint32_t sqn, bool external);
+int mlx5_flow_hw_lacp_rx_flow(struct rte_eth_dev *dev);
 int mlx5_flow_actions_validate(struct rte_eth_dev *dev,
 		const struct rte_flow_actions_template_attr *attr,
 		const struct rte_flow_action actions[],
drivers/net/mlx5/mlx5_flow_hw.c +240 -9

362 lines not on this page · raw message

drivers/net/mlx5/mlx5_trigger.c +3 -0
index 35733b0604..5ac25d7e2d 100644
@@ -1524,6 +1524,9 @@ mlx5_traffic_enable_hws(struct rte_eth_dev *dev)
 	}
 	if (priv->isolated)
 		return 0;
+	if (!priv->sh->config.lacp_by_user && priv->pf_bond >= 0)
+		if (mlx5_flow_hw_lacp_rx_flow(dev))
+			goto error;
 	if (dev->data->promiscuous)
 		flags |= MLX5_CTRL_PROMISCUOUS;
 	if (dev->data->all_multicast)
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw

Hi,

One small comment, v2 is needed.

Quoted 39 lines

-----Original Message-----
From: Bing Zhao <[email protected]>
Sent: Monday, November 13, 2023 8:42 PM
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Raslan Darawsheh <[email protected]>; Suanming Mou <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; Dariusz Sosnowski <[email protected]>; [email protected]
Subject: [PATCH] net/mlx5: fix the LACP redirection in Rx domain

When the "lacp_by_user" is not set from the application in bond mode, the LACP traffic should be handled by the kernel driver by default.

This commit adds the missing support in the template API when "dv_flow_en=2". The behavior will be the same as that in the DV mode with "dv_flow_en=1". The LACP packets will be redirected to the kernel when starting the steering in the NIC Rx domain.

With this commit, the DEFAULT_MISS action usage is refactored a bit. In the HWS, one unique action can be created with supported bits set in the "flag" per port. The *ROOT_FDB and *HWS_FDB flag bits will only be set when the port is in switchdev mode and working as the E-Switch manager proxy port. The SF/VF and all other representors won't have the FDB flag bits when creating the DEFAULT_MISS action.

Fixes 9fa7c1cddb85 ("net/mlx5: create control flow rules with HWS")
---
 drivers/net/mlx5/linux/mlx5_os.c |   8 +-
 drivers/net/mlx5/mlx5.h          |   1 +
 drivers/net/mlx5/mlx5_flow.h     |   1 +
 drivers/net/mlx5/mlx5_flow_hw.c  | 249 +++++++++++++++++++++++++++++--
 drivers/net/mlx5/mlx5_trigger.c  |   3 +
 5 files changed, 249 insertions(+), 13 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +0 -0

[snip]

drivers/net/mlx5/linux/mlx5_os.c

Quoted 7 lines
drivers/net/mlx5/linux/mlx5_os.c +0 -0
@@ -8327,6 +8503,10 @@ flow_hw_create_ctrl_tables(struct rte_eth_dev *dev,

struct rte_flow_error *error
ret = rte_flow_error_set(error, EINVAL,

RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,

drivers/net/mlx5/linux/mlx5_os.c +1 -0
 					 "Failed to create control tables.");
+	if (priv->hw_tx_meta_cpy_tbl) {

I assume it should be hw_lacp_rx_tbl here. Can you please send v2 for that? And LGTM for left code. It's OK to add my ack for v2.

Quoted 3 lines
drivers/net/mlx5/linux/mlx5_os.c +3 -0
+		flow_hw_table_destroy(dev, priv->hw_tx_meta_cpy_tbl, NULL);
+		priv->hw_tx_meta_cpy_tbl = NULL;
+	}

[snip]

Quoted 1 line

2.34.1

author
#2 lore raw

Hi Suanming,

My answers are inline.

Quoted 64 lines

-----Original Message-----
From: Suanming Mou <[email protected]>
Sent: Monday, November 13, 2023 9:14 PM
To: Bing Zhao <[email protected]>; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Raslan Darawsheh <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; Dariusz Sosnowski <[email protected]>; [email protected]
Subject: RE: [PATCH] net/mlx5: fix the LACP redirection in Rx domain

Hi,

One small comment, v2 is needed.

Quoted 10 lines

-----Original Message-----
From: Bing Zhao <[email protected]>
Sent: Monday, November 13, 2023 8:42 PM
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Raslan Darawsheh <[email protected]>; Suanming Mou <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; Dariusz Sosnowski <[email protected]>; [email protected]
Subject: [PATCH] net/mlx5: fix the LACP redirection in Rx domain

Quoted 4 lines

When the "lacp_by_user" is not set from the application in bond mode, the LACP traffic should be handled by the kernel driver by default.

This commit adds the missing support in the template API when

"dv_flow_en=2".

Quoted 6 lines

The behavior will be the same as that in the DV mode with "dv_flow_en=1". The LACP packets will be redirected to the kernel when starting the steering in the NIC Rx domain.

With this commit, the DEFAULT_MISS action usage is refactored a bit. In the HWS, one unique action can be created with supported bits set in the

"flag"

Quoted 9 lines

per port. The *ROOT_FDB and *HWS_FDB flag bits will only be set when the port is in switchdev mode and working as the E-Switch manager proxy port. The SF/VF and all other representors won't have the FDB flag bits when creating the DEFAULT_MISS action.

Fixes 9fa7c1cddb85 ("net/mlx5: create control flow rules with HWS")
Quoted 6 lines
---
 drivers/net/mlx5/linux/mlx5_os.c |   8 +-
 drivers/net/mlx5/mlx5.h          |   1 +
 drivers/net/mlx5/mlx5_flow.h     |   1 +
 drivers/net/mlx5/mlx5_flow_hw.c  | 249

+++++++++++++++++++++++++++++--

Quoted 5 lines
 drivers/net/mlx5/mlx5_trigger.c  |   3 +
 5 files changed, 249 insertions(+), 13 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +0 -0

[snip]

Quoted 4 lines
drivers/net/mlx5/linux/mlx5_os.c +0 -0
@@ -8327,6 +8503,10 @@ flow_hw_create_ctrl_tables(struct rte_eth_dev
 *dev, struct rte_flow_error *error
 		ret = rte_flow_error_set(error, EINVAL,
 
Quoted 7 lines

drivers/net/mlx5/linux/mlx5_os.c flow_hw_create_ctrl_tables(struct rte_eth_dev · line 8508

Quoted 3 lines
drivers/net/mlx5/linux/mlx5_os.c +1 -0
 RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
 					 "Failed to create control tables.");
+	if (priv->hw_tx_meta_cpy_tbl) {

I assume it should be hw_lacp_rx_tbl here. Can you please send v2 for that? And LGTM for left code. It's OK to add my ack for v2.

Since it is a "goto" label, when arriving here from the LACP error branch, the previous tables were created successfully. The LACP table is the last one from the code and it will never be NULL when reaching here. What should be rollbaked is the previous one.

This is some disadvantage of using goto in the code, not quite straightforward.

Quoted 10 lines

drivers/net/mlx5/linux/mlx5_os.c flow_hw_create_ctrl_tables(struct rte_eth_dev · line 8509

Quoted 3 lines
drivers/net/mlx5/linux/mlx5_os.c +1 -0
+		flow_hw_table_destroy(dev, priv->hw_tx_meta_cpy_tbl,

NULL);

Quoted 2 lines
drivers/net/mlx5/linux/mlx5_os.c +2 -0
+		priv->hw_tx_meta_cpy_tbl = NULL;
+	}

[snip]

Quoted 1 line

2.34.1

BR. Bing

#3 lore raw

Hi,

Quoted 87 lines

-----Original Message-----
From: Bing Zhao <[email protected]>
Sent: Monday, November 13, 2023 9:51 PM
To: Suanming Mou <[email protected]>; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Raslan Darawsheh <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; Dariusz Sosnowski <[email protected]>; [email protected]
Subject: RE: [PATCH] net/mlx5: fix the LACP redirection in Rx domain

Hi Suanming,

My answers are inline.

Quoted 65 lines

-----Original Message-----
From: Suanming Mou <[email protected]>
Sent: Monday, November 13, 2023 9:14 PM
To: Bing Zhao <[email protected]>; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Raslan Darawsheh <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; Dariusz Sosnowski <[email protected]>; [email protected]
Subject: RE: [PATCH] net/mlx5: fix the LACP redirection in Rx domain

Hi,

One small comment, v2 is needed.

Quoted 10 lines

-----Original Message-----
From: Bing Zhao <[email protected]>
Sent: Monday, November 13, 2023 8:42 PM
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Raslan Darawsheh <[email protected]>; Suanming Mou <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; Dariusz Sosnowski <[email protected]>; [email protected]
Subject: [PATCH] net/mlx5: fix the LACP redirection in Rx domain

Quoted 4 lines

When the "lacp_by_user" is not set from the application in bond mode, the LACP traffic should be handled by the kernel driver by default.

This commit adds the missing support in the template API when

"dv_flow_en=2".

Quoted 7 lines

The behavior will be the same as that in the DV mode with "dv_flow_en=1". The LACP packets will be redirected to the kernel when starting the steering in the NIC Rx domain.

With this commit, the DEFAULT_MISS action usage is refactored a bit. In the HWS, one unique action can be created with supported bits set in the

"flag"

Quoted 9 lines

per port. The *ROOT_FDB and *HWS_FDB flag bits will only be set when the port is in switchdev mode and working as the E-Switch manager proxy port. The SF/VF and all other representors won't have the FDB flag bits when creating the DEFAULT_MISS action.

Fixes 9fa7c1cddb85 ("net/mlx5: create control flow rules with HWS")
Quoted 6 lines
---
 drivers/net/mlx5/linux/mlx5_os.c |   8 +-
 drivers/net/mlx5/mlx5.h          |   1 +
 drivers/net/mlx5/mlx5_flow.h     |   1 +
 drivers/net/mlx5/mlx5_flow_hw.c  | 249

+++++++++++++++++++++++++++++--

Quoted 5 lines
 drivers/net/mlx5/mlx5_trigger.c  |   3 +
 5 files changed, 249 insertions(+), 13 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +0 -0

[snip]

Quoted 4 lines
drivers/net/mlx5/linux/mlx5_os.c +0 -0
@@ -8327,6 +8503,10 @@ flow_hw_create_ctrl_tables(struct rte_eth_dev
 *dev, struct rte_flow_error *error
 		ret = rte_flow_error_set(error, EINVAL,
 
Quoted 7 lines

drivers/net/mlx5/linux/mlx5_os.c flow_hw_create_ctrl_tables(struct rte_eth_dev · line 8508

Quoted 3 lines
drivers/net/mlx5/linux/mlx5_os.c +1 -0
 RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
 					 "Failed to create control tables.");
+	if (priv->hw_tx_meta_cpy_tbl) {

I assume it should be hw_lacp_rx_tbl here. Can you please send v2 for that? And LGTM for left code. It's OK to add my ack for v2.

Quoted 6 lines

Since it is a "goto" label, when arriving here from the LACP error branch, the previous tables were created successfully.
The LACP table is the last one from the code and it will never be NULL when reaching here. What should be rollbaked is the previous one.

This is some disadvantage of using goto in the code, not quite straightforward.

OK, got it. Then no need for v2. Thanks.

Quoted 13 lines
Quoted 11 lines

drivers/net/mlx5/linux/mlx5_os.c flow_hw_create_ctrl_tables(struct rte_eth_dev · line 8509

Quoted 4 lines
drivers/net/mlx5/linux/mlx5_os.c +1 -0
+		flow_hw_table_destroy(dev, priv->hw_tx_meta_cpy_tbl,

NULL);

Quoted 2 lines
drivers/net/mlx5/linux/mlx5_os.c +2 -0
+		priv->hw_tx_meta_cpy_tbl = NULL;
+	}

[snip]

Quoted 1 line

2.34.1

BR. Bing

#4 lore raw
In reply to Bing Zhao

Hi,

Quoted 26 lines

-----Original Message-----
From: Bing Zhao <[email protected]>
Sent: Monday, November 13, 2023 2:42 PM
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Raslan Darawsheh <[email protected]>; Suanming Mou <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; Dariusz Sosnowski <[email protected]>; [email protected]
Subject: [PATCH] net/mlx5: fix the LACP redirection in Rx domain

When the "lacp_by_user" is not set from the application in bond mode, the LACP traffic should be handled by the kernel driver by default.

This commit adds the missing support in the template API when "dv_flow_en=2". The behavior will be the same as that in the DV mode with "dv_flow_en=1". The LACP packets will be redirected to the kernel when starting the steering in the NIC Rx domain.

With this commit, the DEFAULT_MISS action usage is refactored a bit. In the HWS, one unique action can be created with supported bits set in the "flag" per port. The *ROOT_FDB and *HWS_FDB flag bits will only be set when the port is in switchdev mode and working as the E-Switch manager proxy port. The SF/VF and all other representors won't have the FDB flag bits when creating the DEFAULT_MISS action.

Quoted 5 lines
Fixes 9fa7c1cddb85 ("net/mlx5: create control flow rules with HWS")

Patch applied to next-net-mlx,

Kindest regards
Raslan Darawsheh