From c04cbf16ccfd9ef142937e4684af6093d812a866 Mon Sep 17 00:00:00 2001 From: Dave Wallace Date: Wed, 7 Feb 2018 18:14:02 -0500 Subject: [PATCH] VCL: remove vrf from vppcom api. Change-Id: I6d91c8051de786fb8781cd0750ea9c350036b306 Signed-off-by: Dave Wallace --- src/vcl/sock_test_client.c | 6 ++---- src/vcl/sock_test_server.c | 4 +--- src/vcl/vcom.c | 10 +++------- src/vcl/vppcom.c | 25 +++++++------------------ src/vcl/vppcom.h | 5 +---- 5 files changed, 14 insertions(+), 36 deletions(-) diff --git a/src/vcl/sock_test_client.c b/src/vcl/sock_test_client.c index 563b05fd8dd..ddb9e7fb20a 100644 --- a/src/vcl/sock_test_client.c +++ b/src/vcl/sock_test_client.c @@ -508,8 +508,7 @@ sock_test_connect_test_sockets (uint32_t num_test_sockets) tsock = &scm->test_socket[i]; #ifdef VCL_TEST tsock->fd = - vppcom_session_create (VPPCOM_VRF_DEFAULT, VPPCOM_PROTO_TCP, - 1 /* is_nonblocking */ ); + vppcom_session_create (VPPCOM_PROTO_TCP, 1 /* is_nonblocking */ ); if (tsock->fd < 0) { errno = -tsock->fd; @@ -945,7 +944,7 @@ main (int argc, char **argv) } else { - ctrl->fd = vppcom_session_create (VPPCOM_VRF_DEFAULT, VPPCOM_PROTO_TCP, + ctrl->fd = vppcom_session_create (VPPCOM_PROTO_TCP, 0 /* is_nonblocking */ ); if (ctrl->fd < 0) { @@ -973,7 +972,6 @@ main (int argc, char **argv) scm->server_addr.sin_port = htons (atoi (argv[optind])); #ifdef VCL_TEST - scm->server_endpt.vrf = VPPCOM_VRF_DEFAULT; scm->server_endpt.is_ip4 = (scm->server_addr.sin_family == AF_INET); scm->server_endpt.ip = (uint8_t *) & scm->server_addr.sin_addr; scm->server_endpt.port = (uint16_t) scm->server_addr.sin_port; diff --git a/src/vcl/sock_test_server.c b/src/vcl/sock_test_server.c index 75ee1d72c74..54769817c0f 100644 --- a/src/vcl/sock_test_server.c +++ b/src/vcl/sock_test_server.c @@ -394,8 +394,7 @@ main (int argc, char **argv) else { ssm->listen_fd = - vppcom_session_create (VPPCOM_VRF_DEFAULT, VPPCOM_PROTO_TCP, - 0 /* is_nonblocking */ ); + vppcom_session_create (VPPCOM_PROTO_TCP, 0 /* is_nonblocking */ ); } #else ssm->listen_fd = socket (AF_INET, SOCK_STREAM, 0); @@ -416,7 +415,6 @@ main (int argc, char **argv) servaddr.sin_port = htons (port); #ifdef VCL_TEST - endpt.vrf = VPPCOM_VRF_DEFAULT; endpt.is_ip4 = (servaddr.sin_family == AF_INET); endpt.ip = (uint8_t *) & servaddr.sin_addr; endpt.port = (uint16_t) servaddr.sin_port; diff --git a/src/vcl/vcom.c b/src/vcl/vcom.c index 327ab88f0cc..82c65e854e0 100644 --- a/src/vcl/vcom.c +++ b/src/vcl/vcom.c @@ -1142,19 +1142,18 @@ socket (int domain, int type, int protocol) ((sock_type == SOCK_STREAM) || (sock_type == SOCK_DGRAM))) { int sid; - u32 vrf = VPPCOM_VRF_DEFAULT; u8 proto = ((sock_type == SOCK_DGRAM) ? VPPCOM_PROTO_UDP : VPPCOM_PROTO_TCP); func_str = "vppcom_session_create"; if (VCOM_DEBUG > 0) - clib_warning ("LDP<%d>: : calling %s(): vrf %u, " + clib_warning ("LDP<%d>: : calling %s(): " "proto %u (%s), is_nonblocking %u", - getpid (), func_str, vrf, proto, + getpid (), func_str, proto, vppcom_proto_str (proto), is_nonblocking); - sid = vppcom_session_create (vrf, proto, is_nonblocking); + sid = vppcom_session_create (proto, is_nonblocking); if (sid < 0) { errno = -sid; @@ -1268,7 +1267,6 @@ bind (int fd, __CONST_SOCKADDR_ARG addr, socklen_t len) func_str = "vppcom_session_bind"; - ep.vrf = VPPCOM_VRF_DEFAULT; switch (addr->sa_family) { case AF_INET: @@ -1493,7 +1491,6 @@ connect (int fd, __CONST_SOCKADDR_ARG addr, socklen_t len) func_str = "vppcom_session_connect"; - ep.vrf = VPPCOM_VRF_DEFAULT; switch (addr->sa_family) { case AF_INET: @@ -2019,7 +2016,6 @@ sendto (int fd, const void *buf, size_t n, int flags, if (addr) { ep = &_ep; - ep->vrf = VPPCOM_VRF_DEFAULT; switch (addr->sa_family) { case AF_INET: diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index 201d9db0ae7..7edb69c4c73 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 @@ -1043,7 +1042,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; @@ -1488,7 +1486,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; @@ -2402,7 +2399,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 +2409,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 +2428,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* */ } @@ -2607,7 +2602,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; @@ -2795,7 +2789,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; @@ -3054,7 +3047,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; @@ -4423,7 +4415,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) @@ -4490,7 +4481,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) @@ -5574,7 +5564,6 @@ vppcom_session_recvfrom (uint32_t session_index, void *buffer, 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) diff --git a/src/vcl/vppcom.h b/src/vcl/vppcom.h index c79b90c7992..d681dee49a9 100644 --- a/src/vcl/vppcom.h +++ b/src/vcl/vppcom.h @@ -32,7 +32,6 @@ extern "C" * VPPCOM Public API Definitions, Enums, and Data Structures */ #define INVALID_SESSION_ID (~0) -#define VPPCOM_VRF_DEFAULT 0 #define VPPCOM_CONF_DEFAULT "/etc/vpp/vcl.conf" #define VPPCOM_ENV_CONF "VCL_CONFIG" #define VPPCOM_ENV_DEBUG "VCL_DEBUG" @@ -77,7 +76,6 @@ typedef enum typedef struct vppcom_endpt_t_ { - uint32_t vrf; uint8_t is_cut_thru; uint8_t is_ip4; uint8_t *ip; @@ -215,8 +213,7 @@ vppcom_retval_str (int retval) extern int vppcom_app_create (char *app_name); extern void vppcom_app_destroy (void); -extern int vppcom_session_create (uint32_t vrf, uint8_t proto, - uint8_t is_nonblocking); +extern int vppcom_session_create (uint8_t proto, uint8_t is_nonblocking); extern int vppcom_session_close (uint32_t session_index); extern int vppcom_session_bind (uint32_t session_index, vppcom_endpt_t * ep); -- 2.16.6