mlx5 unified fdb
A message that is not in the archive (sent off-list or not yet received): [email protected]
v2 cover mlx5 unified fdb
V1: initial version
V2: rebase + determine unified fdb based on FW capability
Bing Zhao (1):
net/mlx5: remove unneeded FDB flag on representor action
Ophir Munk (3):
common/mlx5: support FDB unified capability query net/mlx5: support FDB unified domain net/mlx5/hws: allow different types in miss validation
drivers/common/mlx5/mlx5_devx_cmds.c | 3 + drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/net/mlx5/hws/mlx5dr_table.c | 18 +- drivers/net/mlx5/linux/mlx5_os.c | 11 + drivers/net/mlx5/mlx5.h | 8 + drivers/net/mlx5/mlx5_flow_hw.c | 521 ++++++++++++++++++++++++----------- drivers/net/mlx5/mlx5_flow_meter.c | 16 +- drivers/net/mlx5/mlx5_flow_quota.c | 9 +- drivers/net/mlx5/mlx5_hws_cnt.c | 9 +- 9 files changed, 429 insertions(+), 167 deletions(-)
Signature · 1 line
2.8.4
PATCH v2 1/4 common/mlx5: support FDB unified capability query
This commit queries the FW for the new unified FDB mode and saves it in mlx5 shared device as fdb_unified_en bit.
--- drivers/common/mlx5/mlx5_devx_cmds.c | 3 +++ drivers/common/mlx5/mlx5_devx_cmds.h | 1 + 2 files changed, 4 insertions(+)
drivers/common/mlx5/mlx5_devx_cmds.c +3 -0
@@ -1349,6 +1349,9 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, attr->max_header_modify_pattern_length =MLX5_GET (wqe_based_flow_table_cap, hcattr, max_header_modify_pattern_length); + attr->fdb_unified_en =MLX5_GET (wqe_based_flow_table_cap, + hcattr, + fdb_unified_en); }/* Query HCA attribute for ROCE. */ if (attr->roce) {
drivers/common/mlx5/mlx5_devx_cmds.h +1 -0
@@ -325,6 +325,7 @@ struct mlx5_hca_attr { uint32_t cross_vhca:1; uint32_t lag_rx_port_affinity:1; uint32_t wqe_based_flow_table_sup:1; + uint32_t fdb_unified_en:1;uint8_t max_header_modify_pattern_length;uint64_t system_image_guid; uint32_t log_max_conn_track_offload:5;
Signature · 1 line
2.8.4
RE: [PATCH V2 1/4] common/mlx5: support FDB unified capability query
Quoted 12 lines
-----Original Message-----
From: Ophir Munk <[email protected]>
Sent: Wednesday, February 26, 2025 9:39 AM
To: Dariusz Sosnowski <[email protected]>; Slava Ovsiienko <[email protected]>; Bing Zhao <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>
Subject: [PATCH V2 1/4] common/mlx5: support FDB unified capability query
Quoted 4 lines
This commit queries the FW for the new unified FDB mode and saves it in mlx5 shared device as
fdb_unified_enbit.Signed-off-by Ophir Munk <[email protected]>
Best regards,
Dariusz Sosnowski
PATCH v2 2/4 net/mlx5: support FDB unified domain
In reply to Ophir MunkLegacy FDB domain is enhanced with optional three sub-domains: FDB_RX FDB_TX and FDB_UNIFIED. Based on FW capability bit mlx5 will work in either legacy or unified mode. To work in fdb unified mode the flow attribute transfer bit must be set and the fdb sub domains are determined by the table specialize flags SPECIALIZE_TRANSFER_WIRE_ORIG and SPECIALIZE_TRANSFER_VPORT_ORIG.
+------------+-------------+--------------+ | WIRE_ORIG | VPORT_ORIG | FDB domain | +------------+-------------+--------------+ | 0 | 0 | FDB_UNIFIED | | 0 | 1 | FDB_TX | | 1 | 0 | FDB_RX | +------------+-------------+--------------+
There can be no two groups which only differ in their fdb sub domain. A table must be created in a group which has the same fdb sub domain.
--- drivers/net/mlx5/linux/mlx5_os.c | 11 + drivers/net/mlx5/mlx5.h | 8 + drivers/net/mlx5/mlx5_flow_hw.c | 519 ++++++++++++++++++++++++++----------- drivers/net/mlx5/mlx5_flow_meter.c | 16 +- drivers/net/mlx5/mlx5_flow_quota.c | 9 +- drivers/net/mlx5/mlx5_hws_cnt.c | 9 +- 6 files changed, 409 insertions(+), 163 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +11 -0
@@ -1707,6 +1707,17 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,LIST_INIT (&priv->hw_ext_ctrl_flows);if (priv->sh->config.dv_flow_en ==2 ) {#ifdef HAVE_MLX5_HWS_SUPPORT +/* +* Unified FDB flag is only needed for the actions created on the transfer +* port. proxy port. It is not needed on the following ports: +* 1. NIC PF / VF / SF +* 2. in Verbs or DV/DR mode +* 3. with unsupported FW +* 4. all representors in HWS +*/ + priv->unified_fdb_en = !!priv->master && sh->cdev->config.hca_attr.fdb_unified_en; +DRV_LOG (DEBUG ,"port %u: unified FDB %s enabled." , + eth_dev->data->port_id, priv->unified_fdb_en ?"is" :"isn't" );if (priv->sh->config.dv_esw_en) {uint32_t usable_bits;uint32_t required_bits;
drivers/net/mlx5/mlx5.h +8 -0
@@ -1986,6 +1986,7 @@ struct mlx5_priv { uint32_t mark_enabled:1; /* If mark action is enabled on rxqs. */ uint32_t num_lag_ports:4; /* Number of ports can be bonded. */ uint32_t tunnel_enabled:1; /* If tunnel offloading is enabled on rxqs. */ + uint32_t unified_fdb_en:1; /* Unified FDB flag per port. */uint16_t domain_id;/* Switch domain identifier. */ uint16_t vport_id;/* Associated VF vport index (if any). */ uint32_t vport_meta_tag;/* Used for vport index match ove VF LAG. */
@@ -2226,6 +2227,13 @@ mlx5_is_port_on_mpesw_device(struct mlx5_priv *priv)return priv->mpesw_port >=0 ; } +static inline bool +is_unified_fdb (const struct mlx5_priv *priv) +{ +/* Only needed on proxy port in E-Switch mode. */ +return priv->unified_fdb_en; +} +/* mlx5.c */ int mlx5_getenv_int (const char *);
drivers/net/mlx5/mlx5_flow_hw.c +363 -156
913 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_meter.c +13 -3
@@ -105,7 +105,11 @@ mlx5_flow_meter_init_guest(struct rte_eth_dev *dev) priv->hws_mpool->devx_obj = host_priv->hws_mpool->devx_obj; flags =MLX5DR_ACTION_FLAG_HWS_RX |MLX5DR_ACTION_FLAG_HWS_TX ;if (priv->sh->config.dv_esw_en && priv->master) - flags |=MLX5DR_ACTION_FLAG_HWS_FDB ; + flags |= (is_unified_fdb (priv) ? + (MLX5DR_ACTION_FLAG_HWS_FDB_RX | +MLX5DR_ACTION_FLAG_HWS_FDB_TX | +MLX5DR_ACTION_FLAG_HWS_FDB_UNIFIED ) : +MLX5DR_ACTION_FLAG_HWS_FDB ); priv->hws_mpool->action =mlx5dr_action_create_aso_meter (priv->dr_ctx, (struct mlx5dr_devx_obj *)priv->hws_mpool->devx_obj, reg_id -REG_C_0 , flags);
@@ -188,8 +192,14 @@ mlx5_flow_meter_init(struct rte_eth_dev *dev, goto err; } flags =MLX5DR_ACTION_FLAG_HWS_RX |MLX5DR_ACTION_FLAG_HWS_TX ; -if (priv->sh->config.dv_esw_en && priv->master) - flags |=MLX5DR_ACTION_FLAG_HWS_FDB ; +if (priv->sh->config.dv_esw_en && priv->master) { + flags |= ((is_unified_fdb (priv)) ? + (MLX5DR_ACTION_FLAG_HWS_FDB_RX | +MLX5DR_ACTION_FLAG_HWS_FDB_TX | +MLX5DR_ACTION_FLAG_HWS_FDB_UNIFIED ) : +MLX5DR_ACTION_FLAG_HWS_FDB ); + } + priv->mtr_bulk.action =mlx5dr_action_create_aso_meter (priv->dr_ctx, (struct mlx5dr_devx_obj *)dcs, reg_id -REG_C_0 , flags);
drivers/net/mlx5/mlx5_flow_quota.c +7 -2
@@ -741,8 +741,13 @@ mlx5_flow_quota_init(struct rte_eth_dev *dev, uint32_t nb_quotas) ret =mlx5_quota_init_guest (priv);if (ret) goto err; -if (priv->sh->config.dv_esw_en && priv->master) - flags |=MLX5DR_ACTION_FLAG_HWS_FDB ; +if (priv->sh->config.dv_esw_en && priv->master) { + flags |= (is_unified_fdb (priv) ? + (MLX5DR_ACTION_FLAG_HWS_FDB_RX | +MLX5DR_ACTION_FLAG_HWS_FDB_TX | +MLX5DR_ACTION_FLAG_HWS_FDB_UNIFIED ) : +MLX5DR_ACTION_FLAG_HWS_FDB ); + } qctx->dr_action =mlx5dr_action_create_aso_meter (priv->dr_ctx, (struct mlx5dr_devx_obj *)qctx->devx_obj, reg_id -REG_C_0 , flags);
drivers/net/mlx5/mlx5_hws_cnt.c +7 -2
@@ -666,8 +666,13 @@ mlx5_hws_cnt_pool_action_create(struct mlx5_priv *priv,uint32_t flags; flags =MLX5DR_ACTION_FLAG_HWS_RX |MLX5DR_ACTION_FLAG_HWS_TX ; -if (priv->sh->config.dv_esw_en && priv->master) - flags |=MLX5DR_ACTION_FLAG_HWS_FDB ; +if (priv->sh->config.dv_esw_en && priv->master) { + flags |= (is_unified_fdb (priv) ? + (MLX5DR_ACTION_FLAG_HWS_FDB_RX | +MLX5DR_ACTION_FLAG_HWS_FDB_TX | +MLX5DR_ACTION_FLAG_HWS_FDB_UNIFIED ) : +MLX5DR_ACTION_FLAG_HWS_FDB ); + }for (idx =0 ; idx < hpool->dcs_mng.batch_total; idx++) {struct mlx5_hws_cnt_dcs *hdcs = &hpool->dcs_mng.dcs[idx];struct mlx5_hws_cnt_dcs *dcs = &cpool->dcs_mng.dcs[idx];
Signature · 1 line
2.8.4
RE: [PATCH V2 2/4] net/mlx5: support FDB unified domain
Quoted 27 lines
-----Original Message-----
From: Ophir Munk <[email protected]>
Sent: Wednesday, February 26, 2025 9:39 AM
To: Dariusz Sosnowski <[email protected]>; Slava Ovsiienko <[email protected]>; Bing Zhao <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>
Subject: [PATCH V2 2/4] net/mlx5: support FDB unified domainLegacy FDB domain is enhanced with optional three sub-domains:
FDB_RXFDB_TXandFDB_UNIFIED. Based on FW capability bit mlx5 will work in either legacy or unified mode. To work in fdb unified mode the flow attribute transfer bit must be set and the fdb sub domains are determined by the table specialize flagsSPECIALIZE_TRANSFER_WIRE_ORIGandSPECIALIZE_TRANSFER_VPORT_ORIG.+------------+-------------+--------------+ | WIRE_ORIG | VPORT_ORIG | FDB domain | +------------+-------------+--------------+ | 0 | 0 | FDB_UNIFIED | | 0 | 1 | FDB_TX | | 1 | 0 | FDB_RX | +------------+-------------+--------------+
Quoted 4 lines
There can be no two groups which only differ in their fdb sub domain. A table must be created in a group which has the same fdb sub domain.
Signed-off-by Ophir Munk <[email protected]>
Best regards,
Dariusz Sosnowski
PATCH v2 3/4 net/mlx5: remove unneeded FDB flag on representor action
In reply to Ophir MunkFrom: Bing Zhao <[email protected]>
The "send_to_kernel" action is shared and created during the HWS configuration stage. By default, the NIC Rx and Tx flags are needed.
There is only one case that the FDB* flags are needed when creating the action, the same as other shared actions. Only the transfer proxy port needs the FDB* flags for shared actions.
Removing the unneeded FDB flags will help to save the resources of memory and STCs.
--- drivers/net/mlx5/mlx5_flow_hw.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +6 -8
@@ -9649,21 +9649,18 @@ _create_send_to_kernel_actions(struct mlx5_priv *priv, int type) }static void -flow_hw_create_send_to_kernel_actions (struct mlx5_priv *priv) +flow_hw_create_send_to_kernel_actions (struct mlx5_priv *priv,bool is_proxy) {#ifdef HAVE_MLX5DV_DR_ACTION_CREATE_DEST_ROOT_TABLE int i, from, to; -bool is_vf_sf_dev = priv->sh->dev_cap.vf || priv->sh->dev_cap.sf;bool unified_fdb =is_unified_fdb (priv);for (i =MLX5DR_TABLE_TYPE_NIC_RX ; i <=MLX5DR_TABLE_TYPE_NIC_TX ; i++)_create_send_to_kernel_actions (priv, i); -if (priv->sh->config.dv_esw_en && !is_vf_sf_dev) { - from = unified_fdb ?MLX5DR_TABLE_TYPE_FDB_RX : -MLX5DR_TABLE_TYPE_FDB ; - to = unified_fdb ?MLX5DR_TABLE_TYPE_FDB_UNIFIED : -MLX5DR_TABLE_TYPE_FDB ; +if (is_proxy) { + from = unified_fdb ?MLX5DR_TABLE_TYPE_FDB_RX :MLX5DR_TABLE_TYPE_FDB ; + to = unified_fdb ?MLX5DR_TABLE_TYPE_FDB_UNIFIED :MLX5DR_TABLE_TYPE_FDB ;for (i = from; i <= to; i++)_create_send_to_kernel_actions (priv, i); }
@@ -9674,6 +9671,7 @@ static void flow_hw_destroy_send_to_kernel_action(struct mlx5_priv *priv) {int i; +for (i =MLX5DR_TABLE_TYPE_NIC_RX ; i <MLX5DR_TABLE_TYPE_MAX ; i++) {if (priv->hw_send_to_kernel[i]) {mlx5dr_action_destroy (priv->hw_send_to_kernel[i]);
@@ -12171,7 +12169,7 @@ __flow_hw_configure(struct rte_eth_dev *dev, } }if (!priv->shared_host) -flow_hw_create_send_to_kernel_actions (priv); +flow_hw_create_send_to_kernel_actions (priv, is_proxy);if (port_attr->nb_conn_tracks || (host_priv && host_priv->hws_ctpool)) {if (mlx5_flow_ct_init (dev, port_attr->nb_conn_tracks, nb_q_updated)) goto err;
Signature · 1 line
2.8.4
RE: [PATCH V2 3/4] net/mlx5: remove unneeded FDB flag on representor action
Quoted 23 lines
-----Original Message-----
From: Ophir Munk <[email protected]>
Sent: Wednesday, February 26, 2025 9:39 AM
To: Dariusz Sosnowski <[email protected]>; Slava Ovsiienko <[email protected]>; Bing Zhao <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>; Jiawei(Jonny) Wang <[email protected]>
Subject: [PATCH V2 3/4] net/mlx5: remove unneeded FDB flag on representor actionFrom: Bing Zhao <[email protected]>
The "
send_to_kernel" action is shared and created during the HWS configuration stage. By default, the NIC Rx and Tx flags are needed.There is only one case that the FDB* flags are needed when creating the action, the same as other shared actions. Only the transfer proxy port needs the FDB* flags for shared actions.
Quoted 7 lines
Removing the unneeded FDB flags will help to save the resources of memory and STCs.
Fixes 07836ba156cb ("net/mlx5: fix device checking for send to kernel action")Signed-off-by Bing Zhao <[email protected]>
Best regards,
Dariusz Sosnowski
PATCH v2 4/4 net/mlx5/hws: allow different types in miss validation
In reply to Ophir MunkIn validating Jump from group A to default miss group B DPDK requests that both groups types will be identical. In practice jumping from FDB_UNIFIED to FDB_RX or FDB_TX group types (or vice versa) is allowed. This commit enables this jumping between the different types.
--- drivers/net/mlx5/hws/mlx5dr_table.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/net/mlx5/hws/mlx5dr_table.c +16 -2
@@ -626,6 +626,19 @@ int mlx5dr_table_connect_to_miss_table(struct mlx5dr_table *src_tbl,return 0 ; } +static bool mlx5dr_table_set_default_miss_valid_types (enum mlx5dr_table_type from, +enum mlx5dr_table_type to) +{ +if (from == to || + ((from ==MLX5DR_TABLE_TYPE_FDB_UNIFIED && + (to ==MLX5DR_TABLE_TYPE_FDB_RX || to ==MLX5DR_TABLE_TYPE_FDB_TX )) || + (to ==MLX5DR_TABLE_TYPE_FDB_UNIFIED && + (from ==MLX5DR_TABLE_TYPE_FDB_RX || from ==MLX5DR_TABLE_TYPE_FDB_TX )))) +return true; + +return false; +} +static int mlx5dr_table_set_default_miss_not_valid (struct mlx5dr_table *tbl,struct mlx5dr_table *miss_tbl) {
@@ -637,8 +650,9 @@ static int mlx5dr_table_set_default_miss_not_valid(struct mlx5dr_table *tbl, }if (mlx5dr_table_is_root (tbl) || - (miss_tbl &&mlx5dr_table_is_root (miss_tbl)) || - (miss_tbl && miss_tbl->type != tbl->type)) { + (miss_tbl && + ((mlx5dr_table_is_root (miss_tbl)) || + !mlx5dr_table_set_default_miss_valid_types (tbl->type, miss_tbl->type)))) {DR_LOG (ERR ,"Invalid arguments" ); rte_errno =EINVAL ;return -rte_errno;
Signature · 1 line
2.8.4
RE: [PATCH V2 4/4] net/mlx5/hws: allow different types in miss validation
Quoted 12 lines
-----Original Message-----
From: Ophir Munk <[email protected]>
Sent: Wednesday, February 26, 2025 9:39 AM
To: Dariusz Sosnowski <[email protected]>; Slava Ovsiienko <[email protected]>; Bing Zhao <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>
Subject: [PATCH V2 4/4]net/mlx5/hws: allow different types in miss validation
Quoted 8 lines
In validating Jump from group A to default miss group B DPDK requests that both groups types will be identical. In practice jumping from
FDB_UNIFIEDtoFDB_RXorFDB_TXgroup types (or vice versa) is allowed.
This commit enables this jumping between the different types.Fixes b81f95ca770d ("net/mlx5/hws: support default miss table")Signed-off-by Ophir Munk <[email protected]>
Best regards,
Dariusz Sosnowski
Hi,
From: Ophir Munk <[email protected]>
Sent: Wednesday, February 26, 2025 10:38 AM
To: Dariusz Sosnowski; Slava Ovsiienko; Bing Zhao; Ori Kam; Suanming Mou; Matan Azrad
Cc: [email protected]; Raslan Darawsheh
Subject: [PATCH V2 0/4] mlx5 unified fdb
V1: initial version
V2: rebase + determine unified fdb based on FW capability
Bing Zhao (1):
net/mlx5: remove unneeded FDB flag on representor action
Ophir Munk (3):
common/mlx5: support FDB unified capability query net/mlx5: support FDB unified domain net/mlx5/hws: allow different types in miss validation
drivers/common/mlx5/mlx5_devx_cmds.c | 3 + drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/net/mlx5/hws/mlx5dr_table.c | 18 +- drivers/net/mlx5/linux/mlx5_os.c | 11 + drivers/net/mlx5/mlx5.h | 8 + drivers/net/mlx5/mlx5_flow_hw.c | 521 ++++++++++++++++++++++++----------- drivers/net/mlx5/mlx5_flow_meter.c | 16 +- drivers/net/mlx5/mlx5_flow_quota.c | 9 +- drivers/net/mlx5/mlx5_hws_cnt.c | 9 +- 9 files changed, 429 insertions(+), 167 deletions(-)
--
2.8.4
rebased squashed second and third patch together,
series applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh