public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
	linux-kernel@vger.kernel.org, bryan.whitehead@microchip.com,
	hkallweit1@gmail.com, pabeni@redhat.com, edumazet@google.com,
	linux@armlinux.org.uk, UNGLinuxDriver@microchip.com,
	Ian.Saturley@microchip.com
Subject: Re: [PATCH net-next 1/2] net: lan743x: Add support for get_pauseparam and set_pauseparam
Date: Fri, 21 Oct 2022 15:46:09 +0200	[thread overview]
Message-ID: <Y1Kiocu3WUubYyVe@lunn.ch> (raw)
In-Reply-To: <20221021055642.255413-2-Raju.Lakkaraju@microchip.com>

> +static int lan743x_set_pauseparam(struct net_device *dev,
> +				  struct ethtool_pauseparam *pause)
> +{
> +	struct lan743x_adapter *adapter = netdev_priv(dev);
> +	struct phy_device *phydev = dev->phydev;
> +	struct lan743x_phy *phy = &adapter->phy;
> +
> +	if (!phydev)
> +		return -ENODEV;
> +
> +	if (!phy_validate_pause(phydev, pause))
> +		return -EINVAL;
> +
> +	phy->fc_request_control = 0;
> +	if (pause->rx_pause)
> +		phy->fc_request_control |= FLOW_CTRL_RX;
> +
> +	if (pause->tx_pause)
> +		phy->fc_request_control |= FLOW_CTRL_TX;
> +
> +	phy->fc_autoneg = pause->autoneg;
> +
> +	phy_set_asym_pause(phydev, pause->rx_pause,  pause->tx_pause);
> +
> +	if (pause->autoneg == AUTONEG_DISABLE)
> +		lan743x_mac_flow_ctrl_set_enables(adapter, pause->tx_pause,
> +						  pause->rx_pause);

pause is not too well defined. But i think phy_set_asym_pause() should
be in an else clause. If pause autoneg is off, you directly set it in
the MAC and ignore what is negotiated. If it is enabled, you
negotiate. As far as i understand, you don't modify your negotiation
when pause autoneg is off.

	Andrew

  reply	other threads:[~2022-10-21 14:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-21  5:56 [PATCH net-next 0/2] net: lan743x: PCI11010 / PCI11414 devices Enhancements Raju Lakkaraju
2022-10-21  5:56 ` [PATCH net-next 1/2] net: lan743x: Add support for get_pauseparam and set_pauseparam Raju Lakkaraju
2022-10-21 13:46   ` Andrew Lunn [this message]
2022-10-24  7:16     ` Raju Lakkaraju
2022-10-21  5:56 ` [PATCH net-next 2/2] net: phy: micrel: Add PHY Auto/MDI/MDI-X set driver for KSZ9131 Raju Lakkaraju
2022-10-21  7:27   ` Horatiu Vultur
2022-10-21 10:26     ` Raju Lakkaraju

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y1Kiocu3WUubYyVe@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=Ian.Saturley@microchip.com \
    --cc=Raju.Lakkaraju@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=bryan.whitehead@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox