[v2,10/13] test/crypto: add fragmented packet case

Message ID 1638788880-650-11-git-send-email-anoobj@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series Add new cases to lookaside IPsec tests |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Anoob Joseph Dec. 6, 2021, 11:07 a.m. UTC
  From: Tejasree Kondoj <ktejasree@marvell.com>

Add fragmented plain packet test case in combined mode.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
---
 app/test/test_cryptodev.c                | 16 ++++++++++++++++
 app/test/test_cryptodev_security_ipsec.c |  7 +++++++
 2 files changed, 23 insertions(+)
  

Patch

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index d5902dd..9a8cced 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -9670,6 +9670,18 @@  test_ipsec_proto_stats(const void *data __rte_unused)
 }
 
 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)
 {
 	struct crypto_testsuite_params *ts_params = &testsuite_params;
@@ -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 */
 	}
 };
diff --git a/app/test/test_cryptodev_security_ipsec.c b/app/test/test_cryptodev_security_ipsec.c
index 6fa1d3d..832f9d8 100644
--- a/app/test/test_cryptodev_security_ipsec.c
+++ b/app/test/test_cryptodev_security_ipsec.c
@@ -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);
+		}
+
 	}
 }