net/mlx5: Add NIC TX domain namespace
authorHuy Nguyen <huyn@mellanox.com>
Wed, 8 Apr 2020 19:47:39 +0000 (14:47 -0500)
committerSaeed Mahameed <saeedm@nvidia.com>
Mon, 12 Oct 2020 22:37:44 +0000 (15:37 -0700)
Add new namespace that represents the NIC TX domain.

Signed-off-by: Huy Nguyen <huyn@mellanox.com>
Signed-off-by: Raed Salem <raeds@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en/fs.h
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
include/linux/mlx5/fs.h

index 6a97452..dc74470 100644 (file)
@@ -236,6 +236,7 @@ struct mlx5e_accel_fs_tcp;
 
 struct mlx5e_flow_steering {
        struct mlx5_flow_namespace      *ns;
+       struct mlx5_flow_namespace      *egress_ns;
 #ifdef CONFIG_MLX5_EN_RXNFC
        struct mlx5e_ethtool_steering   ethtool;
 #endif
index fee1697..babe340 100644 (file)
@@ -776,6 +776,9 @@ static int mlx5_cmd_modify_header_alloc(struct mlx5_flow_root_namespace *ns,
                table_type = FS_FT_NIC_RX;
                break;
        case MLX5_FLOW_NAMESPACE_EGRESS:
+#ifdef CONFIG_MLX5_IPSEC
+       case MLX5_FLOW_NAMESPACE_EGRESS_KERNEL:
+#endif
                max_actions = MLX5_CAP_FLOWTABLE_NIC_TX(dev, max_modify_header_actions);
                table_type = FS_FT_NIC_TX;
                break;
index 6141e9e..1609183 100644 (file)
 #define LAG_NUM_PRIOS 1
 #define LAG_MIN_LEVEL (OFFLOADS_MIN_LEVEL + 1)
 
+#define KERNEL_TX_IPSEC_NUM_PRIOS  1
+#define KERNEL_TX_IPSEC_NUM_LEVELS 1
+#define KERNEL_TX_MIN_LEVEL        (KERNEL_TX_IPSEC_NUM_LEVELS)
+
 struct node_caps {
        size_t  arr_sz;
        long    *caps;
@@ -180,13 +184,24 @@ static struct init_tree_node {
 
 static struct init_tree_node egress_root_fs = {
        .type = FS_TYPE_NAMESPACE,
+#ifdef CONFIG_MLX5_IPSEC
+       .ar_size = 2,
+#else
        .ar_size = 1,
+#endif
        .children = (struct init_tree_node[]) {
                ADD_PRIO(0, MLX5_BY_PASS_NUM_PRIOS, 0,
                         FS_CHAINING_CAPS_EGRESS,
                         ADD_NS(MLX5_FLOW_TABLE_MISS_ACTION_DEF,
                                ADD_MULTIPLE_PRIO(MLX5_BY_PASS_NUM_PRIOS,
                                                  BY_PASS_PRIO_NUM_LEVELS))),
+#ifdef CONFIG_MLX5_IPSEC
+               ADD_PRIO(0, KERNEL_TX_MIN_LEVEL, 0,
+                        FS_CHAINING_CAPS_EGRESS,
+                        ADD_NS(MLX5_FLOW_TABLE_MISS_ACTION_DEF,
+                               ADD_MULTIPLE_PRIO(KERNEL_TX_IPSEC_NUM_PRIOS,
+                                                 KERNEL_TX_IPSEC_NUM_LEVELS))),
+#endif
        }
 };
 
@@ -2165,8 +2180,10 @@ struct mlx5_flow_namespace *mlx5_get_flow_namespace(struct mlx5_core_dev *dev,
                break;
        }
 
-       if (type == MLX5_FLOW_NAMESPACE_EGRESS) {
+       if (type == MLX5_FLOW_NAMESPACE_EGRESS ||
+           type == MLX5_FLOW_NAMESPACE_EGRESS_KERNEL) {
                root_ns = steering->egress_root_ns;
+               prio = type - MLX5_FLOW_NAMESPACE_EGRESS;
        } else if (type == MLX5_FLOW_NAMESPACE_RDMA_RX) {
                root_ns = steering->rdma_rx_root_ns;
                prio = RDMA_RX_BYPASS_PRIO;
index 92d991d..846d94a 100644 (file)
@@ -76,6 +76,7 @@ enum mlx5_flow_namespace_type {
        MLX5_FLOW_NAMESPACE_SNIFFER_RX,
        MLX5_FLOW_NAMESPACE_SNIFFER_TX,
        MLX5_FLOW_NAMESPACE_EGRESS,
+       MLX5_FLOW_NAMESPACE_EGRESS_KERNEL,
        MLX5_FLOW_NAMESPACE_RDMA_RX,
        MLX5_FLOW_NAMESPACE_RDMA_RX_KERNEL,
        MLX5_FLOW_NAMESPACE_RDMA_TX,