diff mbox series

[ovs-dev,V2,08/14] netdev-offload: Disallow offloading to unrelated tunneling vports.

Message ID 20210210152702.4898-9-elibr@nvidia.com
State Changes Requested
Headers show
Series Netdev vxlan-decap offload | expand

Commit Message

Eli Britstein Feb. 10, 2021, 3:26 p.m. UTC
From: Ilya Maximets <i.maximets@ovn.org>

'linux_tc' flow API suitable only for tunneling vports with backing
linux interfaces. DPDK flow API is not suitable for such ports.

With this change we could drop vport restriction from dpif-netdev.

This is a prerequisite for enabling vport offloading in DPDK.

Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Eli Britstein <elibr@nvidia.com>
Reviewed-by: Gaetan Rivet <gaetanr@nvidia.com>
---
 lib/dpif-netdev.c         | 3 +--
 lib/netdev-offload-dpdk.c | 8 ++++++++
 lib/netdev-offload-tc.c   | 8 ++++++++
 3 files changed, 17 insertions(+), 2 deletions(-)

Comments

0-day Robot Feb. 10, 2021, 9:24 p.m. UTC | #1
Bleep bloop.  Greetings Eli Britstein, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Unexpected sign-offs from developers who are not authors or co-authors or committers: Eli Britstein <elibr@nvidia.com>
Lines checked: 90, Warnings: 1, Errors: 0


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
diff mbox series

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 09e86631e..7c82a7a27 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -2697,8 +2697,7 @@  dp_netdev_flow_offload_put(struct dp_flow_offload_item *offload)
     info.flow_mark = mark;
 
     port = netdev_ports_get(in_port, dpif_type_str);
-    if (!port || netdev_vport_is_vport_class(port->netdev_class)) {
-        netdev_close(port);
+    if (!port) {
         goto err_free;
     }
     /* Taking a global 'port_mutex' to fulfill thread safety restrictions for
diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c
index 21aa26b42..041429be8 100644
--- a/lib/netdev-offload-dpdk.c
+++ b/lib/netdev-offload-dpdk.c
@@ -24,6 +24,7 @@ 
 #include "dpif-netdev.h"
 #include "netdev-offload-provider.h"
 #include "netdev-provider.h"
+#include "netdev-vport.h"
 #include "openvswitch/match.h"
 #include "openvswitch/vlog.h"
 #include "packets.h"
@@ -1523,6 +1524,13 @@  netdev_offload_dpdk_flow_del(struct netdev *netdev OVS_UNUSED,
 static int
 netdev_offload_dpdk_init_flow_api(struct netdev *netdev)
 {
+    if (netdev_vport_is_vport_class(netdev->netdev_class)
+        && !strcmp(netdev_get_dpif_type(netdev), "system")) {
+        VLOG_DBG("%s: vport belongs to the system datapath. Skipping.",
+                 netdev_get_name(netdev));
+        return EOPNOTSUPP;
+    }
+
     return netdev_dpdk_flow_api_supported(netdev) ? 0 : EOPNOTSUPP;
 }
 
diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c
index 7cdd84944..2554399ce 100644
--- a/lib/netdev-offload-tc.c
+++ b/lib/netdev-offload-tc.c
@@ -31,6 +31,7 @@ 
 #include "netdev-linux.h"
 #include "netdev-offload-provider.h"
 #include "netdev-provider.h"
+#include "netdev-vport.h"
 #include "netlink.h"
 #include "netlink-socket.h"
 #include "odp-netlink.h"
@@ -2004,6 +2005,13 @@  netdev_tc_init_flow_api(struct netdev *netdev)
     int ifindex;
     int error;
 
+    if (netdev_vport_is_vport_class(netdev->netdev_class)
+        && strcmp(netdev_get_dpif_type(netdev), "system")) {
+        VLOG_DBG("%s: vport doesn't belong to the system datapath. Skipping.",
+                 netdev_get_name(netdev));
+        return EOPNOTSUPP;
+    }
+
     ifindex = netdev_get_ifindex(netdev);
     if (ifindex < 0) {
         VLOG_INFO("init: failed to get ifindex for %s: %s",