Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2680095pxj; Mon, 31 May 2021 08:06:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8puhu23qK08KnxszooXMHeqda7a//6TEwtJ1n0pMbON53F7HqH8PBofrfcUAe6SUuvPAm X-Received: by 2002:a17:907:9047:: with SMTP id az7mr11167739ejc.4.1622473603812; Mon, 31 May 2021 08:06:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622473603; cv=none; d=google.com; s=arc-20160816; b=PGnM4m5/vwzyElqxcpZPy8q17aGEaq46G9j0QPs8S2M61tTzU19VFiA3JDeglKCu0Q 9H45UvwIjmmkk9P2wXNCCFeJD+X1/H0u36Ry5nncKH7AoYHANdU+Lr4cBOUB0vt9kFIR KMs7N4tYzBNghlAdXRSf79rHoptwZbmyDqoBiv8p2uG5/zjGafKwM/fWxt0GoTnoI/6w yJzKbKbylM5eXAMhNU49PR0KU9KouPIkcV0xqdjNL0s8cztODN/2E0UKSVBJGbpZ+fnk HEE//OHKeTb+b9pA91Mxd0CmnwLse9/NqGqIw4g34Za0NU5cvfsM20iPrKIALzAgHHaB yRCA== 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=rkXQF7jbHnDS1K2EEIf1hsdkBV8KrzZOymb9v8v22pc=; b=VxT0bgRqjExLb9BebIlGewiCfxR9BOSo/qGh8NeYjc9dT/PS40CrO8rukLrn/gKAxg Ui+MXChTx0dZGgVPSeEz3Wcz6Dx3oq4tt0l1Oil8x+T81SNU2m41YS1AcrEzQvJW+sjS Zt1CWEiT6p9Dw86K8m4ATEAq77p6f+ogh0BGlNkOWdfSFj/+dQC+KAam4XRKIKsN675S 0b4MzlPy5roemfj2u6zbPMIDf+tBuq3eP/PAQwJJmFSJGQGU+6PuwRk75X8jrPBn06F6 Dwo3/RsLULGE9GA/FMU6C/LL4LFSrDUkXgLdLwYdrHGZpSzZhe5PjWvVpqgsUlVOTIlc iwbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=psCFEJnK; 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 r9si12590769ejr.730.2021.05.31.08.06.20; Mon, 31 May 2021 08:06:43 -0700 (PDT) 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=psCFEJnK; 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 S233954AbhEaPEJ (ORCPT + 99 others); Mon, 31 May 2021 11:04:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:40220 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233149AbhEaOHe (ORCPT ); Mon, 31 May 2021 10:07:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4CF5461408; Mon, 31 May 2021 13:39:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468358; bh=KLSH0nHP6iWM/iZlyTw+XyKElfMnEL1/zIgwuEG1xsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=psCFEJnK8JH0Z5xrcuHP4Zy/1VuiEdqhzBDNTx/VE80sjX7CXCLSITSDMjSJPwoMJ cNxpbwmYzbR632tbhQ0PQIcQe2+Rdwm/zmsqML/HWhfCn52YmArRvLwP3UT+YoXsJ0 HOFUkyrH+j1jj35UeVvMUEtJ7El/LyLSO/rQdyws= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Edwin Peer , Michael Chan , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 213/252] bnxt_en: Fix context memory setup for 64K page size. Date: Mon, 31 May 2021 15:14:38 +0200 Message-Id: <20210531130705.251104887@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@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: Michael Chan [ Upstream commit 702279d2ce4650000bb6302013630304e359dc13 ] There was a typo in the code that checks for 64K BNXT_PAGE_SHIFT in bnxt_hwrm_set_pg_attr(). Fix it and make the code more understandable with a new macro BNXT_SET_CTX_PAGE_ATTR(). Fixes: 1b9394e5a2ad ("bnxt_en: Configure context memory on new devices.") Reviewed-by: Edwin Peer Signed-off-by: Michael Chan Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 9 +-------- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index ff86324c7fb8..adfaa9a850dd 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -6834,14 +6834,7 @@ ctx_err: static void bnxt_hwrm_set_pg_attr(struct bnxt_ring_mem_info *rmem, u8 *pg_attr, __le64 *pg_dir) { - u8 pg_size = 0; - - if (BNXT_PAGE_SHIFT == 13) - pg_size = 1 << 4; - else if (BNXT_PAGE_SIZE == 16) - pg_size = 2 << 4; - - *pg_attr = pg_size; + BNXT_SET_CTX_PAGE_ATTR(*pg_attr); if (rmem->depth >= 1) { if (rmem->depth == 2) *pg_attr |= 2; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index e4e926c65118..a95c5afa2f01 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -1440,6 +1440,16 @@ struct bnxt_ctx_pg_info { #define BNXT_MAX_TQM_RINGS \ (BNXT_MAX_TQM_SP_RINGS + BNXT_MAX_TQM_FP_RINGS) +#define BNXT_SET_CTX_PAGE_ATTR(attr) \ +do { \ + if (BNXT_PAGE_SIZE == 0x2000) \ + attr = FUNC_BACKING_STORE_CFG_REQ_SRQ_PG_SIZE_PG_8K; \ + else if (BNXT_PAGE_SIZE == 0x10000) \ + attr = FUNC_BACKING_STORE_CFG_REQ_QPC_PG_SIZE_PG_64K; \ + else \ + attr = FUNC_BACKING_STORE_CFG_REQ_QPC_PG_SIZE_PG_4K; \ +} while (0) + struct bnxt_ctx_mem_info { u32 qp_max_entries; u16 qp_min_qp1_entries; -- 2.30.2