diff mbox series

[ovs-dev,V6,13/18] netdev-offload: Introduce a function to validate same flow api handle

Message ID 20191219115436.10354-14-elibr@mellanox.com
State Changes Requested
Delegated to: Ilya Maximets
Headers show
Series netdev datapath actions offload | expand

Commit Message

Eli Britstein Dec. 19, 2019, 11:54 a.m. UTC
Signed-off-by: Eli Britstein <elibr@mellanox.com>
---
 lib/netdev-offload-provider.h |  1 +
 lib/netdev-offload.c          | 12 ++++++++++++
 2 files changed, 13 insertions(+)
diff mbox series

Patch

diff --git a/lib/netdev-offload-provider.h b/lib/netdev-offload-provider.h
index 4e1c4251d..5a809c0cd 100644
--- a/lib/netdev-offload-provider.h
+++ b/lib/netdev-offload-provider.h
@@ -89,6 +89,7 @@  struct netdev_flow_api {
 
 int netdev_register_flow_api_provider(const struct netdev_flow_api *);
 int netdev_unregister_flow_api_provider(const char *type);
+bool netdev_flow_api_equals(const struct netdev *, const struct netdev *);
 
 #ifdef __linux__
 extern const struct netdev_flow_api netdev_offload_tc;
diff --git a/lib/netdev-offload.c b/lib/netdev-offload.c
index ae01acda6..32eab5910 100644
--- a/lib/netdev-offload.c
+++ b/lib/netdev-offload.c
@@ -156,6 +156,18 @@  netdev_unregister_flow_api_provider(const char *type)
     return error;
 }
 
+bool
+netdev_flow_api_equals(const struct netdev *netdev1,
+                       const struct netdev *netdev2)
+{
+    const struct netdev_flow_api *netdev_flow_api1 =
+        ovsrcu_get(const struct netdev_flow_api *, &netdev1->flow_api);
+    const struct netdev_flow_api *netdev_flow_api2 =
+        ovsrcu_get(const struct netdev_flow_api *, &netdev2->flow_api);
+
+    return netdev_flow_api1 == netdev_flow_api2;
+}
+
 static int
 netdev_assign_flow_api(struct netdev *netdev)
 {