diff mbox series

[ovs-dev,12/62] netdev-offload: work around for vhostuserclient type flow_api

Message ID 20201228092520.11807-13-taoyunxiang@cmss.chinamobile.com
State Not Applicable
Headers show
Series DPDK Offload API to test | expand

Commit Message

Tao YunXiang Dec. 28, 2020, 9:24 a.m. UTC
From: Liuchang <liuchang@cmss.chinamobile.com>

Code Source From: Self Code
Description:

    For vhu type, no intel dpdk driver cannot support coresponding
offload api, so for debug reason, we add work around code for vhost
user type

Jira:  #[Optional]
市场项目编号(名称):[Optional]
---
 lib/netdev-offload-dpdk.c     |  2 +-
 lib/netdev-offload-provider.h |  5 +++++
 lib/netdev-offload.c          | 15 +++++++++++----
 3 files changed, 17 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c
index 23527bd..befc1d6 100644
--- a/lib/netdev-offload-dpdk.c
+++ b/lib/netdev-offload-dpdk.c
@@ -1368,7 +1368,7 @@  netdev_offload_dpdk_destroy_flow(struct netdev *netdev,
     return ret;
 }
 
-static int
+int
 netdev_offload_dpdk_flow_put(struct netdev *netdev, struct match *match,
                              struct nlattr *actions, size_t actions_len,
                              const ovs_u128 *ufid, struct offload_info *info,
diff --git a/lib/netdev-offload-provider.h b/lib/netdev-offload-provider.h
index 5a809c0..0c1a370 100644
--- a/lib/netdev-offload-provider.h
+++ b/lib/netdev-offload-provider.h
@@ -28,6 +28,11 @@ 
 extern "C" {
 #endif
 
+extern int
+netdev_offload_dpdk_flow_put(struct netdev *netdev, struct match *match,
+                             struct nlattr *actions, size_t actions_len,
+                             const ovs_u128 *ufid, struct offload_info *info,
+                             struct dpif_flow_stats *stats);
 struct netdev_flow_api {
     char *type;
     /* Flush all offloaded flows from a netdev.
diff --git a/lib/netdev-offload.c b/lib/netdev-offload.c
index 1612fe6..a32b3fc 100644
--- a/lib/netdev-offload.c
+++ b/lib/netdev-offload.c
@@ -237,6 +237,7 @@  netdev_flow_dump_next(struct netdev_flow_dump *dump, struct match *match,
            : false;
 }
 
+
 int
 netdev_flow_put(struct netdev *netdev, struct match *match,
                 struct nlattr *actions, size_t act_len,
@@ -245,11 +246,17 @@  netdev_flow_put(struct netdev *netdev, struct match *match,
 {
     const struct netdev_flow_api *flow_api =
         ovsrcu_get(const struct netdev_flow_api *, &netdev->flow_api);
+    const char *netdev_type = netdev->netdev_class->type;
 
-    return (flow_api && flow_api->flow_put)
-           ? flow_api->flow_put(netdev, match, actions, act_len, ufid,
-                                info, stats)
-           : EOPNOTSUPP;
+    if (!strcmp(netdev_type, "dpdkvhostuserclient")) {
+        return netdev_offload_dpdk_flow_put(netdev, match, actions, act_len, ufid,
+                                     info, stats);
+    } else {
+        return (flow_api && flow_api->flow_put)
+               ? flow_api->flow_put(netdev, match, actions, act_len, ufid,
+                                    info, stats)
+               : EOPNOTSUPP;
+    }
 }
 
 int