hsa: cleanup ifdefs in sock tests
[vpp.git] / src / plugins / hs_apps / vcl / vcl_test.h
index ab05f7a..c6b9230 100644 (file)
@@ -86,10 +86,11 @@ typedef struct __attribute__ ((packed))
   uint32_t test;
   uint32_t ctrl_handle;
   uint32_t num_test_sessions;
+  uint32_t num_test_sessions_perq;
+  uint32_t num_test_qsessions;
   uint32_t verbose;
   uint32_t address_ip6;
   uint32_t transport_udp;
-  uint32_t transport_tls;
   uint64_t rxbuf_size;
   uint64_t txbuf_size;
   uint64_t num_writes;
@@ -119,6 +120,7 @@ typedef struct
   char *rxbuf;
   vcl_test_cfg_t cfg;
   vcl_test_stats_t stats;
+  int session_index;
 } vcl_test_session_t;
 
 
@@ -201,6 +203,7 @@ vcl_test_cfg_init (vcl_test_cfg_t * cfg)
   cfg->test = VCL_TEST_TYPE_NONE;
   cfg->ctrl_handle = ~0;
   cfg->num_test_sessions = 1;
+  cfg->num_test_sessions_perq = 1;
   cfg->verbose = 0;
   cfg->rxbuf_size = VCL_TEST_CFG_RXBUF_SIZE_DEF;
   cfg->num_writes = VCL_TEST_CFG_NUM_WRITES_DEF;
@@ -491,28 +494,16 @@ vcl_test_write (int fd, uint8_t * buf, uint32_t nbytes,
       if (rv < 0)
        {
          errno = -rv;
-         rv = -1;
-       }
-      if (rv < 0)
-       {
-         if ((errno == EAGAIN) || (errno == EWOULDBLOCK))
-           {
-             if (stats)
-               stats->tx_eagain++;
-             break;
-           }
-         else
-           break;
+         if ((errno == EAGAIN || errno == EWOULDBLOCK) && stats)
+           stats->tx_eagain++;
+         break;
        }
       tx_bytes += rv;
 
-      if (tx_bytes != nbytes)
-       {
-         nbytes_left = nbytes_left - rv;
-         buf += rv;
-         if (stats)
-           stats->tx_incomp++;
-       }
+      nbytes_left = nbytes_left - rv;
+      buf += rv;
+      if (stats)
+       stats->tx_incomp++;
 
     }
   while (tx_bytes != nbytes);
@@ -527,6 +518,32 @@ vcl_test_write (int fd, uint8_t * buf, uint32_t nbytes,
   return (tx_bytes);
 }
 
+static inline void
+dump_help (void)
+{
+#define INDENT "\n  "
+
+  printf ("CLIENT: Test configuration commands:"
+         INDENT VCL_TEST_TOKEN_HELP
+         "\t\t\tDisplay help."
+         INDENT VCL_TEST_TOKEN_EXIT
+         "\t\t\tExit test client & server."
+         INDENT VCL_TEST_TOKEN_SHOW_CFG
+         "\t\t\tShow the current test cfg."
+         INDENT VCL_TEST_TOKEN_RUN_UNI
+         "\t\t\tRun the Uni-directional test."
+         INDENT VCL_TEST_TOKEN_RUN_BI
+         "\t\t\tRun the Bi-directional test."
+         INDENT VCL_TEST_TOKEN_VERBOSE
+         "\t\t\tToggle verbose setting."
+         INDENT VCL_TEST_TOKEN_RXBUF_SIZE
+         "<rxbuf size>\tRx buffer size (bytes)."
+         INDENT VCL_TEST_TOKEN_TXBUF_SIZE
+         "<txbuf size>\tTx buffer size (bytes)."
+         INDENT VCL_TEST_TOKEN_NUM_WRITES
+         "<# of writes>\tNumber of txbuf writes to server." "\n");
+}
+
 #endif /* __vcl_test_h__ */
 
 /*