From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 596322FDC44; Tue, 26 Aug 2025 13:47:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756216053; cv=none; b=oQfLBPum8yMICzidiQebpuUkTV1X/5lWKPa9cMBfJkCEkCFCEcECMOSYPrBXiL+9qyFaN4VsnPem34cULrucWYZWZPh+rEMbj8xSc7gg+W4Cemv6cfU27GDRcJouuWxyhaeqularQYbdSpz2Lqj2jKiM9MDOTesjYaggPnXP4ts= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756216053; c=relaxed/simple; bh=tsMkao7ccJA77NER/MKEJ+5Wb/Rd9WGXuYdulMxMuHY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Rfz9v/Yl7iuFNjN6GM4uPJnk5f/toE6wFrgsCxb8Ww+h4a7q5BZu6PiAfx5Asp93crdqBD6zVTpXyavfgKJ+NybbfWofn5edKxto0fkDHPfuinaAlcGds/z2wnios/3A4T6R5BHtPP02hKHhnhnVGyi5//TFCEVfxfgRxz5zv0w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Q4NFRglf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Q4NFRglf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEB70C4CEF1; Tue, 26 Aug 2025 13:47:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1756216053; bh=tsMkao7ccJA77NER/MKEJ+5Wb/Rd9WGXuYdulMxMuHY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q4NFRglf+PHBeeAsiS/H7mLkezH7M0/pJqRhCRCoAqlLCUbsD/MCxdruJZBC5NJxB i7s47rwT1FHi7h1PE4nRyBtyzT9IQL9w0WguFbLgfxMF+zW0iIgE5Bpc/bw3+PSn0n kgF1evuY3e/7Zb/22xnxe4eSTLT8Jc/SkU+s7EsA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Gal Pressman , Christoph Paasch , Eric Dumazet , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 234/644] net/mlx5: Correctly set gso_segs when LRO is used Date: Tue, 26 Aug 2025 13:05:25 +0200 Message-ID: <20250826110952.206367343@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250826110946.507083938@linuxfoundation.org> References: <20250826110946.507083938@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christoph Paasch [ Upstream commit 77bf1c55b2acc7fa3734b14f4561e3d75aea1a90 ] When gso_segs is left at 0, a number of assumptions will end up being incorrect throughout the stack. For example, in the GRO-path, we set NAPI_GRO_CB()->count to gso_segs. So, if a non-LRO'ed packet followed by an LRO'ed packet is being processed in GRO, the first one will have NAPI_GRO_CB()->count set to 1 and the next one to 0 (in dev_gro_receive()). Since commit 531d0d32de3e ("net/mlx5: Correctly set gso_size when LRO is used") these packets will get merged (as their gso_size now matches). So, we end up in gro_complete() with NAPI_GRO_CB()->count == 1 and thus don't call inet_gro_complete(). Meaning, checksum-validation in tcp_checksum_complete() will fail with a "hw csum failure". Even before the above mentioned commit, incorrect gso_segs means that other things like TCP's accounting of incoming packets (tp->segs_in, data_segs_in, rcv_ooopack) will be incorrect. Which means that if one does bytes_received/data_segs_in, the result will be bigger than the MTU. Fix this by initializing gso_segs correctly when LRO is used. Fixes: e586b3b0baee ("net/mlx5: Ethernet Datapath files") Reported-by: Gal Pressman Closes: https://lore.kernel.org/netdev/6583783f-f0fb-4fb1-a415-feec8155bc69@nvidia.com/ Signed-off-by: Christoph Paasch Reviewed-by: Gal Pressman Reviewed-by: Eric Dumazet Link: https://patch.msgid.link/20250729-mlx5_gso_segs-v1-1-b48c480c1c12@openai.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c @@ -1061,6 +1061,7 @@ static inline void mlx5e_build_rx_skb(st unsigned int hdrlen = mlx5e_lro_update_hdr(skb, cqe, cqe_bcnt); skb_shinfo(skb)->gso_size = DIV_ROUND_UP(cqe_bcnt - hdrlen, lro_num_seg); + skb_shinfo(skb)->gso_segs = lro_num_seg; /* Subtract one since we already counted this as one * "regular" packet in mlx5e_complete_rx_cqe() */