From: David Miller <davem@davemloft.net>
To: Jisheng.Zhang@synaptics.com
Cc: thomas.petazzoni@bootlin.com, kuba@kernel.org,
linux@armlinux.org.uk, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-nex 2/2] net: mvneta: Don't speed down the PHY when changing mtu
Date: Tue, 28 Jul 2020 17:52:02 -0700 (PDT) [thread overview]
Message-ID: <20200728.175202.598794850221205861.davem@davemloft.net> (raw)
In-Reply-To: <20200727195314.704dfaed@xhacker.debian>
From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Date: Mon, 27 Jul 2020 19:53:14 +0800
> @@ -3651,7 +3651,8 @@ static void mvneta_stop_dev(struct mvneta_port *pp)
>
> set_bit(__MVNETA_DOWN, &pp->state);
>
> - if (device_may_wakeup(&pp->dev->dev))
> + if (device_may_wakeup(&pp->dev->dev) &&
> + pp->pkt_size == MVNETA_RX_PKT_SIZE(pp->dev->mtu))
> phylink_speed_down(pp->phylink, false);
>
This is too much for me.
You shouldn't have to shut down the entire device and take it back up
again just to change the MTU.
Unfortunately, this is a common pattern in many drivers and it is very
dangerous to take this lazy path of just doing "stop/start" around
the MTU change.
It means you can't recover from partial failures properly,
f.e. recovering from an inability to allocate queue resources for the
new MTU.
To solve this properly, you must restructure the MTU change such that
is specifically stops the necessary and only the units of the chip
necessary to change the MTU.
It should next try to allocate the necessary resources to satisfy the
MTU change, keeping the existing resources allocated in case of
failure.
Then, only is all resources are successfully allocated, it should
commit the MTU change fully and without errors.
Then none of these link flapping issues are even possible.
next prev parent reply other threads:[~2020-07-29 0:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-27 11:50 [PATCH net-nex 0/2] net: mvneta: improve phylink_speed_up/down usage Jisheng Zhang
2020-07-27 11:51 ` [PATCH net-nex 1/2] net: mvneta: fix comment about phylink_speed_down Jisheng Zhang
2020-07-27 11:53 ` [PATCH net-nex 2/2] net: mvneta: Don't speed down the PHY when changing mtu Jisheng Zhang
2020-07-29 0:52 ` David Miller [this message]
2020-07-29 9:53 ` Jisheng Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200728.175202.598794850221205861.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=Jisheng.Zhang@synaptics.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®