Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1208483imu; Sat, 17 Nov 2018 19:24:16 -0800 (PST) X-Google-Smtp-Source: AJdET5eNoAtDWc5pXZmhRRaL0glGtk+oRlMcR1IA3g32wNU61vuLp92kqoLF/QpiNRtedK/PtOo1 X-Received: by 2002:a17:902:bc83:: with SMTP id bb3-v6mr16838137plb.223.1542511456827; Sat, 17 Nov 2018 19:24:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542511456; cv=none; d=google.com; s=arc-20160816; b=h1NkLWdmDd5jgYREZgrlbSELMCmO6Mx2hm6uVSwZIMfGQxZ0yP7crVE4VLwixLqakJ FlcnXFYxbqpB3jw/Q0JwzuuBfcs0G1NNbhAmRGUCb78cyEvxlZz0kC5wcmjs0TmvLdYq /9IYmLxSlfpm5+Vn+0oFtMmXCe4WeXFaZvZDb3o1vIybbcIepdlSQ6zZh4iQSptmfuF3 +8m9U6y3fJ5HZm6Ag5pPeRHBXke7nnh7+PliU/m+LfcgVwM4rb0MWrRzOMGdsUOdLxTb WgkEZlYrpn2T6urCDLRCaOmC91gpb9OVdWQuZ+pPsU/ol6fb/63DpJEZWfYXfjSNEpy3 KraA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=aJXXKo9F5ZA9rLoSeQQ5M4xeCfzZGosEoJ3M7rNW4Pw=; b=K/QD0kbTkJhOK2u52MDizk9s8vx8T1XN38W84+nyIvMZ8cpPj4Rc99D1ZUfwam77EV t24WDKhicYCtAsGnzmZc8McupdQUo9qvKbCxfrRbc+TTduARXO8qbBcujmj6iicteiYq LYKZmdVPdrT6axlDhCJzW4sY7RIFAXMmo48MbSC+v6+qNePVVdkLyV3Lo9nZXlZgKjT/ kvcp5XL1KlTcxbRjvWwNRNQhB3b58UNXVS4yrrkMfLGvW+Of3pGNQoclpUHz1ZOx1Azn 3tNloFwEWGagTcOQyhQm5DxfG0qnp9a1h8q8ECEPz8M9Gm1HixJA5O5dPop+SXNS+sQf x91w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g32si34834306pgg.400.2018.11.17.19.24.01; Sat, 17 Nov 2018 19:24:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727131AbeKRNjt (ORCPT + 99 others); Sun, 18 Nov 2018 08:39:49 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:15113 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725831AbeKRNjs (ORCPT ); Sun, 18 Nov 2018 08:39:48 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 95FD9FCA895C9; Sun, 18 Nov 2018 11:20:53 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.47.88.178) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.408.0; Sun, 18 Nov 2018 11:20:47 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin , Jian Shen Subject: [PATCH net-next 5/5] net: hns3: up/down netdev in hclge module when setting mtu Date: Sun, 18 Nov 2018 03:19:14 +0000 Message-ID: <20181118031914.23892-6-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20181118031914.23892-1-salil.mehta@huawei.com> References: <20181118031914.23892-1-salil.mehta@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.47.88.178] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunsheng Lin Currently netdev is down in enet module, and it is before mtu range checking in hclge module, which may be cause netdev being down unnecessarily. Signed-off-by: Yunsheng Lin Signed-off-by: Jian Shen Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 11 ----------- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 +++ 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 5cae14c991ee..7f81db3df041 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -1573,18 +1573,11 @@ static int hns3_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, static int hns3_nic_change_mtu(struct net_device *netdev, int new_mtu) { struct hnae3_handle *h = hns3_get_handle(netdev); - bool if_running = netif_running(netdev); int ret; if (!h->ae_algo->ops->set_mtu) return -EOPNOTSUPP; - /* if this was called with netdev up then bring netdevice down */ - if (if_running) { - (void)hns3_nic_net_stop(netdev); - msleep(100); - } - ret = h->ae_algo->ops->set_mtu(h, new_mtu); if (ret) netdev_err(netdev, "failed to change MTU in hardware %d\n", @@ -1592,10 +1585,6 @@ static int hns3_nic_change_mtu(struct net_device *netdev, int new_mtu) else netdev->mtu = new_mtu; - /* if the netdev was running earlier, bring it up again */ - if (if_running && hns3_nic_net_open(netdev)) - ret = -EINVAL; - return ret; } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 967cb83f32d6..f78b8e188443 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -6450,6 +6450,8 @@ int hclge_set_vport_mtu(struct hclge_vport *vport, int new_mtu) return -EINVAL; } + hclge_notify_client(hdev, HNAE3_DOWN_CLIENT); + ret = hclge_set_mac_mtu(hdev, max_frm_size); if (ret) { dev_err(&hdev->pdev->dev, @@ -6466,6 +6468,7 @@ int hclge_set_vport_mtu(struct hclge_vport *vport, int new_mtu) "Allocate buffer fail, ret =%d\n", ret); out: + hclge_notify_client(hdev, HNAE3_UP_CLIENT); mutex_unlock(&hdev->vport_lock); return ret; } -- 2.17.1