Commit e0387e1d authored by Devesh Sharma's avatar Devesh Sharma Committed by Jason Gunthorpe

RDMA/bnxt_re: Skip backing store allocation for 57500 series

The backing store to keep HW context data structures is allocated and
initialized by L2 driver. For 57500 chip RoCE driver do not require to
allocate and initialize additional memory. Changing to skip duplicate
allocation and initialization for 57500 adapters. Driver continues as
before for older chips.

This patch also takes care of stats context memory alignment to 128
boundary, a requirement for 57500 series of chip. Older chips do not care
of alignment, thus the change is unconditional.
Signed-off-by: default avatarSelvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: default avatarDevesh Sharma <devesh.sharma@broadcom.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent b353ce55
...@@ -1401,7 +1401,8 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev) ...@@ -1401,7 +1401,8 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev)
if (!rdev->is_virtfn) if (!rdev->is_virtfn)
bnxt_re_set_resource_limits(rdev); bnxt_re_set_resource_limits(rdev);
rc = bnxt_qplib_alloc_ctx(rdev->en_dev->pdev, &rdev->qplib_ctx, 0); rc = bnxt_qplib_alloc_ctx(rdev->en_dev->pdev, &rdev->qplib_ctx, 0,
bnxt_qplib_is_chip_gen_p5(&rdev->chip_ctx));
if (rc) { if (rc) {
pr_err("Failed to allocate QPLIB context: %#x\n", rc); pr_err("Failed to allocate QPLIB context: %#x\n", rc);
goto disable_rcfw; goto disable_rcfw;
......
...@@ -482,11 +482,13 @@ int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw, ...@@ -482,11 +482,13 @@ int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw,
req.log2_dbr_pg_size = cpu_to_le16(PAGE_SHIFT - req.log2_dbr_pg_size = cpu_to_le16(PAGE_SHIFT -
RCFW_DBR_BASE_PAGE_SHIFT); RCFW_DBR_BASE_PAGE_SHIFT);
/* /*
* VFs need not setup the HW context area, PF * Gen P5 devices doesn't require this allocation
* as the L2 driver does the same for RoCE also.
* Also, VFs need not setup the HW context area, PF
* shall setup this area for VF. Skipping the * shall setup this area for VF. Skipping the
* HW programming * HW programming
*/ */
if (is_virtfn) if (is_virtfn || bnxt_qplib_is_chip_gen_p5(rcfw->res->cctx))
goto skip_ctx_setup; goto skip_ctx_setup;
level = ctx->qpc_tbl.level; level = ctx->qpc_tbl.level;
......
...@@ -330,13 +330,13 @@ void bnxt_qplib_free_ctx(struct pci_dev *pdev, ...@@ -330,13 +330,13 @@ void bnxt_qplib_free_ctx(struct pci_dev *pdev,
*/ */
int bnxt_qplib_alloc_ctx(struct pci_dev *pdev, int bnxt_qplib_alloc_ctx(struct pci_dev *pdev,
struct bnxt_qplib_ctx *ctx, struct bnxt_qplib_ctx *ctx,
bool virt_fn) bool virt_fn, bool is_p5)
{ {
int i, j, k, rc = 0; int i, j, k, rc = 0;
int fnz_idx = -1; int fnz_idx = -1;
__le64 **pbl_ptr; __le64 **pbl_ptr;
if (virt_fn) if (virt_fn || is_p5)
goto stats_alloc; goto stats_alloc;
/* QPC Tables */ /* QPC Tables */
...@@ -762,7 +762,11 @@ static int bnxt_qplib_alloc_stats_ctx(struct pci_dev *pdev, ...@@ -762,7 +762,11 @@ static int bnxt_qplib_alloc_stats_ctx(struct pci_dev *pdev,
{ {
memset(stats, 0, sizeof(*stats)); memset(stats, 0, sizeof(*stats));
stats->fw_id = -1; stats->fw_id = -1;
stats->size = sizeof(struct ctx_hw_stats); /* 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->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) {
......
...@@ -252,5 +252,5 @@ void bnxt_qplib_free_ctx(struct pci_dev *pdev, ...@@ -252,5 +252,5 @@ void bnxt_qplib_free_ctx(struct pci_dev *pdev,
struct bnxt_qplib_ctx *ctx); struct bnxt_qplib_ctx *ctx);
int bnxt_qplib_alloc_ctx(struct pci_dev *pdev, int bnxt_qplib_alloc_ctx(struct pci_dev *pdev,
struct bnxt_qplib_ctx *ctx, struct bnxt_qplib_ctx *ctx,
bool virt_fn); bool virt_fn, bool is_p5);
#endif /* __BNXT_QPLIB_RES_H__ */ #endif /* __BNXT_QPLIB_RES_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment