All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
To: bruce.richardson@intel.com, harry.van.haaren@intel.com,
	gage.eads@intel.com, hemant.agrawal@nxp.com, nipun.gupta@nxp.com,
	nikhil.rao@intel.com, santosh.shukla@caviumnetworks.com,
	jerin.jacob@caviumnetworks.com
Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Subject: [PATCH 4/8] app/eventdev: add ethernet device setup helpers
Date: Wed, 18 Oct 2017 18:09:04 +0530	[thread overview]
Message-ID: <1508330348-30060-5-git-send-email-pbhagavatula@caviumnetworks.com> (raw)
In-Reply-To: <1508330348-30060-1-git-send-email-pbhagavatula@caviumnetworks.com>

Add ethernet device setup functions to configure ethdev ports incase
prod_type_ethdev option is enabled.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---
 app/test-eventdev/test_perf_atq.c    |  1 +
 app/test-eventdev/test_perf_common.c | 72 ++++++++++++++++++++++++++++++++++++
 app/test-eventdev/test_perf_common.h |  1 +
 app/test-eventdev/test_perf_queue.c  |  1 +
 4 files changed, 75 insertions(+)

diff --git a/app/test-eventdev/test_perf_atq.c b/app/test-eventdev/test_perf_atq.c
index f6fd5d9..aec50a8 100644
--- a/app/test-eventdev/test_perf_atq.c
+++ b/app/test-eventdev/test_perf_atq.c
@@ -281,6 +281,7 @@ static const struct evt_test_ops perf_atq =  {
 	.opt_check          = perf_atq_opt_check,
 	.opt_dump           = perf_atq_opt_dump,
 	.test_setup         = perf_test_setup,
+	.ethdev_setup       = perf_ethdev_setup,
 	.mempool_setup      = perf_mempool_setup,
 	.eventdev_setup     = perf_atq_eventdev_setup,
 	.launch_lcores      = perf_atq_launch_lcores,
diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
index b26d694..ebf8900 100644
--- a/app/test-eventdev/test_perf_common.c
+++ b/app/test-eventdev/test_perf_common.c
@@ -408,6 +408,78 @@ perf_elt_init(struct rte_mempool *mp, void *arg __rte_unused,
 	memset(obj, 0, mp->elt_size);
 }
 
+#define NB_RX_DESC			128
+#define NB_TX_DESC			512
+int
+perf_ethdev_setup(struct evt_test *test, struct evt_options *opt)
+{
+	uint16_t nb_rx_queues = 1;
+	int i;
+	int j;
+	struct test_perf *t = evt_test_priv(test);
+	struct rte_eth_conf port_conf = {
+		.rxmode = {
+			.mq_mode = ETH_MQ_RX_RSS,
+			.max_rx_pkt_len = ETHER_MAX_LEN,
+			.split_hdr_size = 0,
+			.header_split   = 0,
+			.hw_ip_checksum = 0,
+			.hw_vlan_filter = 0,
+			.hw_vlan_strip  = 0,
+			.hw_vlan_extend = 0,
+			.jumbo_frame    = 0,
+			.hw_strip_crc   = 1,
+		},
+		.rx_adv_conf = {
+			.rss_conf = {
+				.rss_key = NULL,
+				.rss_hf = ETH_RSS_IP,
+			},
+		},
+	};
+
+	if (opt->prod_type == EVT_PROD_TYPE_SYNT)
+		return 0;
+
+	if (!rte_eth_dev_count()) {
+		evt_err("No ethernet ports found.\n");
+		return -ENODEV;
+	}
+
+	for (i = 0; i < rte_eth_dev_count(); i++) {
+
+		if (rte_eth_dev_configure(i, nb_rx_queues, nb_rx_queues,
+					&port_conf)
+				< 0) {
+			evt_err("Failed to configure eth port [%d]\n", i);
+			return -EINVAL;
+		}
+
+		for (j = 0; j < nb_rx_queues; j++) {
+			if (rte_eth_rx_queue_setup(i, j, NB_RX_DESC,
+					rte_socket_id(), NULL, t->pool) < 0) {
+				evt_err("Failed to setup eth port [%d]"
+						" rx_queue: %d."
+						" Using synthetic producer\n",
+						i, j);
+				return -EINVAL;
+			}
+			if (rte_eth_tx_queue_setup(i, j, NB_TX_DESC,
+						rte_socket_id(), NULL) < 0) {
+				evt_err("Failed to setup eth port [%d]"
+						" tx_queue: %d."
+						" Using synthetic producer\n",
+						i, j);
+				return -EINVAL;
+			}
+		}
+
+		rte_eth_promiscuous_enable(i);
+	}
+
+	return 0;
+}
+
 int
 perf_mempool_setup(struct evt_test *test, struct evt_options *opt)
 {
diff --git a/app/test-eventdev/test_perf_common.h b/app/test-eventdev/test_perf_common.h
index ab2e599..5c6a615 100644
--- a/app/test-eventdev/test_perf_common.h
+++ b/app/test-eventdev/test_perf_common.h
@@ -157,6 +157,7 @@ perf_nb_event_ports(struct evt_options *opt)
 int perf_test_result(struct evt_test *test, struct evt_options *opt);
 int perf_opt_check(struct evt_options *opt, uint64_t nb_queues);
 int perf_test_setup(struct evt_test *test, struct evt_options *opt);
+int perf_ethdev_setup(struct evt_test *test, struct evt_options *opt);
 int perf_mempool_setup(struct evt_test *test, struct evt_options *opt);
 int perf_event_dev_port_setup(struct evt_test *test, struct evt_options *opt,
 				uint8_t stride, uint8_t nb_queues);
diff --git a/app/test-eventdev/test_perf_queue.c b/app/test-eventdev/test_perf_queue.c
index 3467bb5..4f3e7e7 100644
--- a/app/test-eventdev/test_perf_queue.c
+++ b/app/test-eventdev/test_perf_queue.c
@@ -294,6 +294,7 @@ static const struct evt_test_ops perf_queue =  {
 	.opt_dump           = perf_queue_opt_dump,
 	.test_setup         = perf_test_setup,
 	.mempool_setup      = perf_mempool_setup,
+	.ethdev_setup	    = perf_ethdev_setup,
 	.eventdev_setup     = perf_queue_eventdev_setup,
 	.launch_lcores      = perf_queue_launch_lcores,
 	.eventdev_destroy   = perf_eventdev_destroy,
-- 
2.7.4

  parent reply	other threads:[~2017-10-18 12:40 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-18 12:39 [PATCH 0/8] app/eventdev: add event eth Rx adapter support Pavan Nikhilesh
2017-10-18 12:39 ` [PATCH 1/8] app/eventdev: add ethernet device producer option Pavan Nikhilesh
2017-12-10  8:34   ` Jerin Jacob
2017-10-18 12:39 ` [PATCH 2/8] app/eventdev: modify app setup to support ethdev Pavan Nikhilesh
2017-12-10 11:56   ` Jerin Jacob
2017-10-18 12:39 ` [PATCH 3/8] app/eventdev: add pktmbuf pool for ethdev Pavan Nikhilesh
2017-12-10 12:01   ` Jerin Jacob
2017-10-18 12:39 ` Pavan Nikhilesh [this message]
2017-12-10 12:09   ` [PATCH 4/8] app/eventdev: add ethernet device setup helpers Jerin Jacob
2017-10-18 12:39 ` [PATCH 5/8] app/eventdev: add ethernet device tear down Pavan Nikhilesh
2017-12-10 12:10   ` Jerin Jacob
2017-10-18 12:39 ` [PATCH 6/8] app/eventdev: add event Rx adapter setup Pavan Nikhilesh
2017-12-10 12:13   ` Jerin Jacob
2017-10-18 12:39 ` [PATCH 7/8] app/eventdev: add service core configuration Pavan Nikhilesh
2017-10-18 12:39 ` [PATCH 8/8] doc: update app eventdev options Pavan Nikhilesh
2017-10-18 18:33   ` Mcnamara, John
2017-12-10 12:16   ` Jerin Jacob
2017-12-10  8:28 ` [PATCH 0/8] app/eventdev: add event eth Rx adapter support Jerin Jacob
2017-12-11  7:37   ` Pavan Nikhilesh Bhagavatula
2017-12-11 11:12 ` [PATCH v2 1/8] app/eventdev: add ethernet device producer option Pavan Nikhilesh
2017-12-11 11:12   ` [PATCH v2 2/8] app/eventdev: modify app setup to support ethdev Pavan Nikhilesh
2017-12-11 11:12   ` [PATCH v2 3/8] app/eventdev: add pktmbuf pool for ethdev Pavan Nikhilesh
2017-12-11 11:12   ` [PATCH v2 4/8] app/eventdev: add ethernet device setup helpers Pavan Nikhilesh
2017-12-11 11:12   ` [PATCH v2 5/8] app/eventdev: add ethernet device tear down Pavan Nikhilesh
2017-12-11 11:12   ` [PATCH v2 6/8] app/eventdev: add event Rx adapter setup Pavan Nikhilesh
2017-12-11 11:12   ` [PATCH v2 7/8] app/eventdev: add service core configuration Pavan Nikhilesh
2017-12-11 11:12   ` [PATCH v2 8/8] doc: update app eventdev options Pavan Nikhilesh
2017-12-16  9:34   ` [PATCH v2 1/8] app/eventdev: add ethernet device producer option Jerin Jacob
2017-12-11 15:13 ` [PATCH v3 " Pavan Nikhilesh
2017-12-11 15:13   ` [PATCH v3 2/8] app/eventdev: modify app setup to support ethdev Pavan Nikhilesh
2017-12-11 15:13   ` [PATCH v3 3/8] app/eventdev: add pktmbuf pool for ethdev Pavan Nikhilesh
2017-12-11 15:13   ` [PATCH v3 4/8] app/eventdev: add ethernet device setup helpers Pavan Nikhilesh
2017-12-11 15:13   ` [PATCH v3 5/8] app/eventdev: add ethernet device tear down Pavan Nikhilesh
2017-12-11 15:13   ` [PATCH v3 6/8] app/eventdev: add event Rx adapter setup Pavan Nikhilesh
2017-12-11 15:13   ` [PATCH v3 7/8] app/eventdev: add service core configuration Pavan Nikhilesh
2017-12-19 10:25     ` Van Haaren, Harry
2017-12-11 15:13   ` [PATCH v3 8/8] doc: update app eventdev options Pavan Nikhilesh
2017-12-11 17:34     ` Eads, Gage
2017-12-12  7:19       ` Pavan Nikhilesh Bhagavatula
2017-12-16  9:32       ` 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=1508330348-30060-5-git-send-email-pbhagavatula@caviumnetworks.com \
    --to=pbhagavatula@caviumnetworks.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=gage.eads@intel.com \
    --cc=harry.van.haaren@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=nikhil.rao@intel.com \
    --cc=nipun.gupta@nxp.com \
    --cc=santosh.shukla@caviumnetworks.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.