DPDK patches and discussions
 help / color / mirror / Atom feed
From: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/5] pipeline: prepare for variable size headers
Date: Tue, 27 Jul 2021 17:36:05 +0100	[thread overview]
Message-ID: <20210727163609.97769-1-cristian.dumitrescu@intel.com> (raw)

The emit instruction that is responsible for pushing headers into the
output packet is now reading the header length from internal run-time
structures as opposed to constant value from the instruction opcode.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/pipeline/rte_swx_pipeline.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c
index 84505e2a45..2f5cfacd85 100644
--- a/lib/pipeline/rte_swx_pipeline.c
+++ b/lib/pipeline/rte_swx_pipeline.c
@@ -251,6 +251,7 @@ TAILQ_HEAD(header_tailq, header);
 
 struct header_runtime {
 	uint8_t *ptr0;
+	uint32_t n_bytes;
 };
 
 struct header_out_runtime {
@@ -2522,11 +2523,14 @@ header_build(struct rte_swx_pipeline *p)
 
 		TAILQ_FOREACH(h, &p->headers, node) {
 			uint8_t *header_storage;
+			uint32_t n_bytes =  h->st->n_bits / 8;
 
 			header_storage = &t->header_storage[offset];
-			offset += h->st->n_bits / 8;
+			offset += n_bytes;
 
 			t->headers[h->id].ptr0 = header_storage;
+			t->headers[h->id].n_bytes = n_bytes;
+
 			t->structs[h->struct_id] = header_storage;
 		}
 	}
@@ -3262,9 +3266,11 @@ __instr_hdr_emit_exec(struct rte_swx_pipeline *p, uint32_t n_emit)
 	for (i = 0; i < n_emit; i++) {
 		uint32_t header_id = ip->io.hdr.header_id[i];
 		uint32_t struct_id = ip->io.hdr.struct_id[i];
-		uint32_t n_bytes = ip->io.hdr.n_bytes[i];
 
 		struct header_runtime *hi = &t->headers[header_id];
+		uint8_t *hi_ptr0 = hi->ptr0;
+		uint32_t n_bytes = hi->n_bytes;
+
 		uint8_t *hi_ptr = t->structs[struct_id];
 
 		if (!MASK64_BIT_GET(valid_headers, header_id))
@@ -3281,7 +3287,7 @@ __instr_hdr_emit_exec(struct rte_swx_pipeline *p, uint32_t n_emit)
 			if (!t->n_headers_out) {
 				ho = &t->headers_out[0];
 
-				ho->ptr0 = hi->ptr0;
+				ho->ptr0 = hi_ptr0;
 				ho->ptr = hi_ptr;
 
 				ho_ptr = hi_ptr;
@@ -3302,7 +3308,7 @@ __instr_hdr_emit_exec(struct rte_swx_pipeline *p, uint32_t n_emit)
 			ho->n_bytes = ho_nbytes;
 
 			ho++;
-			ho->ptr0 = hi->ptr0;
+			ho->ptr0 = hi_ptr0;
 			ho->ptr = hi_ptr;
 
 			ho_ptr = hi_ptr;
-- 
2.17.1


             reply	other threads:[~2021-07-27 16:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27 16:36 Cristian Dumitrescu [this message]
2021-07-27 16:36 ` [dpdk-dev] [PATCH 2/5] pipeline: add support " Cristian Dumitrescu
2021-07-27 16:36 ` [dpdk-dev] [PATCH 3/5] pipeline: add variable size headers extract instruction Cristian Dumitrescu
2021-07-27 16:36 ` [dpdk-dev] [PATCH 4/5] pipeline: add header look-ahead instruction Cristian Dumitrescu
2021-07-27 16:36 ` [dpdk-dev] [PATCH 5/5] examples/pipeline: add variable size headers example Cristian Dumitrescu
2021-07-27 17:43 ` [dpdk-dev] [PATCH V2 1/5] pipeline: prepare for variable size headers Cristian Dumitrescu
2021-07-27 17:43   ` [dpdk-dev] [PATCH V2 2/5] pipeline: add support " Cristian Dumitrescu
2021-07-27 17:43   ` [dpdk-dev] [PATCH V2 3/5] pipeline: add variable size headers extract instruction Cristian Dumitrescu
2021-07-27 17:43   ` [dpdk-dev] [PATCH V2 4/5] pipeline: add header look-ahead instruction Cristian Dumitrescu
2021-07-27 17:43   ` [dpdk-dev] [PATCH V2 5/5] examples/pipeline: add variable size headers example Cristian Dumitrescu
2021-09-27  7:16   ` [dpdk-dev] [PATCH V2 1/5] pipeline: prepare for variable size headers Thomas Monjalon

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=20210727163609.97769-1-cristian.dumitrescu@intel.com \
    --to=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    /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).