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.
250 lines
9.4 KiB
250 lines
9.4 KiB
From a051b0b47d1666c94db81514fc8a5798ba552851 Mon Sep 17 00:00:00 2001
|
|
From: Alaa Hleihel <ahleihel@redhat.com>
|
|
Date: Sun, 10 May 2020 14:52:00 -0400
|
|
Subject: [PATCH 036/312] [netdrv] net/mlx5: Add per-namespace flow table
|
|
default miss action support
|
|
|
|
Message-id: <20200510145245.10054-38-ahleihel@redhat.com>
|
|
Patchwork-id: 306577
|
|
Patchwork-instance: patchwork
|
|
O-Subject: [RHEL8.3 BZ 1789378 v2 37/82] net/mlx5: Add per-namespace flow table default miss action support
|
|
Bugzilla: 1789378
|
|
RH-Acked-by: Kamal Heib <kheib@redhat.com>
|
|
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
|
|
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
|
|
RH-Acked-by: Jonathan Toppins <jtoppins@redhat.com>
|
|
|
|
Bugzilla: http://bugzilla.redhat.com/1789378
|
|
Upstream: v5.4-rc1
|
|
Conflicts:
|
|
- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
|
|
Context diff due to already backported commit:
|
|
20f7b37ffc7d ("net/mlx5e: Introduce root ft concept for representors netdevs")
|
|
---> We have FS_CHAINING_CAPS instead of empty element.
|
|
|
|
commit f66ad830b11406cdff84e7d8656a0a9e34b0b606
|
|
Author: Mark Zhang <markz@mellanox.com>
|
|
Date: Mon Aug 19 14:36:24 2019 +0300
|
|
|
|
net/mlx5: Add per-namespace flow table default miss action support
|
|
|
|
Currently all the namespaces under the same steering domain share the same
|
|
default table miss action, however in some situations (e.g., RDMA RX)
|
|
different actions are required. This patch adds a per-namespace default
|
|
table miss action instead of using the miss action of the steering domain.
|
|
|
|
Signed-off-by: Mark Zhang <markz@mellanox.com>
|
|
Reviewed-by: Mark Bloch <markb@mellanox.com>
|
|
Signed-off-by: Leon Romanovsky <leonro@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 | 4 +-
|
|
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 73 +++++++++++++----------
|
|
drivers/net/ethernet/mellanox/mlx5/core/fs_core.h | 8 +++
|
|
3 files changed, 53 insertions(+), 32 deletions(-)
|
|
|
|
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
|
|
index a848272a60a1..3c816e81f8d9 100644
|
|
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
|
|
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
|
|
@@ -226,7 +226,7 @@ static int mlx5_cmd_create_flow_table(struct mlx5_flow_root_namespace *ns,
|
|
} else {
|
|
MLX5_SET(create_flow_table_in, in,
|
|
flow_table_context.table_miss_action,
|
|
- ns->def_miss_action);
|
|
+ ft->def_miss_action);
|
|
}
|
|
break;
|
|
|
|
@@ -306,7 +306,7 @@ static int mlx5_cmd_modify_flow_table(struct mlx5_flow_root_namespace *ns,
|
|
} else {
|
|
MLX5_SET(modify_flow_table_in, in,
|
|
flow_table_context.table_miss_action,
|
|
- ns->def_miss_action);
|
|
+ ft->def_miss_action);
|
|
}
|
|
}
|
|
|
|
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
|
|
index 26d0333080e4..5ebd74d078f2 100644
|
|
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
|
|
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
|
|
@@ -60,7 +60,8 @@
|
|
ADD_PRIO(num_prios_val, 0, num_levels_val, {},\
|
|
__VA_ARGS__)\
|
|
|
|
-#define ADD_NS(...) {.type = FS_TYPE_NAMESPACE,\
|
|
+#define ADD_NS(def_miss_act, ...) {.type = FS_TYPE_NAMESPACE, \
|
|
+ .def_miss_action = def_miss_act,\
|
|
.children = (struct init_tree_node[]) {__VA_ARGS__},\
|
|
.ar_size = INIT_TREE_NODE_ARRAY_SIZE(__VA_ARGS__) \
|
|
}
|
|
@@ -131,33 +132,41 @@ static struct init_tree_node {
|
|
int num_leaf_prios;
|
|
int prio;
|
|
int num_levels;
|
|
+ enum mlx5_flow_table_miss_action def_miss_action;
|
|
} root_fs = {
|
|
.type = FS_TYPE_NAMESPACE,
|
|
.ar_size = 7,
|
|
- .children = (struct init_tree_node[]) {
|
|
- ADD_PRIO(0, BY_PASS_MIN_LEVEL, 0,
|
|
- FS_CHAINING_CAPS,
|
|
- ADD_NS(ADD_MULTIPLE_PRIO(MLX5_BY_PASS_NUM_PRIOS,
|
|
- BY_PASS_PRIO_NUM_LEVELS))),
|
|
- ADD_PRIO(0, LAG_MIN_LEVEL, 0,
|
|
- FS_CHAINING_CAPS,
|
|
- ADD_NS(ADD_MULTIPLE_PRIO(LAG_NUM_PRIOS,
|
|
- LAG_PRIO_NUM_LEVELS))),
|
|
- ADD_PRIO(0, OFFLOADS_MIN_LEVEL, 0, FS_CHAINING_CAPS,
|
|
- ADD_NS(ADD_MULTIPLE_PRIO(OFFLOADS_NUM_PRIOS, OFFLOADS_MAX_FT))),
|
|
- ADD_PRIO(0, ETHTOOL_MIN_LEVEL, 0,
|
|
- FS_CHAINING_CAPS,
|
|
- ADD_NS(ADD_MULTIPLE_PRIO(ETHTOOL_NUM_PRIOS,
|
|
- ETHTOOL_PRIO_NUM_LEVELS))),
|
|
- ADD_PRIO(0, KERNEL_MIN_LEVEL, 0, {},
|
|
- ADD_NS(ADD_MULTIPLE_PRIO(KERNEL_NIC_TC_NUM_PRIOS, KERNEL_NIC_TC_NUM_LEVELS),
|
|
- ADD_MULTIPLE_PRIO(KERNEL_NIC_NUM_PRIOS,
|
|
- KERNEL_NIC_PRIO_NUM_LEVELS))),
|
|
- ADD_PRIO(0, BY_PASS_MIN_LEVEL, 0,
|
|
- FS_CHAINING_CAPS,
|
|
- ADD_NS(ADD_MULTIPLE_PRIO(LEFTOVERS_NUM_PRIOS, LEFTOVERS_NUM_LEVELS))),
|
|
- ADD_PRIO(0, ANCHOR_MIN_LEVEL, 0, {},
|
|
- ADD_NS(ADD_MULTIPLE_PRIO(ANCHOR_NUM_PRIOS, ANCHOR_NUM_LEVELS))),
|
|
+ .children = (struct init_tree_node[]){
|
|
+ ADD_PRIO(0, BY_PASS_MIN_LEVEL, 0, FS_CHAINING_CAPS,
|
|
+ ADD_NS(MLX5_FLOW_TABLE_MISS_ACTION_DEF,
|
|
+ ADD_MULTIPLE_PRIO(MLX5_BY_PASS_NUM_PRIOS,
|
|
+ BY_PASS_PRIO_NUM_LEVELS))),
|
|
+ ADD_PRIO(0, LAG_MIN_LEVEL, 0, FS_CHAINING_CAPS,
|
|
+ ADD_NS(MLX5_FLOW_TABLE_MISS_ACTION_DEF,
|
|
+ ADD_MULTIPLE_PRIO(LAG_NUM_PRIOS,
|
|
+ LAG_PRIO_NUM_LEVELS))),
|
|
+ ADD_PRIO(0, OFFLOADS_MIN_LEVEL, 0, FS_CHAINING_CAPS,
|
|
+ ADD_NS(MLX5_FLOW_TABLE_MISS_ACTION_DEF,
|
|
+ ADD_MULTIPLE_PRIO(OFFLOADS_NUM_PRIOS,
|
|
+ OFFLOADS_MAX_FT))),
|
|
+ ADD_PRIO(0, ETHTOOL_MIN_LEVEL, 0, FS_CHAINING_CAPS,
|
|
+ ADD_NS(MLX5_FLOW_TABLE_MISS_ACTION_DEF,
|
|
+ ADD_MULTIPLE_PRIO(ETHTOOL_NUM_PRIOS,
|
|
+ ETHTOOL_PRIO_NUM_LEVELS))),
|
|
+ ADD_PRIO(0, KERNEL_MIN_LEVEL, 0, {},
|
|
+ ADD_NS(MLX5_FLOW_TABLE_MISS_ACTION_DEF,
|
|
+ ADD_MULTIPLE_PRIO(KERNEL_NIC_TC_NUM_PRIOS,
|
|
+ KERNEL_NIC_TC_NUM_LEVELS),
|
|
+ ADD_MULTIPLE_PRIO(KERNEL_NIC_NUM_PRIOS,
|
|
+ KERNEL_NIC_PRIO_NUM_LEVELS))),
|
|
+ ADD_PRIO(0, BY_PASS_MIN_LEVEL, 0, FS_CHAINING_CAPS,
|
|
+ ADD_NS(MLX5_FLOW_TABLE_MISS_ACTION_DEF,
|
|
+ ADD_MULTIPLE_PRIO(LEFTOVERS_NUM_PRIOS,
|
|
+ LEFTOVERS_NUM_LEVELS))),
|
|
+ ADD_PRIO(0, ANCHOR_MIN_LEVEL, 0, {},
|
|
+ ADD_NS(MLX5_FLOW_TABLE_MISS_ACTION_DEF,
|
|
+ ADD_MULTIPLE_PRIO(ANCHOR_NUM_PRIOS,
|
|
+ ANCHOR_NUM_LEVELS))),
|
|
}
|
|
};
|
|
|
|
@@ -167,7 +176,8 @@ static struct init_tree_node egress_root_fs = {
|
|
.children = (struct init_tree_node[]) {
|
|
ADD_PRIO(0, MLX5_BY_PASS_NUM_PRIOS, 0,
|
|
FS_CHAINING_CAPS_EGRESS,
|
|
- ADD_NS(ADD_MULTIPLE_PRIO(MLX5_BY_PASS_NUM_PRIOS,
|
|
+ ADD_NS(MLX5_FLOW_TABLE_MISS_ACTION_DEF,
|
|
+ ADD_MULTIPLE_PRIO(MLX5_BY_PASS_NUM_PRIOS,
|
|
BY_PASS_PRIO_NUM_LEVELS))),
|
|
}
|
|
};
|
|
@@ -1014,6 +1024,7 @@ static struct mlx5_flow_table *__mlx5_create_flow_table(struct mlx5_flow_namespa
|
|
tree_init_node(&ft->node, del_hw_flow_table, del_sw_flow_table);
|
|
log_table_sz = ft->max_fte ? ilog2(ft->max_fte) : 0;
|
|
next_ft = find_next_chained_ft(fs_prio);
|
|
+ ft->def_miss_action = ns->def_miss_action;
|
|
err = root->cmds->create_flow_table(root, ft, log_table_sz, next_ft);
|
|
if (err)
|
|
goto free_ft;
|
|
@@ -2159,7 +2170,8 @@ static struct mlx5_flow_namespace *fs_init_namespace(struct mlx5_flow_namespace
|
|
return ns;
|
|
}
|
|
|
|
-static struct mlx5_flow_namespace *fs_create_namespace(struct fs_prio *prio)
|
|
+static struct mlx5_flow_namespace *fs_create_namespace(struct fs_prio *prio,
|
|
+ int def_miss_act)
|
|
{
|
|
struct mlx5_flow_namespace *ns;
|
|
|
|
@@ -2168,6 +2180,7 @@ static struct mlx5_flow_namespace *fs_create_namespace(struct fs_prio *prio)
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
fs_init_namespace(ns);
|
|
+ ns->def_miss_action = def_miss_act;
|
|
tree_init_node(&ns->node, NULL, del_sw_ns);
|
|
tree_add_node(&ns->node, &prio->node);
|
|
list_add_tail(&ns->node.list, &prio->node.children);
|
|
@@ -2234,7 +2247,7 @@ static int init_root_tree_recursive(struct mlx5_flow_steering *steering,
|
|
base = &fs_prio->node;
|
|
} else if (init_node->type == FS_TYPE_NAMESPACE) {
|
|
fs_get_obj(fs_prio, fs_parent_node);
|
|
- fs_ns = fs_create_namespace(fs_prio);
|
|
+ fs_ns = fs_create_namespace(fs_prio, init_node->def_miss_action);
|
|
if (IS_ERR(fs_ns))
|
|
return PTR_ERR(fs_ns);
|
|
base = &fs_ns->node;
|
|
@@ -2504,7 +2517,7 @@ static int init_rdma_rx_root_ns(struct mlx5_flow_steering *steering)
|
|
if (!steering->rdma_rx_root_ns)
|
|
return -ENOMEM;
|
|
|
|
- steering->rdma_rx_root_ns->def_miss_action =
|
|
+ steering->rdma_rx_root_ns->ns.def_miss_action =
|
|
MLX5_FLOW_TABLE_MISS_ACTION_SWITCH_DOMAIN;
|
|
|
|
/* Create single prio */
|
|
@@ -2547,7 +2560,7 @@ static int init_fdb_root_ns(struct mlx5_flow_steering *steering)
|
|
}
|
|
|
|
for (chain = 0; chain <= FDB_MAX_CHAIN; chain++) {
|
|
- ns = fs_create_namespace(maj_prio);
|
|
+ ns = fs_create_namespace(maj_prio, MLX5_FLOW_TABLE_MISS_ACTION_DEF);
|
|
if (IS_ERR(ns)) {
|
|
err = PTR_ERR(ns);
|
|
goto out_err;
|
|
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
|
|
index 51e1bdb49ff8..c6221ccbdddf 100644
|
|
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
|
|
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
|
|
@@ -171,6 +171,9 @@ struct mlx5_flow_table {
|
|
struct list_head fwd_rules;
|
|
u32 flags;
|
|
struct rhltable fgs_hash;
|
|
+#ifndef __GENKSYMS__
|
|
+ enum mlx5_flow_table_miss_action def_miss_action;
|
|
+#endif
|
|
};
|
|
|
|
struct mlx5_ft_underlay_qp {
|
|
@@ -218,6 +221,9 @@ struct fs_prio {
|
|
struct mlx5_flow_namespace {
|
|
/* parent == NULL => root ns */
|
|
struct fs_node node;
|
|
+#ifndef __GENKSYMS__
|
|
+ enum mlx5_flow_table_miss_action def_miss_action;
|
|
+#endif
|
|
};
|
|
|
|
struct mlx5_flow_group_mask {
|
|
@@ -249,7 +255,9 @@ struct mlx5_flow_root_namespace {
|
|
struct mutex chain_lock;
|
|
struct list_head underlay_qpns;
|
|
const struct mlx5_flow_cmds *cmds;
|
|
+#ifdef __GENKSYMS__
|
|
enum mlx5_flow_table_miss_action def_miss_action;
|
|
+#endif
|
|
};
|
|
|
|
int mlx5_init_fc_stats(struct mlx5_core_dev *dev);
|
|
--
|
|
2.13.6
|
|
|