|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
22 #define _(sym, str) str,
36 u8 *
a = va_arg (*args,
u8 *);
37 return format (s,
"%d.%d.%d.%d",
a[0],
a[1],
a[2],
a[3]);
43 ip6_address_t *
a = va_arg (*args, ip6_address_t *);
44 u32 i, i_max_n_zero, max_n_zeros, i_first_zero, n_zeros, last_double_colon;
48 i_first_zero = i_max_n_zero;
52 u32 is_zero =
a->as_u16[
i] == 0;
53 if (is_zero && i_first_zero >=
ARRAY_LEN (
a->as_u16))
59 if ((!is_zero && n_zeros > max_n_zeros)
60 || (
i + 1 >=
ARRAY_LEN (
a->as_u16) && n_zeros > max_n_zeros))
62 i_max_n_zero = i_first_zero;
63 max_n_zeros = n_zeros;
69 last_double_colon = 0;
72 if (
i == i_max_n_zero && max_n_zeros > 1)
76 last_double_colon = 1;
81 (last_double_colon ||
i == 0) ?
"" :
":",
82 clib_net_to_host_u16 (
a->as_u16[
i]));
83 last_double_colon = 0;
94 ip46_address_t *ip46 = va_arg (*args, ip46_address_t *);
126 s =
format (s,
"%s", p[0]);
138 #define _(n,v,s) hash_set (em->error_string_by_error_number, -v, s);
152 session->session_index);
158 u32 session_type = va_arg (*args,
u32);
159 switch (session_type)
162 return format (s,
"Qsession");
164 return format (s,
"Stream");
166 return format (s,
"Lsession");
170 return format (s,
"BadSession");
176 u32 session_state = va_arg (*args,
u32);
177 switch (session_state)
180 return format (s,
"ECHO_SESSION_STATE_INITIAL (%u)", session_state);
182 return format (s,
"ECHO_SESSION_STATE_READY (%u)", session_state);
184 return format (s,
"ECHO_SESSION_STATE_AWAIT_CLOSING (%u)",
187 return format (s,
"ECHO_SESSION_STATE_AWAIT_DATA (%u)", session_state);
189 return format (s,
"ECHO_SESSION_STATE_CLOSING (%u)", session_state);
191 return format (s,
"ECHO_SESSION_STATE_CLOSED (%u)", session_state);
195 return format (s,
"unknown session state (%u)", session_state);
207 return format (s,
"STATE_ATTACHED_NO_CERT (%u)",
state);
215 return format (s,
"STATE_DISCONNECTED (%u)",
state);
225 u8 *
a = va_arg (*args,
u8 *);
240 u8 *
a = va_arg (*args,
u8 *);
243 else if (
unformat (input,
"qconnected"))
245 else if (
unformat (input,
"qconnect"))
247 else if (
unformat (input,
"sconnected"))
249 else if (
unformat (input,
"sconnect"))
251 else if (
unformat (input,
"lastbyte"))
263 f64 bps = va_arg (*args,
f64) * 8;
265 return format (s,
"%.3f Gb/s", bps / 1e9);
267 return format (s,
"%.3f Mb/s", bps / 1e6);
269 return format (s,
"%.3f Kb/s", bps / 1e3);
271 return format (s,
"%.3f b/s", bps);
277 u32 timing_event = va_arg (*args,
u32);
279 return format (s,
"start");
281 return format (s,
"qconnect");
283 return format (s,
"qconnected");
285 return format (s,
"sconnect");
287 return format (s,
"sconnected");
289 return format (s,
"lastbyte");
291 return format (s,
"exit");
293 return format (s,
"unknown timing event");
301 *
proto = TRANSPORT_PROTO_TCP;
303 *
proto = TRANSPORT_PROTO_TCP;
305 *
proto = TRANSPORT_PROTO_UDP;
307 *
proto = TRANSPORT_PROTO_UDP;
309 *
proto = TRANSPORT_PROTO_TLS;
311 *
proto = TRANSPORT_PROTO_TLS;
313 *
proto = TRANSPORT_PROTO_QUIC;
315 *
proto = TRANSPORT_PROTO_QUIC;
327 case TRANSPORT_PROTO_TCP:
330 case TRANSPORT_PROTO_UDP:
333 case TRANSPORT_PROTO_NONE:
336 case TRANSPORT_PROTO_TLS:
339 case TRANSPORT_PROTO_QUIC:
342 case TRANSPORT_PROTO_DTLS:
345 case TRANSPORT_PROTO_SRTP:
349 s =
format (s,
"UNKNOWN");
358 u8 *result = va_arg (*args,
u8 *);
361 if (!
unformat (input,
"%d.%d.%d.%d", &
a[0], &
a[1], &
a[2], &
a[3]))
364 if (
a[0] >= 256 ||
a[1] >= 256 ||
a[2] >= 256 ||
a[3] >= 256)
378 ip6_address_t *result = va_arg (*args, ip6_address_t *);
380 uword hex_quad, n_hex_quads, hex_digit, n_hex_digits;
381 uword c, n_colon, double_colon_index;
383 n_hex_quads = hex_quad = n_hex_digits = n_colon = 0;
384 double_colon_index =
ARRAY_LEN (hex_quads);
388 if (
c >=
'0' &&
c <=
'9')
390 else if (
c >=
'a' &&
c <=
'f')
391 hex_digit =
c + 10 -
'a';
392 else if (
c >=
'A' &&
c <=
'F')
393 hex_digit =
c + 10 -
'A';
394 else if (
c ==
':' && n_colon < 2)
403 if (n_hex_quads >=
ARRAY_LEN (hex_quads))
408 hex_quad = (hex_quad << 4) | hex_digit;
411 if (n_hex_digits >= 4)
422 if (double_colon_index <
ARRAY_LEN (hex_quads))
424 double_colon_index = n_hex_quads;
427 if (n_colon > 0 && n_hex_digits > 0)
429 hex_quads[n_hex_quads++] = hex_quad;
435 if (n_hex_digits > 0)
436 hex_quads[n_hex_quads++] = hex_quad;
442 if (double_colon_index <
ARRAY_LEN (hex_quads))
446 for (
i = n_hex_quads - 1;
i >= (signed) double_colon_index;
i--)
447 hex_quads[n_zero +
i] = hex_quads[
i];
449 for (
i = 0;
i < n_zero;
i++)
450 hex_quads[double_colon_index +
i] = 0;
460 result->as_u16[
i] = clib_host_to_net_u16 (hex_quads[
i]);
469 ip46_address_t *
ip = va_arg (*args, ip46_address_t *);
485 return format (s,
"mbedtls");
487 return format (s,
"openssl");
489 return format (s,
"picotls");
493 return format (s,
"unknown crypto engine");
499 u8 *
a = va_arg (*args,
u8 *);
502 else if (
unformat (input,
"openssl"))
504 else if (
unformat (input,
"picotls"))
526 ECHO_LOG (3,
"hash_unset(0x%lx)", handle);
531 ECHO_LOG (3,
"hash_set(0x%lx) S[%d]", handle, sid);
554 ECHO_FAIL (ECHO_FAIL_RPC_SIZE,
"RPC lock failed");
560 ECHO_FAIL (ECHO_FAIL_RPC_SIZE,
"RPC ring is full");
581 ECHO_LOG (2,
"unknown handle 0x%lx", handle);
619 ECHO_LOG (1,
"Session 0x%x done in %.6fs RX[%.4f] TX[%.4f] Gbit/s\n",
#define hash_set(h, key, value)
#define clib_memcpy(d, s, n)
void svm_msg_q_add_and_unlock(svm_msg_q_t *mq, svm_msg_q_msg_t *msg)
Producer enqueue one message to queue with mutex held.
#define ECHO_FAIL(fail, _fmt, _args...)
echo_session_t * sessions
svm_msg_q_msg_t svm_msg_q_alloc_msg_w_ring(svm_msg_q_t *mq, u32 ring_index)
Allocate message buffer on ring.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
void * svm_msg_q_msg_data(svm_msg_q_t *mq, svm_msg_q_msg_t *msg)
Get data for message in queue.
u8 * echo_format_session_state(u8 *s, va_list *args)
static u8 ip46_address_is_ip4(const ip46_address_t *ip46)
@ ECHO_EVT_FIRST_QCONNECT
volatile connection_state_t state
#define SESSION_INVALID_INDEX
@ ECHO_SESSION_TYPE_STREAM
static int svm_msg_q_lock(svm_msg_q_t *mq)
Lock, or block trying, the message queue.
vl_api_dhcp_client_state_t state
u8 * format_transport_proto(u8 *s, va_list *args)
u8 * format_ip46_address(u8 *s, va_list *args)
@ ECHO_SESSION_STATE_READY
volatile u64 bytes_received
u8 * echo_format_session_type(u8 *s, va_list *args)
@ ECHO_SESSION_TYPE_LISTEN
#define hash_unset(h, key)
foreach_app_session_field u64 vpp_session_handle
uword * session_index_by_vpp_handles
char * echo_fail_code_str[]
@ ECHO_SESSION_STATE_AWAIT_CLOSING
struct echo_main_t::@690 timing
uword * error_string_by_error_number
int echo_send_rpc(echo_main_t *em, void *fp, echo_rpc_args_t *args)
u8 * format_api_error(u8 *s, va_list *args)
void echo_session_print_stats(echo_main_t *em, echo_session_t *session)
uword unformat_ip6_address(unformat_input_t *input, va_list *args)
static_always_inline void clib_spinlock_lock(clib_spinlock_t *p)
@ ECHO_SESSION_STATE_AWAIT_DATA
@ ECHO_SESSION_STATE_CLOSING
svm_msg_q_t rpc_msq_queue
uword echo_unformat_close(unformat_input_t *input, va_list *args)
static f64 clib_time_now(clib_time_t *c)
echo_session_t * echo_session_new(echo_main_t *em)
@ ECHO_EVT_LAST_QCONNECTED
@ ECHO_EVT_FIRST_SCONNECT
u8 * echo_format_timing_event(u8 *s, va_list *args)
#define clib_atomic_fetch_add(a, b)
uword echo_unformat_timing_event(unformat_input_t *input, va_list *args)
u8 * echo_format_app_state(u8 *s, va_list *args)
@ ECHO_SESSION_STATE_INITIAL
u8 * echo_format_session(u8 *s, va_list *args)
clib_spinlock_t sid_vpp_handles_lock
description fragment has unexpected format
@ ECHO_EVT_LAST_SCONNECTED
u8 * echo_format_bytes_per_sec(u8 *s, va_list *args)
uword unformat_ip4_address(unformat_input_t *input, va_list *args)
static_always_inline void clib_spinlock_unlock(clib_spinlock_t *p)
void echo_session_handle_add_del(echo_main_t *em, u64 handle, u32 sid)
u8 * format_ip6_address(u8 *s, va_list *args)
volatile u32 nxt_available_sidx
uword unformat_ip46_address(unformat_input_t *input, va_list *args)
enum echo_test_evt_ echo_test_evt_t
u8 * echo_format_crypto_engine(u8 *s, va_list *args)
u8 * format_ip4_address(u8 *s, va_list *args)
#define ECHO_LOG(lvl, _fmt, _args...)
#define foreach_vnet_api_error
uword unformat_transport_proto(unformat_input_t *input, va_list *args)
uword echo_unformat_crypto_engine(unformat_input_t *input, va_list *args)
static u8 svm_msg_q_ring_is_full(svm_msg_q_t *mq, u32 ring_index)
@ ECHO_SESSION_STATE_CLOSED
void echo_notify_event(echo_main_t *em, echo_test_evt_t e)
#define hash_create(elts, value_bytes)
vl_api_fib_path_type_t type
void init_error_string_table()
echo_session_t * echo_get_session_from_handle(echo_main_t *em, u64 handle)
int wait_for_state_change(echo_main_t *em, connection_state_t state, f64 timeout)
static void svm_msg_q_unlock(svm_msg_q_t *mq)
Unlock message queue.