DPDK patches and discussions
 help / color / mirror / Atom feed
From: Neil Horman <nhorman@tuxdriver.com>
To: Pablo de Lara <pablox.de.lara.guarch@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] test: Ring PMD unit test rollback
Date: Fri, 27 Jun 2014 11:03:28 -0400
Message-ID: <20140627150328.GB9138@hmsreliant.think-freely.org> (raw)
In-Reply-To: <1403880399-16777-1-git-send-email-pablox.de.lara.guarch@intel.com>

On Fri, Jun 27, 2014 at 03:46:39PM +0100, Pablo de Lara wrote:
> From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> 
> New ring PMD unit test requires extra EAL option (vdev),
> in order to pass, which I believe is incorrect, as this
> test should be focused on testing the API, without needing
> to pass any argument.
> 
> Added again all functions that create all the ring devices
> necessary for the test, and remove the last two tests
> (test_pmd_ring_pair_create and test_pmd_ring_pair_attach),
> as they call functions that are deprecated.
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Nak, this also re-adds the need to link the pmd to the application, either
statically or at runtime (i.e. this implicitly obviates the -d option in
rte_eal_parse_args).  If you really want to re-add these api calls, I recommend
that you split them into a separate ring library and ring_pmd library.

Neil

P.S. you did remember to use the -d option in your testing, right?  Without it
the pmd won't load and the vdev option won't find the proper pmd to parse it.


> ---
>  app/test/test_pmd_ring.c |  217 +++++++++++++++-------------------------------
>  1 files changed, 72 insertions(+), 145 deletions(-)
> 
> diff --git a/app/test/test_pmd_ring.c b/app/test/test_pmd_ring.c
> index 0d3d95c..6988277 100644
> --- a/app/test/test_pmd_ring.c
> +++ b/app/test/test_pmd_ring.c
> @@ -42,6 +42,7 @@
>  /* 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 */
>  
> @@ -49,8 +50,6 @@ static uint8_t start_idx; /* will store the port id of the first of our new port
>  #define RX_PORT (uint8_t)(start_idx + 2)
>  #define RXTX_PORT (uint8_t)(start_idx + 3)
>  #define RXTX_PORT2 (uint8_t)(start_idx + 4)
> -#define RXTX_PORT4 (uint8_t)(start_idx + 6)
> -#define RXTX_PORT5 (uint8_t)(start_idx + 7)
>  #define SOCKET0 0
>  
>  #define RING_SIZE 256
> @@ -58,6 +57,58 @@ 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)
>  {
> @@ -252,12 +303,26 @@ 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;
> @@ -304,144 +369,8 @@ test_pmd_ring_init(void)
>  
>  	rte_eth_dev_stop(RXTX_PORT2);
>  
> -	return 0;
> -}
> -
> -static int
> -test_pmd_ring_pair_create(void)
> -{
> -	struct rte_eth_stats stats, stats2;
> -	struct rte_mbuf buf, *pbuf = &buf;
> -	struct rte_eth_conf null_conf;
> -
> -	if ((RXTX_PORT4 >= RTE_MAX_ETHPORTS) || (RXTX_PORT5 >= RTE_MAX_ETHPORTS)) {
> -		printf(" TX/RX port exceed max eth ports\n");
> -		return -1;
> -	}
> -	if ((rte_eth_dev_configure(RXTX_PORT4, 1, 1, &null_conf) < 0)
> -		|| (rte_eth_dev_configure(RXTX_PORT5, 1, 1, &null_conf) < 0)) {
> -		printf("Configure failed for RXTX port\n");
> -		return -1;
> -	}
> -
> -	if ((rte_eth_tx_queue_setup(RXTX_PORT4, 0, RING_SIZE, SOCKET0, NULL) < 0)
> -		|| (rte_eth_tx_queue_setup(RXTX_PORT5, 0, RING_SIZE, SOCKET0, NULL) < 0)) {
> -		printf("TX queue setup failed\n");
> -		return -1;
> -	}
> -
> -	if ((rte_eth_rx_queue_setup(RXTX_PORT4, 0, RING_SIZE, SOCKET0, NULL, mp) < 0)
> -		|| (rte_eth_rx_queue_setup(RXTX_PORT5, 0, RING_SIZE, SOCKET0, NULL, mp) < 0)) {
> -		printf("RX queue setup failed\n");
> -		return -1;
> -	}
> -
> -	if ((rte_eth_dev_start(RXTX_PORT4) < 0)
> -		|| (rte_eth_dev_start(RXTX_PORT5) < 0)) {
> -		printf("Error starting RXTX port\n");
> -		return -1;
> -	}
> -
> -	/* send and receive 1 packet and check for stats update */
> -	if (rte_eth_tx_burst(RXTX_PORT4, 0, &pbuf, 1) != 1) {
> -		printf("Error sending packet to RXTX port\n");
> -		return -1;
> -	}
> -
> -	if (rte_eth_rx_burst(RXTX_PORT5, 0, &pbuf, 1) != 1) {
> -		printf("Error receiving packet from RXTX port\n");
> -		return -1;
> -	}
> -
> -	rte_eth_stats_get(RXTX_PORT4, &stats);
> -	rte_eth_stats_get(RXTX_PORT5, &stats2);
> -	if (stats.ipackets != 0 || stats.opackets != 1 ||
> -			stats.ibytes != 0 || stats.obytes != 0 ||
> -			stats.ierrors != 0 || stats.oerrors != 0) {
> -		printf("Error: RXTX port stats are not as expected\n");
> -		return -1;
> -	}
> -
> -	if (stats2.ipackets != 1 || stats2.opackets != 0 ||
> -			stats2.ibytes != 0 || stats2.obytes != 0 ||
> -			stats2.ierrors != 0 || stats2.oerrors != 0) {
> -		printf("Error: RXTX port stats are not as expected\n");
> -		return -1;
> -	}
> -
> -	rte_eth_dev_stop(RXTX_PORT4);
> -	rte_eth_dev_stop(RXTX_PORT5);
> -
> -	return 0;
> -}
> -
> -static int
> -test_pmd_ring_pair_attach(void)
> -{
> -	struct rte_eth_stats stats, stats2;
> -	struct rte_mbuf buf, *pbuf = &buf;
> -	struct rte_eth_conf null_conf;
> -
> -	if ((RXTX_PORT4 >= RTE_MAX_ETHPORTS) || (RXTX_PORT5 >= RTE_MAX_ETHPORTS)) {
> -		printf(" TX/RX port exceed max eth ports\n");
> -		return -1;
> -	}
> -	if ((rte_eth_dev_configure(RXTX_PORT4, 1, 1, &null_conf) < 0)
> -		|| (rte_eth_dev_configure(RXTX_PORT5, 1, 1, &null_conf) < 0)) {
> -		printf("Configure failed for RXTX port\n");
> -		return -1;
> -	}
> -
> -	if ((rte_eth_tx_queue_setup(RXTX_PORT4, 0, RING_SIZE, SOCKET0, NULL) < 0)
> -		|| (rte_eth_tx_queue_setup(RXTX_PORT5, 0, RING_SIZE, SOCKET0, NULL) < 0)) {
> -		printf("TX queue setup failed\n");
> -		return -1;
> -	}
> -
> -	if ((rte_eth_rx_queue_setup(RXTX_PORT4, 0, RING_SIZE, SOCKET0, NULL, mp) < 0)
> -		|| (rte_eth_rx_queue_setup(RXTX_PORT5, 0, RING_SIZE, SOCKET0, NULL, mp) < 0)) {
> -		printf("RX queue setup failed\n");
> -		return -1;
> -	}
> -
> -	if ((rte_eth_dev_start(RXTX_PORT4) < 0)
> -		|| (rte_eth_dev_start(RXTX_PORT5) < 0)) {
> -		printf("Error starting RXTX port\n");
> -		return -1;
> -	}
> -
> -	rte_eth_stats_reset(RXTX_PORT4);
> -	rte_eth_stats_reset(RXTX_PORT5);
> -
> -	/* send and receive 1 packet and check for stats update */
> -	if (rte_eth_tx_burst(RXTX_PORT4, 0, &pbuf, 1) != 1) {
> -		printf("Error sending packet to RXTX port\n");
> -		return -1;
> -	}
> -	if (rte_eth_rx_burst(RXTX_PORT5, 0, &pbuf, 1) != 1) {
> -		printf("Error receiving packet from RXTX port\n");
> -		return -1;
> -	}
> -
> -	rte_eth_stats_get(RXTX_PORT4, &stats);
> -	rte_eth_stats_get(RXTX_PORT5, &stats2);
> -	if (stats.ipackets != 0 || stats.opackets != 1 ||
> -			stats.ibytes != 0 || stats.obytes != 0 ||
> -			stats.ierrors != 0 || stats.oerrors != 0) {
> -		printf("Error: RXTX port stats are not as expected\n");
> -		return -1;
> -	}
> -
> -	if (stats2.ipackets != 1 || stats2.opackets != 0 ||
> -			stats2.ibytes != 0 || stats2.obytes != 0 ||
> -			stats2.ierrors != 0 || stats2.oerrors != 0) {
> -		printf("Error: RXTX port stats are not as expected\n");
> -		return -1;
> -	}
> -
> -	rte_eth_dev_stop(RXTX_PORT4);
> -	rte_eth_dev_stop(RXTX_PORT5);
> -
> +	/* Test init same name pmd ring */
> +	rte_pmd_ring_devinit(name1, params_null);
>  	return 0;
>  }
>  
> @@ -476,6 +405,9 @@ test_pmd_ring(void)
>  		return -1;
>  	}
>  
> +	if (test_ring_ethdev_create() < 0)
> +		return -1;
> +
>  	if (test_ethdev_configure() < 0)
>  		return -1;
>  
> @@ -495,11 +427,6 @@ test_pmd_ring(void)
>  	if (test_pmd_ring_init() < 0)
>  		return -1;
>  
> -	if (test_pmd_ring_pair_create() < 0)
> -		return -1;
> -
> -	if (test_pmd_ring_pair_attach() < 0)
> -		return -1;
>  	return 0;
>  }
>  
> -- 
> 1.7.0.7
> 
> 

  reply	other threads:[~2014-06-27 15:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-27 14:46 Pablo de Lara
2014-06-27 15:03 ` Neil Horman [this message]
2014-06-27 15:47   ` De Lara Guarch, Pablo
2014-06-27 16:26     ` 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=20140627150328.GB9138@hmsreliant.think-freely.org \
    --to=nhorman@tuxdriver.com \
    --cc=dev@dpdk.org \
    --cc=pablox.de.lara.guarch@intel.com \
    /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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git