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 all commits
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
20 changes: 16 additions & 4 deletions providers/mlx5/dr_action.c
Expand Up @@ -684,6 +684,7 @@ int dr_actions_build_ste_arr(struct mlx5dv_dr_matcher *matcher,
switch (action_type) {
case DR_ACTION_TYP_DROP:
attr.final_icm_addr = nic_dmn->drop_icm_addr;
attr.hit_gvmi = nic_dmn->drop_icm_addr >> 48;
break;
case DR_ACTION_TYP_FT:
{
Expand Down Expand Up @@ -872,10 +873,21 @@ int dr_actions_build_ste_arr(struct mlx5dv_dr_matcher *matcher,
dr_dbg(dmn, "Destination vport belongs to a different domain\n");
goto out_invalid_arg;
}
attr.hit_gvmi = action->vport.caps->vhca_gvmi;
attr.final_icm_addr = rx_rule ?
action->vport.caps->icm_address_rx :
action->vport.caps->icm_address_tx;
if (unlikely(rx_rule && action->vport.caps->num == WIRE_PORT)) {
if (dmn->type == MLX5DV_DR_DOMAIN_TYPE_NIC_RX) {
dr_dbg(dmn, "Forwarding to uplink vport on RX is not allowed\n");
goto out_invalid_arg;
}

/* silently drop the packets for RX side of FDB */
attr.final_icm_addr = nic_dmn->drop_icm_addr;
attr.hit_gvmi = nic_dmn->drop_icm_addr >> 48;
} else {
attr.hit_gvmi = action->vport.caps->vhca_gvmi;
attr.final_icm_addr = rx_rule ?
action->vport.caps->icm_address_rx :
action->vport.caps->icm_address_tx;
}
break;
case DR_ACTION_TYP_DEST_ARRAY:
if (action->dest_array.dmn != dmn) {
Expand Down
12 changes: 8 additions & 4 deletions providers/mlx5/dr_ptrn.c
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
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