test/threads: add unit test
[dpdk.git] / app / test / test_event_eth_tx_adapter.c
index 73f6afe..2900532 100644 (file)
 
 #include "test.h"
 
+#ifdef RTE_EXEC_ENV_WINDOWS
+static int
+test_event_eth_tx_adapter_common(void)
+{
+       printf("event_eth_tx_adapter not supported on Windows, skipping test\n");
+       return TEST_SKIPPED;
+}
+
+#else
+
 #define MAX_NUM_QUEUE          RTE_PMD_RING_MAX_RX_RINGS
 #define TEST_INST_ID           0
 #define TEST_DEV_ID            0
@@ -45,7 +55,7 @@ static uint64_t eid = ~0ULL;
 static uint32_t tid;
 
 static inline int
-port_init_common(uint8_t port, const struct rte_eth_conf *port_conf,
+port_init_common(uint16_t port, const struct rte_eth_conf *port_conf,
                struct rte_mempool *mp)
 {
        const uint16_t rx_ring_size = RING_SIZE, tx_ring_size = RING_SIZE;
@@ -85,13 +95,12 @@ port_init_common(uint8_t port, const struct rte_eth_conf *port_conf,
 
        /* Display the port MAC address. */
        struct rte_ether_addr addr;
-       rte_eth_macaddr_get(port, &addr);
+       retval = rte_eth_macaddr_get(port, &addr);
+       if (retval < 0)
+               return retval;
        printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8
                           " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n",
-                       (unsigned int)port,
-                       addr.addr_bytes[0], addr.addr_bytes[1],
-                       addr.addr_bytes[2], addr.addr_bytes[3],
-                       addr.addr_bytes[4], addr.addr_bytes[5]);
+                       (unsigned int)port, RTE_ETHER_ADDR_BYTES(&addr));
 
        /* Enable RX in promiscuous mode for the Ethernet device. */
        retval = rte_eth_promiscuous_enable(port);
@@ -102,7 +111,7 @@ port_init_common(uint8_t port, const struct rte_eth_conf *port_conf,
 }
 
 static inline int
-port_init(uint8_t port, struct rte_mempool *mp)
+port_init(uint16_t port, struct rte_mempool *mp)
 {
        struct rte_eth_conf conf = { 0 };
        return port_init_common(port, &conf, mp);
@@ -697,5 +706,7 @@ test_event_eth_tx_adapter_common(void)
        return unit_test_suite_runner(&event_eth_tx_tests);
 }
 
+#endif /* !RTE_EXEC_ENV_WINDOWS */
+
 REGISTER_TEST_COMMAND(event_eth_tx_adapter_autotest,
                test_event_eth_tx_adapter_common);