From patchwork Sun Nov 18 03:19:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 151430 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1141133ljp; Sat, 17 Nov 2018 19:21:01 -0800 (PST) X-Google-Smtp-Source: AJdET5eZqzSu5QIQIFk1QISzodBnAYWUu9D+qfxWIcVktQlZfWxGCzCvbx5w7tRvQRgSeg5QuzI6 X-Received: by 2002:a17:902:64c1:: with SMTP id y1mr7739338pli.64.1542511260979; Sat, 17 Nov 2018 19:21:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542511260; cv=none; d=google.com; s=arc-20160816; b=q+N8irmMugUVc2oBkkqWTC9pszfN6TGVWxtQ1OIbaGnbmyukTFFIrZ/doBLXHgJYQa A+2rmAS/634k+8nQKtNDSCQOAMvZp8mSgGUvcs8Pzm5xScwSvTmmzaYYxmg8ohzexKt0 Xvh3goO/I9eky3r8ILINY+8v31Mz2KMTqwjZvvLkZicYAknM3wQdOYw1dsy4PhP+8VKO dF6wTq1QPlAoWqc2hL4WYpcyFoT7/tP9y4B7mZB9E1ji4j5LwgWANX7URrFl5mlQA5PJ Fxyrj/fhgnlFwYbVSPMPrSALeQrJXhOIS9cbdLiaTICrR0RLQqb9ckghb8qAevvUHgJt ZV9w== 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 h10si8791460pgi.562.2018.11.17.19.21.00; Sat, 17 Nov 2018 19:21:00 -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 S1727141AbeKRNjt (ORCPT + 32 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 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(-) -- 2.17.1 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; }