net: add helpers to resolve negotiated flow control
authorRussell King <rmk+kernel@armlinux.org.uk>
Sat, 15 Feb 2020 15:49:27 +0000 (15:49 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 17 Feb 2020 03:39:44 +0000 (19:39 -0800)
commita87ae8a963bde755b0962bcc18db83d611f63e7a
tree9fa705afcdce8ca1555396d433e68b1ac918ed7a
parent8062e2333f8f7dcd5627e22b99e18d1cbb53eedb
net: add helpers to resolve negotiated flow control

Add a couple of helpers to resolve negotiated flow control. Two helpers
are provided:

- linkmode_resolve_pause() which takes the link partner and local
  advertisements, and decodes whether we should enable TX or RX pause
  at the MAC. This is useful outside of phylib, e.g. in phylink.
- phy_get_pause(), which returns the TX/RX enablement status for the
  current negotiation results of the PHY.

This allows us to centralise the flow control resolution, rather than
spreading it around.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/Makefile
drivers/net/phy/linkmode.c [new file with mode: 0644]
drivers/net/phy/phy_device.c
include/linux/linkmode.h
include/linux/phy.h