Skip to content

Commit 304cc83

Browse files
bmarreddyrleon
authored andcommitted
RDMA/bnxt_re: Enhance RoCE SRIOV resource configuration design
Refine RoCE SRIOV resource configuration design, using the INITIALIZE_FW's flag as an indication for the new design to the firmware. RoCE driver does not have to provision resources to VF when firmware advertises support for RoCE resource management by NIC driver. Signed-off-by: Bhargava Chenna Marreddy <[email protected]> Signed-off-by: Kalesh AP <[email protected]> Reviewed-by: Vikas Gupta <[email protected]> Reviewed-by: Selvin Xavier <[email protected]> CC: Michael Chan <[email protected]> Signed-off-by: Selvin Xavier <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 53371c5 commit 304cc83

File tree

6 files changed

+17
-5
lines changed

6 files changed

+17
-5
lines changed

drivers/infiniband/hw/bnxt_re/main.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ static int bnxt_re_setup_chip_ctx(struct bnxt_re_dev *rdev)
184184
rdev->rcfw.res = &rdev->qplib_res;
185185
rdev->qplib_res.dattr = &rdev->dev_attr;
186186
rdev->qplib_res.is_vf = BNXT_EN_VF(en_dev);
187+
rdev->qplib_res.en_dev = en_dev;
187188

188189
bnxt_re_set_drv_mode(rdev);
189190

@@ -285,6 +286,10 @@ static void bnxt_re_set_resource_limits(struct bnxt_re_dev *rdev)
285286

286287
static void bnxt_re_vf_res_config(struct bnxt_re_dev *rdev)
287288
{
289+
/*
290+
* Use the total VF count since the actual VF count may not be
291+
* available at this point.
292+
*/
288293
rdev->num_vfs = pci_sriov_get_totalvfs(rdev->en_dev->pdev);
289294
if (!bnxt_qplib_is_chip_gen_p5_p7(rdev->chip_ctx)) {
290295
bnxt_re_set_resource_limits(rdev);
@@ -2056,11 +2061,9 @@ static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 op_type)
20562061
INIT_DELAYED_WORK(&rdev->worker, bnxt_re_worker);
20572062
set_bit(BNXT_RE_FLAG_QOS_WORK_REG, &rdev->flags);
20582063
schedule_delayed_work(&rdev->worker, msecs_to_jiffies(30000));
2059-
/*
2060-
* Use the total VF count since the actual VF count may not be
2061-
* available at this point.
2062-
*/
2063-
bnxt_re_vf_res_config(rdev);
2064+
2065+
if (!(rdev->qplib_res.en_dev->flags & BNXT_EN_FLAG_ROCE_VF_RES_MGMT))
2066+
bnxt_re_vf_res_config(rdev);
20642067
}
20652068
hash_init(rdev->cq_hash);
20662069
if (rdev->chip_ctx->modes.toggle_bits & BNXT_QPLIB_SRQ_TOGGLE_BIT)

drivers/infiniband/hw/bnxt_re/qplib_rcfw.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,8 @@ int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw,
910910
flags |= CMDQ_INITIALIZE_FW_FLAGS_HW_REQUESTER_RETX_SUPPORTED;
911911
if (_is_optimize_modify_qp_supported(rcfw->res->dattr->dev_cap_flags2))
912912
flags |= CMDQ_INITIALIZE_FW_FLAGS_OPTIMIZE_MODIFY_QP_SUPPORTED;
913+
if (rcfw->res->en_dev->flags & BNXT_EN_FLAG_ROCE_VF_RES_MGMT)
914+
flags |= CMDQ_INITIALIZE_FW_FLAGS_L2_VF_RESOURCE_MGMT;
913915
req.flags |= cpu_to_le16(flags);
914916
req.stat_ctx_id = cpu_to_le32(ctx->stats.fw_id);
915917
bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), sizeof(resp), 0);

drivers/infiniband/hw/bnxt_re/qplib_res.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
#ifndef __BNXT_QPLIB_RES_H__
4040
#define __BNXT_QPLIB_RES_H__
4141

42+
#include "bnxt_ulp.h"
43+
4244
extern const struct bnxt_qplib_gid bnxt_qplib_gid_zero;
4345

4446
#define CHIP_NUM_57508 0x1750
@@ -302,6 +304,7 @@ struct bnxt_qplib_res {
302304
struct bnxt_qplib_chip_ctx *cctx;
303305
struct bnxt_qplib_dev_attr *dattr;
304306
struct net_device *netdev;
307+
struct bnxt_en_dev *en_dev;
305308
struct bnxt_qplib_rcfw *rcfw;
306309
struct bnxt_qplib_pd_tbl pd_tbl;
307310
/* To protect the pd table bit map */

drivers/infiniband/hw/bnxt_re/roce_hsi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ struct cmdq_initialize_fw {
217217
#define CMDQ_INITIALIZE_FW_FLAGS_MRAV_RESERVATION_SPLIT 0x1UL
218218
#define CMDQ_INITIALIZE_FW_FLAGS_HW_REQUESTER_RETX_SUPPORTED 0x2UL
219219
#define CMDQ_INITIALIZE_FW_FLAGS_OPTIMIZE_MODIFY_QP_SUPPORTED 0x8UL
220+
#define CMDQ_INITIALIZE_FW_FLAGS_L2_VF_RESOURCE_MGMT 0x10UL
220221
__le16 cookie;
221222
u8 resp_size;
222223
u8 reserved8;

drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,8 @@ static void bnxt_set_edev_info(struct bnxt_en_dev *edev, struct bnxt *bp)
414414
edev->flags |= BNXT_EN_FLAG_ROCEV2_CAP;
415415
if (bp->flags & BNXT_FLAG_VF)
416416
edev->flags |= BNXT_EN_FLAG_VF;
417+
if (BNXT_ROCE_VF_RESC_CAP(bp))
418+
edev->flags |= BNXT_EN_FLAG_ROCE_VF_RES_MGMT;
417419

418420
edev->chip_num = bp->chip_num;
419421
edev->hw_ring_stats_size = bp->hw_ring_stats_size;

drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ struct bnxt_en_dev {
6464
#define BNXT_EN_FLAG_ULP_STOPPED 0x8
6565
#define BNXT_EN_FLAG_VF 0x10
6666
#define BNXT_EN_VF(edev) ((edev)->flags & BNXT_EN_FLAG_VF)
67+
#define BNXT_EN_FLAG_ROCE_VF_RES_MGMT 0x20
6768

6869
struct bnxt_ulp *ulp_tbl;
6970
int l2_db_size; /* Doorbell BAR size in

0 commit comments

Comments
 (0)