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

Message ID 20200109074655.1104-14-elibr@mellanox.com
State Accepted
Delegated to: Ilya Maximets
Headers show
Series
  • netdev datapath actions offload
Related show

Commit Message

Eli Britstein Jan. 9, 2020, 7:46 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(+)

Patch
diff mbox series

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