> -----Original Message----- > From: Andrew Lunn <andrew@xxxxxxx> > Sent: Wednesday, June 28, 2023 7:17 PM > To: Russell King (Oracle) <linux@xxxxxxxxxxxxxxx> > Cc: Revanth Kumar Uppala <ruppala@xxxxxxxxxx>; hkallweit1@xxxxxxxxx; > netdev@xxxxxxxxxxxxxxx; linux-tegra@xxxxxxxxxxxxxxx; Narayan Reddy > <narayanr@xxxxxxxxxx> > Subject: Re: [PATCH 1/4] net: phy: aquantia: Enable Tx/Rx pause frame support > in aquantia PHY > > External email: Use caution opening links or attachments > > > On Wed, Jun 28, 2023 at 02:30:48PM +0100, Russell King (Oracle) wrote: > > On Wed, Jun 28, 2023 at 06:13:23PM +0530, Revanth Kumar Uppala wrote: > > > From: Narayan Reddy <narayanr@xxxxxxxxxx> > > > > > > Enable flow control support using pause frames in aquantia phy driver. > > > > > > Signed-off-by: Narayan Reddy <narayanr@xxxxxxxxxx> > > > Signed-off-by: Revanth Kumar Uppala <ruppala@xxxxxxxxxx> > > > > I think this is over-complex. > > > > > #define MDIO_PHYXS_VEND_IF_STATUS 0xe812 > > > #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK GENMASK(7, 3) > > > #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_KR 0 @@ -583,6 +585,17 > @@ > > > static int aqr107_config_init(struct phy_device *phydev) > > > if (!ret) > > > aqr107_chip_info(phydev); > > > > > > + /* Advertize flow control */ > > > + linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, phydev- > >supported); > > > + linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, phydev- > >supported); > > > + linkmode_copy(phydev->advertising, phydev->supported); > > > > This is the wrong place to be doing this, since pause support depends > > not only on the PHY but also on the MAC. There are phylib interfaces > > that MACs should call so that phylib knows that the MAC supports pause > > frames. > > > > Secondly, the PHY driver needs to tell phylib that the PHY supports > > pause frames, and that's done through either setting the .features > > member in the PHY driver, or by providing a .get_features > > implementation. > > > > Configuration of the pause advertisement should already be happening > > through the core phylib code. > > I really should do a LPC netdev talk "Everybody gets pause wrong..." > > genphy_c45_an_config_aneg() will configure pause advertisement. The PHY > driver does not need to configure it, if the PHY follows the standard and has the > configuration in the correct place. As Russell said, please check the PHYs ability > to advertise pause is being reported correctly, by .get_features, of the default > implementation of .get_features if that is being used. And then check your MAC > driver is also indicating it supports pause. >From .get_features, it is not possible to check PHY's ability to advertise pause is being reported as there is no such register present for AQR PHY to check capabilities in its datasheet. Hence, we are directly configuring the pause frames from aqr107_config_init(). Thanks, Revanth Uppala > > Andrew