From 82dac4edda0acc4e31e294a9b0fb156d32b94a8a Mon Sep 17 00:00:00 2001 From: Huazhong Tan Date: Mon, 7 May 2018 14:42:55 +0800 Subject: [PATCH] UBUNTU: SAUCE: {topost} net: hns3: separate roce from nic when resetting BugLink: https://bugs.launchpad.net/bugs/1787477 While doing resetting, roce should do its uninitailization part before nic's, and do its initialization part after nic's. Signed-off-by: Huazhong Tan Signed-off-by: Peng Li Signed-off-by: dann frazier Acked-by: Stefan Bader Acked-by: Kleber Sacilotto de Souza Signed-off-by: Kleber Sacilotto de Souza --- .../hisilicon/hns3/hns3pf/hclge_main.c | 43 ++++++++++++++----- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index db9db688b08e..12eb41e065ee 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -2631,7 +2631,6 @@ static void hclge_misc_irq_uninit(struct hclge_dev *hdev) static int hclge_notify_client(struct hclge_dev *hdev, enum hnae3_reset_notify_type type) { - struct hnae3_client *rclient = hdev->roce_client; struct hnae3_client *client = hdev->nic_client; struct hnae3_handle *handle; int ret; @@ -2648,19 +2647,36 @@ static int hclge_notify_client(struct hclge_dev *hdev, "notify nic client failed %d", ret); return ret; } + } - if (rclient && rclient->ops->reset_notify) { - handle = &hdev->vport[i].roce; - ret = rclient->ops->reset_notify(handle, type); - if (ret) { - dev_err(&hdev->pdev->dev, - "notify roce client failed %d", ret); - return ret; - } + return 0; +} + +static int hclge_notify_roce_client(struct hclge_dev *hdev, + enum hnae3_reset_notify_type type) +{ + struct hnae3_client *client = hdev->roce_client; + struct hnae3_handle *handle; + int ret = 0; + u16 i; + + if (!client) + return 0; + + if (!client->ops->reset_notify) + return -EOPNOTSUPP; + + for (i = 0; i < hdev->num_vmdq_vport + 1; i++) { + handle = &hdev->vport[i].roce; + ret = client->ops->reset_notify(handle, type); + if (ret) { + dev_err(&hdev->pdev->dev, + "notify roce client failed %d", ret); + return ret; } } - return 0; + return ret; } static int hclge_reset_wait(struct hclge_dev *hdev) @@ -2811,6 +2827,10 @@ static void hclge_reset(struct hclge_dev *hdev) /* perform reset of the stack & ae device for a client */ handle = &hdev->vport[0].nic; + + hclge_notify_roce_client(hdev, HNAE3_DOWN_CLIENT); + hclge_notify_roce_client(hdev, HNAE3_UNINIT_CLIENT); + rtnl_lock(); hclge_notify_client(hdev, HNAE3_DOWN_CLIENT); @@ -2829,6 +2849,9 @@ static void hclge_reset(struct hclge_dev *hdev) hclge_notify_client(hdev, HNAE3_UP_CLIENT); handle->last_reset_time = jiffies; rtnl_unlock(); + + hclge_notify_roce_client(hdev, HNAE3_INIT_CLIENT); + hclge_notify_roce_client(hdev, HNAE3_UP_CLIENT); } static void hclge_reset_event(struct hnae3_handle *handle) -- 2.39.5