aboutsummaryrefslogtreecommitdiffstats
path: root/tests/vpp/perf/crypto/10ge2p1x710-ethip4ipsec1tnlsw-ip4base-int-aes128cbc-hmac512sha-ndrpdr.robot
blob: a26af292428df25ca3a9e8ba3f9c28cf85c1e413 (plain)
1
2
3
4
5
6

@media only all and (prefers-color-scheme: dark) {
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
.highlight .c1 { color: #75715e } /* Comment.Single */
.highlight .cs { color: #75715e } /* Comment.Special */
.highlight .gd { color: #f92672 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gi { color: #a6e22e } /* Generic.Inserted */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #75715e } /* Generic.Subheading */
.highlight .kc { color: #66d9ef } /* Keyword.Constant */
.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
.highlight .kn { color: #f92672 } /* Keyword.Namespace */
.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
.highlight .kt { color: #66d9ef } /* Keyword.Type */
.highlight .ld { color: #e6db74 } /* Literal.Date */
.highlight .m { color: #ae81ff } /* Literal.Number */
.highlight .s { color: #e6db74 } /* Literal.String */
.highlight .na { color: #a6e22e } /* Name.Attribute */
.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
.highlight .nc { color: #a6e22e } /* Name.Class */
.highlight .no { color: #66d9ef } /* Name.Constant */
.highlight .nd { color: #a6e22e } /* Name.Decorator */
.highlight .ni { color: #f8f8f2 } /* Name.Entity */
.highlight .ne { color: #a6e22e } /* Name.Exception */
.highlight .nf { color: #a6e22e } /* Name.Function */
.highlight .nl { color: #f8f8f2 } /* Name.Label */
.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
.highlight .nx { color: #a6e22e } /* Name.Other */
.highlight .py { color: #f8f8f2 } /* Name.Property */
.highlight .nt { color: #f92672 } /* Name.Tag */
.highlight .nv { color: #f8f8f2 } /* Name.Variable */
.highlight .ow { color: #f92672 } /* Operator.Word */
.highlight .w { color: #f8f8f2 } /* Text.Whitespace */
.highlight .mb { color: #ae81ff } /* Literal.Number.Bin */
.highlight .mf { color: #ae81ff } /* Literal.Number.Float */
.highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
.highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
.highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
.highlight .sa { color: #e6db74 } /* Literal.String.Affix */
.highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
.highlight .sc { color: #e6db74 } /* Literal.String.Char */
.highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */
.highlight .sd { color: #e6db74 } /* Literal.String.Doc */
.highlight .s2 { color: #e6db74 } /* Literal.String.Double */
.highlight .se { color: #ae81ff } /* Literal.String.Escape */
.highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
.highlight .si { color: #e6db74 } /* Literal.String.Interpol */
.highlight .sx { color: #e6db74 } /* Literal.String.Other */
.highlight .sr { color: #e6db74 } /* Literal.String.Regex */
.highlight .s1 { color: #e6db74 } /* Literal.String.Single */
.highlight .ss { color: #e6db74 } /* Literal.String.Symbol */
.highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #a6e22e } /* Name.Function.Magic */
.highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */
.highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */
.highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */
.highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */
.highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */
}
@media (prefers-color-scheme: light) {
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
}
/*
 * Copyright (c) 2019 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <vlib/vlib.h>
#include <vnet/vnet.h>

u8 *vlib_validate_buffers (vlib_main_t * vm,
			   u32 * buffers,
			   uword next_buffer_stride,
			   uword n_buffers,
			   vlib_buffer_known_state_t known_state,
			   uword follow_buffer_next);

static clib_error_t *
test_vlib_command_fn (vlib_main_t * vm,
		      unformat_input_t * input, vlib_cli_command_t * cmd)
{
  u32 bi;
  u8 *res;
  u32 allocated;
  vlib_buffer_t *b;
  vlib_buffer_t *last_b;
  u8 junk[4] = { 1, 2, 3, 4 };
  vlib_packet_template_t _t, *t = &_t;
  u8 *data_copy = 0;
  vnet_main_t *vnm = vnet_get_main ();
  vnet_interface_main_t *im = &vnm->interface_main;

  /* Cover vlib_packet_template_get_packet */
  t->packet_data = format (0, "silly packet data");
  t->min_n_buffers_each_alloc = 1;
  t->name = (u8 *) "test template";

  if (vlib_packet_template_get_packet (vm, t, &bi))
    vlib_buffer_free_one (vm, bi);

  vec_free (t->packet_data);

  /* Get a buffer */
  allocated = vlib_buffer_alloc (vm, &bi, 1);
  if (allocated != 1)
    return clib_error_return (0, "Buffer allocation failure!");

  b = vlib_get_buffer (vm, bi);

  /* Force buffer allocation */
  b->current_length = 2048;
  last_b = b;
  vlib_buffer_chain_append_data_with_alloc (vm, b, &last_b,
					    junk, ARRAY_LEN (junk));

  /* Cover vlib_buffer_length_in_chain_slow_path(...) */
  b->flags &= ~(VLIB_BUFFER_TOTAL_LENGTH_VALID);
  vlib_cli_output (vm, "buffer length %d",
		   vlib_buffer_length_in_chain (vm, b));
  b->flags &= ~(VLIB_BUFFER_TOTAL_LENGTH_VALID);
  vlib_cli_output (vm, "%u", vlib_buffer_index_length_in_chain (vm, bi));

  /* Add more data. Eat Mor Chikin. */
  vlib_buffer_add_data (vm, &bi, junk, ARRAY_LEN (junk));

  /* Dump the resulting two-chunk pkt */
  vlib_cli_output (vm, "%U", format_vlib_buffer_and_data, b);
  vlib_cli_output (vm, "%U", format_vlib_buffer_data, b->data, 17);

  vec_validate (data_copy, vlib_buffer_length_in_chain (vm, b) - 1);
  vlib_cli_output (vm, "%u", vlib_buffer_contents (vm, bi, data_copy));
  vec_free (data_copy);

  /* Cover simple functions in buffer.h / buffer_funcs.h */
  vlib_cli_output (vm, "%llx", vlib_buffer_get_va (b));
  vlib_cli_output (vm, "%llx", vlib_buffer_get_current_va (b));
  vlib_cli_output (vm, "%d", vlib_buffer_has_space (b, 100ll));
  vlib_buffer_reset (b);
  vlib_cli_output (vm, "%llx", vlib_buffer_get_tail (b));
  vlib_buffer_put_uninit (b, 0);
  vlib_buffer_push_uninit (b, 0);
  vlib_buffer_make_headroom (b, 0);
  (void) vlib_buffer_pull (b, 0);
  vlib_cli_output (vm, "%llx", vlib_buffer_get_pa (vm, b));
  vlib_cli_output (vm, "%llx", vlib_buffer_get_current_pa (vm, b));

  /* Validate it one way */
  res = vlib_validate_buffer (vm, bi, 1 /* follow_buffer_next */ );
  if (res)
    return clib_error_return (0, "%v", res);

  /* Validate it a different way */
  res = vlib_validate_buffers (vm, &bi, 0 /* stride */ ,
			       1, VLIB_BUFFER_KNOWN_ALLOCATED,
			       1 /* follow_buffer_next */ );
  if (res)
    return clib_error_return (0, "%v", res);

  /* Free it */
  vlib_buffer_free_one (vm, bi);
  /* It will be free */
  res = vlib_validate_buffers (vm, &bi, 0 /* stride */ ,
			       1, VLIB_BUFFER_KNOWN_FREE,
			       1 /* follow_buffer_next */ );
  if (res)
    return clib_error_return (0, "%v", res);

  /* Misc */
  vlib_cli_output
    (vm, "%u",
     vlib_combined_counter_n_counters (im->combined_sw_if_counters));

  /* buffer will not be allocated at this point, exercise error path */
  res = vlib_validate_buffers (vm, &bi, 0 /* stride */ ,
			       1, VLIB_BUFFER_KNOWN_ALLOCATED,
			       1 /* follow_buffer_next */ );
  if (res)
    return clib_error_return (0, "%v", res);

  /* NOTREACHED */
  return 0;
}

/* *INDENT-OFF* */
VLIB_CLI_COMMAND (test_vlib_command, static) =
{
  .path = "test vlib",
  .short_help = "vlib code coverage unit test",
  .function = test_vlib_command_fn,
};
/* *INDENT-ON* */

static clib_error_t *
test_format_vlib_command_fn (vlib_main_t * vm,
			     unformat_input_t * input,
			     vlib_cli_command_t * cmd)
{
  unformat_input_t _i, *i = &_i;
  int enable = -1, disable = -1;
  int twenty_seven = -1;;
  int rxtx = -1;

  memset (i, 0, sizeof (*i));
  unformat_init_string (i, "enable disable rx tx 27", 23);

  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
    {
      if (unformat (i, "%U", unformat_vlib_enable_disable, &enable))
	;
      else if (unformat (i, "%U", unformat_vlib_enable_disable, &disable))
	;
      else if (unformat (i, "%U", unformat_vlib_number, &twenty_seven))
	;
      else if (unformat (i, "%U", unformat_vlib_rx_tx, &rxtx))
	;
      else
	break;
    }

  rxtx = VLIB_TX;
  vlib_cli_output (vm, "%U", format_vlib_read_write, rxtx);
  vlib_cli_output (vm, "%U", format_vlib_rx_tx, rxtx);

  rxtx = VLIB_RX;
  vlib_cli_output (vm, "%U", format_vlib_read_write, rxtx);
  vlib_cli_output (vm, "%U", format_vlib_rx_tx, rxtx);
  rxtx = 12345;
  vlib_cli_output (vm, "%U", format_vlib_read_write, rxtx);
  vlib_cli_output (vm, "%U", format_vlib_rx_tx, rxtx);

  unformat_free (i);
  return 0;
}

/* *INDENT-OFF* */
VLIB_CLI_COMMAND (test_format_vlib_command, static) =
{
  .path = "test format-vlib",
  .short_help = "vlib format code coverate unit test",
  .function = test_format_vlib_command_fn,
};
/* *INDENT-ON* */

static clib_error_t *
test_vlib2_command_fn (vlib_main_t * vm,
		       unformat_input_t * input, vlib_cli_command_t * cmd)
{
  u8 *s;
  u8 **result;

  s = format (0, "show       ");
  result = vlib_cli_get_possible_completions (s
n">s); s = format (0, "show ?"); result = vlib_cli_get_possible_completions (s); vec_free (result); vec_free (s); return 0; } /* *INDENT-OFF* */ VLIB_CLI_COMMAND (test_vlib2_command, static) = { .path = "test vlib2", .short_help = "vlib code coverage unit test #2", .function = test_vlib2_command_fn, }; /* *INDENT-ON* */ /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */