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

Eli Britstein elibr at mellanox.com
Thu Jan 9 07:46:50 UTC 2020


Signed-off-by: Eli Britstein <elibr at mellanox.com>
---
 lib/netdev-offload-provider.h |  1 +
 lib/netdev-offload.c          | 12 ++++++++++++
 2 files changed, 13 insertions(+)

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



More information about the dev mailing list