[ovs-dev] [PATCH v2] netdev-rte-offloads: Reserve mark space.

Ophir Munk ophirmu at mellanox.com
Mon Apr 22 07:45:04 UTC 2019


From: Roni Bar Yanai <roniba at mellanox.com>

Reserve the first 64 uint32_t marks numbers (0-63) for special
processing. For example, if a packet can't complete its processing in
hardware, we will make sure that the packet is marked with a special
mark to continue its processing in software.

Co-authored-by: Asaf Penso <asafp at mellanox.com>
Signed-off-by: Asaf Penso <asafp at mellanox.com>
Co-authored-by: Ophir Munk <ophirmu at mellanox.com>
Signed-off-by: Ophir Munk <ophirmu at mellanox.com>
Signed-off-by: Roni Bar Yanai <roniba at mellanox.com>
---
v1:
Initial version
v2:
Update commit message: replace "integers" with uint32_t notation.

 lib/dpif-netdev.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index ba88d97..813ce0d 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -2098,8 +2098,11 @@ dp_netdev_pmd_find_dpcls(struct dp_netdev_pmd_thread *pmd,
     return cls;
 }
 
-#define MAX_FLOW_MARK       (UINT32_MAX - 1)
-#define INVALID_FLOW_MARK   (UINT32_MAX)
+#define INVALID_FLOW_MARK        (UINT32_MAX)
+#define MAX_FLOW_MARK            (UINT32_MAX - 1)
+#define RESERVED_FLOW_MARK_SIZE  (64)
+#define MIN_FLOW_MARK            RESERVED_FLOW_MARK_SIZE
+#define AVAILABLE_FLOW_MARK_SIZE (MAX_FLOW_MARK - MIN_FLOW_MARK + 1)
 
 struct megaflow_to_mark_data {
     const struct cmap_node node;
@@ -2125,7 +2128,8 @@ flow_mark_alloc(void)
 
     if (!flow_mark.pool) {
         /* Haven't initiated yet, do it here */
-        flow_mark.pool = id_pool_create(0, MAX_FLOW_MARK);
+        flow_mark.pool = id_pool_create(MIN_FLOW_MARK,
+                                        AVAILABLE_FLOW_MARK_SIZE);
     }
 
     if (id_pool_alloc_id(flow_mark.pool, &mark)) {
-- 
1.8.3.1



More information about the dev mailing list