From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
Cc: netdev@vger.kernel.org, andrew@lunn.ch, hkallweit1@gmail.com,
woojung.huh@microchip.com, UNGLinuxDriver@microchip.com,
horms@kernel.org, Tristram.Ha@microchip.com,
Arun.Ramadoss@microchip.com
Subject: Re: [PATCH net v7 3/3] net: dsa: microchip: monitor potential faults in half-duplex mode
Date: Tue, 25 Jun 2024 11:27:07 +0100 [thread overview]
Message-ID: <Znqbe6HDrajK0UVq@shell.armlinux.org.uk> (raw)
In-Reply-To: <20240621144322.545908-4-enguerrand.de-ribaucourt@savoirfairelinux.com>
On Fri, Jun 21, 2024 at 04:43:22PM +0200, Enguerrand de Ribaucourt wrote:
> The errata DS80000754 recommends monitoring potential faults in
> half-duplex mode for the KSZ9477 family.
>
> half-duplex is not very common so I just added a critical message
> when the fault conditions are detected. The switch can be expected
> to be unable to communicate anymore in these states and a software
> reset of the switch would be required which I did not implement.
>
> Fixes: b987e98e50ab ("dsa: add DSA switch driver for Microchip KSZ9477")
> Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
> ---
> v7:
> - use dev_crit_once instead of dev_crit_ratelimited
> The condition will remain true forever and the routine called every
> 5 seconds. There's no need to repeat the message.
> - add explanations in the comment above the warning to help users
> anticipate the consequences of the fault.
> v6: https://lore.kernel.org/netdev/20240614094642.122464-4-enguerrand.de-ribaucourt@savoirfairelinux.com/
> - use macros for PORT_INTF_SPEED_MASK check
> - add VLAN condition before checking the resources
> v5: https://lore.kernel.org/all/20240604092304.314636-5-enguerrand.de-ribaucourt@savoirfairelinux.com/
> - use macros for bitmasks
> - check for return values on ksz_pread*
> v4: https://lore.kernel.org/all/20240531142430.678198-6-enguerrand.de-ribaucourt@savoirfairelinux.com/
> - rebase on net/main
> - add Fixes tag
> - reverse x-mas tree
> v3: https://lore.kernel.org/all/20240530102436.226189-6-enguerrand.de-ribaucourt@savoirfairelinux.com/
> ---
> drivers/net/dsa/microchip/ksz9477.c | 51 +++++++++++++++++++++++++
> drivers/net/dsa/microchip/ksz9477.h | 2 +
> drivers/net/dsa/microchip/ksz9477_reg.h | 10 ++++-
> drivers/net/dsa/microchip/ksz_common.c | 11 ++++++
> drivers/net/dsa/microchip/ksz_common.h | 1 +
> 5 files changed, 73 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
> index c2878dd0ad7e..6924b3818357 100644
> --- a/drivers/net/dsa/microchip/ksz9477.c
> +++ b/drivers/net/dsa/microchip/ksz9477.c
> @@ -429,6 +429,57 @@ void ksz9477_freeze_mib(struct ksz_device *dev, int port, bool freeze)
> mutex_unlock(&p->mib.cnt_mutex);
> }
>
> +int ksz9477_errata_monitor(struct ksz_device *dev, int port,
> + u64 tx_late_col)
> +{
> + u32 pmavbc;
> + u8 status;
> + u16 pqm;
> + int ret;
> +
> + ret = ksz_pread8(dev, port, REG_PORT_STATUS_0, &status);
> + if (ret)
> + return ret;
> + if (!(FIELD_GET(PORT_INTF_SPEED_MASK, status) == PORT_INTF_SPEED_NONE) &&
> + !(status & PORT_INTF_FULL_DUPLEX)) {
> + /* Errata DS80000754 recommends monitoring potential faults in
> + * half-duplex mode. The switch might not be able to communicate anymore
> + * in these states.
> + * If you see this message, please read the errata-sheet for more information:
While I realise that the URL is long, netdev still prefers lines to be
no longer than 80 characters, so please wrap the comment accordingly.
The URL is probably fine (since there isn't any option), and then
dev_warn_once() string shouldn't be broken over separate lones either.
However, also consider whether moving this code block into a function
would tidy things up - the compiler can automatically inline static
functions (and does in many cases, especially when they only have one
callsite.)
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2024-06-25 10:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-21 14:43 [PATCH net v7 0/3] Handle new Microchip KSZ 9897 Errata Enguerrand de Ribaucourt
2024-06-21 14:43 ` [PATCH net v7 1/3] net: phy: micrel: add Microchip KSZ 9477 to the device table Enguerrand de Ribaucourt
2024-06-21 14:43 ` [PATCH net v7 2/3] net: dsa: microchip: use collision based back pressure mode Enguerrand de Ribaucourt
2024-06-21 14:43 ` [PATCH net v7 3/3] net: dsa: microchip: monitor potential faults in half-duplex mode Enguerrand de Ribaucourt
2024-06-22 18:33 ` Andrew Lunn
2024-06-25 10:27 ` Russell King (Oracle) [this message]
2024-06-23 9:10 ` [PATCH net v7 0/3] Handle new Microchip KSZ 9897 Errata patchwork-bot+netdevbpf
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=Znqbe6HDrajK0UVq@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=Arun.Ramadoss@microchip.com \
--cc=Tristram.Ha@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=enguerrand.de-ribaucourt@savoirfairelinux.com \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=woojung.huh@microchip.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;
as well as URLs for NNTP newsgroup(s).