All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Simon Horman <horms@verge.net.au>
Cc: David Miller <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	Florian Fainelli <f.fainelli@gmail.com>
Subject: Re: [PATCH v3 net-next 07/12] net: ethernet: Add helper to remove a supported link mode
Date: Mon, 17 Sep 2018 17:38:11 +0200	[thread overview]
Message-ID: <20180917153811.GE5458@lunn.ch> (raw)
In-Reply-To: <20180917151302.l6mzzy5xmqlbgejj@verge.net.au>

On Mon, Sep 17, 2018 at 05:13:07PM +0200, Simon Horman wrote:
> On Wed, Sep 12, 2018 at 01:53:14AM +0200, Andrew Lunn wrote:
> > Some MAC hardware cannot support a subset of link modes. e.g. often
> > 1Gbps Full duplex is supported, but Half duplex is not. Add a helper
> > to remove such a link mode.
> > 
> > Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> > Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> > ---
> >  drivers/net/ethernet/apm/xgene/xgene_enet_hw.c |  6 +++---
> >  drivers/net/ethernet/cadence/macb_main.c       |  5 ++---
> >  drivers/net/ethernet/freescale/fec_main.c      |  3 ++-
> >  drivers/net/ethernet/microchip/lan743x_main.c  |  2 +-
> >  drivers/net/ethernet/renesas/ravb_main.c       |  3 ++-
> >  .../net/ethernet/stmicro/stmmac/stmmac_main.c  | 12 ++++++++----
> >  drivers/net/phy/phy_device.c                   | 18 ++++++++++++++++++
> >  drivers/net/usb/lan78xx.c                      |  2 +-
> >  include/linux/phy.h                            |  1 +
> >  9 files changed, 38 insertions(+), 14 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
> > index 078a04dc1182..4831f9de5945 100644
> 
> ...
> 
> > diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> > index aff5516b781e..fb2a1125780d 100644
> > --- a/drivers/net/ethernet/renesas/ravb_main.c
> > +++ b/drivers/net/ethernet/renesas/ravb_main.c
> > @@ -1074,7 +1074,8 @@ static int ravb_phy_init(struct net_device *ndev)
> >  	}
> >  
> >  	/* 10BASE is not supported */
> > -	phydev->supported &= ~PHY_10BT_FEATURES;
> > +	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Half_BIT);
> > +	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Full_BIT);
> >  
> >  	phy_attached_info(phydev);
> >  
> 
> ...
> 
> > diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> > index db1172db1e7c..e9ca83a438b0 100644
> > --- a/drivers/net/phy/phy_device.c
> > +++ b/drivers/net/phy/phy_device.c
> > @@ -1765,6 +1765,24 @@ int phy_set_max_speed(struct phy_device *phydev, u32 max_speed)
> >  }
> >  EXPORT_SYMBOL(phy_set_max_speed);
> >  
> > +/**
> > + * phy_remove_link_mode - Remove a supported link mode
> > + * @phydev: phy_device structure to remove link mode from
> > + * @link_mode: Link mode to be removed
> > + *
> > + * Description: Some MACs don't support all link modes which the PHY
> > + * does.  e.g. a 1G MAC often does not support 1000Half. Add a helper
> > + * to remove a link mode.
> > + */
> > +void phy_remove_link_mode(struct phy_device *phydev, u32 link_mode)
> > +{
> > +	WARN_ON(link_mode > 31);
> > +
> > +	phydev->supported &= ~BIT(link_mode);
> > +	phydev->advertising = phydev->supported;
> > +}
> > +EXPORT_SYMBOL(phy_remove_link_mode);
> > +
> >  static void of_set_phy_supported(struct phy_device *phydev)
> >  {
> >  	struct device_node *node = phydev->mdio.dev.of_node;
> 
> Hi Andrew,
> 
> I believe that for the RAVB the overall effect of this change is that
> 10-BaseT modes are no longer advertised (although both with and without
> this patch they are not supported).
> 
> Unfortunately on R-Car Gen3 M3-W (r8a7796) based Salvator-X board
> I have observed that this results in the link no longer being negotiated
> on one switch (the one I usually use) while it seemed fine on another.

Hi Simon

Thanks for testing this.

Could you dump the PHY registers with and without this patch:

$ mii-tool -vv eth0

Once difference is that phy_remove_link_mode() does
phydev->advertising = phydev->supported where as the old code does
not. I though phylib would do this anyway, it does at some point in
time, but i didn't check when. It could be you are actually
advertising 10, even if you don't support it.

Thanks
	Andrew

  reply	other threads:[~2018-09-17 21:06 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-11 23:53 [PATCH v3 net-next 00/12] Preparing for phylib limkmodes Andrew Lunn
2018-09-11 23:53 ` [PATCH v3 net-next 01/12] net: phy: ste10Xp: Remove wrong SUPPORTED_Pause Andrew Lunn
2018-09-11 23:53 ` [PATCH v3 net-next 02/12] net: phy: et1011c: Remove incorrect missing 1000 Half Andrew Lunn
2018-09-11 23:53 ` [PATCH v3 net-next 03/12] net: phy: bcm63xx: Allow to be built with COMPILE_TEST Andrew Lunn
2018-09-11 23:53 ` [PATCH v3 net-next 04/12] net: ethernet: Use phy_set_max_speed() to limit advertised speed Andrew Lunn
2018-11-22 10:40   ` Anssi Hannula
2018-11-22 18:33     ` Andrew Lunn
2018-09-11 23:53 ` [PATCH v3 net-next 05/12] net: bcmgenet: Fix speed selection for reverse MII Andrew Lunn
2018-09-11 23:53 ` [PATCH v3 net-next 06/12] net: ethernet: Fix up drivers masking pause support Andrew Lunn
2018-09-11 23:53 ` [PATCH v3 net-next 07/12] net: ethernet: Add helper to remove a supported link mode Andrew Lunn
2018-09-17 15:13   ` Simon Horman
2018-09-17 15:38     ` Andrew Lunn [this message]
2018-09-18 10:58       ` Simon Horman
2018-09-18 13:02         ` Andrew Lunn
2018-09-19  7:45           ` Simon Horman
2018-09-19 12:32             ` Andrew Lunn
2018-09-20  8:05               ` Simon Horman
2018-09-20 12:51                 ` Andrew Lunn
2018-09-21  8:17                   ` Simon Horman
2018-09-24 15:36                     ` Simon Horman
2018-09-24 15:50                       ` Andrew Lunn
2018-09-25  7:38                         ` Simon Horman
2018-09-27  3:08                         ` David Miller
2018-10-01 12:43                           ` Simon Horman
2018-09-20 13:25         ` Andrew Lunn
2018-09-21  8:13           ` Simon Horman
2018-09-21 13:01             ` Andrew Lunn
2018-09-25  8:40               ` Simon Horman
2018-09-11 23:53 ` [PATCH v3 net-next 08/12] net: ethernet: Add helper for MACs which support asym pause Andrew Lunn
2018-09-11 23:53 ` [PATCH v3 net-next 09/12] net: ethernet: Add helper for MACs which support pause Andrew Lunn
2018-09-11 23:53 ` [PATCH v3 net-next 10/12] net: ethernet: Add helper for set_pauseparam for Asym Pause Andrew Lunn
2018-09-11 23:53 ` [PATCH v3 net-next 11/12] net: ethernet: Add helper for set_pauseparam for Pause Andrew Lunn
2018-09-11 23:53 ` [PATCH v3 net-next 12/12] net: ethernet: Add helper to determine if pause configuration is supported Andrew Lunn
2018-09-13  3:24 ` [PATCH v3 net-next 00/12] Preparing for phylib limkmodes David Miller

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=20180917153811.GE5458@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=horms@verge.net.au \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.