diff options
author | Huazhong Tan <tanhuazhong@huawei.com> | 2019-05-28 17:02:54 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-05-28 17:39:01 -0700 |
commit | bd9109c9b1f3c34529fe43a4ede46e72d237361b (patch) | |
tree | b27fb7f595db149d42b4841f9be0205e55022254 /drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | |
parent | 33a90e2f20e6c455889a0f41857692221172a5ae (diff) | |
download | linux-bd9109c9b1f3c34529fe43a4ede46e72d237361b.tar.bz2 |
net: hns3: use HCLGE_STATE_NIC_REGISTERED to indicate PF NIC client has registered
When PF NIC client's init_instance() succeeds, it means this client
has been registered successfully, so we use HCLGE_STATE_NIC_REGISTERED
to indicate that. And before calling PF NIC client's uninit_instance(),
we clear this state.
So any operation of PF NIC client from HCLGE is not allowed if this
state is not set.
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c')
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index fb0dc185fb4a..87c5cb0f4c8c 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -2873,6 +2873,10 @@ int hclge_notify_client(struct hclge_dev *hdev, struct hnae3_client *client = hdev->nic_client; u16 i; + if (!test_bit(HCLGE_STATE_NIC_REGISTERED, &hdev->state) || + !client) + return 0; + if (!client->ops->reset_notify) return -EOPNOTSUPP; @@ -8184,6 +8188,7 @@ static int hclge_init_client_instance(struct hnae3_client *client, goto clear_nic; hnae3_set_client_init_flag(client, ae_dev, 1); + set_bit(HCLGE_STATE_NIC_REGISTERED, &hdev->state); if (netif_msg_drv(&hdev->vport->nic)) hclge_info_show(hdev); @@ -8270,6 +8275,7 @@ static void hclge_uninit_client_instance(struct hnae3_client *client, if (client->type == HNAE3_CLIENT_ROCE) return; if (hdev->nic_client && client->ops->uninit_instance) { + clear_bit(HCLGE_STATE_NIC_REGISTERED, &hdev->state); client->ops->uninit_instance(&vport->nic, 0); hdev->nic_client = NULL; vport->nic.client = NULL; |