Commit eb755a95 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'mlx5-misc-fixes-2024-08-08'

Tariq Toukan says:

====================
mlx5 misc fixes 2024-08-08

This patchset provides misc bug fixes from the team to the mlx5 core and
Eth drivers.
====================

Link: https://patch.msgid.link/20240808144107.2095424-1-tariqt@nvidia.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents d2438c16 0b4a4534
...@@ -130,7 +130,7 @@ struct page_pool; ...@@ -130,7 +130,7 @@ struct page_pool;
#define MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE_MPW 0x2 #define MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE_MPW 0x2
#define MLX5E_DEFAULT_LRO_TIMEOUT 32 #define MLX5E_DEFAULT_LRO_TIMEOUT 32
#define MLX5E_LRO_TIMEOUT_ARR_SIZE 4 #define MLX5E_DEFAULT_SHAMPO_TIMEOUT 1024
#define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC 0x10 #define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC 0x10
#define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC_FROM_CQE 0x3 #define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC_FROM_CQE 0x3
......
...@@ -928,7 +928,7 @@ int mlx5e_build_rq_param(struct mlx5_core_dev *mdev, ...@@ -928,7 +928,7 @@ int mlx5e_build_rq_param(struct mlx5_core_dev *mdev,
MLX5_SET(wq, wq, log_headers_entry_size, MLX5_SET(wq, wq, log_headers_entry_size,
mlx5e_shampo_get_log_hd_entry_size(mdev, params)); mlx5e_shampo_get_log_hd_entry_size(mdev, params));
MLX5_SET(rqc, rqc, reservation_timeout, MLX5_SET(rqc, rqc, reservation_timeout,
params->packet_merge.timeout); mlx5e_choose_lro_timeout(mdev, MLX5E_DEFAULT_SHAMPO_TIMEOUT));
MLX5_SET(rqc, rqc, shampo_match_criteria_type, MLX5_SET(rqc, rqc, shampo_match_criteria_type,
params->packet_merge.shampo.match_criteria_type); params->packet_merge.shampo.match_criteria_type);
MLX5_SET(rqc, rqc, shampo_no_match_alignment_granularity, MLX5_SET(rqc, rqc, shampo_no_match_alignment_granularity,
...@@ -1087,6 +1087,20 @@ static u32 mlx5e_shampo_icosq_sz(struct mlx5_core_dev *mdev, ...@@ -1087,6 +1087,20 @@ static u32 mlx5e_shampo_icosq_sz(struct mlx5_core_dev *mdev,
return wqebbs; return wqebbs;
} }
#define MLX5E_LRO_TIMEOUT_ARR_SIZE 4
u32 mlx5e_choose_lro_timeout(struct mlx5_core_dev *mdev, u32 wanted_timeout)
{
int i;
/* The supported periods are organized in ascending order */
for (i = 0; i < MLX5E_LRO_TIMEOUT_ARR_SIZE - 1; i++)
if (MLX5_CAP_ETH(mdev, lro_timer_supported_periods[i]) >= wanted_timeout)
break;
return MLX5_CAP_ETH(mdev, lro_timer_supported_periods[i]);
}
static u32 mlx5e_mpwrq_total_umr_wqebbs(struct mlx5_core_dev *mdev, static u32 mlx5e_mpwrq_total_umr_wqebbs(struct mlx5_core_dev *mdev,
struct mlx5e_params *params, struct mlx5e_params *params,
struct mlx5e_xsk_param *xsk) struct mlx5e_xsk_param *xsk)
......
...@@ -108,6 +108,7 @@ u32 mlx5e_shampo_hd_per_wqe(struct mlx5_core_dev *mdev, ...@@ -108,6 +108,7 @@ u32 mlx5e_shampo_hd_per_wqe(struct mlx5_core_dev *mdev,
u32 mlx5e_shampo_hd_per_wq(struct mlx5_core_dev *mdev, u32 mlx5e_shampo_hd_per_wq(struct mlx5_core_dev *mdev,
struct mlx5e_params *params, struct mlx5e_params *params,
struct mlx5e_rq_param *rq_param); struct mlx5e_rq_param *rq_param);
u32 mlx5e_choose_lro_timeout(struct mlx5_core_dev *mdev, u32 wanted_timeout);
u8 mlx5e_mpwqe_get_log_stride_size(struct mlx5_core_dev *mdev, u8 mlx5e_mpwqe_get_log_stride_size(struct mlx5_core_dev *mdev,
struct mlx5e_params *params, struct mlx5e_params *params,
struct mlx5e_xsk_param *xsk); struct mlx5e_xsk_param *xsk);
......
...@@ -146,7 +146,9 @@ static int mlx5e_tx_reporter_timeout_recover(void *ctx) ...@@ -146,7 +146,9 @@ static int mlx5e_tx_reporter_timeout_recover(void *ctx)
return err; return err;
} }
mutex_lock(&priv->state_lock);
err = mlx5e_safe_reopen_channels(priv); err = mlx5e_safe_reopen_channels(priv);
mutex_unlock(&priv->state_lock);
if (!err) { if (!err) {
to_ctx->status = 1; /* all channels recovered */ to_ctx->status = 1; /* all channels recovered */
return err; return err;
......
...@@ -734,7 +734,7 @@ mlx5e_ethtool_flow_replace(struct mlx5e_priv *priv, ...@@ -734,7 +734,7 @@ mlx5e_ethtool_flow_replace(struct mlx5e_priv *priv,
if (num_tuples <= 0) { if (num_tuples <= 0) {
netdev_warn(priv->netdev, "%s: flow is not valid %d\n", netdev_warn(priv->netdev, "%s: flow is not valid %d\n",
__func__, num_tuples); __func__, num_tuples);
return num_tuples; return num_tuples < 0 ? num_tuples : -EINVAL;
} }
eth_ft = get_flow_table(priv, fs, num_tuples); eth_ft = get_flow_table(priv, fs, num_tuples);
......
...@@ -5167,18 +5167,6 @@ const struct net_device_ops mlx5e_netdev_ops = { ...@@ -5167,18 +5167,6 @@ const struct net_device_ops mlx5e_netdev_ops = {
#endif #endif
}; };
static u32 mlx5e_choose_lro_timeout(struct mlx5_core_dev *mdev, u32 wanted_timeout)
{
int i;
/* The supported periods are organized in ascending order */
for (i = 0; i < MLX5E_LRO_TIMEOUT_ARR_SIZE - 1; i++)
if (MLX5_CAP_ETH(mdev, lro_timer_supported_periods[i]) >= wanted_timeout)
break;
return MLX5_CAP_ETH(mdev, lro_timer_supported_periods[i]);
}
void mlx5e_build_nic_params(struct mlx5e_priv *priv, struct mlx5e_xsk *xsk, u16 mtu) void mlx5e_build_nic_params(struct mlx5e_priv *priv, struct mlx5e_xsk *xsk, u16 mtu)
{ {
struct mlx5e_params *params = &priv->channels.params; struct mlx5e_params *params = &priv->channels.params;
...@@ -5308,7 +5296,7 @@ static void mlx5e_get_queue_stats_rx(struct net_device *dev, int i, ...@@ -5308,7 +5296,7 @@ static void mlx5e_get_queue_stats_rx(struct net_device *dev, int i,
struct mlx5e_rq_stats *rq_stats; struct mlx5e_rq_stats *rq_stats;
ASSERT_RTNL(); ASSERT_RTNL();
if (mlx5e_is_uplink_rep(priv)) if (mlx5e_is_uplink_rep(priv) || !priv->stats_nch)
return; return;
channel_stats = priv->channel_stats[i]; channel_stats = priv->channel_stats[i];
...@@ -5328,6 +5316,9 @@ static void mlx5e_get_queue_stats_tx(struct net_device *dev, int i, ...@@ -5328,6 +5316,9 @@ static void mlx5e_get_queue_stats_tx(struct net_device *dev, int i,
struct mlx5e_sq_stats *sq_stats; struct mlx5e_sq_stats *sq_stats;
ASSERT_RTNL(); ASSERT_RTNL();
if (!priv->stats_nch)
return;
/* no special case needed for ptp htb etc since txq2sq_stats is kept up /* no special case needed for ptp htb etc since txq2sq_stats is kept up
* to date for active sq_stats, otherwise get_base_stats takes care of * to date for active sq_stats, otherwise get_base_stats takes care of
* inactive sqs. * inactive sqs.
......
...@@ -126,7 +126,7 @@ static bool mlx5_sd_is_supported(struct mlx5_core_dev *dev, u8 host_buses) ...@@ -126,7 +126,7 @@ static bool mlx5_sd_is_supported(struct mlx5_core_dev *dev, u8 host_buses)
} }
static int mlx5_query_sd(struct mlx5_core_dev *dev, bool *sdm, static int mlx5_query_sd(struct mlx5_core_dev *dev, bool *sdm,
u8 *host_buses, u8 *sd_group) u8 *host_buses)
{ {
u32 out[MLX5_ST_SZ_DW(mpir_reg)]; u32 out[MLX5_ST_SZ_DW(mpir_reg)];
int err; int err;
...@@ -135,10 +135,6 @@ static int mlx5_query_sd(struct mlx5_core_dev *dev, bool *sdm, ...@@ -135,10 +135,6 @@ static int mlx5_query_sd(struct mlx5_core_dev *dev, bool *sdm,
if (err) if (err)
return err; return err;
err = mlx5_query_nic_vport_sd_group(dev, sd_group);
if (err)
return err;
*sdm = MLX5_GET(mpir_reg, out, sdm); *sdm = MLX5_GET(mpir_reg, out, sdm);
*host_buses = MLX5_GET(mpir_reg, out, host_buses); *host_buses = MLX5_GET(mpir_reg, out, host_buses);
...@@ -166,19 +162,23 @@ static int sd_init(struct mlx5_core_dev *dev) ...@@ -166,19 +162,23 @@ static int sd_init(struct mlx5_core_dev *dev)
if (mlx5_core_is_ecpf(dev)) if (mlx5_core_is_ecpf(dev))
return 0; return 0;
err = mlx5_query_nic_vport_sd_group(dev, &sd_group);
if (err)
return err;
if (!sd_group)
return 0;
if (!MLX5_CAP_MCAM_REG(dev, mpir)) if (!MLX5_CAP_MCAM_REG(dev, mpir))
return 0; return 0;
err = mlx5_query_sd(dev, &sdm, &host_buses, &sd_group); err = mlx5_query_sd(dev, &sdm, &host_buses);
if (err) if (err)
return err; return err;
if (!sdm) if (!sdm)
return 0; return 0;
if (!sd_group)
return 0;
group_id = mlx5_sd_group_id(dev, sd_group); group_id = mlx5_sd_group_id(dev, sd_group);
if (!mlx5_sd_is_supported(dev, host_buses)) { if (!mlx5_sd_is_supported(dev, host_buses)) {
......
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