Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp836820pxu; Mon, 23 Nov 2020 05:32:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJxIGB4RXwpn4dCWiF8lPl0IAG2hxVPu9HCw9qu18lL55uog8dPDxI0AgDLGlJ9aR8+8T20G X-Received: by 2002:a17:906:e53:: with SMTP id q19mr45465821eji.254.1606138354599; Mon, 23 Nov 2020 05:32:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606138354; cv=none; d=google.com; s=arc-20160816; b=uPaj02Q7NNeRoDu7VmVvdS4aUcSHmCt7W2H/SR4P6OvM9stMpmsQHrTQMRuY+6Ym9e fBr8iAnRLISytbtbi14g5MKvrfbmyfqAiOCS4Zfd992SrTfOlVyc0tPrWIQ3IlgA3LI3 8HsSL9YJOL/ct6UkcMZVMA8yaP9AGShL0JJGeqN0sYtIsdHAh0g/kr05D6CeY6fHcQWo DEn/v851cmXmmsSESg+/S6m0oc14PxKhnmQc9ZpRSiGLRkdmsi6EQEBiiSHu4hdsAHff OnQKntTF0Vb2h3kCo8J0mi3anQFShs10bv5RJTErHVcQWwife95C+mCbZdIr91SejutK tE1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fidnoyZYU7hcXyBJ8OGoq72mxN/YmVbiVsOX0PBod7A=; b=WAtg0m+CXy36iPjSl1Dhly/bwI0iSRiEltmOTZYwcBNNYifUOgBdmBB1Gm6Onx2b45 eeWJYO6Pkxoo6ZN576tC5cRAy7XMvOrHtaOsDuDUaShm2WjlBBwNNf/Ie+rMHfFqeCim YrkE8pAEuF1TIJnyv1qCpGsllaSpepuJEHffkZxfpKOgdRZmPGHalc+7e7E9J/GNgmBS 1wnEUJTG1llG+O1jR3/FXW2PtU7Ce26r5wUfMheWIWt32lGo69IWpMJQUREuszYYY3Ak 1B/2vFCwLufT6vRjEobrFuzFG0WwIp6/Qjphsmnm9qSF8sGSFMqFtHB2VRJ50F3a76+S zHnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xUhDfMeD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c19si6402494ejm.162.2020.11.23.05.32.10; Mon, 23 Nov 2020 05:32:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xUhDfMeD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389240AbgKWN3S (ORCPT + 99 others); Mon, 23 Nov 2020 08:29:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:40532 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729814AbgKWM35 (ORCPT ); Mon, 23 Nov 2020 07:29:57 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EDEFA20781; Mon, 23 Nov 2020 12:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134595; bh=rAcPQE4Pyb89krisL2VuBtbaVMFIUWmxdljlRMhVbjY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xUhDfMeDzvmHUNC2Zf/o3B+rTUAfGyW2WEqQZ4eCJIHK08bzhlD9KRS6bcMc/hUJ0 m3M4bXG+GRMNjTZemFiwoofmkX8or0GOKfK7TUZsMKG30cE52UNL+NsN0B8VsZnMFT 5INcWF/OF3Fmya6eycq6sLszfX4/nySPBrI+y7vA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aya Levin , Moshe Shemesh , Eran Ben Elisha , Tariq Toukan , Jakub Kicinski Subject: [PATCH 4.19 15/91] net/mlx4_core: Fix init_hca fields offset Date: Mon, 23 Nov 2020 13:21:35 +0100 Message-Id: <20201123121810.045221651@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121809.285416732@linuxfoundation.org> References: <20201123121809.285416732@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Aya Levin [ Upstream commit 6d9c8d15af0ef20a66a0b432cac0d08319920602 ] Slave function read the following capabilities from the wrong offset: 1. log_mc_entry_sz 2. fs_log_entry_sz 3. log_mc_hash_sz Fix that by adjusting these capabilities offset to match firmware layout. Due to the wrong offset read, the following issues might occur: 1+2. Negative value reported at max_mcast_qp_attach. 3. Driver to init FW with multicast hash size of zero. Fixes: a40ded604365 ("net/mlx4_core: Add masking for a few queries on HCA caps") Signed-off-by: Aya Levin Reviewed-by: Moshe Shemesh Reviewed-by: Eran Ben Elisha Signed-off-by: Tariq Toukan Link: https://lore.kernel.org/r/20201118081922.553-1-tariqt@nvidia.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx4/fw.c | 6 +++--- drivers/net/ethernet/mellanox/mlx4/fw.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) --- a/drivers/net/ethernet/mellanox/mlx4/fw.c +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c @@ -1861,8 +1861,8 @@ int mlx4_INIT_HCA(struct mlx4_dev *dev, #define INIT_HCA_LOG_RD_OFFSET (INIT_HCA_QPC_OFFSET + 0x77) #define INIT_HCA_MCAST_OFFSET 0x0c0 #define INIT_HCA_MC_BASE_OFFSET (INIT_HCA_MCAST_OFFSET + 0x00) -#define INIT_HCA_LOG_MC_ENTRY_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x12) -#define INIT_HCA_LOG_MC_HASH_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x16) +#define INIT_HCA_LOG_MC_ENTRY_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x13) +#define INIT_HCA_LOG_MC_HASH_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x17) #define INIT_HCA_UC_STEERING_OFFSET (INIT_HCA_MCAST_OFFSET + 0x18) #define INIT_HCA_LOG_MC_TABLE_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x1b) #define INIT_HCA_DEVICE_MANAGED_FLOW_STEERING_EN 0x6 @@ -1870,7 +1870,7 @@ int mlx4_INIT_HCA(struct mlx4_dev *dev, #define INIT_HCA_DRIVER_VERSION_SZ 0x40 #define INIT_HCA_FS_PARAM_OFFSET 0x1d0 #define INIT_HCA_FS_BASE_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x00) -#define INIT_HCA_FS_LOG_ENTRY_SZ_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x12) +#define INIT_HCA_FS_LOG_ENTRY_SZ_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x13) #define INIT_HCA_FS_A0_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x18) #define INIT_HCA_FS_LOG_TABLE_SZ_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x1b) #define INIT_HCA_FS_ETH_BITS_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x21) --- a/drivers/net/ethernet/mellanox/mlx4/fw.h +++ b/drivers/net/ethernet/mellanox/mlx4/fw.h @@ -182,8 +182,8 @@ struct mlx4_init_hca_param { u64 cmpt_base; u64 mtt_base; u64 global_caps; - u16 log_mc_entry_sz; - u16 log_mc_hash_sz; + u8 log_mc_entry_sz; + u8 log_mc_hash_sz; u16 hca_core_clock; /* Internal Clock Frequency (in MHz) */ u8 log_num_qps; u8 log_num_srqs;