Skip to content

Commit 181d981

Browse files
committed
Merge branch 'mlx5-misc-fixes-2025-09-22'
Tariq Toukan says: ==================== mlx5 misc fixes 2025-09-22 This patchset provides misc bug fixes from the team to the mlx5 Eth and core drivers. ==================== Link: https://patch.msgid.link/1758525094-816583-1-git-send-email-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 0efdfbb + 6d0477d commit 181d981

9 files changed

Lines changed: 40 additions & 17 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,6 +1466,7 @@ static void fec_set_block_stats(struct mlx5e_priv *priv,
14661466
case MLX5E_FEC_RS_528_514:
14671467
case MLX5E_FEC_RS_544_514:
14681468
case MLX5E_FEC_LLRS_272_257_1:
1469+
case MLX5E_FEC_RS_544_514_INTERLEAVED_QUAD:
14691470
fec_set_rs_stats(fec_stats, out);
14701471
return;
14711472
case MLX5E_FEC_FIRECODE:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ static void del_sw_hw_rule(struct fs_node *node)
663663
BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_ACTION) |
664664
BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_FLOW_COUNTERS);
665665
fte->act_dests.action.action &= ~MLX5_FLOW_CONTEXT_ACTION_COUNT;
666-
mlx5_fc_local_destroy(rule->dest_attr.counter);
666+
mlx5_fc_local_put(rule->dest_attr.counter);
667667
goto out;
668668
}
669669

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ struct mlx5_fc {
343343
enum mlx5_fc_type type;
344344
struct mlx5_fc_bulk *bulk;
345345
struct mlx5_fc_cache cache;
346+
refcount_t fc_local_refcount;
346347
/* last{packets,bytes} are used for calculating deltas since last reading. */
347348
u64 lastpackets;
348349
u64 lastbytes;

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

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -562,17 +562,36 @@ mlx5_fc_local_create(u32 counter_id, u32 offset, u32 bulk_size)
562562
counter->id = counter_id;
563563
fc_bulk->base_id = counter_id - offset;
564564
fc_bulk->fs_bulk.bulk_len = bulk_size;
565+
refcount_set(&fc_bulk->hws_data.hws_action_refcount, 0);
566+
mutex_init(&fc_bulk->hws_data.lock);
565567
counter->bulk = fc_bulk;
568+
refcount_set(&counter->fc_local_refcount, 1);
566569
return counter;
567570
}
568571
EXPORT_SYMBOL(mlx5_fc_local_create);
569572

570573
void mlx5_fc_local_destroy(struct mlx5_fc *counter)
571574
{
572-
if (!counter || counter->type != MLX5_FC_TYPE_LOCAL)
573-
return;
574-
575575
kfree(counter->bulk);
576576
kfree(counter);
577577
}
578578
EXPORT_SYMBOL(mlx5_fc_local_destroy);
579+
580+
void mlx5_fc_local_get(struct mlx5_fc *counter)
581+
{
582+
if (!counter || counter->type != MLX5_FC_TYPE_LOCAL)
583+
return;
584+
585+
refcount_inc(&counter->fc_local_refcount);
586+
}
587+
588+
void mlx5_fc_local_put(struct mlx5_fc *counter)
589+
{
590+
if (!counter || counter->type != MLX5_FC_TYPE_LOCAL)
591+
return;
592+
593+
if (!refcount_dec_and_test(&counter->fc_local_refcount))
594+
return;
595+
596+
mlx5_fc_local_destroy(counter);
597+
}

drivers/net/ethernet/mellanox/mlx5/core/steering/hws/action.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,7 @@ mlx5hws_action_create_modify_header(struct mlx5hws_context *ctx,
13601360
struct mlx5hws_action *
13611361
mlx5hws_action_create_dest_array(struct mlx5hws_context *ctx, size_t num_dest,
13621362
struct mlx5hws_action_dest_attr *dests,
1363-
bool ignore_flow_level, u32 flags)
1363+
u32 flags)
13641364
{
13651365
struct mlx5hws_cmd_set_fte_dest *dest_list = NULL;
13661366
struct mlx5hws_cmd_ft_create_attr ft_attr = {0};
@@ -1397,7 +1397,7 @@ mlx5hws_action_create_dest_array(struct mlx5hws_context *ctx, size_t num_dest,
13971397
MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE;
13981398
dest_list[i].destination_id = dests[i].dest->dest_obj.obj_id;
13991399
fte_attr.action_flags |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
1400-
fte_attr.ignore_flow_level = ignore_flow_level;
1400+
fte_attr.ignore_flow_level = 1;
14011401
if (dests[i].is_wire_ft)
14021402
last_dest_idx = i;
14031403
break;

drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -572,12 +572,12 @@ static void mlx5_fs_put_dest_action_sampler(struct mlx5_fs_hws_context *fs_ctx,
572572
static struct mlx5hws_action *
573573
mlx5_fs_create_action_dest_array(struct mlx5hws_context *ctx,
574574
struct mlx5hws_action_dest_attr *dests,
575-
u32 num_of_dests, bool ignore_flow_level)
575+
u32 num_of_dests)
576576
{
577577
u32 flags = MLX5HWS_ACTION_FLAG_HWS_FDB | MLX5HWS_ACTION_FLAG_SHARED;
578578

579579
return mlx5hws_action_create_dest_array(ctx, num_of_dests, dests,
580-
ignore_flow_level, flags);
580+
flags);
581581
}
582582

583583
static struct mlx5hws_action *
@@ -1014,19 +1014,14 @@ static int mlx5_fs_fte_get_hws_actions(struct mlx5_flow_root_namespace *ns,
10141014
}
10151015
(*ractions)[num_actions++].action = dest_actions->dest;
10161016
} else if (num_dest_actions > 1) {
1017-
bool ignore_flow_level;
1018-
10191017
if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX ||
10201018
num_fs_actions == MLX5_FLOW_CONTEXT_ACTION_MAX) {
10211019
err = -EOPNOTSUPP;
10221020
goto free_actions;
10231021
}
1024-
ignore_flow_level =
1025-
!!(fte_action->flags & FLOW_ACT_IGNORE_FLOW_LEVEL);
10261022
tmp_action =
10271023
mlx5_fs_create_action_dest_array(ctx, dest_actions,
1028-
num_dest_actions,
1029-
ignore_flow_level);
1024+
num_dest_actions);
10301025
if (!tmp_action) {
10311026
err = -EOPNOTSUPP;
10321027
goto free_actions;

drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws_pools.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,15 +407,21 @@ struct mlx5hws_action *mlx5_fc_get_hws_action(struct mlx5hws_context *ctx,
407407
{
408408
struct mlx5_fs_hws_create_action_ctx create_ctx;
409409
struct mlx5_fc_bulk *fc_bulk = counter->bulk;
410+
struct mlx5hws_action *hws_action;
410411

411412
create_ctx.hws_ctx = ctx;
412413
create_ctx.id = fc_bulk->base_id;
413414
create_ctx.actions_type = MLX5HWS_ACTION_TYP_CTR;
414415

415-
return mlx5_fs_get_hws_action(&fc_bulk->hws_data, &create_ctx);
416+
mlx5_fc_local_get(counter);
417+
hws_action = mlx5_fs_get_hws_action(&fc_bulk->hws_data, &create_ctx);
418+
if (!hws_action)
419+
mlx5_fc_local_put(counter);
420+
return hws_action;
416421
}
417422

418423
void mlx5_fc_put_hws_action(struct mlx5_fc *counter)
419424
{
420425
mlx5_fs_put_hws_action(&counter->bulk->hws_data);
426+
mlx5_fc_local_put(counter);
421427
}

drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,15 +735,14 @@ mlx5hws_action_create_push_vlan(struct mlx5hws_context *ctx, u32 flags);
735735
* @num_dest: The number of dests attributes.
736736
* @dests: The destination array. Each contains a destination action and can
737737
* have additional actions.
738-
* @ignore_flow_level: Whether to turn on 'ignore_flow_level' for this dest.
739738
* @flags: Action creation flags (enum mlx5hws_action_flags).
740739
*
741740
* Return: pointer to mlx5hws_action on success NULL otherwise.
742741
*/
743742
struct mlx5hws_action *
744743
mlx5hws_action_create_dest_array(struct mlx5hws_context *ctx, size_t num_dest,
745744
struct mlx5hws_action_dest_attr *dests,
746-
bool ignore_flow_level, u32 flags);
745+
u32 flags);
747746

748747
/**
749748
* mlx5hws_action_create_insert_header - Create insert header action.

include/linux/mlx5/fs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@ struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging);
308308
void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter);
309309
struct mlx5_fc *mlx5_fc_local_create(u32 counter_id, u32 offset, u32 bulk_size);
310310
void mlx5_fc_local_destroy(struct mlx5_fc *counter);
311+
void mlx5_fc_local_get(struct mlx5_fc *counter);
312+
void mlx5_fc_local_put(struct mlx5_fc *counter);
311313
u64 mlx5_fc_query_lastuse(struct mlx5_fc *counter);
312314
void mlx5_fc_query_cached(struct mlx5_fc *counter,
313315
u64 *bytes, u64 *packets, u64 *lastuse);

0 commit comments

Comments
 (0)