lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZTuk/OF01M24nBeG@shell.armlinux.org.uk>
Date:   Fri, 27 Oct 2023 12:54:36 +0100
From:   "Russell King (Oracle)" <linux@...linux.org.uk>
To:     Serge Semin <fancer.lancer@...il.com>
Cc:     Raju Lakkaraju <Raju.Lakkaraju@...rochip.com>,
        netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
        linux-kernel@...r.kernel.org, andrew@...n.ch,
        Jose.Abreu@...opsys.com, UNGLinuxDriver@...rochip.com
Subject: Re: [PATCH net-next V3] net: pcs: xpcs: Add 2500BASE-X case in get
 state for XPCS drivers

On Fri, Oct 27, 2023 at 02:04:15PM +0300, Serge Semin wrote:
> Cc += Russell
> 
> * It's a good practice to add all the reviewers to Cc in the new patch
> * revisions.
> 
> On Fri, Oct 27, 2023 at 10:13:06AM +0530, Raju Lakkaraju wrote:
> > Add DW_2500BASEX case in xpcs_get_state( ) to update speed, duplex and pause
> > 
> > Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@...rochip.com>
> 
> With a nitpick below clarified, feel free to add:
> Reviewed-by: Serge Semin <fancer.lancer@...il.com>
> 
> > ---
> >  drivers/net/pcs/pcs-xpcs.c | 29 +++++++++++++++++++++++++++++
> >  drivers/net/pcs/pcs-xpcs.h |  2 ++
> >  2 files changed, 31 insertions(+)
> > 
> > diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c
> > index 4dbc21f604f2..31f0beba638a 100644
> > --- a/drivers/net/pcs/pcs-xpcs.c
> > +++ b/drivers/net/pcs/pcs-xpcs.c
> > @@ -1090,6 +1090,28 @@ static int xpcs_get_state_c37_1000basex(struct dw_xpcs *xpcs,
> >  	return 0;
> >  }
> >  
> > +static int xpcs_get_state_2500basex(struct dw_xpcs *xpcs,
> > +				    struct phylink_link_state *state)
> > +{
> > +	int ret;
> > +
> > +	ret = xpcs_read(xpcs, MDIO_MMD_VEND2, DW_VR_MII_MMD_STS);
> > +	if (ret < 0) {
> > +		state->link = 0;
> > +		return ret;
> > +	}
> > +
> > +	state->link = !!(ret & DW_VR_MII_MMD_STS_LINK_STS);
> > +	if (!state->link)
> > +		return 0;
> > +
> > +	state->speed = SPEED_2500;
> 
> > +	state->pause |= MLO_PAUSE_TX | MLO_PAUSE_RX;
> 
> Why is it '|=' instead of just '='? Is it possible to have the 'pause'
> field having some additional flags set which would be required to
> preserve?

The code is correct. There are other flags on state->pause other than
these, and phylink initialises state->pause prior to calling the
function. The only flags that should be modified here are these two
bits that the code is setting.

Phylink will initialise it to MLO_PAUSE_NONE if expecting autoneg, or
the configured values if autoneg on the link is disabled.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ