From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id E67AD28EE for ; Sat, 27 May 2017 13:12:19 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 May 2017 04:12:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,402,1491289200"; d="scan'208";a="1135355924" Received: from irsmsx152.ger.corp.intel.com ([163.33.192.66]) by orsmga001.jf.intel.com with ESMTP; 27 May 2017 04:12:16 -0700 Received: from irsmsx109.ger.corp.intel.com ([169.254.13.250]) by IRSMSX152.ger.corp.intel.com ([169.254.6.83]) with mapi id 14.03.0319.002; Sat, 27 May 2017 12:12:16 +0100 From: "Ananyev, Konstantin" To: "Hu, Jiayu" CC: "dev@dpdk.org" , "Wiles, Keith" , "yuanhan.liu@linux.intel.com" Thread-Topic: [PATCH v3 1/3] lib: add Generic Receive Offload API framework Thread-Index: AQHSvNIioTj7qilZNEunAvoVQTYKUKIAL6+AgAGlgACAAN/38IADoyeAgAEVmeCAAD37gIAAjg7Q Date: Sat, 27 May 2017 11:12:16 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772583FAFE69E@IRSMSX109.ger.corp.intel.com> References: <1491309106-94264-1-git-send-email-jiayu.hu@intel.com> <1493021398-115955-1-git-send-email-jiayu.hu@intel.com> <1493021398-115955-2-git-send-email-jiayu.hu@intel.com> <2601191342CEEE43887BDE71AB9772583FAF8C27@IRSMSX109.ger.corp.intel.com> <20170523103154.GA2033@localhost.localdomain> <2601191342CEEE43887BDE71AB9772583FAF9BAE@IRSMSX109.ger.corp.intel.com> <20170526072613.GA85810@localhost.localdomain> <2601191342CEEE43887BDE71AB9772583FAFB22A@IRSMSX109.ger.corp.intel.com> <20170527034137.GA22570@localhost.localdomain> In-Reply-To: <20170527034137.GA22570@localhost.localdomain> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3 1/3] lib: add Generic Receive Offload API framework X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 May 2017 11:12:20 -0000 > -----Original Message----- > From: Hu, Jiayu > Sent: Saturday, May 27, 2017 4:42 AM > To: Ananyev, Konstantin > Cc: dev@dpdk.org; Wiles, Keith ; yuanhan.liu@linux= .intel.com > Subject: Re: [PATCH v3 1/3] lib: add Generic Receive Offload API framewor= k >=20 > On Sat, May 27, 2017 at 07:10:21AM +0800, Ananyev, Konstantin wrote: > > Hi Jiayu, > > > > > -----Original Message----- > > > From: Hu, Jiayu > > > Sent: Friday, May 26, 2017 8:26 AM > > > To: Ananyev, Konstantin > > > Cc: dev@dpdk.org; Wiles, Keith ; yuanhan.liu@l= inux.intel.com > > > Subject: Re: [PATCH v3 1/3] lib: add Generic Receive Offload API fram= ework > > > > > > Hi Konstantin, > > > > > > On Wed, May 24, 2017 at 08:38:25PM +0800, Ananyev, Konstantin wrote: > > > > > > > > Hi Jiayu, > > > > > > > > > > > > > > Hi Konstantin, > > > > > > > > > > Thanks for your comments. My replies/questions are below. > > > > > > > > > > BRs, > > > > > Jiayu > > > > > > > > > > On Mon, May 22, 2017 at 05:19:19PM +0800, Ananyev, Konstantin wro= te: > > > > > > Hi Jiayu, > > > > > > My comments/questions below. > > > > > > Konstantin > > > > > > > > > > > > > > > > > > > > For applications, DPDK GRO provides three external functions = to > > > > > > > enable/disable GRO: > > > > > > > - rte_gro_init: initialize GRO environment; > > > > > > > - rte_gro_enable: enable GRO for a given port; > > > > > > > - rte_gro_disable: disable GRO for a given port. > > > > > > > Before using GRO, applications should explicitly call rte_gro= _init to > > > > > > > initizalize GRO environment. After that, applications can cal= l > > > > > > > rte_gro_enable to enable GRO and call rte_gro_disable to disa= ble GRO for > > > > > > > specific ports. > > > > > > > > > > > > I think this is too restrictive and wouldn't meet various user'= s needs. > > > > > > User might want to: > > > > > > - enable/disable GRO for particular RX queue > > > > > > - or even setup different GRO types for different RX queues, > > > > > > i.e, - GRO over IPV4/TCP for queue 0, and GRO over IPV6/TCP= for queue 1, etc. > > > > > > > > > > The reason for enabling/disabling GRO per-port instead of per-que= ue is that LINUX > > > > > controls GRO per-port. To control GRO per-queue indeed can provid= e more flexibility > > > > > to applications. But are there any scenarios that different queue= s of a port may > > > > > require different GRO control (i.e. GRO types and enable/disable = GRO)? > > > > > > > > I think yes. > > > > > > > > > > > > > > > - For various reasons, user might prefer not to use RX callback= s for various reasons, > > > > > > But invoke gro() manually at somepoint in his code. > > > > > > > > > > An application-used GRO library can enable more flexibility to ap= plications. Besides, > > > > > when perform GRO in ethdev layer or inside PMD drivers, it is an = issue that > > > > > rte_eth_rx_burst returns actually received packet number or GROed= packet number. And > > > > > the same issue happens in GSO, and even more seriously. This is b= ecause applications > > > > > , like VPP, always rely on the return value of rte_eth_tx_burst t= o decide further > > > > > operations. If applications can direcly call GRO/GSO libraries, t= his issue won't exist. > > > > > And DPDK is a library, which is not a holistic system like LINUX.= We don't need to do > > > > > the same as LINUX. Therefore, maybe it's a better idea to directl= y provide SW > > > > > segmentation/reassembling libraries to applications. > > > > > > > > > > > - Many users would like to control size (number of flows/items = per flow), > > > > > > max allowed packet size, max timeout, etc., for different GRO= tables. > > > > > > - User would need a way to flush all or only timeout packets fr= om particular GRO tables. > > > > > > > > > > > > So I think that API needs to extended to become be much more fi= ne-grained. > > > > > > Something like that: > > > > > > > > > > > > struct rte_gro_tbl_param { > > > > > > int32_t socket_id; > > > > > > size_t max_flows; > > > > > > size_t max_items_per_flow; > > > > > > size_t max_pkt_size; > > > > > > uint64_t packet_timeout_cycles; > > > > > > > > > > > > > > > > > > ... > > > > > > }; > > > > > > > > > > > > struct rte_gro_tbl; > > > > > > strct rte_gro_tbl *rte_gro_tbl_create(const struct rte_gro_tbl_= param *param); > > > > > > > > > > > > void rte_gro_tbl_destroy(struct rte_gro_tbl *tbl); > > > > > > > > > > Yes, I agree with you. It's necessary to provide more fine-graine= d control APIs to > > > > > applications. But what's 'packet_timeout_cycles' used for? Is it = for TCP packets? > > > > > > > > For any packets that sits in the gro_table for too long. > > > > > > > > > > > > > > > > > > > > > /* > > > > > > * process packets, might store some packets inside the GRO tab= le, > > > > > > * returns number of filled entries in pkt[] > > > > > > */ > > > > > > uint32_t rte_gro_tbl_process(struct rte_gro_tbl *tbl, struct rt= e_mbuf *pkt[], uint32_t num); > > > > > > > > > > > > /* > > > > > > * retirieves up to num timeouted packets from the table. > > > > > > */ > > > > > > uint32_t rtre_gro_tbl_timeout(struct rte_gro_tbl *tbl, uint64_t= tmt, struct rte_mbuf *pkt[], uint32_t num); > > > > > > > > > > Currently, we implement GRO as RX callback, whose processing logi= c is simple: > > > > > receive burst packets -> perform GRO -> return to application. GR= O stops after > > > > > finishing processing received packets. If we provide rte_gro_tbl_= timeout, when > > > > > and who will call it? > > > > > > > > I mean the following scenario: > > > > We receive a packet, find it is eligible for GRO and put it into gr= o_table > > > > in expectation - there would be more packets for the same flow. > > > > But it could happen that we would never (or for some long time) rec= eive > > > > any new packets for that flow. > > > > So the first packet would never be delivered to the upper layer, > > > > or delivered too late. > > > > So we need a mechanism to extract such not merged packets > > > > and push them to the upper layer. > > > > My thought it would be application responsibility to call it from t= ime to time. > > > > That's actually another reason why I think we shouldn't use applica= tion > > > > to always use RX callbacks for GRO. > > > > > > Currently, we only provide one reassembly function, rte_gro_reassembl= e_burst, > > > which merges N inputted packets at a time. After finishing processing= these > > > packets, it returns all of them and reset hashing tables. Therefore, = there > > > are no packets in hashing tables after rte_gro_reassemble_burst retur= ns. > > > > Ok, sorry I missed that part with rte_hash_reset(). > > So gro_ressemble_burst() performs only inline processing on current inp= ut packets > > and doesn't try to save packets for future merging, correct? >=20 > Yes. >=20 > > Such approach indeed is much lightweight and doesn't require any extra = timeouts and flush(). > > So my opinion let's keep it like that - nice and simple. > > BTW, I think in that case we don't need any hashtables (or any other pe= rsistent strucures)at all. > > What we need is just a set of GROs (tcp4, tpc6, etc.) we want to perfor= m on given array of packets. >=20 > Beside GRO types that are desired to perform, maybe it also needs max_pkt= _size and > some GRO type specific information? Yes, but we don't need the actual hash-tables, etc. inside. Passing something like struct gro_param seems enough. >=20 > > > > > > > > If we provide rte_gro_tbl_timeout, we also need to provide another re= assmebly > > > function, like rte_gro_reassemble, which processes one given packet a= t a > > > time and won't reset hashing tables. Applications decide when to flus= h packets > > > in hashing tables. And rte_gro_tbl_timeout is one of the ways that ca= n be used > > > to flush the packets. Do you mean that? > > > > Yes, that's what I meant, but as I said above - I think your approach i= s probably > > more preferable - it is much simpler and lightweight. > > Konstantin > >