net: hns3: Fix for netdev not up problem when setting mtu

[ Upstream commit 93d8daf460 ]

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: a8e8b7ff35 ("net: hns3: Add support to change MTU in HNS3 hardware")
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Yunsheng Lin
2018-09-26 19:28:37 +01:00
committed by Greg Kroah-Hartman
parent 7a1f314e3c
commit af98283da9

View File

@@ -1447,12 +1447,10 @@ static int hns3_nic_change_mtu(struct net_device *netdev, int new_mtu)
} }
ret = h->ae_algo->ops->set_mtu(h, 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", netdev_err(netdev, "failed to change MTU in hardware %d\n",
ret); ret);
return ret; else
}
netdev->mtu = new_mtu; netdev->mtu = new_mtu;
/* if the netdev was running earlier, bring it up again */ /* if the netdev was running earlier, bring it up again */