From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:31 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EFDD666DF39; Mon, 26 Jul 2021 15:19:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrM6HbMz3Jrs; Mon, 26 Jul 2021 15:19:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 915A71952A; Mon, 26 Jul 2021 15:19:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJVTE025481; Mon, 26 Jul 2021 15:19:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJViS025479; Mon, 26 Jul 2021 15:19:31 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:31 GMT Message-Id: <202107261519.16QFJViS025479@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2ec7f3d2fe64 - stable/13 - mlx5en: handle offloaded Rx checksums calculated for tunneled packets MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2ec7f3d2fe648efdc0f67da6981b0d0027a0b1be Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:32 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2ec7f3d2fe648efdc0f67da6981b0d0027a0b1be commit 2ec7f3d2fe648efdc0f67da6981b0d0027a0b1be Author: Konstantin Belousov AuthorDate: 2021-04-06 03:44:13 +0000 Commit: Konstantin Belousov 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 =