@@ -57,14 +57,8 @@ struct nicpf {
57
57
#define NIC_GET_BGX_FROM_VF_LMAC_MAP (map ) ((map >> 4) & 0xF)
58
58
#define NIC_GET_LMAC_FROM_VF_LMAC_MAP (map ) (map & 0xF)
59
59
u8 * vf_lmac_map ;
60
- struct delayed_work dwork ;
61
- struct workqueue_struct * check_link ;
62
- u8 * link ;
63
- u8 * duplex ;
64
- u32 * speed ;
65
60
u16 cpi_base [MAX_NUM_VFS_SUPPORTED ];
66
61
u16 rssi_base [MAX_NUM_VFS_SUPPORTED ];
67
- bool mbx_lock [MAX_NUM_VFS_SUPPORTED ];
68
62
69
63
/* MSI-X */
70
64
u8 num_vec ;
@@ -929,6 +923,10 @@ static void nic_config_timestamp(struct nicpf *nic, int vf, struct set_ptp *ptp)
929
923
nic_reg_write (nic , NIC_PF_PKIND_0_15_CFG | (pkind_idx << 3 ), pkind_val );
930
924
}
931
925
926
+ /* Get BGX LMAC link status and update corresponding VF
927
+ * if there is a change, valid only if internal L2 switch
928
+ * is not present otherwise VF link is always treated as up
929
+ */
932
930
static void nic_link_status_get (struct nicpf * nic , u8 vf )
933
931
{
934
932
union nic_mbx mbx = {};
@@ -944,10 +942,6 @@ static void nic_link_status_get(struct nicpf *nic, u8 vf)
944
942
/* Get interface link status */
945
943
bgx_get_lmac_link_state (nic -> node , bgx , lmac , & link );
946
944
947
- nic -> link [vf ] = link .link_up ;
948
- nic -> duplex [vf ] = link .duplex ;
949
- nic -> speed [vf ] = link .speed ;
950
-
951
945
/* Send a mbox message to VF with current link status */
952
946
mbx .link_status .link_up = link .link_up ;
953
947
mbx .link_status .duplex = link .duplex ;
@@ -970,8 +964,6 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
970
964
int i ;
971
965
int ret = 0 ;
972
966
973
- nic -> mbx_lock [vf ] = true;
974
-
975
967
mbx_addr = nic_get_mbx_addr (vf );
976
968
mbx_data = (u64 * )& mbx ;
977
969
@@ -986,12 +978,7 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
986
978
switch (mbx .msg .msg ) {
987
979
case NIC_MBOX_MSG_READY :
988
980
nic_mbx_send_ready (nic , vf );
989
- if (vf < nic -> num_vf_en ) {
990
- nic -> link [vf ] = 0 ;
991
- nic -> duplex [vf ] = 0 ;
992
- nic -> speed [vf ] = 0 ;
993
- }
994
- goto unlock ;
981
+ return ;
995
982
case NIC_MBOX_MSG_QS_CFG :
996
983
reg_addr = NIC_PF_QSET_0_127_CFG |
997
984
(mbx .qs .num << NIC_QS_ID_SHIFT );
@@ -1060,7 +1047,7 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
1060
1047
break ;
1061
1048
case NIC_MBOX_MSG_RSS_SIZE :
1062
1049
nic_send_rss_size (nic , vf );
1063
- goto unlock ;
1050
+ return ;
1064
1051
case NIC_MBOX_MSG_RSS_CFG :
1065
1052
case NIC_MBOX_MSG_RSS_CFG_CONT :
1066
1053
nic_config_rss (nic , & mbx .rss_cfg );
@@ -1078,19 +1065,19 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
1078
1065
break ;
1079
1066
case NIC_MBOX_MSG_ALLOC_SQS :
1080
1067
nic_alloc_sqs (nic , & mbx .sqs_alloc );
1081
- goto unlock ;
1068
+ return ;
1082
1069
case NIC_MBOX_MSG_NICVF_PTR :
1083
1070
nic -> nicvf [vf ] = mbx .nicvf .nicvf ;
1084
1071
break ;
1085
1072
case NIC_MBOX_MSG_PNICVF_PTR :
1086
1073
nic_send_pnicvf (nic , vf );
1087
- goto unlock ;
1074
+ return ;
1088
1075
case NIC_MBOX_MSG_SNICVF_PTR :
1089
1076
nic_send_snicvf (nic , & mbx .nicvf );
1090
- goto unlock ;
1077
+ return ;
1091
1078
case NIC_MBOX_MSG_BGX_STATS :
1092
1079
nic_get_bgx_stats (nic , & mbx .bgx_stats );
1093
- goto unlock ;
1080
+ return ;
1094
1081
case NIC_MBOX_MSG_LOOPBACK :
1095
1082
ret = nic_config_loopback (nic , & mbx .lbk );
1096
1083
break ;
@@ -1099,7 +1086,7 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
1099
1086
break ;
1100
1087
case NIC_MBOX_MSG_PFC :
1101
1088
nic_pause_frame (nic , vf , & mbx .pfc );
1102
- goto unlock ;
1089
+ return ;
1103
1090
case NIC_MBOX_MSG_PTP_CFG :
1104
1091
nic_config_timestamp (nic , vf , & mbx .ptp );
1105
1092
break ;
@@ -1143,7 +1130,7 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
1143
1130
break ;
1144
1131
}
1145
1132
nic_link_status_get (nic , vf );
1146
- goto unlock ;
1133
+ return ;
1147
1134
default :
1148
1135
dev_err (& nic -> pdev -> dev ,
1149
1136
"Invalid msg from VF%d, msg 0x%x\n" , vf , mbx .msg .msg );
@@ -1157,8 +1144,6 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
1157
1144
mbx .msg .msg , vf );
1158
1145
nic_mbx_send_nack (nic , vf );
1159
1146
}
1160
- unlock :
1161
- nic -> mbx_lock [vf ] = false;
1162
1147
}
1163
1148
1164
1149
static irqreturn_t nic_mbx_intr_handler (int irq , void * nic_irq )
@@ -1306,52 +1291,6 @@ static int nic_sriov_init(struct pci_dev *pdev, struct nicpf *nic)
1306
1291
return 0 ;
1307
1292
}
1308
1293
1309
- /* Poll for BGX LMAC link status and update corresponding VF
1310
- * if there is a change, valid only if internal L2 switch
1311
- * is not present otherwise VF link is always treated as up
1312
- */
1313
- static void nic_poll_for_link (struct work_struct * work )
1314
- {
1315
- union nic_mbx mbx = {};
1316
- struct nicpf * nic ;
1317
- struct bgx_link_status link ;
1318
- u8 vf , bgx , lmac ;
1319
-
1320
- nic = container_of (work , struct nicpf , dwork .work );
1321
-
1322
- mbx .link_status .msg = NIC_MBOX_MSG_BGX_LINK_CHANGE ;
1323
-
1324
- for (vf = 0 ; vf < nic -> num_vf_en ; vf ++ ) {
1325
- /* Poll only if VF is UP */
1326
- if (!nic -> vf_enabled [vf ])
1327
- continue ;
1328
-
1329
- /* Get BGX, LMAC indices for the VF */
1330
- bgx = NIC_GET_BGX_FROM_VF_LMAC_MAP (nic -> vf_lmac_map [vf ]);
1331
- lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP (nic -> vf_lmac_map [vf ]);
1332
- /* Get interface link status */
1333
- bgx_get_lmac_link_state (nic -> node , bgx , lmac , & link );
1334
-
1335
- /* Inform VF only if link status changed */
1336
- if (nic -> link [vf ] == link .link_up )
1337
- continue ;
1338
-
1339
- if (!nic -> mbx_lock [vf ]) {
1340
- nic -> link [vf ] = link .link_up ;
1341
- nic -> duplex [vf ] = link .duplex ;
1342
- nic -> speed [vf ] = link .speed ;
1343
-
1344
- /* Send a mbox message to VF with current link status */
1345
- mbx .link_status .link_up = link .link_up ;
1346
- mbx .link_status .duplex = link .duplex ;
1347
- mbx .link_status .speed = link .speed ;
1348
- mbx .link_status .mac_type = link .mac_type ;
1349
- nic_send_msg_to_vf (nic , vf , & mbx );
1350
- }
1351
- }
1352
- queue_delayed_work (nic -> check_link , & nic -> dwork , HZ * 2 );
1353
- }
1354
-
1355
1294
static int nic_probe (struct pci_dev * pdev , const struct pci_device_id * ent )
1356
1295
{
1357
1296
struct device * dev = & pdev -> dev ;
@@ -1420,18 +1359,6 @@ static int nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1420
1359
if (!nic -> vf_lmac_map )
1421
1360
goto err_release_regions ;
1422
1361
1423
- nic -> link = devm_kmalloc_array (dev , max_lmac , sizeof (u8 ), GFP_KERNEL );
1424
- if (!nic -> link )
1425
- goto err_release_regions ;
1426
-
1427
- nic -> duplex = devm_kmalloc_array (dev , max_lmac , sizeof (u8 ), GFP_KERNEL );
1428
- if (!nic -> duplex )
1429
- goto err_release_regions ;
1430
-
1431
- nic -> speed = devm_kmalloc_array (dev , max_lmac , sizeof (u32 ), GFP_KERNEL );
1432
- if (!nic -> speed )
1433
- goto err_release_regions ;
1434
-
1435
1362
/* Initialize hardware */
1436
1363
nic_init_hw (nic );
1437
1364
@@ -1447,19 +1374,8 @@ static int nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1447
1374
if (err )
1448
1375
goto err_unregister_interrupts ;
1449
1376
1450
- /* Register a physical link status poll fn() */
1451
- nic -> check_link = alloc_workqueue ("check_link_status" ,
1452
- WQ_UNBOUND | WQ_MEM_RECLAIM , 1 );
1453
- if (!nic -> check_link ) {
1454
- err = - ENOMEM ;
1455
- goto err_disable_sriov ;
1456
- }
1457
-
1458
1377
return 0 ;
1459
1378
1460
- err_disable_sriov :
1461
- if (nic -> flags & NIC_SRIOV_ENABLED )
1462
- pci_disable_sriov (pdev );
1463
1379
err_unregister_interrupts :
1464
1380
nic_unregister_interrupts (nic );
1465
1381
err_release_regions :
@@ -1480,12 +1396,6 @@ static void nic_remove(struct pci_dev *pdev)
1480
1396
if (nic -> flags & NIC_SRIOV_ENABLED )
1481
1397
pci_disable_sriov (pdev );
1482
1398
1483
- if (nic -> check_link ) {
1484
- /* Destroy work Queue */
1485
- cancel_delayed_work_sync (& nic -> dwork );
1486
- destroy_workqueue (nic -> check_link );
1487
- }
1488
-
1489
1399
nic_unregister_interrupts (nic );
1490
1400
pci_release_regions (pdev );
1491
1401
0 commit comments