DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/testpmd: fix IPv4 checksum
@ 2021-08-02 18:00 Gregory Etelson
  2021-08-02 18:04 ` Ajit Khaparde
  2021-08-02 18:13 ` [dpdk-dev] [PATCH v2] " Gregory Etelson
  0 siblings, 2 replies; 5+ messages in thread
From: Gregory Etelson @ 2021-08-02 18:00 UTC (permalink / raw)
  To: dev, yux.jiang
  Cc: getelson, matan, rasland, viacheslavo, Xiaoyun Li, Ajit Khaparde,
	Ori Kam, Olivier Matz

UDP protocol reserves 0 checksum value for special purposes.
Other protocols, like IPv4, TCP and SCTP must calculate checksum value
in software or offload checksum calculation to hardware.

If IPv4 TX checksum offload was off and header checksum was set to 0,
testpmd csum engine did not calculate checksum value for IPv4, TCP and
SCTP.

The patch always calculates IPv4, TCP and SCTP TX checksums if it is
not offloaded.

Fixes: b2a9e4a855d0 ("app/testpmd: fix Tx checksum calculation for tunnel")

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
 app/test-pmd/csumonly.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index bd5ad64a57..607c889359 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -487,7 +487,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
 		} else {
 			if (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) {
 				ol_flags |= PKT_TX_IP_CKSUM;
-			} else if (ipv4_hdr->hdr_checksum != 0) {
+			} else {
 				ipv4_hdr->hdr_checksum = 0;
 				ipv4_hdr->hdr_checksum =
 					rte_ipv4_cksum(ipv4_hdr);
@@ -519,7 +519,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
 			ol_flags |= PKT_TX_TCP_SEG;
 		else if (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) {
 			ol_flags |= PKT_TX_TCP_CKSUM;
-		} else if (tcp_hdr->cksum != 0) {
+		} else {
 			tcp_hdr->cksum = 0;
 			tcp_hdr->cksum =
 				get_udptcp_checksum(l3_hdr, tcp_hdr,
@@ -535,7 +535,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
 		if ((tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) &&
 			((ipv4_hdr->total_length & 0x3) == 0)) {
 			ol_flags |= PKT_TX_SCTP_CKSUM;
-		} else if (sctp_hdr->cksum != 0) {
+		} else {
 			sctp_hdr->cksum = 0;
 			/* XXX implement CRC32c, example available in
 			 * RFC3309 */
-- 
2.32.0


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

* Re: [dpdk-dev] [PATCH] app/testpmd: fix IPv4 checksum
  2021-08-02 18:00 [dpdk-dev] [PATCH] app/testpmd: fix IPv4 checksum Gregory Etelson
@ 2021-08-02 18:04 ` Ajit Khaparde
  2021-08-02 18:13 ` [dpdk-dev] [PATCH v2] " Gregory Etelson
  1 sibling, 0 replies; 5+ messages in thread
From: Ajit Khaparde @ 2021-08-02 18:04 UTC (permalink / raw)
  To: Gregory Etelson
  Cc: dpdk-dev, yux.jiang, Matan Azrad, Raslan Darawsheh,
	Slava Ovsiienko, Xiaoyun Li, Ori Kam, Olivier Matz

[-- Attachment #1: Type: text/plain, Size: 2624 bytes --]

On Mon, Aug 2, 2021 at 11:00 AM Gregory Etelson <getelson@nvidia.com> wrote:
>
> UDP protocol reserves 0 checksum value for special purposes.
> Other protocols, like IPv4, TCP and SCTP must calculate checksum value
> in software or offload checksum calculation to hardware.
>
> If IPv4 TX checksum offload was off and header checksum was set to 0,
> testpmd csum engine did not calculate checksum value for IPv4, TCP and
> SCTP.
>
> The patch always calculates IPv4, TCP and SCTP TX checksums if it is
> not offloaded.
>
> Fixes: b2a9e4a855d0 ("app/testpmd: fix Tx checksum calculation for tunnel")
>
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
I think this fixes Bug 768?

If yes, please add the tag "Bugzilla ID: 768" to the commit.

> ---
>  app/test-pmd/csumonly.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
> index bd5ad64a57..607c889359 100644
> --- a/app/test-pmd/csumonly.c
> +++ b/app/test-pmd/csumonly.c
> @@ -487,7 +487,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
>                 } else {
>                         if (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) {
>                                 ol_flags |= PKT_TX_IP_CKSUM;
> -                       } else if (ipv4_hdr->hdr_checksum != 0) {
> +                       } else {
>                                 ipv4_hdr->hdr_checksum = 0;
>                                 ipv4_hdr->hdr_checksum =
>                                         rte_ipv4_cksum(ipv4_hdr);
> @@ -519,7 +519,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
>                         ol_flags |= PKT_TX_TCP_SEG;
>                 else if (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) {
>                         ol_flags |= PKT_TX_TCP_CKSUM;
> -               } else if (tcp_hdr->cksum != 0) {
> +               } else {
>                         tcp_hdr->cksum = 0;
>                         tcp_hdr->cksum =
>                                 get_udptcp_checksum(l3_hdr, tcp_hdr,
> @@ -535,7 +535,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
>                 if ((tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) &&
>                         ((ipv4_hdr->total_length & 0x3) == 0)) {
>                         ol_flags |= PKT_TX_SCTP_CKSUM;
> -               } else if (sctp_hdr->cksum != 0) {
> +               } else {
>                         sctp_hdr->cksum = 0;
>                         /* XXX implement CRC32c, example available in
>                          * RFC3309 */
> --
> 2.32.0
>

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

* [dpdk-dev] [PATCH v2] app/testpmd: fix IPv4 checksum
  2021-08-02 18:00 [dpdk-dev] [PATCH] app/testpmd: fix IPv4 checksum Gregory Etelson
  2021-08-02 18:04 ` Ajit Khaparde
@ 2021-08-02 18:13 ` Gregory Etelson
  2021-08-03  1:33   ` Ajit Khaparde
  1 sibling, 1 reply; 5+ messages in thread
From: Gregory Etelson @ 2021-08-02 18:13 UTC (permalink / raw)
  To: dev, yux.jiang
  Cc: getelson, matan, rasland, viacheslavo, Xiaoyun Li, Ori Kam,
	Ajit Khaparde, Olivier Matz

UDP protocol reserves 0 checksum value for special purposes.
Other protocols, like IPv4, TCP and SCTP must calculate checksum value
in software or offload checksum calculation to hardware.

If IPv4 TX checksum offload was off and header checksum was set to 0,
testpmd csum engine did not calculate checksum value for IPv4, TCP and
SCTP.

The patch always calculates IPv4, TCP and SCTP TX checksums if it is
not offloaded.

Fixes: b2a9e4a855d0 ("app/testpmd: fix Tx checksum calculation for tunnel")
Bugzilla ID: 768

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
v2: add Bugzilla ID
---
 app/test-pmd/csumonly.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index bd5ad64a57..607c889359 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -487,7 +487,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
 		} else {
 			if (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) {
 				ol_flags |= PKT_TX_IP_CKSUM;
-			} else if (ipv4_hdr->hdr_checksum != 0) {
+			} else {
 				ipv4_hdr->hdr_checksum = 0;
 				ipv4_hdr->hdr_checksum =
 					rte_ipv4_cksum(ipv4_hdr);
@@ -519,7 +519,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
 			ol_flags |= PKT_TX_TCP_SEG;
 		else if (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) {
 			ol_flags |= PKT_TX_TCP_CKSUM;
-		} else if (tcp_hdr->cksum != 0) {
+		} else {
 			tcp_hdr->cksum = 0;
 			tcp_hdr->cksum =
 				get_udptcp_checksum(l3_hdr, tcp_hdr,
@@ -535,7 +535,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
 		if ((tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) &&
 			((ipv4_hdr->total_length & 0x3) == 0)) {
 			ol_flags |= PKT_TX_SCTP_CKSUM;
-		} else if (sctp_hdr->cksum != 0) {
+		} else {
 			sctp_hdr->cksum = 0;
 			/* XXX implement CRC32c, example available in
 			 * RFC3309 */
-- 
2.32.0


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

* Re: [dpdk-dev] [PATCH v2] app/testpmd: fix IPv4 checksum
  2021-08-02 18:13 ` [dpdk-dev] [PATCH v2] " Gregory Etelson
@ 2021-08-03  1:33   ` Ajit Khaparde
  2021-08-04  9:38     ` Thomas Monjalon
  0 siblings, 1 reply; 5+ messages in thread
From: Ajit Khaparde @ 2021-08-03  1:33 UTC (permalink / raw)
  To: Gregory Etelson
  Cc: dpdk-dev, yux.jiang, Matan Azrad, Raslan Darawsheh,
	Slava Ovsiienko, Xiaoyun Li, Ori Kam, Olivier Matz

[-- Attachment #1: Type: text/plain, Size: 2634 bytes --]

On Mon, Aug 2, 2021 at 11:13 AM Gregory Etelson <getelson@nvidia.com> wrote:
>
> UDP protocol reserves 0 checksum value for special purposes.
> Other protocols, like IPv4, TCP and SCTP must calculate checksum value
> in software or offload checksum calculation to hardware.
>
> If IPv4 TX checksum offload was off and header checksum was set to 0,
> testpmd csum engine did not calculate checksum value for IPv4, TCP and
> SCTP.
>
> The patch always calculates IPv4, TCP and SCTP TX checksums if it is
> not offloaded.
>
> Fixes: b2a9e4a855d0 ("app/testpmd: fix Tx checksum calculation for tunnel")
> Bugzilla ID: 768
>
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

> ---
> v2: add Bugzilla ID
> ---
>  app/test-pmd/csumonly.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
> index bd5ad64a57..607c889359 100644
> --- a/app/test-pmd/csumonly.c
> +++ b/app/test-pmd/csumonly.c
> @@ -487,7 +487,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
>                 } else {
>                         if (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) {
>                                 ol_flags |= PKT_TX_IP_CKSUM;
> -                       } else if (ipv4_hdr->hdr_checksum != 0) {
> +                       } else {
>                                 ipv4_hdr->hdr_checksum = 0;
>                                 ipv4_hdr->hdr_checksum =
>                                         rte_ipv4_cksum(ipv4_hdr);
> @@ -519,7 +519,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
>                         ol_flags |= PKT_TX_TCP_SEG;
>                 else if (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) {
>                         ol_flags |= PKT_TX_TCP_CKSUM;
> -               } else if (tcp_hdr->cksum != 0) {
> +               } else {
>                         tcp_hdr->cksum = 0;
>                         tcp_hdr->cksum =
>                                 get_udptcp_checksum(l3_hdr, tcp_hdr,
> @@ -535,7 +535,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
>                 if ((tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) &&
>                         ((ipv4_hdr->total_length & 0x3) == 0)) {
>                         ol_flags |= PKT_TX_SCTP_CKSUM;
> -               } else if (sctp_hdr->cksum != 0) {
> +               } else {
>                         sctp_hdr->cksum = 0;
>                         /* XXX implement CRC32c, example available in
>                          * RFC3309 */
> --
> 2.32.0
>

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

* Re: [dpdk-dev] [PATCH v2] app/testpmd: fix IPv4 checksum
  2021-08-03  1:33   ` Ajit Khaparde
@ 2021-08-04  9:38     ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2021-08-04  9:38 UTC (permalink / raw)
  To: Gregory Etelson
  Cc: dev, yux.jiang, Matan Azrad, Raslan Darawsheh, Slava Ovsiienko,
	Xiaoyun Li, Ori Kam, Olivier Matz, Ajit Khaparde

> > UDP protocol reserves 0 checksum value for special purposes.
> > Other protocols, like IPv4, TCP and SCTP must calculate checksum value
> > in software or offload checksum calculation to hardware.
> >
> > If IPv4 TX checksum offload was off and header checksum was set to 0,
> > testpmd csum engine did not calculate checksum value for IPv4, TCP and
> > SCTP.
> >
> > The patch always calculates IPv4, TCP and SCTP TX checksums if it is
> > not offloaded.
> >
> > Fixes: b2a9e4a855d0 ("app/testpmd: fix Tx checksum calculation for tunnel")
> > Bugzilla ID: 768
> >
> > Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

Applied, thanks.




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

end of thread, other threads:[~2021-08-04  9:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-02 18:00 [dpdk-dev] [PATCH] app/testpmd: fix IPv4 checksum Gregory Etelson
2021-08-02 18:04 ` Ajit Khaparde
2021-08-02 18:13 ` [dpdk-dev] [PATCH v2] " Gregory Etelson
2021-08-03  1:33   ` Ajit Khaparde
2021-08-04  9:38     ` Thomas Monjalon

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