From 5afb79f9d86fd4ed7ff789515f021df2b056d3cf Mon Sep 17 00:00:00 2001 From: Yevgeny Kliteynik Date: Sun, 17 Dec 2023 12:06:01 +0200 Subject: [PATCH] mlx5: DR, Can't go to uplink vport on RX rule 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: 828351a7da47 ("mlx5: Expose steering action functionality") Signed-off-by: Yevgeny Kliteynik Reviewed-by: Erez Shitrit Signed-off-by: Yishai Hadas --- providers/mlx5/dr_action.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/providers/mlx5/dr_action.c b/providers/mlx5/dr_action.c index 2455bfc0b..d139f23ae 100644 --- a/providers/mlx5/dr_action.c +++ b/providers/mlx5/dr_action.c @@ -873,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) {