Skip to content

Commit 54cc017

Browse files
committed
Merge branch 'bnxt_en-Bug-fixes'
Michael Chan says: ==================== bnxt_en: Bug fixes. The first patch stores the firmware version code which is needed by the next 2 patches to determine some worarounds based on the firmware version. The workarounds are to disable legacy TX push mode and to clear the hardware statistics during ifdown. The last patch checks that it is a PF before reading the VPD. Please also queue these for -stable. Thanks. ==================== Reviewed-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2 parents a83024b + c55e28a commit 54cc017

File tree

2 files changed

+34
-7
lines changed

2 files changed

+34
-7
lines changed

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

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6292,6 +6292,7 @@ int bnxt_hwrm_set_coal(struct bnxt *bp)
62926292

62936293
static void bnxt_hwrm_stat_ctx_free(struct bnxt *bp)
62946294
{
6295+
struct hwrm_stat_ctx_clr_stats_input req0 = {0};
62956296
struct hwrm_stat_ctx_free_input req = {0};
62966297
int i;
62976298

@@ -6301,6 +6302,7 @@ static void bnxt_hwrm_stat_ctx_free(struct bnxt *bp)
63016302
if (BNXT_CHIP_TYPE_NITRO_A0(bp))
63026303
return;
63036304

6305+
bnxt_hwrm_cmd_hdr_init(bp, &req0, HWRM_STAT_CTX_CLR_STATS, -1, -1);
63046306
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_STAT_CTX_FREE, -1, -1);
63056307

63066308
mutex_lock(&bp->hwrm_cmd_lock);
@@ -6310,7 +6312,11 @@ static void bnxt_hwrm_stat_ctx_free(struct bnxt *bp)
63106312

63116313
if (cpr->hw_stats_ctx_id != INVALID_STATS_CTX_ID) {
63126314
req.stat_ctx_id = cpu_to_le32(cpr->hw_stats_ctx_id);
6313-
6315+
if (BNXT_FW_MAJ(bp) <= 20) {
6316+
req0.stat_ctx_id = req.stat_ctx_id;
6317+
_hwrm_send_message(bp, &req0, sizeof(req0),
6318+
HWRM_CMD_TIMEOUT);
6319+
}
63146320
_hwrm_send_message(bp, &req, sizeof(req),
63156321
HWRM_CMD_TIMEOUT);
63166322

@@ -6976,7 +6982,8 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
69766982
bp->fw_cap |= BNXT_FW_CAP_ERR_RECOVER_RELOAD;
69776983

69786984
bp->tx_push_thresh = 0;
6979-
if (flags & FUNC_QCAPS_RESP_FLAGS_PUSH_MODE_SUPPORTED)
6985+
if ((flags & FUNC_QCAPS_RESP_FLAGS_PUSH_MODE_SUPPORTED) &&
6986+
BNXT_FW_MAJ(bp) > 217)
69806987
bp->tx_push_thresh = BNXT_TX_PUSH_THRESH;
69816988

69826989
hw_resc->max_rsscos_ctxs = le16_to_cpu(resp->max_rsscos_ctx);
@@ -7240,8 +7247,9 @@ static int __bnxt_hwrm_ver_get(struct bnxt *bp, bool silent)
72407247
static int bnxt_hwrm_ver_get(struct bnxt *bp)
72417248
{
72427249
struct hwrm_ver_get_output *resp = bp->hwrm_cmd_resp_addr;
7250+
u16 fw_maj, fw_min, fw_bld, fw_rsv;
72437251
u32 dev_caps_cfg, hwrm_ver;
7244-
int rc;
7252+
int rc, len;
72457253

72467254
bp->hwrm_max_req_len = HWRM_MAX_REQ_LEN;
72477255
mutex_lock(&bp->hwrm_cmd_lock);
@@ -7273,9 +7281,22 @@ static int bnxt_hwrm_ver_get(struct bnxt *bp)
72737281
resp->hwrm_intf_maj_8b, resp->hwrm_intf_min_8b,
72747282
resp->hwrm_intf_upd_8b);
72757283

7276-
snprintf(bp->fw_ver_str, BC_HWRM_STR_LEN, "%d.%d.%d.%d",
7277-
resp->hwrm_fw_maj_8b, resp->hwrm_fw_min_8b,
7278-
resp->hwrm_fw_bld_8b, resp->hwrm_fw_rsvd_8b);
7284+
fw_maj = le16_to_cpu(resp->hwrm_fw_major);
7285+
if (bp->hwrm_spec_code > 0x10803 && fw_maj) {
7286+
fw_min = le16_to_cpu(resp->hwrm_fw_minor);
7287+
fw_bld = le16_to_cpu(resp->hwrm_fw_build);
7288+
fw_rsv = le16_to_cpu(resp->hwrm_fw_patch);
7289+
len = FW_VER_STR_LEN;
7290+
} else {
7291+
fw_maj = resp->hwrm_fw_maj_8b;
7292+
fw_min = resp->hwrm_fw_min_8b;
7293+
fw_bld = resp->hwrm_fw_bld_8b;
7294+
fw_rsv = resp->hwrm_fw_rsvd_8b;
7295+
len = BC_HWRM_STR_LEN;
7296+
}
7297+
bp->fw_ver_code = BNXT_FW_VER_CODE(fw_maj, fw_min, fw_bld, fw_rsv);
7298+
snprintf(bp->fw_ver_str, len, "%d.%d.%d.%d", fw_maj, fw_min, fw_bld,
7299+
fw_rsv);
72797300

72807301
if (strlen(resp->active_pkg_name)) {
72817302
int fw_ver_len = strlen(bp->fw_ver_str);
@@ -11892,7 +11913,8 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1189211913
dev->ethtool_ops = &bnxt_ethtool_ops;
1189311914
pci_set_drvdata(pdev, dev);
1189411915

11895-
bnxt_vpd_read_info(bp);
11916+
if (BNXT_PF(bp))
11917+
bnxt_vpd_read_info(bp);
1189611918

1189711919
rc = bnxt_alloc_hwrm_resources(bp);
1189811920
if (rc)

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,6 +1746,11 @@ struct bnxt {
17461746
#define PHY_VER_STR_LEN (FW_VER_STR_LEN - BC_HWRM_STR_LEN)
17471747
char fw_ver_str[FW_VER_STR_LEN];
17481748
char hwrm_ver_supp[FW_VER_STR_LEN];
1749+
u64 fw_ver_code;
1750+
#define BNXT_FW_VER_CODE(maj, min, bld, rsv) \
1751+
((u64)(maj) << 48 | (u64)(min) << 32 | (u64)(bld) << 16 | (rsv))
1752+
#define BNXT_FW_MAJ(bp) ((bp)->fw_ver_code >> 48)
1753+
17491754
__be16 vxlan_port;
17501755
u8 vxlan_port_cnt;
17511756
__le16 vxlan_fw_dst_port_id;

0 commit comments

Comments
 (0)