[ovs-dev] [RFC PATCH 3/5] netdev-offload: Register xdp flow api provider

Toshiaki Makita toshiaki.makita1 at gmail.com
Tue Mar 10 15:29:09 UTC 2020


*** THIS PATCH IS NOT INTENDED TO BE APPLIED ***

Temporarily comment out TC flow api provider for testing and register
xdp offload provider.

FIXME: Need a way to specify flow api provider from configuration.

Signed-off-by: Toshiaki Makita <toshiaki.makita1 at gmail.com>
---
 lib/netdev-afxdp.c            | 3 ++-
 lib/netdev-offload-provider.h | 3 +++
 lib/netdev.c                  | 4 +++-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/netdev-afxdp.c b/lib/netdev-afxdp.c
index 9004839b9..aa2b0c32c 100644
--- a/lib/netdev-afxdp.c
+++ b/lib/netdev-afxdp.c
@@ -42,6 +42,7 @@
 #include "dp-packet.h"
 #include "dpif-netdev.h"
 #include "fatal-signal.h"
+#include "netdev-offload-provider.h"
 #include "netdev-offload-xdp.h"
 #include "openvswitch/compiler.h"
 #include "openvswitch/dynamic-string.h"
@@ -1482,7 +1483,7 @@ libbpf_print(enum libbpf_print_level level,
 int netdev_afxdp_init(void)
 {
     libbpf_set_print(libbpf_print);
-    return 0;
+    return netdev_register_flow_api_provider(&netdev_offload_xdp);
 }
 
 int
diff --git a/lib/netdev-offload-provider.h b/lib/netdev-offload-provider.h
index 5a809c0cd..1e07f9bf1 100644
--- a/lib/netdev-offload-provider.h
+++ b/lib/netdev-offload-provider.h
@@ -93,6 +93,9 @@ bool netdev_flow_api_equals(const struct netdev *, const struct netdev *);
 
 #ifdef __linux__
 extern const struct netdev_flow_api netdev_offload_tc;
+#ifdef HAVE_AF_XDP
+extern const struct netdev_flow_api netdev_offload_xdp;
+#endif
 #endif
 
 #ifdef DPDK_NETDEV
diff --git a/lib/netdev.c b/lib/netdev.c
index 8c44eee8e..83250fc88 100644
--- a/lib/netdev.c
+++ b/lib/netdev.c
@@ -151,7 +151,9 @@ netdev_initialize(void)
         netdev_register_provider(&netdev_tap_class);
         netdev_vport_tunnel_register();
 
-        netdev_register_flow_api_provider(&netdev_offload_tc);
+        /* FIXME: Temporary comment out for testing */
+        /* Need a way to specify flow api provider by configuration */
+        // netdev_register_flow_api_provider(&netdev_offload_tc);
 #ifdef HAVE_AF_XDP
         netdev_register_provider(&netdev_afxdp_class);
 #endif
-- 
2.24.1



More information about the dev mailing list