test/mbuf: add unit test cases
[dpdk.git] / app / test / test_ring_perf.c
index ebb3939..b6ad703 100644 (file)
@@ -52,10 +52,11 @@ get_two_hyperthreads(struct lcore_pair *lcp)
                RTE_LCORE_FOREACH(id2) {
                        if (id1 == id2)
                                continue;
-                       c1 = lcore_config[id1].core_id;
-                       c2 = lcore_config[id2].core_id;
-                       s1 = lcore_config[id1].socket_id;
-                       s2 = lcore_config[id2].socket_id;
+
+                       c1 = rte_lcore_to_cpu_id(id1);
+                       c2 = rte_lcore_to_cpu_id(id2);
+                       s1 = rte_lcore_to_socket_id(id1);
+                       s2 = rte_lcore_to_socket_id(id2);
                        if ((c1 == c2) && (s1 == s2)){
                                lcp->c1 = id1;
                                lcp->c2 = id2;
@@ -75,10 +76,11 @@ get_two_cores(struct lcore_pair *lcp)
                RTE_LCORE_FOREACH(id2) {
                        if (id1 == id2)
                                continue;
-                       c1 = lcore_config[id1].core_id;
-                       c2 = lcore_config[id2].core_id;
-                       s1 = lcore_config[id1].socket_id;
-                       s2 = lcore_config[id2].socket_id;
+
+                       c1 = rte_lcore_to_cpu_id(id1);
+                       c2 = rte_lcore_to_cpu_id(id2);
+                       s1 = rte_lcore_to_socket_id(id1);
+                       s2 = rte_lcore_to_socket_id(id2);
                        if ((c1 != c2) && (s1 == s2)){
                                lcp->c1 = id1;
                                lcp->c2 = id2;
@@ -98,8 +100,8 @@ get_two_sockets(struct lcore_pair *lcp)
                RTE_LCORE_FOREACH(id2) {
                        if (id1 == id2)
                                continue;
-                       s1 = lcore_config[id1].socket_id;
-                       s2 = lcore_config[id2].socket_id;
+                       s1 = rte_lcore_to_socket_id(id1);
+                       s2 = rte_lcore_to_socket_id(id2);
                        if (s1 != s2){
                                lcp->c1 = id1;
                                lcp->c2 = id2;
@@ -160,7 +162,11 @@ enqueue_bulk(void *p)
        unsigned i;
        void *burst[MAX_BURST] = {0};
 
-       if ( __sync_add_and_fetch(&lcore_count, 1) != 2 )
+#ifdef RTE_USE_C11_MEM_MODEL
+       if (__atomic_add_fetch(&lcore_count, 1, __ATOMIC_RELAXED) != 2)
+#else
+       if (__sync_add_and_fetch(&lcore_count, 1) != 2)
+#endif
                while(lcore_count != 2)
                        rte_pause();
 
@@ -196,7 +202,11 @@ dequeue_bulk(void *p)
        unsigned i;
        void *burst[MAX_BURST] = {0};
 
-       if ( __sync_add_and_fetch(&lcore_count, 1) != 2 )
+#ifdef RTE_USE_C11_MEM_MODEL
+       if (__atomic_add_fetch(&lcore_count, 1, __ATOMIC_RELAXED) != 2)
+#else
+       if (__sync_add_and_fetch(&lcore_count, 1) != 2)
+#endif
                while(lcore_count != 2)
                        rte_pause();