RDMA/bnxt_re: Fix stats counters
[ 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: 9d6b648c31
("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 <nareshkumar.pbs@broadcom.com>
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
c8667cb406
commit
e6a06a13ec
@@ -119,6 +119,7 @@ static int bnxt_re_setup_chip_ctx(struct bnxt_re_dev *rdev, u8 wqe_mode)
|
|||||||
if (!chip_ctx)
|
if (!chip_ctx)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
chip_ctx->chip_num = bp->chip_num;
|
chip_ctx->chip_num = bp->chip_num;
|
||||||
|
chip_ctx->hw_stats_size = bp->hw_ring_stats_size;
|
||||||
|
|
||||||
rdev->chip_ctx = chip_ctx;
|
rdev->chip_ctx = chip_ctx;
|
||||||
/* rest members to follow eventually */
|
/* 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,
|
dma_addr_t dma_map,
|
||||||
u32 *fw_stats_ctx_id)
|
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_output resp = {0};
|
||||||
struct hwrm_stat_ctx_alloc_input req = {0};
|
struct hwrm_stat_ctx_alloc_input req = {0};
|
||||||
struct bnxt_en_dev *en_dev = rdev->en_dev;
|
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);
|
bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_STAT_CTX_ALLOC, -1, -1);
|
||||||
req.update_period_ms = cpu_to_le32(1000);
|
req.update_period_ms = cpu_to_le32(1000);
|
||||||
req.stats_dma_addr = cpu_to_le64(dma_map);
|
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;
|
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,
|
bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp,
|
||||||
sizeof(resp), DFLT_HWRM_CMD_TIMEOUT);
|
sizeof(resp), DFLT_HWRM_CMD_TIMEOUT);
|
||||||
|
@@ -56,6 +56,7 @@
|
|||||||
static void bnxt_qplib_free_stats_ctx(struct pci_dev *pdev,
|
static void bnxt_qplib_free_stats_ctx(struct pci_dev *pdev,
|
||||||
struct bnxt_qplib_stats *stats);
|
struct bnxt_qplib_stats *stats);
|
||||||
static int bnxt_qplib_alloc_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);
|
struct bnxt_qplib_stats *stats);
|
||||||
|
|
||||||
/* PBL */
|
/* PBL */
|
||||||
@@ -559,7 +560,7 @@ int bnxt_qplib_alloc_ctx(struct bnxt_qplib_res *res,
|
|||||||
goto fail;
|
goto fail;
|
||||||
stats_alloc:
|
stats_alloc:
|
||||||
/* Stats */
|
/* 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)
|
if (rc)
|
||||||
goto fail;
|
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,
|
static int bnxt_qplib_alloc_stats_ctx(struct pci_dev *pdev,
|
||||||
|
struct bnxt_qplib_chip_ctx *cctx,
|
||||||
struct bnxt_qplib_stats *stats)
|
struct bnxt_qplib_stats *stats)
|
||||||
{
|
{
|
||||||
memset(stats, 0, sizeof(*stats));
|
memset(stats, 0, sizeof(*stats));
|
||||||
stats->fw_id = -1;
|
stats->fw_id = -1;
|
||||||
/* 128 byte aligned context memory is required only for 57500.
|
stats->size = cctx->hw_stats_size;
|
||||||
* However making this unconditional, it does not harm previous
|
|
||||||
* generation.
|
|
||||||
*/
|
|
||||||
stats->size = ALIGN(sizeof(struct ctx_hw_stats), 128);
|
|
||||||
stats->dma = dma_alloc_coherent(&pdev->dev, stats->size,
|
stats->dma = dma_alloc_coherent(&pdev->dev, stats->size,
|
||||||
&stats->dma_map, GFP_KERNEL);
|
&stats->dma_map, GFP_KERNEL);
|
||||||
if (!stats->dma) {
|
if (!stats->dma) {
|
||||||
|
@@ -60,6 +60,7 @@ struct bnxt_qplib_chip_ctx {
|
|||||||
u16 chip_num;
|
u16 chip_num;
|
||||||
u8 chip_rev;
|
u8 chip_rev;
|
||||||
u8 chip_metal;
|
u8 chip_metal;
|
||||||
|
u16 hw_stats_size;
|
||||||
struct bnxt_qplib_drv_modes modes;
|
struct bnxt_qplib_drv_modes modes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user