net: hns3: do reinitialization while ETS configuration changed
authorHuazhong Tan <tanhuazhong@huawei.com>
Fri, 18 Jan 2019 08:13:13 +0000 (16:13 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Jan 2019 23:10:22 +0000 (15:10 -0800)
When the ETS information is changed, the network device needs to be
re-initialized, otherwise the information such as the receiving queue
will be incorrect.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h

index 0bda9bd8ecc1d5f270126e51bc0fa8bb5ab38f80..10cc86533885d232feb92262344fd5231956c58d 100644 (file)
@@ -3728,7 +3728,6 @@ static int hns3_client_setup_tc(struct hnae3_handle *handle, u8 tc)
 {
        struct hnae3_knic_private_info *kinfo = &handle->kinfo;
        struct net_device *ndev = kinfo->netdev;
-       bool if_running;
        int ret;
 
        if (tc > HNAE3_MAX_TC)
@@ -3737,24 +3736,13 @@ static int hns3_client_setup_tc(struct hnae3_handle *handle, u8 tc)
        if (!ndev)
                return -ENODEV;
 
-       if_running = netif_running(ndev);
-
-       if (if_running) {
-               (void)hns3_nic_net_stop(ndev);
-               msleep(100);
-       }
-
        ret = (kinfo->dcb_ops && kinfo->dcb_ops->map_update) ?
                kinfo->dcb_ops->map_update(handle) : -EOPNOTSUPP;
        if (ret)
-               goto err_out;
+               return ret;
 
        ret = hns3_nic_set_real_num_queue(ndev);
 
-err_out:
-       if (if_running)
-               (void)hns3_nic_net_open(ndev);
-
        return ret;
 }
 
index f6323b2501dcfe076cff2d304b437ba65662855e..4ec0b9cd15ae7d0d4c4eaac9757be0b69b972409 100644 (file)
@@ -222,6 +222,16 @@ static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets)
        if (ret)
                return ret;
 
+       if (map_changed) {
+               ret = hclge_notify_client(hdev, HNAE3_DOWN_CLIENT);
+               if (ret)
+                       return ret;
+
+               ret = hclge_notify_client(hdev, HNAE3_UNINIT_CLIENT);
+               if (ret)
+                       return ret;
+       }
+
        hclge_tm_schd_info_update(hdev, num_tc);
 
        ret = hclge_ieee_ets_to_tm_info(hdev, ets);
@@ -232,6 +242,13 @@ static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets)
                ret = hclge_client_setup_tc(hdev);
                if (ret)
                        return ret;
+               ret = hclge_notify_client(hdev, HNAE3_INIT_CLIENT);
+               if (ret)
+                       return ret;
+
+               ret = hclge_notify_client(hdev, HNAE3_UP_CLIENT);
+               if (ret)
+                       return ret;
        }
 
        return hclge_tm_dwrr_cfg(hdev);
index 450094cc4b28db39aec5a046f7f7138f5de1f7cf..97683a75c95d1822374cb4482ac51c017caa8375 100644 (file)
@@ -2401,8 +2401,8 @@ static void hclge_misc_irq_uninit(struct hclge_dev *hdev)
        hclge_free_vector(hdev, 0);
 }
 
-static int hclge_notify_client(struct hclge_dev *hdev,
-                              enum hnae3_reset_notify_type type)
+int hclge_notify_client(struct hclge_dev *hdev,
+                       enum hnae3_reset_notify_type type)
 {
        struct hnae3_client *client = hdev->nic_client;
        u16 i;
index 6615b85a1c5272f8937cebf2939d99da55e07654..279ed2d83cb83a8db77c35c72d7b6cd0be3f4f34 100644 (file)
@@ -878,4 +878,6 @@ void hclge_vport_stop(struct hclge_vport *vport);
 int hclge_set_vport_mtu(struct hclge_vport *vport, int new_mtu);
 int hclge_dbg_run_cmd(struct hnae3_handle *handle, char *cmd_buf);
 u16 hclge_covert_handle_qid_global(struct hnae3_handle *handle, u16 queue_id);
+int hclge_notify_client(struct hclge_dev *hdev,
+                       enum hnae3_reset_notify_type type);
 #endif