[v2,1/8] net/ice: fix check for outer UDP checksum offload

Message ID 20240405144604.906695-2-david.marchand@redhat.com (mailing list archive)
State Superseded
Delegated to: Thomas Monjalon
Headers
Series Fix outer UDP checksum for Intel nics |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand April 5, 2024, 2:45 p.m. UTC
  ICE_TX_CTX_EIPT_NONE == 0.
There is a good chance that !(anything & 0) is true :-).

While removing this noop check is doable, let's check that the
descriptor does contain a outer ip type.

Fixes: 2ed011776334 ("net/ice: fix outer UDP Tx checksum offload")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Changes since v1:
- fix inverted check,

---
 drivers/net/ice/ice_rxtx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Bruce Richardson April 8, 2024, 3:05 p.m. UTC | #1
On Fri, Apr 05, 2024 at 04:45:55PM +0200, David Marchand wrote:
> ICE_TX_CTX_EIPT_NONE == 0.
> There is a good chance that !(anything & 0) is true :-).
> 
> While removing this noop check is doable, let's check that the
> descriptor does contain a outer ip type.
> 
> Fixes: 2ed011776334 ("net/ice: fix outer UDP Tx checksum offload")
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
  

Patch

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 13aabe97a5..40471306b4 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -2751,9 +2751,9 @@  ice_parse_tunneling_params(uint64_t ol_flags,
 	 * Calculate the tunneling UDP checksum.
 	 * Shall be set only if L4TUNT = 01b and EIPT is not zero
 	 */
-	if (!(*cd_tunneling & ICE_TX_CTX_EIPT_NONE) &&
-		(*cd_tunneling & ICE_TXD_CTX_UDP_TUNNELING) &&
-		(ol_flags & RTE_MBUF_F_TX_OUTER_UDP_CKSUM))
+	if ((*cd_tunneling & ICE_TXD_CTX_QW0_EIPT_M) &&
+			(*cd_tunneling & ICE_TXD_CTX_UDP_TUNNELING) &&
+			(ol_flags & RTE_MBUF_F_TX_OUTER_UDP_CKSUM))
 		*cd_tunneling |= ICE_TXD_CTX_QW0_L4T_CS_M;
 }