]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
UBUNTU: SAUCE: {topost} net: hns3: separate roce from nic when resetting
authorHuazhong Tan <tanhuazhong@huawei.com>
Mon, 7 May 2018 06:42:55 +0000 (14:42 +0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 5 Sep 2018 12:18:41 +0000 (14:18 +0200)
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 <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

index db9db688b08e757a2e41bb9b487d327927303fa3..12eb41e065ee1f3c88f16faecd72c2e7008ca572 100644 (file)
@@ -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)