From: GuoJia Liao liaoguojia@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
-------------------------------------
When promiscuous was set for PF, VLAN filter is disabled. PF can capture all traffic it received, including those unmatched VLAN packets and unmatched MAC packets. Currently, if triggered a reset for PF, VLAN filter is enabled when VLAN filter reinitializing, and dose not change except trigger a promisc change. Unmatched VLAN packets is filtered by VLAN filter. It means that promiscuous mode is inconsistent after reset!
Fix this up by adding a HCLGE_STATE_PROMISC_CHANGED flag in hclge_reset_ae_dev(), which means that promiscuous mode needs to update in periodicity task, and refining the VLAN state in hclge_sync_promisc_mode().
Signed-off-by: GuoJia Liao liaoguojia@huawei.com Reviewed-by: Jian Shen shenjian15@huawei.com Reviewed-by: Peng Li lipeng321@huawei.com Reviewed-by: Weiwei Deng dengweiwei@huawei.com Reviewed-by: Zhaohui Zhong zhongzhaohui@huawei.com Reviewed-by: Junxin Chen chenjunxin1@huawei.com Signed-off-by: Shengzui You youshengzui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 7e2eb7dccc20..823f161766aa 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -10680,6 +10680,8 @@ static int hclge_reset_ae_dev(struct hnae3_ae_dev *ae_dev) return ret; }
+ set_bit(HCLGE_STATE_PROMISC_CHANGED, &hdev->state); + /* Log and clear the hw errors those already occurred */ hclge_handle_all_hns_hw_errors(ae_dev);
@@ -11360,7 +11362,7 @@ static void hclge_sync_promisc_mode(struct hclge_dev *hdev) struct hclge_vport *vport = &hdev->vport[0]; struct hnae3_handle *handle = &vport->nic; u8 tmp_flags = 0; - u32 filter_en; + bool vlan_en; int ret;
if (vport->last_promisc_flags != vport->overflow_promisc_flags) { @@ -11374,9 +11376,11 @@ static void hclge_sync_promisc_mode(struct hclge_dev *hdev) tmp_flags & HNAE3_MPE); if (!ret) { clear_bit(HCLGE_STATE_PROMISC_CHANGED, &hdev->state); - filter_en = hclge_vf_vlan_need_enable(vport) ? - HNAE3_VLAN_FLTR : 0; - hclge_enable_vlan_filter(handle, tmp_flags & filter_en); + vlan_en = (tmp_flags & HNAE3_USER_UPE) ? + false : hclge_vf_vlan_need_enable(vport); + + vport->vf_vlan_en = vlan_en; + hclge_enable_vlan_filter(handle, vlan_en); } } }