Skip to content

Commit a1653b1

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Refactor the driver registration function with firmware.
The driver register function with firmware consists of passing version information and registering for async events. To support the RDMA driver, the async events that we need to register may change. Separate the driver register function into 2 parts so that we can just update the async events for the RDMA driver. Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e4060d3 commit a1653b1

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

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

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3117,27 +3117,46 @@ int hwrm_send_message_silent(struct bnxt *bp, void *msg, u32 msg_len,
31173117
return rc;
31183118
}
31193119

3120-
static int bnxt_hwrm_func_drv_rgtr(struct bnxt *bp)
3120+
int bnxt_hwrm_func_rgtr_async_events(struct bnxt *bp, unsigned long *bmap,
3121+
int bmap_size)
31213122
{
31223123
struct hwrm_func_drv_rgtr_input req = {0};
3123-
int i;
31243124
DECLARE_BITMAP(async_events_bmap, 256);
31253125
u32 *events = (u32 *)async_events_bmap;
3126+
int i;
31263127

31273128
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_DRV_RGTR, -1, -1);
31283129

31293130
req.enables =
3130-
cpu_to_le32(FUNC_DRV_RGTR_REQ_ENABLES_OS_TYPE |
3131-
FUNC_DRV_RGTR_REQ_ENABLES_VER |
3132-
FUNC_DRV_RGTR_REQ_ENABLES_ASYNC_EVENT_FWD);
3131+
cpu_to_le32(FUNC_DRV_RGTR_REQ_ENABLES_ASYNC_EVENT_FWD);
31333132

31343133
memset(async_events_bmap, 0, sizeof(async_events_bmap));
31353134
for (i = 0; i < ARRAY_SIZE(bnxt_async_events_arr); i++)
31363135
__set_bit(bnxt_async_events_arr[i], async_events_bmap);
31373136

3137+
if (bmap && bmap_size) {
3138+
for (i = 0; i < bmap_size; i++) {
3139+
if (test_bit(i, bmap))
3140+
__set_bit(i, async_events_bmap);
3141+
}
3142+
}
3143+
31383144
for (i = 0; i < 8; i++)
31393145
req.async_event_fwd[i] |= cpu_to_le32(events[i]);
31403146

3147+
return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
3148+
}
3149+
3150+
static int bnxt_hwrm_func_drv_rgtr(struct bnxt *bp)
3151+
{
3152+
struct hwrm_func_drv_rgtr_input req = {0};
3153+
3154+
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_DRV_RGTR, -1, -1);
3155+
3156+
req.enables =
3157+
cpu_to_le32(FUNC_DRV_RGTR_REQ_ENABLES_OS_TYPE |
3158+
FUNC_DRV_RGTR_REQ_ENABLES_VER);
3159+
31413160
req.os_type = cpu_to_le16(FUNC_DRV_RGTR_REQ_OS_TYPE_LINUX);
31423161
req.ver_maj = DRV_VER_MAJ;
31433162
req.ver_min = DRV_VER_MIN;
@@ -3146,6 +3165,7 @@ static int bnxt_hwrm_func_drv_rgtr(struct bnxt *bp)
31463165
if (BNXT_PF(bp)) {
31473166
DECLARE_BITMAP(vf_req_snif_bmap, 256);
31483167
u32 *data = (u32 *)vf_req_snif_bmap;
3168+
int i;
31493169

31503170
memset(vf_req_snif_bmap, 0, sizeof(vf_req_snif_bmap));
31513171
for (i = 0; i < ARRAY_SIZE(bnxt_vf_req_snif); i++)
@@ -7023,6 +7043,10 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
70237043
if (rc)
70247044
goto init_err;
70257045

7046+
rc = bnxt_hwrm_func_rgtr_async_events(bp, NULL, 0);
7047+
if (rc)
7048+
goto init_err;
7049+
70267050
/* Get the MAX capabilities for this function */
70277051
rc = bnxt_hwrm_func_qcaps(bp);
70287052
if (rc) {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,8 @@ void bnxt_hwrm_cmd_hdr_init(struct bnxt *, void *, u16, u16, u16);
12401240
int _hwrm_send_message(struct bnxt *, void *, u32, int);
12411241
int hwrm_send_message(struct bnxt *, void *, u32, int);
12421242
int hwrm_send_message_silent(struct bnxt *, void *, u32, int);
1243+
int bnxt_hwrm_func_rgtr_async_events(struct bnxt *bp, unsigned long *bmap,
1244+
int bmap_size);
12431245
int bnxt_hwrm_set_coal(struct bnxt *);
12441246
unsigned int bnxt_get_max_func_stat_ctxs(struct bnxt *bp);
12451247
unsigned int bnxt_get_max_func_cp_rings(struct bnxt *bp);

0 commit comments

Comments
 (0)