Skip to content

Commit 8a27c4d

Browse files
committed
Merge branch 'bnxt_en-update-for-net-next'
Michael Chan says: ==================== bnxt_en: Update for net-next This series adds better error and debug logging for firmware messages. We now also use the firmware provided timeout value for long running commands instead of capping it to 40 seconds. ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 4ccdcc8 + 8c6f36d commit 8a27c4d

File tree

6 files changed

+129
-65
lines changed

6 files changed

+129
-65
lines changed

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

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,6 +2086,9 @@ static int bnxt_async_event_process(struct bnxt *bp,
20862086
u32 data1 = le32_to_cpu(cmpl->event_data1);
20872087
u32 data2 = le32_to_cpu(cmpl->event_data2);
20882088

2089+
netdev_dbg(bp->dev, "hwrm event 0x%x {0x%x, 0x%x}\n",
2090+
event_id, data1, data2);
2091+
20892092
/* TODO CHIMP_FW: Define event id's for link change, error etc */
20902093
switch (event_id) {
20912094
case ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE: {
@@ -7691,19 +7694,6 @@ static void __bnxt_map_fw_health_reg(struct bnxt *bp, u32 reg)
76917694
BNXT_FW_HEALTH_WIN_MAP_OFF);
76927695
}
76937696

7694-
bool bnxt_is_fw_healthy(struct bnxt *bp)
7695-
{
7696-
if (bp->fw_health && bp->fw_health->status_reliable) {
7697-
u32 fw_status;
7698-
7699-
fw_status = bnxt_fw_health_readl(bp, BNXT_FW_HEALTH_REG);
7700-
if (fw_status && !BNXT_FW_IS_HEALTHY(fw_status))
7701-
return false;
7702-
}
7703-
7704-
return true;
7705-
}
7706-
77077697
static void bnxt_inv_fw_health_reg(struct bnxt *bp)
77087698
{
77097699
struct bnxt_fw_health *fw_health = bp->fw_health;
@@ -8031,6 +8021,12 @@ static int bnxt_hwrm_ver_get(struct bnxt *bp)
80318021
bp->hwrm_cmd_timeout = le16_to_cpu(resp->def_req_timeout);
80328022
if (!bp->hwrm_cmd_timeout)
80338023
bp->hwrm_cmd_timeout = DFLT_HWRM_CMD_TIMEOUT;
8024+
bp->hwrm_cmd_max_timeout = le16_to_cpu(resp->max_req_timeout) * 1000;
8025+
if (!bp->hwrm_cmd_max_timeout)
8026+
bp->hwrm_cmd_max_timeout = HWRM_CMD_MAX_TIMEOUT;
8027+
else if (bp->hwrm_cmd_max_timeout > HWRM_CMD_MAX_TIMEOUT)
8028+
netdev_warn(bp->dev, "Device requests max timeout of %d seconds, may trigger hung task watchdog\n",
8029+
bp->hwrm_cmd_max_timeout / 1000);
80348030

80358031
if (resp->hwrm_intf_maj_8b >= 1) {
80368032
bp->hwrm_max_req_len = le16_to_cpu(resp->max_req_win_len);
@@ -8634,7 +8630,10 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init)
86348630
/* Filter for default vnic 0 */
86358631
rc = bnxt_hwrm_set_vnic_filter(bp, 0, 0, bp->dev->dev_addr);
86368632
if (rc) {
8637-
netdev_err(bp->dev, "HWRM vnic filter failure rc: %x\n", rc);
8633+
if (BNXT_VF(bp) && rc == -ENODEV)
8634+
netdev_err(bp->dev, "Cannot configure L2 filter while PF is unavailable\n");
8635+
else
8636+
netdev_err(bp->dev, "HWRM vnic filter failure rc: %x\n", rc);
86388637
goto err_out;
86398638
}
86408639
vnic->uc_filter_count = 1;
@@ -9427,6 +9426,10 @@ int bnxt_update_link(struct bnxt *bp, bool chng_link_state)
94279426
rc = hwrm_req_send(bp, req);
94289427
if (rc) {
94299428
hwrm_req_drop(bp, req);
9429+
if (BNXT_VF(bp) && rc == -ENODEV) {
9430+
netdev_warn(bp->dev, "Cannot obtain link state while PF unavailable.\n");
9431+
rc = 0;
9432+
}
94309433
return rc;
94319434
}
94329435

@@ -10825,12 +10828,21 @@ static int bnxt_cfg_rx_mode(struct bnxt *bp)
1082510828
for (i = 1, off = 0; i < vnic->uc_filter_count; i++, off += ETH_ALEN) {
1082610829
rc = bnxt_hwrm_set_vnic_filter(bp, 0, i, vnic->uc_list + off);
1082710830
if (rc) {
10828-
netdev_err(bp->dev, "HWRM vnic filter failure rc: %x\n",
10829-
rc);
10831+
if (BNXT_VF(bp) && rc == -ENODEV) {
10832+
if (!test_and_set_bit(BNXT_STATE_L2_FILTER_RETRY, &bp->state))
10833+
netdev_warn(bp->dev, "Cannot configure L2 filters while PF is unavailable, will retry\n");
10834+
else
10835+
netdev_dbg(bp->dev, "PF still unavailable while configuring L2 filters.\n");
10836+
rc = 0;
10837+
} else {
10838+
netdev_err(bp->dev, "HWRM vnic filter failure rc: %x\n", rc);
10839+
}
1083010840
vnic->uc_filter_count = i;
1083110841
return rc;
1083210842
}
1083310843
}
10844+
if (test_and_clear_bit(BNXT_STATE_L2_FILTER_RETRY, &bp->state))
10845+
netdev_notice(bp->dev, "Retry of L2 filter configuration successful.\n");
1083410846

1083510847
skip_uc:
1083610848
if ((vnic->rx_mask & CFA_L2_SET_RX_MASK_REQ_MASK_PROMISCUOUS) &&
@@ -11395,6 +11407,11 @@ static void bnxt_timer(struct timer_list *t)
1139511407
}
1139611408
}
1139711409

11410+
if (test_bit(BNXT_STATE_L2_FILTER_RETRY, &bp->state)) {
11411+
set_bit(BNXT_RX_MASK_SP_EVENT, &bp->sp_event);
11412+
bnxt_queue_sp_work(bp);
11413+
}
11414+
1139811415
if ((bp->flags & BNXT_FLAG_CHIP_P5) && !bp->chip_rev &&
1139911416
netif_carrier_ok(dev)) {
1140011417
set_bit(BNXT_RING_COAL_NOW_SP_EVENT, &bp->sp_event);
@@ -13101,7 +13118,7 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh)
1310113118
bp->tx_nr_rings = bp->tx_nr_rings_per_tc;
1310213119

1310313120
rc = __bnxt_reserve_rings(bp);
13104-
if (rc)
13121+
if (rc && rc != -ENODEV)
1310513122
netdev_warn(bp->dev, "Unable to reserve tx rings\n");
1310613123
bp->tx_nr_rings_per_tc = bp->tx_nr_rings;
1310713124
if (sh)
@@ -13110,7 +13127,7 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh)
1311013127
/* Rings may have been trimmed, re-reserve the trimmed rings. */
1311113128
if (bnxt_need_reserve_rings(bp)) {
1311213129
rc = __bnxt_reserve_rings(bp);
13113-
if (rc)
13130+
if (rc && rc != -ENODEV)
1311413131
netdev_warn(bp->dev, "2nd rings reservation failed.\n");
1311513132
bp->tx_nr_rings_per_tc = bp->tx_nr_rings;
1311613133
}
@@ -13136,7 +13153,10 @@ static int bnxt_init_dflt_ring_mode(struct bnxt *bp)
1313613153
bnxt_clear_int_mode(bp);
1313713154
rc = bnxt_set_dflt_rings(bp, true);
1313813155
if (rc) {
13139-
netdev_err(bp->dev, "Not enough rings available.\n");
13156+
if (BNXT_VF(bp) && rc == -ENODEV)
13157+
netdev_err(bp->dev, "Cannot configure VF rings while PF is unavailable.\n");
13158+
else
13159+
netdev_err(bp->dev, "Not enough rings available.\n");
1314013160
goto init_dflt_ring_err;
1314113161
}
1314213162
rc = bnxt_init_int_mode(bp);
@@ -13424,8 +13444,12 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1342413444
bnxt_set_ring_params(bp);
1342513445
rc = bnxt_set_dflt_rings(bp, true);
1342613446
if (rc) {
13427-
netdev_err(bp->dev, "Not enough rings available.\n");
13428-
rc = -ENOMEM;
13447+
if (BNXT_VF(bp) && rc == -ENODEV) {
13448+
netdev_err(bp->dev, "Cannot configure VF rings while PF is unavailable.\n");
13449+
} else {
13450+
netdev_err(bp->dev, "Not enough rings available.\n");
13451+
rc = -ENOMEM;
13452+
}
1342913453
goto init_err_pci_clean;
1343013454
}
1343113455

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,6 +1916,7 @@ struct bnxt {
19161916
#define BNXT_STATE_DRV_REGISTERED 7
19171917
#define BNXT_STATE_PCI_CHANNEL_IO_FROZEN 8
19181918
#define BNXT_STATE_NAPI_DISABLED 9
1919+
#define BNXT_STATE_L2_FILTER_RETRY 10
19191920
#define BNXT_STATE_FW_ACTIVATE 11
19201921
#define BNXT_STATE_RECOVER 12
19211922
#define BNXT_STATE_FW_NON_FATAL_COND 13
@@ -1986,7 +1987,8 @@ struct bnxt {
19861987

19871988
u16 hwrm_max_req_len;
19881989
u16 hwrm_max_ext_req_len;
1989-
int hwrm_cmd_timeout;
1990+
unsigned int hwrm_cmd_timeout;
1991+
unsigned int hwrm_cmd_max_timeout;
19901992
struct mutex hwrm_cmd_lock; /* serialize hwrm messages */
19911993
struct hwrm_ver_get_output ver_resp;
19921994
#define FW_VER_STR_LEN 32
@@ -2303,7 +2305,6 @@ int bnxt_cancel_reservations(struct bnxt *bp, bool fw_reset);
23032305
int bnxt_hwrm_alloc_wol_fltr(struct bnxt *bp);
23042306
int bnxt_hwrm_free_wol_fltr(struct bnxt *bp);
23052307
int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp, bool all);
2306-
bool bnxt_is_fw_healthy(struct bnxt *bp);
23072308
int bnxt_hwrm_fw_set_time(struct bnxt *);
23082309
int bnxt_open_nic(struct bnxt *, bool, bool);
23092310
int bnxt_half_open_nic(struct bnxt *bp);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static int bnxt_hwrm_dbg_dma_data(struct bnxt *bp, void *msg,
3232
return -ENOMEM;
3333
}
3434

35-
hwrm_req_timeout(bp, msg, HWRM_COREDUMP_TIMEOUT);
35+
hwrm_req_timeout(bp, msg, bp->hwrm_cmd_max_timeout);
3636
cmn_resp = hwrm_req_hold(bp, msg);
3737
resp = cmn_resp;
3838

@@ -125,7 +125,7 @@ static int bnxt_hwrm_dbg_coredump_initiate(struct bnxt *bp, u16 component_id,
125125
if (rc)
126126
return rc;
127127

128-
hwrm_req_timeout(bp, req, HWRM_COREDUMP_TIMEOUT);
128+
hwrm_req_timeout(bp, req, bp->hwrm_cmd_max_timeout);
129129
req->component_id = cpu_to_le16(component_id);
130130
req->segment_id = cpu_to_le16(segment_id);
131131

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
#include "bnxt_nvm_defs.h" /* NVRAM content constant and structure defs */
3232
#include "bnxt_fw_hdr.h" /* Firmware hdr constant and structure defs */
3333
#include "bnxt_coredump.h"
34-
#define FLASH_NVRAM_TIMEOUT ((HWRM_CMD_TIMEOUT) * 100)
35-
#define FLASH_PACKAGE_TIMEOUT ((HWRM_CMD_TIMEOUT) * 200)
36-
#define INSTALL_PACKAGE_TIMEOUT ((HWRM_CMD_TIMEOUT) * 200)
3734

3835
static u32 bnxt_get_msglevel(struct net_device *dev)
3936
{
@@ -2194,7 +2191,7 @@ static int bnxt_flash_nvram(struct net_device *dev, u16 dir_type,
21942191
req->host_src_addr = cpu_to_le64(dma_handle);
21952192
}
21962193

2197-
hwrm_req_timeout(bp, req, FLASH_NVRAM_TIMEOUT);
2194+
hwrm_req_timeout(bp, req, bp->hwrm_cmd_max_timeout);
21982195
req->dir_type = cpu_to_le16(dir_type);
21992196
req->dir_ordinal = cpu_to_le16(dir_ordinal);
22002197
req->dir_ext = cpu_to_le16(dir_ext);
@@ -2540,8 +2537,8 @@ int bnxt_flash_package_from_fw_obj(struct net_device *dev, const struct firmware
25402537
return rc;
25412538
}
25422539

2543-
hwrm_req_timeout(bp, modify, FLASH_PACKAGE_TIMEOUT);
2544-
hwrm_req_timeout(bp, install, INSTALL_PACKAGE_TIMEOUT);
2540+
hwrm_req_timeout(bp, modify, bp->hwrm_cmd_max_timeout);
2541+
hwrm_req_timeout(bp, install, bp->hwrm_cmd_max_timeout);
25452542

25462543
hwrm_req_hold(bp, modify);
25472544
modify->host_src_addr = cpu_to_le64(dma_handle);

0 commit comments

Comments
 (0)