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>] [day] [month] [year] [list]
Date:   Wed, 29 Jun 2022 21:30:12 +0800
From:   Frank <Frank.Sae@...or-comm.com>
To:     Peter Geis <pgwipeout@...il.com>, Andrew Lunn <andrew@...n.ch>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Russell King <linux@...linux.org.uk>,
        "David S . Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>
Cc:     yinghong.zhang@...or-comm.com, fei.zhang@...or-comm.com,
        hua.sun@...or-comm.com, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, Frank <Frank.Sae@...or-comm.com>
Subject: Re: Re: [PATCH v2] net: phy: Add driver for Motorcomm yt8521 gigabit

The poll mode of yt8521 phy is not support utp and fiber at same time, In other
words, only utp or fiber can be connected at one time, and you can change to
fiber or utp at next time. so in poll mode need to do both ( utp and fiber )
operation

> > > > +int yt8521_config_aneg(struct phy_device *phydev)
> > > > +{
> > > > + struct yt8521_priv *priv = phydev->priv;
> > > > + u8 polling_mode = priv->polling_mode;
> > > > + int old_page;
> > > > + int ret;
> > > > +
> > > > + old_page = yt8521_read_page_with_lock(phydev);
> > > > + if (old_page)
> > > > +  return old_page;
> > > > +
> > > > + if (polling_mode == YT8521_MODE_FIBER ||
> > > > +     polling_mode == YT8521_MODE_POLL) {
> > > > +  ret = yt8521_write_page_with_lock(phydev,
> > > > +        YT8521_RSSR_FIBER_SPACE);
> > > > +  if (ret < 0)
> > > > +   goto err_restore_page;
> > > > +
> > > > +  ret = genphy_config_aneg(phydev);
> > > > +  if (ret < 0)
> > > > +   goto err_restore_page;
> > > > + }
> > > > +
> > > > + if (polling_mode == YT8521_MODE_UTP ||
> > > > +     polling_mode == YT8521_MODE_POLL) {
> > > > +  ret = yt8521_write_page_with_lock(phydev,
> > > > +        YT8521_RSSR_UTP_SPACE);
> > > > +  if (ret < 0)
> > > > +   goto err_restore_page;
> > > > +
> > > > +  ret = genphy_config_aneg(phydev);
> > > > +  if (ret < 0)
> > > > +   goto err_restore_page;
> > > > + }
> > >
> > > Looks like this could be refactored to reduce duplication.
> > >
> >
> > sure, as the reason said above, the same operation is required in both utp and
> > fiber spaces.
> 
> So you can probably pull the 'core' of this function out into a
> helper, and then call it either with YT8521_RSSR_UTP_SPACE or
> YT8521_RSSR_FIBER_SPACE.
> 
> > > > + ret = !!(link_fiber | link_utp);
> > >
> > > Does this mean it can do both copper and fibre at the same time. And
> > > whichever gives up first wins?
> >
> > Sure, the phy supports utp, fiber, and both. In the case of both, this driver
> > supposes that fiber is of priority.
> 
> It is generally not that simple. Fibre, you probably want 1000BaseX,
> unless the fibre module is actually copper, and then you want
> SGMII. So you need something to talk to the fibre module and ask it
> what it is. That something is phylink. Phylink does not support both
> copper and fibre at the same time for one MAC.

Cheers and BR,
Frank

-- 
2.31.0.windows.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ