DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
To: gage.eads@intel.com, jerin.jacobkollanukkaran@cavium.com,
	harry.van.haaren@intel.com, hemant.agrawal@nxp.com,
	liang.j.ma@intel.com, santosh.shukla@caviumnetworks.com
Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Subject: [dpdk-dev] [PATCH v2 07/15] examples/eventdev: modify work cycles
Date: Wed, 10 Jan 2018 16:40:05 +0530	[thread overview]
Message-ID: <20180110111013.14644-7-pbhagavatula@caviumnetworks.com> (raw)
In-Reply-To: <20180110111013.14644-1-pbhagavatula@caviumnetworks.com>

The current work cycles function exchanges source and destination mac
address and also pauses the core for the given cycles.
This patch splits the function into two parts i.e. exchange mac and
pause the cores. The pause cores function is invoked at every stage
where as exchange mac is invoked when packet is transmitted.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---
 examples/eventdev_pipeline_sw_pmd/pipeline_common.h         | 11 +++++------
 examples/eventdev_pipeline_sw_pmd/pipeline_worker_generic.c |  7 +++++--
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/examples/eventdev_pipeline_sw_pmd/pipeline_common.h b/examples/eventdev_pipeline_sw_pmd/pipeline_common.h
index 9e1f5e9f0..d58059b78 100644
--- a/examples/eventdev_pipeline_sw_pmd/pipeline_common.h
+++ b/examples/eventdev_pipeline_sw_pmd/pipeline_common.h
@@ -99,21 +99,20 @@ struct fastpath_data *fdata;
 struct config_data cdata;
 
 static __rte_always_inline void
-work(struct rte_mbuf *m)
+exchange_mac(struct rte_mbuf *m)
 {
 	struct ether_hdr *eth;
 	struct ether_addr addr;
 
 	/* change mac addresses on packet (to use mbuf data) */
-	/*
-	 * FIXME Swap mac address properly and also handle the
-	 * case for both odd and even number of stages that the
-	 * addresses end up the same at the end of the pipeline
-	 */
 	eth = rte_pktmbuf_mtod(m, struct ether_hdr *);
 	ether_addr_copy(&eth->d_addr, &addr);
 	ether_addr_copy(&addr, &eth->d_addr);
+}
 
+static __rte_always_inline void
+work(void)
+{
 	/* do a number of cycles of work per packet */
 	volatile uint64_t start_tsc = rte_rdtsc();
 	while (rte_rdtsc() < start_tsc + cdata.worker_cycles)
diff --git a/examples/eventdev_pipeline_sw_pmd/pipeline_worker_generic.c b/examples/eventdev_pipeline_sw_pmd/pipeline_worker_generic.c
index f4523902b..90f87709c 100644
--- a/examples/eventdev_pipeline_sw_pmd/pipeline_worker_generic.c
+++ b/examples/eventdev_pipeline_sw_pmd/pipeline_worker_generic.c
@@ -45,7 +45,7 @@ worker_generic(void *arg)
 		ev.op = RTE_EVENT_OP_FORWARD;
 		ev.sched_type = cdata.queue_type;
 
-		work(ev.mbuf);
+		work();
 
 		while (rte_event_enqueue_burst(dev_id, port_id, &ev, 1) != 1)
 			rte_pause();
@@ -101,7 +101,7 @@ worker_generic_burst(void *arg)
 			events[i].op = RTE_EVENT_OP_FORWARD;
 			events[i].sched_type = cdata.queue_type;
 
-			work(events[i].mbuf);
+			work();
 		}
 		uint16_t nb_tx = rte_event_enqueue_burst(dev_id, port_id,
 				events, nb_rx);
@@ -148,6 +148,7 @@ consumer(void)
 		received++;
 		uint8_t outport = packet.mbuf->port;
 
+		exchange_mac(packet.mbuf);
 		rte_eth_tx_buffer(outport, 0, fdata->tx_buf[outport],
 				packet.mbuf);
 
@@ -212,6 +213,8 @@ consumer_burst(void)
 		received += n;
 		for (i = 0; i < n; i++) {
 			uint8_t outport = packets[i].mbuf->port;
+
+			exchange_mac(packets[i].mbuf);
 			rte_eth_tx_buffer(outport, 0, fdata->tx_buf[outport],
 					packets[i].mbuf);
 
-- 
2.15.1

  parent reply	other threads:[~2018-01-10 11:10 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07 20:36 [dpdk-dev] [PATCH 00/13] examples/eventdev: add capability based pipeline support Pavan Nikhilesh
2017-12-07 20:36 ` [dpdk-dev] [PATCH 01/13] examples/eventdev: add Rx adapter support Pavan Nikhilesh
2017-12-11 16:15   ` Eads, Gage
2017-12-12  8:17     ` Pavan Nikhilesh Bhagavatula
2017-12-12 15:59       ` Eads, Gage
2017-12-07 20:36 ` [dpdk-dev] [PATCH 02/13] examples/eventdev: move common data into pipeline common Pavan Nikhilesh
2017-12-11 16:15   ` Eads, Gage
2017-12-12  8:19     ` Pavan Nikhilesh Bhagavatula
2017-12-07 20:36 ` [dpdk-dev] [PATCH 03/13] examples/eventdev: add framework for caps based pipeline Pavan Nikhilesh
2017-12-07 20:36 ` [dpdk-dev] [PATCH 04/13] examples/eventdev: add generic worker pipeline Pavan Nikhilesh
2017-12-07 20:36 ` [dpdk-dev] [PATCH 05/13] examples/eventdev: add ops to check cmdline args Pavan Nikhilesh
2017-12-19 11:23   ` Van Haaren, Harry
2017-12-07 20:36 ` [dpdk-dev] [PATCH 06/13] examples/eventdev: add non burst mode generic worker Pavan Nikhilesh
2017-12-19 13:26   ` Van Haaren, Harry
2017-12-19 19:01     ` Pavan Nikhilesh
2017-12-07 20:36 ` [dpdk-dev] [PATCH 07/13] examples/eventdev: add thread safe Tx worker pipeline Pavan Nikhilesh
2017-12-19 12:00   ` Van Haaren, Harry
2017-12-19 18:55     ` Pavan Nikhilesh
2017-12-07 20:37 ` [dpdk-dev] [PATCH 08/13] examples/eventdev: add burst for thread safe pipeline Pavan Nikhilesh
2017-12-07 20:37 ` [dpdk-dev] [PATCH 09/13] examples/eventdev: add all type queue option Pavan Nikhilesh
2017-12-19 13:18   ` Van Haaren, Harry
2017-12-19 19:05     ` Pavan Nikhilesh
2017-12-07 20:37 ` [dpdk-dev] [PATCH 10/13] examples/eventdev: add single stage pipeline worker Pavan Nikhilesh
2017-12-11 16:45   ` Eads, Gage
2017-12-07 20:37 ` [dpdk-dev] [PATCH 11/13] examples/eventdev: add atq " Pavan Nikhilesh
2017-12-19 13:34   ` Van Haaren, Harry
2017-12-07 20:37 ` [dpdk-dev] [PATCH 12/13] examples/eventdev_pipeline_sw_pmd: rename example Pavan Nikhilesh
2017-12-07 20:37 ` [dpdk-dev] [PATCH 13/13] doc: update example eventdev_pipeline Pavan Nikhilesh
2017-12-11 11:29   ` Laatz, Kevin
2018-01-10 11:09 ` [dpdk-dev] [PATCH v2 01/15] examples/eventdev: add Rx adapter support Pavan Nikhilesh
2018-01-10 11:10   ` [dpdk-dev] [PATCH v2 02/15] examples/eventdev: move common data into pipeline common Pavan Nikhilesh
2018-01-10 11:10   ` [dpdk-dev] [PATCH v2 03/15] examples/eventdev: add framework for caps based pipeline Pavan Nikhilesh
2018-01-10 11:10   ` [dpdk-dev] [PATCH v2 04/15] examples/eventdev: add generic worker pipeline Pavan Nikhilesh
2018-01-10 11:10   ` [dpdk-dev] [PATCH v2 05/15] examples/eventdev: add ops to check cmdline args Pavan Nikhilesh
2018-01-10 11:10   ` [dpdk-dev] [PATCH v2 06/15] examples/eventdev: add non burst mode generic worker Pavan Nikhilesh
2018-01-10 11:10   ` Pavan Nikhilesh [this message]
2018-01-15 10:14     ` [dpdk-dev] [PATCH v2 07/15] examples/eventdev: modify work cycles Van Haaren, Harry
2018-01-10 11:10   ` [dpdk-dev] [PATCH v2 08/15] examples/eventdev: add thread safe Tx worker pipeline Pavan Nikhilesh
2018-01-10 11:10   ` [dpdk-dev] [PATCH v2 09/15] examples/eventdev: add burst for thread safe pipeline Pavan Nikhilesh
2018-01-10 11:10   ` [dpdk-dev] [PATCH v2 10/15] examples/eventdev: add all type queue option Pavan Nikhilesh
2018-01-10 11:10   ` [dpdk-dev] [PATCH v2 11/15] examples/eventdev: add single stage pipeline worker Pavan Nikhilesh
2018-01-10 11:10   ` [dpdk-dev] [PATCH v2 12/15] examples/eventdev: add atq " Pavan Nikhilesh
2018-01-10 11:10   ` [dpdk-dev] [PATCH v2 13/15] examples/eventdev: add mempool size configuration Pavan Nikhilesh
2018-01-10 11:10   ` [dpdk-dev] [PATCH v2 14/15] examples/eventdev_pipeline_sw_pmd: rename example Pavan Nikhilesh
2018-01-10 11:10   ` [dpdk-dev] [PATCH v2 15/15] doc: update example eventdev pipeline Pavan Nikhilesh
2018-01-16 11:34     ` Kovacevic, Marko
2018-01-16 10:35   ` [dpdk-dev] [PATCH v2 01/15] examples/eventdev: add Rx adapter support Van Haaren, Harry
2018-01-16 16:12     ` 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=20180110111013.14644-7-pbhagavatula@caviumnetworks.com \
    --to=pbhagavatula@caviumnetworks.com \
    --cc=dev@dpdk.org \
    --cc=gage.eads@intel.com \
    --cc=harry.van.haaren@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerin.jacobkollanukkaran@cavium.com \
    --cc=liang.j.ma@intel.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 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).