Skip to content

Commit 4bb13ab

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Add unsupported SFP+ module warnings.
Add the PORT_CONN_NOT_ALLOWED async event handling logic. The driver will print an appropriate warning to reflect the SFP+ module enforcement policy done in the firmware. Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 25be862 commit 4bb13ab

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

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

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ static const u16 bnxt_vf_req_snif[] = {
121121
static const u16 bnxt_async_events_arr[] = {
122122
HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE,
123123
HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD,
124+
HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED,
124125
};
125126

126127
static bool bnxt_vf_pciid(enum board_idx idx)
@@ -1236,6 +1237,19 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_napi *bnapi, u32 *raw_cons,
12361237
return rc;
12371238
}
12381239

1240+
#define BNXT_GET_EVENT_PORT(data) \
1241+
((data) & \
1242+
HWRM_ASYNC_EVENT_CMPL_PORT_CONN_NOT_ALLOWED_EVENT_DATA1_PORT_ID_MASK)
1243+
1244+
#define BNXT_EVENT_POLICY_MASK \
1245+
HWRM_ASYNC_EVENT_CMPL_PORT_CONN_NOT_ALLOWED_EVENT_DATA1_ENFORCEMENT_POLICY_MASK
1246+
1247+
#define BNXT_EVENT_POLICY_SFT \
1248+
HWRM_ASYNC_EVENT_CMPL_PORT_CONN_NOT_ALLOWED_EVENT_DATA1_ENFORCEMENT_POLICY_SFT
1249+
1250+
#define BNXT_GET_EVENT_POLICY(data) \
1251+
(((data) & BNXT_EVENT_POLICY_MASK) >> BNXT_EVENT_POLICY_SFT)
1252+
12391253
static int bnxt_async_event_process(struct bnxt *bp,
12401254
struct hwrm_async_event_cmpl *cmpl)
12411255
{
@@ -1249,6 +1263,22 @@ static int bnxt_async_event_process(struct bnxt *bp,
12491263
case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD:
12501264
set_bit(BNXT_HWRM_PF_UNLOAD_SP_EVENT, &bp->sp_event);
12511265
break;
1266+
case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED: {
1267+
u32 data1 = le32_to_cpu(cmpl->event_data1);
1268+
u16 port_id = BNXT_GET_EVENT_PORT(data1);
1269+
1270+
if (BNXT_VF(bp))
1271+
break;
1272+
1273+
if (bp->pf.port_id != port_id)
1274+
break;
1275+
1276+
bp->link_info.last_port_module_event =
1277+
BNXT_GET_EVENT_POLICY(data1);
1278+
1279+
set_bit(BNXT_HWRM_PORT_MODULE_SP_EVENT, &bp->sp_event);
1280+
break;
1281+
}
12521282
default:
12531283
netdev_err(bp->dev, "unhandled ASYNC event (id 0x%x)\n",
12541284
event_id);
@@ -5447,6 +5477,28 @@ static void bnxt_timer(unsigned long data)
54475477
mod_timer(&bp->timer, jiffies + bp->current_interval);
54485478
}
54495479

5480+
static void bnxt_port_module_event(struct bnxt *bp)
5481+
{
5482+
struct bnxt_link_info *link_info = &bp->link_info;
5483+
struct hwrm_port_phy_qcfg_output *resp = &link_info->phy_qcfg_resp;
5484+
5485+
if (bnxt_update_link(bp, true))
5486+
return;
5487+
5488+
if (link_info->last_port_module_event != 0) {
5489+
netdev_warn(bp->dev, "Unqualified SFP+ module detected on port %d\n",
5490+
bp->pf.port_id);
5491+
if (bp->hwrm_spec_code >= 0x10201) {
5492+
netdev_warn(bp->dev, "Module part number %s\n",
5493+
resp->phy_vendor_partnumber);
5494+
}
5495+
}
5496+
if (link_info->last_port_module_event == 1)
5497+
netdev_warn(bp->dev, "TX is disabled\n");
5498+
if (link_info->last_port_module_event == 3)
5499+
netdev_warn(bp->dev, "Shutdown SFP+ module\n");
5500+
}
5501+
54505502
static void bnxt_cfg_ntp_filters(struct bnxt *);
54515503

54525504
static void bnxt_sp_task(struct work_struct *work)
@@ -5494,6 +5546,9 @@ static void bnxt_sp_task(struct work_struct *work)
54945546
rtnl_unlock();
54955547
}
54965548

5549+
if (test_and_clear_bit(BNXT_HWRM_PORT_MODULE_SP_EVENT, &bp->sp_event))
5550+
bnxt_port_module_event(bp);
5551+
54975552
if (test_and_clear_bit(BNXT_PERIODIC_STATS_SP_EVENT, &bp->sp_event))
54985553
bnxt_hwrm_port_qstats(bp);
54995554

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,8 @@ struct bnxt_link_info {
825825
u16 req_link_speed;
826826
u32 advertising;
827827
bool force_link_chng;
828+
829+
u8 last_port_module_event;
828830
/* a copy of phy_qcfg output used to report link
829831
* info to VF
830832
*/
@@ -992,6 +994,7 @@ struct bnxt {
992994
#define BNXT_RST_RING_SP_EVENT 7
993995
#define BNXT_HWRM_PF_UNLOAD_SP_EVENT 8
994996
#define BNXT_PERIODIC_STATS_SP_EVENT 9
997+
#define BNXT_HWRM_PORT_MODULE_SP_EVENT 10
995998

996999
struct bnxt_pf_info pf;
9971000
#ifdef CONFIG_BNXT_SRIOV

0 commit comments

Comments
 (0)