X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvcl%2Fsock_test.h;h=26dc3f1e6530ff79ca33ae0b4b8f3563169e86ae;hb=410bcca41c1a3e7c3d4b4c2940120f9b21732d49;hp=281ba6fd473e5d6cfb6761d8de1b00e55a85bdd5;hpb=5c7cf1cc5358d137160be1619981e7eea9a7402f;p=vpp.git diff --git a/src/vcl/sock_test.h b/src/vcl/sock_test.h index 281ba6fd473..26dc3f1e653 100644 --- a/src/vcl/sock_test.h +++ b/src/vcl/sock_test.h @@ -48,6 +48,11 @@ #define SOCK_TEST_CFG_BUF_SIZE_MIN 128 #define SOCK_TEST_CFG_MAX_TEST_SCKTS 5 +#define SOCK_TEST_AF_UNIX_FILENAME "/tmp/ldp_server_af_unix_socket" +#define SOCK_TEST_MIXED_EPOLL_DATA "Hello, world! (over an AF_UNIX socket)" +#define SOCK_TEST_AF_UNIX_ACCEPT_DATA 0xaf0000af +#define SOCK_TEST_AF_UNIX_FD_MASK 0x00af0000 + typedef enum { SOCK_TEST_TYPE_NONE, @@ -60,10 +65,13 @@ typedef enum typedef struct __attribute__ ((packed)) { uint32_t magic; + uint32_t seq_num; uint32_t test; uint32_t ctrl_handle; uint32_t num_test_sockets; uint32_t verbose; + uint32_t address_ip6; + uint32_t transport_udp; uint64_t rxbuf_size; uint64_t txbuf_size; uint64_t num_writes; @@ -157,7 +165,8 @@ sock_test_buf_alloc (sock_test_cfg_t *cfg, uint8_t is_rxbuf, uint8_t **buf, { int errno_val = errno; perror ("ERROR in sock_test_buf_alloc()"); - fprintf (stderr, "ERROR: Buffer allocation failed (errno = %d)!\n" + fprintf (stderr, "SOCK_TEST: ERROR: Buffer allocation " + "failed (errno = %d)!\n" " Using buffer size %d instead of desired" " size (%d)\n", errno_val, *bufsize, alloc_size); } @@ -207,6 +216,7 @@ sock_test_cfg_dump (sock_test_cfg_t * cfg, uint8_t is_client) printf (" test config (%p):\n" SOCK_TEST_SEPARATOR_STRING " magic: 0x%08x\n" + " seq_num: 0x%08x\n" "%-5s test: %s (%d)\n" " ctrl handle: %d (0x%x)\n" "%-5s num test sockets: %u (0x%08x)\n" @@ -216,7 +226,7 @@ sock_test_cfg_dump (sock_test_cfg_t * cfg, uint8_t is_client) "%-5s num writes: %lu (0x%08lx)\n" " client tx bytes: %lu (0x%08lx)\n" SOCK_TEST_SEPARATOR_STRING, - (void *) cfg, cfg->magic, + (void *) cfg, cfg->magic, cfg->seq_num, is_client && (cfg->test == SOCK_TEST_TYPE_UNI) ? "'"SOCK_TEST_TOKEN_RUN_UNI"'" : is_client && (cfg->test == SOCK_TEST_TYPE_BI) ? @@ -301,6 +311,13 @@ sock_test_stats_dump (char * header, sock_test_stats_t * stats, stats->stop.tv_sec, stats->stop.tv_nsec); printf (SOCK_TEST_SEPARATOR_STRING); + +#if SOCK_SERVER_USE_EPOLL && !defined (VCL_TEST) + printf (" af_unix xacts: %lu (0x%08lx)\n", + sock_server_main.af_unix_xacts); + + printf (SOCK_TEST_SEPARATOR_STRING); +#endif } static inline int @@ -340,8 +357,8 @@ sock_test_read (int fd, uint8_t *buf, uint32_t nbytes, { errno_val = errno; perror ("ERROR in sock_test_read()"); - fprintf (stderr, "ERROR: socket read failed (errno = %d)!\n", - errno_val); + fprintf (stderr, "SOCK_TEST: ERROR: socket read " + "failed (errno = %d)!\n", errno_val); errno = errno_val; } else if (stats) @@ -392,8 +409,8 @@ sock_test_write (int fd, uint8_t *buf, uint32_t nbytes, stats->tx_incomp++; if (verbose) { - printf ("WARNING: bytes written (%d) != bytes to write (%d)!\n", - tx_bytes, nbytes); + printf ("SOCK_TEST: WARNING: bytes written (%d) " + "!= bytes to write (%d)!\n", tx_bytes, nbytes); } } @@ -403,8 +420,8 @@ sock_test_write (int fd, uint8_t *buf, uint32_t nbytes, { errno_val = errno; perror ("ERROR in sock_test_write()"); - fprintf (stderr, "ERROR: socket write failed (errno = %d)!\n", - errno_val); + fprintf (stderr, "SOCK_TEST: ERROR: socket write failed " + "(errno = %d)!\n", errno_val); } else if (stats) stats->tx_bytes += tx_bytes;