Merge branch 'mlx5-misc-fixes-2026-01-26'

Tariq Toukan says:

====================
mlx5 misc fixes 2026-01-26

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

Link: https://patch.msgid.link/1769411695-18820-1-git-send-email-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski 2026-01-27 18:03:44 -08:00
commit d32ba904a4
6 changed files with 70 additions and 15 deletions

View file

@ -575,3 +575,17 @@ bool mlx5_same_hw_devs(struct mlx5_core_dev *dev, struct mlx5_core_dev *peer_dev
return plen && flen && flen == plen &&
!memcmp(fsystem_guid, psystem_guid, flen);
}
void mlx5_core_reps_aux_devs_remove(struct mlx5_core_dev *dev)
{
struct mlx5_priv *priv = &dev->priv;
if (priv->adev[MLX5_INTERFACE_PROTOCOL_ETH])
device_lock_assert(&priv->adev[MLX5_INTERFACE_PROTOCOL_ETH]->adev.dev);
else
mlx5_core_err(dev, "ETH driver already removed\n");
if (priv->adev[MLX5_INTERFACE_PROTOCOL_IB_REP])
del_adev(&priv->adev[MLX5_INTERFACE_PROTOCOL_IB_REP]->adev);
if (priv->adev[MLX5_INTERFACE_PROTOCOL_ETH_REP])
del_adev(&priv->adev[MLX5_INTERFACE_PROTOCOL_ETH_REP]->adev);
}

View file

@ -4052,6 +4052,8 @@ mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
mlx5e_queue_update_stats(priv);
}
netdev_stats_to_stats64(stats, &dev->stats);
if (mlx5e_is_uplink_rep(priv)) {
struct mlx5e_vport_stats *vstats = &priv->stats.vport;
@ -4068,21 +4070,21 @@ mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
mlx5e_fold_sw_stats64(priv, stats);
}
stats->rx_missed_errors = priv->stats.qcnt.rx_out_of_buffer;
stats->rx_dropped = PPORT_2863_GET(pstats, if_in_discards);
stats->rx_missed_errors += priv->stats.qcnt.rx_out_of_buffer;
stats->rx_dropped += PPORT_2863_GET(pstats, if_in_discards);
stats->rx_length_errors =
stats->rx_length_errors +=
PPORT_802_3_GET(pstats, a_in_range_length_errors) +
PPORT_802_3_GET(pstats, a_out_of_range_length_field) +
PPORT_802_3_GET(pstats, a_frame_too_long_errors) +
VNIC_ENV_GET(&priv->stats.vnic, eth_wqe_too_small);
stats->rx_crc_errors =
stats->rx_crc_errors +=
PPORT_802_3_GET(pstats, a_frame_check_sequence_errors);
stats->rx_frame_errors = PPORT_802_3_GET(pstats, a_alignment_errors);
stats->tx_aborted_errors = PPORT_2863_GET(pstats, if_out_discards);
stats->rx_errors = stats->rx_length_errors + stats->rx_crc_errors +
stats->rx_frame_errors;
stats->tx_errors = stats->tx_aborted_errors + stats->tx_carrier_errors;
stats->rx_frame_errors += PPORT_802_3_GET(pstats, a_alignment_errors);
stats->tx_aborted_errors += PPORT_2863_GET(pstats, if_out_discards);
stats->rx_errors += stats->rx_length_errors + stats->rx_crc_errors +
stats->rx_frame_errors;
stats->tx_errors += stats->tx_aborted_errors + stats->tx_carrier_errors;
}
static void mlx5e_nic_set_rx_mode(struct mlx5e_priv *priv)
@ -6842,6 +6844,7 @@ static void _mlx5e_remove(struct auxiliary_device *adev)
struct mlx5e_priv *priv = netdev_priv(netdev);
struct mlx5_core_dev *mdev = edev->mdev;
mlx5_eswitch_safe_aux_devs_remove(mdev);
mlx5_core_uplink_netdev_set(mdev, NULL);
if (priv->profile)

View file

@ -2147,11 +2147,14 @@ static void mlx5e_tc_del_fdb_peer_flow(struct mlx5e_tc_flow *flow,
static void mlx5e_tc_del_fdb_peers_flow(struct mlx5e_tc_flow *flow)
{
struct mlx5_devcom_comp_dev *devcom;
struct mlx5_devcom_comp_dev *pos;
struct mlx5_eswitch *peer_esw;
int i;
for (i = 0; i < MLX5_MAX_PORTS; i++) {
if (i == mlx5_get_dev_index(flow->priv->mdev))
continue;
devcom = flow->priv->mdev->priv.eswitch->devcom;
mlx5_devcom_for_each_peer_entry(devcom, peer_esw, pos) {
i = mlx5_get_dev_index(peer_esw->dev);
mlx5e_tc_del_fdb_peer_flow(flow, i);
}
}
@ -5513,12 +5516,16 @@ int mlx5e_tc_num_filters(struct mlx5e_priv *priv, unsigned long flags)
void mlx5e_tc_clean_fdb_peer_flows(struct mlx5_eswitch *esw)
{
struct mlx5_devcom_comp_dev *devcom;
struct mlx5_devcom_comp_dev *pos;
struct mlx5e_tc_flow *flow, *tmp;
struct mlx5_eswitch *peer_esw;
int i;
for (i = 0; i < MLX5_MAX_PORTS; i++) {
if (i == mlx5_get_dev_index(esw->dev))
continue;
devcom = esw->devcom;
mlx5_devcom_for_each_peer_entry(devcom, peer_esw, pos) {
i = mlx5_get_dev_index(peer_esw->dev);
list_for_each_entry_safe(flow, tmp, &esw->offloads.peer_flows[i], peer[i])
mlx5e_tc_del_fdb_peers_flow(flow);
}

View file

@ -929,6 +929,7 @@ int mlx5_esw_ipsec_vf_packet_offload_set(struct mlx5_eswitch *esw, struct mlx5_v
int mlx5_esw_ipsec_vf_packet_offload_supported(struct mlx5_core_dev *dev,
u16 vport_num);
bool mlx5_esw_host_functions_enabled(const struct mlx5_core_dev *dev);
void mlx5_eswitch_safe_aux_devs_remove(struct mlx5_core_dev *dev);
#else /* CONFIG_MLX5_ESWITCH */
/* eswitch API stubs */
static inline int mlx5_eswitch_init(struct mlx5_core_dev *dev) { return 0; }
@ -1012,6 +1013,9 @@ mlx5_esw_vport_vhca_id(struct mlx5_eswitch *esw, u16 vportn, u16 *vhca_id)
return false;
}
static inline void
mlx5_eswitch_safe_aux_devs_remove(struct mlx5_core_dev *dev) {}
#endif /* CONFIG_MLX5_ESWITCH */
#endif /* __MLX5_ESWITCH_H__ */

View file

@ -3981,6 +3981,32 @@ static bool mlx5_devlink_switchdev_active_mode_change(struct mlx5_eswitch *esw,
return true;
}
#define MLX5_ESW_HOLD_TIMEOUT_MS 7000
#define MLX5_ESW_HOLD_RETRY_DELAY_MS 500
void mlx5_eswitch_safe_aux_devs_remove(struct mlx5_core_dev *dev)
{
unsigned long timeout;
bool hold_esw = true;
/* Wait for any concurrent eswitch mode transition to complete. */
if (!mlx5_esw_hold(dev)) {
timeout = jiffies + msecs_to_jiffies(MLX5_ESW_HOLD_TIMEOUT_MS);
while (!mlx5_esw_hold(dev)) {
if (!time_before(jiffies, timeout)) {
hold_esw = false;
break;
}
msleep(MLX5_ESW_HOLD_RETRY_DELAY_MS);
}
}
if (hold_esw) {
if (mlx5_eswitch_mode(dev) == MLX5_ESWITCH_OFFLOADS)
mlx5_core_reps_aux_devs_remove(dev);
mlx5_esw_release(dev);
}
}
int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode,
struct netlink_ext_ack *extack)
{

View file

@ -290,6 +290,7 @@ int mlx5_register_device(struct mlx5_core_dev *dev);
void mlx5_unregister_device(struct mlx5_core_dev *dev);
void mlx5_dev_set_lightweight(struct mlx5_core_dev *dev);
bool mlx5_dev_is_lightweight(struct mlx5_core_dev *dev);
void mlx5_core_reps_aux_devs_remove(struct mlx5_core_dev *dev);
void mlx5_fw_reporters_create(struct mlx5_core_dev *dev);
int mlx5_query_mtpps(struct mlx5_core_dev *dev, u32 *mtpps, u32 mtpps_size);