Skip to content

Commit 0c921a8

Browse files
jpirkodavem330
authored andcommitted
mlxsw: acl: Use PBS type for forward action
Current behaviour of "mirred redirect" action (forward) offload is a bit odd. For matched packets the action forwards them to the desired destination, but it also lets the packet duplicates to go the original way down (bridge, router, etc). That is more like "mirred mirror". Fix this by using PBS type which behaves exactly like "mirred redirect". Note that PBS does not support loopback mode. Fixes: 4cda7d8 ("mlxsw: core: Introduce flexible actions support") Signed-off-by: Jiri Pirko <jiri@mellanox.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 6a553b4 commit 0c921a8

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -651,31 +651,29 @@ int mlxsw_afa_block_append_fwd(struct mlxsw_afa_block *block,
651651
u8 local_port, bool in_port)
652652
{
653653
struct mlxsw_afa_fwd_entry_ref *fwd_entry_ref;
654-
u32 kvdl_index = 0;
654+
u32 kvdl_index;
655655
char *act;
656656
int err;
657657

658-
if (!in_port) {
659-
fwd_entry_ref = mlxsw_afa_fwd_entry_ref_create(block,
660-
local_port);
661-
if (IS_ERR(fwd_entry_ref))
662-
return PTR_ERR(fwd_entry_ref);
663-
kvdl_index = fwd_entry_ref->fwd_entry->kvdl_index;
664-
}
658+
if (in_port)
659+
return -EOPNOTSUPP;
660+
fwd_entry_ref = mlxsw_afa_fwd_entry_ref_create(block, local_port);
661+
if (IS_ERR(fwd_entry_ref))
662+
return PTR_ERR(fwd_entry_ref);
663+
kvdl_index = fwd_entry_ref->fwd_entry->kvdl_index;
665664

666665
act = mlxsw_afa_block_append_action(block, MLXSW_AFA_FORWARD_CODE,
667666
MLXSW_AFA_FORWARD_SIZE);
668667
if (!act) {
669668
err = -ENOBUFS;
670669
goto err_append_action;
671670
}
672-
mlxsw_afa_forward_pack(act, MLXSW_AFA_FORWARD_TYPE_OUTPUT,
671+
mlxsw_afa_forward_pack(act, MLXSW_AFA_FORWARD_TYPE_PBS,
673672
kvdl_index, in_port);
674673
return 0;
675674

676675
err_append_action:
677-
if (!in_port)
678-
mlxsw_afa_fwd_entry_ref_destroy(block, fwd_entry_ref);
676+
mlxsw_afa_fwd_entry_ref_destroy(block, fwd_entry_ref);
679677
return err;
680678
}
681679
EXPORT_SYMBOL(mlxsw_afa_block_append_fwd);

0 commit comments

Comments
 (0)