git: 75312cafe79f - stable/13 - mlx5en: Properly account for no-checksum on tunneled packets.

From: Hans Petter Selasky <hselasky_at_FreeBSD.org>
Date: Tue, 08 Feb 2022 15:14:03 UTC
The branch stable/13 has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=75312cafe79f3ea6b2bd96174084bd75df91bb08

commit 75312cafe79f3ea6b2bd96174084bd75df91bb08
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2022-02-08 15:08:53 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2022-02-08 15:08:53 +0000

    mlx5en: Properly account for no-checksum on tunneled packets.
    
    Sponsored by:   NVIDIA Networking
    
    (cherry picked from commit aabca1034c742ed6160ffec57a7e481d929153f7)
---
 sys/dev/mlx5/mlx5_en/mlx5_en_rx.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
index 522e3f09df2c..9e58a9bd7904 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
@@ -333,11 +333,13 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *cqe,
 			    CSUM_IP_CHECKED | CSUM_IP_VALID |
 			    CSUM_DATA_VALID | CSUM_PSEUDO_HDR;
 			mb->m_pkthdr.csum_data = htons(0xffff);
-		}
-		if (((cqe->hds_ip_ext & (CQE_L2_OK | CQE_L3_OK | CQE_L4_OK)) ==
-		    (CQE_L2_OK | CQE_L3_OK | CQE_L4_OK))) {
-			mb->m_pkthdr.csum_flags |=
-			    CSUM_INNER_L4_CALC | CSUM_INNER_L4_VALID;
+
+			if (likely((cqe->hds_ip_ext & CQE_L4_OK) == CQE_L4_OK)) {
+				mb->m_pkthdr.csum_flags |=
+				    CSUM_INNER_L4_CALC | CSUM_INNER_L4_VALID;
+			}
+		} else {
+			rq->stats.csum_none++;
 		}
 	} else if (likely((ifp->if_capenable & (IFCAP_RXCSUM |
 	    IFCAP_RXCSUM_IPV6)) != 0) &&