]> git.dujemihanovic.xyz Git - linux.git/commit
net: hns3: fix add VLAN fail issue
authorJian Shen <shenjian15@huawei.com>
Fri, 10 Nov 2023 09:37:07 +0000 (17:37 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 13 Nov 2023 09:06:58 +0000 (09:06 +0000)
commit472a2ff63efb30234cbf6b2cdaf8117f21b4f8bc
tree93a43edace0bb24aec6899ab6a1635a91717fda5
parent2bd5b559a1f391f05927bbb0b31381fa71c61e26
net: hns3: fix add VLAN fail issue

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: fe4144d47eef ("net: hns3: sync VLAN filter entries when kill VLAN ID failed")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c