net/mlx5e: Move management of indir traffic types to rx_res
This commit moves the responsibility of keeping the RSS configuration for different traffic types to en/rx_res.{c,h}, hiding the implementation details behind the new getters, and abandons all usage of struct mlx5e_tirc_config, which is no longer useful and superseded by struct mlx5e_rss_params_traffic_type. Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com> Reviewed-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
This commit is contained in:
parent
a6696735d6
commit
65d6b6e5a5
|
@ -27,7 +27,8 @@ mlx5_core-$(CONFIG_MLX5_CORE_EN) += en_main.o en_common.o en_fs.o en_ethtool.o \
|
|||
en_selftest.o en/port.o en/monitor_stats.o en/health.o \
|
||||
en/reporter_tx.o en/reporter_rx.o en/params.o en/xsk/pool.o \
|
||||
en/xsk/setup.o en/xsk/rx.o en/xsk/tx.o en/devlink.o en/ptp.o \
|
||||
en/qos.o en/trap.o en/fs_tt_redirect.o en/rqt.o en/tir.o
|
||||
en/qos.o en/trap.o en/fs_tt_redirect.o en/rqt.o en/tir.o \
|
||||
en/rx_res.o
|
||||
|
||||
#
|
||||
# Netdev extra
|
||||
|
|
|
@ -922,7 +922,6 @@ int mlx5e_vlan_rx_kill_vid(struct net_device *dev, __always_unused __be16 proto,
|
|||
void mlx5e_timestamp_init(struct mlx5e_priv *priv);
|
||||
|
||||
int mlx5e_modify_tirs_hash(struct mlx5e_priv *priv);
|
||||
struct mlx5e_tirc_config mlx5e_tirc_get_default_config(enum mlx5e_traffic_types tt);
|
||||
|
||||
struct mlx5e_xsk_param;
|
||||
|
||||
|
|
|
@ -83,12 +83,6 @@ enum mlx5e_traffic_types {
|
|||
MLX5E_NUM_INDIR_TIRS = MLX5E_TT_ANY,
|
||||
};
|
||||
|
||||
struct mlx5e_tirc_config {
|
||||
u8 l3_prot_type;
|
||||
u8 l4_prot_type;
|
||||
u32 rx_hash_fields;
|
||||
};
|
||||
|
||||
#define MLX5_HASH_IP (MLX5_HASH_FIELD_SEL_SRC_IP |\
|
||||
MLX5_HASH_FIELD_SEL_DST_IP)
|
||||
#define MLX5_HASH_IP_L4PORTS (MLX5_HASH_FIELD_SEL_SRC_IP |\
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
|
||||
/* Copyright (c) 2021, Mellanox Technologies inc. All rights reserved. */
|
||||
|
||||
#include "rx_res.h"
|
||||
|
||||
static const struct mlx5e_rss_params_traffic_type rss_default_config[MLX5E_NUM_INDIR_TIRS] = {
|
||||
[MLX5E_TT_IPV4_TCP] = {
|
||||
.l3_prot_type = MLX5_L3_PROT_TYPE_IPV4,
|
||||
.l4_prot_type = MLX5_L4_PROT_TYPE_TCP,
|
||||
.rx_hash_fields = MLX5_HASH_IP_L4PORTS,
|
||||
},
|
||||
[MLX5E_TT_IPV6_TCP] = {
|
||||
.l3_prot_type = MLX5_L3_PROT_TYPE_IPV6,
|
||||
.l4_prot_type = MLX5_L4_PROT_TYPE_TCP,
|
||||
.rx_hash_fields = MLX5_HASH_IP_L4PORTS,
|
||||
},
|
||||
[MLX5E_TT_IPV4_UDP] = {
|
||||
.l3_prot_type = MLX5_L3_PROT_TYPE_IPV4,
|
||||
.l4_prot_type = MLX5_L4_PROT_TYPE_UDP,
|
||||
.rx_hash_fields = MLX5_HASH_IP_L4PORTS,
|
||||
},
|
||||
[MLX5E_TT_IPV6_UDP] = {
|
||||
.l3_prot_type = MLX5_L3_PROT_TYPE_IPV6,
|
||||
.l4_prot_type = MLX5_L4_PROT_TYPE_UDP,
|
||||
.rx_hash_fields = MLX5_HASH_IP_L4PORTS,
|
||||
},
|
||||
[MLX5E_TT_IPV4_IPSEC_AH] = {
|
||||
.l3_prot_type = MLX5_L3_PROT_TYPE_IPV4,
|
||||
.l4_prot_type = 0,
|
||||
.rx_hash_fields = MLX5_HASH_IP_IPSEC_SPI,
|
||||
},
|
||||
[MLX5E_TT_IPV6_IPSEC_AH] = {
|
||||
.l3_prot_type = MLX5_L3_PROT_TYPE_IPV6,
|
||||
.l4_prot_type = 0,
|
||||
.rx_hash_fields = MLX5_HASH_IP_IPSEC_SPI,
|
||||
},
|
||||
[MLX5E_TT_IPV4_IPSEC_ESP] = {
|
||||
.l3_prot_type = MLX5_L3_PROT_TYPE_IPV4,
|
||||
.l4_prot_type = 0,
|
||||
.rx_hash_fields = MLX5_HASH_IP_IPSEC_SPI,
|
||||
},
|
||||
[MLX5E_TT_IPV6_IPSEC_ESP] = {
|
||||
.l3_prot_type = MLX5_L3_PROT_TYPE_IPV6,
|
||||
.l4_prot_type = 0,
|
||||
.rx_hash_fields = MLX5_HASH_IP_IPSEC_SPI,
|
||||
},
|
||||
[MLX5E_TT_IPV4] = {
|
||||
.l3_prot_type = MLX5_L3_PROT_TYPE_IPV4,
|
||||
.l4_prot_type = 0,
|
||||
.rx_hash_fields = MLX5_HASH_IP,
|
||||
},
|
||||
[MLX5E_TT_IPV6] = {
|
||||
.l3_prot_type = MLX5_L3_PROT_TYPE_IPV6,
|
||||
.l4_prot_type = 0,
|
||||
.rx_hash_fields = MLX5_HASH_IP,
|
||||
},
|
||||
};
|
||||
|
||||
struct mlx5e_rss_params_traffic_type
|
||||
mlx5e_rss_get_default_tt_config(enum mlx5e_traffic_types tt)
|
||||
{
|
||||
return rss_default_config[tt];
|
||||
}
|
||||
|
||||
struct mlx5e_rss_params_traffic_type
|
||||
mlx5e_rx_res_rss_get_current_tt_config(struct mlx5e_rx_res *res, enum mlx5e_traffic_types tt)
|
||||
{
|
||||
struct mlx5e_rss_params_traffic_type rss_tt;
|
||||
|
||||
rss_tt = mlx5e_rss_get_default_tt_config(tt);
|
||||
rss_tt.rx_hash_fields = res->rss_params.rx_hash_fields[tt];
|
||||
return rss_tt;
|
||||
}
|
|
@ -39,4 +39,9 @@ struct mlx5e_rx_res {
|
|||
} ptp;
|
||||
};
|
||||
|
||||
struct mlx5e_rss_params_traffic_type
|
||||
mlx5e_rss_get_default_tt_config(enum mlx5e_traffic_types tt);
|
||||
struct mlx5e_rss_params_traffic_type
|
||||
mlx5e_rx_res_rss_get_current_tt_config(struct mlx5e_rx_res *res, enum mlx5e_traffic_types tt);
|
||||
|
||||
#endif /* __MLX5_EN_RX_RES_H__ */
|
||||
|
|
|
@ -2316,69 +2316,9 @@ static void mlx5e_redirect_rqts_to_drop(struct mlx5e_priv *priv)
|
|||
mlx5e_rqt_redirect_direct(&res->ptp.rqt, priv->drop_rq.rqn);
|
||||
}
|
||||
|
||||
static const struct mlx5e_tirc_config tirc_default_config[MLX5E_NUM_INDIR_TIRS] = {
|
||||
[MLX5E_TT_IPV4_TCP] = { .l3_prot_type = MLX5_L3_PROT_TYPE_IPV4,
|
||||
.l4_prot_type = MLX5_L4_PROT_TYPE_TCP,
|
||||
.rx_hash_fields = MLX5_HASH_IP_L4PORTS,
|
||||
},
|
||||
[MLX5E_TT_IPV6_TCP] = { .l3_prot_type = MLX5_L3_PROT_TYPE_IPV6,
|
||||
.l4_prot_type = MLX5_L4_PROT_TYPE_TCP,
|
||||
.rx_hash_fields = MLX5_HASH_IP_L4PORTS,
|
||||
},
|
||||
[MLX5E_TT_IPV4_UDP] = { .l3_prot_type = MLX5_L3_PROT_TYPE_IPV4,
|
||||
.l4_prot_type = MLX5_L4_PROT_TYPE_UDP,
|
||||
.rx_hash_fields = MLX5_HASH_IP_L4PORTS,
|
||||
},
|
||||
[MLX5E_TT_IPV6_UDP] = { .l3_prot_type = MLX5_L3_PROT_TYPE_IPV6,
|
||||
.l4_prot_type = MLX5_L4_PROT_TYPE_UDP,
|
||||
.rx_hash_fields = MLX5_HASH_IP_L4PORTS,
|
||||
},
|
||||
[MLX5E_TT_IPV4_IPSEC_AH] = { .l3_prot_type = MLX5_L3_PROT_TYPE_IPV4,
|
||||
.l4_prot_type = 0,
|
||||
.rx_hash_fields = MLX5_HASH_IP_IPSEC_SPI,
|
||||
},
|
||||
[MLX5E_TT_IPV6_IPSEC_AH] = { .l3_prot_type = MLX5_L3_PROT_TYPE_IPV6,
|
||||
.l4_prot_type = 0,
|
||||
.rx_hash_fields = MLX5_HASH_IP_IPSEC_SPI,
|
||||
},
|
||||
[MLX5E_TT_IPV4_IPSEC_ESP] = { .l3_prot_type = MLX5_L3_PROT_TYPE_IPV4,
|
||||
.l4_prot_type = 0,
|
||||
.rx_hash_fields = MLX5_HASH_IP_IPSEC_SPI,
|
||||
},
|
||||
[MLX5E_TT_IPV6_IPSEC_ESP] = { .l3_prot_type = MLX5_L3_PROT_TYPE_IPV6,
|
||||
.l4_prot_type = 0,
|
||||
.rx_hash_fields = MLX5_HASH_IP_IPSEC_SPI,
|
||||
},
|
||||
[MLX5E_TT_IPV4] = { .l3_prot_type = MLX5_L3_PROT_TYPE_IPV4,
|
||||
.l4_prot_type = 0,
|
||||
.rx_hash_fields = MLX5_HASH_IP,
|
||||
},
|
||||
[MLX5E_TT_IPV6] = { .l3_prot_type = MLX5_L3_PROT_TYPE_IPV6,
|
||||
.l4_prot_type = 0,
|
||||
.rx_hash_fields = MLX5_HASH_IP,
|
||||
},
|
||||
};
|
||||
|
||||
struct mlx5e_tirc_config mlx5e_tirc_get_default_config(enum mlx5e_traffic_types tt)
|
||||
{
|
||||
return tirc_default_config[tt];
|
||||
}
|
||||
|
||||
static void mlx5e_update_rx_hash_fields(struct mlx5e_rss_params_traffic_type *rss_tt,
|
||||
enum mlx5e_traffic_types tt,
|
||||
u32 rx_hash_fields)
|
||||
{
|
||||
*rss_tt = (struct mlx5e_rss_params_traffic_type) {
|
||||
.l3_prot_type = tirc_default_config[tt].l3_prot_type,
|
||||
.l4_prot_type = tirc_default_config[tt].l4_prot_type,
|
||||
.rx_hash_fields = rx_hash_fields,
|
||||
};
|
||||
}
|
||||
|
||||
int mlx5e_modify_tirs_hash(struct mlx5e_priv *priv)
|
||||
{
|
||||
struct mlx5e_rss_params_hash *rss_hash = &priv->rx_res->rss_params.hash;
|
||||
struct mlx5e_rss_params *rss = &priv->rx_res->rss_params;
|
||||
struct mlx5e_rss_params_traffic_type rss_tt;
|
||||
struct mlx5e_rx_res *res = priv->rx_res;
|
||||
struct mlx5e_tir_builder *builder;
|
||||
|
@ -2389,7 +2329,7 @@ int mlx5e_modify_tirs_hash(struct mlx5e_priv *priv)
|
|||
return -ENOMEM;
|
||||
|
||||
for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++) {
|
||||
mlx5e_update_rx_hash_fields(&rss_tt, tt, rss->rx_hash_fields[tt]);
|
||||
rss_tt = mlx5e_rx_res_rss_get_current_tt_config(res, tt);
|
||||
mlx5e_tir_builder_build_rss(builder, rss_hash, &rss_tt, false);
|
||||
mlx5e_tir_modify(&res->rss[tt].indir_tir, builder);
|
||||
mlx5e_tir_builder_clear(builder);
|
||||
|
@ -2400,7 +2340,7 @@ int mlx5e_modify_tirs_hash(struct mlx5e_priv *priv)
|
|||
goto out;
|
||||
|
||||
for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++) {
|
||||
mlx5e_update_rx_hash_fields(&rss_tt, tt, rss->rx_hash_fields[tt]);
|
||||
rss_tt = mlx5e_rx_res_rss_get_current_tt_config(res, tt);
|
||||
mlx5e_tir_builder_build_rss(builder, rss_hash, &rss_tt, true);
|
||||
mlx5e_tir_modify(&res->rss[tt].indir_tir, builder);
|
||||
mlx5e_tir_builder_clear(builder);
|
||||
|
@ -3083,7 +3023,6 @@ int mlx5e_create_indirect_tirs(struct mlx5e_priv *priv, bool inner_ttc)
|
|||
{
|
||||
struct mlx5e_rss_params_hash *rss_hash = &priv->rx_res->rss_params.hash;
|
||||
bool inner_ft_support = priv->channels.params.tunneled_offload_en;
|
||||
struct mlx5e_rss_params *rss = &priv->rx_res->rss_params;
|
||||
struct mlx5e_rss_params_traffic_type rss_tt;
|
||||
struct mlx5e_rx_res *res = priv->rx_res;
|
||||
enum mlx5e_traffic_types tt, max_tt;
|
||||
|
@ -3103,7 +3042,7 @@ int mlx5e_create_indirect_tirs(struct mlx5e_priv *priv, bool inner_ttc)
|
|||
mlx5e_tir_builder_build_rqt(builder, priv->mdev->mlx5e_res.hw_objs.td.tdn,
|
||||
indir_rqtn, inner_ft_support);
|
||||
mlx5e_tir_builder_build_lro(builder, &lro_param);
|
||||
mlx5e_update_rx_hash_fields(&rss_tt, tt, rss->rx_hash_fields[tt]);
|
||||
rss_tt = mlx5e_rx_res_rss_get_current_tt_config(res, tt);
|
||||
mlx5e_tir_builder_build_rss(builder, rss_hash, &rss_tt, false);
|
||||
|
||||
err = mlx5e_tir_init(&res->rss[tt].indir_tir, builder, priv->mdev, true);
|
||||
|
@ -3122,7 +3061,7 @@ int mlx5e_create_indirect_tirs(struct mlx5e_priv *priv, bool inner_ttc)
|
|||
mlx5e_tir_builder_build_rqt(builder, priv->mdev->mlx5e_res.hw_objs.td.tdn,
|
||||
indir_rqtn, inner_ft_support);
|
||||
mlx5e_tir_builder_build_lro(builder, &lro_param);
|
||||
mlx5e_update_rx_hash_fields(&rss_tt, tt, rss->rx_hash_fields[tt]);
|
||||
rss_tt = mlx5e_rx_res_rss_get_current_tt_config(res, tt);
|
||||
mlx5e_tir_builder_build_rss(builder, rss_hash, &rss_tt, true);
|
||||
|
||||
err = mlx5e_tir_init(&res->rss[tt].inner_indir_tir, builder, priv->mdev, true);
|
||||
|
@ -4540,7 +4479,7 @@ void mlx5e_build_rss_params(struct mlx5e_rss_params *rss_params,
|
|||
MLX5E_INDIR_RQT_SIZE, num_channels);
|
||||
for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++)
|
||||
rss_params->rx_hash_fields[tt] =
|
||||
tirc_default_config[tt].rx_hash_fields;
|
||||
mlx5e_rss_get_default_tt_config(tt).rx_hash_fields;
|
||||
}
|
||||
|
||||
void mlx5e_build_nic_params(struct mlx5e_priv *priv, struct mlx5e_xsk *xsk, u16 mtu)
|
||||
|
|
|
@ -515,7 +515,6 @@ static int mlx5e_hairpin_create_indirect_rqt(struct mlx5e_hairpin *hp)
|
|||
|
||||
static int mlx5e_hairpin_create_indirect_tirs(struct mlx5e_hairpin *hp)
|
||||
{
|
||||
struct mlx5e_rss_params_traffic_type rss_tt;
|
||||
struct mlx5e_priv *priv = hp->func_priv;
|
||||
struct mlx5e_rss_params_hash *rss_hash;
|
||||
enum mlx5e_traffic_types tt, max_tt;
|
||||
|
@ -529,13 +528,9 @@ static int mlx5e_hairpin_create_indirect_tirs(struct mlx5e_hairpin *hp)
|
|||
rss_hash = &priv->rx_res->rss_params.hash;
|
||||
|
||||
for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++) {
|
||||
struct mlx5e_tirc_config ttconfig = mlx5e_tirc_get_default_config(tt);
|
||||
struct mlx5e_rss_params_traffic_type rss_tt;
|
||||
|
||||
rss_tt = (struct mlx5e_rss_params_traffic_type) {
|
||||
.l3_prot_type = ttconfig.l3_prot_type,
|
||||
.l4_prot_type = ttconfig.l4_prot_type,
|
||||
.rx_hash_fields = ttconfig.rx_hash_fields,
|
||||
};
|
||||
rss_tt = mlx5e_rss_get_default_tt_config(tt);
|
||||
|
||||
mlx5e_tir_builder_build_rqt(builder, hp->tdn,
|
||||
mlx5e_rqt_get_rqtn(&hp->indir_rqt),
|
||||
|
|
Loading…
Reference in New Issue