Skip to content

Commit bf14e9e

Browse files
committed
Merge branch 'bnxt_en-next'
Michael Chan says: ==================== bnxt_en: updates for net-next. Non-critical bug fixes, improvements, a new ethtool feature, and a new device ID. v2: Fixed a bug in bnxt_get_module_eeprom() found by Ben Hutchings. Ajit Khaparde (2): bnxt_en: Add Support for ETHTOOL_GMODULEINFO and ETHTOOL_GMODULEEEPRO bnxt_en: Report PCIe link speed and width during driver load Michael Chan (6): bnxt_en: Reduce maximum ring pages if page size is 64K. bnxt_en: Improve the delay logic for firmware response. bnxt_en: Fix length value in dmesg log firmware error message. bnxt_en: Simplify and improve unsupported SFP+ module reporting. bnxt_en: Add BCM57314 device ID. bnxt_en: Use dma_rmb() instead of rmb(). Satish Baddipadige (1): bnxt_en: Fix invalid max channel parameter in ethtool -l. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 909b27f + b67daab commit bf14e9e

File tree

4 files changed

+242
-49
lines changed

4 files changed

+242
-49
lines changed

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

Lines changed: 64 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ enum board_idx {
7878
BCM57402,
7979
BCM57404,
8080
BCM57406,
81+
BCM57314,
8182
BCM57304_VF,
8283
BCM57404_VF,
8384
};
@@ -92,6 +93,7 @@ static const struct {
9293
{ "Broadcom BCM57402 NetXtreme-E Dual-port 10Gb Ethernet" },
9394
{ "Broadcom BCM57404 NetXtreme-E Dual-port 10Gb/25Gb Ethernet" },
9495
{ "Broadcom BCM57406 NetXtreme-E Dual-port 10GBase-T Ethernet" },
96+
{ "Broadcom BCM57314 NetXtreme-C Dual-port 10Gb/25Gb/40Gb/50Gb Ethernet" },
9597
{ "Broadcom BCM57304 NetXtreme-C Ethernet Virtual Function" },
9698
{ "Broadcom BCM57404 NetXtreme-E Ethernet Virtual Function" },
9799
};
@@ -103,6 +105,7 @@ static const struct pci_device_id bnxt_pci_tbl[] = {
103105
{ PCI_VDEVICE(BROADCOM, 0x16d0), .driver_data = BCM57402 },
104106
{ PCI_VDEVICE(BROADCOM, 0x16d1), .driver_data = BCM57404 },
105107
{ PCI_VDEVICE(BROADCOM, 0x16d2), .driver_data = BCM57406 },
108+
{ PCI_VDEVICE(BROADCOM, 0x16df), .driver_data = BCM57314 },
106109
#ifdef CONFIG_BNXT_SRIOV
107110
{ PCI_VDEVICE(BROADCOM, 0x16cb), .driver_data = BCM57304_VF },
108111
{ PCI_VDEVICE(BROADCOM, 0x16d3), .driver_data = BCM57404_VF },
@@ -1324,15 +1327,6 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_napi *bnapi, u32 *raw_cons,
13241327
((data) & \
13251328
HWRM_ASYNC_EVENT_CMPL_PORT_CONN_NOT_ALLOWED_EVENT_DATA1_PORT_ID_MASK)
13261329

1327-
#define BNXT_EVENT_POLICY_MASK \
1328-
HWRM_ASYNC_EVENT_CMPL_PORT_CONN_NOT_ALLOWED_EVENT_DATA1_ENFORCEMENT_POLICY_MASK
1329-
1330-
#define BNXT_EVENT_POLICY_SFT \
1331-
HWRM_ASYNC_EVENT_CMPL_PORT_CONN_NOT_ALLOWED_EVENT_DATA1_ENFORCEMENT_POLICY_SFT
1332-
1333-
#define BNXT_GET_EVENT_POLICY(data) \
1334-
(((data) & BNXT_EVENT_POLICY_MASK) >> BNXT_EVENT_POLICY_SFT)
1335-
13361330
static int bnxt_async_event_process(struct bnxt *bp,
13371331
struct hwrm_async_event_cmpl *cmpl)
13381332
{
@@ -1371,9 +1365,6 @@ static int bnxt_async_event_process(struct bnxt *bp,
13711365
if (bp->pf.port_id != port_id)
13721366
break;
13731367

1374-
bp->link_info.last_port_module_event =
1375-
BNXT_GET_EVENT_POLICY(data1);
1376-
13771368
set_bit(BNXT_HWRM_PORT_MODULE_SP_EVENT, &bp->sp_event);
13781369
break;
13791370
}
@@ -1503,7 +1494,7 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget)
15031494
/* The valid test of the entry must be done first before
15041495
* reading any further.
15051496
*/
1506-
rmb();
1497+
dma_rmb();
15071498
if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) {
15081499
tx_pkts++;
15091500
/* return full budget so NAPI will complete. */
@@ -2780,7 +2771,7 @@ void bnxt_hwrm_cmd_hdr_init(struct bnxt *bp, void *request, u16 req_type,
27802771
static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
27812772
int timeout, bool silent)
27822773
{
2783-
int i, intr_process, rc;
2774+
int i, intr_process, rc, tmo_count;
27842775
struct input *req = msg;
27852776
u32 *data = msg;
27862777
__le32 *resp_len, *valid;
@@ -2809,11 +2800,12 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
28092800
timeout = DFLT_HWRM_CMD_TIMEOUT;
28102801

28112802
i = 0;
2803+
tmo_count = timeout * 40;
28122804
if (intr_process) {
28132805
/* Wait until hwrm response cmpl interrupt is processed */
28142806
while (bp->hwrm_intr_seq_id != HWRM_SEQ_ID_INVALID &&
2815-
i++ < timeout) {
2816-
usleep_range(600, 800);
2807+
i++ < tmo_count) {
2808+
usleep_range(25, 40);
28172809
}
28182810

28192811
if (bp->hwrm_intr_seq_id != HWRM_SEQ_ID_INVALID) {
@@ -2824,30 +2816,30 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
28242816
} else {
28252817
/* Check if response len is updated */
28262818
resp_len = bp->hwrm_cmd_resp_addr + HWRM_RESP_LEN_OFFSET;
2827-
for (i = 0; i < timeout; i++) {
2819+
for (i = 0; i < tmo_count; i++) {
28282820
len = (le32_to_cpu(*resp_len) & HWRM_RESP_LEN_MASK) >>
28292821
HWRM_RESP_LEN_SFT;
28302822
if (len)
28312823
break;
2832-
usleep_range(600, 800);
2824+
usleep_range(25, 40);
28332825
}
28342826

2835-
if (i >= timeout) {
2827+
if (i >= tmo_count) {
28362828
netdev_err(bp->dev, "Error (timeout: %d) msg {0x%x 0x%x} len:%d\n",
28372829
timeout, le16_to_cpu(req->req_type),
2838-
le16_to_cpu(req->seq_id), *resp_len);
2830+
le16_to_cpu(req->seq_id), len);
28392831
return -1;
28402832
}
28412833

28422834
/* Last word of resp contains valid bit */
28432835
valid = bp->hwrm_cmd_resp_addr + len - 4;
2844-
for (i = 0; i < timeout; i++) {
2836+
for (i = 0; i < 5; i++) {
28452837
if (le32_to_cpu(*valid) & HWRM_RESP_VALID_MASK)
28462838
break;
2847-
usleep_range(600, 800);
2839+
udelay(1);
28482840
}
28492841

2850-
if (i >= timeout) {
2842+
if (i >= 5) {
28512843
netdev_err(bp->dev, "Error (timeout: %d) msg {0x%x 0x%x} len:%d v:%d\n",
28522844
timeout, le16_to_cpu(req->req_type),
28532845
le16_to_cpu(req->seq_id), len, *valid);
@@ -4734,6 +4726,7 @@ static int bnxt_update_link(struct bnxt *bp, bool chng_link_state)
47344726
link_info->transceiver = resp->xcvr_pkg_type;
47354727
link_info->phy_addr = resp->eee_config_phy_addr &
47364728
PORT_PHY_QCFG_RESP_PHY_ADDR_MASK;
4729+
link_info->module_status = resp->module_status;
47374730

47384731
if (bp->flags & BNXT_FLAG_EEE_CAP) {
47394732
struct ethtool_eee *eee = &bp->eee;
@@ -4786,6 +4779,33 @@ static int bnxt_update_link(struct bnxt *bp, bool chng_link_state)
47864779
return 0;
47874780
}
47884781

4782+
static void bnxt_get_port_module_status(struct bnxt *bp)
4783+
{
4784+
struct bnxt_link_info *link_info = &bp->link_info;
4785+
struct hwrm_port_phy_qcfg_output *resp = &link_info->phy_qcfg_resp;
4786+
u8 module_status;
4787+
4788+
if (bnxt_update_link(bp, true))
4789+
return;
4790+
4791+
module_status = link_info->module_status;
4792+
switch (module_status) {
4793+
case PORT_PHY_QCFG_RESP_MODULE_STATUS_DISABLETX:
4794+
case PORT_PHY_QCFG_RESP_MODULE_STATUS_PWRDOWN:
4795+
case PORT_PHY_QCFG_RESP_MODULE_STATUS_WARNINGMSG:
4796+
netdev_warn(bp->dev, "Unqualified SFP+ module detected on port %d\n",
4797+
bp->pf.port_id);
4798+
if (bp->hwrm_spec_code >= 0x10201) {
4799+
netdev_warn(bp->dev, "Module part number %s\n",
4800+
resp->phy_vendor_partnumber);
4801+
}
4802+
if (module_status == PORT_PHY_QCFG_RESP_MODULE_STATUS_DISABLETX)
4803+
netdev_warn(bp->dev, "TX is disabled\n");
4804+
if (module_status == PORT_PHY_QCFG_RESP_MODULE_STATUS_PWRDOWN)
4805+
netdev_warn(bp->dev, "SFP+ module is shutdown\n");
4806+
}
4807+
}
4808+
47894809
static void
47904810
bnxt_hwrm_set_pause_common(struct bnxt *bp, struct hwrm_port_phy_cfg_input *req)
47914811
{
@@ -5078,7 +5098,8 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
50785098
/* Enable TX queues */
50795099
bnxt_tx_enable(bp);
50805100
mod_timer(&bp->timer, jiffies + bp->current_interval);
5081-
bnxt_update_link(bp, true);
5101+
/* Poll link status and check for SFP+ module status */
5102+
bnxt_get_port_module_status(bp);
50825103

50835104
return 0;
50845105

@@ -5613,28 +5634,6 @@ static void bnxt_timer(unsigned long data)
56135634
mod_timer(&bp->timer, jiffies + bp->current_interval);
56145635
}
56155636

5616-
static void bnxt_port_module_event(struct bnxt *bp)
5617-
{
5618-
struct bnxt_link_info *link_info = &bp->link_info;
5619-
struct hwrm_port_phy_qcfg_output *resp = &link_info->phy_qcfg_resp;
5620-
5621-
if (bnxt_update_link(bp, true))
5622-
return;
5623-
5624-
if (link_info->last_port_module_event != 0) {
5625-
netdev_warn(bp->dev, "Unqualified SFP+ module detected on port %d\n",
5626-
bp->pf.port_id);
5627-
if (bp->hwrm_spec_code >= 0x10201) {
5628-
netdev_warn(bp->dev, "Module part number %s\n",
5629-
resp->phy_vendor_partnumber);
5630-
}
5631-
}
5632-
if (link_info->last_port_module_event == 1)
5633-
netdev_warn(bp->dev, "TX is disabled\n");
5634-
if (link_info->last_port_module_event == 3)
5635-
netdev_warn(bp->dev, "Shutdown SFP+ module\n");
5636-
}
5637-
56385637
static void bnxt_cfg_ntp_filters(struct bnxt *);
56395638

56405639
static void bnxt_sp_task(struct work_struct *work)
@@ -5683,7 +5682,7 @@ static void bnxt_sp_task(struct work_struct *work)
56835682
}
56845683

56855684
if (test_and_clear_bit(BNXT_HWRM_PORT_MODULE_SP_EVENT, &bp->sp_event))
5686-
bnxt_port_module_event(bp);
5685+
bnxt_get_port_module_status(bp);
56875686

56885687
if (test_and_clear_bit(BNXT_PERIODIC_STATS_SP_EVENT, &bp->sp_event))
56895688
bnxt_hwrm_port_qstats(bp);
@@ -6260,6 +6259,22 @@ static int bnxt_set_dflt_rings(struct bnxt *bp)
62606259
return rc;
62616260
}
62626261

6262+
static void bnxt_parse_log_pcie_link(struct bnxt *bp)
6263+
{
6264+
enum pcie_link_width width = PCIE_LNK_WIDTH_UNKNOWN;
6265+
enum pci_bus_speed speed = PCI_SPEED_UNKNOWN;
6266+
6267+
if (pcie_get_minimum_link(bp->pdev, &speed, &width) ||
6268+
speed == PCI_SPEED_UNKNOWN || width == PCIE_LNK_WIDTH_UNKNOWN)
6269+
netdev_info(bp->dev, "Failed to determine PCIe Link Info\n");
6270+
else
6271+
netdev_info(bp->dev, "PCIe: Speed %s Width x%d\n",
6272+
speed == PCIE_SPEED_2_5GT ? "2.5GT/s" :
6273+
speed == PCIE_SPEED_5_0GT ? "5.0GT/s" :
6274+
speed == PCIE_SPEED_8_0GT ? "8.0GT/s" :
6275+
"Unknown", width);
6276+
}
6277+
62636278
static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
62646279
{
62656280
static int version_printed;
@@ -6380,6 +6395,8 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
63806395
board_info[ent->driver_data].name,
63816396
(long)pci_resource_start(pdev, 0), dev->dev_addr);
63826397

6398+
bnxt_parse_log_pcie_link(bp);
6399+
63836400
return 0;
63846401

63856402
init_err:

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,17 @@ struct rx_tpa_end_cmp_ext {
425425

426426
#define MAX_TPA 64
427427

428+
#if (BNXT_PAGE_SHIFT == 16)
429+
#define MAX_RX_PAGES 1
430+
#define MAX_RX_AGG_PAGES 4
431+
#define MAX_TX_PAGES 1
432+
#define MAX_CP_PAGES 8
433+
#else
428434
#define MAX_RX_PAGES 8
429435
#define MAX_RX_AGG_PAGES 32
430436
#define MAX_TX_PAGES 8
431437
#define MAX_CP_PAGES 64
438+
#endif
432439

433440
#define RX_DESC_CNT (BNXT_PAGE_SIZE / sizeof(struct rx_bd))
434441
#define TX_DESC_CNT (BNXT_PAGE_SIZE / sizeof(struct tx_bd))
@@ -831,6 +838,7 @@ struct bnxt_link_info {
831838
u16 lp_auto_link_speeds;
832839
u16 force_link_speed;
833840
u32 preemphasis;
841+
u8 module_status;
834842

835843
/* copy of requested setting from ethtool cmd */
836844
u8 autoneg;
@@ -842,7 +850,6 @@ struct bnxt_link_info {
842850
u32 advertising;
843851
bool force_link_chng;
844852

845-
u8 last_port_module_event;
846853
/* a copy of phy_qcfg output used to report link
847854
* info to VF
848855
*/
@@ -1123,6 +1130,16 @@ static inline void bnxt_disable_poll(struct bnxt_napi *bnapi)
11231130

11241131
#endif
11251132

1133+
#define I2C_DEV_ADDR_A0 0xa0
1134+
#define I2C_DEV_ADDR_A2 0xa2
1135+
#define SFP_EEPROM_SFF_8472_COMP_ADDR 0x5e
1136+
#define SFP_EEPROM_SFF_8472_COMP_SIZE 1
1137+
#define SFF_MODULE_ID_SFP 0x3
1138+
#define SFF_MODULE_ID_QSFP 0xc
1139+
#define SFF_MODULE_ID_QSFP_PLUS 0xd
1140+
#define SFF_MODULE_ID_QSFP28 0x11
1141+
#define BNXT_MAX_PHY_I2C_RESP_SIZE 64
1142+
11261143
void bnxt_set_ring_params(struct bnxt *);
11271144
void bnxt_hwrm_cmd_hdr_init(struct bnxt *, void *, u16, u16, u16);
11281145
int _hwrm_send_message(struct bnxt *, void *, u32, int);

0 commit comments

Comments
 (0)