X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvcl%2Fvppcom.c;h=d81e327c7f1175c3884dd2b687305367c3388e27;hb=refs%2Fchanges%2F20%2F10620%2F4;hp=373304ba120ba1d49992deb2f408313b9e48e672;hpb=2167355e1657af1991085b880bb0dd0331093f4e;p=vpp.git diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index 373304ba120..d81e327c7f1 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -157,7 +157,6 @@ typedef struct u32 wait_cont_idx; vppcom_epoll_t vep; int libc_epfd; - u32 vrf; vppcom_ip46_t lcl_addr; vppcom_ip46_t peer_addr; u16 lcl_port; // network order @@ -191,6 +190,7 @@ typedef struct vppcom_cfg_t_ f64 accept_timeout; u32 event_ring_size; char *event_log_path; + u8 *vpp_api_filename; } vppcom_cfg_t; typedef struct vppcom_main_t_ @@ -200,7 +200,7 @@ typedef struct vppcom_main_t_ u32 *client_session_index_fifo; int main_cpu; - /* vpe input queue */ + /* vpp input queue */ svm_queue_t *vl_input_queue; /* API client handle */ @@ -424,13 +424,17 @@ static int vppcom_connect_to_vpp (char *app_name) { api_main_t *am = &api_main; + vppcom_cfg_t *vcl_cfg = &vcm->cfg; int rv = VPPCOM_OK; + if (!vcl_cfg->vpp_api_filename) + vcl_cfg->vpp_api_filename = format (0, "/vpe-api%c", 0); + if (VPPCOM_DEBUG > 0) - clib_warning ("VCL<%d>: app (%s) connecting to VPP api...", - getpid (), app_name); + clib_warning ("VCL<%d>: app (%s) connecting to VPP api (%s)...", + getpid (), app_name, vcl_cfg->vpp_api_filename); - if (vl_client_connect_to_vlib ("/vpe-api", app_name, + if (vl_client_connect_to_vlib ((char *) vcl_cfg->vpp_api_filename, app_name, vcm->cfg.vpp_api_q_length) < 0) { clib_warning ("VCL<%d>: app (%s) connect failed!", getpid (), app_name); @@ -441,6 +445,10 @@ vppcom_connect_to_vpp (char *app_name) vcm->vl_input_queue = am->shmem_hdr->vl_input_queue; vcm->my_client_index = am->my_client_index; vcm->app_state = STATE_APP_CONN_VPP; + + if (VPPCOM_DEBUG > 0) + clib_warning ("VCL<%d>: app (%s) is connected to VPP!", + getpid (), app_name); } if (VPPCOM_DEBUG > 0) @@ -471,9 +479,6 @@ vppcom_connect_to_vpp (char *app_name) ed->data = rv; /* *INDENT-ON* */ } - - clib_warning ("VCL<%d>: app (%s) is connected to VPP!", - getpid (), app_name); return rv; } @@ -497,7 +502,7 @@ vppcom_init_error_string_table (void) { vcm->error_string_by_error_number = hash_create (0, sizeof (uword)); -#define _(n,v,s) hash_set (vcm->error_string_by_error_number, -v, s); +#define _(n, v, s) hash_set (vcm->error_string_by_error_number, -v, s); foreach_vnet_api_error; #undef _ @@ -558,12 +563,12 @@ vppcom_wait_for_session_state_change (u32 session_index, clib_spinlock_unlock (&vcm->sessions_lockp); return rv; } - if (session->state == state) + if (session->state & state) { clib_spinlock_unlock (&vcm->sessions_lockp); return VPPCOM_OK; } - if (session->state == STATE_FAILED) + if (session->state & STATE_FAILED) { clib_spinlock_unlock (&vcm->sessions_lockp); return VPPCOM_ECONNREFUSED; @@ -942,7 +947,7 @@ vl_api_connect_session_reply_t_handler (vl_api_connect_session_reply_t * mp) u32 session_index; svm_fifo_t *rx_fifo, *tx_fifo; u8 is_cut_thru = 0; - int rv; + int rv = VPPCOM_OK; session_index = mp->context; VCL_LOCK_AND_GET_SESSION (session_index, &session); @@ -953,7 +958,7 @@ done: "connect failed! %U", getpid (), mp->handle, session_index, format_api_error, ntohl (mp->retval)); - if (rv == VPPCOM_OK) + if (session) { session->state = STATE_FAILED; session->vpp_handle = mp->handle; @@ -1042,7 +1047,6 @@ vppcom_send_connect_sock (session_t * session, u32 session_index) cmp->client_index = vcm->my_client_index; cmp->context = session_index; - cmp->vrf = session->vrf; cmp->is_ip4 = session->peer_addr.is_ip4; clib_memcpy (cmp->ip, &session->peer_addr.ip46, sizeof (cmp->ip)); cmp->port = session->peer_port; @@ -1322,7 +1326,7 @@ vl_api_accept_session_t_handler (vl_api_accept_session_t * mp) if (session->peer_addr.is_ip4) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = @@ -1487,7 +1491,6 @@ vppcom_send_bind_sock (session_t * session, u32 session_index) bmp->_vl_msg_id = ntohs (VL_API_BIND_SOCK); bmp->client_index = vcm->my_client_index; bmp->context = session_index; - bmp->vrf = session->vrf; bmp->is_ip4 = session->lcl_addr.is_ip4; clib_memcpy (bmp->ip, &session->lcl_addr.ip46, sizeof (bmp->ip)); bmp->port = session->lcl_port; @@ -1632,7 +1635,6 @@ vppcom_session_disconnect (u32 session_index) { if (is_server) { - svm_fifo_segment_main_t *sm = &svm_fifo_segment_main; svm_fifo_segment_private_t *seg; VCL_LOCK_AND_GET_SESSION (session_index, &session); @@ -1648,7 +1650,7 @@ vppcom_session_disconnect (u32 session_index) session->server_tx_fifo, session->server_tx_fifo->refcnt); - seg = vec_elt_at_index (sm->segments, session->sm_seg_index); + seg = svm_fifo_segment_get_segment (session->sm_seg_index); svm_fifo_segment_free_fifo (seg, session->server_rx_fifo, FIFO_SEGMENT_RX_FREELIST); svm_fifo_segment_free_fifo (seg, session->server_tx_fifo, @@ -1686,7 +1688,7 @@ _(MAP_ANOTHER_SEGMENT, map_another_segment) static void vppcom_api_hookup (void) { -#define _(N,n) \ +#define _(N, n) \ vl_msg_api_set_handlers(VL_API_##N, #n, \ vl_api_##n##_t_handler, \ vl_noop_handler, \ @@ -1739,12 +1741,20 @@ vppcom_cfg_heapsize (char *conf_fname) if (fp == NULL) { if (VPPCOM_DEBUG > 0) - fprintf (stderr, "open configuration file '%s' failed\n", conf_fname); + clib_warning ("VCL<%d>: using default heapsize %lld (0x%llx)", + getpid (), vcl_cfg->heapsize, vcl_cfg->heapsize); goto defaulted; } + argv = calloc (1, sizeof (char *)); if (argv == NULL) - goto defaulted; + { + if (VPPCOM_DEBUG > 0) + clib_warning ("VCL<%d>: calloc failed, using default " + "heapsize %lld (0x%llx)", + getpid (), vcl_cfg->heapsize, vcl_cfg->heapsize); + goto defaulted; + } while (1) { @@ -1758,11 +1768,25 @@ vppcom_cfg_heapsize (char *conf_fname) argc++; char **tmp = realloc (argv, argc * sizeof (char *)); if (tmp == NULL) - goto defaulted; + { + if (VPPCOM_DEBUG > 0) + clib_warning ("VCL<%d>: realloc failed, " + "using default heapsize %lld (0x%llx)", + getpid (), vcl_cfg->heapsize, + vcl_cfg->heapsize); + goto defaulted; + } argv = tmp; arg = strndup (p, 1024); if (arg == NULL) - goto defaulted; + { + if (VPPCOM_DEBUG > 0) + clib_warning ("VCL<%d>: strndup failed, " + "using default heapsize %lld (0x%llx)", + getpid (), vcl_cfg->heapsize, + vcl_cfg->heapsize); + goto defaulted; + } argv[argc - 1] = arg; p = strtok (NULL, " \t\n"); } @@ -1773,7 +1797,13 @@ vppcom_cfg_heapsize (char *conf_fname) char **tmp = realloc (argv, (argc + 1) * sizeof (char *)); if (tmp == NULL) - goto defaulted; + { + if (VPPCOM_DEBUG > 0) + clib_warning ("VCL<%d>: realloc failed, " + "using default heapsize %lld (0x%llx)", + getpid (), vcl_cfg->heapsize, vcl_cfg->heapsize); + goto defaulted; + } argv = tmp; argv[argc] = NULL; @@ -1835,18 +1865,21 @@ defaulted: "PROT_READ | PROT_WRITE,MAP_SHARED | MAP_ANONYMOUS, " "-1, 0) failed!", getpid (), vcl_cfg->heapsize, vcl_cfg->heapsize); + ASSERT (vcl_mem != MAP_FAILED); return; } heap = clib_mem_init (vcl_mem, vcl_cfg->heapsize); if (!heap) { clib_warning ("VCL<%d>: ERROR: clib_mem_init() failed!", getpid ()); + ASSERT (heap); return; } vcl_mem = clib_mem_alloc (sizeof (_vppcom_main)); if (!vcl_mem) { clib_warning ("VCL<%d>: ERROR: clib_mem_alloc() failed!", getpid ()); + ASSERT (vcl_mem); return; } @@ -1874,7 +1907,7 @@ vppcom_cfg_read (char *conf_fname) if (fd < 0) { if (VPPCOM_DEBUG > 0) - clib_warning ("VCL<%d>: open configuration file '%s' failed!", + clib_warning ("VCL<%d>: using default configuration.", getpid (), conf_fname); goto file_done; } @@ -1882,15 +1915,16 @@ vppcom_cfg_read (char *conf_fname) if (fstat (fd, &s) < 0) { if (VPPCOM_DEBUG > 0) - clib_warning ("VCL<%d>: failed to stat `%s'", getpid (), conf_fname); + clib_warning ("VCL<%d>: failed to stat `%s', " + "using default configuration", getpid (), conf_fname); goto file_done; } if (!(S_ISREG (s.st_mode) || S_ISLNK (s.st_mode))) { if (VPPCOM_DEBUG > 0) - clib_warning ("VCL<%d>: not a regular file `%s'", - getpid (), conf_fname); + clib_warning ("VCL<%d>: not a regular file `%s', " + "using default configuration", getpid (), conf_fname); goto file_done; } @@ -1922,10 +1956,16 @@ vppcom_cfg_read (char *conf_fname) else if (unformat (line_input, "api-prefix %s", &chroot_path)) { vec_terminate_c_string (chroot_path); + if (vcl_cfg->vpp_api_filename) + vec_free (vcl_cfg->vpp_api_filename); + vcl_cfg->vpp_api_filename = format (0, "/%s-vpe-api%c", + chroot_path, 0); vl_set_memory_root_path ((char *) chroot_path); + if (VPPCOM_DEBUG > 0) - clib_warning ("VCL<%d>: configured api-prefix %s", - getpid (), chroot_path); + clib_warning ("VCL<%d>: configured api-prefix (%s) and " + "api filename (%s)", getpid (), chroot_path, + vcl_cfg->vpp_api_filename); chroot_path = 0; /* Don't vec_free() it! */ } else if (unformat (line_input, "vpp-api-q-length %d", &q_len)) @@ -2218,16 +2258,46 @@ vppcom_app_create (char *app_name) } conf_fname = getenv (VPPCOM_ENV_CONF); if (!conf_fname) - { - conf_fname = VPPCOM_CONF_DEFAULT; - if (VPPCOM_DEBUG > 0) - clib_warning ("VCL<%d>: getenv '%s' failed!", getpid (), - VPPCOM_ENV_CONF); - } + conf_fname = VPPCOM_CONF_DEFAULT; vppcom_cfg_heapsize (conf_fname); + vcl_cfg = &vcm->cfg; clib_fifo_validate (vcm->client_session_index_fifo, vcm->cfg.listen_queue_size); vppcom_cfg_read (conf_fname); + + env_var_str = getenv (VPPCOM_ENV_API_PREFIX); + if (env_var_str) + { + if (vcl_cfg->vpp_api_filename) + vec_free (vcl_cfg->vpp_api_filename); + vcl_cfg->vpp_api_filename = format (0, "/%s-vpe-api%c", + env_var_str, 0); + vl_set_memory_root_path ((char *) env_var_str); + + if (VPPCOM_DEBUG > 0) + clib_warning ("VCL<%d>: configured api prefix (%s) and " + "filename (%s) from " VPPCOM_ENV_API_PREFIX "!", + getpid (), env_var_str, vcl_cfg->vpp_api_filename); + } + + env_var_str = getenv (VPPCOM_ENV_APP_NAMESPACE_SECRET); + if (env_var_str) + { + u64 tmp; + if (sscanf (env_var_str, "%lu", &tmp) != 1) + clib_warning ("VCL<%d>: Invalid namespace secret specified in " + "the environment variable " + VPPCOM_ENV_APP_NAMESPACE_SECRET + " (%s)!\n", getpid (), env_var_str); + else + { + vcm->cfg.namespace_secret = tmp; + if (VPPCOM_DEBUG > 0) + clib_warning ("VCL<%d>: configured namespace secret " + "(%lu) from " VPPCOM_ENV_APP_NAMESPACE_ID "!", + getpid (), vcm->cfg.namespace_secret); + } + } env_var_str = getenv (VPPCOM_ENV_APP_NAMESPACE_ID); if (env_var_str) { @@ -2239,8 +2309,8 @@ vppcom_app_create (char *app_name) if (VPPCOM_DEBUG > 0) clib_warning ("VCL<%d>: configured namespace_id (%v) from " - VPPCOM_ENV_APP_NAMESPACE_ID "!", getpid (), - vcm->cfg.namespace_id); + VPPCOM_ENV_APP_NAMESPACE_ID + "!", getpid (), vcm->cfg.namespace_id); } env_var_str = getenv (VPPCOM_ENV_APP_NAMESPACE_SECRET); if (env_var_str) @@ -2256,8 +2326,9 @@ vppcom_app_create (char *app_name) vcm->cfg.namespace_secret = tmp; if (VPPCOM_DEBUG > 0) clib_warning ("VCL<%d>: configured namespace secret " - "(%lu) from " VPPCOM_ENV_APP_NAMESPACE_ID "!", - getpid (), vcm->cfg.namespace_secret); + "(%lu) from " + VPPCOM_ENV_APP_NAMESPACE_ID + "!", getpid (), vcm->cfg.namespace_secret); } } if (getenv (VPPCOM_ENV_APP_PROXY_TRANSPORT_TCP)) @@ -2265,7 +2336,8 @@ vppcom_app_create (char *app_name) vcm->cfg.app_proxy_transport_tcp = 1; if (VPPCOM_DEBUG > 0) clib_warning ("VCL<%d>: configured app_proxy_transport_tcp " - "(%u) from " VPPCOM_ENV_APP_PROXY_TRANSPORT_TCP + "(%u) from " + VPPCOM_ENV_APP_PROXY_TRANSPORT_TCP "!", getpid (), vcm->cfg.app_proxy_transport_tcp); } if (getenv (VPPCOM_ENV_APP_PROXY_TRANSPORT_UDP)) @@ -2273,7 +2345,8 @@ vppcom_app_create (char *app_name) vcm->cfg.app_proxy_transport_udp = 1; if (VPPCOM_DEBUG > 0) clib_warning ("VCL<%d>: configured app_proxy_transport_udp " - "(%u) from " VPPCOM_ENV_APP_PROXY_TRANSPORT_UDP + "(%u) from " + VPPCOM_ENV_APP_PROXY_TRANSPORT_UDP "!", getpid (), vcm->cfg.app_proxy_transport_udp); } if (getenv (VPPCOM_ENV_APP_SCOPE_LOCAL)) @@ -2281,16 +2354,16 @@ vppcom_app_create (char *app_name) vcm->cfg.app_scope_local = 1; if (VPPCOM_DEBUG > 0) clib_warning ("VCL<%d>: configured app_scope_local (%u) from " - VPPCOM_ENV_APP_SCOPE_LOCAL "!", getpid (), - vcm->cfg.app_scope_local); + VPPCOM_ENV_APP_SCOPE_LOCAL + "!", getpid (), vcm->cfg.app_scope_local); } if (getenv (VPPCOM_ENV_APP_SCOPE_GLOBAL)) { vcm->cfg.app_scope_global = 1; if (VPPCOM_DEBUG > 0) clib_warning ("VCL<%d>: configured app_scope_global (%u) from " - VPPCOM_ENV_APP_SCOPE_GLOBAL "!", getpid (), - vcm->cfg.app_scope_global); + VPPCOM_ENV_APP_SCOPE_GLOBAL + "!", getpid (), vcm->cfg.app_scope_global); } vcm->main_cpu = os_get_thread_index (); @@ -2304,8 +2377,8 @@ vppcom_app_create (char *app_name) clib_time_init (&vcm->clib_time); vppcom_init_error_string_table (); - svm_fifo_segment_init (vcl_cfg->segment_baseva, - 20 /* timeout in secs */ ); + svm_fifo_segment_main_init (vcl_cfg->segment_baseva, + 20 /* timeout in secs */ ); clib_spinlock_init (&vcm->sessions_lockp); } @@ -2402,7 +2475,7 @@ vppcom_app_destroy (void) } int -vppcom_session_create (u32 vrf, u8 proto, u8 is_nonblocking) +vppcom_session_create (u8 proto, u8 is_nonblocking) { session_t *session; u32 session_index; @@ -2412,7 +2485,6 @@ vppcom_session_create (u32 vrf, u8 proto, u8 is_nonblocking) memset (session, 0, sizeof (*session)); session_index = session - vcm->sessions; - session->vrf = vrf; session->proto = proto; session->state = STATE_START; session->is_nonblocking = is_nonblocking ? 1 : 0; @@ -2432,20 +2504,19 @@ vppcom_session_create (u32 vrf, u8 proto, u8 is_nonblocking) /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { - .format = "session_create:vrf:%d proto:%d state:%d is_nonblocking:%d", - .format_args = "i4i4i4i4", + .format = "session_create:proto:%d state:%d is_nonblocking:%d", + .format_args = "i4i4i4", }; struct { - u32 data[4]; + u32 data[3]; } *ed; ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track); - ed->data[0] = session->vrf; - ed->data[1] = session->proto; - ed->data[2] = session->state; - ed->data[3] = session->is_nonblocking; + ed->data[0] = session->proto; + ed->data[1] = session->state; + ed->data[2] = session->is_nonblocking; /* *INDENT-ON* */ } @@ -2518,7 +2589,7 @@ vppcom_session_close (uint32_t session_index) if (is_listen) { - if (state == STATE_LISTEN) + if (state & STATE_LISTEN) { rv = vppcom_session_unbind (session_index); if (PREDICT_FALSE (rv < 0)) @@ -2607,7 +2678,6 @@ vppcom_session_bind (uint32_t session_index, vppcom_endpt_t * ep) goto done; } - session->vrf = ep->vrf; session->lcl_addr.is_ip4 = ep->is_ip4; session->lcl_addr.ip46 = to_ip46 (!ep->is_ip4, ep->ip); session->lcl_port = ep->port; @@ -2625,7 +2695,7 @@ vppcom_session_bind (uint32_t session_index, vppcom_endpt_t * ep) { if (session->lcl_addr.is_ip4) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "bind local:%s:%d.%d.%d.%d:%d ", @@ -2722,7 +2792,7 @@ vppcom_session_accept (uint32_t listen_session_index, vppcom_endpt_t * ep, { session_t *listen_session = 0; session_t *client_session = 0; - u32 client_session_index = ~0; + u32 client_session_index = ~0, n_fifos; int rv; f64 wait_for; char *cut_thru_str; @@ -2795,7 +2865,6 @@ vppcom_session_accept (uint32_t listen_session_index, vppcom_endpt_t * ep, if (ep) { - ep->vrf = client_session->vrf; ep->is_cut_thru = client_session->is_cut_thru; ep->is_ip4 = client_session->peer_addr.is_ip4; ep->port = client_session->peer_port; @@ -2821,9 +2890,6 @@ vppcom_session_accept (uint32_t listen_session_index, vppcom_endpt_t * ep, format ((u8 *) a->segment_name, "%d:segment%d%c", getpid (), vcm->unique_segment_index++, 0); a->segment_size = vcm->cfg.segment_size; - a->preallocated_fifo_pairs = vcm->cfg.preallocated_fifo_pairs; - a->rx_fifo_size = vcm->cfg.rx_fifo_size; - a->tx_fifo_size = vcm->cfg.tx_fifo_size; rv = svm_fifo_segment_create (a); if (PREDICT_FALSE (rv)) @@ -2850,6 +2916,14 @@ vppcom_session_accept (uint32_t listen_session_index, vppcom_endpt_t * ep, vec_free (a->new_segment_indices); seg = svm_fifo_segment_get_segment (client_session->sm_seg_index); + if (vcm->cfg.preallocated_fifo_pairs) + { + n_fifos = vcm->cfg.preallocated_fifo_pairs; + svm_fifo_segment_preallocate_fifo_pairs (seg, vcm->cfg.rx_fifo_size, + vcm->cfg.tx_fifo_size, + &n_fifos); + } + client_session->server_rx_fifo = svm_fifo_segment_alloc_fifo (seg, vcm->cfg.rx_fifo_size, FIFO_SEGMENT_RX_FREELIST); @@ -2972,7 +3046,7 @@ vppcom_session_accept (uint32_t listen_session_index, vppcom_endpt_t * ep, if (client_session->lcl_addr.is_ip4) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e2) = { .format = "accept cut-thru: S:%d %d.%d.%d.%d:%d ", @@ -3049,7 +3123,6 @@ vppcom_session_connect (uint32_t session_index, vppcom_endpt_t * server_ep) goto done; } - session->vrf = server_ep->vrf; session->peer_addr.is_ip4 = server_ep->is_ip4; session->peer_addr.ip46 = to_ip46 (!server_ep->is_ip4, server_ep->ip); session->peer_port = server_ep->port; @@ -3126,8 +3199,7 @@ vppcom_session_read_internal (uint32_t session_index, void *buf, int n, if (PREDICT_FALSE (!(state & (SERVER_STATE_OPEN | CLIENT_STATE_OPEN)))) { clib_spinlock_unlock (&vcm->sessions_lockp); - rv = ((state == STATE_DISCONNECT) ? - VPPCOM_ECONNRESET : VPPCOM_ENOTCONN); + rv = ((state & STATE_DISCONNECT) ? VPPCOM_ECONNRESET : VPPCOM_ENOTCONN); if (VPPCOM_DEBUG > 0) clib_warning ("VCL<%d>: vpp handle 0x%llx, sid %u: %s session is " @@ -3163,7 +3235,7 @@ vppcom_session_read_internal (uint32_t session_index, void *buf, int n, if (poll_et) session->vep.et_mask |= EPOLLIN; - if (state == STATE_CLOSE_ON_EMPTY) + if (state & STATE_CLOSE_ON_EMPTY) { session_state_t new_state = STATE_DISCONNECT; rv = VPPCOM_ECONNRESET; @@ -3243,7 +3315,7 @@ vppcom_session_read_ready (session_t * session, u32 session_index) { if (!(state & (SERVER_STATE_OPEN | CLIENT_STATE_OPEN | STATE_LISTEN))) { - rv = ((state == STATE_DISCONNECT) ? VPPCOM_ECONNRESET : + rv = ((state & STATE_DISCONNECT) ? VPPCOM_ECONNRESET : VPPCOM_ENOTCONN); if (VPPCOM_DEBUG > 1) @@ -3269,7 +3341,7 @@ vppcom_session_read_ready (session_t * session, u32 session_index) if (poll_et) session->vep.et_mask |= EPOLLIN; - if (state == STATE_CLOSE_ON_EMPTY) + if (state & STATE_CLOSE_ON_EMPTY) { rv = VPPCOM_ECONNRESET; session_state_t new_state = STATE_DISCONNECT; @@ -3343,8 +3415,7 @@ vppcom_session_write (uint32_t session_index, void *buf, size_t n) state = session->state; if (!(state & (SERVER_STATE_OPEN | CLIENT_STATE_OPEN))) { - rv = ((state == STATE_DISCONNECT) ? VPPCOM_ECONNRESET : - VPPCOM_ENOTCONN); + rv = ((state & STATE_DISCONNECT) ? VPPCOM_ECONNRESET : VPPCOM_ENOTCONN); clib_spinlock_unlock (&vcm->sessions_lockp); if (VPPCOM_DEBUG > 1) @@ -3396,7 +3467,7 @@ vppcom_session_write (uint32_t session_index, void *buf, size_t n) if (poll_et) session->vep.et_mask |= EPOLLOUT; - if (state == STATE_CLOSE_ON_EMPTY) + if (state & STATE_CLOSE_ON_EMPTY) { session_state_t new_state = STATE_DISCONNECT; rv = VPPCOM_ECONNRESET; @@ -3472,8 +3543,7 @@ vppcom_session_write_ready (session_t * session, u32 session_index) { session_state_t state = session->state; - rv = ((state == STATE_DISCONNECT) ? VPPCOM_ECONNRESET : - VPPCOM_ENOTCONN); + rv = ((state & STATE_DISCONNECT) ? VPPCOM_ECONNRESET : VPPCOM_ENOTCONN); clib_warning ("VCL<%d>: ERROR: vpp handle 0x%llx, sid %u: " "%s session is not open! state 0x%x (%s), " @@ -3504,7 +3574,7 @@ vppcom_session_write_ready (session_t * session, u32 session_index) if (poll_et) session->vep.et_mask |= EPOLLOUT; - if (state == STATE_CLOSE_ON_EMPTY) + if (state & STATE_CLOSE_ON_EMPTY) { rv = VPPCOM_ECONNRESET; session_state_t new_state = STATE_DISCONNECT; @@ -3889,7 +3959,7 @@ vppcom_epoll_ctl (uint32_t vep_idx, int op, uint32_t session_index, event->events, event->data.u64); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "epoll_ctladd: events:%x data:%x", @@ -4005,7 +4075,7 @@ vppcom_epoll_ctl (uint32_t vep_idx, int op, uint32_t session_index, getpid (), vep_idx, session_index); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "epoll_ctldel: vep:%d", @@ -4075,7 +4145,7 @@ vppcom_epoll_wait (uint32_t vep_idx, struct epoll_event *events, getpid (), vep_idx); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "WRN: vep_idx:%d empty", @@ -4125,7 +4195,7 @@ vppcom_epoll_wait (uint32_t vep_idx, struct epoll_event *events, getpid (), vep_idx); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "ERR:vep_idx:%d is vep", @@ -4152,7 +4222,7 @@ vppcom_epoll_wait (uint32_t vep_idx, struct epoll_event *events, "a vep session!", getpid (), sid); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "ERR:SID:%d not vep", @@ -4301,7 +4371,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, getpid (), rv); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "VPPCOM_ATTR_GET_NREAD: nread=%d", @@ -4327,7 +4397,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, getpid (), session_index, rv); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "VPPCOM_ATTR_GET_NWRITE: nwrite=%d", @@ -4356,7 +4426,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, session_index, *flags, session->is_nonblocking); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "VPPCOM_ATTR_GET_FLAGS: flags=%x is_nonblk=%d", @@ -4391,7 +4461,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, session->is_nonblocking); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "VPPCOM_ATTR_SET_FLAGS: flags=%x is_nonblk=%d", @@ -4418,7 +4488,6 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, if (PREDICT_TRUE (buffer && buflen && (*buflen >= sizeof (*ep)) && ep->ip)) { - ep->vrf = session->vrf; ep->is_ip4 = session->peer_addr.is_ip4; ep->port = session->peer_port; if (session->peer_addr.is_ip4) @@ -4438,7 +4507,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, { if (ep->is_ip4) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "VPPCOM_ATTR_GET_PEER_ADDR: addr:%d.%d.%d.%d:%d", @@ -4460,7 +4529,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, } else { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "VPPCOM_ATTR_GET_PEER_ADDR: addr:IP6:%d", @@ -4485,7 +4554,6 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, if (PREDICT_TRUE (buffer && buflen && (*buflen >= sizeof (*ep)) && ep->ip)) { - ep->vrf = session->vrf; ep->is_ip4 = session->lcl_addr.is_ip4; ep->port = session->lcl_port; if (session->lcl_addr.is_ip4) @@ -4505,7 +4573,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, { if (ep->is_ip4) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "VPPCOM_ATTR_GET_LCL_ADDR: addr:%d.%d.%d.%d:%d", @@ -4527,7 +4595,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, } else { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "VPPCOM_ATTR_GET_LCL_ADDR: addr:IP6:%d", @@ -4555,24 +4623,18 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, getpid (), rv); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { - .format = "VPPCOM_ATTR_GET_LIBC_EPFD: libc_epfd=%s%d buflen=%d", - .format_args = "t1i4i4", - .n_enum_strings = 2, - .enum_strings = {"", "-",}, + .format = "VPPCOM_ATTR_GET_LIBC_EPFD: libc_epfd=%d", + .format_args = "i4", }; CLIB_PACKED (struct { - u8 sign; - u32 data[2]; + i32 data; }) * ed; ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track); - - ed->sign = (session->libc_epfd < 0); - ed->data[0] = abs(session->libc_epfd); - ed->data[1] = *buflen; + ed->data = session->libc_epfd; /* *INDENT-ON* */ } @@ -4591,7 +4653,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, *buflen); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "VPPCOM_ATTR_SET_LIBC_EPFD: libc_epfd=%s%d buflen=%d", @@ -4628,7 +4690,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, *(int *) buffer ? "UDP" : "TCP", *buflen); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "VPPCOM_ATTR_GET_PROTOCOL: %s buflen=%d", @@ -4664,7 +4726,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, "buflen %d", getpid (), *(int *) buffer, *buflen); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "VPPCOM_ATTR_GET_LISTEN: %d buflen=%d", @@ -4697,7 +4759,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, *(int *) buffer, *buflen); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "VPPCOM_ATTR_GET_ERROR: %d buflen=%d", @@ -4738,7 +4800,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, *(size_t *) buffer, *(size_t *) buffer, *buflen); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "VPPCOM_ATTR_GET_TX_FIFO_LEN: 0x%x buflen=%d", @@ -4771,7 +4833,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, *buflen); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "VPPCOM_ATTR_SET_TX_FIFO_LEN: 0x%x buflen=%d", @@ -4812,7 +4874,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, *(size_t *) buffer, *(size_t *) buffer, *buflen); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "VPPCOM_ATTR_GET_RX_FIFO_LEN: 0x%x buflen=%d", @@ -4839,16 +4901,16 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, /* VPP-TBD */ session->rcvbuf_size = *(u32 *) buffer; if (VPPCOM_DEBUG > 2) - clib_warning ("VCL<%d>: VPPCOM_ATTR_SET_TX_FIFO_LEN: %u (0x%x), " + clib_warning ("VCL<%d>: VPPCOM_ATTR_SET_RX_FIFO_LEN: %u (0x%x), " "buflen %d, #VPP-TBD#", getpid (), session->sndbuf_size, session->sndbuf_size, *buflen); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { - .format = "VPPCOM_ATTR_SET_TX_FIFO_LEN: 0x%x buflen=%d", + .format = "VPPCOM_ATTR_SET_RX_FIFO_LEN: 0x%x buflen=%d", .format_args = "i4i4", }; @@ -4880,7 +4942,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, *buflen); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "VPPCOM_ATTR_GET_REUSEADDR: %d buflen=%d", @@ -4919,7 +4981,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, *buflen); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "VPPCOM_ATTR_SET_REUSEADDR: %d buflen=%d", @@ -4955,7 +5017,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, *buflen); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "VPPCOM_ATTR_GET_REUSEPORT: %d buflen=%d", @@ -4994,7 +5056,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, *buflen); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "VPPCOM_ATTR_SET_REUSEPORT: %d buflen=%d", @@ -5030,7 +5092,7 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, *buflen); if (VPPCOM_DEBUG > 0) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ ELOG_TYPE_DECLARE (e) = { .format = "VPPCOM_ATTR_GET_BROADCAST: %d buflen=%d", @@ -5066,6 +5128,25 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_BROADCAST), *buflen); + if (VPPCOM_DEBUG > 0) + { + /* *INDENT-OFF* */ + ELOG_TYPE_DECLARE (e) = + { + .format = "VPPCOM_ATTR_SET_BROADCAST: %d buflen=%d", + .format_args = "i4i4", + }; + + struct { + u32 data[2]; + } * ed; + + ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track); + ed->data[0] = VCL_SESS_ATTR_TEST (session->attr, + VCL_SESS_ATTR_BROADCAST); + ed->data[1] = *buflen; + /* *INDENT-ON* */ + } } else rv = VPPCOM_EINVAL; @@ -5083,6 +5164,24 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, clib_warning ("VCL<%d>: VPPCOM_ATTR_GET_V6ONLY: %d, " "buflen %d, #VPP-TBD#", getpid (), *(int *) buffer, *buflen); + if (VPPCOM_DEBUG > 0) + { + /* *INDENT-OFF* */ + ELOG_TYPE_DECLARE (e) = + { + .format = "VPPCOM_ATTR_GET_V6ONLY: %d buflen=%d", + .format_args = "i4i4", + }; + + struct { + u32 data[2]; + } * ed; + + ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track); + ed->data[0] = *(int *) buffer; + ed->data[1] = *buflen; + /* *INDENT-ON* */ + } } else rv = VPPCOM_EINVAL; @@ -5102,6 +5201,25 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, "buflen %d, #VPP-TBD#", getpid (), VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_V6ONLY), *buflen); + if (VPPCOM_DEBUG > 0) + { + /* *INDENT-OFF* */ + ELOG_TYPE_DECLARE (e) = + { + .format = "VPPCOM_ATTR_SET_V6ONLY: %d buflen=%d", + .format_args = "i4i4", + }; + + struct { + u32 data[2]; + } * ed; + + ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track); + ed->data[0] = VCL_SESS_ATTR_TEST (session->attr, + VCL_SESS_ATTR_V6ONLY); + ed->data[1] = *buflen; + /* *INDENT-ON* */ + } } else rv = VPPCOM_EINVAL; @@ -5119,6 +5237,24 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, clib_warning ("VCL<%d>: VPPCOM_ATTR_GET_KEEPALIVE: %d, " "buflen %d, #VPP-TBD#", getpid (), *(int *) buffer, *buflen); + if (VPPCOM_DEBUG > 0) + { + /* *INDENT-OFF* */ + ELOG_TYPE_DECLARE (e) = + { + .format = "VPPCOM_ATTR_GET_KEEPALIVE: %d buflen=%d", + .format_args = "i4i4", + }; + + struct { + u32 data[2]; + } * ed; + + ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track); + ed->data[0] = *(int *) buffer; + ed->data[1] = *buflen; + /* *INDENT-ON* */ + } } else rv = VPPCOM_EINVAL; @@ -5139,6 +5275,25 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_KEEPALIVE), *buflen); + if (VPPCOM_DEBUG > 0) + { + /* *INDENT-OFF* */ + ELOG_TYPE_DECLARE (e) = + { + .format = "VPPCOM_ATTR_SET_KEEPALIVE: %d buflen=%d", + .format_args = "i4i4", + }; + + struct { + u32 data[2]; + } * ed; + + ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track); + ed->data[0] = VCL_SESS_ATTR_TEST (session->attr, + VCL_SESS_ATTR_KEEPALIVE); + ed->data[1] = *buflen; + /* *INDENT-ON* */ + } } else rv = VPPCOM_EINVAL; @@ -5156,6 +5311,24 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, clib_warning ("VCL<%d>: VPPCOM_ATTR_GET_TCP_NODELAY: %d, " "buflen %d, #VPP-TBD#", getpid (), *(int *) buffer, *buflen); + if (VPPCOM_DEBUG > 0) + { + /* *INDENT-OFF* */ + ELOG_TYPE_DECLARE (e) = + { + .format = "VPPCOM_ATTR_GET_TCP_NODELAY: %d buflen=%d", + .format_args = "i4i4", + }; + + struct { + u32 data[2]; + } * ed; + + ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track); + ed->data[0] = *(int *) buffer; + ed->data[1] = *buflen; + /* *INDENT-ON* */ + } } else rv = VPPCOM_EINVAL; @@ -5176,6 +5349,25 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_TCP_NODELAY), *buflen); + if (VPPCOM_DEBUG > 0) + { + /* *INDENT-OFF* */ + ELOG_TYPE_DECLARE (e) = + { + .format = "VPPCOM_ATTR_SET_TCP_NODELAY: %d buflen=%d", + .format_args = "i4i4", + }; + + struct { + u32 data[2]; + } * ed; + + ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track); + ed->data[0] = VCL_SESS_ATTR_TEST (session->attr, + VCL_SESS_ATTR_TCP_NODELAY); + ed->data[1] = *buflen; + /* *INDENT-ON* */ + } } else rv = VPPCOM_EINVAL; @@ -5193,6 +5385,24 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, clib_warning ("VCL<%d>: VPPCOM_ATTR_GET_TCP_KEEPIDLE: %d, " "buflen %d, #VPP-TBD#", getpid (), *(int *) buffer, *buflen); + if (VPPCOM_DEBUG > 0) + { + /* *INDENT-OFF* */ + ELOG_TYPE_DECLARE (e) = + { + .format = "VPPCOM_ATTR_GET_TCP_KEEPIDLE: %d buflen=%d", + .format_args = "i4i4", + }; + + struct { + u32 data[2]; + } * ed; + + ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track); + ed->data[0] = *(int *) buffer; + ed->data[1] = *buflen; + /* *INDENT-ON* */ + } } else rv = VPPCOM_EINVAL; @@ -5213,6 +5423,25 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_TCP_KEEPIDLE), *buflen); + if (VPPCOM_DEBUG > 0) + { + /* *INDENT-OFF* */ + ELOG_TYPE_DECLARE (e) = + { + .format = "VPPCOM_ATTR_SET_TCP_KEEPIDLE: %d buflen=%d", + .format_args = "i4i4", + }; + + struct { + u32 data[2]; + } * ed; + + ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track); + ed->data[0] = VCL_SESS_ATTR_TEST (session->attr, + VCL_SESS_ATTR_TCP_KEEPIDLE); + ed->data[1] = *buflen; + /* *INDENT-ON* */ + } } else rv = VPPCOM_EINVAL; @@ -5230,6 +5459,24 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, clib_warning ("VCL<%d>: VPPCOM_ATTR_GET_TCP_KEEPINTVL: %d, " "buflen %d, #VPP-TBD#", getpid (), *(int *) buffer, *buflen); + if (VPPCOM_DEBUG > 0) + { + /* *INDENT-OFF* */ + ELOG_TYPE_DECLARE (e) = + { + .format = "VPPCOM_ATTR_GET_TCP_KEEPIDLE: %d buflen=%d", + .format_args = "i4i4", + }; + + struct { + u32 data[2]; + } * ed; + + ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track); + ed->data[0] = *(int *) buffer; + ed->data[1] = *buflen; + /* *INDENT-ON* */ + } } else rv = VPPCOM_EINVAL; @@ -5250,6 +5497,25 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_TCP_KEEPINTVL), *buflen); + if (VPPCOM_DEBUG > 0) + { + /* *INDENT-OFF* */ + ELOG_TYPE_DECLARE (e) = + { + .format = "VPPCOM_ATTR_SET_TCP_KEEPINTVL: %d buflen=%d", + .format_args = "i4i4", + }; + + struct { + u32 data[2]; + } * ed; + + ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track); + ed->data[0] = VCL_SESS_ATTR_TEST (session->attr, + VCL_SESS_ATTR_TCP_KEEPINTVL); + ed->data[1] = *buflen; + /* *INDENT-ON* */ + } } else rv = VPPCOM_EINVAL; @@ -5266,6 +5532,24 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, clib_warning ("VCL<%d>: VPPCOM_ATTR_GET_TCP_USER_MSS: %d, " "buflen %d, #VPP-TBD#", getpid (), *(int *) buffer, *buflen); + if (VPPCOM_DEBUG > 0) + { + /* *INDENT-OFF* */ + ELOG_TYPE_DECLARE (e) = + { + .format = "VPPCOM_ATTR_GET_TCP_USER_MSS: %d buflen=%d", + .format_args = "i4i4", + }; + + struct { + u32 data[2]; + } * ed; + + ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track); + ed->data[0] = *(int *) buffer; + ed->data[1] = *buflen; + /* *INDENT-ON* */ + } } else rv = VPPCOM_EINVAL; @@ -5278,9 +5562,27 @@ vppcom_session_attr (uint32_t session_index, uint32_t op, session->user_mss = *(u32 *) buffer; if (VPPCOM_DEBUG > 2) - clib_warning ("VCL<%d>: VPPCOM_ATTR_SET_TCP_KEEPINTVL: %u, " + clib_warning ("VCL<%d>: VPPCOM_ATTR_SET_TCP_USER_MSS: %u, " "buflen %d, #VPP-TBD#", getpid (), session->user_mss, *buflen); + if (VPPCOM_DEBUG > 0) + { + /* *INDENT-OFF* */ + ELOG_TYPE_DECLARE (e) = + { + .format = "VPPCOM_ATTR_SET_TCP_USER_MSS: %d buflen=%d", + .format_args = "i4i4", + }; + + struct { + u32 data[2]; + } * ed; + + ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track); + ed->data[0] = session->user_mss; + ed->data[1] = *buflen; + /* *INDENT-ON* */ + } } else rv = VPPCOM_EINVAL; @@ -5314,11 +5616,27 @@ vppcom_session_recvfrom (uint32_t session_index, void *buffer, clib_warning ("VCL<%d>: invalid session, " "sid (%u) has been closed!", getpid (), session_index); + if (VPPCOM_DEBUG > 0) + { + /* *INDENT-OFF* */ + ELOG_TYPE_DECLARE (e) = + { + .format = "invalid session: %d closed", + .format_args = "i4", + }; + + struct { + u32 data; + } * ed; + + ed = ELOG_TRACK_DATA (&vcm->elog_main, e, vcm->elog_track); + ed->data = session_index; + /* *INDENT-ON* */ + } rv = VPPCOM_EBADFD; clib_spinlock_unlock (&vcm->sessions_lockp); goto done; } - ep->vrf = session->vrf; ep->is_ip4 = session->peer_addr.is_ip4; ep->port = session->peer_port; if (session->peer_addr.is_ip4)