DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 3/3] ring: autotest for using ring as ethdev
Date: Fri, 16 May 2014 19:15:14 +0100	[thread overview]
Message-ID: <1400264114-28455-4-git-send-email-bruce.richardson@intel.com> (raw)
In-Reply-To: <1400264114-28455-1-git-send-email-bruce.richardson@intel.com>

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 <bruce.richardson@intel.com>
---
 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 <rte_common.h>
 #include <rte_errno.h>
 #include <rte_hexdump.h>
+#include <rte_ethdev.h>
 
 #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

  parent reply	other threads:[~2014-05-16 18:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-16 18:15 [dpdk-dev] [PATCH 0/3] ring: provide rte_ring_as_ethdev API Bruce Richardson
2014-05-16 18:15 ` [dpdk-dev] [PATCH 1/3] ethdev: Remove ethdev.h dependency on mbuf + mempool Bruce Richardson
2014-05-16 18:15 ` [dpdk-dev] [PATCH 2/3] ring: add support for converting a ring to ethdev Bruce Richardson
2014-05-16 18:15 ` Bruce Richardson [this message]
2014-05-16 18:54 ` [dpdk-dev] [PATCH 0/3] ring: provide rte_ring_as_ethdev API Neil Horman
2014-05-19 10:59   ` Richardson, Bruce
2014-05-19 13:40     ` Neil Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1400264114-28455-4-git-send-email-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).