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 <marko.kovace...@intel.com> > Signed-off-by: Fan Zhang <roy.fan.zh...@intel.com> > Acked-by: Konstantin Ananyev <konstantin.anan...@intel.com> > Tested-by: Konstantin Ananyev <konstantin.anan...@intel.com> > ---
[...] > --- 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