From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Gonzalez Monroy, Sergio" Subject: Re: [PATCH] rte_reorder: Allow sequence numbers > 0 as starting point Date: Fri, 29 May 2015 17:37:40 +0100 Message-ID: <556895D4.9000705@intel.com> References: <20150520130205.03ed30be@miho> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit To: Simon Kagstrom , dev@dpdk.org Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 465155A57 for ; Fri, 29 May 2015 18:37:43 +0200 (CEST) In-Reply-To: <20150520130205.03ed30be@miho> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 20/05/2015 12:02, Simon Kagstrom wrote: > 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. Acked-by: Sergio Gonzalez Monroy