The branch main has been updated by hselasky:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=0ee1b09eaa99ed96885fd024a32baf182411a35a

commit 0ee1b09eaa99ed96885fd024a32baf182411a35a
Author:     Hans Petter Selasky <[email protected]>
AuthorDate: 2022-02-01 15:20:13 +0000
Commit:     Hans Petter Selasky <[email protected]>
CommitDate: 2022-02-01 15:21:16 +0000

    mlx5: Implement offloads flowtable namespace.
    
    This namespace will be used for TCP offloads, like hardware decryption
    of TLS TCP data.
    
    MFC after:      1 week
    Sponsored by:   NVIDIA Networking
---
 sys/dev/mlx5/fs.h                     |  1 +
 sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c | 35 ++++++++++++++++++++++++-----------
 2 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/sys/dev/mlx5/fs.h b/sys/dev/mlx5/fs.h
index fc7a6f429fd0..e5ec897fd9f1 100644
--- a/sys/dev/mlx5/fs.h
+++ b/sys/dev/mlx5/fs.h
@@ -54,6 +54,7 @@ enum {
 
 enum mlx5_flow_namespace_type {
        MLX5_FLOW_NAMESPACE_BYPASS,
+       MLX5_FLOW_NAMESPACE_OFFLOADS,
        MLX5_FLOW_NAMESPACE_KERNEL,
        MLX5_FLOW_NAMESPACE_LEFTOVERS,
        MLX5_FLOW_NAMESPACE_SNIFFER_RX,
diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c 
b/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c
index 860c2331f03a..5305991689ca 100644
--- a/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c
+++ b/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2013-2017, Mellanox Technologies, Ltd.  All rights reserved.
+ * Copyright (c) 2013-2021, Mellanox Technologies, Ltd.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -67,13 +67,19 @@
 #define FS_REQUIRED_CAPS(...) {.arr_sz = INIT_CAPS_ARRAY_SIZE(__VA_ARGS__), \
                               .caps = (long[]) {__VA_ARGS__}}
 
-#define BYPASS_MAX_FT 5
-#define BYPASS_PRIO_MAX_FT 1
-#define KERNEL_MAX_FT 5
-#define LEFTOVER_MAX_FT 1
-#define KERNEL_MIN_LEVEL 3
-#define LEFTOVER_MIN_LEVEL KERNEL_MIN_LEVEL + 1
-#define BYPASS_MIN_LEVEL MLX5_NUM_BYPASS_FTS + LEFTOVER_MIN_LEVEL
+/* Flowtable sizes: */
+#define        BYPASS_MAX_FT 5
+#define        BYPASS_PRIO_MAX_FT 1
+#define        OFFLOADS_MAX_FT 2
+#define        KERNEL_MAX_FT 5
+#define        LEFTOVER_MAX_FT 1
+
+/* Flowtable levels: */
+#define        OFFLOADS_MIN_LEVEL 3
+#define        KERNEL_MIN_LEVEL (OFFLOADS_MIN_LEVEL + 1)
+#define        LEFTOVER_MIN_LEVEL (KERNEL_MIN_LEVEL + 1)
+#define        BYPASS_MIN_LEVEL (MLX5_NUM_BYPASS_FTS + LEFTOVER_MIN_LEVEL)
+
 struct node_caps {
        size_t  arr_sz;
        long    *caps;
@@ -92,7 +98,7 @@ struct init_tree_node {
 } root_fs = {
        .type = FS_TYPE_NAMESPACE,
        .name = "root",
-       .ar_size = 3,
+       .ar_size = 4,
        .children = (struct init_tree_node[]) {
                ADD_PRIO("by_pass_prio", 0, BYPASS_MIN_LEVEL, 0,
                         
FS_REQUIRED_CAPS(FS_CAP(flow_table_properties_nic_receive.flow_modify_en),
@@ -116,6 +122,10 @@ struct init_tree_node {
                                            BYPASS_PRIO_MAX_FT),
                                ADD_FT_PRIO("prio-mcast", 0,
                                            BYPASS_PRIO_MAX_FT))),
+               ADD_PRIO("offloads_prio", 0, OFFLOADS_MIN_LEVEL, 0, {},
+                        ADD_NS("offloads_ns",
+                               ADD_FT_PRIO("prio_offloads-0", 0,
+                                           OFFLOADS_MAX_FT))),
                ADD_PRIO("kernel_prio", 0, KERNEL_MIN_LEVEL, 0, {},
                         ADD_NS("kernel_ns",
                                ADD_FT_PRIO("prio_kernel-0", 0,
@@ -2375,12 +2385,15 @@ struct mlx5_flow_namespace 
*mlx5_get_flow_namespace(struct mlx5_core_dev *dev,
        case MLX5_FLOW_NAMESPACE_BYPASS:
                prio = 0;
                break;
-       case MLX5_FLOW_NAMESPACE_KERNEL:
+       case MLX5_FLOW_NAMESPACE_OFFLOADS:
                prio = 1;
                break;
-       case MLX5_FLOW_NAMESPACE_LEFTOVERS:
+       case MLX5_FLOW_NAMESPACE_KERNEL:
                prio = 2;
                break;
+       case MLX5_FLOW_NAMESPACE_LEFTOVERS:
+               prio = 3;
+               break;
        case MLX5_FLOW_NAMESPACE_FDB:
                if (dev->fdb_root_ns)
                        return &dev->fdb_root_ns->ns;

Reply via email to