DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: Harry van Haaren <harry.van.haaren@intel.com>
Cc: <dev@dpdk.org>, Gage Eads <gage.eads@intel.com>,
	David Hunt <david.hunt@intel.com>
Subject: Re: [dpdk-dev] [PATCH 5/7] test/eventdev: unit and functional tests
Date: Wed, 23 Nov 2016 09:02:46 +0530	[thread overview]
Message-ID: <20161123033245.GA30043@svelivela-lt.caveonetworks.com> (raw)
In-Reply-To: <1479319207-130646-6-git-send-email-harry.van.haaren@intel.com>

On Wed, Nov 16, 2016 at 06:00:05PM +0000, Harry van Haaren wrote:
> This commit adds basic unit and functional tests for the eventdev
> API. The test code is added in this commit, but not yet enabled until
> the next commit.
> 
> Signed-off-by: Gage Eads <gage.eads@intel.com>
> Signed-off-by: David Hunt <david.hunt@intel.com>
> Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
> ---

A few comments on portability and usage perspective. See below,

> +#include <rte_eal.h>
> +#include <rte_per_lcore.h>
> +#include <rte_lcore.h>
> +#include <rte_debug.h>
> +#include <rte_ethdev.h>
> +#include <rte_cycles.h>
> +
> +#include <rte_eventdev.h>
> +#include "test.h"
> +
> +
> +static inline int
> +create_ports(struct test *t, int num_ports)
> +{
> +	int i;
> +	static const struct rte_event_port_conf conf = {
> +			.dequeue_queue_depth = 32,
> +			.enqueue_queue_depth = 64,
> +	};

Check the max supported through info get first.

> +
> +	for (i = 0; i < num_ports; i++) {
> +		if (rte_event_port_setup(t->ev, i, &conf) < 0) {
> +			printf("Error setting up port %d\n", i);
> +			return -1;
> +		}
> +		t->port[i] = i;
> +	}
> +
> +	return 0;
> +}
> +
> +
> +static int
> +run_prio_packet_test(struct test *t)

Run per event enqueue priority test if the platform supports
RTE_EVENT_DEV_CAP_EVENT_QOS


> +{
> +	int err;
> +	const uint32_t MAGIC_SEQN[] = {4711, 1234};
> +	const uint32_t PRIORITY[] = {3, 0};
> +	unsigned i;
> +	for(i = 0; i < RTE_DIM(MAGIC_SEQN); i++) {
> +		/* generate pkt and enqueue */
> +		struct rte_event ev;
> +		struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool);
> +		if (!arp) {
> +			printf("%d: gen of pkt failed\n", __LINE__);
> +			return -1;
> +		}
> +		arp->seqn = MAGIC_SEQN[i];

For me, it make sense to don't touch any field in mbuf to make eventdev
model works. use private field to store test specific data

> +
> +		ev = (struct rte_event){
> +			.priority = PRIORITY[i],
> +			.operation = RTE_EVENT_OP_NEW,
> +			.queue_id = t->qid[0],
> +			.mbuf = arp
> +		};
> +		err = rte_event_enqueue(t->ev, t->port[0], &ev, 0);
> +		if (err < 0) {
> +			printf("%d: error failed to enqueue\n", __LINE__);
> +			return -1;
> +		}
> +	}
> +
> +	rte_event_schedule(t->ev);
> +
> +	struct rte_event_dev_stats stats;
> +	err = rte_event_dev_stats_get(t->ev, &stats);
> +	if (err) {
> +		printf("%d: error failed to get stats\n", __LINE__);
> +		return -1;
> +	}
> +
> +	if (stats.port_rx_pkts[t->port[0]] != 2) {
> +		printf("%d: error stats incorrect for directed port\n", __LINE__);
> +		rte_event_dev_dump(stdout, t->ev);
> +		return -1;
> +	}

rely on stats for functional verification may not work in all the
implementation. makes sense to have more concrete functional
verification without stats

> +
> +	struct rte_event ev, ev2;
> +	uint32_t deq_pkts;
> +	deq_pkts = rte_event_dequeue(t->ev, t->port[0], &ev, 0);
> +	if (deq_pkts != 1) {
> +		printf("%d: error failed to deq\n", __LINE__);
> +		rte_event_dev_dump(stdout, t->ev);
> +		return -1;
> +	}
> +	if(ev.mbuf->seqn != MAGIC_SEQN[1]) {
> +		printf("%d: first packet out not highest priority\n", __LINE__);
> +		rte_event_dev_dump(stdout, t->ev);
> +		return -1;
> +	}
> +	rte_pktmbuf_free(ev.mbuf);
> +
> +
> +static int
> +test_overload_trip(struct test *t)

overload tests wont fail in ddr backed systems.(ddr backed system will
mimic infinite size queue to application). So testing against failure
may not work at all in some implementation

> +{
> +	int err;
> +
> +	/* Create instance with 3 directed QIDs going to 3 ports */
> +	if (init(t, 1, 1) < 0 ||
> +			create_ports(t, 1) < 0 ||
> +			create_atomic_qids(t, 1) < 0)
> +		return -1;
> +

  reply	other threads:[~2016-11-23  3:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-16 18:00 [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD Harry van Haaren
2016-11-16 18:00 ` [dpdk-dev] [PATCH 1/7] eventdev: header and implementation Harry van Haaren
2016-11-16 18:00 ` [dpdk-dev] [PATCH 2/7] eventdev: makefiles Harry van Haaren
2016-11-16 18:00 ` [dpdk-dev] [PATCH 3/7] event/sw: software eventdev implementation Harry van Haaren
2016-11-16 18:00 ` [dpdk-dev] [PATCH 4/7] event/sw: makefiles and config Harry van Haaren
2016-11-16 18:00 ` [dpdk-dev] [PATCH 5/7] test/eventdev: unit and functional tests Harry van Haaren
2016-11-23  3:32   ` Jerin Jacob [this message]
2016-11-16 18:00 ` [dpdk-dev] [PATCH 6/7] test/eventdev: unit func makefiles Harry van Haaren
2016-11-16 18:00 ` [dpdk-dev] [PATCH 7/7] examples/eventdev_pipeline: adding example Harry van Haaren
2016-11-22  6:02   ` Jerin Jacob
2016-11-22 14:04     ` Richardson, Bruce
2016-11-23  0:30       ` Jerin Jacob
2016-11-16 20:19 ` [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD Jerin Jacob
2016-11-17 10:05   ` Bruce Richardson
2016-11-18 22:23     ` Jerin Jacob
2016-11-21  9:48       ` Bruce Richardson
2016-11-21 20:18         ` Jerin Jacob
2016-11-22 14:05           ` Richardson, Bruce

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=20161123033245.GA30043@svelivela-lt.caveonetworks.com \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=david.hunt@intel.com \
    --cc=dev@dpdk.org \
    --cc=gage.eads@intel.com \
    --cc=harry.van.haaren@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
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).