Thread (12 messages) read the whole thread 12 messages, 2 authors, 2021-12-16

Re: [PATCH] net: phylink: Pass state to pcs_config

From: "Russell King (Oracle)" <linux@armlinux.org.uk>
Date: 2021-12-15 01:12:09
Also in: lkml, netdev

On Wed, Dec 15, 2021 at 12:49:14AM +0000, Russell King (Oracle) wrote:
On Tue, Dec 14, 2021 at 07:16:53PM -0500, Sean Anderson wrote:
quoted
Ok, so let me clarify my understanding. Perhaps this can be eliminated
through a different approach.

When I read the datasheet for mvneta (which hopefully has the same
logic here, since I could not find a datasheet for an mvpp2 device), I
noticed that the Pause_Adv bit said
quoted
It is valid only if flow control mode is defined by Auto-Negotiation
(as defined by the <AnFcEn> bit).
Which I interpreted to mean that if AnFcEn was clear, then no flow
control was advertised. But perhaps it instead means that the logic is
something like

if (AnFcEn)
	Config_Reg.PAUSE = Pause_Adv;
else
	Config_Reg.PAUSE = SetFcEn;

which would mean that we can just clear AnFcEn in link_up if the
autonegotiated pause settings are different from the configured pause
settings.
Having actually played with this hardware quite a bit and observed what
it sends, what it implements for advertising is:

	Config_Reg.PAUSE = Pause_Adv;

Config_Reg gets sent over the 1000BASE-X link to the link partner, and
we receive Remote_Reg from the link partner.

Then, the hardware implements:

	if (AnFcEn)
		MAC_PAUSE = Config_Reg.PAUSE & Remote_Reg.PAUSE;
	else
		MAC_PAUSE = SetFcEn;

In otherwords, AnFcEn controls whether the result of autonegotiation
or the value of SetFcEn controls whether the MAC enables symmetric
pause mode.
I should also note that in the Port Status register,

	TxFcEn = RxFcEn = MAC_PAUSE;

So, the status register bits follow SetFcEn when AnFcEn is disabled.

However, these bits are the only way to report the result of the
negotiation, which is why we use them to report back whether flow
control was enabled in mvneta_pcs_get_state(). These bits will be
ignored by phylink when ethtool -A has disabled pause negotiation,
and in that situation there is no way as I said to be able to read
the negotiation result.

permit_pause_to_mac exists precisely because of the limitions of this
hardware, and having it costs virtually nothing to other network
drivers... except a parameter that others ignore.

If we don't have permit_pause_to_mac in pcs_config() then we need to
have it passed to the link_up() methods instead. There is no other
option (other than breaking mvneta and mvpp2) here than to make the
state of ethtool -A ... autoneg on|off known to the hardware.

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help