Skip to content

Commit 8d42ead

Browse files
committed
Merge branch 'bnxt_en-Fixes-for-net-next'
Michael Chan says: ==================== bnxt_en: Fixes for net-next. This series includes a bug fix for a regression in firmware message polling introduced recently on net-next. There are 3 additional minor fixes for unsupported link speed checking, VF MAC address handling, and setting PHY eeprom length. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 724e47a + 707e7e9 commit 8d42ead

File tree

4 files changed

+30
-20
lines changed

4 files changed

+30
-20
lines changed

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3530,6 +3530,8 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
35303530
HWRM_RESP_LEN_SFT;
35313531
valid = bp->hwrm_cmd_resp_addr + len - 1;
35323532
} else {
3533+
int j;
3534+
35333535
/* Check if response len is updated */
35343536
for (i = 0; i < tmo_count; i++) {
35353537
len = (le32_to_cpu(*resp_len) & HWRM_RESP_LEN_MASK) >>
@@ -3547,24 +3549,26 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
35473549

35483550
if (i >= tmo_count) {
35493551
netdev_err(bp->dev, "Error (timeout: %d) msg {0x%x 0x%x} len:%d\n",
3550-
timeout, le16_to_cpu(req->req_type),
3552+
HWRM_TOTAL_TIMEOUT(i),
3553+
le16_to_cpu(req->req_type),
35513554
le16_to_cpu(req->seq_id), len);
35523555
return -1;
35533556
}
35543557

35553558
/* Last byte of resp contains valid bit */
35563559
valid = bp->hwrm_cmd_resp_addr + len - 1;
3557-
for (i = 0; i < 5; i++) {
3560+
for (j = 0; j < HWRM_VALID_BIT_DELAY_USEC; j++) {
35583561
/* make sure we read from updated DMA memory */
35593562
dma_rmb();
35603563
if (*valid)
35613564
break;
35623565
udelay(1);
35633566
}
35643567

3565-
if (i >= 5) {
3568+
if (j >= HWRM_VALID_BIT_DELAY_USEC) {
35663569
netdev_err(bp->dev, "Error (timeout: %d) msg {0x%x 0x%x} len:%d v:%d\n",
3567-
timeout, le16_to_cpu(req->req_type),
3570+
HWRM_TOTAL_TIMEOUT(i),
3571+
le16_to_cpu(req->req_type),
35683572
le16_to_cpu(req->seq_id), len, *valid);
35693573
return -1;
35703574
}
@@ -6458,6 +6462,9 @@ static int bnxt_update_link(struct bnxt *bp, bool chng_link_state)
64586462
}
64596463
mutex_unlock(&bp->hwrm_cmd_lock);
64606464

6465+
if (!BNXT_SINGLE_PF(bp))
6466+
return 0;
6467+
64616468
diff = link_info->support_auto_speeds ^ link_info->advertising;
64626469
if ((link_info->support_auto_speeds | diff) !=
64636470
link_info->support_auto_speeds) {
@@ -8671,8 +8678,8 @@ static int bnxt_init_mac_addr(struct bnxt *bp)
86718678
memcpy(bp->dev->dev_addr, vf->mac_addr, ETH_ALEN);
86728679
} else {
86738680
eth_hw_addr_random(bp->dev);
8674-
rc = bnxt_approve_mac(bp, bp->dev->dev_addr);
86758681
}
8682+
rc = bnxt_approve_mac(bp, bp->dev->dev_addr);
86768683
#endif
86778684
}
86788685
return rc;

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,13 @@ struct rx_tpa_end_cmp_ext {
539539
#define HWRM_MIN_TIMEOUT 25
540540
#define HWRM_MAX_TIMEOUT 40
541541

542+
#define HWRM_TOTAL_TIMEOUT(n) (((n) <= HWRM_SHORT_TIMEOUT_COUNTER) ? \
543+
((n) * HWRM_SHORT_MIN_TIMEOUT) : \
544+
(HWRM_SHORT_TIMEOUT_COUNTER * HWRM_SHORT_MIN_TIMEOUT + \
545+
((n) - HWRM_SHORT_TIMEOUT_COUNTER) * HWRM_MIN_TIMEOUT))
546+
547+
#define HWRM_VALID_BIT_DELAY_USEC 20
548+
542549
#define BNXT_RX_EVENT 1
543550
#define BNXT_AGG_EVENT 2
544551
#define BNXT_TX_EVENT 4
@@ -1407,8 +1414,7 @@ struct bnxt {
14071414

14081415
#define I2C_DEV_ADDR_A0 0xa0
14091416
#define I2C_DEV_ADDR_A2 0xa2
1410-
#define SFP_EEPROM_SFF_8472_COMP_ADDR 0x5e
1411-
#define SFP_EEPROM_SFF_8472_COMP_SIZE 1
1417+
#define SFF_DIAG_SUPPORT_OFFSET 0x5c
14121418
#define SFF_MODULE_ID_SFP 0x3
14131419
#define SFF_MODULE_ID_QSFP 0xc
14141420
#define SFF_MODULE_ID_QSFP_PLUS 0xd

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

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2184,9 +2184,8 @@ static int bnxt_read_sfp_module_eeprom_info(struct bnxt *bp, u16 i2c_addr,
21842184
static int bnxt_get_module_info(struct net_device *dev,
21852185
struct ethtool_modinfo *modinfo)
21862186
{
2187+
u8 data[SFF_DIAG_SUPPORT_OFFSET + 1];
21872188
struct bnxt *bp = netdev_priv(dev);
2188-
struct hwrm_port_phy_i2c_read_input req = {0};
2189-
struct hwrm_port_phy_i2c_read_output *output = bp->hwrm_cmd_resp_addr;
21902189
int rc;
21912190

21922191
/* No point in going further if phy status indicates
@@ -2201,21 +2200,19 @@ static int bnxt_get_module_info(struct net_device *dev,
22012200
if (bp->hwrm_spec_code < 0x10202)
22022201
return -EOPNOTSUPP;
22032202

2204-
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_PORT_PHY_I2C_READ, -1, -1);
2205-
req.i2c_slave_addr = I2C_DEV_ADDR_A0;
2206-
req.page_number = 0;
2207-
req.page_offset = cpu_to_le16(SFP_EEPROM_SFF_8472_COMP_ADDR);
2208-
req.data_length = SFP_EEPROM_SFF_8472_COMP_SIZE;
2209-
req.port_id = cpu_to_le16(bp->pf.port_id);
2210-
mutex_lock(&bp->hwrm_cmd_lock);
2211-
rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
2203+
rc = bnxt_read_sfp_module_eeprom_info(bp, I2C_DEV_ADDR_A0, 0, 0,
2204+
SFF_DIAG_SUPPORT_OFFSET + 1,
2205+
data);
22122206
if (!rc) {
2213-
u32 module_id = le32_to_cpu(output->data[0]);
2207+
u8 module_id = data[0];
2208+
u8 diag_supported = data[SFF_DIAG_SUPPORT_OFFSET];
22142209

22152210
switch (module_id) {
22162211
case SFF_MODULE_ID_SFP:
22172212
modinfo->type = ETH_MODULE_SFF_8472;
22182213
modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN;
2214+
if (!diag_supported)
2215+
modinfo->eeprom_len = ETH_MODULE_SFF_8436_LEN;
22192216
break;
22202217
case SFF_MODULE_ID_QSFP:
22212218
case SFF_MODULE_ID_QSFP_PLUS:
@@ -2231,7 +2228,6 @@ static int bnxt_get_module_info(struct net_device *dev,
22312228
break;
22322229
}
22332230
}
2234-
mutex_unlock(&bp->hwrm_cmd_lock);
22352231
return rc;
22362232
}
22372233

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,8 @@ static int bnxt_vf_configure_mac(struct bnxt *bp, struct bnxt_vf_info *vf)
923923
if (req->enables & cpu_to_le32(FUNC_VF_CFG_REQ_ENABLES_DFLT_MAC_ADDR)) {
924924
if (is_valid_ether_addr(req->dflt_mac_addr) &&
925925
((vf->flags & BNXT_VF_TRUST) ||
926-
(!is_valid_ether_addr(vf->mac_addr)))) {
926+
!is_valid_ether_addr(vf->mac_addr) ||
927+
ether_addr_equal(req->dflt_mac_addr, vf->mac_addr))) {
927928
ether_addr_copy(vf->vf_mac_addr, req->dflt_mac_addr);
928929
return bnxt_hwrm_exec_fwd_resp(bp, vf, msg_size);
929930
}

0 commit comments

Comments
 (0)