virtio: remove kernel virtio header dependencies
[vpp.git] / src / vnet / devices / tap / cli.c
index 40086a5..7580d92 100644 (file)
@@ -25,8 +25,6 @@
 #include <vnet/ip/ip4_packet.h>
 #include <vnet/ip/ip6_packet.h>
 #include <vnet/ip/format.h>
-#include <linux/virtio_net.h>
-#include <linux/vhost.h>
 #include <vnet/devices/virtio/virtio.h>
 #include <vnet/devices/tap/tap.h>
 
@@ -90,6 +88,8 @@ tap_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
            args.tap_flags &= ~TAP_FLAG_GSO;
          else if (unformat (line_input, "gso"))
            args.tap_flags |= TAP_FLAG_GSO;
+         else if (unformat (line_input, "gro-coalesce"))
+           args.tap_flags |= TAP_FLAG_GRO_COALESCE;
          else if (unformat (line_input, "csum-offload"))
            args.tap_flags |= TAP_FLAG_CSUM_OFFLOAD;
          else if (unformat (line_input, "persist"))
@@ -98,6 +98,10 @@ tap_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
            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;
@@ -133,12 +137,13 @@ tap_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
 VLIB_CLI_COMMAND (tap_create_command, static) = {
   .path = "create tap",
   .short_help = "create tap {id <if-id>} [hw-addr <mac-address>] "
-    "[rx-ring-size <size>] [tx-ring-size <size>] [host-ns <netns>] "
-    "[host-bridge <bridge-name>] [host-ip4-addr <ip4addr/mask>] "
-    "[host-ip6-addr <ip6-addr>] [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] "
-    "[persist] [attach] [tun]",
+    "[num-rx-queues <n>] [rx-ring-size <size>] [tx-ring-size <size>] "
+    "[host-ns <netns>] [host-bridge <bridge-name>] "
+    "[host-ip4-addr <ip4addr/mask>] [host-ip6-addr <ip6-addr>] "
+    "[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] [packed] [in-order]",
   .function = tap_create_command_fn,
 };
 /* *INDENT-ON* */
@@ -198,7 +203,7 @@ tap_offload_command_fn (vlib_main_t * vm, unformat_input_t * input,
   unformat_input_t _line_input, *line_input = &_line_input;
   u32 sw_if_index = ~0;
   vnet_main_t *vnm = vnet_get_main ();
-  int gso_enable = 0, gso_disable = 0;
+  int gso_enable = 0, gso_disable = 0, is_gro_coalesce = 0;
   int csum_offload_enable = 0, csum_offload_disable = 0;
   int rv = 0;
 
@@ -214,7 +219,11 @@ tap_offload_command_fn (vlib_main_t * vm, unformat_input_t * input,
                         vnm, &sw_if_index))
        ;
       else if (unformat (line_input, "gso-enable"))
-       gso_enable = 1;
+       {
+         gso_enable = 1;
+         if (unformat (line_input, "gro-coalesce"))
+           is_gro_coalesce = 1;
+       }
       else if (unformat (line_input, "gso-disable"))
        gso_disable = 1;
       else if (unformat (line_input, "csum-offload-enable"))
@@ -232,11 +241,11 @@ tap_offload_command_fn (vlib_main_t * vm, unformat_input_t * input,
                              "please specify interface name or sw_if_index");
 
   if (gso_enable)
-    rv = tap_gso_enable_disable (vm, sw_if_index, 1);
+    rv = tap_gso_enable_disable (vm, sw_if_index, 1, is_gro_coalesce);
   else if (csum_offload_enable)
     rv = tap_csum_offload_enable_disable (vm, sw_if_index, 1);
   else if (gso_disable)
-    rv = tap_gso_enable_disable (vm, sw_if_index, 0);
+    rv = tap_gso_enable_disable (vm, sw_if_index, 0, 0);
   else if (csum_offload_disable)
     rv = tap_csum_offload_enable_disable (vm, sw_if_index, 0);
 
@@ -253,7 +262,8 @@ VLIB_CLI_COMMAND (tap_offload_command, static) =
 {
   .path = "set tap offload",
   .short_help = "set tap offload {<interface> | sw_if_index <sw_idx>}"
-    " <gso-enable | gso-disable | csum-offload-enable | csum-offload-disable>",
+    " <gso-enable [gro-coalesce]  | gso-disable | csum-offload-enable |"
+    "csum-offload-disable>",
   .function = tap_offload_command_fn,
 };
 /* *INDENT-ON* */