test/crypto: add UDP encapsulation port verification
authorTejasree Kondoj <ktejasree@marvell.com>
Wed, 29 Sep 2021 03:25:14 +0000 (08:55 +0530)
committerAkhil Goyal <gakhil@marvell.com>
Fri, 8 Oct 2021 19:31:07 +0000 (21:31 +0200)
Added UDP encapsulation ports verification test cases for
IPsec inbound.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
app/test/test_cryptodev.c
app/test/test_cryptodev_security_ipsec.c
app/test/test_cryptodev_security_ipsec.h
doc/guides/rel_notes/release_21_11.rst

index 665d19c..5f0d023 100644 (file)
@@ -9262,6 +9262,19 @@ test_ipsec_proto_tunnel_dst_addr_verify(const void *data __rte_unused)
        return test_ipsec_proto_all(&flags);
 }
 
+static int
+test_ipsec_proto_udp_ports_verify(const void *data __rte_unused)
+{
+       struct ipsec_test_flags flags;
+
+       memset(&flags, 0, sizeof(flags));
+
+       flags.udp_encap = true;
+       flags.udp_ports_verify = true;
+
+       return test_ipsec_proto_all(&flags);
+}
+
 static int
 test_PDCP_PROTO_all(void)
 {
@@ -14194,6 +14207,10 @@ static struct unit_test_suite ipsec_proto_testsuite  = {
                        "UDP encapsulation",
                        ut_setup_security, ut_teardown,
                        test_ipsec_proto_udp_encap),
+               TEST_CASE_NAMED_ST(
+                       "UDP encapsulation ports verification test",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_udp_ports_verify),
                TEST_CASE_NAMED_ST(
                        "SA expiry packets soft",
                        ut_setup_security, ut_teardown,
index f040630..764e77b 100644 (file)
@@ -36,6 +36,14 @@ test_ipsec_sec_caps_verify(struct rte_security_ipsec_xform *ipsec_xform,
                return -ENOTSUP;
        }
 
+       if (ipsec_xform->options.udp_ports_verify == 1 &&
+           sec_cap->ipsec.options.udp_ports_verify == 0) {
+               if (!silent)
+                       RTE_LOG(INFO, USER1, "UDP encapsulation ports "
+                               "verification is not supported\n");
+               return -ENOTSUP;
+       }
+
        if (ipsec_xform->options.copy_dscp == 1 &&
            sec_cap->ipsec.options.copy_dscp == 0) {
                if (!silent)
@@ -216,6 +224,9 @@ test_ipsec_td_update(struct ipsec_test_data td_inb[],
                if (flags->udp_encap)
                        td_inb[i].ipsec_xform.options.udp_encap = 1;
 
+               if (flags->udp_ports_verify)
+                       td_inb[i].ipsec_xform.options.udp_ports_verify = 1;
+
                td_inb[i].ipsec_xform.options.tunnel_hdr_verify =
                        flags->tunnel_hdr_verify;
 
index a65cb54..0416005 100644 (file)
@@ -55,6 +55,7 @@ struct ipsec_test_flags {
        bool iv_gen;
        uint32_t tunnel_hdr_verify;
        bool udp_encap;
+       bool udp_ports_verify;
 };
 
 struct crypto_param {
index 309045e..671cc48 100644 (file)
@@ -137,6 +137,7 @@ New Features
   * Added tests to verify error reporting with ICV corruption.
   * Added tests to verify IV generation.
   * Added tests to verify UDP encapsulation.
+  * Added tests to verify UDP encapsulation ports.
   * Added tests to validate packets soft expiry.
   * Added tests to validate packets hard expiry.
   * Added tests to verify tunnel header verification in IPsec inbound.