mlx5 cleanups 2025-03-19
Subsystems (5)
Tariq Toukan
maintainercover mlx5 cleanups 2025-03-19
Hi,
This series contains small cleanups to the mlx5 core and Eth drivers.
Regards,
Tariq
Gal Pressman (1):
net/mlx5: Remove NULL check before dev_{put, hold}
Mark Zhang (1):
net/mlx5e: Use right API to free bitmap memory
Tariq Toukan (1):
net/mlx5e: Always select CONFIG_PAGE_POOL_STATS
drivers/net/ethernet/mellanox/mlx5/core/Kconfig | 1 + .../net/ethernet/mellanox/mlx5/core/en/tc_tun.c | 9 +++------ .../ethernet/mellanox/mlx5/core/en/tc_tun_encap.c | 9 +++------ drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 ++-- drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 14 -------------- drivers/net/ethernet/mellanox/mlx5/core/en_stats.h | 4 ---- drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 3 +-- 7 files changed, 10 insertions(+), 34 deletions(-)
base-commit: 8904eeb9de86e940cb635a42453855790d53b838
Signature · 1 line
2.31.1
Tariq Toukan
maintainerPATCH 1/3 net/mlx5: Remove NULL check before dev_{put, hold}
From: Gal Pressman <[email protected]>
Fix coccinelle warnings:
WARNING: NULL check before dev_{put, hold} functions is not needed.
--- drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c | 9 +++------ .../net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c | 9 +++------ drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 3 +-- 3 files changed, 7 insertions(+), 14 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c +3 -6
@@ -31,8 +31,7 @@ static void mlx5e_tc_tun_route_attr_cleanup(struct mlx5e_tc_tun_route_attr *attr {if (attr->n)neigh_release (attr->n); -if (attr->route_dev) -dev_put (attr->route_dev); +dev_put (attr->route_dev); }struct mlx5e_tc_tunnel *mlx5e_get_tc_tun (struct net_device *tunnel_dev)
@@ -68,16 +67,14 @@ static int get_route_and_out_devs(struct mlx5e_priv *priv,* while holding rcu read lock. Take the net_device for correctness * sake. */ -if (uplink_upper) -dev_hold (uplink_upper); +dev_hold (uplink_upper);rcu_read_unlock (); dst_is_lag_dev = (uplink_upper &&netif_is_lag_master (uplink_upper) && real_dev == uplink_upper &&mlx5_lag_is_sriov (priv->mdev)); -if (uplink_upper) -dev_put (uplink_upper); +dev_put (uplink_upper);/* if the egress device isn't on the same HW e-switch or * it's a LAG device, use the uplink
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c +3 -6
@@ -42,8 +42,7 @@ static int mlx5e_set_int_port_tunnel(struct mlx5e_priv *priv, &attr->action, out_index); out: -if (route_dev) -dev_put (route_dev); +dev_put (route_dev);return err; }
@@ -753,8 +752,7 @@ static int mlx5e_set_vf_tunnel(struct mlx5_eswitch *esw, } out: -if (route_dev) -dev_put (route_dev); +dev_put (route_dev);return err; }
@@ -788,8 +786,7 @@ static int mlx5e_update_vf_tunnel(struct mlx5_eswitch *esw,mlx5e_tc_match_to_reg_mod_hdr_change (esw->dev, mod_hdr_acts,VPORT_TO_REG , act_id, data); out: -if (route_dev) -dev_put (route_dev); +dev_put (route_dev);return err; }
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +1 -2
@@ -523,8 +523,7 @@ static struct net_device *mlx5_lag_active_backup_get_netdev(struct mlx5_core_dev ndev = ldev->pf[last_idx].netdev; } -if (ndev) -dev_hold (ndev); +dev_hold (ndev); unlock:spin_unlock_irqrestore (&lag_lock, flags);
Signature · 1 line
2.31.1
Re: [PATCH net-next 1/3] net/mlx5: Remove NULL check before dev_{put, hold}
Quoted 9 lines · Tariq Toukan
From: Gal Pressman <[email protected]>
Fix coccinelle warnings:
WARNING: NULL check before dev_{put, hold} functions is not needed.Signed-off-by Gal Pressman <[email protected]>Reviewed-by Jianbo Liu <[email protected]>Signed-off-by Tariq Toukan <[email protected]>
LGTM,
Signature · 2 lines
Regards, Kalesh AP
Tariq Toukan
maintainerPATCH 2/3 net/mlx5e: Use right API to free bitmap memory
In reply to Tariq ToukanFrom: Mark Zhang <[email protected]>
Use bitmap_free() to free memory allocated with bitmap_zalloc_node().
This fixes memtrack error:
mtl rsc inconsistency: memtrack_free: .../drivers/net/ethernet/mellanox/mlx5/core/en_main.c::466: kfree for unknown address=0xFFFF0000CA3619E8, device=0x0
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +2 -2
@@ -359,7 +359,7 @@ static int mlx5e_rq_shampo_hd_info_alloc(struct mlx5e_rq *rq, int node)return 0 ; err_nomem: -kvfree (shampo->bitmap); +bitmap_free (shampo->bitmap);kvfree (shampo->pages);return -ENOMEM ;
@@ -367,7 +367,7 @@ static int mlx5e_rq_shampo_hd_info_alloc(struct mlx5e_rq *rq, int node)static void mlx5e_rq_shampo_hd_info_free (struct mlx5e_rq *rq) { -kvfree (rq->mpwqe.shampo->bitmap); +bitmap_free (rq->mpwqe.shampo->bitmap);kvfree (rq->mpwqe.shampo->pages); }
Signature · 1 line
2.31.1
Re: [PATCH net-next 2/3] net/mlx5e: Use right API to free bitmap memory
Quoted 10 lines · Tariq Toukan
From: Mark Zhang <[email protected]>
Use
bitmap_free()to free memory allocated withbitmap_zalloc_node().
This fixes memtrack error:
mtl rsc inconsistency:memtrack_free: .../drivers/net/ethernet/mellanox/mlx5/core/en_main.c::466: kfree for unknown address=0xFFFF0000CA3619E8, device=0x0Signed-off-by Mark Zhang <[email protected]>Reviewed-by Maher Sanalla <[email protected]>Signed-off-by Tariq Toukan <[email protected]>
LGTM,
Signature · 2 lines
Regards, Kalesh AP
Tariq Toukan
maintainerPATCH 3/3 net/mlx5e: Always select CONFIG_PAGE_POOL_STATS
In reply to Tariq ToukanAlways set PAGE_POOL_STATS in mlx5 Eth driver.
Cleanup the corresponding #ifdefs.
Page pool stats are essential to monitor and analyze RX performance.
--- drivers/net/ethernet/mellanox/mlx5/core/Kconfig | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 14 -------------- drivers/net/ethernet/mellanox/mlx5/core/en_stats.h | 4 ---- 3 files changed, 1 insertion(+), 18 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/Kconfig +1 -0
@@ -31,6 +31,7 @@ config MLX5_CORE_EN bool "Mellanox 5th generation network adapters (ConnectX series) Ethernet support" depends on NETDEVICES && ETHERNET && INET && PCI && MLX5_CORE select PAGE_POOL + select PAGE_POOL_STATS select DIMLIB help Ethernet support in Mellanox Technologies ConnectX-4 NIC.
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +0 -14
@@ -37,9 +37,7 @@#include "en/ptp.h" #include "en/port.h" -#ifdef CONFIG_PAGE_POOL_STATS #include <net/page_pool/helpers.h> -#endif void mlx5e_ethtool_put_stat (u64 **data,u64 val) {
@@ -196,7 +194,6 @@ static const struct counter_desc sw_stats_desc[] = { { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_arfs_err) },#endif { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_recover) }, -#ifdef CONFIG_PAGE_POOL_STATS { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_pp_alloc_fast) }, { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_pp_alloc_slow) }, { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_pp_alloc_slow_high_order) },
@@ -208,7 +205,6 @@ static const struct counter_desc sw_stats_desc[] = { { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_pp_recycle_ring) }, { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_pp_recycle_ring_full) }, { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_pp_recycle_released_ref) }, -#endif #ifdef CONFIG_MLX5_EN_TLS { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_tls_decrypted_packets) }, { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_tls_decrypted_bytes) },
@@ -377,7 +373,6 @@ static void mlx5e_stats_grp_sw_update_stats_rq_stats(struct mlx5e_sw_stats *s, s->rx_arfs_err += rq_stats->arfs_err;#endif s->rx_recover += rq_stats->recover; -#ifdef CONFIG_PAGE_POOL_STATS s->rx_pp_alloc_fast += rq_stats->pp_alloc_fast; s->rx_pp_alloc_slow += rq_stats->pp_alloc_slow; s->rx_pp_alloc_empty += rq_stats->pp_alloc_empty;
@@ -389,7 +384,6 @@ static void mlx5e_stats_grp_sw_update_stats_rq_stats(struct mlx5e_sw_stats *s, s->rx_pp_recycle_ring += rq_stats->pp_recycle_ring; s->rx_pp_recycle_ring_full += rq_stats->pp_recycle_ring_full; s->rx_pp_recycle_released_ref += rq_stats->pp_recycle_released_ref; -#endif #ifdef CONFIG_MLX5_EN_TLS s->rx_tls_decrypted_packets += rq_stats->tls_decrypted_packets; s->rx_tls_decrypted_bytes += rq_stats->tls_decrypted_bytes;
@@ -496,7 +490,6 @@ static void mlx5e_stats_grp_sw_update_stats_qos(struct mlx5e_priv *priv, } } -#ifdef CONFIG_PAGE_POOL_STATS static void mlx5e_stats_update_stats_rq_page_pool (struct mlx5e_channel *c) {struct mlx5e_rq_stats *rq_stats = c->rq.stats;
@@ -519,11 +512,6 @@ static void mlx5e_stats_update_stats_rq_page_pool(struct mlx5e_channel *c) rq_stats->pp_recycle_ring_full = stats.recycle_stats.ring_full; rq_stats->pp_recycle_released_ref = stats.recycle_stats.released_refcnt; } -#else -static void mlx5e_stats_update_stats_rq_page_pool (struct mlx5e_channel *c) -{ -} -#endif static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS (sw) {
@@ -2086,7 +2074,6 @@ static const struct counter_desc rq_stats_desc[] = { { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, arfs_err) },#endif { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, recover) }, -#ifdef CONFIG_PAGE_POOL_STATS { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, pp_alloc_fast) }, { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, pp_alloc_slow) }, { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, pp_alloc_slow_high_order) },
@@ -2098,7 +2085,6 @@ static const struct counter_desc rq_stats_desc[] = { { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, pp_recycle_ring) }, { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, pp_recycle_ring_full) }, { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, pp_recycle_released_ref) }, -#endif #ifdef CONFIG_MLX5_EN_TLS { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, tls_decrypted_packets) }, { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, tls_decrypted_bytes) },
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +0 -4
@@ -215,7 +215,6 @@ struct mlx5e_sw_stats {u64 ch_aff_change;u64 ch_force_irq;u64 ch_eq_rearm; -#ifdef CONFIG_PAGE_POOL_STATS u64 rx_pp_alloc_fast;u64 rx_pp_alloc_slow;u64 rx_pp_alloc_slow_high_order;
@@ -227,7 +226,6 @@ struct mlx5e_sw_stats {u64 rx_pp_recycle_ring;u64 rx_pp_recycle_ring_full;u64 rx_pp_recycle_released_ref; -#endif #ifdef CONFIG_MLX5_EN_TLS u64 tx_tls_encrypted_packets;u64 tx_tls_encrypted_bytes;
@@ -381,7 +379,6 @@ struct mlx5e_rq_stats {u64 arfs_err;#endif u64 recover; -#ifdef CONFIG_PAGE_POOL_STATS u64 pp_alloc_fast;u64 pp_alloc_slow;u64 pp_alloc_slow_high_order;
@@ -393,7 +390,6 @@ struct mlx5e_rq_stats {u64 pp_recycle_ring;u64 pp_recycle_ring_full;u64 pp_recycle_released_ref; -#endif #ifdef CONFIG_MLX5_EN_TLS u64 tls_decrypted_packets;u64 tls_decrypted_bytes;
Signature · 1 line
2.31.1
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Wed, 19 Mar 2025 21:23:16 +0200 you wrote:
Hi,
This series contains small cleanups to the mlx5 core and Eth drivers.
Regards,
Tariq[...]
Here is the summary with links:
- [net-next,1/3] net/mlx5: Remove NULL check before dev_{put, hold}
https://git.kernel.org/netdev/net-next/c/42cd8dee3a1b - [net-next,2/3] net/mlx5e: Use right API to free bitmap memory https://git.kernel.org/netdev/net-next/c/cac48eb6d383 - [net-next,3/3] net/mlx5e: Always select CONFIG_PAGE_POOL_STATS https://git.kernel.org/netdev/net-next/c/cba38d1235ff
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html