vcl: refactor test apps to use multiple workers

Change-Id: Ia931377004c2996826a5f504d16c3c934ca3b70d
Signed-off-by: Florin Coras <fcoras@cisco.com>
diff --git a/src/vcl/vcl_test_client.c b/src/vcl/vcl_test_client.c
index af51b66..4e61045 100644
--- a/src/vcl/vcl_test_client.c
+++ b/src/vcl/vcl_test_client.c
@@ -137,7 +137,6 @@
       FD_SET (tsock->fd, &rd_fdset);
       sidx = vppcom_session_index (tsock->fd);
       nfds = sidx > nfds ? sidx : nfds;
-//      nfds = ((tsock->fd + 1) > nfds) ? (tsock->fd + 1) : nfds;
     }
 
   nfds++;
@@ -256,10 +255,8 @@
   sock_client_main_t *scm = &sock_client_main;
   sock_test_socket_t *ctrl = &scm->ctrl_socket;
   sock_test_socket_t *tsock;
-  int tx_bytes;
-  uint32_t i, n;
-  int rv;
-  int nfds = 0;
+  int tx_bytes, rv, nfds = 0;
+  uint32_t i, n, sidx;
   fd_set wr_fdset, rd_fdset;
   fd_set _wfdset, *wfdset = &_wfdset;
   fd_set _rfdset, *rfdset = (test == SOCK_TEST_TYPE_BI) ? &_rfdset : 0;
@@ -297,7 +294,8 @@
       memset (&tsock->stats, 0, sizeof (tsock->stats));
       FD_SET (tsock->fd, &wr_fdset);
       FD_SET (tsock->fd, &rd_fdset);
-      nfds = ((tsock->fd + 1) > nfds) ? (tsock->fd + 1) : nfds;
+      sidx = vppcom_session_index (tsock->fd);
+      nfds = sidx > nfds ? sidx : nfds;
     }
 
   nfds++;
@@ -327,7 +325,7 @@
 	    continue;
 
 	  if ((test == SOCK_TEST_TYPE_BI) &&
-	      FD_ISSET (tsock->fd, rfdset) &&
+	      FD_ISSET (vppcom_session_index (tsock->fd), rfdset) &&
 	      (tsock->stats.rx_bytes < ctrl->cfg.total_bytes))
 	    {
 	      (void) vcl_test_read (tsock->fd,
@@ -335,7 +333,7 @@
 				    tsock->rxbuf_size, &tsock->stats);
 	    }
 
-	  if (FD_ISSET (tsock->fd, wfdset)
+	  if (FD_ISSET (vppcom_session_index (tsock->fd), wfdset)
 	      && (tsock->stats.tx_bytes < ctrl->cfg.total_bytes))
 	    {
 	      tx_bytes = vcl_test_write (tsock->fd, (uint8_t *) tsock->txbuf,