linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ravb: implement MTU change while device is up
@ 2019-05-08 15:21 Ulrich Hecht
  2019-05-08 15:59 ` Sergei Shtylyov
  2019-05-08 16:50 ` Niklas Söderlund
  0 siblings, 2 replies; 11+ messages in thread
From: Ulrich Hecht @ 2019-05-08 15:21 UTC (permalink / raw)
  To: linux-renesas-soc; +Cc: netdev, davem, wsa, horms, magnus.damm, Ulrich Hecht

Uses the same method as various other drivers: shut the device down,
change the MTU, then bring it back up again.

Tested on Renesas D3 Draak board.

Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
---
 drivers/net/ethernet/renesas/ravb_main.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index ef8f089..02c247c 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1810,13 +1810,16 @@ static int ravb_do_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
 
 static int ravb_change_mtu(struct net_device *ndev, int new_mtu)
 {
-	if (netif_running(ndev))
-		return -EBUSY;
+	if (!netif_running(ndev)) {
+		ndev->mtu = new_mtu;
+		netdev_update_features(ndev);
+		return 0;
+	}
 
+	ravb_close(ndev);
 	ndev->mtu = new_mtu;
-	netdev_update_features(ndev);
 
-	return 0;
+	return ravb_open(ndev);
 }
 
 static void ravb_set_rx_csum(struct net_device *ndev, bool enable)
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-05-23  1:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-08 15:21 [PATCH] ravb: implement MTU change while device is up Ulrich Hecht
2019-05-08 15:59 ` Sergei Shtylyov
2019-05-08 16:52   ` Niklas Söderlund
2019-05-09  6:57     ` Ulrich Hecht
2019-05-09 10:10       ` Simon Horman
2019-05-09 15:32         ` Ulrich Hecht
2019-05-13 12:18           ` Simon Horman
2019-05-20 12:09             ` Wolfram Sang
2019-05-22 11:59               ` Simon Horman
2019-05-23  1:02                 ` Ulrich Hecht
2019-05-08 16:50 ` Niklas Söderlund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).