@@ -61,6 +61,7 @@ static void hclge_sync_fd_table(struct hclge_dev *hdev);
6161static void hclge_update_fec_stats (struct hclge_dev * hdev );
6262static int hclge_mac_link_status_wait (struct hclge_dev * hdev , int link_ret ,
6363 int wait_cnt );
64+ static int hclge_update_port_info (struct hclge_dev * hdev );
6465
6566static struct hnae3_ae_algo ae_algo ;
6667
@@ -3041,6 +3042,9 @@ static void hclge_update_link_status(struct hclge_dev *hdev)
30413042
30423043 if (state != hdev -> hw .mac .link ) {
30433044 hdev -> hw .mac .link = state ;
3045+ if (state == HCLGE_LINK_STATUS_UP )
3046+ hclge_update_port_info (hdev );
3047+
30443048 client -> ops -> link_status_change (handle , state );
30453049 hclge_config_mac_tnl_int (hdev , state );
30463050 if (rclient && rclient -> ops -> link_status_change )
@@ -10025,8 +10029,6 @@ static void hclge_rm_vport_vlan_table(struct hclge_vport *vport, u16 vlan_id,
1002510029 struct hclge_vport_vlan_cfg * vlan , * tmp ;
1002610030 struct hclge_dev * hdev = vport -> back ;
1002710031
10028- mutex_lock (& hdev -> vport_lock );
10029-
1003010032 list_for_each_entry_safe (vlan , tmp , & vport -> vlan_list , node ) {
1003110033 if (vlan -> vlan_id == vlan_id ) {
1003210034 if (is_write_tbl && vlan -> hd_tbl_status )
@@ -10041,8 +10043,6 @@ static void hclge_rm_vport_vlan_table(struct hclge_vport *vport, u16 vlan_id,
1004110043 break ;
1004210044 }
1004310045 }
10044-
10045- mutex_unlock (& hdev -> vport_lock );
1004610046}
1004710047
1004810048void hclge_rm_vport_all_vlan_table (struct hclge_vport * vport , bool is_del_list )
@@ -10451,11 +10451,16 @@ int hclge_set_vlan_filter(struct hnae3_handle *handle, __be16 proto,
1045110451 * handle mailbox. Just record the vlan id, and remove it after
1045210452 * reset finished.
1045310453 */
10454+ mutex_lock (& hdev -> vport_lock );
1045410455 if ((test_bit (HCLGE_STATE_RST_HANDLING , & hdev -> state ) ||
1045510456 test_bit (HCLGE_STATE_RST_FAIL , & hdev -> state )) && is_kill ) {
1045610457 set_bit (vlan_id , vport -> vlan_del_fail_bmap );
10458+ mutex_unlock (& hdev -> vport_lock );
1045710459 return - EBUSY ;
10460+ } else if (!is_kill && test_bit (vlan_id , vport -> vlan_del_fail_bmap )) {
10461+ clear_bit (vlan_id , vport -> vlan_del_fail_bmap );
1045810462 }
10463+ mutex_unlock (& hdev -> vport_lock );
1045910464
1046010465 /* when port base vlan enabled, we use port base vlan as the vlan
1046110466 * filter entry. In this case, we don't update vlan filter table
@@ -10470,17 +10475,22 @@ int hclge_set_vlan_filter(struct hnae3_handle *handle, __be16 proto,
1047010475 }
1047110476
1047210477 if (!ret ) {
10473- if (!is_kill )
10478+ if (!is_kill ) {
1047410479 hclge_add_vport_vlan_table (vport , vlan_id ,
1047510480 writen_to_tbl );
10476- else if (is_kill && vlan_id != 0 )
10481+ } else if (is_kill && vlan_id != 0 ) {
10482+ mutex_lock (& hdev -> vport_lock );
1047710483 hclge_rm_vport_vlan_table (vport , vlan_id , false);
10484+ mutex_unlock (& hdev -> vport_lock );
10485+ }
1047810486 } else if (is_kill ) {
1047910487 /* when remove hw vlan filter failed, record the vlan id,
1048010488 * and try to remove it from hw later, to be consistence
1048110489 * with stack
1048210490 */
10491+ mutex_lock (& hdev -> vport_lock );
1048310492 set_bit (vlan_id , vport -> vlan_del_fail_bmap );
10493+ mutex_unlock (& hdev -> vport_lock );
1048410494 }
1048510495
1048610496 hclge_set_vport_vlan_fltr_change (vport );
@@ -10520,6 +10530,7 @@ static void hclge_sync_vlan_filter(struct hclge_dev *hdev)
1052010530 int i , ret , sync_cnt = 0 ;
1052110531 u16 vlan_id ;
1052210532
10533+ mutex_lock (& hdev -> vport_lock );
1052310534 /* start from vport 1 for PF is always alive */
1052410535 for (i = 0 ; i < hdev -> num_alloc_vport ; i ++ ) {
1052510536 struct hclge_vport * vport = & hdev -> vport [i ];
@@ -10530,21 +10541,26 @@ static void hclge_sync_vlan_filter(struct hclge_dev *hdev)
1053010541 ret = hclge_set_vlan_filter_hw (hdev , htons (ETH_P_8021Q ),
1053110542 vport -> vport_id , vlan_id ,
1053210543 true);
10533- if (ret && ret != - EINVAL )
10544+ if (ret && ret != - EINVAL ) {
10545+ mutex_unlock (& hdev -> vport_lock );
1053410546 return ;
10547+ }
1053510548
1053610549 clear_bit (vlan_id , vport -> vlan_del_fail_bmap );
1053710550 hclge_rm_vport_vlan_table (vport , vlan_id , false);
1053810551 hclge_set_vport_vlan_fltr_change (vport );
1053910552
1054010553 sync_cnt ++ ;
10541- if (sync_cnt >= HCLGE_MAX_SYNC_COUNT )
10554+ if (sync_cnt >= HCLGE_MAX_SYNC_COUNT ) {
10555+ mutex_unlock (& hdev -> vport_lock );
1054210556 return ;
10557+ }
1054310558
1054410559 vlan_id = find_first_bit (vport -> vlan_del_fail_bmap ,
1054510560 VLAN_N_VID );
1054610561 }
1054710562 }
10563+ mutex_unlock (& hdev -> vport_lock );
1054810564
1054910565 hclge_sync_vlan_fltr_state (hdev );
1055010566}
@@ -11651,6 +11667,7 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
1165111667 goto err_msi_irq_uninit ;
1165211668
1165311669 if (hdev -> hw .mac .media_type == HNAE3_MEDIA_TYPE_COPPER ) {
11670+ clear_bit (HNAE3_DEV_SUPPORT_FEC_B , ae_dev -> caps );
1165411671 if (hnae3_dev_phy_imp_supported (hdev ))
1165511672 ret = hclge_update_tp_port_info (hdev );
1165611673 else
0 commit comments