• Jian Shen's avatar
    net: hns3: fix add VLAN fail issue · 472a2ff6
    Jian Shen authored
    The hclge_sync_vlan_filter is called in periodic task,
    trying to remove VLAN from vlan_del_fail_bmap. It can
    be concurrence with VLAN adding operation from user.
    So once user failed to delete a VLAN id, and add it
    again soon, it may be removed by the periodic task,
    which may cause the software configuration being
    inconsistent with hardware. So add mutex handling
    to avoid this.
    
         user                        hns3 driver
    
                                               periodic task
                                                    │
      add vlan 10 ───── hns3_vlan_rx_add_vid        │
           │             (suppose success)          │
           │                                        │
      del vlan 10 ─────  hns3_vlan_rx_kill_vid      │
           │           (suppose fail,add to         │
           │             vlan_del_fail_bmap)        │
           │                                        │
      add vlan 10 ───── hns3_vlan_rx_add_vid        │
                         (suppose success)          │
                                           foreach vlan_del_fail_bmp
                                                del vlan 10
    
    Fixes: fe4144d4 ("net: hns3: sync VLAN filter entries when kill VLAN ID failed")
    Signed-off-by: default avatarJian Shen <shenjian15@huawei.com>
    Signed-off-by: default avatarJijie Shao <shaojijie@huawei.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    472a2ff6
hclge_main.c 344 KB