Mailing List Archive

[PATCH V2 net 6/7] net: hns3: fix port vlan filter not disabled issue
From: Yonglong Liu <liuyonglong@huawei.com>

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: 184cd221a863 ("net: hns3: disable port VLAN filter when support function level VLAN filter control")
Fixes: 2ba306627f59 ("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>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 5dc8593c97be..018069b12de6 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -9910,6 +9910,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;

@@ -9929,8 +9930,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)
--
2.30.0
Re: [PATCH V2 net 6/7] net: hns3: fix port vlan filter not disabled issue [ In reply to ]
On Fri, Apr 26, 2024 at 06:00:44PM +0800, Jijie Shao wrote:
> From: Yonglong Liu <liuyonglong@huawei.com>
>
> 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: 184cd221a863 ("net: hns3: disable port VLAN filter when support function level VLAN filter control")
> Fixes: 2ba306627f59 ("net: hns3: add support for modify VLAN filter state")

For the record, my reading of this is:

184cd221a863 is a fix for 2ba306627f59. Both were included in v5.14.
This patch fixes 184cd221a863 and in turn 2ba306627f59.

> Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
> Signed-off-by: Jijie Shao <shaojijie@huawei.com>

Reviewed-by: Simon Horman <horms@kernel.org>

..