You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
119 lines
4.1 KiB
119 lines
4.1 KiB
4 years ago
|
From a395ed0bff5abd7782871413c7e9ffb8f3fca589 Mon Sep 17 00:00:00 2001
|
||
|
From: Alaa Hleihel <ahleihel@redhat.com>
|
||
|
Date: Tue, 12 May 2020 10:54:03 -0400
|
||
|
Subject: [PATCH 143/312] [netdrv] net/mlx5: Add ignore level support fwd to
|
||
|
table rules
|
||
|
|
||
|
Message-id: <20200512105530.4207-38-ahleihel@redhat.com>
|
||
|
Patchwork-id: 306910
|
||
|
Patchwork-instance: patchwork
|
||
|
O-Subject: [RHEL8.3 BZ 1789382 037/124] net/mlx5: Add ignore level support fwd to table rules
|
||
|
Bugzilla: 1789382
|
||
|
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
|
||
|
RH-Acked-by: Kamal Heib <kheib@redhat.com>
|
||
|
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
|
||
|
|
||
|
Bugzilla: http://bugzilla.redhat.com/1789382
|
||
|
Upstream: v5.6-rc1
|
||
|
|
||
|
commit ff189b43568216c6211e9e7ddd9026cb8295e744
|
||
|
Author: Paul Blakey <paulb@mellanox.com>
|
||
|
Date: Sun Jan 5 15:15:54 2020 +0200
|
||
|
|
||
|
net/mlx5: Add ignore level support fwd to table rules
|
||
|
|
||
|
If user sets ignore flow level flag on a rule, that rule can point to
|
||
|
a flow table of any level, including those with levels equal or less
|
||
|
than the level of the flow table it is added on.
|
||
|
|
||
|
This with unamanged tables will be used to create a FDB chain/prio
|
||
|
hierarchy much larger than currently supported level range.
|
||
|
|
||
|
Signed-off-by: Paul Blakey <paulb@mellanox.com>
|
||
|
Reviewed-by: Mark Bloch <markb@mellanox.com>
|
||
|
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
|
||
|
|
||
|
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
|
||
|
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
|
||
|
---
|
||
|
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c | 3 +++
|
||
|
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 18 +++++++++++++++---
|
||
|
include/linux/mlx5/fs.h | 1 +
|
||
|
3 files changed, 19 insertions(+), 3 deletions(-)
|
||
|
|
||
|
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
|
||
|
index 3c816e81f8d9..b25465d9e030 100644
|
||
|
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
|
||
|
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
|
||
|
@@ -432,6 +432,9 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,
|
||
|
MLX5_SET(set_fte_in, in, table_type, ft->type);
|
||
|
MLX5_SET(set_fte_in, in, table_id, ft->id);
|
||
|
MLX5_SET(set_fte_in, in, flow_index, fte->index);
|
||
|
+ MLX5_SET(set_fte_in, in, ignore_flow_level,
|
||
|
+ !!(fte->action.flags & FLOW_ACT_IGNORE_FLOW_LEVEL));
|
||
|
+
|
||
|
if (ft->vport) {
|
||
|
MLX5_SET(set_fte_in, in, vport_number, ft->vport);
|
||
|
MLX5_SET(set_fte_in, in, other_vport, 1);
|
||
|
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
|
||
|
index 703799975f22..2f6c8890f25e 100644
|
||
|
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
|
||
|
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
|
||
|
@@ -1555,18 +1555,30 @@ static bool counter_is_valid(u32 action)
|
||
|
}
|
||
|
|
||
|
static bool dest_is_valid(struct mlx5_flow_destination *dest,
|
||
|
- u32 action,
|
||
|
+ struct mlx5_flow_act *flow_act,
|
||
|
struct mlx5_flow_table *ft)
|
||
|
{
|
||
|
+ bool ignore_level = flow_act->flags & FLOW_ACT_IGNORE_FLOW_LEVEL;
|
||
|
+ u32 action = flow_act->action;
|
||
|
+
|
||
|
if (dest && (dest->type == MLX5_FLOW_DESTINATION_TYPE_COUNTER))
|
||
|
return counter_is_valid(action);
|
||
|
|
||
|
if (!(action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST))
|
||
|
return true;
|
||
|
|
||
|
+ if (ignore_level) {
|
||
|
+ if (ft->type != FS_FT_FDB)
|
||
|
+ return false;
|
||
|
+
|
||
|
+ if (dest->type == MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE &&
|
||
|
+ dest->ft->type != FS_FT_FDB)
|
||
|
+ return false;
|
||
|
+ }
|
||
|
+
|
||
|
if (!dest || ((dest->type ==
|
||
|
MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE) &&
|
||
|
- (dest->ft->level <= ft->level)))
|
||
|
+ (dest->ft->level <= ft->level && !ignore_level)))
|
||
|
return false;
|
||
|
return true;
|
||
|
}
|
||
|
@@ -1797,7 +1809,7 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
|
||
|
return ERR_PTR(-EINVAL);
|
||
|
|
||
|
for (i = 0; i < dest_num; i++) {
|
||
|
- if (!dest_is_valid(&dest[i], flow_act->action, ft))
|
||
|
+ if (!dest_is_valid(&dest[i], flow_act, ft))
|
||
|
return ERR_PTR(-EINVAL);
|
||
|
}
|
||
|
nested_down_read_ref_node(&ft->node, FS_LOCK_GRANDPARENT);
|
||
|
diff --git a/include/linux/mlx5/fs.h b/include/linux/mlx5/fs.h
|
||
|
index 72bc6585f732..5649a8a70c2e 100644
|
||
|
--- a/include/linux/mlx5/fs.h
|
||
|
+++ b/include/linux/mlx5/fs.h
|
||
|
@@ -207,6 +207,7 @@ struct mlx5_fs_vlan {
|
||
|
|
||
|
enum {
|
||
|
FLOW_ACT_NO_APPEND = BIT(0),
|
||
|
+ FLOW_ACT_IGNORE_FLOW_LEVEL = BIT(1),
|
||
|
};
|
||
|
|
||
|
struct mlx5_flow_act {
|
||
|
--
|
||
|
2.13.6
|
||
|
|