Commit 43befe99 authored by Maxim Mikityanskiy's avatar Maxim Mikityanskiy Committed by Saeed Mahameed

net/mlx5e: Use a new initializer to build uniform indir table

Replace mlx5e_build_default_indir_rqt with a new initializer of struct
mlx5e_rss_params_indir that works directly with the struct, rather than
its internals.

The new initializer is called mlx5e_rss_params_indir_init_uniform, which
also reflects the purpose (uniform spreading) better.
Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 1187c8c4
...@@ -984,9 +984,6 @@ void mlx5e_activate_priv_channels(struct mlx5e_priv *priv); ...@@ -984,9 +984,6 @@ void mlx5e_activate_priv_channels(struct mlx5e_priv *priv);
void mlx5e_deactivate_priv_channels(struct mlx5e_priv *priv); void mlx5e_deactivate_priv_channels(struct mlx5e_priv *priv);
int mlx5e_ptp_rx_manage_fs_ctx(struct mlx5e_priv *priv, void *ctx); int mlx5e_ptp_rx_manage_fs_ctx(struct mlx5e_priv *priv, void *ctx);
void mlx5e_build_default_indir_rqt(u32 *indirection_rqt, int len,
int num_channels);
int mlx5e_modify_rq_state(struct mlx5e_rq *rq, int curr_state, int next_state); int mlx5e_modify_rq_state(struct mlx5e_rq *rq, int curr_state, int next_state);
void mlx5e_activate_rq(struct mlx5e_rq *rq); void mlx5e_activate_rq(struct mlx5e_rq *rq);
void mlx5e_deactivate_rq(struct mlx5e_rq *rq); void mlx5e_deactivate_rq(struct mlx5e_rq *rq);
......
...@@ -4,6 +4,15 @@ ...@@ -4,6 +4,15 @@
#include "rqt.h" #include "rqt.h"
#include <linux/mlx5/transobj.h> #include <linux/mlx5/transobj.h>
void mlx5e_rss_params_indir_init_uniform(struct mlx5e_rss_params_indir *indir,
unsigned int num_channels)
{
unsigned int i;
for (i = 0; i < MLX5E_INDIR_RQT_SIZE; i++)
indir->table[i] = i % num_channels;
}
static int mlx5e_rqt_init(struct mlx5e_rqt *rqt, struct mlx5_core_dev *mdev, static int mlx5e_rqt_init(struct mlx5e_rqt *rqt, struct mlx5_core_dev *mdev,
u16 max_size, u32 *init_rqns, u16 init_size) u16 max_size, u32 *init_rqns, u16 init_size)
{ {
......
...@@ -14,6 +14,9 @@ struct mlx5e_rss_params_indir { ...@@ -14,6 +14,9 @@ struct mlx5e_rss_params_indir {
u32 table[MLX5E_INDIR_RQT_SIZE]; u32 table[MLX5E_INDIR_RQT_SIZE];
}; };
void mlx5e_rss_params_indir_init_uniform(struct mlx5e_rss_params_indir *indir,
unsigned int num_channels);
struct mlx5e_rqt { struct mlx5e_rqt {
struct mlx5_core_dev *mdev; struct mlx5_core_dev *mdev;
u32 rqtn; u32 rqtn;
......
...@@ -2572,8 +2572,8 @@ int mlx5e_num_channels_changed(struct mlx5e_priv *priv) ...@@ -2572,8 +2572,8 @@ int mlx5e_num_channels_changed(struct mlx5e_priv *priv)
/* This function may be called on attach, before priv->rx_res is created. */ /* This function may be called on attach, before priv->rx_res is created. */
if (!netif_is_rxfh_configured(priv->netdev) && priv->rx_res) if (!netif_is_rxfh_configured(priv->netdev) && priv->rx_res)
mlx5e_build_default_indir_rqt(priv->rx_res->rss_params.indir.table, mlx5e_rss_params_indir_init_uniform(&priv->rx_res->rss_params.indir,
MLX5E_INDIR_RQT_SIZE, count); count);
return 0; return 0;
} }
...@@ -4459,15 +4459,6 @@ const struct net_device_ops mlx5e_netdev_ops = { ...@@ -4459,15 +4459,6 @@ const struct net_device_ops mlx5e_netdev_ops = {
.ndo_get_devlink_port = mlx5e_get_devlink_port, .ndo_get_devlink_port = mlx5e_get_devlink_port,
}; };
void mlx5e_build_default_indir_rqt(u32 *indirection_rqt, int len,
int num_channels)
{
int i;
for (i = 0; i < len; i++)
indirection_rqt[i] = i % num_channels;
}
static u32 mlx5e_choose_lro_timeout(struct mlx5_core_dev *mdev, u32 wanted_timeout) static u32 mlx5e_choose_lro_timeout(struct mlx5_core_dev *mdev, u32 wanted_timeout)
{ {
int i; int i;
...@@ -4488,8 +4479,7 @@ void mlx5e_build_rss_params(struct mlx5e_rss_params *rss_params, ...@@ -4488,8 +4479,7 @@ void mlx5e_build_rss_params(struct mlx5e_rss_params *rss_params,
rss_params->hash.hfunc = ETH_RSS_HASH_TOP; rss_params->hash.hfunc = ETH_RSS_HASH_TOP;
netdev_rss_key_fill(rss_params->hash.toeplitz_hash_key, netdev_rss_key_fill(rss_params->hash.toeplitz_hash_key,
sizeof(rss_params->hash.toeplitz_hash_key)); sizeof(rss_params->hash.toeplitz_hash_key));
mlx5e_build_default_indir_rqt(rss_params->indir.table, mlx5e_rss_params_indir_init_uniform(&rss_params->indir, num_channels);
MLX5E_INDIR_RQT_SIZE, num_channels);
for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++) for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++)
rss_params->rx_hash_fields[tt] = rss_params->rx_hash_fields[tt] =
mlx5e_rss_get_default_tt_config(tt).rx_hash_fields; mlx5e_rss_get_default_tt_config(tt).rx_hash_fields;
......
...@@ -525,7 +525,7 @@ static int mlx5e_hairpin_create_indirect_rqt(struct mlx5e_hairpin *hp) ...@@ -525,7 +525,7 @@ static int mlx5e_hairpin_create_indirect_rqt(struct mlx5e_hairpin *hp)
if (!indir) if (!indir)
return -ENOMEM; return -ENOMEM;
mlx5e_build_default_indir_rqt(indir->table, MLX5E_INDIR_RQT_SIZE, hp->num_channels); mlx5e_rss_params_indir_init_uniform(indir, hp->num_channels);
err = mlx5e_rqt_init_indir(&hp->indir_rqt, mdev, hp->pair->rqn, hp->num_channels, err = mlx5e_rqt_init_indir(&hp->indir_rqt, mdev, hp->pair->rqn, hp->num_channels,
priv->rx_res->rss_params.hash.hfunc, indir); priv->rx_res->rss_params.hash.hfunc, indir);
......
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