net/mlx5e: Fix ethtool RX hash func configuration change
We should modify TIRs explicitly to apply the new RSS configuration. The light ndo close/open calls do not "refresh" them. Fixes: 2d75b2bc8a8c ('net/mlx5e: Add ethtool RSS configuration options') Signed-off-by: Tariq Toukan <tariqt@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
0ad9b20415
commit
bdfc028de1
@ -447,6 +447,8 @@ enum mlx5e_traffic_types {
|
|||||||
MLX5E_NUM_TT,
|
MLX5E_NUM_TT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define IS_HASHING_TT(tt) (tt != MLX5E_TT_ANY)
|
||||||
|
|
||||||
enum mlx5e_rqt_ix {
|
enum mlx5e_rqt_ix {
|
||||||
MLX5E_INDIRECTION_RQT,
|
MLX5E_INDIRECTION_RQT,
|
||||||
MLX5E_SINGLE_RQ_RQT,
|
MLX5E_SINGLE_RQ_RQT,
|
||||||
@ -613,6 +615,7 @@ void mlx5e_enable_vlan_filter(struct mlx5e_priv *priv);
|
|||||||
void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv);
|
void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv);
|
||||||
|
|
||||||
int mlx5e_redirect_rqt(struct mlx5e_priv *priv, enum mlx5e_rqt_ix rqt_ix);
|
int mlx5e_redirect_rqt(struct mlx5e_priv *priv, enum mlx5e_rqt_ix rqt_ix);
|
||||||
|
void mlx5e_build_tir_ctx_hash(void *tirc, struct mlx5e_priv *priv);
|
||||||
|
|
||||||
int mlx5e_open_locked(struct net_device *netdev);
|
int mlx5e_open_locked(struct net_device *netdev);
|
||||||
int mlx5e_close_locked(struct net_device *netdev);
|
int mlx5e_close_locked(struct net_device *netdev);
|
||||||
|
@ -703,18 +703,36 @@ static int mlx5e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void mlx5e_modify_tirs_hash(struct mlx5e_priv *priv, void *in, int inlen)
|
||||||
|
{
|
||||||
|
struct mlx5_core_dev *mdev = priv->mdev;
|
||||||
|
void *tirc = MLX5_ADDR_OF(modify_tir_in, in, ctx);
|
||||||
|
int i;
|
||||||
|
|
||||||
|
MLX5_SET(modify_tir_in, in, bitmask.hash, 1);
|
||||||
|
mlx5e_build_tir_ctx_hash(tirc, priv);
|
||||||
|
|
||||||
|
for (i = 0; i < MLX5E_NUM_TT; i++)
|
||||||
|
if (IS_HASHING_TT(i))
|
||||||
|
mlx5_core_modify_tir(mdev, priv->tirn[i], in, inlen);
|
||||||
|
}
|
||||||
|
|
||||||
static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir,
|
static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir,
|
||||||
const u8 *key, const u8 hfunc)
|
const u8 *key, const u8 hfunc)
|
||||||
{
|
{
|
||||||
struct mlx5e_priv *priv = netdev_priv(dev);
|
struct mlx5e_priv *priv = netdev_priv(dev);
|
||||||
bool close_open;
|
int inlen = MLX5_ST_SZ_BYTES(modify_tir_in);
|
||||||
int err = 0;
|
void *in;
|
||||||
|
|
||||||
if ((hfunc != ETH_RSS_HASH_NO_CHANGE) &&
|
if ((hfunc != ETH_RSS_HASH_NO_CHANGE) &&
|
||||||
(hfunc != ETH_RSS_HASH_XOR) &&
|
(hfunc != ETH_RSS_HASH_XOR) &&
|
||||||
(hfunc != ETH_RSS_HASH_TOP))
|
(hfunc != ETH_RSS_HASH_TOP))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
in = mlx5_vzalloc(inlen);
|
||||||
|
if (!in)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
mutex_lock(&priv->state_lock);
|
mutex_lock(&priv->state_lock);
|
||||||
|
|
||||||
if (indir) {
|
if (indir) {
|
||||||
@ -723,11 +741,6 @@ static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir,
|
|||||||
mlx5e_redirect_rqt(priv, MLX5E_INDIRECTION_RQT);
|
mlx5e_redirect_rqt(priv, MLX5E_INDIRECTION_RQT);
|
||||||
}
|
}
|
||||||
|
|
||||||
close_open = (key || (hfunc != ETH_RSS_HASH_NO_CHANGE)) &&
|
|
||||||
test_bit(MLX5E_STATE_OPENED, &priv->state);
|
|
||||||
if (close_open)
|
|
||||||
mlx5e_close_locked(dev);
|
|
||||||
|
|
||||||
if (key)
|
if (key)
|
||||||
memcpy(priv->params.toeplitz_hash_key, key,
|
memcpy(priv->params.toeplitz_hash_key, key,
|
||||||
sizeof(priv->params.toeplitz_hash_key));
|
sizeof(priv->params.toeplitz_hash_key));
|
||||||
@ -735,12 +748,13 @@ static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir,
|
|||||||
if (hfunc != ETH_RSS_HASH_NO_CHANGE)
|
if (hfunc != ETH_RSS_HASH_NO_CHANGE)
|
||||||
priv->params.rss_hfunc = hfunc;
|
priv->params.rss_hfunc = hfunc;
|
||||||
|
|
||||||
if (close_open)
|
mlx5e_modify_tirs_hash(priv, in, inlen);
|
||||||
err = mlx5e_open_locked(priv->netdev);
|
|
||||||
|
|
||||||
mutex_unlock(&priv->state_lock);
|
mutex_unlock(&priv->state_lock);
|
||||||
|
|
||||||
return err;
|
kvfree(in);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mlx5e_get_rxnfc(struct net_device *netdev,
|
static int mlx5e_get_rxnfc(struct net_device *netdev,
|
||||||
|
@ -1317,6 +1317,21 @@ static void mlx5e_build_tir_ctx_lro(void *tirc, struct mlx5e_priv *priv)
|
|||||||
lro_timer_supported_periods[2]));
|
lro_timer_supported_periods[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mlx5e_build_tir_ctx_hash(void *tirc, struct mlx5e_priv *priv)
|
||||||
|
{
|
||||||
|
MLX5_SET(tirc, tirc, rx_hash_fn,
|
||||||
|
mlx5e_rx_hash_fn(priv->params.rss_hfunc));
|
||||||
|
if (priv->params.rss_hfunc == ETH_RSS_HASH_TOP) {
|
||||||
|
void *rss_key = MLX5_ADDR_OF(tirc, tirc,
|
||||||
|
rx_hash_toeplitz_key);
|
||||||
|
size_t len = MLX5_FLD_SZ_BYTES(tirc,
|
||||||
|
rx_hash_toeplitz_key);
|
||||||
|
|
||||||
|
MLX5_SET(tirc, tirc, rx_hash_symmetric, 1);
|
||||||
|
memcpy(rss_key, priv->params.toeplitz_hash_key, len);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int mlx5e_modify_tirs_lro(struct mlx5e_priv *priv)
|
static int mlx5e_modify_tirs_lro(struct mlx5e_priv *priv)
|
||||||
{
|
{
|
||||||
struct mlx5_core_dev *mdev = priv->mdev;
|
struct mlx5_core_dev *mdev = priv->mdev;
|
||||||
@ -1677,17 +1692,7 @@ static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 *tirc, int tt)
|
|||||||
default:
|
default:
|
||||||
MLX5_SET(tirc, tirc, indirect_table,
|
MLX5_SET(tirc, tirc, indirect_table,
|
||||||
priv->rqtn[MLX5E_INDIRECTION_RQT]);
|
priv->rqtn[MLX5E_INDIRECTION_RQT]);
|
||||||
MLX5_SET(tirc, tirc, rx_hash_fn,
|
mlx5e_build_tir_ctx_hash(tirc, priv);
|
||||||
mlx5e_rx_hash_fn(priv->params.rss_hfunc));
|
|
||||||
if (priv->params.rss_hfunc == ETH_RSS_HASH_TOP) {
|
|
||||||
void *rss_key = MLX5_ADDR_OF(tirc, tirc,
|
|
||||||
rx_hash_toeplitz_key);
|
|
||||||
size_t len = MLX5_FLD_SZ_BYTES(tirc,
|
|
||||||
rx_hash_toeplitz_key);
|
|
||||||
|
|
||||||
MLX5_SET(tirc, tirc, rx_hash_symmetric, 1);
|
|
||||||
memcpy(rss_key, priv->params.toeplitz_hash_key, len);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4245,7 +4245,9 @@ struct mlx5_ifc_modify_tir_bitmask_bits {
|
|||||||
|
|
||||||
u8 reserved_at_20[0x1b];
|
u8 reserved_at_20[0x1b];
|
||||||
u8 self_lb_en[0x1];
|
u8 self_lb_en[0x1];
|
||||||
u8 reserved_at_3c[0x3];
|
u8 reserved_at_3c[0x1];
|
||||||
|
u8 hash[0x1];
|
||||||
|
u8 reserved_at_3e[0x1];
|
||||||
u8 lro[0x1];
|
u8 lro[0x1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user