Skip to content

Commit 09cb9f2

Browse files
committed
Merge branch 'bnxt_en-Bug-fixes'
Michael Chan says: ==================== bnxt_en: Bug fixes. 3 bnxt_en driver fixes, covering a bug in preserving the counters during some resets, proper error code when flashing NVRAM fails, and an endian bug when extracting the firmware response message length. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 591612a + 2a5a880 commit 09cb9f2

File tree

3 files changed

+10
-20
lines changed

3 files changed

+10
-20
lines changed

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

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4176,14 +4176,12 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
41764176
int i, intr_process, rc, tmo_count;
41774177
struct input *req = msg;
41784178
u32 *data = msg;
4179-
__le32 *resp_len;
41804179
u8 *valid;
41814180
u16 cp_ring_id, len = 0;
41824181
struct hwrm_err_output *resp = bp->hwrm_cmd_resp_addr;
41834182
u16 max_req_len = BNXT_HWRM_MAX_REQ_LEN;
41844183
struct hwrm_short_input short_input = {0};
41854184
u32 doorbell_offset = BNXT_GRCPF_REG_CHIMP_COMM_TRIGGER;
4186-
u8 *resp_addr = (u8 *)bp->hwrm_cmd_resp_addr;
41874185
u32 bar_offset = BNXT_GRCPF_REG_CHIMP_COMM;
41884186
u16 dst = BNXT_HWRM_CHNL_CHIMP;
41894187

@@ -4201,7 +4199,6 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
42014199
bar_offset = BNXT_GRCPF_REG_KONG_COMM;
42024200
doorbell_offset = BNXT_GRCPF_REG_KONG_COMM_TRIGGER;
42034201
resp = bp->hwrm_cmd_kong_resp_addr;
4204-
resp_addr = (u8 *)bp->hwrm_cmd_kong_resp_addr;
42054202
}
42064203

42074204
memset(resp, 0, PAGE_SIZE);
@@ -4270,7 +4267,6 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
42704267
tmo_count = HWRM_SHORT_TIMEOUT_COUNTER;
42714268
timeout = timeout - HWRM_SHORT_MIN_TIMEOUT * HWRM_SHORT_TIMEOUT_COUNTER;
42724269
tmo_count += DIV_ROUND_UP(timeout, HWRM_MIN_TIMEOUT);
4273-
resp_len = (__le32 *)(resp_addr + HWRM_RESP_LEN_OFFSET);
42744270

42754271
if (intr_process) {
42764272
u16 seq_id = bp->hwrm_intr_seq_id;
@@ -4298,9 +4294,8 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
42984294
le16_to_cpu(req->req_type));
42994295
return -EBUSY;
43004296
}
4301-
len = (le32_to_cpu(*resp_len) & HWRM_RESP_LEN_MASK) >>
4302-
HWRM_RESP_LEN_SFT;
4303-
valid = resp_addr + len - 1;
4297+
len = le16_to_cpu(resp->resp_len);
4298+
valid = ((u8 *)resp) + len - 1;
43044299
} else {
43054300
int j;
43064301

@@ -4311,8 +4306,7 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
43114306
*/
43124307
if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state))
43134308
return -EBUSY;
4314-
len = (le32_to_cpu(*resp_len) & HWRM_RESP_LEN_MASK) >>
4315-
HWRM_RESP_LEN_SFT;
4309+
len = le16_to_cpu(resp->resp_len);
43164310
if (len)
43174311
break;
43184312
/* on first few passes, just barely sleep */
@@ -4334,7 +4328,7 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
43344328
}
43354329

43364330
/* Last byte of resp contains valid bit */
4337-
valid = resp_addr + len - 1;
4331+
valid = ((u8 *)resp) + len - 1;
43384332
for (j = 0; j < HWRM_VALID_BIT_DELAY_USEC; j++) {
43394333
/* make sure we read from updated DMA memory */
43404334
dma_rmb();
@@ -9310,7 +9304,7 @@ static void __bnxt_close_nic(struct bnxt *bp, bool irq_re_init,
93109304
bnxt_free_skbs(bp);
93119305

93129306
/* Save ring stats before shutdown */
9313-
if (bp->bnapi)
9307+
if (bp->bnapi && irq_re_init)
93149308
bnxt_get_ring_stats(bp, &bp->net_stats_prev);
93159309
if (irq_re_init) {
93169310
bnxt_free_irq(bp);

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -656,11 +656,6 @@ struct nqe_cn {
656656
#define HWRM_CMD_TIMEOUT (bp->hwrm_cmd_timeout)
657657
#define HWRM_RESET_TIMEOUT ((HWRM_CMD_TIMEOUT) * 4)
658658
#define HWRM_COREDUMP_TIMEOUT ((HWRM_CMD_TIMEOUT) * 12)
659-
#define HWRM_RESP_ERR_CODE_MASK 0xffff
660-
#define HWRM_RESP_LEN_OFFSET 4
661-
#define HWRM_RESP_LEN_MASK 0xffff0000
662-
#define HWRM_RESP_LEN_SFT 16
663-
#define HWRM_RESP_VALID_MASK 0xff000000
664659
#define BNXT_HWRM_REQ_MAX_SIZE 128
665660
#define BNXT_HWRM_REQS_PER_PAGE (BNXT_PAGE_SIZE / \
666661
BNXT_HWRM_REQ_MAX_SIZE)

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,11 +2012,12 @@ int bnxt_flash_package_from_file(struct net_device *dev, const char *filename,
20122012

20132013
bnxt_hwrm_fw_set_time(bp);
20142014

2015-
if (bnxt_find_nvram_item(dev, BNX_DIR_TYPE_UPDATE,
2016-
BNX_DIR_ORDINAL_FIRST, BNX_DIR_EXT_NONE,
2017-
&index, &item_len, NULL) != 0) {
2015+
rc = bnxt_find_nvram_item(dev, BNX_DIR_TYPE_UPDATE,
2016+
BNX_DIR_ORDINAL_FIRST, BNX_DIR_EXT_NONE,
2017+
&index, &item_len, NULL);
2018+
if (rc) {
20182019
netdev_err(dev, "PKG update area not created in nvram\n");
2019-
return -ENOBUFS;
2020+
return rc;
20202021
}
20212022

20222023
rc = request_firmware(&fw, filename, &dev->dev);

0 commit comments

Comments
 (0)