From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <reshma.pattan@intel.com>
Received: from mga01.intel.com (mga01.intel.com [192.55.52.88])
 by dpdk.org (Postfix) with ESMTP id 1ECA12E8A
 for <dev@dpdk.org>; Tue,  7 Oct 2014 11:27:09 +0200 (CEST)
Received: from fmsmga003.fm.intel.com ([10.253.24.29])
 by fmsmga101.fm.intel.com with ESMTP; 07 Oct 2014 02:34:20 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; 
 d="scan'208,217";a="396472459"
Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157])
 by FMSMGA003.fm.intel.com with ESMTP; 07 Oct 2014 02:27:35 -0700
Received: from irsmsx109.ger.corp.intel.com ([169.254.13.253]) by
 IRSMSX103.ger.corp.intel.com ([169.254.3.175]) with mapi id 14.03.0195.001;
 Tue, 7 Oct 2014 10:33:07 +0100
From: "Pattan, Reshma" <reshma.pattan@intel.com>
To: "dev@dpdk.org" <dev@dpdk.org>
Thread-Topic: [dpdk-dev] [PATCH RFC] librte_reorder: new reorder library
Thread-Index: Ac/iEVdJ37EJ6J4+T6uxM4L+4xcn2g==
Date: Tue, 7 Oct 2014 09:33:06 +0000
Message-ID: <3AEA2BF9852C6F48A459DA490692831FE21954@IRSMSX109.ger.corp.intel.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-originating-ip: [163.33.239.181]
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
X-Content-Filtered-By: Mailman/MimeDel 2.1.15
Subject: [dpdk-dev]  [PATCH RFC] librte_reorder: new reorder library
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 07 Oct 2014 09:27:11 -0000

Hi All,

I am planning  to implement packet reorder library. Details are as below, p=
lease go through them and provide the comments.

Requirement:
               To reorder out of ordered packets that are received from dif=
ferent cores.

Usage:
To be used along with distributor library. Next version of distributor are =
planned to distribute incoming packets to all worker cores irrespective of =
the flow type.
In this case to ensure in order delivery of the packets at output side reor=
der library will used by the tx end.

Assumption:
All input packets will be marked with sequence number in seqn field of mbuf=
, this will be the reference for reordering at the tx end.
Sequence number will be of type uint32_t. New sequence number field seqn wi=
ll be added to mbuf structure.

Design:
a)There will be reorder buffer(circular buffer) structure maintained in reo=
rder library to store reordered packets and other details of buffer like he=
ad to drain the packet from, min sequence number and other details.
               b)Library will provide insert and drain functions to reorder=
 and fetch out the reordered packets respectively.
c)Users of library should pass the packets to insert functions for reorderi=
ng.

Insertion logic:
Sequence number of current packet will be used to calculate offset in reord=
er buffer and write packet to the location  in the reorder buffer correspon=
ding to offset.
                             Offset is calculated as difference of current =
packet  sequence number and sequence number associated with  reorder buffer.

During sequence number wrapping or wrapping over of reorder buffer size, be=
fore inserting the new packet we should move offset number of packets to ot=
her buffer called overflow buffer and advance the head of reorder buffer by=
 "offset-reorder buffer size" and insert the new packet.

Insert function:
int rte_reorder_insert(struct rte_reorder_buffer *buffer, struct rte_mbuf *=
mbuf);
Note: Other insert function is also under plan to insert burst of packets.

               Reorder buffer:
struct rte_reorder_buffer {
        unsigned int size;      /* The size (number of entries) of the buff=
er. */
        unsigned int mask;      /* Mask (size - 1) of the buffer */
        unsigned int head;      /* Current head of buffer */
        uint32_t min_seqn;      /* latest sequence number associated with b=
uffer */
        struct rte_mbuf *entries[MAX_REORDER_BUFFER_SIZE]; /* buffer to hol=
d reordered mbufs */
};

d)Users can fetch out the reordered packets by drain function provided by l=
ibrary. Users must pass the mbuf array , drain function should fill  passed=
 mbuff array  with the reordered buffer packets.
During drain operation, overflow buffer  packets will be fetched out first =
and then reorder buffer.

Drain function:
               int rte_reorder_drain(struct rte_reorder_buffer *buffer, str=
uct rte_mbuf **mbufs)

Thanks,
Reshma

--------------------------------------------------------------
Intel Shannon Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263
Business address: Dromore House, East Park, Shannon, Co. Clare

This e-mail and any attachments may contain confidential material for the s=
ole use of the intended recipient(s). Any review or distribution by others =
is strictly prohibited. If you are not the intended recipient, please conta=
ct the sender and delete all copies.