Commit c03bc86e authored by Yonglong Liu's avatar Yonglong Liu Committed by Zihao Xue
Browse files

net: hns3: fix port vlan filter not disabled problem in dynamic vlan mode

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9D6UN


CVE: NA

----------------------------------------------------------------------

The driver set port vlan filter to "on" when initialized, and
then set port vlan filter to "off" in service task if in dynamic
vlan mode. Between this two settings, if user set a vlan to the
port, the port vlan filter is remain in "on" status, which is
not expected.

To fix the problem, if in dynamic vlan mode, set the port vlan
filter to "off".

Fixes: 184cd221 ("net: hns3: disable port VLAN filter when support function level VLAN filter control")
Fixes: 2ba30662 ("net: hns3: add support for modify VLAN filter state")
Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
Signed-off-by: default avatarHao Chen <chenhao418@huawei.com>
Signed-off-by: default avatarZihao Xue <xuezihao@huawei.com>
parent 68151df4
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -10547,6 +10547,7 @@ static int hclge_set_vlan_protocol_type(struct hclge_dev *hdev)
static int hclge_init_vlan_filter(struct hclge_dev *hdev)
{
	struct hclge_vport *vport;
	bool enable = true;
	int ret;
	int i;

@@ -10566,8 +10567,12 @@ static int hclge_init_vlan_filter(struct hclge_dev *hdev)
		vport->cur_vlan_fltr_en = true;
	}

	if (test_bit(HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B, hdev->ae_dev->caps) &&
	    !test_bit(HNAE3_DEV_SUPPORT_PORT_VLAN_BYPASS_B, hdev->ae_dev->caps))
		enable = false;

	return hclge_set_vlan_filter_ctrl(hdev, HCLGE_FILTER_TYPE_PORT,
					  HCLGE_FILTER_FE_INGRESS, true, 0);
					  HCLGE_FILTER_FE_INGRESS, enable, 0);
}

static int hclge_init_vlan_type(struct hclge_dev *hdev)