Return-Path: Received: from mail-cys01nam02on0124.outbound.protection.outlook.com ([104.47.37.124]:59524 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S966390AbeCSQJF (ORCPT ); Mon, 19 Mar 2018 12:09:05 -0400 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Jesper Dangaard Brouer , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 067/167] mlx5: fix bug reading rss_hash_type from CQE Date: Mon, 19 Mar 2018 16:06:45 +0000 Message-ID: <20180319160513.16384-67-alexander.levin@microsoft.com> References: <20180319160513.16384-1-alexander.levin@microsoft.com> In-Reply-To: <20180319160513.16384-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Jesper Dangaard Brouer [ Upstream commit 12e8b570e732eaa5eae3a2895ba3fbcf91bde2b4 ] Masks for extracting part of the Completion Queue Entry (CQE) field rss_hash_type was swapped, namely CQE_RSS_HTYPE_IP and CQE_RSS_HTYPE_L4. The bug resulted in setting skb->l4_hash, even-though the rss_hash_type indicated that hash was NOT computed over the L4 (UDP or TCP) part of the packet. Added comments from the datasheet, to make it more clear what these masks are selecting. Signed-off-by: Jesper Dangaard Brouer Acked-by: Saeed Mahameed Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- include/linux/mlx5/device.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h index a91b67b18a73..5c93f4a89afa 100644 --- a/include/linux/mlx5/device.h +++ b/include/linux/mlx5/device.h @@ -635,8 +635,14 @@ enum { }; =20 enum { - CQE_RSS_HTYPE_IP =3D 0x3 << 6, - CQE_RSS_HTYPE_L4 =3D 0x3 << 2, + CQE_RSS_HTYPE_IP =3D 0x3 << 2, + /* cqe->rss_hash_type[3:2] - IP destination selected for hash + * (00 =3D none, 01 =3D IPv4, 10 =3D IPv6, 11 =3D Reserved) + */ + CQE_RSS_HTYPE_L4 =3D 0x3 << 6, + /* cqe->rss_hash_type[7:6] - L4 destination selected for hash + * (00 =3D none, 01 =3D TCP. 10 =3D UDP, 11 =3D IPSEC.SPI + */ }; =20 enum { --=20 2.14.1