DPDK patches and discussions
 help / color / mirror / Atom feed
From: santosh <santosh.shukla@caviumnetworks.com>
To: Nikhil Rao <nikhil.rao@intel.com>,
	jerin.jacob@caviumnetworks.com, bruce.richardson@intel.com
Cc: gage.eads@intel.com, dev@dpdk.org, thomas@monjalon.net,
	harry.van.haaren@intel.com, hemant.agrawal@nxp.com,
	nipun.gupta@nxp.com, narender.vangati@intel.com,
	erik.g.carrillo@intel.com, abhinandan.gujjar@intel.com
Subject: Re: [dpdk-dev] [PATCH v3 4/4] eventdev: Add tests for event eth Rx adapter APIs
Date: Fri, 15 Sep 2017 11:37:18 +0530	[thread overview]
Message-ID: <97759889-9349-ee87-2386-666973f162d1@caviumnetworks.com> (raw)
In-Reply-To: <1505219369-2493-5-git-send-email-nikhil.rao@intel.com>

Hi Nikhil,

On Tuesday 12 September 2017 05:59 PM, Nikhil Rao wrote:
> Add unit tests for rte_event_eth_rx_adapter_xxx() APIs
>
> Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
> ---
>  test/test/test_event_eth_rx_adapter.c | 385 ++++++++++++++++++++++++++++++++++
>  test/test/Makefile                    |   1 +
>  2 files changed, 386 insertions(+)
>  create mode 100644 test/test/test_event_eth_rx_adapter.c

patch breaks build:
http://dpdk.org/ml/archives/test-report/2017-September/029088.html

> diff --git a/test/test/test_event_eth_rx_adapter.c b/test/test/test_event_eth_rx_adapter.c
> new file mode 100644
> index 0000000..d338b0b
> --- /dev/null
> +++ b/test/test/test_event_eth_rx_adapter.c
> @@ -0,0 +1,385 @@
> +/*-
> + *   BSD LICENSE
> + *
> + *   Copyright(c) 2017 Intel Corporation. All rights reserved.
> + *
> + *   Redistribution and use in source and binary forms, with or without
> + *   modification, are permitted provided that the following conditions
> + *   are met:
> + *
> + *     * Redistributions of source code must retain the above copyright
> + *       notice, this list of conditions and the following disclaimer.
> + *     * Redistributions in binary form must reproduce the above copyright
> + *       notice, this list of conditions and the following disclaimer in
> + *       the documentation and/or other materials provided with the
> + *       distribution.
> + *     * Neither the name of Intel Corporation nor the names of its
> + *       contributors may be used to endorse or promote products derived
> + *       from this software without specific prior written permission.
> + *
> + *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> + *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> + *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> + *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> + *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> + *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> + *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> + *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> + *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> + *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + */
> +#include <string.h>
> +#include <rte_common.h>
> +#include <rte_mempool.h>
> +#include <rte_mbuf.h>
> +#include <rte_ethdev.h>
> +#include <rte_eventdev.h>
> +
> +#include <rte_event_eth_rx_adapter.h>
> +
> +#include "test.h"
> +
> +/* i40e limits max to 64 */
> +#define MAX_NUM_RX_QUEUE	64
> +struct rte_mempool *mp;

Pl. avoid globals for mempool, I did similar cleanup
for mempool tests in past. And in your test case, few functions are
are pool consumer so I suggest to add mempool * arg to those
function.

> +uint16_t rx_rings, tx_rings;
> +uint32_t cap;
> +
> +static inline int
> +port_init(uint8_t port, struct rte_mempool *mp)
> +{
> +	static const struct rte_eth_conf port_conf_default = {
> +		.rxmode = {
> +			.mq_mode = ETH_MQ_RX_RSS,
> +			.max_rx_pkt_len = ETHER_MAX_LEN
> +		},
> +		.rx_adv_conf = {
> +			.rss_conf = {
> +				.rss_hf = ETH_RSS_IP |
> +					  ETH_RSS_TCP |
> +					  ETH_RSS_UDP,
> +			}
> +		}
> +	};
> +	const uint16_t rx_ring_size = 512, tx_ring_size = 512;
> +	struct rte_eth_conf port_conf = port_conf_default;
> +	int retval;
> +	uint16_t q;
> +	struct rte_eth_dev_info dev_info;
> +
> +	if (port >= rte_eth_dev_count())
> +		return -1;
> +
> +	rte_eth_dev_info_get(port, &dev_info);
> +	rx_rings = RTE_MIN(MAX_NUM_RX_QUEUE, dev_info.max_rx_queues);
> +
> +	/* Configure the Ethernet device. */
> +	retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf);
> +	if (retval != 0)
> +		return retval;
> +
> +	for (q = 0; q < rx_rings; q++) {
> +		retval = rte_eth_rx_queue_setup(port, q, rx_ring_size,
> +				rte_eth_dev_socket_id(port), NULL, mp);
> +		if (retval < 0)
> +			return retval;
> +	}
> +
> +	/* Allocate and set up 1 TX queue per Ethernet port. */
> +	for (q = 0; q < tx_rings; q++) {
> +		retval = rte_eth_tx_queue_setup(port, q, tx_ring_size,
> +				rte_eth_dev_socket_id(port), NULL);
> +		if (retval < 0)
> +			return retval;
> +	}
> +
> +	/* Start the Ethernet port. */
> +	retval = rte_eth_dev_start(port);
> +	if (retval < 0)
> +		return retval;
> +
> +	/* Display the port MAC address. */
> +	struct ether_addr addr;
> +	rte_eth_macaddr_get(port, &addr);
> +	printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8
> +			   " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n",
> +			(unsigned int)port,
> +			addr.addr_bytes[0], addr.addr_bytes[1],
> +			addr.addr_bytes[2], addr.addr_bytes[3],
> +			addr.addr_bytes[4], addr.addr_bytes[5]);
> +
> +	/* Enable RX in promiscuous mode for the Ethernet device. */
> +	rte_eth_promiscuous_enable(port);
> +
> +	return 0;
> +}
> +
> +static int
> +init_ports(int num_ports)
> +{
> +	uint8_t portid;
> +
> +	mp = rte_pktmbuf_pool_create("packet_pool",
> +			/* mbufs */ 8192 * num_ports * MAX_NUM_RX_QUEUE,
> +			/* cache_size */ 512,

Use macro for cache_size value, same comment for mbufs.
Something like,
for cache_size: RTE_MEMPOOL_CACHE_MAX_SIZE,

Local test macro for mbuf could be:
MBUF_xxx, see test/test/test_mbuf.c.

Thanks.

  reply	other threads:[~2017-09-15  6:07 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-12 12:29 [dpdk-dev] [PATCH v3 0/4] eventdev: cover letter: ethernet Rx queue event adapter Nikhil Rao
2017-09-12 12:29 ` [dpdk-dev] [PATCH v3 1/4] eventdev: Add caps API and PMD callbacks for rte_event_eth_rx_adapter Nikhil Rao
2017-09-12 12:29 ` [dpdk-dev] [PATCH v3 2/4] eventdev: Add eth Rx adapter caps callback to SW evdev Nikhil Rao
2017-09-13 13:36   ` Nipun Gupta
2017-09-14  3:04     ` Rao, Nikhil
2017-09-14  4:37       ` Nipun Gupta
2017-09-12 12:29 ` [dpdk-dev] [PATCH v3 3/4] eventdev: Add eventdev ethernet Rx adapter Nikhil Rao
2017-09-12  4:17   ` Jerin Jacob
2017-09-13  9:41     ` Rao, Nikhil
2017-09-13 18:53       ` [dpdk-dev] [PATCH " Nikhil Rao
2017-09-15  6:07         ` Nipun Gupta
2017-09-18  4:54           ` Rao, Nikhil
2017-09-15  6:10         ` santosh
2017-09-15 11:10           ` Rao, Nikhil
2017-09-15 14:26             ` santosh
2017-09-18 15:36         ` Van Haaren, Harry
2017-09-19 15:25           ` Rao, Nikhil
2017-09-12 12:29 ` [dpdk-dev] [PATCH v3 4/4] eventdev: Add tests for event eth Rx adapter APIs Nikhil Rao
2017-09-15  6:07   ` santosh [this message]
2017-09-18 15:40   ` Van Haaren, Harry
2017-09-21 12:36 ` [dpdk-dev] [PATCH v3 0/4] eventdev: cover letter: ethernet Rx queue event adapter Jerin Jacob

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=97759889-9349-ee87-2386-666973f162d1@caviumnetworks.com \
    --to=santosh.shukla@caviumnetworks.com \
    --cc=abhinandan.gujjar@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=erik.g.carrillo@intel.com \
    --cc=gage.eads@intel.com \
    --cc=harry.van.haaren@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=narender.vangati@intel.com \
    --cc=nikhil.rao@intel.com \
    --cc=nipun.gupta@nxp.com \
    --cc=thomas@monjalon.net \
    /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).