From: Vivien Didelot <vivien.didelot@savoirfairelinux•com>
To: Andrew Lunn <andrew@lunn•ch>, David Miller <davem@davemloft•net>
Cc: netdev <netdev@vger•kernel.org>, Andrew Lunn <andrew@lunn•ch>
Subject: Re: [PATCH net-next] dsa: mv88e6xxx: Timeout based on iterations
Date: Wed, 17 Aug 2016 19:08:39 -0400 [thread overview]
Message-ID: <87oa4rat8o.fsf@ketchup.mtl.sfl> (raw)
In-Reply-To: <1471469225-368-1-git-send-email-andrew@lunn.ch>
Hi Andrew,
Andrew Lunn <andrew@lunn•ch> writes:
> The mv88e6xxx driver times out operations on the switch based on
> looping until an elapsed wall clock time is reached. However, if
> usleep_range() sleeps much longer than expected, it could timeout with
> an error without actually checking to see if the devices has completed
> the operation. So replace the elapsed time with a fixed upper bound on
> the number of loops.
>
> Testing on various switches has shown that switches takes either 0 or
> 1 iteration, so a maximum of 16 iterations is a safe limit.
>
> Signed-off-by: Andrew Lunn <andrew@lunn•ch>
> ---
> drivers/net/dsa/mv88e6xxx/chip.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
> index a230fcba5b64..ac8e9af4879f 100644
> --- a/drivers/net/dsa/mv88e6xxx/chip.c
> +++ b/drivers/net/dsa/mv88e6xxx/chip.c
> @@ -309,9 +309,9 @@ static int mv88e6xxx_serdes_write(struct mv88e6xxx_chip *chip, int reg, u16 val)
> static int mv88e6xxx_wait(struct mv88e6xxx_chip *chip, int addr, int reg,
> u16 mask)
> {
> - unsigned long timeout = jiffies + HZ / 10;
> + int i;
>
> - while (time_before(jiffies, timeout)) {
> + for (i = 0; i < 16; i++) {
> u16 val;
> int err;
>
Since we remove the elapsed time here, can we use mv88e6xxx_wait in
mv88e6xxx_update? It'd be good to have a consistent wait routine
everywhere.
Thanks,
Vivien
next prev parent reply other threads:[~2016-08-17 23:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-17 21:27 [PATCH net-next] dsa: mv88e6xxx: Timeout based on iterations Andrew Lunn
2016-08-17 23:08 ` Vivien Didelot [this message]
2016-08-18 18:39 ` Andrew Lunn
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=87oa4rat8o.fsf@ketchup.mtl.sfl \
--to=vivien.didelot@savoirfairelinux$(echo .)com \
--cc=andrew@lunn$(echo .)ch \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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