Messages in this thread | | | Date | Mon, 30 Nov 2020 14:52:14 +0000 | From | Russell King - ARM Linux admin <> | Subject | Re: [RFC PATCH 2/3] net: sparx5: Add Sparx5 switchdev driver |
| |
On Mon, Nov 30, 2020 at 03:15:56PM +0100, Steen Hegelund wrote: > On 29.11.2020 10:52, Russell King - ARM Linux admin wrote: > > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > > > On Sat, Nov 28, 2020 at 10:28:28PM +0000, Russell King - ARM Linux admin wrote: > > > On Sat, Nov 28, 2020 at 08:06:16PM +0100, Andrew Lunn 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; > > > > > + int err = 0; > > > > > + > > > > > + conf = port->conf; > > > > > + conf.autoneg = state->an_enabled; > > > > > + conf.pause = state->pause; > > > > > + conf.duplex = state->duplex; > > > > > + conf.power_down = false; > > > > > + conf.portmode = state->interface; > > > > > + > > > > > + if (state->speed == SPEED_UNKNOWN) { > > > > > + /* When a SFP is plugged in we use capabilities to > > > > > + * default to the highest supported speed > > > > > + */ > > > > > > > > This looks suspicious. > > > > > > Yes, it looks highly suspicious. The fact that > > > sparx5_phylink_mac_link_up() is empty, and sparx5_phylink_mac_config() > > > does all the work suggests that this was developed before the phylink > > > re-organisation, and this code hasn't been updated for it. > > > > > > Any new code for the kernel really ought to be updated for the new > > > phylink methodology before it is accepted. > > > > > > Looking at sparx5_port_config(), it also seems to use > > > PHY_INTERFACE_MODE_1000BASEX for both 1000BASE-X and 2500BASE-X. All > > > very well for the driver to do that internally, but it's confusing > > > when it comes to reviewing this stuff, especially when people outside > > > of the driver (such as myself) reviewing it need to understand what's > > > going on with the configuration. > > > > Hi Russell, > > > There are other issues too. > > > > Looking at sparx5_get_1000basex_status(), we have: > > > > + status->link = DEV2G5_PCS1G_LINK_STATUS_LINK_STATUS_GET(value) | > > + DEV2G5_PCS1G_LINK_STATUS_SYNC_STATUS_GET(value); > > > > > Why is the link status the logical OR of these? > > Oops: It should have been AND. Well spotted.
Do you need to check the sync status? Isn't it impossible to have "link up" on a link that is unsynchronised?
-- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
| |