Skip to content

Commit

Permalink
mlx5: DR, Can't go to uplink vport on RX rule
Browse files Browse the repository at this point in the history
[ Upstream commit 5afb79f ]

Go-To-Vport action on RX is not allowed when the vport is uplink.  If
this happens on RX domain, the rule insertion fails, as the rule is
illegal.
If this happens on RX side of the FDB domain, then the TX part of the
rule is legal, and the RX part will be replaced with drop.

Fixes: 828351a ("mlx5: Expose steering action functionality")
Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Reviewed-by: Erez Shitrit <erezsh@nvidia.com>
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Signed-off-by: Nicolas Morey <nmorey@suse.com>
  • Loading branch information
kliteyn authored and nmorey committed Jan 17, 2024
1 parent 12b441b commit 6b608a5
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions providers/mlx5/dr_action.c
Expand Up @@ -842,10 +842,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

0 comments on commit 6b608a5

Please sign in to comment.