netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Huazhong Tan <tanhuazhong@huawei.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<salil.mehta@huawei.com>, <yisen.zhuang@huawei.com>,
	<linuxarm@huawei.com>, <jakub.kicinski@netronome.com>,
	Jian Shen <shenjian15@huawei.com>,
	"Huazhong Tan" <tanhuazhong@huawei.com>
Subject: [PATCH net-next 05/12] net: hns3: fix VF VLAN table entries inconsistent issue
Date: Wed, 16 Oct 2019 15:17:04 +0800	[thread overview]
Message-ID: <1571210231-29154-6-git-send-email-tanhuazhong@huawei.com> (raw)
In-Reply-To: <1571210231-29154-1-git-send-email-tanhuazhong@huawei.com>

From: Jian Shen <shenjian15@huawei.com>

Currently, if VF is loaded on the host side, the host doesn't
clear the VF's VLAN table entries when VF removing. In this
case, when doing reset and disabling sriov at the same time the
VLAN device over VF will be removed, but the VLAN table entries
in hardware are remained.

This patch fixes it by asking PF to clear the VLAN table entries for
VF when VF is removing. It also clear the VLAN table full bit
after VF VLAN table entries being cleared.

Fixes: c6075b193462 ("net: hns3: Record VF vlan tables")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h           | 1 +
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c   | 1 +
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c    | 1 +
 drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 4 ++++
 4 files changed, 7 insertions(+)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h b/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h
index 0059d44..05f3442 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h
@@ -46,6 +46,7 @@ enum HCLGE_MBX_OPCODE {
 	HCLGE_MBX_PUSH_VLAN_INFO,	/* (PF -> VF) push port base vlan */
 	HCLGE_MBX_GET_MEDIA_TYPE,       /* (VF -> PF) get media type */
 	HCLGE_MBX_PUSH_PROMISC_INFO,	/* (PF -> VF) push vf promisc info */
+	HCLGE_MBX_VF_UNINIT,            /* (VF -> PF) vf is unintializing */
 
 	HCLGE_MBX_GET_VF_FLR_STATUS = 200, /* (M7 -> PF) get vf reset status */
 	HCLGE_MBX_PUSH_LINK_STATUS,	/* (M7 -> PF) get port link status */
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 2f0386d..962c4b4 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -8218,6 +8218,7 @@ void hclge_rm_vport_all_vlan_table(struct hclge_vport *vport, bool is_del_list)
 			kfree(vlan);
 		}
 	}
+	clear_bit(vport->vport_id, hdev->vf_vlan_full);
 }
 
 void hclge_uninit_vport_vlan_table(struct hclge_dev *hdev)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
index 97463e11..d48b2f6 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
@@ -797,6 +797,7 @@ void hclge_mbx_handler(struct hclge_dev *hdev)
 			hclge_get_link_mode(vport, req);
 			break;
 		case HCLGE_MBX_GET_VF_FLR_STATUS:
+		case HCLGE_MBX_VF_UNINIT:
 			mutex_lock(&hdev->vport_cfg_mutex);
 			hclge_rm_vport_all_mac_table(vport, true,
 						     HCLGE_MAC_ADDR_UC);
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
index 408e386..f426f63 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
@@ -2796,6 +2796,10 @@ static void hclgevf_uninit_hdev(struct hclgevf_dev *hdev)
 {
 	hclgevf_state_uninit(hdev);
 
+	if (!test_bit(HCLGEVF_STATE_CMD_DISABLE, &hdev->state))
+		hclgevf_send_mbx_msg(hdev, HCLGE_MBX_VF_UNINIT, 0, NULL, 0,
+				     false, NULL, 0);
+
 	if (test_bit(HCLGEVF_STATE_IRQ_INITED, &hdev->state)) {
 		hclgevf_misc_irq_uninit(hdev);
 		hclgevf_uninit_msi(hdev);
-- 
2.7.4


  parent reply	other threads:[~2019-10-16  7:20 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16  7:16 [PATCH net-next 00/12] net: hns3: add some bugfixes and optimizations Huazhong Tan
2019-10-16  7:17 ` [PATCH net-next 01/12] net: hns3: remove struct hns3_nic_ring_data in hns3_enet module Huazhong Tan
2019-10-16  7:17 ` [PATCH net-next 02/12] net: hns3: fix TX queue not restarted problem Huazhong Tan
2019-10-16  7:17 ` [PATCH net-next 03/12] net: hns3: fix a use after freed problem in hns3_nic_maybe_stop_tx() Huazhong Tan
2019-10-16  7:17 ` [PATCH net-next 04/12] net: hns3: fix mis-counting IRQ vector numbers issue Huazhong Tan
2019-10-16  7:17 ` Huazhong Tan [this message]
2019-10-16  7:17 ` [PATCH net-next 06/12] net: hns3: optimized MAC address in management table Huazhong Tan
2019-10-16  7:17 ` [PATCH net-next 07/12] net: hns3: minor optimization for barrier in IO path Huazhong Tan
2019-10-16  7:17 ` [PATCH net-next 08/12] net: hns3: introduce ring_to_netdev() in enet module Huazhong Tan
2019-10-16 17:10   ` Jakub Kicinski
2019-10-17  0:50     ` tanhuazhong
2019-10-16  7:17 ` [PATCH net-next 09/12] net: hns3: minor cleanup for hns3_handle_rx_bd() Huazhong Tan
2019-10-16  7:17 ` [PATCH net-next 10/12] net: hns3: fix VF id issue for setting VF VLAN Huazhong Tan
2019-10-16  7:17 ` [PATCH net-next 11/12] net: hns3: do not allocate linear data for fraglist skb Huazhong Tan
2019-10-16 17:18   ` Jakub Kicinski
2019-10-17  0:54     ` tanhuazhong
2019-10-16  7:17 ` [PATCH net-next 12/12] net: hns3: log and clear hardware error after reset complete Huazhong Tan
2019-10-16 17:19 ` [PATCH net-next 00/12] net: hns3: add some bugfixes and optimizations Jakub Kicinski
2019-10-16 17:50   ` David Miller
2019-10-17  0:56     ` tanhuazhong
2019-10-17  3:27     ` tanhuazhong
2019-10-17 15:47       ` Jakub Kicinski
2019-10-18  0:57         ` tanhuazhong
2019-10-17  0:55   ` tanhuazhong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1571210231-29154-6-git-send-email-tanhuazhong@huawei.com \
    --to=tanhuazhong@huawei.com \
    --cc=davem@davemloft.net \
    --cc=jakub.kicinski@netronome.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=salil.mehta@huawei.com \
    --cc=shenjian15@huawei.com \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).