netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: "Marek Behún" <kabel@kernel.org>
Cc: netdev@vger.kernel.org, pavana.sharma@digi.com,
	vivien.didelot@gmail.com, f.fainelli@gmail.com, kuba@kernel.org,
	lkp@intel.com, davem@davemloft.net, ashkan.boldaji@digi.com,
	Chris Packham <chris.packham@alliedtelesis.co.nz>,
	olteanv@gmail.com,
	Russell King - ARM Linux admin <linux@armlinux.org.uk>,
	Russell King <rmk+kernel@armlinux.org.uk>
Subject: Re: [PATCH net] net: dsa: mv88e6xxx: do not allow inband AN for 2500base-x mode
Date: Fri, 15 Jan 2021 15:16:03 +0100	[thread overview]
Message-ID: <YAGjo3RQUjmFb+m7@lunn.ch> (raw)
In-Reply-To: <20210115005516.03f0f772@kernel.org>

On Fri, Jan 15, 2021 at 12:55:16AM +0100, Marek Behún wrote:
> On Fri, 15 Jan 2021 00:00:33 +0100
> Andrew Lunn <andrew@lunn.ch> wrote:
> 
> > > diff --git a/drivers/net/dsa/mv88e6xxx/serdes.c b/drivers/net/dsa/mv88e6xxx/serdes.c
> > > index 3195936dc5be..b8241820679e 100644
> > > --- a/drivers/net/dsa/mv88e6xxx/serdes.c
> > > +++ b/drivers/net/dsa/mv88e6xxx/serdes.c
> > > @@ -55,9 +55,20 @@ static int mv88e6xxx_serdes_pcs_get_state(struct mv88e6xxx_chip *chip,
> > >  {
> > >  	if (status & MV88E6390_SGMII_PHY_STATUS_SPD_DPL_VALID) {
> > >  		state->link = !!(status & MV88E6390_SGMII_PHY_STATUS_LINK);
> > > +
> > > +		if (state->interface == PHY_INTERFACE_MODE_2500BASEX) {
> > > +			if (state->link) {
> > > +				state->speed = SPEED_2500;
> > > +				state->duplex = DUPLEX_FULL;
> > > +			}
> > > +
> > > +			return 0;
> > > +		}
> > > +
> > > +		state->an_complete = 1;  
> > 
> > Should this be here? It seems like a logically different change, it is
> > not clear to me it is to do with PHY_INTERFACE_MODE_2500BASEX.
> 
> This function does not set an_complete at all, and as I understand it,
> it should. But maybe this should be in different commit, and more
> thought put into it. I will rethink it and send another version.

Thanks. A patch should do one thing, do it well, and have a good
commit message explaining why it is making the change. So yes, please
do put this into a patch of its own.

> 
> > >  		state->duplex = status &
> > >  				MV88E6390_SGMII_PHY_STATUS_DUPLEX_FULL ?
> > > -			                         DUPLEX_FULL : DUPLEX_HALF;
> > > +						DUPLEX_FULL : DUPLEX_HALF;  
> > 
> > This looks like an unintended white space change.
> 
> This change is intended. There were 17 space there istead of 2 tabs + 1
> space. And the last space is not needed, since it does not provide any
> other alignment. Should this be in separate commit?

Yes, white space changes should always be in a separate patch. They
distract from the actual change being made here.

> BTW Andrew, the code in serdes.c does many read and write calls, and it
> could be simplified a lot by implementing modify, setbits and clearbits
> methods, like phy.h implements. Or maybe we can use phy_mmd_* methods
> here instead of mv88e6390_serdes_read/write ?
> 
> I fear such change will make future backporting of new fix commits
> a pain. But I still think it should be done. What do you think?

As you say, it make backporting hard. Are the simplifications worth
it? And it is not limited to just SERDES code, the whole driver has
bits of code doing read/modify/write, so if you are going to make such
changes, it should be done everywhere.

	 Andrew

      reply	other threads:[~2021-01-15 14:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-14  2:40 [PATCH net] net: dsa: mv88e6xxx: do not allow inband AN for 2500base-x mode Marek Behún
2021-01-14 23:00 ` Andrew Lunn
2021-01-14 23:55   ` Marek Behún
2021-01-15 14:16     ` Andrew Lunn [this message]

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=YAGjo3RQUjmFb+m7@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=ashkan.boldaji@digi.com \
    --cc=chris.packham@alliedtelesis.co.nz \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kabel@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lkp@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pavana.sharma@digi.com \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=vivien.didelot@gmail.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).