ring: convert to use of PMD_REGISTER_DRIVER and fix linking
[dpdk.git] / app / test / test_pmd_ring.c
index 4d9c2ba..1fe38fa 100644 (file)
@@ -42,7 +42,6 @@
 /* two test rings, r1 is used by two ports, r2 just by one */
 static struct rte_ring *r1[2], *r2;
 
-static struct rte_ring *nullring = NULL;
 static struct rte_mempool *mp;
 static uint8_t start_idx; /* will store the port id of the first of our new ports */
 
@@ -59,58 +58,6 @@ static uint8_t start_idx; /* will store the port id of the first of our new port
 #define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
 #define NB_MBUF   512
 
-
-static int
-test_ring_ethdev_create(void)
-{
-       int retval;
-       printf("Testing ring pmd create\n");
-
-       retval = rte_eth_from_rings(NULL, 0, NULL, 0, SOCKET0);
-       if (retval < 0) {
-               printf("Failure, failed to create zero-sized RXTX ring pmd\n");
-               return -1;
-       }
-
-       retval = rte_eth_from_rings(NULL, 0, NULL, 0, RTE_MAX_NUMA_NODES);
-       if (retval >= 0) {
-               printf("Failure, can create ring pmd on socket %d\n", RTE_MAX_NUMA_NODES);
-               return -1;
-       }
-
-       retval = rte_eth_from_rings(NULL, 1, &r2, 1, SOCKET0);
-       if (retval >= 0) {
-               printf("Failure, can create pmd with null rx rings\n");
-               return -1;
-       }
-
-       retval = rte_eth_from_rings(r1, 1, NULL, 1, SOCKET0);
-       if (retval >= 0) {
-               printf("Failure, can create pmd with null tx rings\n");
-               return -1;
-       }
-
-       retval = rte_eth_from_rings(&nullring, 1, r1, 2, SOCKET0);
-       if (retval < 0) {
-               printf("Failure, failed to create TX-only ring pmd\n");
-               return -1;
-       }
-
-       retval = rte_eth_from_rings(r1, 1, &nullring, 1, SOCKET0);
-       if (retval < 0) {
-               printf("Failure, failed to create RX-only ring pmd\n");
-               return -1;
-       }
-
-       retval = rte_eth_from_rings(&r2, 1, &r2, 1, SOCKET0);
-       if (retval < 0) {
-               printf("Failure, failed to create RXTX ring pmd\n");
-               return -1;
-       }
-
-       return 0;
-}
-
 static int
 test_ethdev_configure(void)
 {
@@ -305,26 +252,12 @@ test_stats_reset(void)
 static int 
 test_pmd_ring_init(void)
 {
-       const char * name1 = "R3";
-       const char * name2 = "R4";
-       const char * params_null = NULL;
-       const char * params = "PARAMS";
        struct rte_eth_stats stats;
        struct rte_mbuf buf, *pbuf = &buf;
        struct rte_eth_conf null_conf;
 
        printf("Testing ring pmd init\n");
 
-       if (rte_pmd_ring_devinit(name1, params_null) < 0) {
-               printf("Testing ring pmd init fail\n");
-               return -1;
-       }
-
-       if (rte_pmd_ring_devinit(name2, params) < 0) {
-               printf("Testing ring pmd init fail\n");
-               return -1;
-       }
-
        if (RXTX_PORT2 >= RTE_MAX_ETHPORTS) {
                printf(" TX/RX port exceed max eth ports\n");
                return -1;
@@ -371,24 +304,16 @@ test_pmd_ring_init(void)
 
        rte_eth_dev_stop(RXTX_PORT2);
 
-       /* Test init same name pmd ring */
-       rte_pmd_ring_devinit(name1, params_null);
        return 0;
 }
 
 static int
 test_pmd_ring_pair_create(void)
 {
-       const char * name1 = "_RNG_P0";
        struct rte_eth_stats stats, stats2;
        struct rte_mbuf buf, *pbuf = &buf;
        struct rte_eth_conf null_conf;
 
-       if (rte_eth_ring_pair_create(name1, SOCKET0) < 0) {
-               printf("Create ring pair failed\n");
-               return -1;
-       }
-
        if ((RXTX_PORT4 >= RTE_MAX_ETHPORTS) || (RXTX_PORT5 >= RTE_MAX_ETHPORTS)) {
                printf(" TX/RX port exceed max eth ports\n");
                return -1;
@@ -447,28 +372,16 @@ test_pmd_ring_pair_create(void)
        rte_eth_dev_stop(RXTX_PORT4);
        rte_eth_dev_stop(RXTX_PORT5);
 
-       /* Test create same name ring pair */
-       if (rte_eth_ring_pair_create(name1, SOCKET0) == 0) {
-               printf("Create same name ring pair error\n");
-               return -1;
-       }
        return 0;
 }
 
 static int
 test_pmd_ring_pair_attach(void)
 {
-       const char * name1 = "_RNG_P0";
-       const char * name2 = "_RNG_P1";
        struct rte_eth_stats stats, stats2;
        struct rte_mbuf buf, *pbuf = &buf;
        struct rte_eth_conf null_conf;
 
-       if (rte_eth_ring_pair_attach(name1, SOCKET0) < 0) {
-               printf("Attach ring pair failed\n");
-               return -1;
-       }
-
        if ((RXTX_PORT4 >= RTE_MAX_ETHPORTS) || (RXTX_PORT5 >= RTE_MAX_ETHPORTS)) {
                printf(" TX/RX port exceed max eth ports\n");
                return -1;
@@ -529,11 +442,6 @@ test_pmd_ring_pair_attach(void)
        rte_eth_dev_stop(RXTX_PORT4);
        rte_eth_dev_stop(RXTX_PORT5);
        
-       /* Test attach non-existing ring pair */
-       if (rte_eth_ring_pair_attach(name2, SOCKET0) == 0) {
-               printf("Attach non-existing ring pair error\n");
-               return -1;
-       }
        return 0;
 }
 
@@ -568,9 +476,6 @@ test_pmd_ring(void)
                return -1;
        }
 
-       if (test_ring_ethdev_create() < 0)
-               return -1;
-
        if (test_ethdev_configure() < 0)
                return -1;