};
static struct event_eth_rx_adapter_test_params default_params;
+static bool event_dev_created;
+static bool eth_dev_created;
static inline int
port_init_common(uint16_t port, const struct rte_eth_conf *port_conf,
if (!count) {
printf("Failed to find a valid event device,"
" testing with event_skeleton device\n");
- rte_vdev_init("event_skeleton", NULL);
+ err = rte_vdev_init("event_skeleton", NULL);
+ TEST_ASSERT(err == 0, "Failed to create event_skeleton. err=%d",
+ err);
+ event_dev_created = true;
}
struct rte_event_dev_config config = {
TEST_ASSERT(err == 0, "Event device initialization failed err %d\n",
err);
+ count = rte_eth_dev_count_total();
+ if (!count) {
+ printf("Testing with net_null device\n");
+ err = rte_vdev_init("net_null", NULL);
+ TEST_ASSERT(err == 0, "Failed to create net_null. err=%d",
+ err);
+ eth_dev_created = true;
+ }
+
/*
* eth devices like octeontx use event device to receive packets
* so rte_eth_dev_start invokes rte_event_dev_start internally, so
if (!count) {
printf("Failed to find a valid event device,"
" testing with event_skeleton device\n");
- rte_vdev_init("event_skeleton", NULL);
+ err = rte_vdev_init("event_skeleton", NULL);
+ TEST_ASSERT(err == 0, "Failed to create event_skeleton. err=%d",
+ err);
+ event_dev_created = true;
}
struct rte_event_dev_config config = {
TEST_ASSERT(err == 0, "Event device initialization failed err %d\n",
err);
+ count = rte_eth_dev_count_total();
+ if (!count) {
+ printf("Testing with net_null device\n");
+ err = rte_vdev_init("net_null", NULL);
+ TEST_ASSERT(err == 0, "Failed to create net_null. err=%d",
+ err);
+ eth_dev_created = true;
+ }
+
/*
* eth devices like octeontx use event device to receive packets
* so rte_eth_dev_start invokes rte_event_dev_start internally, so
static void
testsuite_teardown(void)
{
+ int err;
uint32_t i;
RTE_ETH_FOREACH_DEV(i)
rte_eth_dev_stop(i);
+ if (eth_dev_created) {
+ err = rte_vdev_uninit("net_null");
+ if (err)
+ printf("Failed to delete net_null. err=%d", err);
+ eth_dev_created = false;
+ }
+
rte_mempool_free(default_params.mp);
+ if (event_dev_created) {
+ err = rte_vdev_uninit("event_skeleton");
+ if (err)
+ printf("Failed to delete event_skeleton. err=%d", err);
+ event_dev_created = false;
+ }
+
+ memset(&default_params, 0, sizeof(default_params));
}
static void
testsuite_teardown_rx_intr(void)
{
+ int err;
if (!default_params.rx_intr_port_inited)
return;
rte_eth_dev_stop(default_params.rx_intr_port);
+ if (eth_dev_created) {
+ err = rte_vdev_uninit("net_null");
+ if (err)
+ printf("Failed to delete net_null. err=%d", err);
+ eth_dev_created = false;
+ }
rte_mempool_free(default_params.mp);
+ if (event_dev_created) {
+ err = rte_vdev_uninit("event_skeleton");
+ if (err)
+ printf("Failed to delete event_skeleton. err=%d", err);
+ event_dev_created = false;
+ }
+
+ memset(&default_params, 0, sizeof(default_params));
}
static int