From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Ananyev, Konstantin" Subject: Re: [PATCH v4 3/3] mbuf:replace the inner_l2_len and the inner_l3_len fields Date: Tue, 2 Dec 2014 15:36:48 +0000 Message-ID: <2601191342CEEE43887BDE71AB977258213BC075@IRSMSX105.ger.corp.intel.com> References: <1417503172-18642-1-git-send-email-jijiang.liu@intel.com> <1417503172-18642-4-git-send-email-jijiang.liu@intel.com> <547DD269.2080500@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable To: didier.pallard , "Liu, Jijiang" , "dev-VfR2kkLFssw@public.gmane.org" Return-path: In-Reply-To: <547DD269.2080500-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> Content-Language: en-US List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" Hi Didier > -----Original Message----- > From: dev [mailto:dev-bounces-VfR2kkLFssw@public.gmane.org] On Behalf Of didier.pallard > Sent: Tuesday, December 02, 2014 2:53 PM > To: Liu, Jijiang; dev-VfR2kkLFssw@public.gmane.org > Subject: Re: [dpdk-dev] [PATCH v4 3/3] mbuf:replace the inner_l2_len and = the inner_l3_len fields >=20 > Hello, >=20 > On 12/02/2014 07:52 AM, Jijiang Liu wrote: > > Replace the inner_l2_len and the inner_l3_len field with the outer_l2_l= en and outer_l3_len field, and rework csum forward engine > and i40e PMD due to these changes. > > > > Signed-off-by: Jijiang Liu > [...] > > --- a/lib/librte_mbuf/rte_mbuf.h > > +++ b/lib/librte_mbuf/rte_mbuf.h > > @@ -276,8 +276,8 @@ struct rte_mbuf { > > uint64_t tso_segsz:16; /**< TCP TSO segment size */ > > > > /* fields for TX offloading of tunnels */ > > - uint64_t inner_l3_len:9; /**< inner L3 (IP) Hdr Length. */ > > - uint64_t inner_l2_len:7; /**< inner L2 (MAC) Hdr Length. */ > > + uint64_t outer_l3_len:9; /**< Outer L3 (IP) Hdr Length. */ > > + uint64_t outer_l2_len:7; /**< Outer L2 (MAC) Hdr Length. */ > > > > /* uint64_t unused:8; */ > > }; >=20 > Sorry for entering lately this discussion, but i'm not convinced by the > choice of outer_lx_len rather than inner_lx_len for new fields. > I agree with Olivier that new flags should only be related to the use of > new fields, to maintain coherency with oldest implementations. > But from a stack point of view, i think it is better to have lx_len > fields that target the outer layers, and to name new fields inner_lx_len. >=20 > Let's discuss the two possibilities. >=20 > 1) outer_lx_len fields are introduced. > In this case, the stack should have knowledge that it is processing > tunneled packets to use outer_lx_len rather than lx_len, > or stack should always use outer_lx_len packet and move those fields to > lx_len packets if no tunneling occurs... > I think it will induce extra processing that does not seem to be really > needed. >=20 > 2) inner_lx_len fields are introduced. > In this case, the stack first uses lx_len fields. When packet should be > tunneled, lx_len fields are moved to inner_lx_len fields. > Then the stack can process the outer layer and still use the lx_len field= s. Not sure, that I understood why 2) is better than 1). Let say, you have a 'normal' (non-tunnelling) packet: ether/IP/TCP In that case you still use mbuf's l2_len/l3_len/l4_len fields and setup ol_= flags as usual. Then later, you decided to 'tunnel' that packet. So you just fill mbuf's outer_l2_len/outer_l3_len, setup TX_OUTER_* and TX_= TUNNEL_* bits in ol_flags and probably update l2_len. l3_len/l4_len and ol_flags bits set for them remain intact. That's with 1) With 2) - you'll have to move l3_len/l4_len to inner_lx_len.=20 And I suppose ol_flags values too: ol_flags &=3D ~PKT_ IP_CKSUM; ol_flgas |=3D PKT_INNER_IP_CKSUM ? And same for L4_CKSUM flags too? Konstantin >=20 > For example: > an eth/IP/TCP forged packet will look like this: >=20 > Ether/IP/UDP/xxx > m->flags =3D IP_CKSUM > m->l2_len =3D sizeof(ether) > m->l3_len =3D sizeof(ip) > m->l4_len =3D sizeof(udp) > m->inner_l2_len =3D 0 > m->inner_l3_len =3D 0 >=20 > When entering tunnel for example a VXLAN interface, lx_len will be moved > to inner_lx_len >=20 > Ether/IP/UDP/xxx > m->flags =3D INNER_IP_CKSUM > m->l2_len =3D 0 > m->l3_len =3D 0 > m->l4_len =3D 0 > m->inner_l2_len =3D sizeof(ether) > m->inner_l3_len =3D sizeof(ip) >=20 >=20 > once complete encapsulation is processed by the stack, the packet will > look like >=20 > Ether/IP/UDP/VXLAN/Ether/IP/UDP/xxx > m->flags =3D IP_CKSUM | INNER_IP_CKSUM > m->l2_len =3D sizeof(ether) > m->l3_len =3D sizeof(ip) > m->l4_len =3D sizeof(udp) > m->inner_l2_len =3D sizeof(ether) + sizeof (vxlan) > m->inner_l3_len =3D sizeof(ip) >=20 >=20 > didier >=20