summaryrefslogtreecommitdiff
path: root/lib/librte_reorder
diff options
context:
space:
mode:
authorSimon Kagstrom <simon.kagstrom@netinsight.net>2015-05-20 13:02:05 +0200
committerThomas Monjalon <thomas.monjalon@6wind.com>2015-06-22 22:20:12 +0200
commit7e1fa1de8a536c68f6af76cf8d222a9e948c93ba (patch)
tree350ca505055f624a42c4152b4355f8fbccc3a233 /lib/librte_reorder
parent1129992baa61d72c5d9820b1b2aa615d1bbf523b (diff)
downloaddpdk-7e1fa1de8a536c68f6af76cf8d222a9e948c93ba.zip
dpdk-7e1fa1de8a536c68f6af76cf8d222a9e948c93ba.tar.gz
dpdk-7e1fa1de8a536c68f6af76cf8d222a9e948c93ba.tar.xz
reorder: allow random number as starting point
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> Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Diffstat (limited to 'lib/librte_reorder')
-rw-r--r--lib/librte_reorder/rte_reorder.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/librte_reorder/rte_reorder.c b/lib/librte_reorder/rte_reorder.c
index dc0e806..010dff6 100644
--- a/lib/librte_reorder/rte_reorder.c
+++ b/lib/librte_reorder/rte_reorder.c
@@ -73,6 +73,7 @@ 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 +326,11 @@ 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.