]> git.droids-corp.org - dpdk.git/commitdiff
test/crypto: add fragmented packet case
authorTejasree Kondoj <ktejasree@marvell.com>
Mon, 6 Dec 2021 11:07:57 +0000 (16:37 +0530)
committerAkhil Goyal <gakhil@marvell.com>
Fri, 21 Jan 2022 10:55:12 +0000 (11:55 +0100)
Add fragmented plain packet test case in combined mode.
The test case leverages combined mode framework to generate
IPsec packet from a fragment and verify that headers are formed
correctly. The IPsec packet would be decapsulated and the plain
packet is compared against the original packet.

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

index 38648f4b92df9b1d5c254e5b7e56d85f5b37b339..4c00b62f0e832c3f63b03241ca11a7a95437de0e 100644 (file)
@@ -9669,6 +9669,18 @@ test_ipsec_proto_stats(const void *data __rte_unused)
        return test_ipsec_proto_all(&flags);
 }
 
+static int
+test_ipsec_proto_pkt_fragment(const void *data __rte_unused)
+{
+       struct ipsec_test_flags flags;
+
+       memset(&flags, 0, sizeof(flags));
+
+       flags.fragment = true;
+
+       return test_ipsec_proto_all(&flags);
+}
+
 static int
 test_PDCP_PROTO_all(void)
 {
@@ -14677,6 +14689,10 @@ static struct unit_test_suite ipsec_proto_testsuite  = {
                        "Statistics: success",
                        ut_setup_security, ut_teardown,
                        test_ipsec_proto_stats),
+               TEST_CASE_NAMED_ST(
+                       "Fragmented packet",
+                       ut_setup_security, ut_teardown,
+                       test_ipsec_proto_pkt_fragment),
                TEST_CASES_END() /**< NULL terminate unit test array */
        }
 };
index 6fa1d3d90a0648dfb01a68e2e1e3bdba41185640..832f9d844d760a5a4f76827cfb6964a4fdbbc165 100644 (file)
@@ -418,6 +418,13 @@ test_ipsec_td_prepare(const struct crypto_param *param1,
                if (flags->stats_success)
                        td->ipsec_xform.options.stats = 1;
 
+               if (flags->fragment) {
+                       struct rte_ipv4_hdr *ip;
+                       ip = (struct rte_ipv4_hdr *)&td->input_text.data;
+                       ip->fragment_offset = 4;
+                       ip->hdr_checksum = rte_ipv4_cksum(ip);
+               }
+
        }
 }