update Cavium Inc copyright headers
[dpdk.git] / test / test / test_eventdev.c
index 042a446..f766191 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2016 Cavium networks. All rights reserved.
+ *   Copyright(c) 2016 Cavium, Inc. All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
  *   modification, are permitted provided that the following conditions
@@ -13,7 +13,7 @@
  *        notice, this list of conditions and the following disclaimer in
  *        the documentation and/or other materials provided with the
  *        distribution.
- *      * Neither the name of Cavium networks nor the names of its
+ *      * Neither the name of Cavium, Inc nor the names of its
  *        contributors may be used to endorse or promote products derived
  *        from this software without specific prior written permission.
  *
@@ -36,7 +36,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_eventdev.h>
-#include <rte_cryptodev.h>
+#include <rte_dev.h>
 
 #include "test.h"
 
@@ -51,7 +51,7 @@ testsuite_setup(void)
        if (!count) {
                printf("Failed to find a valid event device,"
                        " testing with event_skeleton device\n");
-               return rte_eal_vdev_init("event_skeleton", NULL);
+               return rte_vdev_init("event_skeleton", NULL);
        }
        return TEST_SUCCESS;
 }
@@ -138,13 +138,6 @@ test_ethdev_config_run(struct rte_event_dev_config *dev_conf,
        return rte_event_dev_configure(TEST_DEV_ID, dev_conf);
 }
 
-static void
-min_dequeue_limit(struct rte_event_dev_config *dev_conf,
-                 struct rte_event_dev_info *info)
-{
-       dev_conf->dequeue_timeout_ns = info->min_dequeue_timeout_ns - 1;
-}
-
 static void
 max_dequeue_limit(struct rte_event_dev_config *dev_conf,
                  struct rte_event_dev_info *info)
@@ -210,9 +203,6 @@ test_eventdev_configure(void)
        TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info");
 
        /* Check limits */
-       TEST_ASSERT_EQUAL(-EINVAL,
-               test_ethdev_config_run(&dev_conf, &info, min_dequeue_limit),
-                "Config negative test failed");
        TEST_ASSERT_EQUAL(-EINVAL,
                test_ethdev_config_run(&dev_conf, &info, max_dequeue_limit),
                 "Config negative test failed");
@@ -244,8 +234,8 @@ test_eventdev_configure(void)
 
        /* re-configure */
        devconf_set_default_sane_values(&dev_conf, &info);
-       dev_conf.nb_event_ports = info.max_event_ports/2;
-       dev_conf.nb_event_queues = info.max_event_queues/2;
+       dev_conf.nb_event_ports = RTE_MAX(info.max_event_ports/2, 1);
+       dev_conf.nb_event_queues = RTE_MAX(info.max_event_queues/2, 1);
        ret = rte_event_dev_configure(TEST_DEV_ID, &dev_conf);
        TEST_ASSERT_SUCCESS(ret, "Failed to re configure eventdev");
 
@@ -519,9 +509,10 @@ test_eventdev_timeout_ticks(void)
        uint64_t timeout_ticks;
 
        ret = rte_event_dequeue_timeout_ticks(TEST_DEV_ID, 100, &timeout_ticks);
-       TEST_ASSERT_SUCCESS(ret, "Fail to get timeout_ticks");
+       if (ret != -ENOTSUP)
+               TEST_ASSERT_SUCCESS(ret, "Fail to get timeout_ticks");
 
-       return TEST_SUCCESS;
+       return ret;
 }
 
 
@@ -543,6 +534,10 @@ test_eventdev_start_stop(void)
                TEST_ASSERT_SUCCESS(ret, "Failed to setup port%d", i);
        }
 
+       ret = rte_event_port_link(TEST_DEV_ID, 0, NULL, NULL, 0);
+       TEST_ASSERT(ret == rte_event_queue_count(TEST_DEV_ID),
+                       "Failed to link port, device %d", TEST_DEV_ID);
+
        ret = rte_event_dev_start(TEST_DEV_ID);
        TEST_ASSERT_SUCCESS(ret, "Failed to start device%d", TEST_DEV_ID);
 
@@ -569,6 +564,10 @@ eventdev_setup_device(void)
                TEST_ASSERT_SUCCESS(ret, "Failed to setup port%d", i);
        }
 
+       ret = rte_event_port_link(TEST_DEV_ID, 0, NULL, NULL, 0);
+       TEST_ASSERT(ret == rte_event_queue_count(TEST_DEV_ID),
+                       "Failed to link port, device %d", TEST_DEV_ID);
+
        ret = rte_event_dev_start(TEST_DEV_ID);
        TEST_ASSERT_SUCCESS(ret, "Failed to start device%d", TEST_DEV_ID);