|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
45 if (
a.sep_ext.ext_cfg)
55 if (
a->sep_ext.ext_cfg)
208 u8 fifo_usage = fifo_in_use * 100 / fifo_size;
215 if (seg_usage < pm->low_watermark && fifo_usage > 50)
216 update_size = fifo_in_use;
217 else if (seg_usage < pm->high_watermark && fifo_usage > 80)
218 update_size = fifo_in_use;
220 update_size =
clib_min (update_size, sm->max_fifo_size - fifo_size);
229 update_size = (bytes / 2);
231 ASSERT (fifo_size >= 4096);
232 update_size =
clib_min (update_size, fifo_size - 4096);
291 return proto == TRANSPORT_PROTO_TLS;
320 u32 ao_thread_index = ao_tx_fifo->master_thread_index;
321 u32 ao_session_index = ao_tx_fifo->shr->master_session_index;
335 u32 max_dequeue, proxy_index;
336 int actual_transfer __attribute__ ((unused));
365 a->api_context = proxy_index;
554 u32 session_index = proxy_tx_fifo->shr->master_session_index;
637 u32 segment_size = 512 << 20;
644 a->name =
format (0,
"proxy-server");
684 a->name =
format (0,
"proxy-active-open");
698 | APP_OPTIONS_FLAGS_IS_PROXY;
731 if (
a->sep_ext.ext_cfg)
766 for (
i = 0;
i < num_threads;
i++)
787 for (
i = 0;
i < num_threads;
i++)
804 char *default_server_uri =
"tcp://0.0.0.0/23";
805 char *default_client_uri =
"tcp://6.0.2.2/23";
806 u8 *server_uri = 0, *client_uri = 0;
835 else if (
unformat (line_input,
"high-watermark %d", &tmp32))
837 else if (
unformat (line_input,
"low-watermark %d", &tmp32))
843 else if (
unformat (line_input,
"private-segment-count %d",
846 else if (
unformat (line_input,
"private-segment-size %U",
849 if (tmp64 >= 0x100000000ULL)
852 0,
"private segment size %lld (%llu) too large", tmp64, tmp64);
857 else if (
unformat (line_input,
"server-uri %s", &server_uri))
859 else if (
unformat (line_input,
"client-uri %s", &client_uri))
871 clib_warning (
"No server-uri provided, Using default: %s",
873 server_uri =
format (0,
"%s%c", default_server_uri, 0);
877 clib_warning (
"No client-uri provided, Using default: %s",
879 client_uri =
format (0,
"%s%c", default_client_uri, 0);
914 .path =
"test proxy server",
915 .short_help =
"test proxy server [server-uri <tcp://ip/port>]"
916 "[client-uri <tcp://ip/port>][fifo-size <nn>[k|m]]"
917 "[max-fifo-size <nn>[k|m]][high-watermark <nn>]"
918 "[low-watermark <nn>][rcv-buf-size <nn>][prealloc-fifos <nn>]"
919 "[private-segment-size <mem>][private-segment-count <nn>]",
static void clib_spinlock_init(clib_spinlock_t *p)
volatile int ao_disconnected
int vnet_listen(vnet_listen_args_t *a)
static u8 svm_fifo_set_event(svm_fifo_t *f)
Set fifo event flag.
session_endpoint_cfg_t sep
static u32 vlib_num_workers()
enum session_error_ session_error_t
#define hash_set(h, key, value)
static u32 svm_fifo_size(svm_fifo_t *f)
int vnet_connect(vnet_connect_args_t *a)
segment_manager_t * segment_manager_get(u32 index)
@ APP_OPTIONS_RX_FIFO_SIZE
u32 session_index
Index in thread pool where session was allocated.
@ SESSION_FT_ACTION_ENQUEUED
@ APP_OPTIONS_HIGH_WATERMARK
#define clib_memcpy(d, s, n)
u8 fifo_segment_get_mem_usage(fifo_segment_t *fs)
volatile int po_disconnected
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
proxy_session_t * sessions
Session pool, shared.
static int proxy_tx_callback(session_t *proxy_s)
static uword pointer_to_uword(const void *p)
volatile int active_open_establishing
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static clib_error_t * proxy_server_create_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void tcp_send_ack(tcp_connection_t *tc)
static int proxy_add_segment_callback(u32 client_index, u64 segment_handle)
static int active_open_create_callback(session_t *s)
int svm_fifo_peek(svm_fifo_t *f, u32 offset, u32 len, u8 *dst)
Peek data from fifo.
svm_fifo_t * server_rx_fifo
static void clib_mem_free(void *p)
static void proxy_call_main_thread(vnet_connect_args_t *a)
struct _tcp_connection tcp_connection_t
static void proxy_cb_fn(void *data, u32 data_len)
u32 private_segment_count
Number of private fifo segs.
struct _segment_manager segment_manager_t
#define clib_error_return(e, args...)
u8 low_watermark
low watermark (%)
struct _session_endpoint_cfg session_endpoint_cfg_t
u8 thread_index
Index of the thread that allocated the session.
#define pool_put(P, E)
Free an object E in pool P.
static int proxy_server_create(vlib_main_t *vm)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static int common_fifo_tuning_callback(session_t *s, svm_fifo_t *f, session_ft_action_t act, u32 bytes)
@ APP_OPTIONS_SEGMENT_SIZE
struct _transport_connection transport_connection_t
static vlib_cli_command_t proxy_create_command
(constructor) VLIB_CLI_COMMAND (proxy_create_command)
u32 server_client_index
server API client handle
#define hash_unset(h, key)
session_handle_t vpp_server_handle
int(* session_accept_callback)(session_t *new_session)
Notify server of newly accepted session.
uword * proxy_session_by_server_handle
struct _svm_fifo svm_fifo_t
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
static int active_open_connected_callback(u32 app_index, u32 opaque, session_t *s, session_error_t err)
svm_msg_q_t ** server_event_queue
per-thread vectors
@ SESSION_CLEANUP_TRANSPORT
static int proxy_server_listen()
session_handle_t vpp_active_open_handle
@ SVM_FIFO_WANT_DEQ_NOTIF
Notify on dequeue.
enum session_ft_action_ session_ft_action_t
svm_fifo_t * rx_fifo
Pointers to rx/tx buffers.
static void session_endpoint_alloc_ext_cfg(session_endpoint_cfg_t *sep_ext, transport_endpt_ext_cfg_type_t type)
struct _vnet_disconnect_args_t vnet_disconnect_args_t
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static int proxy_accept_callback(session_t *s)
transport_connection_t * session_get_transport(session_t *s)
static u32 svm_fifo_max_enqueue(svm_fifo_t *f)
static const char test_srv_key_rsa[]
static svm_msg_q_t * session_main_get_vpp_event_queue(u32 thread_index)
session_endpoint_cfg_t client_sep
static int proxy_server_attach()
u32 fifo_size
initial fifo size
static_always_inline uword vlib_get_thread_index(void)
svm_msg_q_t ** active_open_event_queue
int session_send_io_evt_to_thread_custom(void *data, u32 thread_index, session_evt_type_t evt_type)
struct _vnet_bind_args_t vnet_listen_args_t
clib_spinlock_t sessions_lock
static proxy_session_t * proxy_get_passive_open(proxy_main_t *pm, session_handle_t handle)
u32 private_segment_size
size of private fifo segs
static proxy_session_t * proxy_get_active_open(proxy_main_t *pm, session_handle_t handle)
static void active_open_disconnect_callback(session_t *s)
u32 server_app_index
server app index
fifo_segment_t * segment_manager_get_segment(segment_manager_t *sm, u32 segment_index)
Reads a segment from the segment manager's pool without lock.
static int proxy_transport_needs_crypto(transport_proto_t proto)
void session_send_rpc_evt_to_thread(u32 thread_index, void *fp, void *rpc_args)
static int active_open_attach(void)
static session_handle_t session_handle(session_t *s)
@ SESSION_FT_ACTION_N_ACTIONS
static session_t * session_get_from_handle(session_handle_t handle)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
static u32 svm_fifo_max_dequeue_prod(svm_fifo_t *f)
Fifo max bytes to dequeue optimized for producer.
#define VLIB_CLI_COMMAND(x,...)
void(* session_reset_callback)(session_t *s)
Notify app that session was reset.
static void active_open_reset_callback(session_t *s)
@ APP_OPTIONS_ACCEPT_COOKIE
int vnet_app_add_cert_key_pair(vnet_app_add_cert_key_pair_args_t *a)
int vnet_disconnect_session(vnet_disconnect_args_t *a)
uword * proxy_session_by_active_open_handle
struct _vnet_app_add_cert_key_pair_args_ vnet_app_add_cert_key_pair_args_t
@ APP_OPTIONS_PREALLOC_FIFO_PAIRS
int vnet_application_attach(vnet_app_attach_args_t *a)
Attach application to vpp.
static session_cb_vft_t active_open_clients
static void proxy_disconnect_callback(session_t *s)
#define vec_free(V)
Free vector's memory (no header).
@ APP_OPTIONS_TX_FIFO_SIZE
static const char test_srv_crt_rsa[]
@ APP_OPTIONS_ADD_SEGMENT_SIZE
static int proxy_connected_callback(u32 app_index, u32 api_context, session_t *s, session_error_t err)
description fragment has unexpected format
static void svm_fifo_set_size(svm_fifo_t *f, u32 size)
static void active_open_cleanup_callback(session_t *s, session_cleanup_ntf_t ntf)
clib_error_t * proxy_main_init(vlib_main_t *vm)
#define VLIB_INIT_FUNCTION(x)
static struct option options[]
static void proxy_cleanup_callback(session_t *s, session_cleanup_ntf_t ntf)
enum _transport_proto transport_proto_t
u32 max_fifo_size
max fifo size
void vl_api_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
static const u32 test_srv_crt_rsa_len
struct _vnet_connect_args vnet_connect_args_t
static void proxy_try_delete_session(session_t *s, u8 is_active_open)
int parse_uri(char *uri, session_endpoint_cfg_t *sep)
#define SESSION_INVALID_HANDLE
static void proxy_server_add_ckpair(void)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static transport_proto_t session_get_transport_proto(session_t *s)
#define pool_get_zero(P, E)
Allocate an object E from a pool P and zero it.
static session_cb_vft_t proxy_session_cb_vft
static void proxy_session_free(proxy_session_t *ps)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
#define uword_to_pointer(u, type)
u8 ** rx_buf
intermediate rx buffers
static void proxy_try_close_session(session_t *s, int is_active_open)
svm_fifo_t * server_tx_fifo
#define clib_warning(format, args...)
static int active_open_rx_callback(session_t *s)
static void proxy_force_ack(void *handlep)
static void proxy_reset_callback(session_t *s)
u32 active_open_client_index
active open API client handle
static int proxy_rx_callback(session_t *s)
u8 high_watermark
high watermark (%)
struct _vnet_app_attach_args_t vnet_app_attach_args_t
static int active_open_tx_callback(session_t *ao_s)
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
static vlib_thread_main_t * vlib_get_thread_main()
static u32 svm_fifo_max_dequeue_cons(svm_fifo_t *f)
Fifo max bytes to dequeue optimized for consumer.
#define hash_create(elts, value_bytes)
@ APP_OPTIONS_MAX_FIFO_SIZE
static void svm_fifo_add_want_deq_ntf(svm_fifo_t *f, u8 ntf_type)
Set specific want notification flag.
int session_send_io_evt_to_thread(svm_fifo_t *f, session_evt_type_t evt_type)
volatile u8 session_state
State in session layer state machine.
@ TRANSPORT_ENDPT_EXT_CFG_CRYPTO
@ APP_OPTIONS_PRIVATE_SEGMENT_COUNT
u32 active_open_app_index
active open index after attach
@ APP_OPTIONS_LOW_WATERMARK
session_endpoint_cfg_t server_sep
clib_error_t * vnet_session_enable_disable(vlib_main_t *vm, u8 is_en)
static const u32 test_srv_key_rsa_len
u8 prealloc_fifos
Request fifo preallocation.