tap: add virtio 1.1 API flag

Type: feature

Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Change-Id: I3e00deb94943c545d1649865b2efdf7d51b90f4d
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index fcf0b60..c9e0b62 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -7390,6 +7390,10 @@
 	tap_flags |= TAP_API_FLAG_TUN;
       else if (unformat (i, "gro-coalesce"))
 	tap_flags |= TAP_API_FLAG_GRO_COALESCE;
+      else if (unformat (i, "packed"))
+	tap_flags |= TAP_API_FLAG_PACKED;
+      else if (unformat (i, "in-order"))
+	tap_flags |= TAP_API_FLAG_IN_ORDER;
       else
 	break;
     }
@@ -20659,7 +20663,7 @@
 _(bridge_flags,                                                         \
   "bd_id <bridge-domain-id> [learn] [forward] [uu-flood] [flood] [arp-term] [disable]\n") \
 _(tap_create_v2,                                                        \
-  "id <num> [hw-addr <mac-addr>] [host-if-name <name>] [host-ns <name>] [num-rx-queues <num>] [rx-ring-size <num>] [tx-ring-size <num>] [host-bridge <name>] [host-mac-addr <mac-addr>] [host-ip4-addr <ip4addr/mask>] [host-ip6-addr <ip6addr/mask>] [host-mtu-size <mtu>] [gso | no-gso | csum-offload | gro-coalesce] [persist] [attach] [tun]") \
+  "id <num> [hw-addr <mac-addr>] [host-if-name <name>] [host-ns <name>] [num-rx-queues <num>] [rx-ring-size <num>] [tx-ring-size <num>] [host-bridge <name>] [host-mac-addr <mac-addr>] [host-ip4-addr <ip4addr/mask>] [host-ip6-addr <ip6addr/mask>] [host-mtu-size <mtu>] [gso | no-gso | csum-offload | gro-coalesce] [persist] [attach] [tun] [packed] [in-order]") \
 _(tap_delete_v2,                                                        \
   "<vpp-if-name> | sw_if_index <id>")                                   \
 _(sw_interface_tap_v2_dump, "")                                         \
diff --git a/src/vnet/devices/tap/cli.c b/src/vnet/devices/tap/cli.c
index fa5fa91..704cd18 100644
--- a/src/vnet/devices/tap/cli.c
+++ b/src/vnet/devices/tap/cli.c
@@ -100,6 +100,10 @@
 	    args.tap_flags |= TAP_FLAG_ATTACH;
 	  else if (unformat (line_input, "tun"))
 	    args.tap_flags |= TAP_FLAG_TUN;
+	  else if (unformat (line_input, "packed"))
+	    args.tap_flags |= TAP_FLAG_PACKED;
+	  else if (unformat (line_input, "in-order"))
+	    args.tap_flags |= TAP_FLAG_IN_ORDER;
 	  else if (unformat (line_input, "hw-addr %U",
 			     unformat_ethernet_address, args.mac_addr.bytes))
 	    args.mac_addr_set = 1;
@@ -141,7 +145,7 @@
     "[host-ip4-gw <ip4-addr>] [host-ip6-gw <ip6-addr>] "
     "[host-mac-addr <host-mac-address>] [host-if-name <name>] "
     "[host-mtu-size <size>] [no-gso|gso|csum-offload|gro-coalesce] "
-    "[persist] [attach] [tun]",
+    "[persist] [attach] [tun] [packed] [in-order]",
   .function = tap_create_command_fn,
 };
 /* *INDENT-ON* */
diff --git a/src/vnet/devices/tap/tap.h b/src/vnet/devices/tap/tap.h
index 93b5da5..46f13a4 100644
--- a/src/vnet/devices/tap/tap.h
+++ b/src/vnet/devices/tap/tap.h
@@ -28,7 +28,9 @@
   _ (PERSIST, 2)             \
   _ (ATTACH, 3)              \
   _ (TUN, 4)                 \
-  _ (GRO_COALESCE, 5)
+  _ (GRO_COALESCE, 5)        \
+  _ (PACKED, 6)              \
+  _ (IN_ORDER, 7)
 
 typedef enum
 {
diff --git a/src/vnet/devices/tap/tapv2.api b/src/vnet/devices/tap/tapv2.api
index 94e1a7c..6b66184 100644
--- a/src/vnet/devices/tap/tapv2.api
+++ b/src/vnet/devices/tap/tapv2.api
@@ -32,6 +32,8 @@
         TAP_API_FLAG_ATTACH = 8,  /* attach to the existing persistence interface after vpp crash/restart */
         TAP_API_FLAG_TUN = 16,  /* create TUN interface instead of tap */
         TAP_API_FLAG_GRO_COALESCE = 32, /* enable packet coalescing on tx side, provided gso enabled */
+        TAP_API_FLAG_PACKED = 64 [backwards_compatible], /* enable packed ring support */
+        TAP_API_FLAG_IN_ORDER = 128 [backwards_compatible], /* enable in-order desc support */
 };
 
 /** \brief Initialize a new tap interface with the given parameters
diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c
index 1928e42..8f2975d 100644
--- a/src/vpp/api/custom_dump.c
+++ b/src/vpp/api/custom_dump.c
@@ -591,6 +591,10 @@
     s = format (s, "tun ");
   if ((mp->tap_flags) & TAP_API_FLAG_GRO_COALESCE)
     s = format (s, "gro-coalesce-enabled ");
+  if ((mp->tap_flags) & TAP_API_FLAG_PACKED)
+    s = format (s, "packed ");
+  if ((mp->tap_flags) & TAP_API_FLAG_IN_ORDER)
+    s = format (s, "in-order ");
   FINISH;
 }