From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 72EE8A045E for ; Thu, 30 May 2019 18:51:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B28FF2B9A; Thu, 30 May 2019 18:51:26 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 988201B05 for ; Thu, 30 May 2019 18:51:25 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 May 2019 09:51:24 -0700 X-ExtLoop1: 1 Received: from irsmsx109.ger.corp.intel.com ([163.33.3.23]) by FMSMGA003.fm.intel.com with ESMTP; 30 May 2019 09:51:22 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.155]) by IRSMSX109.ger.corp.intel.com ([169.254.13.162]) with mapi id 14.03.0415.000; Thu, 30 May 2019 17:51:22 +0100 From: "Ananyev, Konstantin" To: Lukasz Bartosik CC: "dev@dpdk.org" , "anoobj@marvell.com" Thread-Topic: [PATCH v2] ipsec: include high order bytes of esn in pkt len Thread-Index: AQHVEWDXzb8lpJMlr0KfKEwDcj7nSKaD7EJA Date: Thu, 30 May 2019 16:51:21 +0000 Message-ID: <2601191342CEEE43887BDE71AB977258016163A722@irsmsx105.ger.corp.intel.com> References: <1556636155-26299-1-git-send-email-lbartosik@marvell.com> <1558613471-24414-1-git-send-email-lbartosik@marvell.com> In-Reply-To: <1558613471-24414-1-git-send-email-lbartosik@marvell.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTI4YTIyYjUtZjNlNy00M2Y3LTlmODEtYjk4MTU4NTFiOThlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiTGN2cERodjBWZ3o1bTlrOFk2TmZ3RlB3a3BlbVVLcFp3RG1cL0RQWDRRK0xKZ0hjbkRnNXIxTGV6MG1aT1BkM2cifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] ipsec: include high order bytes of esn in pkt len 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Lukasz, > diff --git a/lib/librte_ipsec/esp_outb.c b/lib/librte_ipsec/esp_outb.c > index c798bc4..ed5974b 100644 > --- a/lib/librte_ipsec/esp_outb.c > +++ b/lib/librte_ipsec/esp_outb.c > @@ -126,11 +126,11 @@ outb_tun_pkt_prepare(struct rte_ipsec_sa *sa, rte_b= e64_t sqc, >=20 > /* pad length + esp tail */ > pdlen =3D clen - plen; > - tlen =3D pdlen + sa->icv_len; > + tlen =3D pdlen + sa->icv_len + sa->sqh_len; We probably don't want to increase pkt_len by sa->sqh_len for inline case. That's why I suggested to pass sqh_len as parameter to that function. Then for inline we can just pass 0. Do you see any obstacles with that approach? Same thought for transport mode. Konstantin >=20 > /* do append and prepend */ > ml =3D rte_pktmbuf_lastseg(mb); > - if (tlen + sa->sqh_len + sa->aad_len > rte_pktmbuf_tailroom(ml)) > + if (tlen + sa->aad_len > rte_pktmbuf_tailroom(ml)) > return -ENOSPC; >=20 > /* prepend header */ > @@ -152,8 +152,8 @@ outb_tun_pkt_prepare(struct rte_ipsec_sa *sa, rte_be6= 4_t sqc, > rte_memcpy(ph, sa->hdr, sa->hdr_len); >=20 > /* update original and new ip header fields */ > - update_tun_l3hdr(sa, ph + sa->hdr_l3_off, mb->pkt_len, sa->hdr_l3_off, > - sqn_low16(sqc)); > + update_tun_l3hdr(sa, ph + sa->hdr_l3_off, mb->pkt_len - sa->sqh_len, > + sa->hdr_l3_off, sqn_low16(sqc)); >=20 > /* update spi, seqn and iv */ > esph =3D (struct esp_hdr *)(ph + sa->hdr_len); > @@ -292,11 +292,11 @@ outb_trs_pkt_prepare(struct rte_ipsec_sa *sa, rte_b= e64_t sqc, >=20 > /* pad length + esp tail */ > pdlen =3D clen - plen; > - tlen =3D pdlen + sa->icv_len; > + tlen =3D pdlen + sa->icv_len + sa->sqh_len; >=20 > /* do append and insert */ > ml =3D rte_pktmbuf_lastseg(mb); > - if (tlen + sa->sqh_len + sa->aad_len > rte_pktmbuf_tailroom(ml)) > + if (tlen + sa->aad_len > rte_pktmbuf_tailroom(ml)) > return -ENOSPC; >=20 > /* prepend space for ESP header */ > @@ -314,8 +314,8 @@ outb_trs_pkt_prepare(struct rte_ipsec_sa *sa, rte_be6= 4_t sqc, > insert_esph(ph, ph + hlen, uhlen); >=20 > /* update ip header fields */ > - np =3D update_trs_l3hdr(sa, ph + l2len, mb->pkt_len, l2len, l3len, > - IPPROTO_ESP); > + np =3D update_trs_l3hdr(sa, ph + l2len, mb->pkt_len - sa->sqh_len, l2le= n, > + l3len, IPPROTO_ESP); >=20 > /* update spi, seqn and iv */ > esph =3D (struct esp_hdr *)(ph + uhlen); > @@ -425,6 +425,9 @@ esp_outb_sqh_process(const struct rte_ipsec_session *= ss, struct rte_mbuf *mb[], > for (i =3D 0; i !=3D num; i++) { > if ((mb[i]->ol_flags & PKT_RX_SEC_OFFLOAD_FAILED) =3D=3D 0) { > ml =3D rte_pktmbuf_lastseg(mb[i]); > + /* remove high-order 32 bits of esn from packet len */ > + mb[i]->pkt_len -=3D sa->sqh_len; > + ml->data_len -=3D sa->sqh_len; > icv =3D rte_pktmbuf_mtod_offset(ml, void *, > ml->data_len - icv_len); > remove_sqh(icv, icv_len);