Skip to content

Commit

Permalink
net/mlx5: HWS, use list_move() instead of del/add
Browse files Browse the repository at this point in the history
Wherever applicable, use list_move function instead of list_del + list_add.

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Reviewed-by: Vlad Dogaru <vdogaru@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/1741780194-137519-3-git-send-email-tariqt@nvidia.com
Reviewed-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Yevgeny Kliteynik authored and Paolo Abeni committed Mar 19, 2025
1 parent eae1389 commit 1a403ad
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1985,8 +1985,7 @@ int mlx5hws_definer_get_obj(struct mlx5hws_context *ctx,
continue;

/* Reuse definer and set LRU (move to be first in the list) */
list_del_init(&cached_definer->list_node);
list_add(&cached_definer->list_node, &cache->list_head);
list_move(&cached_definer->list_node, &cache->list_head);
cached_definer->refcount++;
return cached_definer->definer.obj_id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ mlx5hws_pat_get_existing_cached_pattern(struct mlx5hws_pattern_cache *cache,
cached_pattern = mlx5hws_pat_find_cached_pattern(cache, num_of_actions, actions);
if (cached_pattern) {
/* LRU: move it to be first in the list */
list_del_init(&cached_pattern->ptrn_list_node);
list_add(&cached_pattern->ptrn_list_node, &cache->ptrn_list);
list_move(&cached_pattern->ptrn_list_node, &cache->ptrn_list);
cached_pattern->refcount++;
}

Expand Down

0 comments on commit 1a403ad

Please sign in to comment.