> -----Original Message-----
> From: Andrew Lunn <and...@lunn.ch>
> Sent: Thursday, March 11, 2021 8:57 PM
> To: David Thompson <davthomp...@nvidia.com>
> Cc: netdev@vger.kernel.org; da...@davemloft.net; k...@kernel.org; Liming
> Sun <limi...@nvidia.com>; Asmaa Mnebhi <as...@nvidia.com>
> Subject: Re: [PATCH net-next v4] Add Mellanox BlueField Gigabit Ethernet 
> driver
> 
> > +static void mlxbf_gige_get_pauseparam(struct net_device *netdev,
> > +                                 struct ethtool_pauseparam *pause) {
> > +   struct mlxbf_gige *priv = netdev_priv(netdev);
> > +
> > +   pause->autoneg = priv->aneg_pause;
> > +   pause->rx_pause = priv->tx_pause;
> > +   pause->tx_pause = priv->rx_pause;
> > +}
> 
> > +static int mlxbf_gige_probe(struct platform_device *pdev) {
> > +   err = phy_connect_direct(netdev, phydev,
> > +                            mlxbf_gige_adjust_link,
> > +                            PHY_INTERFACE_MODE_GMII);
> > +   if (err) {
> > +           dev_err(&pdev->dev, "Could not attach to PHY\n");
> > +           mlxbf_gige_mdio_remove(priv);
> > +           return err;
> > +   }
> > +
> > +   /* MAC only supports 1000T full duplex mode */
> > +   phy_remove_link_mode(phydev,
> ETHTOOL_LINK_MODE_1000baseT_Half_BIT);
> > +   phy_remove_link_mode(phydev,
> ETHTOOL_LINK_MODE_100baseT_Full_BIT);
> > +   phy_remove_link_mode(phydev,
> ETHTOOL_LINK_MODE_100baseT_Half_BIT);
> > +   phy_remove_link_mode(phydev,
> ETHTOOL_LINK_MODE_10baseT_Full_BIT);
> > +   phy_remove_link_mode(phydev,
> ETHTOOL_LINK_MODE_10baseT_Half_BIT);
> > +
> > +   /* MAC supports symmetric flow control */
> > +   phy_support_sym_pause(phydev);
> > +
> > +   /* Enable pause */
> > +   priv->rx_pause = phydev->pause;
> > +   priv->tx_pause = phydev->pause;
> > +   priv->aneg_pause = AUTONEG_ENABLE;
> 
> Hi David
> 
> I'm pretty sure mlxbf_gige_get_pauseparam() is broken.
> 
> This is the only code which sets priv->rx_pause, etc. And this is before the 
> PHY
> has had time to do anything. auto-neg has not completed so you have no idea
> what has been negotiated for pause.
> mlxbf_gige_adjust_link() should be adjusting priv->??_pause once the link has
> been established.
> 
>      Andrew

Yes, good point Andrew.  I will modify mlxbf_gige_adjust_link() to set the
private pause parameters after the "link up" event.

- Dave

Reply via email to