Skip to content

Commit f5db7a3

Browse files
liuyonglong86Paolo Abeni
authored andcommitted
net: hns3: fix port vlan filter not disabled issue
According to hardware limitation, for device support modify VLAN filter state but not support bypass port VLAN filter, it should always disable the port VLAN filter. but the driver enables port VLAN filter when initializing, if there is no VLAN(except VLAN 0) id added, the driver will disable it in service task. In most time, it works fine. But there is a time window before the service task shceduled and net device being registered. So if user adds VLAN at this time, the driver will not update the VLAN filter state, and the port VLAN filter remains enabled. To fix the problem, if support modify VLAN filter state but not support bypass port VLAN filter, set the port vlan filter to "off". Fixes: 184cd22 ("net: hns3: disable port VLAN filter when support function level VLAN filter control") Fixes: 2ba3066 ("net: hns3: add support for modify VLAN filter state") Signed-off-by: Yonglong Liu <liuyonglong@huawei.com> Signed-off-by: Jijie Shao <shaojijie@huawei.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 094c281 commit f5db7a3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9910,6 +9910,7 @@ static int hclge_set_vlan_protocol_type(struct hclge_dev *hdev)
99109910
static int hclge_init_vlan_filter(struct hclge_dev *hdev)
99119911
{
99129912
struct hclge_vport *vport;
9913+
bool enable = true;
99139914
int ret;
99149915
int i;
99159916

@@ -9929,8 +9930,12 @@ static int hclge_init_vlan_filter(struct hclge_dev *hdev)
99299930
vport->cur_vlan_fltr_en = true;
99309931
}
99319932

9933+
if (test_bit(HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B, hdev->ae_dev->caps) &&
9934+
!test_bit(HNAE3_DEV_SUPPORT_PORT_VLAN_BYPASS_B, hdev->ae_dev->caps))
9935+
enable = false;
9936+
99329937
return hclge_set_vlan_filter_ctrl(hdev, HCLGE_FILTER_TYPE_PORT,
9933-
HCLGE_FILTER_FE_INGRESS, true, 0);
9938+
HCLGE_FILTER_FE_INGRESS, enable, 0);
99349939
}
99359940

99369941
static int hclge_init_vlan_type(struct hclge_dev *hdev)

0 commit comments

Comments
 (0)