From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ernst.netinsight.se (ernst.netinsight.se [194.16.221.21]) by dpdk.org (Postfix) with SMTP id 6286DC31A for ; Wed, 20 May 2015 13:02:12 +0200 (CEST) Received: from miho (unverified [10.100.1.152]) by ernst.netinsight.se (EMWAC SMTPRS 0.83) with SMTP id ; Wed, 20 May 2015 13:02:04 +0200 Date: Wed, 20 May 2015 13:02:05 +0200 From: Simon Kagstrom To: dev@dpdk.org Message-ID: <20150520130205.03ed30be@miho> X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.27; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [dpdk-dev] [PATCH] rte_reorder: Allow sequence numbers > 0 as starting point X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 May 2015 11:02:12 -0000 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 Signed-off-by: Johan Faltstrom --- 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