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]
Date:   Mon, 7 Jun 2021 14:45:01 +0200
From:   Steen Hegelund <steen.hegelund@...rochip.com>
To:     "Russell King (Oracle)" <linux@...linux.org.uk>
CC:     "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, Andrew Lunn <andrew@...n.ch>,
        Microchip Linux Driver Support <UNGLinuxDriver@...rochip.com>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Madalin Bucur <madalin.bucur@....nxp.com>,
        Mark Einon <mark.einon@...il.com>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Arnd Bergmann <arnd@...db.de>,
        Philipp Zabel <p.zabel@...gutronix.de>,
        "Simon Horman" <simon.horman@...ronome.com>,
        <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        Bjarni Jonasson <bjarni.jonasson@...rochip.com>,
        Lars Povlsen <lars.povlsen@...rochip.com>
Subject: Re: [PATCH net-next v3 03/10] net: sparx5: add hostmode with
 phylink support

Hi Russell,

Thanks for your comments.

On Mon, 2021-06-07 at 10:15 +0100, Russell King (Oracle) wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On Fri, Jun 04, 2021 at 10:55:53AM +0200, Steen Hegelund wrote:
> > +static void sparx5_phylink_mac_config(struct phylink_config *config,
> > +                                   unsigned int mode,
> > +                                   const struct phylink_link_state *state)
> > +{
> > +     struct sparx5_port *port = netdev_priv(to_net_dev(config->dev));
> > +     struct sparx5_port_config conf;
> > +
> > +     conf = port->conf;
> > +     conf.power_down = false;
> > +     conf.portmode = state->interface;
> > +     conf.speed = state->speed;
> > +     conf.autoneg = state->an_enabled;
> > +     conf.pause = state->pause;
> > +
> > +     if (state->interface == PHY_INTERFACE_MODE_10GBASER) {
> > +             if (state->speed == SPEED_UNKNOWN) {
> > +                     /* When a SFP is plugged in we use capabilities to
> > +                      * default to the highest supported speed
> > +                      */
> > +                     if (phylink_test(state->advertising, 25000baseSR_Full) ||
> > +                         phylink_test(state->advertising, 25000baseCR_Full))
> > +                             conf.speed = SPEED_25000;
> > +                     else if (state->interface == PHY_INTERFACE_MODE_10GBASER)
> > +                             conf.speed = SPEED_10000;
> > +             } else if (state->speed == SPEED_2500) {
> > +                     conf.portmode = PHY_INTERFACE_MODE_2500BASEX;
> > +             } else if (state->speed == SPEED_1000) {
> > +                     conf.portmode = PHY_INTERFACE_MODE_1000BASEX;
> > +             }
> 
> 1) As detailed in the documentation for phylink, state->speed is not
>    guaranteed to be valid in the mac_config method.

OK.  I will assume speed is not known in this callback.


> 2) We clearly need PHY_INTERFACE_MODE_25GBASER rather than working
>    around this by testing bits in the advertising bitmap.


Yes that would be a very useful addition.
Should I add PHY_INTERFACE_MODE_25GBASER in this series or should that be added as a separate
series?

> 
> 3) I really don't get what's going on with setting the port mode to
>    2500base-X and 1000base-X here when state->interface is 10GBASER.

The high speed interfaces (> 2.5G) do not support any in-band signalling, so the only way that e.g a
10G interface running at 2.5G will be able to link up with its partner is if both ends configure the
speed manually via ethtool.
	
> 
> > +             if (phylink_test(state->advertising, FIBRE))
> > +                     conf.media = PHY_MEDIA_SR;
> > +             else
> > +                     conf.media = PHY_MEDIA_DAC;
> > +     }
> > +
> > +     if (!port_conf_has_changed(&port->conf, &conf))
> > +             return;
> > +}
> > +
> > +static void sparx5_phylink_mac_link_up(struct phylink_config *config,
> > +                                    struct phy_device *phy,
> > +                                    unsigned int mode,
> > +                                    phy_interface_t interface,
> > +                                    int speed, int duplex,
> > +                                    bool tx_pause, bool rx_pause)
> > +{
> 
> This is the only place that the MAC is guaranteed to know the
> negotiated speed.

OK.

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


-- 
BR
Steen

-=-=-=-=-=-=-=-=-=-=-=-=-=-=
steen.hegelund@...rochip.com


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ