Commit 137f3d50 authored by Jianbo Liu's avatar Jianbo Liu Committed by Jakub Kicinski

net/mlx5: Support matching on l4_type for ttc_table

Replace matching on TCP and UDP protocols with new l4_type field which
is parsed by steering for ttc_table. It is enabled by the
outer_l4_type or inner_l4_type bits in nic_rx or port_sel flow table
capabilities and used only if pcc_ifa2 bit in HCA capabilities is set.
Signed-off-by: default avatarJianbo Liu <jianbol@nvidia.com>
Reviewed-by: default avatarMark Bloch <mbloch@nvidia.com>
Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
Link: https://lore.kernel.org/r/20240402133043.56322-10-tariqt@nvidia.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 8c54c89a
...@@ -896,8 +896,7 @@ static void mlx5e_set_inner_ttc_params(struct mlx5e_flow_steering *fs, ...@@ -896,8 +896,7 @@ static void mlx5e_set_inner_ttc_params(struct mlx5e_flow_steering *fs,
int tt; int tt;
memset(ttc_params, 0, sizeof(*ttc_params)); memset(ttc_params, 0, sizeof(*ttc_params));
ttc_params->ns = mlx5_get_flow_namespace(fs->mdev, ttc_params->ns_type = MLX5_FLOW_NAMESPACE_KERNEL;
MLX5_FLOW_NAMESPACE_KERNEL);
ft_attr->level = MLX5E_INNER_TTC_FT_LEVEL; ft_attr->level = MLX5E_INNER_TTC_FT_LEVEL;
ft_attr->prio = MLX5E_NIC_PRIO; ft_attr->prio = MLX5E_NIC_PRIO;
...@@ -920,8 +919,7 @@ void mlx5e_set_ttc_params(struct mlx5e_flow_steering *fs, ...@@ -920,8 +919,7 @@ void mlx5e_set_ttc_params(struct mlx5e_flow_steering *fs,
int tt; int tt;
memset(ttc_params, 0, sizeof(*ttc_params)); memset(ttc_params, 0, sizeof(*ttc_params));
ttc_params->ns = mlx5_get_flow_namespace(fs->mdev, ttc_params->ns_type = MLX5_FLOW_NAMESPACE_KERNEL;
MLX5_FLOW_NAMESPACE_KERNEL);
ft_attr->level = MLX5E_TTC_FT_LEVEL; ft_attr->level = MLX5E_TTC_FT_LEVEL;
ft_attr->prio = MLX5E_NIC_PRIO; ft_attr->prio = MLX5E_NIC_PRIO;
......
...@@ -835,8 +835,7 @@ static void mlx5e_hairpin_set_ttc_params(struct mlx5e_hairpin *hp, ...@@ -835,8 +835,7 @@ static void mlx5e_hairpin_set_ttc_params(struct mlx5e_hairpin *hp,
memset(ttc_params, 0, sizeof(*ttc_params)); memset(ttc_params, 0, sizeof(*ttc_params));
ttc_params->ns = mlx5_get_flow_namespace(hp->func_mdev, ttc_params->ns_type = MLX5_FLOW_NAMESPACE_KERNEL;
MLX5_FLOW_NAMESPACE_KERNEL);
for (tt = 0; tt < MLX5_NUM_TT; tt++) { for (tt = 0; tt < MLX5_NUM_TT; tt++) {
ttc_params->dests[tt].type = MLX5_FLOW_DESTINATION_TYPE_TIR; ttc_params->dests[tt].type = MLX5_FLOW_DESTINATION_TYPE_TIR;
ttc_params->dests[tt].tir_num = ttc_params->dests[tt].tir_num =
......
...@@ -449,13 +449,11 @@ static void set_tt_map(struct mlx5_lag_port_sel *port_sel, ...@@ -449,13 +449,11 @@ static void set_tt_map(struct mlx5_lag_port_sel *port_sel,
static void mlx5_lag_set_inner_ttc_params(struct mlx5_lag *ldev, static void mlx5_lag_set_inner_ttc_params(struct mlx5_lag *ldev,
struct ttc_params *ttc_params) struct ttc_params *ttc_params)
{ {
struct mlx5_core_dev *dev = ldev->pf[MLX5_LAG_P1].dev;
struct mlx5_lag_port_sel *port_sel = &ldev->port_sel; struct mlx5_lag_port_sel *port_sel = &ldev->port_sel;
struct mlx5_flow_table_attr *ft_attr; struct mlx5_flow_table_attr *ft_attr;
int tt; int tt;
ttc_params->ns = mlx5_get_flow_namespace(dev, ttc_params->ns_type = MLX5_FLOW_NAMESPACE_PORT_SEL;
MLX5_FLOW_NAMESPACE_PORT_SEL);
ft_attr = &ttc_params->ft_attr; ft_attr = &ttc_params->ft_attr;
ft_attr->level = MLX5_LAG_FT_LEVEL_INNER_TTC; ft_attr->level = MLX5_LAG_FT_LEVEL_INNER_TTC;
...@@ -470,13 +468,11 @@ static void mlx5_lag_set_inner_ttc_params(struct mlx5_lag *ldev, ...@@ -470,13 +468,11 @@ static void mlx5_lag_set_inner_ttc_params(struct mlx5_lag *ldev,
static void mlx5_lag_set_outer_ttc_params(struct mlx5_lag *ldev, static void mlx5_lag_set_outer_ttc_params(struct mlx5_lag *ldev,
struct ttc_params *ttc_params) struct ttc_params *ttc_params)
{ {
struct mlx5_core_dev *dev = ldev->pf[MLX5_LAG_P1].dev;
struct mlx5_lag_port_sel *port_sel = &ldev->port_sel; struct mlx5_lag_port_sel *port_sel = &ldev->port_sel;
struct mlx5_flow_table_attr *ft_attr; struct mlx5_flow_table_attr *ft_attr;
int tt; int tt;
ttc_params->ns = mlx5_get_flow_namespace(dev, ttc_params->ns_type = MLX5_FLOW_NAMESPACE_PORT_SEL;
MLX5_FLOW_NAMESPACE_PORT_SEL);
ft_attr = &ttc_params->ft_attr; ft_attr = &ttc_params->ft_attr;
ft_attr->level = MLX5_LAG_FT_LEVEL_TTC; ft_attr->level = MLX5_LAG_FT_LEVEL_TTC;
......
...@@ -40,7 +40,7 @@ struct mlx5_ttc_rule { ...@@ -40,7 +40,7 @@ struct mlx5_ttc_rule {
struct mlx5_ttc_table; struct mlx5_ttc_table;
struct ttc_params { struct ttc_params {
struct mlx5_flow_namespace *ns; enum mlx5_flow_namespace_type ns_type;
struct mlx5_flow_table_attr ft_attr; struct mlx5_flow_table_attr ft_attr;
struct mlx5_flow_destination dests[MLX5_NUM_TT]; struct mlx5_flow_destination dests[MLX5_NUM_TT];
DECLARE_BITMAP(ignore_dests, MLX5_NUM_TT); DECLARE_BITMAP(ignore_dests, MLX5_NUM_TT);
......
...@@ -1336,6 +1336,9 @@ enum mlx5_qcam_feature_groups { ...@@ -1336,6 +1336,9 @@ enum mlx5_qcam_feature_groups {
#define MLX5_CAP_ESW_FT_FIELD_SUPPORT_2(mdev, cap) \ #define MLX5_CAP_ESW_FT_FIELD_SUPPORT_2(mdev, cap) \
MLX5_CAP_ESW_FLOWTABLE(mdev, ft_field_support_2_esw_fdb.cap) MLX5_CAP_ESW_FLOWTABLE(mdev, ft_field_support_2_esw_fdb.cap)
#define MLX5_CAP_NIC_RX_FT_FIELD_SUPPORT_2(mdev, cap) \
MLX5_CAP_FLOWTABLE(mdev, ft_field_support_2_nic_receive.cap)
#define MLX5_CAP_ESW(mdev, cap) \ #define MLX5_CAP_ESW(mdev, cap) \
MLX5_GET(e_switch_cap, \ MLX5_GET(e_switch_cap, \
mdev->caps.hca[MLX5_CAP_ESWITCH]->cur, cap) mdev->caps.hca[MLX5_CAP_ESWITCH]->cur, cap)
...@@ -1359,6 +1362,9 @@ enum mlx5_qcam_feature_groups { ...@@ -1359,6 +1362,9 @@ enum mlx5_qcam_feature_groups {
#define MLX5_CAP_FLOWTABLE_PORT_SELECTION(mdev, cap) \ #define MLX5_CAP_FLOWTABLE_PORT_SELECTION(mdev, cap) \
MLX5_CAP_PORT_SELECTION(mdev, flow_table_properties_port_selection.cap) MLX5_CAP_PORT_SELECTION(mdev, flow_table_properties_port_selection.cap)
#define MLX5_CAP_PORT_SELECTION_FT_FIELD_SUPPORT_2(mdev, cap) \
MLX5_CAP_PORT_SELECTION(mdev, ft_field_support_2_port_selection.cap)
#define MLX5_CAP_ODP(mdev, cap)\ #define MLX5_CAP_ODP(mdev, cap)\
MLX5_GET(odp_cap, mdev->caps.hca[MLX5_CAP_ODP]->cur, cap) MLX5_GET(odp_cap, mdev->caps.hca[MLX5_CAP_ODP]->cur, cap)
......
...@@ -416,7 +416,10 @@ struct mlx5_ifc_flow_table_fields_supported_bits { ...@@ -416,7 +416,10 @@ struct mlx5_ifc_flow_table_fields_supported_bits {
/* Table 2170 - Flow Table Fields Supported 2 Format */ /* Table 2170 - Flow Table Fields Supported 2 Format */
struct mlx5_ifc_flow_table_fields_supported_2_bits { struct mlx5_ifc_flow_table_fields_supported_2_bits {
u8 reserved_at_0[0xe]; u8 reserved_at_0[0x2];
u8 inner_l4_type[0x1];
u8 outer_l4_type[0x1];
u8 reserved_at_4[0xa];
u8 bth_opcode[0x1]; u8 bth_opcode[0x1];
u8 reserved_at_f[0x1]; u8 reserved_at_f[0x1];
u8 tunnel_header_0_1[0x1]; u8 tunnel_header_0_1[0x1];
...@@ -525,6 +528,12 @@ union mlx5_ifc_ipv6_layout_ipv4_layout_auto_bits { ...@@ -525,6 +528,12 @@ union mlx5_ifc_ipv6_layout_ipv4_layout_auto_bits {
u8 reserved_at_0[0x80]; u8 reserved_at_0[0x80];
}; };
enum {
MLX5_PACKET_L4_TYPE_NONE,
MLX5_PACKET_L4_TYPE_TCP,
MLX5_PACKET_L4_TYPE_UDP,
};
struct mlx5_ifc_fte_match_set_lyr_2_4_bits { struct mlx5_ifc_fte_match_set_lyr_2_4_bits {
u8 smac_47_16[0x20]; u8 smac_47_16[0x20];
...@@ -550,7 +559,8 @@ struct mlx5_ifc_fte_match_set_lyr_2_4_bits { ...@@ -550,7 +559,8 @@ struct mlx5_ifc_fte_match_set_lyr_2_4_bits {
u8 tcp_sport[0x10]; u8 tcp_sport[0x10];
u8 tcp_dport[0x10]; u8 tcp_dport[0x10];
u8 reserved_at_c0[0x10]; u8 l4_type[0x2];
u8 reserved_at_c2[0xe];
u8 ipv4_ihl[0x4]; u8 ipv4_ihl[0x4];
u8 reserved_at_c4[0x4]; u8 reserved_at_c4[0x4];
...@@ -846,7 +856,11 @@ struct mlx5_ifc_flow_table_nic_cap_bits { ...@@ -846,7 +856,11 @@ struct mlx5_ifc_flow_table_nic_cap_bits {
struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_transmit_sniffer; struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_transmit_sniffer;
u8 reserved_at_e00[0x700]; u8 reserved_at_e00[0x600];
struct mlx5_ifc_flow_table_fields_supported_2_bits ft_field_support_2_nic_receive;
u8 reserved_at_1480[0x80];
struct mlx5_ifc_flow_table_fields_supported_2_bits ft_field_support_2_nic_receive_rdma; struct mlx5_ifc_flow_table_fields_supported_2_bits ft_field_support_2_nic_receive_rdma;
...@@ -876,7 +890,9 @@ struct mlx5_ifc_port_selection_cap_bits { ...@@ -876,7 +890,9 @@ struct mlx5_ifc_port_selection_cap_bits {
struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_port_selection; struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_port_selection;
u8 reserved_at_400[0x7c00]; struct mlx5_ifc_flow_table_fields_supported_2_bits ft_field_support_2_port_selection;
u8 reserved_at_480[0x7b80];
}; };
enum { enum {
...@@ -2004,7 +2020,13 @@ struct mlx5_ifc_cmd_hca_cap_2_bits { ...@@ -2004,7 +2020,13 @@ struct mlx5_ifc_cmd_hca_cap_2_bits {
u8 reserved_at_3a0[0x10]; u8 reserved_at_3a0[0x10];
u8 max_rqt_vhca_id[0x10]; u8 max_rqt_vhca_id[0x10];
u8 reserved_at_3c0[0x440]; u8 reserved_at_3c0[0x20];
u8 reserved_at_3e0[0x10];
u8 pcc_ifa2[0x1];
u8 reserved_at_3f1[0xf];
u8 reserved_at_400[0x400];
}; };
enum mlx5_ifc_flow_destination_type { enum mlx5_ifc_flow_destination_type {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment