DPDK patches and discussions
 help / color / mirror / Atom feed
From: Simon Kagstrom <simon.kagstrom@netinsight.net>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] rte_reorder: Allow sequence numbers > 0 as starting point
Date: Wed, 20 May 2015 13:02:05 +0200	[thread overview]
Message-ID: <20150520130205.03ed30be@miho> (raw)

We use sequence numbers from a generator which has potentially started
long before the receiver. Therefore, the first number will typically
be > 0. The rte_reorder code will not work in this case, since the
packet is seen as outside of the buffer.

The patch instead records the first sequence number inserted as the
starting point.

Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
Signed-off-by: Johan Faltstrom <johan.faltstrom@netinsight.net>
---
 lib/librte_reorder/rte_reorder.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/librte_reorder/rte_reorder.c b/lib/librte_reorder/rte_reorder.c
index dc0e806..4d6449e 100644
--- a/lib/librte_reorder/rte_reorder.c
+++ b/lib/librte_reorder/rte_reorder.c
@@ -73,6 +73,8 @@ struct rte_reorder_buffer {
 	unsigned int memsize; /**< memory area size of reorder buffer */
 	struct cir_buffer ready_buf; /**< temp buffer for dequeued entries */
 	struct cir_buffer order_buf; /**< buffer used to reorder entries */
+
+	int is_initialized;
 } __rte_cache_aligned;
 
 static void
@@ -325,6 +327,12 @@ rte_reorder_insert(struct rte_reorder_buffer *b, struct rte_mbuf *mbuf)
 	uint32_t offset, position;
 	struct cir_buffer *order_buf = &b->order_buf;
 
+	if (!b->is_initialized) {
+	    b->min_seqn = mbuf->seqn;
+
+	    b->is_initialized = 1;
+	}
+
 	/*
 	 * calculate the offset from the head pointer we need to go.
 	 * The subtraction takes care of the sequence number wrapping.
-- 
1.9.1

             reply	other threads:[~2015-05-20 11:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-20 11:02 Simon Kagstrom [this message]
2015-05-28  7:49 ` Gonzalez Monroy, Sergio
2015-05-28  8:15   ` Simon Kågström
2015-05-28  9:36     ` Gonzalez Monroy, Sergio
2015-05-29 16:37 ` Gonzalez Monroy, Sergio
2015-06-22 20:28   ` 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=20150520130205.03ed30be@miho \
    --to=simon.kagstrom@netinsight.net \
    --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).