Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mlx5: Misc. items #1416

Merged
merged 3 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Next Next commit
mlx5: DR, Fix pattern compare
When comparing two patterns validate they have the same type.

Fixes: 9e305aa ("mlx5: DR, Support RX decap L3 action for STE V1 type")
Signed-off-by: Hamdan Igbaria <[email protected]>
Reviewed-by: Erez Shitrit <[email protected]>
Signed-off-by: Yishai Hadas <[email protected]>
  • Loading branch information
hamdanigbaria authored and Yishai Hadas committed Dec 28, 2023
commit bf930ccbeceed95eb94ab9faec8c38850a652f20
12 changes: 8 additions & 4 deletions providers/mlx5/dr_ptrn.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ static bool dr_ptrn_compare_modify_hdr(size_t cur_num_of_actions,
}

static bool dr_ptrn_compare_pattern(enum dr_ptrn_type type,
enum dr_ptrn_type cur_type,
size_t cur_num_of_actions,
__be64 cur_hw_action[],
size_t num_of_actions,
__be64 hw_action[])
{
if (cur_num_of_actions != num_of_actions)
if ((cur_num_of_actions != num_of_actions) || (cur_type != type))
return false;

switch (type) {
Expand Down Expand Up @@ -87,6 +88,7 @@ dr_ptrn_find_cached_pattern(struct dr_ptrn_mngr *mngr,

list_for_each_safe(&mngr->ptrn_list, cached_pattern, tmp, list) {
if (dr_ptrn_compare_pattern(type,
cached_pattern->type,
cached_pattern->rewrite_param.num_of_actions,
(__be64 *)cached_pattern->rewrite_param.data,
num_of_actions,
Expand All @@ -101,8 +103,8 @@ dr_ptrn_find_cached_pattern(struct dr_ptrn_mngr *mngr,
}

static struct dr_ptrn_obj *
dr_ptrn_alloc_pattern(struct dr_ptrn_mngr *mngr,
uint16_t num_of_actions, uint8_t *data)
dr_ptrn_alloc_pattern(struct dr_ptrn_mngr *mngr, uint16_t num_of_actions,
uint8_t *data, enum dr_ptrn_type type)
{
struct dr_ptrn_obj *pattern;
struct dr_icm_chunk *chunk;
Expand Down Expand Up @@ -135,6 +137,8 @@ dr_ptrn_alloc_pattern(struct dr_ptrn_mngr *mngr,
goto free_pattern;
}

pattern->type = type;

memcpy(pattern->rewrite_param.data, data, num_of_actions * DR_MODIFY_ACTION_SIZE);
pattern->rewrite_param.chunk = chunk;
pattern->rewrite_param.index = index;
Expand Down Expand Up @@ -178,7 +182,7 @@ dr_ptrn_cache_get_pattern(struct dr_ptrn_mngr *mngr,
(__be64 *)data);
if (!pattern) {
/* Alloc and add new pattern to cache */
pattern = dr_ptrn_alloc_pattern(mngr, num_of_actions, data);
pattern = dr_ptrn_alloc_pattern(mngr, num_of_actions, data, type);
if (!pattern)
goto out_unlock;

Expand Down
1 change: 1 addition & 0 deletions providers/mlx5/mlx5dv_dr.h
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,7 @@ struct dr_ptrn_obj {
struct dr_rewrite_param rewrite_param;
atomic_int refcount;
struct list_node list;
enum dr_ptrn_type type;
};

struct dr_arg_obj {
Expand Down