Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jul 2021 15:19:31 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 2ec7f3d2fe64 - stable/13 - mlx5en: handle offloaded Rx checksums calculated for tunneled packets
Message-ID:  <202107261519.16QFJViS025479@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=2ec7f3d2fe648efdc0f67da6981b0d0027a0b1be

commit 2ec7f3d2fe648efdc0f67da6981b0d0027a0b1be
Author:     Konstantin Belousov <konstantinb@nvidia.com>
AuthorDate: 2021-04-06 03:44:13 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-07-26 13:51:10 +0000

    mlx5en: handle offloaded Rx checksums calculated for tunneled packets
    
    (cherry picked from commit 149349e01ecd3a4655f7cbebe54973f6f0b0b371)
---
 sys/dev/mlx5/mlx5_en/mlx5_en_rx.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
index 2bf189efc7e0..7cfd15b6aa5e 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
@@ -306,6 +306,10 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *cqe,
 		}
 #else
 		M_HASHTYPE_SET(mb, M_HASHTYPE_OPAQUE_HASH);
+#endif
+#ifdef M_HASHTYPE_SETINNER
+		if (cqe_is_tunneled(cqe))
+			M_HASHTYPE_SETINNER(mb);
 #endif
 	} else {
 		mb->m_pkthdr.flowid = rq->ix;
@@ -313,7 +317,27 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *cqe,
 	}
 	mb->m_pkthdr.rcvif = ifp;
 
-	if (likely(ifp->if_capenable & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) &&
+	if (cqe_is_tunneled(cqe)) {
+		/*
+		 * CQE can be tunneled only if TIR is configured to
+		 * enable parsing of tunneled payload, so no need to
+		 * check for capabilities.
+		 */
+		if (((cqe->hds_ip_ext & (CQE_L2_OK | CQE_L3_OK)) ==
+		    (CQE_L2_OK | CQE_L3_OK))) {
+			mb->m_pkthdr.csum_flags |=
+			    CSUM_INNER_L3_CALC | CSUM_INNER_L3_VALID |
+			    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;
+		}
+	} else if (likely((ifp->if_capenable & (IFCAP_RXCSUM |
+	    IFCAP_RXCSUM_IPV6)) != 0) &&
 	    ((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 =



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107261519.16QFJViS025479>