From: Nithin Dabilpuram <ndabilpuram@marvell.com>
To: Akhil Goyal <gakhil@marvell.com>, Fan Zhang <fanzhang.oss@gmail.com>
Cc: <jerinj@marvell.com>, <dev@dpdk.org>,
Nithin Dabilpuram <ndabilpuram@marvell.com>
Subject: [PATCH] app/test: handle error packets from inline IPsec
Date: Thu, 9 Mar 2023 17:23:39 +0530 [thread overview]
Message-ID: <20230309115339.1677916-1-ndabilpuram@marvell.com> (raw)
In inline IPsec path, when the ol_flags indicate error, pkt might
be incomplete. Hence don't trust the m->pkt_len to determine the
size of packet, rather consider even data length's per segment.
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
app/test/test_cryptodev_security_ipsec.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/app/test/test_cryptodev_security_ipsec.c b/app/test/test_cryptodev_security_ipsec.c
index 221edaa98d..7a8688c692 100644
--- a/app/test/test_cryptodev_security_ipsec.c
+++ b/app/test/test_cryptodev_security_ipsec.c
@@ -1042,11 +1042,24 @@ test_ipsec_post_process(const struct rte_mbuf *m, const struct ipsec_test_data *
struct ipsec_test_data *res_d, bool silent,
const struct ipsec_test_flags *flags)
{
- uint32_t len = rte_pktmbuf_pkt_len(m);
+ uint32_t len = rte_pktmbuf_pkt_len(m), data_len;
uint8_t output_text[IPSEC_TEXT_MAX_LEN];
+ const struct rte_mbuf *seg;
const uint8_t *output;
int ret;
+ memset(output_text, 0, IPSEC_TEXT_MAX_LEN);
+ /* Actual data in packet might be less in error cases,
+ * hence take minimum of pkt_len and sum of data_len.
+ * This is done to run through negative test cases.
+ */
+ data_len = 0;
+ seg = m;
+ while (seg) {
+ data_len += seg->data_len;
+ seg = seg->next;
+ }
+ len = RTE_MIN(len, data_len);
/* Copy mbuf payload to continuous buffer */
output = rte_pktmbuf_read(m, 0, len, output_text);
if (output != output_text)
--
2.25.1
next reply other threads:[~2023-03-09 11:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-09 11:53 Nithin Dabilpuram [this message]
2023-03-16 18:26 ` Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230309115339.1677916-1-ndabilpuram@marvell.com \
--to=ndabilpuram@marvell.com \
--cc=dev@dpdk.org \
--cc=fanzhang.oss@gmail.com \
--cc=gakhil@marvell.com \
--cc=jerinj@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).