VCL: remove vrf from vppcom api. 51/10451/2
authorDave Wallace <dwallacelf@gmail.com>
Wed, 7 Feb 2018 23:14:02 +0000 (18:14 -0500)
committerDamjan Marion <dmarion.lists@gmail.com>
Thu, 8 Feb 2018 10:02:31 +0000 (10:02 +0000)
Change-Id: I6d91c8051de786fb8781cd0750ea9c350036b306
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
src/vcl/sock_test_client.c
src/vcl/sock_test_server.c
src/vcl/vcom.c
src/vcl/vppcom.c
src/vcl/vppcom.h

index 563b05f..ddb9e7f 100644 (file)
@@ -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;
index 75ee1d7..5476981 100644 (file)
@@ -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;
index 327ab88..82c65e8 100644 (file)
@@ -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:
index 201d9db..7edb69c 100644 (file)
@@ -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)
index c79b90c..d681dee 100644 (file)
@@ -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);