diff mbox series

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

Message ID 1555919083-13430-1-git-send-email-ophirmu@mellanox.com
State Rejected
Headers show
Series [ovs-dev,v2] netdev-rte-offloads: Reserve mark space. | expand

Commit Message

Ophir Munk April 22, 2019, 7:45 a.m. UTC
From: Roni Bar Yanai <roniba@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@mellanox.com>
Signed-off-by: Asaf Penso <asafp@mellanox.com>
Co-authored-by: Ophir Munk <ophirmu@mellanox.com>
Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Signed-off-by: Roni Bar Yanai <roniba@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(-)

Comments

Ilya Maximets April 22, 2019, 8:14 a.m. UTC | #1
On 22.04.2019 10:45, Ophir Munk wrote:
> From: Roni Bar Yanai <roniba@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.

This patch reserves some ids without actually using them. It's hard to
review if the future usage is unknown. Maybe it'll be better to send
this patch along with the patches that will use those ids?

Best regards, Ilya Maximets.
diff mbox series

Patch

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)) {