X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest%2Ftest_kni.c;h=506b543a68792e8acc701f4d97644e0434cb34de;hb=ea0c20ea95fd5d71a10757e6598ac66233ea1495;hp=60683d26cffc3b50cbdb93978810b3e8722d92f5;hpb=942405f9e2f2c22aa817be374ccfe939a72df2ce;p=dpdk.git diff --git a/app/test/test_kni.c b/app/test/test_kni.c index 60683d26cf..506b543a68 100644 --- a/app/test/test_kni.c +++ b/app/test/test_kni.c @@ -39,7 +39,6 @@ #include "test.h" -#ifdef RTE_LIBRTE_KNI #include #include #include @@ -48,8 +47,7 @@ #define NB_MBUF 8192 #define MAX_PACKET_SZ 2048 -#define MBUF_SZ \ - (MAX_PACKET_SZ + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SZ (MAX_PACKET_SZ + RTE_PKTMBUF_HEADROOM) #define PKT_BURST_SZ 32 #define MEMPOOL_CACHE_SZ PKT_BURST_SZ #define SOCKET 0 @@ -59,7 +57,7 @@ #define IFCONFIG "/sbin/ifconfig " #define TEST_KNI_PORT "test_kni_port" - +#define KNI_TEST_MAX_PORTS 4 /* The threshold number of mbufs to be transmitted or received. */ #define KNI_NUM_MBUF_THRESHOLD 100 static int kni_pkt_mtu = 0; @@ -119,17 +117,10 @@ test_kni_create_mempool(void) mp = rte_mempool_lookup("kni_mempool"); if (!mp) - mp = rte_mempool_create("kni_mempool", + mp = rte_pktmbuf_pool_create("kni_mempool", NB_MBUF, - MBUF_SZ, - MEMPOOL_CACHE_SZ, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, - NULL, - rte_pktmbuf_init, - NULL, - SOCKET, - 0); + MEMPOOL_CACHE_SZ, 0, MBUF_DATA_SZ, + SOCKET); return mp; } @@ -499,6 +490,9 @@ test_kni(void) struct rte_eth_dev_info info; struct rte_kni_ops ops; + /* Initialize KNI subsytem */ + rte_kni_init(KNI_TEST_MAX_PORTS); + if (test_kni_allocate_lcores() < 0) { printf("No enough lcores for kni processing\n"); return -1; @@ -509,11 +503,6 @@ test_kni(void) printf("fail to create mempool for kni\n"); return -1; } - ret = rte_eal_pci_probe(); - if (ret < 0) { - printf("fail to probe PCI devices\n"); - return -1; - } nb_ports = rte_eth_dev_count(); if (nb_ports == 0) { @@ -685,4 +674,3 @@ static struct test_command kni_cmd = { .callback = test_kni, }; REGISTER_TEST_COMMAND(kni_cmd); -#endif /* RTE_LIBRTE_KNI */