[ovs-dev] [patch_v3] dpif: Fix cleanup of userspace datapath.

Darrell Ball dlu998 at gmail.com
Tue Jun 27 02:38:49 UTC 2017


Hardware offload introduced extra tracking of netdev ports.  This
included ovs-netdev, which is really for internal infra usage for
the userpace datapath.  This breaks cleanup of the userspace
datapath.  One effect is that all userspace datapath system tests
fail except for the first one run. There is no need to do this
extra tracking of tap devices for the hardware offload effort.
Hence, the approach taken is to filter both internal device
and tap device types for hardware offload. Internal devices are
'internal' from the kernel datapath perspective and tap devices
are 'internal' from the userpace datapath perspective.

Signed-off-by: Darrell Ball <dlu998 at gmail.com>
---

v1->v2: Add a utility function to check for "internal" ports.
        Add an extra check for add port case.

v2->v3: Change utility function to just check for internal
        and tap device types.  After discussion with Joe who
        was one of the main reviewers of the hardware offload
        patches, it is clear there is no need for the hardware
        offload support to need to track any tap devices.
        Hence, the filtering of device types becomes a simple
        matter of checking for 'internal' device types.

 lib/dpif.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/lib/dpif.c b/lib/dpif.c
index 10bdd70..2f9fe7d 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -100,6 +100,15 @@ static bool should_log_flow_message(const struct vlog_module *module,
 /* Incremented whenever tnl route, arp, etc changes. */
 struct seq *tnl_conf_seq;
 
+static bool
+dpif_is_internal_port(const char *type)
+{
+    /* For userspace datapath, tap devices are the equivalent
+     * of internal devices in the kernel datapath, so both
+     * these types are 'internal' devices. */
+    return !strcmp(type, "internal") || !strcmp(type, "tap");
+}
+
 static void
 dp_initialize(void)
 {
@@ -350,7 +359,7 @@ do_open(const char *name, const char *type, bool create, struct dpif **dpifp)
             struct netdev *netdev;
             int err;
 
-            if (!strcmp(dpif_port.type, "internal")) {
+            if (dpif_is_internal_port(dpif_port.type)) {
                 continue;
             }
 
@@ -556,7 +565,8 @@ dpif_port_add(struct dpif *dpif, struct netdev *netdev, odp_port_t *port_nop)
         VLOG_DBG_RL(&dpmsg_rl, "%s: added %s as port %"PRIu32,
                     dpif_name(dpif), netdev_name, port_no);
 
-        if (strcmp(netdev_get_type(netdev), "internal")) {
+        if (!dpif_is_internal_port(netdev_get_type(netdev))) {
+
             struct dpif_port dpif_port;
 
             dpif_port.type = CONST_CAST(char *, netdev_get_type(netdev));
-- 
1.9.1



More information about the dev mailing list