DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] l2fwd-crypto: remove padding after decrypting
@ 2021-02-23  6:12 Hemant Agrawal
  2021-04-05 18:41 ` Akhil Goyal
  2021-04-09 13:14 ` [dpdk-dev] [PATCH v2] l2fwd-crypto: fix packet length while decryption Hemant Agrawal
  0 siblings, 2 replies; 4+ messages in thread
From: Hemant Agrawal @ 2021-02-23  6:12 UTC (permalink / raw)
  To: dev, declan.doherty; +Cc: Rohit Raj

From: Rohit Raj <rohit.raj@nxp.com>

There were some padding left when a packet gets decrypted. This
patch removes those padding.
This patch also removes the padding left after verifying auth of
the packet.

Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
---
 examples/l2fwd-crypto/main.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index a96cb94cc..e7a1eea30 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -616,12 +616,26 @@ l2fwd_simple_forward(struct rte_mbuf *m, uint16_t portid,
 		struct l2fwd_crypto_options *options)
 {
 	uint16_t dst_port;
+	uint32_t pad_len;
+	struct rte_ipv4_hdr *ip_hdr;
+	uint32_t ipdata_offset = sizeof(struct rte_ether_hdr);
 
+	ip_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(m, char *) +
+					 ipdata_offset);
 	dst_port = l2fwd_dst_ports[portid];
 
 	if (options->mac_updating)
 		l2fwd_mac_updating(m, dst_port);
 
+	if (options->auth_xform.auth.op == RTE_CRYPTO_AUTH_OP_VERIFY)
+		rte_pktmbuf_trim(m, options->auth_xform.auth.digest_length);
+
+	if (options->cipher_xform.cipher.op == RTE_CRYPTO_CIPHER_OP_DECRYPT) {
+		pad_len = m->pkt_len - rte_be_to_cpu_16(ip_hdr->total_length) -
+			  ipdata_offset;
+		rte_pktmbuf_trim(m, pad_len);
+	}
+
 	l2fwd_send_packet(m, dst_port);
 }
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH] l2fwd-crypto: remove padding after decrypting
  2021-02-23  6:12 [dpdk-dev] [PATCH] l2fwd-crypto: remove padding after decrypting Hemant Agrawal
@ 2021-04-05 18:41 ` Akhil Goyal
  2021-04-09 13:14 ` [dpdk-dev] [PATCH v2] l2fwd-crypto: fix packet length while decryption Hemant Agrawal
  1 sibling, 0 replies; 4+ messages in thread
From: Akhil Goyal @ 2021-04-05 18:41 UTC (permalink / raw)
  To: hemant.agrawal; +Cc: declan.doherty, dev, rohit.raj

There were some padding left when a packet gets decrypted. This
patch removes those padding.
This patch also removes the padding left after verifying auth of
the packet.

Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
---
 examples/l2fwd-crypto/main.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

this patch is a fix for a bug.
Could you please add a fixes tag and update the
title of patch accordingly
examples/l2fwd-crypto: fix packet length while decryption


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH v2] l2fwd-crypto: fix packet length while decryption
  2021-02-23  6:12 [dpdk-dev] [PATCH] l2fwd-crypto: remove padding after decrypting Hemant Agrawal
  2021-04-05 18:41 ` Akhil Goyal
@ 2021-04-09 13:14 ` Hemant Agrawal
  2021-04-13 12:58   ` [dpdk-dev] [EXT] " Akhil Goyal
  1 sibling, 1 reply; 4+ messages in thread
From: Hemant Agrawal @ 2021-04-09 13:14 UTC (permalink / raw)
  To: dev, gakhil; +Cc: stable, Rohit Raj

From: Rohit Raj <rohit.raj@nxp.com>

There were some padding left when a packet gets decrypted. This
patch removes those padding.
This patch also removes the padding left after verifying auth of
the packet.

Fixes: e2cdfbd07c8a ("examples/l2fwd-crypto: fix port id type")
Cc: stable@dpdk.org

Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
---
 examples/l2fwd-crypto/main.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 1016ceb841..23a398043e 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -616,12 +616,26 @@ l2fwd_simple_forward(struct rte_mbuf *m, uint16_t portid,
 		struct l2fwd_crypto_options *options)
 {
 	uint16_t dst_port;
+	uint32_t pad_len;
+	struct rte_ipv4_hdr *ip_hdr;
+	uint32_t ipdata_offset = sizeof(struct rte_ether_hdr);
 
+	ip_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(m, char *) +
+					 ipdata_offset);
 	dst_port = l2fwd_dst_ports[portid];
 
 	if (options->mac_updating)
 		l2fwd_mac_updating(m, dst_port);
 
+	if (options->auth_xform.auth.op == RTE_CRYPTO_AUTH_OP_VERIFY)
+		rte_pktmbuf_trim(m, options->auth_xform.auth.digest_length);
+
+	if (options->cipher_xform.cipher.op == RTE_CRYPTO_CIPHER_OP_DECRYPT) {
+		pad_len = m->pkt_len - rte_be_to_cpu_16(ip_hdr->total_length) -
+			  ipdata_offset;
+		rte_pktmbuf_trim(m, pad_len);
+	}
+
 	l2fwd_send_packet(m, dst_port);
 }
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [EXT] [PATCH v2] l2fwd-crypto: fix packet length while decryption
  2021-04-09 13:14 ` [dpdk-dev] [PATCH v2] l2fwd-crypto: fix packet length while decryption Hemant Agrawal
@ 2021-04-13 12:58   ` Akhil Goyal
  0 siblings, 0 replies; 4+ messages in thread
From: Akhil Goyal @ 2021-04-13 12:58 UTC (permalink / raw)
  To: Hemant Agrawal, dev; +Cc: stable, Rohit Raj

> From: Rohit Raj <rohit.raj@nxp.com>
> 
> There were some padding left when a packet gets decrypted. This
> patch removes those padding.
> This patch also removes the padding left after verifying auth of
> the packet.
> 
> Fixes: e2cdfbd07c8a ("examples/l2fwd-crypto: fix port id type")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>

Applied to dpdk-next-crypto

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-13 12:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-23  6:12 [dpdk-dev] [PATCH] l2fwd-crypto: remove padding after decrypting Hemant Agrawal
2021-04-05 18:41 ` Akhil Goyal
2021-04-09 13:14 ` [dpdk-dev] [PATCH v2] l2fwd-crypto: fix packet length while decryption Hemant Agrawal
2021-04-13 12:58   ` [dpdk-dev] [EXT] " Akhil Goyal

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).