common/cnxk: support UDP port verification
authorTejasree Kondoj <ktejasree@marvell.com>
Wed, 29 Sep 2021 03:25:13 +0000 (08:55 +0530)
committerAkhil Goyal <gakhil@marvell.com>
Fri, 8 Oct 2021 19:31:07 +0000 (21:31 +0200)
Adding support to verify UDP encapsulation ports
in IPsec inbound.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
drivers/common/cnxk/cnxk_security.c
drivers/common/cnxk/roc_ie_ot.h
drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c

index 0039a9d..ae3baf6 100644 (file)
@@ -303,6 +303,9 @@ cnxk_ot_ipsec_inb_sa_fill(struct roc_ot_ipsec_inb_sa *sa,
                sa->w10.s.udp_dst_port = 4500;
        }
 
+       if (ipsec_xfrm->options.udp_ports_verify)
+               sa->w2.s.udp_ports_verify = 1;
+
        offset = offsetof(struct roc_ot_ipsec_inb_sa, ctx);
        /* Word offset for HW managed SA field */
        sa->w0.s.hw_ctx_off = offset / 8;
index 12c75af..e8415cf 100644 (file)
@@ -184,7 +184,7 @@ union roc_ot_ipsec_sa_word2 {
                uint64_t esn_en : 1;
                uint64_t tport_l4_incr_csum : 1;
                uint64_t ip_hdr_verify : 2;
-               uint64_t rsvd5 : 1;
+               uint64_t udp_ports_verify : 1;
 
                uint64_t rsvd2 : 7;
                uint64_t async_mode : 1;
@@ -329,7 +329,7 @@ struct roc_ot_ipsec_inb_sa {
                        uint64_t esn_en : 1;
                        uint64_t tport_l4_incr_csum : 1;
                        uint64_t ip_hdr_verify : 2;
-                       uint64_t rsvd5 : 1;
+                       uint64_t udp_ports_verify : 1;
 
                        uint64_t rsvd6 : 7;
                        uint64_t async_mode : 1;
index 8a0cf28..ba4166c 100644 (file)
@@ -921,6 +921,7 @@ cn10k_sec_caps_update(struct rte_security_capability *sec_cap)
                sec_cap->ipsec.options.iv_gen_disable = 1;
 #endif
        } else {
+               sec_cap->ipsec.options.udp_ports_verify = 1;
                if (sec_cap->ipsec.mode == RTE_SECURITY_IPSEC_SA_MODE_TUNNEL)
                        sec_cap->ipsec.options.tunnel_hdr_verify =
                                RTE_SECURITY_IPSEC_TUNNEL_VERIFY_SRC_DST_ADDR;