Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+70 -15
+14
drivers/net/ethernet/mellanox/mlx5/core/dev.c
··· 575 575 return plen && flen && flen == plen && 576 576 !memcmp(fsystem_guid, psystem_guid, flen); 577 577 } 578 + 579 + void mlx5_core_reps_aux_devs_remove(struct mlx5_core_dev *dev) 580 + { 581 + struct mlx5_priv *priv = &dev->priv; 582 + 583 + if (priv->adev[MLX5_INTERFACE_PROTOCOL_ETH]) 584 + device_lock_assert(&priv->adev[MLX5_INTERFACE_PROTOCOL_ETH]->adev.dev); 585 + else 586 + mlx5_core_err(dev, "ETH driver already removed\n"); 587 + if (priv->adev[MLX5_INTERFACE_PROTOCOL_IB_REP]) 588 + del_adev(&priv->adev[MLX5_INTERFACE_PROTOCOL_IB_REP]->adev); 589 + if (priv->adev[MLX5_INTERFACE_PROTOCOL_ETH_REP]) 590 + del_adev(&priv->adev[MLX5_INTERFACE_PROTOCOL_ETH_REP]->adev); 591 + }
+12 -9
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 4052 4052 mlx5e_queue_update_stats(priv); 4053 4053 } 4054 4054 4055 + netdev_stats_to_stats64(stats, &dev->stats); 4056 + 4055 4057 if (mlx5e_is_uplink_rep(priv)) { 4056 4058 struct mlx5e_vport_stats *vstats = &priv->stats.vport; 4057 4059 ··· 4070 4068 mlx5e_fold_sw_stats64(priv, stats); 4071 4069 } 4072 4070 4073 - stats->rx_missed_errors = priv->stats.qcnt.rx_out_of_buffer; 4074 - stats->rx_dropped = PPORT_2863_GET(pstats, if_in_discards); 4071 + stats->rx_missed_errors += priv->stats.qcnt.rx_out_of_buffer; 4072 + stats->rx_dropped += PPORT_2863_GET(pstats, if_in_discards); 4075 4073 4076 - stats->rx_length_errors = 4074 + stats->rx_length_errors += 4077 4075 PPORT_802_3_GET(pstats, a_in_range_length_errors) + 4078 4076 PPORT_802_3_GET(pstats, a_out_of_range_length_field) + 4079 4077 PPORT_802_3_GET(pstats, a_frame_too_long_errors) + 4080 4078 VNIC_ENV_GET(&priv->stats.vnic, eth_wqe_too_small); 4081 - stats->rx_crc_errors = 4079 + stats->rx_crc_errors += 4082 4080 PPORT_802_3_GET(pstats, a_frame_check_sequence_errors); 4083 - stats->rx_frame_errors = PPORT_802_3_GET(pstats, a_alignment_errors); 4084 - stats->tx_aborted_errors = PPORT_2863_GET(pstats, if_out_discards); 4085 - stats->rx_errors = stats->rx_length_errors + stats->rx_crc_errors + 4086 - stats->rx_frame_errors; 4087 - stats->tx_errors = stats->tx_aborted_errors + stats->tx_carrier_errors; 4081 + stats->rx_frame_errors += PPORT_802_3_GET(pstats, a_alignment_errors); 4082 + stats->tx_aborted_errors += PPORT_2863_GET(pstats, if_out_discards); 4083 + stats->rx_errors += stats->rx_length_errors + stats->rx_crc_errors + 4084 + stats->rx_frame_errors; 4085 + stats->tx_errors += stats->tx_aborted_errors + stats->tx_carrier_errors; 4088 4086 } 4089 4087 4090 4088 static void mlx5e_nic_set_rx_mode(struct mlx5e_priv *priv) ··· 6844 6842 struct mlx5e_priv *priv = netdev_priv(netdev); 6845 6843 struct mlx5_core_dev *mdev = edev->mdev; 6846 6844 6845 + mlx5_eswitch_safe_aux_devs_remove(mdev); 6847 6846 mlx5_core_uplink_netdev_set(mdev, NULL); 6848 6847 6849 6848 if (priv->profile)
+13 -6
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
··· 2147 2147 2148 2148 static void mlx5e_tc_del_fdb_peers_flow(struct mlx5e_tc_flow *flow) 2149 2149 { 2150 + struct mlx5_devcom_comp_dev *devcom; 2151 + struct mlx5_devcom_comp_dev *pos; 2152 + struct mlx5_eswitch *peer_esw; 2150 2153 int i; 2151 2154 2152 - for (i = 0; i < MLX5_MAX_PORTS; i++) { 2153 - if (i == mlx5_get_dev_index(flow->priv->mdev)) 2154 - continue; 2155 + devcom = flow->priv->mdev->priv.eswitch->devcom; 2156 + mlx5_devcom_for_each_peer_entry(devcom, peer_esw, pos) { 2157 + i = mlx5_get_dev_index(peer_esw->dev); 2155 2158 mlx5e_tc_del_fdb_peer_flow(flow, i); 2156 2159 } 2157 2160 } ··· 5516 5513 5517 5514 void mlx5e_tc_clean_fdb_peer_flows(struct mlx5_eswitch *esw) 5518 5515 { 5516 + struct mlx5_devcom_comp_dev *devcom; 5517 + struct mlx5_devcom_comp_dev *pos; 5519 5518 struct mlx5e_tc_flow *flow, *tmp; 5519 + struct mlx5_eswitch *peer_esw; 5520 5520 int i; 5521 5521 5522 - for (i = 0; i < MLX5_MAX_PORTS; i++) { 5523 - if (i == mlx5_get_dev_index(esw->dev)) 5524 - continue; 5522 + devcom = esw->devcom; 5523 + 5524 + mlx5_devcom_for_each_peer_entry(devcom, peer_esw, pos) { 5525 + i = mlx5_get_dev_index(peer_esw->dev); 5525 5526 list_for_each_entry_safe(flow, tmp, &esw->offloads.peer_flows[i], peer[i]) 5526 5527 mlx5e_tc_del_fdb_peers_flow(flow); 5527 5528 }
+4
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
··· 929 929 int mlx5_esw_ipsec_vf_packet_offload_supported(struct mlx5_core_dev *dev, 930 930 u16 vport_num); 931 931 bool mlx5_esw_host_functions_enabled(const struct mlx5_core_dev *dev); 932 + void mlx5_eswitch_safe_aux_devs_remove(struct mlx5_core_dev *dev); 932 933 #else /* CONFIG_MLX5_ESWITCH */ 933 934 /* eswitch API stubs */ 934 935 static inline int mlx5_eswitch_init(struct mlx5_core_dev *dev) { return 0; } ··· 1012 1011 { 1013 1012 return false; 1014 1013 } 1014 + 1015 + static inline void 1016 + mlx5_eswitch_safe_aux_devs_remove(struct mlx5_core_dev *dev) {} 1015 1017 1016 1018 #endif /* CONFIG_MLX5_ESWITCH */ 1017 1019
+26
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
··· 3981 3981 return true; 3982 3982 } 3983 3983 3984 + #define MLX5_ESW_HOLD_TIMEOUT_MS 7000 3985 + #define MLX5_ESW_HOLD_RETRY_DELAY_MS 500 3986 + 3987 + void mlx5_eswitch_safe_aux_devs_remove(struct mlx5_core_dev *dev) 3988 + { 3989 + unsigned long timeout; 3990 + bool hold_esw = true; 3991 + 3992 + /* Wait for any concurrent eswitch mode transition to complete. */ 3993 + if (!mlx5_esw_hold(dev)) { 3994 + timeout = jiffies + msecs_to_jiffies(MLX5_ESW_HOLD_TIMEOUT_MS); 3995 + while (!mlx5_esw_hold(dev)) { 3996 + if (!time_before(jiffies, timeout)) { 3997 + hold_esw = false; 3998 + break; 3999 + } 4000 + msleep(MLX5_ESW_HOLD_RETRY_DELAY_MS); 4001 + } 4002 + } 4003 + if (hold_esw) { 4004 + if (mlx5_eswitch_mode(dev) == MLX5_ESWITCH_OFFLOADS) 4005 + mlx5_core_reps_aux_devs_remove(dev); 4006 + mlx5_esw_release(dev); 4007 + } 4008 + } 4009 + 3984 4010 int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode, 3985 4011 struct netlink_ext_ack *extack) 3986 4012 {
+1
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
··· 290 290 void mlx5_unregister_device(struct mlx5_core_dev *dev); 291 291 void mlx5_dev_set_lightweight(struct mlx5_core_dev *dev); 292 292 bool mlx5_dev_is_lightweight(struct mlx5_core_dev *dev); 293 + void mlx5_core_reps_aux_devs_remove(struct mlx5_core_dev *dev); 293 294 294 295 void mlx5_fw_reporters_create(struct mlx5_core_dev *dev); 295 296 int mlx5_query_mtpps(struct mlx5_core_dev *dev, u32 *mtpps, u32 mtpps_size);