diff mbox series

[ovs-dev,v1,01/23] netdev: Add flow API de-init function

Message ID 4d3025b0ee9939dec137dc7fd28d0ea577180181.1612968146.git.grive@u256.net
State New
Headers show
Series dpif-netdev: Parallel offload processing | expand

Commit Message

Gaëtan Rivet Feb. 10, 2021, 2:57 p.m. UTC
Add a new operation for flow API providers to
deinitializes when the API is disassociated from a netdev.

Signed-off-by: Gaetan Rivet <grive@u256.net>
Reviewed-by: Eli Britstein <elibr@nvidia.com>
---
 lib/netdev-offload-provider.h | 3 +++
 lib/netdev-offload.c          | 4 ++++
 2 files changed, 7 insertions(+)

Comments

Maxime Coquelin March 3, 2021, 12:02 p.m. UTC | #1
Hi Gaetan,

On 2/10/21 3:57 PM, Gaetan Rivet wrote:
> Add a new operation for flow API providers to
> deinitializes when the API is disassociated from a netdev.
> 
> Signed-off-by: Gaetan Rivet <grive@u256.net>
> Reviewed-by: Eli Britstein <elibr@nvidia.com>
> ---
>  lib/netdev-offload-provider.h | 3 +++
>  lib/netdev-offload.c          | 4 ++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/lib/netdev-offload-provider.h b/lib/netdev-offload-provider.h
> index cf859d1b4..4815a1bd2 100644
> --- a/lib/netdev-offload-provider.h
> +++ b/lib/netdev-offload-provider.h
> @@ -90,6 +90,9 @@ struct netdev_flow_api {
>      /* Initializies the netdev flow api.
>       * Return 0 if successful, otherwise returns a positive errno value. */
>      int (*init_flow_api)(struct netdev *);
> +
> +    /* Deinitializes the netdev flow api. */
> +    void (*deinit_flow_api)(struct netdev *);
>  };
>  
>  int netdev_register_flow_api_provider(const struct netdev_flow_api *);
> diff --git a/lib/netdev-offload.c b/lib/netdev-offload.c
> index 6237667c3..3092f8d55 100644
> --- a/lib/netdev-offload.c
> +++ b/lib/netdev-offload.c
> @@ -320,6 +320,10 @@ netdev_uninit_flow_api(struct netdev *netdev)
>          return;
>      }
>  
> +    if (flow_api->deinit_flow_api) {
> +        flow_api->deinit_flow_api(netdev);

For consistency, couldn't it be changed to .uninit_flow_api()?

> +    }
> +
>      ovsrcu_set(&netdev->flow_api, NULL);
>      rfa = netdev_lookup_flow_api(flow_api->type);
>      ovs_refcount_unref(&rfa->refcnt);
> 

Maxime
Gaëtan Rivet March 3, 2021, 12:41 p.m. UTC | #2
On Wed, Mar 3, 2021, at 12:02, Maxime Coquelin wrote:
> Hi Gaetan,
> 
> On 2/10/21 3:57 PM, Gaetan Rivet wrote:
> > Add a new operation for flow API providers to
> > deinitializes when the API is disassociated from a netdev.
> > 
> > Signed-off-by: Gaetan Rivet <grive@u256.net>
> > Reviewed-by: Eli Britstein <elibr@nvidia.com>
> > ---
> >  lib/netdev-offload-provider.h | 3 +++
> >  lib/netdev-offload.c          | 4 ++++
> >  2 files changed, 7 insertions(+)
> > 
> > diff --git a/lib/netdev-offload-provider.h b/lib/netdev-offload-provider.h
> > index cf859d1b4..4815a1bd2 100644
> > --- a/lib/netdev-offload-provider.h
> > +++ b/lib/netdev-offload-provider.h
> > @@ -90,6 +90,9 @@ struct netdev_flow_api {
> >      /* Initializies the netdev flow api.
> >       * Return 0 if successful, otherwise returns a positive errno value. */
> >      int (*init_flow_api)(struct netdev *);
> > +
> > +    /* Deinitializes the netdev flow api. */
> > +    void (*deinit_flow_api)(struct netdev *);
> >  };
> >  
> >  int netdev_register_flow_api_provider(const struct netdev_flow_api *);
> > diff --git a/lib/netdev-offload.c b/lib/netdev-offload.c
> > index 6237667c3..3092f8d55 100644
> > --- a/lib/netdev-offload.c
> > +++ b/lib/netdev-offload.c
> > @@ -320,6 +320,10 @@ netdev_uninit_flow_api(struct netdev *netdev)
> >          return;
> >      }
> >  
> > +    if (flow_api->deinit_flow_api) {
> > +        flow_api->deinit_flow_api(netdev);
> 
> For consistency, couldn't it be changed to .uninit_flow_api()?
> 

Hey Maxime,

Actually yes, it should probably be uninit instead.
I don't remember where I got deinit from, I thought it was used elsewhere.
Grepping the code I don't see it. I will update this patch, thanks.

> > +    }
> > +
> >      ovsrcu_set(&netdev->flow_api, NULL);
> >      rfa = netdev_lookup_flow_api(flow_api->type);
> >      ovs_refcount_unref(&rfa->refcnt);
> > 
> 
> Maxime
> 
>
Maxime Coquelin March 3, 2021, 1:05 p.m. UTC | #3
On 3/3/21 1:41 PM, Gaëtan Rivet wrote:
> On Wed, Mar 3, 2021, at 12:02, Maxime Coquelin wrote:
>> Hi Gaetan,
>>
>> On 2/10/21 3:57 PM, Gaetan Rivet wrote:
>>> Add a new operation for flow API providers to
>>> deinitializes when the API is disassociated from a netdev.
>>>
>>> Signed-off-by: Gaetan Rivet <grive@u256.net>
>>> Reviewed-by: Eli Britstein <elibr@nvidia.com>
>>> ---
>>>  lib/netdev-offload-provider.h | 3 +++
>>>  lib/netdev-offload.c          | 4 ++++
>>>  2 files changed, 7 insertions(+)
>>>
>>> diff --git a/lib/netdev-offload-provider.h b/lib/netdev-offload-provider.h
>>> index cf859d1b4..4815a1bd2 100644
>>> --- a/lib/netdev-offload-provider.h
>>> +++ b/lib/netdev-offload-provider.h
>>> @@ -90,6 +90,9 @@ struct netdev_flow_api {
>>>      /* Initializies the netdev flow api.
>>>       * Return 0 if successful, otherwise returns a positive errno value. */
>>>      int (*init_flow_api)(struct netdev *);
>>> +
>>> +    /* Deinitializes the netdev flow api. */
>>> +    void (*deinit_flow_api)(struct netdev *);
>>>  };
>>>  
>>>  int netdev_register_flow_api_provider(const struct netdev_flow_api *);
>>> diff --git a/lib/netdev-offload.c b/lib/netdev-offload.c
>>> index 6237667c3..3092f8d55 100644
>>> --- a/lib/netdev-offload.c
>>> +++ b/lib/netdev-offload.c
>>> @@ -320,6 +320,10 @@ netdev_uninit_flow_api(struct netdev *netdev)
>>>          return;
>>>      }
>>>  
>>> +    if (flow_api->deinit_flow_api) {
>>> +        flow_api->deinit_flow_api(netdev);
>>
>> For consistency, couldn't it be changed to .uninit_flow_api()?
>>
> 
> Hey Maxime,
> 
> Actually yes, it should probably be uninit instead.
> I don't remember where I got deinit from, I thought it was used elsewhere.
> Grepping the code I don't see it. I will update this patch, thanks.

Ok, thanks.
I'm going through your series this week, so no hurry in posting v2 :)

Maxime

>>> +    }
>>> +
>>>      ovsrcu_set(&netdev->flow_api, NULL);
>>>      rfa = netdev_lookup_flow_api(flow_api->type);
>>>      ovs_refcount_unref(&rfa->refcnt);
>>>
>>
>> Maxime
>>
>>
>
diff mbox series

Patch

diff --git a/lib/netdev-offload-provider.h b/lib/netdev-offload-provider.h
index cf859d1b4..4815a1bd2 100644
--- a/lib/netdev-offload-provider.h
+++ b/lib/netdev-offload-provider.h
@@ -90,6 +90,9 @@  struct netdev_flow_api {
     /* Initializies the netdev flow api.
      * Return 0 if successful, otherwise returns a positive errno value. */
     int (*init_flow_api)(struct netdev *);
+
+    /* Deinitializes the netdev flow api. */
+    void (*deinit_flow_api)(struct netdev *);
 };
 
 int netdev_register_flow_api_provider(const struct netdev_flow_api *);
diff --git a/lib/netdev-offload.c b/lib/netdev-offload.c
index 6237667c3..3092f8d55 100644
--- a/lib/netdev-offload.c
+++ b/lib/netdev-offload.c
@@ -320,6 +320,10 @@  netdev_uninit_flow_api(struct netdev *netdev)
         return;
     }
 
+    if (flow_api->deinit_flow_api) {
+        flow_api->deinit_flow_api(netdev);
+    }
+
     ovsrcu_set(&netdev->flow_api, NULL);
     rfa = netdev_lookup_flow_api(flow_api->type);
     ovs_refcount_unref(&rfa->refcnt);