diff mbox series

net: dp83822: disable false carrier interrupt

Message ID 20220617134611.695690-1-enguerrand.de-ribaucourt@savoirfairelinux.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: dp83822: disable false carrier interrupt | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 3 maintainers not CCed: pabeni@redhat.com kuba@kernel.org edumazet@google.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Enguerrand de Ribaucourt June 17, 2022, 1:46 p.m. UTC
When unplugging an Ethernet cable, false carrier events were produced by
the PHY at a very high rate. Once the false carrier counter full, an
interrupt was triggered every few clock cycles until the cable was
replugged. This resulted in approximately 10k/s interrupts.

Since the false carrier counter (FCSCR) is never used, we can safely
disable this interrupt.

In addition to improving performance, this also solved MDIO read
timeouts I was randomly encountering with an i.MX8 fec MAC because of
the interrupt flood. The interrupt count and MDIO timeout fix were
tested on a v5.4.110 kernel.

Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
---
 drivers/net/phy/dp83822.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Andrew Lunn June 17, 2022, 5:55 p.m. UTC | #1
On Fri, Jun 17, 2022 at 03:46:11PM +0200, Enguerrand de Ribaucourt wrote:
> When unplugging an Ethernet cable, false carrier events were produced by
> the PHY at a very high rate. Once the false carrier counter full, an
> interrupt was triggered every few clock cycles until the cable was
> replugged. This resulted in approximately 10k/s interrupts.
> 
> Since the false carrier counter (FCSCR) is never used, we can safely
> disable this interrupt.
> 
> In addition to improving performance, this also solved MDIO read
> timeouts I was randomly encountering with an i.MX8 fec MAC because of
> the interrupt flood. The interrupt count and MDIO timeout fix were
> tested on a v5.4.110 kernel.
> 
> Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
> ---
>  drivers/net/phy/dp83822.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c
> index e6ad3a494d32..95ef507053a6 100644
> --- a/drivers/net/phy/dp83822.c
> +++ b/drivers/net/phy/dp83822.c
> @@ -230,7 +230,6 @@ static int dp83822_config_intr(struct phy_device *phydev)
>  			return misr_status;
>  
>  		misr_status |= (DP83822_RX_ERR_HF_INT_EN |
> -				DP83822_FALSE_CARRIER_HF_INT_EN |

Does the same problem exist for RX_ERR_HF_INT ? That appears to be
that the RX error counter has reached half full. I don't see anything
using register 0x15.

      Andrew
Enguerrand de Ribaucourt June 23, 2022, 8:51 a.m. UTC | #2
----- Original Message -----
> From: "Andrew Lunn" <andrew@lunn.ch>
> To: "Enguerrand de Ribaucourt" <enguerrand.de-ribaucourt@savoirfairelinux.com>
> Cc: davem@davemloft.net, "netdev" <netdev@vger.kernel.org>, linux-kernel@vger.kernel.org, "linux"
> <linux@armlinux.org.uk>, "hkallweit1" <hkallweit1@gmail.com>
> Sent: Friday, June 17, 2022 7:55:54 PM
> Subject: Re: [PATCH] net: dp83822: disable false carrier interrupt

> On Fri, Jun 17, 2022 at 03:46:11PM +0200, Enguerrand de Ribaucourt wrote:
> > When unplugging an Ethernet cable, false carrier events were produced by
> > the PHY at a very high rate. Once the false carrier counter full, an
> > interrupt was triggered every few clock cycles until the cable was
> > replugged. This resulted in approximately 10k/s interrupts.

> > Since the false carrier counter (FCSCR) is never used, we can safely
> > disable this interrupt.

> > In addition to improving performance, this also solved MDIO read
> > timeouts I was randomly encountering with an i.MX8 fec MAC because of
> > the interrupt flood. The interrupt count and MDIO timeout fix were
> > tested on a v5.4.110 kernel.

>> Signed-off-by: Enguerrand de Ribaucourt
> > <enguerrand.de-ribaucourt@savoirfairelinux.com>
> > ---
> > drivers/net/phy/dp83822.c | 1 -
> > 1 file changed, 1 deletion(-)

> > diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c
> > index e6ad3a494d32..95ef507053a6 100644
> > --- a/drivers/net/phy/dp83822.c
> > +++ b/drivers/net/phy/dp83822.c
> > @@ -230,7 +230,6 @@ static int dp83822_config_intr(struct phy_device *phydev)
> > return misr_status;

> > misr_status |= (DP83822_RX_ERR_HF_INT_EN |
> > - DP83822_FALSE_CARRIER_HF_INT_EN |

> Does the same problem exist for RX_ERR_HF_INT ? That appears to be
> that the RX error counter has reached half full. I don't see anything
> using register 0x15.

> Andrew

I can produce RX errors using improper ethtool speed settings, which can be seen
in the statistics, but they do not increment register 0x15. However, RX errors due 
to cable disconnection do increase it. After the counter is half full (0x7fff, 
the datasheet is wrong), interrupts that we don't need were indeed generated.

I measured a ~3k/s interrupt flood which also kept going even if I stopped the 
RX errors transfer so we should definitively disable RX_ERR_HF_INT as well.

I'll send a separate patch for RX_ERR_HF_INT_EN to have clear commmit messages.

Thanks,
Enguerrand
Enguerrand de Ribaucourt June 23, 2022, 1:14 p.m. UTC | #3
The false carrier and RX error counters, once half full, produce interrupt
floods. Since we do not use these counters, these interrupts should be disabled.

In-Reply-To: YqzAKguRaxr74oXh@lunn.ch
Fixes: 87461f7a58ab694e638ac52afa543b427751a9d0
diff mbox series

Patch

diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c
index e6ad3a494d32..95ef507053a6 100644
--- a/drivers/net/phy/dp83822.c
+++ b/drivers/net/phy/dp83822.c
@@ -230,7 +230,6 @@  static int dp83822_config_intr(struct phy_device *phydev)
 			return misr_status;
 
 		misr_status |= (DP83822_RX_ERR_HF_INT_EN |
-				DP83822_FALSE_CARRIER_HF_INT_EN |
 				DP83822_LINK_STAT_INT_EN |
 				DP83822_ENERGY_DET_INT_EN |
 				DP83822_LINK_QUAL_INT_EN);