[v2] net/iavf: fix checksum offloading

Message ID 20230823062911.2483926-1-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series [v2] net/iavf: fix checksum offloading |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-unit-arm64-testing fail Testing issues

Commit Message

David Marchand Aug. 23, 2023, 6:29 a.m. UTC
  l2_len and l3_len fields are related to Tx offloading features.

It is undefined in the DPDK API what those fields may contain if an
application did not request a Tx offload.

Skip reading them if no Tx offloads has been requested.

Fixes: 1e728b01120c ("net/iavf: rework Tx path")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Changes since v1:
- updated commitlog and patch to focus on undefined behavior of net/iavf
  wrt reading l2_len/l3_len,

---
 drivers/net/iavf/iavf_rxtx.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Qi Zhang Aug. 23, 2023, 8:33 a.m. UTC | #1
> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Wednesday, August 23, 2023 2:29 PM
> To: dev@dpdk.org
> Cc: echaudro@redhat.com; mkp@redhat.com; Zhang, Qi Z
> <qi.z.zhang@intel.com>; stable@dpdk.org; Wu, Jingjing
> <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Sinha, Abhijit
> <abhijit.sinha@intel.com>; Doherty, Declan <declan.doherty@intel.com>;
> Nicolau, Radu <radu.nicolau@intel.com>
> Subject: [PATCH v2] net/iavf: fix checksum offloading
> 
> l2_len and l3_len fields are related to Tx offloading features.
> 
> It is undefined in the DPDK API what those fields may contain if an application
> did not request a Tx offload.
> 
> Skip reading them if no Tx offloads has been requested.
> 
> Fixes: 1e728b01120c ("net/iavf: rework Tx path")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
  
Patrick Robb Aug. 24, 2023, 3:24 p.m. UTC | #2
Hi David, you can ignore the failures UNH reported for this patch - we made
a mistake reconfiguring jenkins for the refactored unit test suite. As
discussed we are not running the arm64 unit tests until one of the
solutions we talked about is in place.

On Wed, Aug 23, 2023 at 4:33 AM Zhang, Qi Z <qi.z.zhang@intel.com> wrote:

>
>
> > -----Original Message-----
> > From: David Marchand <david.marchand@redhat.com>
> > Sent: Wednesday, August 23, 2023 2:29 PM
> > To: dev@dpdk.org
> > Cc: echaudro@redhat.com; mkp@redhat.com; Zhang, Qi Z
> > <qi.z.zhang@intel.com>; stable@dpdk.org; Wu, Jingjing
> > <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Sinha,
> Abhijit
> > <abhijit.sinha@intel.com>; Doherty, Declan <declan.doherty@intel.com>;
> > Nicolau, Radu <radu.nicolau@intel.com>
> > Subject: [PATCH v2] net/iavf: fix checksum offloading
> >
> > l2_len and l3_len fields are related to Tx offloading features.
> >
> > It is undefined in the DPDK API what those fields may contain if an
> application
> > did not request a Tx offload.
> >
> > Skip reading them if no Tx offloads has been requested.
> >
> > Fixes: 1e728b01120c ("net/iavf: rework Tx path")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
>
> Acked-by: Qi Zhang <qi.z.zhang@intel.com>
>
> Applied to dpdk-next-net-intel.
>
> Thanks
> Qi
>
>
  

Patch

diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c
index f7df4665d1..33b0f9f482 100644
--- a/drivers/net/iavf/iavf_rxtx.c
+++ b/drivers/net/iavf/iavf_rxtx.c
@@ -2643,6 +2643,9 @@  iavf_build_data_desc_cmd_offset_fields(volatile uint64_t *qw1,
 		l2tag1 |= m->vlan_tci;
 	}
 
+	if ((m->ol_flags & IAVF_TX_CKSUM_OFFLOAD_MASK) == 0)
+		goto skip_cksum;
+
 	/* Set MACLEN */
 	if (m->ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK &&
 			!(m->ol_flags & RTE_MBUF_F_TX_SEC_OFFLOAD))
@@ -2702,6 +2705,7 @@  iavf_build_data_desc_cmd_offset_fields(volatile uint64_t *qw1,
 		break;
 	}
 
+skip_cksum:
 	*qw1 = rte_cpu_to_le_64((((uint64_t)command <<
 		IAVF_TXD_DATA_QW1_CMD_SHIFT) & IAVF_TXD_DATA_QW1_CMD_MASK) |
 		(((uint64_t)offset << IAVF_TXD_DATA_QW1_OFFSET_SHIFT) &