Skip to content

Commit 8112d5f

Browse files
committed
Merge branch 'mlx5-cleanups-2025-03-19'
Tariq Toukan says: ==================== mlx5 cleanups 2025-03-19 This series contains small cleanups to the mlx5 core and Eth drivers. ==================== Link: https://patch.msgid.link/1742412199-159596-1-git-send-email-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents c3ad9d9 + cba38d1 commit 8112d5f

File tree

7 files changed

+10
-34
lines changed

7 files changed

+10
-34
lines changed

drivers/net/ethernet/mellanox/mlx5/core/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ config MLX5_CORE_EN
3131
bool "Mellanox 5th generation network adapters (ConnectX series) Ethernet support"
3232
depends on NETDEVICES && ETHERNET && INET && PCI && MLX5_CORE
3333
select PAGE_POOL
34+
select PAGE_POOL_STATS
3435
select DIMLIB
3536
help
3637
Ethernet support in Mellanox Technologies ConnectX-4 NIC.

drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ static void mlx5e_tc_tun_route_attr_cleanup(struct mlx5e_tc_tun_route_attr *attr
3131
{
3232
if (attr->n)
3333
neigh_release(attr->n);
34-
if (attr->route_dev)
35-
dev_put(attr->route_dev);
34+
dev_put(attr->route_dev);
3635
}
3736

3837
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,
6867
* while holding rcu read lock. Take the net_device for correctness
6968
* sake.
7069
*/
71-
if (uplink_upper)
72-
dev_hold(uplink_upper);
70+
dev_hold(uplink_upper);
7371
rcu_read_unlock();
7472

7573
dst_is_lag_dev = (uplink_upper &&
7674
netif_is_lag_master(uplink_upper) &&
7775
real_dev == uplink_upper &&
7876
mlx5_lag_is_sriov(priv->mdev));
79-
if (uplink_upper)
80-
dev_put(uplink_upper);
77+
dev_put(uplink_upper);
8178

8279
/* if the egress device isn't on the same HW e-switch or
8380
* it's a LAG device, use the uplink

drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ static int mlx5e_set_int_port_tunnel(struct mlx5e_priv *priv,
4242
&attr->action, out_index);
4343

4444
out:
45-
if (route_dev)
46-
dev_put(route_dev);
45+
dev_put(route_dev);
4746

4847
return err;
4948
}
@@ -753,8 +752,7 @@ static int mlx5e_set_vf_tunnel(struct mlx5_eswitch *esw,
753752
}
754753

755754
out:
756-
if (route_dev)
757-
dev_put(route_dev);
755+
dev_put(route_dev);
758756
return err;
759757
}
760758

@@ -788,8 +786,7 @@ static int mlx5e_update_vf_tunnel(struct mlx5_eswitch *esw,
788786
mlx5e_tc_match_to_reg_mod_hdr_change(esw->dev, mod_hdr_acts, VPORT_TO_REG, act_id, data);
789787

790788
out:
791-
if (route_dev)
792-
dev_put(route_dev);
789+
dev_put(route_dev);
793790
return err;
794791
}
795792

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,15 +359,15 @@ static int mlx5e_rq_shampo_hd_info_alloc(struct mlx5e_rq *rq, int node)
359359
return 0;
360360

361361
err_nomem:
362-
kvfree(shampo->bitmap);
362+
bitmap_free(shampo->bitmap);
363363
kvfree(shampo->pages);
364364

365365
return -ENOMEM;
366366
}
367367

368368
static void mlx5e_rq_shampo_hd_info_free(struct mlx5e_rq *rq)
369369
{
370-
kvfree(rq->mpwqe.shampo->bitmap);
370+
bitmap_free(rq->mpwqe.shampo->bitmap);
371371
kvfree(rq->mpwqe.shampo->pages);
372372
}
373373

drivers/net/ethernet/mellanox/mlx5/core/en_stats.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@
3737
#include "en/ptp.h"
3838
#include "en/port.h"
3939

40-
#ifdef CONFIG_PAGE_POOL_STATS
4140
#include <net/page_pool/helpers.h>
42-
#endif
4341

4442
void mlx5e_ethtool_put_stat(u64 **data, u64 val)
4543
{
@@ -196,7 +194,6 @@ static const struct counter_desc sw_stats_desc[] = {
196194
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_arfs_err) },
197195
#endif
198196
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_recover) },
199-
#ifdef CONFIG_PAGE_POOL_STATS
200197
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_pp_alloc_fast) },
201198
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_pp_alloc_slow) },
202199
{ 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[] = {
208205
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_pp_recycle_ring) },
209206
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_pp_recycle_ring_full) },
210207
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_pp_recycle_released_ref) },
211-
#endif
212208
#ifdef CONFIG_MLX5_EN_TLS
213209
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_tls_decrypted_packets) },
214210
{ 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,
377373
s->rx_arfs_err += rq_stats->arfs_err;
378374
#endif
379375
s->rx_recover += rq_stats->recover;
380-
#ifdef CONFIG_PAGE_POOL_STATS
381376
s->rx_pp_alloc_fast += rq_stats->pp_alloc_fast;
382377
s->rx_pp_alloc_slow += rq_stats->pp_alloc_slow;
383378
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,
389384
s->rx_pp_recycle_ring += rq_stats->pp_recycle_ring;
390385
s->rx_pp_recycle_ring_full += rq_stats->pp_recycle_ring_full;
391386
s->rx_pp_recycle_released_ref += rq_stats->pp_recycle_released_ref;
392-
#endif
393387
#ifdef CONFIG_MLX5_EN_TLS
394388
s->rx_tls_decrypted_packets += rq_stats->tls_decrypted_packets;
395389
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,
496490
}
497491
}
498492

499-
#ifdef CONFIG_PAGE_POOL_STATS
500493
static void mlx5e_stats_update_stats_rq_page_pool(struct mlx5e_channel *c)
501494
{
502495
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)
519512
rq_stats->pp_recycle_ring_full = stats.recycle_stats.ring_full;
520513
rq_stats->pp_recycle_released_ref = stats.recycle_stats.released_refcnt;
521514
}
522-
#else
523-
static void mlx5e_stats_update_stats_rq_page_pool(struct mlx5e_channel *c)
524-
{
525-
}
526-
#endif
527515

528516
static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(sw)
529517
{
@@ -2131,7 +2119,6 @@ static const struct counter_desc rq_stats_desc[] = {
21312119
{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, arfs_err) },
21322120
#endif
21332121
{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, recover) },
2134-
#ifdef CONFIG_PAGE_POOL_STATS
21352122
{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, pp_alloc_fast) },
21362123
{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, pp_alloc_slow) },
21372124
{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, pp_alloc_slow_high_order) },
@@ -2143,7 +2130,6 @@ static const struct counter_desc rq_stats_desc[] = {
21432130
{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, pp_recycle_ring) },
21442131
{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, pp_recycle_ring_full) },
21452132
{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, pp_recycle_released_ref) },
2146-
#endif
21472133
#ifdef CONFIG_MLX5_EN_TLS
21482134
{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, tls_decrypted_packets) },
21492135
{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, tls_decrypted_bytes) },

drivers/net/ethernet/mellanox/mlx5/core/en_stats.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ struct mlx5e_sw_stats {
215215
u64 ch_aff_change;
216216
u64 ch_force_irq;
217217
u64 ch_eq_rearm;
218-
#ifdef CONFIG_PAGE_POOL_STATS
219218
u64 rx_pp_alloc_fast;
220219
u64 rx_pp_alloc_slow;
221220
u64 rx_pp_alloc_slow_high_order;
@@ -227,7 +226,6 @@ struct mlx5e_sw_stats {
227226
u64 rx_pp_recycle_ring;
228227
u64 rx_pp_recycle_ring_full;
229228
u64 rx_pp_recycle_released_ref;
230-
#endif
231229
#ifdef CONFIG_MLX5_EN_TLS
232230
u64 tx_tls_encrypted_packets;
233231
u64 tx_tls_encrypted_bytes;
@@ -385,7 +383,6 @@ struct mlx5e_rq_stats {
385383
u64 arfs_err;
386384
#endif
387385
u64 recover;
388-
#ifdef CONFIG_PAGE_POOL_STATS
389386
u64 pp_alloc_fast;
390387
u64 pp_alloc_slow;
391388
u64 pp_alloc_slow_high_order;
@@ -397,7 +394,6 @@ struct mlx5e_rq_stats {
397394
u64 pp_recycle_ring;
398395
u64 pp_recycle_ring_full;
399396
u64 pp_recycle_released_ref;
400-
#endif
401397
#ifdef CONFIG_MLX5_EN_TLS
402398
u64 tls_decrypted_packets;
403399
u64 tls_decrypted_bytes;

drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,7 @@ static struct net_device *mlx5_lag_active_backup_get_netdev(struct mlx5_core_dev
523523
ndev = ldev->pf[last_idx].netdev;
524524
}
525525

526-
if (ndev)
527-
dev_hold(ndev);
526+
dev_hold(ndev);
528527

529528
unlock:
530529
spin_unlock_irqrestore(&lag_lock, flags);

0 commit comments

Comments
 (0)