diff mbox series

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

Message ID 1555490540-11087-1-git-send-email-ophirmu@mellanox.com
State Superseded
Headers show
Series [ovs-dev,v1] netdev-rte-offloads: Reserve mark space. | expand

Commit Message

Ophir Munk April 17, 2019, 8:42 a.m. UTC
From: Roni Bar Yanai <roniba@mellanox.com>

Reserve the first 64 intergers (0-63) for special processing.
For example, if a packet can't complete its procssesing 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>
---
 lib/dpif-netdev.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Gregory Rose April 17, 2019, 3:55 p.m. UTC | #1
On 4/17/2019 1:42 AM, Ophir Munk wrote:
> From: Roni Bar Yanai <roniba@mellanox.com>
>
> Reserve the first 64 intergers (0-63) for special processing.
> For example, if a packet can't complete its procssesing in hardware,
> we will make sure that the packet is marked with a special mark to
> continue its processing in software.
s/intergers/integers/

What size integers?

 From the patch it appears to be 32 bit integers but since integer size 
isn't fixed across CPU types it should
be called out I think.

- Greg

>
> 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>
> ---
>   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 9a48038..ea0ace7 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -2096,8 +2096,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;
> @@ -2123,7 +2126,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)) {
Ophir Munk April 22, 2019, 7:49 a.m. UTC | #2
Thanks Greg for your comment. I have sent v2 where the commit message is updated.
In v2 I use uint32_t terminology rather than integers.

Regards,
Ophir

> -----Original Message-----
> From: Gregory Rose <gvrose8192@gmail.com>
> Sent: Wednesday, April 17, 2019 6:56 PM
> To: Ophir Munk <ophirmu@mellanox.com>; ovs-dev@openvswitch.org
> Cc: Ilya Maximets <i.maximets@samsung.com>
> Subject: Re: [ovs-dev] [PATCH v1] netdev-rte-offloads: Reserve mark space.
> 
> 
> On 4/17/2019 1:42 AM, Ophir Munk wrote:
> > From: Roni Bar Yanai <roniba@mellanox.com>
> >
> > Reserve the first 64 intergers (0-63) for special processing.
> > For example, if a packet can't complete its procssesing in hardware,
> > we will make sure that the packet is marked with a special mark to
> > continue its processing in software.
> s/intergers/integers/
> 
> What size integers?
> 
>  From the patch it appears to be 32 bit integers but since integer size isn't
> fixed across CPU types it should be called out I think.
> 
> - Greg
diff mbox series

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 9a48038..ea0ace7 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -2096,8 +2096,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;
@@ -2123,7 +2126,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)) {