diff options
author | Huazhong Tan <tanhuazhong@huawei.com> | 2019-05-28 17:02:55 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-05-28 17:39:01 -0700 |
commit | 2a0bfc36183cb4eb5f1212faafbc93876a9a2088 (patch) | |
tree | 04ca49c3ae05ce4b77e79ed8247ea8fc3a2b8814 /drivers | |
parent | bd9109c9b1f3c34529fe43a4ede46e72d237361b (diff) |
net: hns3: use HCLGE_STATE_ROCE_REGISTERED to indicate PF ROCE client has registered
When PF ROCE client's init_instance() succeeds, it means this client
has been registered successfully, so we use HCLGE_STATE_ROCE_REGISTERED
to indicate that. And before calling PF ROCE client's uninit_instance(),
we clear this state.
So any operation of the ROCE 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')
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 87c5cb0f4c8c..02a06988cf5f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -2902,7 +2902,8 @@ static int hclge_notify_roce_client(struct hclge_dev *hdev, int ret = 0; u16 i; - if (!client) + if (!test_bit(HCLGE_STATE_ROCE_REGISTERED, &hdev->state) || + !client) return 0; if (!client->ops->reset_notify) @@ -8205,6 +8206,8 @@ static int hclge_init_client_instance(struct hnae3_client *client, if (ret) goto clear_roce; + set_bit(HCLGE_STATE_ROCE_REGISTERED, + &hdev->state); hnae3_set_client_init_flag(hdev->roce_client, ae_dev, 1); } @@ -8236,6 +8239,8 @@ static int hclge_init_client_instance(struct hnae3_client *client, if (ret) goto clear_roce; + set_bit(HCLGE_STATE_ROCE_REGISTERED, + &hdev->state); hnae3_set_client_init_flag(client, ae_dev, 1); } @@ -8267,6 +8272,7 @@ static void hclge_uninit_client_instance(struct hnae3_client *client, for (i = 0; i < hdev->num_vmdq_vport + 1; i++) { vport = &hdev->vport[i]; if (hdev->roce_client) { + clear_bit(HCLGE_STATE_ROCE_REGISTERED, &hdev->state); hdev->roce_client->ops->uninit_instance(&vport->roce, 0); hdev->roce_client = NULL; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h index 43901ffeaf4e..2b3bc95ccbdf 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h @@ -202,6 +202,7 @@ enum HCLGE_DEV_STATE { HCLGE_STATE_DISABLED, HCLGE_STATE_REMOVING, HCLGE_STATE_NIC_REGISTERED, + HCLGE_STATE_ROCE_REGISTERED, HCLGE_STATE_SERVICE_INITED, HCLGE_STATE_SERVICE_SCHED, HCLGE_STATE_RST_SERVICE_SCHED, |