net/mlx5: fix mark action creation
PATCH 1/1 net/mlx5: fix mark action creation
Mark flow action is implemented using a flow tag action exposed by HWS layer.
Whenever flow tag action is used in FDB domain, HWS layer has to create relevant STC for both FDB sides, i.e., FDB_RX and FDB_TX.
Flow tag action is not supported on FDB_TX.
This patch adds missing STC fixup code when FDB domain is used, so that on FDB_TX side, NOP action is used in place of flow tag.
It also updates the higher level mlx5 PMD code to reject usage of mark flow action in actions templates with transfer attribute set, and prohibits creation of flow tag action on FDB
if it is not supported by current FW.
--- drivers/common/mlx5/mlx5_devx_cmds.c | 3 +++ drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 2 +- drivers/net/mlx5/hws/mlx5dr_action.c | 10 ++++++++++ drivers/net/mlx5/mlx5_flow_hw.c | 12 +++++++++--- 5 files changed, 24 insertions(+), 4 deletions(-)
drivers/common/mlx5/mlx5_devx_cmds.c +3 -0
@@ -1366,6 +1366,9 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, attr->fdb_unified_en =MLX5_GET (wqe_based_flow_table_cap, hcattr, fdb_unified_en); + attr->fdb_rx_set_flow_tag_stc =MLX5_GET (wqe_based_flow_table_cap, + hcattr, + fdb_rx_set_flow_tag_stc); stc_action_type_127_64 =MLX5_GET64 (wqe_based_flow_table_cap, hcattr, stc_action_type_127_64);
drivers/common/mlx5/mlx5_devx_cmds.h +1 -0
@@ -327,6 +327,7 @@ struct mlx5_hca_attr { uint32_t wqe_based_flow_table_sup:1; uint32_t fdb_unified_en:1; uint32_t jump_fdb_rx_en:1; + uint32_t fdb_rx_set_flow_tag_stc:1;uint8_t max_header_modify_pattern_length;uint64_t system_image_guid; uint32_t log_max_conn_track_offload:5;
drivers/common/mlx5/mlx5_prm.h +1 -1
@@ -2480,7 +2480,7 @@ struct mlx5_ifc_wqe_based_flow_table_cap_bits {u8 ste_format_gen_wqe[0x10 ];u8 linear_match_definer_reg_c3[0x20 ];u8 fdb_jump_to_tir_stc[0x1 ]; -u8 reserved_at_1c1[0x1 ]; +u8 fdb_rx_set_flow_tag_stc[0x1 ];u8 fdb_unified_en[0x1 ];u8 reserved_at_1c3[0x1d ]; };
drivers/net/mlx5/hws/mlx5dr_action.c +10 -0
@@ -81,6 +81,7 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_BIT (MLX5DR_ACTION_TYP_POP_VLAN ),BIT (MLX5DR_ACTION_TYP_POP_VLAN ),BIT (MLX5DR_ACTION_TYP_CTR ), +BIT (MLX5DR_ACTION_TYP_TAG ),BIT (MLX5DR_ACTION_TYP_ASO_METER ),BIT (MLX5DR_ACTION_TYP_ASO_CT ), BIT(MLX5DR_ACTION_TYP_PUSH_VLAN),
@@ -877,6 +878,15 @@ mlx5dr_action_fixup_stc_attr(struct mlx5dr_context *ctx, use_fixup = true;break ; +case MLX5_IFC_STC_ACTION_TYPE_TAG : +if (fw_tbl_type ==FS_FT_FDB_TX ) { + fixup_stc_attr->action_type =MLX5_IFC_STC_ACTION_TYPE_NOP ; + fixup_stc_attr->action_offset =MLX5DR_ACTION_OFFSET_DW5 ; + fixup_stc_attr->stc_offset = stc_attr->stc_offset; + use_fixup = true; + } +break ; +case MLX5_IFC_STC_ACTION_TYPE_ALLOW :if (mlx5dr_table_is_fw_fdb_any (fw_tbl_type)) { fixup_stc_attr->action_type =MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_VPORT ;
drivers/net/mlx5/mlx5_flow_hw.c +9 -3
@@ -6898,6 +6898,12 @@ mlx5_hw_validate_action_mark(struct rte_eth_dev *dev, .transfer = template_attr->transfer }; +if (template_attr->transfer && + !MLX5_SH (dev)->cdev->config.hca_attr.fdb_rx_set_flow_tag_stc) +return rte_flow_error_set (error,ENOTSUP ,RTE_FLOW_ERROR_TYPE_ACTION , + action, +"mark action not supported for transfer" ); +return mlx5_flow_validate_action_mark (dev, action, action_flags, &attr, error); }
@@ -12061,21 +12067,21 @@ __flow_hw_configure(struct rte_eth_dev *dev,for (i =0 ; i <MLX5_HW_ACTION_FLAG_MAX ; i++) {uint32_t act_flags =0 ;uint32_t tag_flags = mlx5_hw_act_flag[i][0 ]; +bool tag_fdb_rx = !!priv->sh->cdev->config.hca_attr.fdb_rx_set_flow_tag_stc; act_flags = mlx5_hw_act_flag[i][MLX5DR_TABLE_TYPE_NIC_RX ] | mlx5_hw_act_flag[i][MLX5DR_TABLE_TYPE_NIC_TX ];if (is_proxy) { -/* Tag action is valid only in FDB_Rx domain. */ if (unified_fdb) { act_flags |= (mlx5_hw_act_flag[i][MLX5DR_TABLE_TYPE_FDB_RX ] | mlx5_hw_act_flag[i][MLX5DR_TABLE_TYPE_FDB_TX ] | mlx5_hw_act_flag[i][MLX5DR_TABLE_TYPE_FDB_UNIFIED ]); -if (i ==MLX5_HW_ACTION_FLAG_NONE_ROOT ) +if (i ==MLX5_HW_ACTION_FLAG_NONE_ROOT && tag_fdb_rx) tag_flags |= mlx5_hw_act_flag[i][MLX5DR_TABLE_TYPE_FDB_RX ]; }else { act_flags |= mlx5_hw_act_flag[i][MLX5DR_TABLE_TYPE_FDB ]; -if (i ==MLX5_HW_ACTION_FLAG_NONE_ROOT ) +if (i ==MLX5_HW_ACTION_FLAG_NONE_ROOT && tag_fdb_rx) tag_flags |= mlx5_hw_act_flag[i][MLX5DR_TABLE_TYPE_FDB ]; } }
Signature · 1 line
2.39.5
Hi,
Quoted 15 lines · Dariusz Sosnowski
Mark flow action is implemented using a flow tag action exposed by HWS layer.
Whenever flow tag action is used in FDB domain, HWS layer has to create relevant STC for both FDB sides, i.e.,FDB_RXandFDB_TX.
Flow tag action is not supported onFDB_TX.This patch adds missing STC fixup code when FDB domain is used, so that on
FDB_TXside, NOP action is used in place of flow tag.It also updates the higher level mlx5 PMD code to reject usage of mark flow action in actions templates with transfer attribute set, and prohibits creation of flow tag action on FDB
if it is not supported by current FW.
Quoted 6 lines
Fixes 794b9b37922f ("net/mlx5: allow FDB RSS")Signed-off-by Erez Shitrit <[email protected]>Signed-off-by Dariusz Sosnowski <[email protected]>Acked-by Bing Zhao <[email protected]>Acked-by Suanming Mou <[email protected]>
Patch applied to next-net-mlx,
Kindest regards
Raslan Darawsheh