aboutsummaryrefslogtreecommitdiffstats
path: root/tests/perf/10ge2p1x520-dot1q-l2xcbase-eth-2vhost-1vm-ndrpdrdisc.robot
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2017-06-14 10:13:08 +0000
committerPeter Mikus <pmikus@cisco.com>2017-06-19 06:14:13 +0000
commitf22e850f38ad5a1630271d020b2078c1580c99c0 (patch)
tree831b5009d111663421841d4905f35aed6d2322cc /tests/perf/10ge2p1x520-dot1q-l2xcbase-eth-2vhost-1vm-ndrpdrdisc.robot
parentb47b29bdbd8c10c8e5fcac6cc9abe72bea75df49 (diff)
Update Ansible scripts for image server copy
Change-Id: I7fa1808218d59ae0094952a94447613b90ce4fd2 Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'tests/perf/10ge2p1x520-dot1q-l2xcbase-eth-2vhost-1vm-ndrpdrdisc.robot')
0 files changed, 0 insertions, 0 deletions
} /* 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) 2017 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 <vppinfra/lock.h>
#include <vlib/log.h>

#define MEMIF_DEFAULT_SOCKET_FILENAME  "memif.sock"
#define MEMIF_DEFAULT_RING_SIZE 1024
#define MEMIF_DEFAULT_RX_QUEUES 1
#define MEMIF_DEFAULT_TX_QUEUES 1
#define MEMIF_DEFAULT_BUFFER_SIZE 2048

#define MEMIF_MAX_M2S_RING		(vec_len (vlib_mains))
#define MEMIF_MAX_S2M_RING		256
#define MEMIF_MAX_REGION		256
#define MEMIF_MAX_LOG2_RING_SIZE	14


#define memif_log_debug(dev, f, ...) do {                               \
  memif_if_t *_dev = (memif_if_t *) dev;                                \
  if (_dev)                                                             \
    vlib_log(VLIB_LOG_LEVEL_DEBUG, memif_main.log_class, "%U: " f,      \
	     format_vnet_hw_if_index_name, vnet_get_main(),             \
	     _dev->hw_if_index, ##__VA_ARGS__);                         \
  else                                                                  \
    vlib_log(VLIB_LOG_LEVEL_DEBUG, memif_main.log_class, f,             \
             ##__VA_ARGS__);                                            \
} while (0)

#define memif_log_warn(dev, f, ...) do {                                \
  memif_if_t *_dev = (memif_if_t *) dev;                                \
  if (_dev)                                                             \
    vlib_log(VLIB_LOG_LEVEL_WARNING, memif_main.log_class, "%U: " f,    \
	     format_vnet_hw_if_index_name, vnet_get_main(),             \
	     _dev->hw_if_index, ##__VA_ARGS__);                         \
  else                                                                  \
    vlib_log(VLIB_LOG_LEVEL_WARNING, memif_main.log_class, f,           \
             ##__VA_ARGS__);                                            \
} while (0)

#define memif_log_err(dev, f, ...) do {                                 \
  memif_if_t *_dev = (memif_if_t *) dev;                                \
  if (_dev)                                                             \
    vlib_log(VLIB_LOG_LEVEL_ERR, memif_main.log_class, "%U: " f,        \
	     format_vnet_hw_if_index_name, vnet_get_main(),             \
	     _dev->hw_if_index, ##__VA_ARGS__);                         \
  else                                                                  \
    vlib_log(VLIB_LOG_LEVEL_ERR, memif_main.log_class, f,               \
             ##__VA_ARGS__);                                            \
} while (0)

#define memif_file_add(a, b) do {					\
  *a = clib_file_add (&file_main, b);					\
  memif_log_warn (0, "clib_file_add fd %d private_data %u idx %u",	\
		(b)->file_descriptor, (b)->private_data, *a);		\
} while (0)

#define memif_file_del(a) do {						\
  memif_log_warn (0, "clib_file_del idx %u", a - file_main.file_pool);	\
  clib_file_del (&file_main, a);					\
} while (0)

#define memif_file_del_by_index(a) do {					\
  memif_log_warn (0, "clib_file_del idx %u", a);			\
  clib_file_del_by_index (&file_main, a);				\
} while (0)

typedef struct
{
  u8 *filename;
  u32 socket_id;
  clib_socket_t *sock;
  clib_socket_t **pending_clients;
  int ref_cnt;
  int is_listener;

  /* hash of all registered id */
  mhash_t dev_instance_by_id;

  /* hash of all registered fds */
  uword *dev_instance_by_fd;
} memif_socket_file_t;

typedef struct
{
  /* Required for vec_validate_aligned */
  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
  void *shm;
  memif_region_size_t region_size;
  int fd;
  u8 is_external;
} memif_region_t;

typedef struct
{
  memif_msg_t msg;
  int fd;
} memif_msg_fifo_elt_t;

typedef struct
{
  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
  /* ring data */
  memif_ring_t *ring;
  memif_log2_ring_size_t log2_ring_size;
  memif_region_index_t region;
  memif_region_offset_t offset;

  u16 last_head;
  u16 last_tail;
  u32 *buffers;
  u8 buffer_pool_index;

  /* interrupts */
  int int_fd;
  uword int_clib_file_index;
  u64 int_count;

  /* queue type */
  memif_ring_type_t type;
} memif_queue_t;

#define foreach_memif_if_flag \
  _(0, ADMIN_UP, "admin-up")		\
  _(1, IS_SLAVE, "slave")		\
  _(2, CONNECTING, "connecting")	\
  _(3, CONNECTED, "connected")		\
  _(4, DELETING, "deleting")		\
  _(5, ZERO_COPY, "zero-copy")		\
  _(6, ERROR, "error")

typedef enum
{
#define _(a, b, c) MEMIF_IF_FLAG_##b = (1 << a),
  foreach_memif_if_flag
#undef _
} memif_if_flag_t;

typedef struct
{
  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
  clib_spinlock_t lockp;
  u32 flags;
  memif_interface_id_t id;
  u32 hw_if_index;
  u32 sw_if_index;
  uword dev_instance;
  memif_interface_mode_t mode:8;

  u32 per_interface_next_index;

  /* socket connection */
  clib_socket_t *sock;
  uword socket_file_index;
  memif_msg_fifo_elt_t *msg_queue;
  u8 *secret;

  memif_region_t *regions;

  memif_queue_t *rx_queues;
  memif_queue_t *tx_queues;

  /* remote info */
  u8 *remote_name;
  u8 *remote_if_name;

  struct
  {
    memif_log2_ring_size_t log2_ring_size;
    u8 num_s2m_rings;
    u8 num_m2s_rings;
    u16 buffer_size;
  } cfg;

  struct
  {
    memif_log2_ring_size_t log2_ring_size;
    u8 num_s2m_rings;
    u8 num_m2s_rings;
    u16 buffer_size;
  } run;

  /* disconnect strings */
  u8 *local_disc_string;
  u8 *remote_disc_string;
} memif_if_t;

typedef struct
{
  u32 packet_len;
  u16 first_buffer_vec_index;
} memif_packet_op_t;

typedef struct
{
  CLIB_ALIGN_MARK (pad, 16);	/* align up to 16 bytes for 32bit builds */
  void *data;
  u32 data_len;
  i16 buffer_offset;
  u16 buffer_vec_index;
} memif_copy_op_t;

#define MEMIF_RX_VECTOR_SZ VLIB_FRAME_SIZE

typedef struct
{
  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);

  /* copy vector */
  memif_packet_op_t packet_ops[MEMIF_RX_VECTOR_SZ];
  memif_copy_op_t *copy_ops;
  u32 *buffers;

  /* buffer template */
  vlib_buffer_t buffer_template;
  memif_desc_t desc_template;
} memif_per_thread_data_t;

typedef struct
{
  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);

  /** API message ID base */
  u16 msg_id_base;

  /* pool of all memory interfaces */
  memif_if_t *interfaces;

  /* pool of all unix socket files */
  memif_socket_file_t *socket_files;
  uword *socket_file_index_by_sock_id;	/* map user socket id to pool idx */

  /* per thread data */
  memif_per_thread_data_t *per_thread_data;

  vlib_log_class_t log_class;

} memif_main_t;

extern memif_main_t memif_main;
extern vnet_device_class_t memif_device_class;
extern vlib_node_registration_t memif_input_node;

typedef enum
{
  MEMIF_PROCESS_EVENT_START = 1,
  MEMIF_PROCESS_EVENT_STOP = 2,
} memif_process_event_t;

typedef struct
{
  memif_interface_id_t id;
  u32 socket_id;
  u8 *secret;
  u8 is_master;
  u8 is_zero_copy;
  memif_interface_mode_t mode:8;
  memif_log2_ring_size_t log2_ring_size;
  u16 buffer_size;
  u8 hw_addr_set;
  u8 hw_addr[6];
  u8 rx_queues;
  u8 tx_queues;

  /* return */
  u32 sw_if_index;
} memif_create_if_args_t;

int memif_socket_filename_add_del (u8 is_add, u32 sock_id,
				   u8 * sock_filename);
int memif_create_if (vlib_main_t * vm, memif_create_if_args_t * args);
int memif_delete_if (vlib_main_t * vm, memif_if_t * mif);
clib_error_t *memif_plugin_api_hookup (vlib_main_t * vm);

static_always_inline void *
memif_get_buffer (memif_if_t * mif, memif_ring_t * ring, u16 slot)
{
  u16 region = ring->desc[slot].region;
  return mif->regions[region].shm + ring->desc[slot].offset;
}

/* memif.c */
clib_error_t *memif_init_regions_and_queues (memif_if_t * mif);
clib_error_t *memif_connect (memif_if_t * mif);
void memif_disconnect (memif_if_t * mif, clib_error_t * err);

/* socket.c */
void memif_socket_close (clib_socket_t ** sock);
clib_error_t *memif_conn_fd_accept_ready (clib_file_t * uf);
clib_error_t *memif_master_conn_fd_read_ready (clib_file_t * uf);
clib_error_t *memif_slave_conn_fd_read_ready (clib_file_t * uf);
clib_error_t *memif_master_conn_fd_write_ready (clib_file_t * uf);
clib_error_t *memif_slave_conn_fd_write_ready (clib_file_t * uf);
clib_error_t *memif_master_conn_fd_error (clib_file_t * uf);
clib_error_t *memif_slave_conn_fd_error (clib_file_t * uf);
clib_error_t *memif_msg_send_disconnect (memif_if_t * mif,
					 clib_error_t * err);
u8 *format_memif_device_name (u8 * s, va_list * args);


/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */