Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1650747pxy; Mon, 2 Aug 2021 07:05:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiv410hOuyEgY4h++8tz/BMjHnwkVk4kyRwSvzdzulOy41pUtP16yZqxVUxpENy+6Mds5q X-Received: by 2002:a5d:8990:: with SMTP id m16mr779290iol.170.1627913151815; Mon, 02 Aug 2021 07:05:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627913151; cv=none; d=google.com; s=arc-20160816; b=WC7rximXsvc9cGu/DMhcSEP/lkHdxUU7Og2dyd9MA7Lw5Hit/QN8QTgT4TN1ucHgqp UvWYzvU7fjYr7pbKYdlRFuUOFS7Kl27lnv1X7FklE9omLNyq+I1B0HWdQcjjsV3VkY8p lnsU2SdYGVX5YmB93uDCIgRG09Irc3p1XXbCEvmlHV9p1HY4ac+kzWaRAXJasDx7M3Qp rVsUIBGlSwfBrqPDcy6YNVK4thjSAp1hNPcCxJoYHro7uuGA1H/ADS0hpMKebTuX83pg c/7CVn4tLEmpRU4//dSmHpK2SsEjE0DPOudQBBDGaxX04Dkf76Mb6PokTlnkfUc3etIb el8Q== 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=PqI98k9vsKE4k1GELCAh3wchCpfhIifOcTBr6nXYWJU=; b=hKA0Vs/gyVktHH+di1tQftDRKdBgv78u+WyEH4iC6cdlhX04QfSF82dCDRoeramt+p hhslUaE6yHLIb0wSxaWA6RyGYucVM3a7GelHgxYkOoeFU8sLmDbKtrY84mFWy600SADy MaoHLD9wgGx81MuikXpod8LA+0FTdKZBsjiozSB1sZtVFt6GXh0PKVbqyQkh6QsvV5Kd jYK7RKCqmaIQaCjIoIa5p5q+dnsoXQwfHcLKc+nM/JUPETYKdy1iIMkY6XcqA8r+E2RM 4CMgdjgaH7gTOYEcvITI1TGnNOyjKI4YkcyLN5HiD6a1evfBvTwdhxa8CDnSI89fW8KD v/Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kSbWZEvH; 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 j25si11753926jaj.93.2021.08.02.07.05.40; Mon, 02 Aug 2021 07:05:51 -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=kSbWZEvH; 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 S233939AbhHBOD1 (ORCPT + 99 others); Mon, 2 Aug 2021 10:03:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:34568 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235158AbhHBNze (ORCPT ); Mon, 2 Aug 2021 09:55:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 62987611C5; Mon, 2 Aug 2021 13:54:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627912443; bh=ay5Tboly/MM24mdV2SB/CRgXLQIV3z1cdjrv5/KZ3LE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kSbWZEvHZjesM7ccLvFm9X9BN3/R1lZG/QgOI9fW+zrc4Tn+0SBC2RobJ4ZeGjfNM 9JtYKg0pmahg6KQnx7Mkd9Tr0Ui4zm1K4osqcq5Y4b1hA8usEGLx58CQMyIsQGyH/2 a2wjTwFTrDvGqCE35qiPKFtq+u1vHECrXnAy0Pgg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naresh Kumar PBS , Selvin Xavier , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.10 28/67] RDMA/bnxt_re: Fix stats counters Date: Mon, 2 Aug 2021 15:44:51 +0200 Message-Id: <20210802134339.976726022@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210802134339.023067817@linuxfoundation.org> References: <20210802134339.023067817@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: Naresh Kumar PBS [ Upstream commit 0c23af52ccd1605926480b5dfd1dd857ef604611 ] Statistical counters are not incrementing in some adapter versions with newer FW. This is due to the stats context length mismatch between FW and driver. Since the L2 driver updates the length correctly, use the stats length from L2 driver while allocating the DMA'able memory and creating the stats context. Fixes: 9d6b648c3112 ("bnxt_en: Update firmware interface spec to 1.10.1.65.") Link: https://lore.kernel.org/r/1626010296-6076-1-git-send-email-selvin.xavier@broadcom.com Signed-off-by: Naresh Kumar PBS Signed-off-by: Selvin Xavier Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/bnxt_re/main.c | 4 +++- drivers/infiniband/hw/bnxt_re/qplib_res.c | 10 ++++------ drivers/infiniband/hw/bnxt_re/qplib_res.h | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c index 04621ba8fa76..1fadca8af71a 100644 --- a/drivers/infiniband/hw/bnxt_re/main.c +++ b/drivers/infiniband/hw/bnxt_re/main.c @@ -119,6 +119,7 @@ static int bnxt_re_setup_chip_ctx(struct bnxt_re_dev *rdev, u8 wqe_mode) if (!chip_ctx) return -ENOMEM; chip_ctx->chip_num = bp->chip_num; + chip_ctx->hw_stats_size = bp->hw_ring_stats_size; rdev->chip_ctx = chip_ctx; /* rest members to follow eventually */ @@ -507,6 +508,7 @@ static int bnxt_re_net_stats_ctx_alloc(struct bnxt_re_dev *rdev, dma_addr_t dma_map, u32 *fw_stats_ctx_id) { + struct bnxt_qplib_chip_ctx *chip_ctx = rdev->chip_ctx; struct hwrm_stat_ctx_alloc_output resp = {0}; struct hwrm_stat_ctx_alloc_input req = {0}; struct bnxt_en_dev *en_dev = rdev->en_dev; @@ -523,7 +525,7 @@ static int bnxt_re_net_stats_ctx_alloc(struct bnxt_re_dev *rdev, bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_STAT_CTX_ALLOC, -1, -1); req.update_period_ms = cpu_to_le32(1000); req.stats_dma_addr = cpu_to_le64(dma_map); - req.stats_dma_length = cpu_to_le16(sizeof(struct ctx_hw_stats_ext)); + req.stats_dma_length = cpu_to_le16(chip_ctx->hw_stats_size); req.stat_ctx_flags = STAT_CTX_ALLOC_REQ_STAT_CTX_FLAGS_ROCE; bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp, sizeof(resp), DFLT_HWRM_CMD_TIMEOUT); diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.c b/drivers/infiniband/hw/bnxt_re/qplib_res.c index 3ca47004b752..754dcebeb4ca 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_res.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_res.c @@ -56,6 +56,7 @@ static void bnxt_qplib_free_stats_ctx(struct pci_dev *pdev, struct bnxt_qplib_stats *stats); static int bnxt_qplib_alloc_stats_ctx(struct pci_dev *pdev, + struct bnxt_qplib_chip_ctx *cctx, struct bnxt_qplib_stats *stats); /* PBL */ @@ -559,7 +560,7 @@ int bnxt_qplib_alloc_ctx(struct bnxt_qplib_res *res, goto fail; stats_alloc: /* Stats */ - rc = bnxt_qplib_alloc_stats_ctx(res->pdev, &ctx->stats); + rc = bnxt_qplib_alloc_stats_ctx(res->pdev, res->cctx, &ctx->stats); if (rc) goto fail; @@ -889,15 +890,12 @@ static void bnxt_qplib_free_stats_ctx(struct pci_dev *pdev, } static int bnxt_qplib_alloc_stats_ctx(struct pci_dev *pdev, + struct bnxt_qplib_chip_ctx *cctx, struct bnxt_qplib_stats *stats) { memset(stats, 0, sizeof(*stats)); stats->fw_id = -1; - /* 128 byte aligned context memory is required only for 57500. - * However making this unconditional, it does not harm previous - * generation. - */ - stats->size = ALIGN(sizeof(struct ctx_hw_stats), 128); + stats->size = cctx->hw_stats_size; stats->dma = dma_alloc_coherent(&pdev->dev, stats->size, &stats->dma_map, GFP_KERNEL); if (!stats->dma) { diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.h b/drivers/infiniband/hw/bnxt_re/qplib_res.h index 7a1ab38b95da..58bad6f78456 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_res.h +++ b/drivers/infiniband/hw/bnxt_re/qplib_res.h @@ -60,6 +60,7 @@ struct bnxt_qplib_chip_ctx { u16 chip_num; u8 chip_rev; u8 chip_metal; + u16 hw_stats_size; struct bnxt_qplib_drv_modes modes; }; -- 2.30.2