From mboxrd@z Thu Jan 1 00:00:00 1970 From: Salil Mehta Subject: [PATCH V2 net-next 07/10] net: hns3: Fix for netdev not up problem when setting mtu Date: Sat, 29 Sep 2018 15:56:19 +0100 Message-ID: <20180929145622.5448-8-salil.mehta@huawei.com> References: <20180929145622.5448-1-salil.mehta@huawei.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , , , , , , , Yunsheng Lin To: Return-path: In-Reply-To: <20180929145622.5448-1-salil.mehta@huawei.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org From: Yunsheng Lin Currently hns3_nic_change_mtu will try to down the netdev before setting mtu, and it does not up the netdev when the setting fails, which causes netdev not up problem. This patch fixes it by not returning when the setting fails. Fixes: a8e8b7ff3517 ("net: hns3: Add support to change MTU in HNS3 hardware") Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 3fc38228f459..545777ae2bc6 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -1491,13 +1491,11 @@ static int hns3_nic_change_mtu(struct net_device *netdev, int new_mtu) } ret = h->ae_algo->ops->set_mtu(h, new_mtu); - if (ret) { + if (ret) netdev_err(netdev, "failed to change MTU in hardware %d\n", ret); - return ret; - } - - netdev->mtu = 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)) -- 2.11.0