misc: remove GNU Indent directives
[vpp.git] / src / vnet / devices / tap / cli.c
index 486cd9f..5c676d3 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>
 
@@ -43,6 +41,7 @@ tap_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
   args.tap_flags = 0;
   args.rv = -1;
   args.num_rx_queues = 1;
+  args.num_tx_queues = 1;
 
   /* Get a line of input. */
   if (unformat_user (input, unformat_line_input, line_input))
@@ -78,6 +77,8 @@ tap_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
            args.host_ip6_gw_set = 1;
          else if (unformat (line_input, "num-rx-queues %d", &tmp))
            args.num_rx_queues = tmp;
+         else if (unformat (line_input, "num-tx-queues %d", &tmp))
+           args.num_tx_queues = tmp;
          else if (unformat (line_input, "rx-ring-size %d", &tmp))
            args.rx_ring_sz = tmp;
          else if (unformat (line_input, "tx-ring-size %d", &tmp))
@@ -90,6 +91,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 +101,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;
@@ -129,19 +136,19 @@ tap_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
 
 }
 
-/* *INDENT-OFF* */
 VLIB_CLI_COMMAND (tap_create_command, static) = {
   .path = "create tap",
-  .short_help = "create tap {id <if-id>} [hw-addr <mac-address>] "
-    "[num-rx-queues <n>] [rx-ring-size <size>] [tx-ring-size <size>] "
-    "[host-ns <netns>] [host-bridge <bridge-name>] "
+  .short_help =
+    "create tap {id <if-id>} [hw-addr <mac-address>] "
+    "[num-rx-queues <n>] [num-tx-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] [persist] [attach] [tun]",
+    "[host-mtu-size <size>] [no-gso|gso [gro-coalesce]|csum-offload] "
+    "[persist] [attach] [tun] [packed] [in-order]",
   .function = tap_create_command_fn,
 };
-/* *INDENT-ON* */
 
 static clib_error_t *
 tap_delete_command_fn (vlib_main_t * vm, unformat_input_t * input,
@@ -182,14 +189,12 @@ tap_delete_command_fn (vlib_main_t * vm, unformat_input_t * input,
   return 0;
 }
 
-/* *INDENT-OFF* */
 VLIB_CLI_COMMAND (tap_delete__command, static) =
 {
   .path = "delete tap",
   .short_help = "delete tap {<interface> | sw_if_index <sw_idx>}",
   .function = tap_delete_command_fn,
 };
-/* *INDENT-ON* */
 
 static clib_error_t *
 tap_offload_command_fn (vlib_main_t * vm, unformat_input_t * input,
@@ -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);
 
@@ -248,15 +257,14 @@ tap_offload_command_fn (vlib_main_t * vm, unformat_input_t * input,
   return 0;
 }
 
-/* *INDENT-OFF* */
 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* */
 
 static clib_error_t *
 tap_show_command_fn (vlib_main_t * vm, unformat_input_t * input,
@@ -286,11 +294,8 @@ tap_show_command_fn (vlib_main_t * vm, unformat_input_t * input,
 
   if (vec_len (hw_if_indices) == 0)
     {
-      /* *INDENT-OFF* */
-      pool_foreach (vif, mm->interfaces,
+      pool_foreach (vif, mm->interfaces)
          vec_add1 (hw_if_indices, vif->hw_if_index);
-      );
-      /* *INDENT-ON* */
     }
 
   virtio_show (vm, hw_if_indices, show_descr, VIRTIO_IF_TYPE_TAP);
@@ -300,13 +305,11 @@ done:
   return error;
 }
 
-/* *INDENT-OFF* */
 VLIB_CLI_COMMAND (tap_show_command, static) = {
   .path = "show tap",
   .short_help = "show tap {<interface>] [descriptors]",
   .function = tap_show_command_fn,
 };
-/* *INDENT-ON* */
 
 static clib_error_t *
 tun_show_command_fn (vlib_main_t * vm, unformat_input_t * input,
@@ -336,11 +339,8 @@ tun_show_command_fn (vlib_main_t * vm, unformat_input_t * input,
 
   if (vec_len (hw_if_indices) == 0)
     {
-      /* *INDENT-OFF* */
-      pool_foreach (vif, mm->interfaces,
+      pool_foreach (vif, mm->interfaces)
           vec_add1 (hw_if_indices, vif->hw_if_index);
-      );
-      /* *INDENT-ON* */
     }
 
   virtio_show (vm, hw_if_indices, show_descr, VIRTIO_IF_TYPE_TUN);
@@ -350,13 +350,11 @@ done:
   return error;
 }
 
-/* *INDENT-OFF* */
 VLIB_CLI_COMMAND (tun_show_command, static) = {
   .path = "show tun",
   .short_help = "show tun {<interface>] [descriptors]",
   .function = tun_show_command_fn,
 };
-/* *INDENT-ON* */
 
 clib_error_t *
 tap_cli_init (vlib_main_t * vm)