@@ -1247,6 +1247,52 @@ static void qed_mcp_read_eee_config(struct qed_hwfn *p_hwfn,
1247
1247
p_link -> eee_lp_adv_caps |= QED_EEE_10G_ADV ;
1248
1248
}
1249
1249
1250
+ static u32 qed_mcp_get_shmem_func (struct qed_hwfn * p_hwfn ,
1251
+ struct qed_ptt * p_ptt ,
1252
+ struct public_func * p_data , int pfid )
1253
+ {
1254
+ u32 addr = SECTION_OFFSIZE_ADDR (p_hwfn -> mcp_info -> public_base ,
1255
+ PUBLIC_FUNC );
1256
+ u32 mfw_path_offsize = qed_rd (p_hwfn , p_ptt , addr );
1257
+ u32 func_addr ;
1258
+ u32 i , size ;
1259
+
1260
+ func_addr = SECTION_ADDR (mfw_path_offsize , pfid );
1261
+ memset (p_data , 0 , sizeof (* p_data ));
1262
+
1263
+ size = min_t (u32 , sizeof (* p_data ), QED_SECTION_SIZE (mfw_path_offsize ));
1264
+ for (i = 0 ; i < size / sizeof (u32 ); i ++ )
1265
+ ((u32 * )p_data )[i ] = qed_rd (p_hwfn , p_ptt ,
1266
+ func_addr + (i << 2 ));
1267
+ return size ;
1268
+ }
1269
+
1270
+ static void qed_read_pf_bandwidth (struct qed_hwfn * p_hwfn ,
1271
+ struct public_func * p_shmem_info )
1272
+ {
1273
+ struct qed_mcp_function_info * p_info ;
1274
+
1275
+ p_info = & p_hwfn -> mcp_info -> func_info ;
1276
+
1277
+ p_info -> bandwidth_min = QED_MFW_GET_FIELD (p_shmem_info -> config ,
1278
+ FUNC_MF_CFG_MIN_BW );
1279
+ if (p_info -> bandwidth_min < 1 || p_info -> bandwidth_min > 100 ) {
1280
+ DP_INFO (p_hwfn ,
1281
+ "bandwidth minimum out of bounds [%02x]. Set to 1\n" ,
1282
+ p_info -> bandwidth_min );
1283
+ p_info -> bandwidth_min = 1 ;
1284
+ }
1285
+
1286
+ p_info -> bandwidth_max = QED_MFW_GET_FIELD (p_shmem_info -> config ,
1287
+ FUNC_MF_CFG_MAX_BW );
1288
+ if (p_info -> bandwidth_max < 1 || p_info -> bandwidth_max > 100 ) {
1289
+ DP_INFO (p_hwfn ,
1290
+ "bandwidth maximum out of bounds [%02x]. Set to 100\n" ,
1291
+ p_info -> bandwidth_max );
1292
+ p_info -> bandwidth_max = 100 ;
1293
+ }
1294
+ }
1295
+
1250
1296
static void qed_mcp_handle_link_change (struct qed_hwfn * p_hwfn ,
1251
1297
struct qed_ptt * p_ptt , bool b_reset )
1252
1298
{
@@ -1274,10 +1320,29 @@ static void qed_mcp_handle_link_change(struct qed_hwfn *p_hwfn,
1274
1320
goto out ;
1275
1321
}
1276
1322
1277
- if (p_hwfn -> b_drv_link_init )
1278
- p_link -> link_up = !!(status & LINK_STATUS_LINK_UP );
1279
- else
1323
+ if (p_hwfn -> b_drv_link_init ) {
1324
+ /* Link indication with modern MFW arrives as per-PF
1325
+ * indication.
1326
+ */
1327
+ if (p_hwfn -> mcp_info -> capabilities &
1328
+ FW_MB_PARAM_FEATURE_SUPPORT_VLINK ) {
1329
+ struct public_func shmem_info ;
1330
+
1331
+ qed_mcp_get_shmem_func (p_hwfn , p_ptt , & shmem_info ,
1332
+ MCP_PF_ID (p_hwfn ));
1333
+ p_link -> link_up = !!(shmem_info .status &
1334
+ FUNC_STATUS_VIRTUAL_LINK_UP );
1335
+ qed_read_pf_bandwidth (p_hwfn , & shmem_info );
1336
+ DP_VERBOSE (p_hwfn , NETIF_MSG_LINK ,
1337
+ "Virtual link_up = %d\n" , p_link -> link_up );
1338
+ } else {
1339
+ p_link -> link_up = !!(status & LINK_STATUS_LINK_UP );
1340
+ DP_VERBOSE (p_hwfn , NETIF_MSG_LINK ,
1341
+ "Physical link_up = %d\n" , p_link -> link_up );
1342
+ }
1343
+ } else {
1280
1344
p_link -> link_up = false;
1345
+ }
1281
1346
1282
1347
p_link -> full_duplex = true;
1283
1348
switch ((status & LINK_STATUS_SPEED_AND_DUPLEX_MASK )) {
@@ -1504,53 +1569,6 @@ static void qed_mcp_send_protocol_stats(struct qed_hwfn *p_hwfn,
1504
1569
qed_mcp_cmd_and_union (p_hwfn , p_ptt , & mb_params );
1505
1570
}
1506
1571
1507
- static void qed_read_pf_bandwidth (struct qed_hwfn * p_hwfn ,
1508
- struct public_func * p_shmem_info )
1509
- {
1510
- struct qed_mcp_function_info * p_info ;
1511
-
1512
- p_info = & p_hwfn -> mcp_info -> func_info ;
1513
-
1514
- p_info -> bandwidth_min = (p_shmem_info -> config &
1515
- FUNC_MF_CFG_MIN_BW_MASK ) >>
1516
- FUNC_MF_CFG_MIN_BW_SHIFT ;
1517
- if (p_info -> bandwidth_min < 1 || p_info -> bandwidth_min > 100 ) {
1518
- DP_INFO (p_hwfn ,
1519
- "bandwidth minimum out of bounds [%02x]. Set to 1\n" ,
1520
- p_info -> bandwidth_min );
1521
- p_info -> bandwidth_min = 1 ;
1522
- }
1523
-
1524
- p_info -> bandwidth_max = (p_shmem_info -> config &
1525
- FUNC_MF_CFG_MAX_BW_MASK ) >>
1526
- FUNC_MF_CFG_MAX_BW_SHIFT ;
1527
- if (p_info -> bandwidth_max < 1 || p_info -> bandwidth_max > 100 ) {
1528
- DP_INFO (p_hwfn ,
1529
- "bandwidth maximum out of bounds [%02x]. Set to 100\n" ,
1530
- p_info -> bandwidth_max );
1531
- p_info -> bandwidth_max = 100 ;
1532
- }
1533
- }
1534
-
1535
- static u32 qed_mcp_get_shmem_func (struct qed_hwfn * p_hwfn ,
1536
- struct qed_ptt * p_ptt ,
1537
- struct public_func * p_data , int pfid )
1538
- {
1539
- u32 addr = SECTION_OFFSIZE_ADDR (p_hwfn -> mcp_info -> public_base ,
1540
- PUBLIC_FUNC );
1541
- u32 mfw_path_offsize = qed_rd (p_hwfn , p_ptt , addr );
1542
- u32 func_addr = SECTION_ADDR (mfw_path_offsize , pfid );
1543
- u32 i , size ;
1544
-
1545
- memset (p_data , 0 , sizeof (* p_data ));
1546
-
1547
- size = min_t (u32 , sizeof (* p_data ), QED_SECTION_SIZE (mfw_path_offsize ));
1548
- for (i = 0 ; i < size / sizeof (u32 ); i ++ )
1549
- ((u32 * )p_data )[i ] = qed_rd (p_hwfn , p_ptt ,
1550
- func_addr + (i << 2 ));
1551
- return size ;
1552
- }
1553
-
1554
1572
static void qed_mcp_update_bw (struct qed_hwfn * p_hwfn , struct qed_ptt * p_ptt )
1555
1573
{
1556
1574
struct qed_mcp_function_info * p_info ;
@@ -3351,7 +3369,8 @@ int qed_mcp_set_capabilities(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
3351
3369
{
3352
3370
u32 mcp_resp , mcp_param , features ;
3353
3371
3354
- features = DRV_MB_PARAM_FEATURE_SUPPORT_PORT_EEE ;
3372
+ features = DRV_MB_PARAM_FEATURE_SUPPORT_PORT_EEE |
3373
+ DRV_MB_PARAM_FEATURE_SUPPORT_FUNC_VLINK ;
3355
3374
3356
3375
return qed_mcp_cmd (p_hwfn , p_ptt , DRV_MSG_CODE_FEATURE_SUPPORT ,
3357
3376
features , & mcp_resp , & mcp_param );
0 commit comments