diff mbox series

[ovs-dev,v4,04/27] netdev: Add flow API uninit function

Message ID d89b73c36dbe4e17fb1e5bc97ffb0d60d1450329.1623234822.git.grive@u256.net
State New
Headers show
Series [ovs-dev,v4,01/27] ovs-thread: Fix barrier use-after-free | expand

Commit Message

Gaetan Rivet June 9, 2021, 1:09 p.m. UTC
Add a new operation for flow API providers to
uninitialize when the API is disassociated from a netdev.

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

Patch

diff --git a/lib/netdev-offload-provider.h b/lib/netdev-offload-provider.h
index cf859d1b4..2127599d3 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 *);
+
+    /* Uninitializes the netdev flow api. */
+    void (*uninit_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..deefefd63 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->uninit_flow_api) {
+        flow_api->uninit_flow_api(netdev);
+    }
+
     ovsrcu_set(&netdev->flow_api, NULL);
     rfa = netdev_lookup_flow_api(flow_api->type);
     ovs_refcount_unref(&rfa->refcnt);