]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
net/mlx5e: Support accept action
authorVlad Buslov <vladbu@nvidia.com>
Tue, 7 Sep 2021 15:47:02 +0000 (18:47 +0300)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 26 Aug 2022 08:54:28 +0000 (10:54 +0200)
BugLink: https://bugs.launchpad.net/bugs/1983498
Support TC generic 'accept' action in mlx5 by introducing
MLX5_ESW_ATTR_FLAG_ACCEPT attribute flag. Flag has similar semantics to
existing MLX5_ESW_ATTR_FLAG_SLOW_PATH flag, however, dedicated flag is
required because existing 'slow path' flag can be flipped by tunneling
subsystem when neighbor changes state.

Introduce new helper function mlx5_esw_attr_flags_skip() to check whether
attribute flags for 'slow path' or 'accept' action are set and use it in
eswitch code instead of direct bit manipulation.

Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
Reviewed-by: Paul Blakey <paulb@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
(cherry picked from commit 6ba2e2b33df853b73c8494758a1da7067d144f7e)
Signed-off-by: Zachary Tahenakos <zachary.tahenakos@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c

index 4ef96c86d044b12fdafbbc31e8f03241559fc488..95a9c1156eee4c2543d5aa68f71823ed60b84e66 100644 (file)
@@ -3881,6 +3881,11 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,
 
        flow_action_for_each(i, act, flow_action) {
                switch (act->id) {
+               case FLOW_ACTION_ACCEPT:
+                       action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST |
+                               MLX5_FLOW_CONTEXT_ACTION_COUNT;
+                       attr->flags |= MLX5_ESW_ATTR_FLAG_ACCEPT;
+                       break;
                case FLOW_ACTION_DROP:
                        action |= MLX5_FLOW_CONTEXT_ACTION_DROP |
                                  MLX5_FLOW_CONTEXT_ACTION_COUNT;
index 31fc08ff85ae3762dd7276f7794abb7c8cd2e2a2..2f13b480a8dd7b755f404a8e221aeadfeeebdbe3 100644 (file)
@@ -453,8 +453,16 @@ enum {
        MLX5_ESW_ATTR_FLAG_NO_IN_PORT    = BIT(2),
        MLX5_ESW_ATTR_FLAG_SRC_REWRITE   = BIT(3),
        MLX5_ESW_ATTR_FLAG_SAMPLE        = BIT(4),
+       MLX5_ESW_ATTR_FLAG_ACCEPT        = BIT(5),
 };
 
+/* Returns true if any of the flags that require skipping further TC/NF processing are set. */
+static inline bool
+mlx5_esw_attr_flags_skip(u32 attr_flags)
+{
+       return attr_flags & (MLX5_ESW_ATTR_FLAG_SLOW_PATH | MLX5_ESW_ATTR_FLAG_ACCEPT);
+}
+
 struct mlx5_esw_flow_attr {
        struct mlx5_eswitch_rep *in_rep;
        struct mlx5_core_dev    *in_mdev;
index 50a9183085ef307956e5cdb6f65cc3fbdd613bb5..e64bf73765c56b7f8dedb5e2e321a366343a2beb 100644 (file)
@@ -440,7 +440,7 @@ esw_setup_dests(struct mlx5_flow_destination *dest,
        } else if (attr->dest_ft) {
                esw_setup_ft_dest(dest, flow_act, esw, attr, spec, *i);
                (*i)++;
-       } else if (attr->flags & MLX5_ESW_ATTR_FLAG_SLOW_PATH) {
+       } else if (mlx5_esw_attr_flags_skip(attr->flags)) {
                esw_setup_slow_path_dest(dest, flow_act, chains, *i);
                (*i)++;
        } else if (attr->dest_chain) {
@@ -467,7 +467,7 @@ esw_cleanup_dests(struct mlx5_eswitch *esw,
 
        if (attr->dest_ft) {
                esw_cleanup_decap_indir(esw, attr);
-       } else if (!(attr->flags & MLX5_ESW_ATTR_FLAG_SLOW_PATH)) {
+       } else if (!mlx5_esw_attr_flags_skip(attr->flags)) {
                if (attr->dest_chain)
                        esw_cleanup_chain_dest(chains, attr->dest_chain, 1, 0);
                else if (esw_is_indir_table(esw, attr))
@@ -678,7 +678,7 @@ __mlx5_eswitch_del_rule(struct mlx5_eswitch *esw,
 
        mlx5_del_flow_rules(rule);
 
-       if (!(attr->flags & MLX5_ESW_ATTR_FLAG_SLOW_PATH)) {
+       if (!mlx5_esw_attr_flags_skip(attr->flags)) {
                /* unref the term table */
                for (i = 0; i < MLX5_MAX_FLOW_FWD_VPORTS; i++) {
                        if (esw_attr->dests[i].termtbl)
index b459549058450ab890f6093050d484926a5e232a..879d78e46e47d896cf935a8fd02f4aee04e10422 100644 (file)
@@ -219,7 +219,7 @@ mlx5_eswitch_termtbl_required(struct mlx5_eswitch *esw,
 
        if (!MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, termination_table) ||
            !MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, ignore_flow_level) ||
-           attr->flags & MLX5_ESW_ATTR_FLAG_SLOW_PATH ||
+           mlx5_esw_attr_flags_skip(attr->flags) ||
            !mlx5_eswitch_offload_is_uplink_port(esw, spec))
                return false;