tap: fix host mtu configuration setting

host mtu can't be set if tap interface is in namespace.
This patch fixes this issue.

Type: fix

Change-Id: I63811c4b56c708fe708061a8afbaec41994f08ca
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c
index f47c1ea..6f16a4c 100644
--- a/src/vnet/devices/tap/tap.c
+++ b/src/vnet/devices/tap/tap.c
@@ -411,18 +411,6 @@
 	}
     }
 
-  /* switch back to old net namespace */
-  if (args->host_namespace)
-    {
-      if (setns (old_netns_fd, CLONE_NEWNET) == -1)
-	{
-	  args->rv = VNET_API_ERROR_SYSCALL_ERROR_2;
-	  args->error = clib_error_return_unix (0, "setns '%s'",
-						args->host_namespace);
-	  goto error;
-	}
-    }
-
   if (args->host_mtu_set)
     {
       args->error =
@@ -446,6 +434,18 @@
       args->host_mtu_size = tm->host_mtu_size;
     }
 
+  /* switch back to old net namespace */
+  if (args->host_namespace)
+    {
+      if (setns (old_netns_fd, CLONE_NEWNET) == -1)
+	{
+	  args->rv = VNET_API_ERROR_SYSCALL_ERROR_2;
+	  args->error = clib_error_return_unix (0, "setns '%s'",
+						args->host_namespace);
+	  goto error;
+	}
+    }
+
   for (i = 0; i < num_q_pairs; i++)
     {
       if (i < vif->num_rxqs && (args->error =
@@ -621,6 +621,7 @@
       args->rv = VNET_API_ERROR_SYSCALL_ERROR_3;
     }
 
+  tap_log_err (vif, "%U", format_clib_error, args->error);
   tap_free (vm, vif);
 done:
   if (vhost_mem)