From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 16901B106 for ; Fri, 16 May 2014 20:15:18 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 16 May 2014 11:15:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,1068,1389772800"; d="scan'208";a="540360726" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 16 May 2014 11:15:18 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id s4GIFGsw005885; Fri, 16 May 2014 19:15:17 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id s4GIFGEo028587; Fri, 16 May 2014 19:15:16 +0100 Received: (from bricha3@localhost) by sivswdev02.ir.intel.com with id s4GIFGWV028583; Fri, 16 May 2014 19:15:16 +0100 From: Bruce Richardson To: dev@dpdk.org Date: Fri, 16 May 2014 19:15:14 +0100 Message-Id: <1400264114-28455-4-git-send-email-bruce.richardson@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1400264114-28455-1-git-send-email-bruce.richardson@intel.com> References: <1400264114-28455-1-git-send-email-bruce.richardson@intel.com> Subject: [dpdk-dev] [PATCH 3/3] ring: autotest for using ring as ethdev X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 May 2014 18:15:19 -0000 An automated unit test for the new API to allow a ring to be used as an ethdev. Verifies that expected enqueue/dequeue functionality still works. Signed-off-by: Bruce Richardson --- app/test/test_ring.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/app/test/test_ring.c b/app/test/test_ring.c index cfd907f..f2aac24 100644 --- a/app/test/test_ring.c +++ b/app/test/test_ring.c @@ -58,6 +58,7 @@ #include #include #include +#include #include "test.h" @@ -1322,6 +1323,26 @@ fail_test: return ret; } +static int +test_ring_as_eth_dev(void) +{ + int ethnum = rte_ring_as_eth_dev(r); + struct rte_mbuf *buf = NULL; + + printf("Testing ring as ethdev - port num: %d\n", ethnum); + if (rte_eth_tx_burst(ethnum, 0, &buf, 1) != 1) + return -1; + if (rte_ring_count(r) != 1) + return -1; + if (rte_eth_rx_burst(ethnum, 0, &buf, 1) != 1) + return -1; + if (buf != NULL) + return -1; + printf("Enqueue/dequeue tests ok\n"); + + return 0; +} + int test_ring(void) { @@ -1379,6 +1400,10 @@ test_ring(void) else printf ( "Test detected NULL ring lookup \n"); + /* test using the ring as an ethdev */ + if (test_ring_as_eth_dev() < 0) + return -1; + /* test of creating ring with wrong size */ if (test_ring_creation_with_wrong_size() < 0) return -1; -- 1.9.0