From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B4FF8A0487 for ; Mon, 1 Jul 2019 15:11:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2657E1B9C3; Mon, 1 Jul 2019 15:11:34 +0200 (CEST) Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id 816A61B99F for ; Mon, 1 Jul 2019 15:11:31 +0200 (CEST) Received: from lfbn-lil-1-176-160.w90-45.abo.wanadoo.fr ([90.45.26.160] helo=droids-corp.org) by mail.droids-corp.org with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hhw8h-0007r6-Do; Mon, 01 Jul 2019 15:14:36 +0200 Received: by droids-corp.org (sSMTP sendmail emulation); Mon, 01 Jul 2019 15:11:29 +0200 Date: Mon, 1 Jul 2019 15:11:29 +0200 From: Olivier Matz To: Fan Zhang Cc: dev@dpdk.org, akhil.goyal@nxp.com, pablo.de.lara.guarch@intel.com, Marko Kovacevic Message-ID: <20190701131129.4mqvqzcq5hbzc6oh@platinum> References: <20190626150509.17442-1-roy.fan.zhang@intel.com> <20190701120124.70418-1-roy.fan.zhang@intel.com> <20190701120124.70418-2-roy.fan.zhang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190701120124.70418-2-roy.fan.zhang@intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH v6 1/2] lib/ipsec: add support for header construction 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" On Mon, Jul 01, 2019 at 01:01:23PM +0100, Fan Zhang wrote: > Add support for RFC 4301(5.1.2) to update of > Type of service field and Traffic class field > bits inside ipv4/ipv6 packets for outbound cases > and inbound cases which deals with the update of > the DSCP/ENC bits inside each of the fields. > > Signed-off-by: Marko Kovacevic > Signed-off-by: Fan Zhang > Acked-by: Konstantin Ananyev > Tested-by: Konstantin Ananyev > --- [...] > --- a/lib/librte_ipsec/esp_outb.c > +++ b/lib/librte_ipsec/esp_outb.c > @@ -152,8 +152,8 @@ outb_tun_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc, > rte_memcpy(ph, sa->hdr, sa->hdr_len); > > /* update original and new ip header fields */ > - update_tun_l3hdr(sa, ph + sa->hdr_l3_off, mb->pkt_len - sqh_len, > - sa->hdr_l3_off, sqn_low16(sqc)); > + update_tun_outb_l3hdr(sa, ph + sa->hdr_l3_off, ph + hlen, > + mb->pkt_len - sqh_len, sa->hdr_l3_off, sqn_low16(sqc)); > > /* update spi, seqn and iv */ > esph = (struct rte_esp_hdr *)(ph + sa->hdr_len); > diff --git a/lib/librte_ipsec/iph.h b/lib/librte_ipsec/iph.h > index 62d78b7b1..90faff6d5 100644 > --- a/lib/librte_ipsec/iph.h > +++ b/lib/librte_ipsec/iph.h > @@ -101,23 +101,183 @@ update_trs_l3hdr(const struct rte_ipsec_sa *sa, void *p, uint32_t plen, > return rc; > } > > +/* > + * The masks for ipv6 header reconstruction (RFC4301) > + */ > +#define IPV6_DSCP_MASK (RTE_IP_DSCP_MASK << RTE_IPV6_HDR_TC_SHIFT) > +#define IPV6_ECN_MASK (RTE_IP_ECN_MASK << RTE_IPV6_HDR_TC_SHIFT) > +#define IPV6_TOS_MASK (IPV6_ECN_MASK | IPV6_DSCP_MASK) > +#define IPV6_ECN_CE IPV6_ECN_MASK [...] > --- a/lib/librte_net/rte_ip.h > +++ b/lib/librte_net/rte_ip.h > @@ -70,6 +70,18 @@ struct rte_ipv4_hdr { > > #define RTE_IPV4_HDR_OFFSET_UNITS 8 > > +/** > + * RFC 3168 Explicit Congestion Notification (ECN) > + * * ECT(1) (ECN-Capable Transport(1)) > + * * ECT(0) (ECN-Capable Transport(0)) > + * * ECT(CE)(CE (Congestion Experienced)) > + */ > +#define RTE_IP_ECN_MASK (0x03) > +#define RTE_IP_ECN_CE RTE_IP_ECN_MASK > + > +/** Packet Option Masks */ > +#define RTE_IP_DSCP_MASK (0xFC) > + > /* > * IPv4 address types > */ Just a quick comment: these flags are also being added in librte_net by this patch: https://mails.dpdk.org/archives/dev/2019-June/135444.html Thanks, Olivier