]> git.droids-corp.org - dpdk.git/commitdiff
crypto/cnxk: add copy and set DF
authorAnoob Joseph <anoobj@marvell.com>
Fri, 17 Dec 2021 09:20:07 +0000 (14:50 +0530)
committerAkhil Goyal <gakhil@marvell.com>
Fri, 21 Jan 2022 09:17:35 +0000 (10:17 +0100)
Add support for copy and set DF bit.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
drivers/crypto/cnxk/cn9k_ipsec.c
drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c

index c9f58255102ab9c6f2ff54f842cd600e499035c6..62b9c2634fb220743298260dc7cd30f2d7948522 100644 (file)
@@ -246,6 +246,8 @@ ipsec_sa_ctl_set(struct rte_security_ipsec_xform *ipsec,
        if (ipsec->options.udp_encap == 1)
                ctl->encap_type = ROC_IE_ON_SA_ENCAP_UDP;
 
+       ctl->copy_df = ipsec->options.copy_df;
+
        ctl->spi = rte_cpu_to_be_32(ipsec->spi);
 
        rte_io_wmb();
@@ -376,13 +378,16 @@ cn9k_ipsec_outb_sa_create(struct cnxk_cpt_qp *qp,
 
        if (ipsec->mode == RTE_SECURITY_IPSEC_SA_MODE_TUNNEL) {
                if (ipsec->tunnel.type == RTE_SECURITY_IPSEC_TUNNEL_IPV4) {
+                       uint16_t frag_off = 0;
                        ctx_len += sizeof(template->ip4);
 
                        ip4->version_ihl = RTE_IPV4_VHL_DEF;
                        ip4->time_to_live = ipsec->tunnel.ipv4.ttl;
                        ip4->type_of_service |= (ipsec->tunnel.ipv4.dscp << 2);
                        if (ipsec->tunnel.ipv4.df)
-                               ip4->fragment_offset = BIT(14);
+                               frag_off |= RTE_IPV4_HDR_DF_FLAG;
+                       ip4->fragment_offset = rte_cpu_to_be_16(frag_off);
+
                        memcpy(&ip4->src_addr, &ipsec->tunnel.ipv4.src_ip,
                               sizeof(struct in_addr));
                        memcpy(&ip4->dst_addr, &ipsec->tunnel.ipv4.dst_ip,
index a0b2a1f5896877b50b46d60c56a1635f233472e9..69ee0d90289cf00bebd4e5d7c7895f94d916b9c6 100644 (file)
@@ -1121,6 +1121,7 @@ static void
 cnxk_sec_caps_update(struct rte_security_capability *sec_cap)
 {
        sec_cap->ipsec.options.udp_encap = 1;
+       sec_cap->ipsec.options.copy_df = 1;
 }
 
 static void