Skip to content

Commit 1511ed0

Browse files
vladimirolteandavem330
authored andcommitted
net: phylink: add support for polling MAC PCS
Some MAC PCS blocks are unable to provide interrupts when their status changes. As we already have support in phylink for polling status, use this to provide a hook for MACs to enable polling mode. The patch idea was picked up from Russell King's suggestion on the macb phylink patch thread here [0] but the implementation was changed. Instead of introducing a new phylink_start_poll() function, which would make the implementation cumbersome for common PHYLINK implementations for multiple types of devices, like DSA, just add a boolean property to the phylink_config structure, which is just as backwards-compatible. https://lkml.org/lkml/2019/12/16/603 Suggested-by: Russell King <[email protected]> Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3a68ba6 commit 1511ed0

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

Documentation/networking/sfp-phylink.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@ this documentation.
251251
phylink_mac_change(priv->phylink, link_is_up);
252252

253253
where ``link_is_up`` is true if the link is currently up or false
254-
otherwise.
254+
otherwise. If a MAC is unable to provide these interrupts, then
255+
it should set ``priv->phylink_config.pcs_poll = true;`` in step 9.
255256

256257
11. Verify that the driver does not call::
257258

drivers/net/phy/phylink.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,8 @@ void phylink_start(struct phylink *pl)
10221022
if (irq <= 0)
10231023
mod_timer(&pl->link_poll, jiffies + HZ);
10241024
}
1025-
if (pl->cfg_link_an_mode == MLO_AN_FIXED && pl->get_fixed_state)
1025+
if ((pl->cfg_link_an_mode == MLO_AN_FIXED && pl->get_fixed_state) ||
1026+
pl->config->pcs_poll)
10261027
mod_timer(&pl->link_poll, jiffies + HZ);
10271028
if (pl->phydev)
10281029
phy_start(pl->phydev);

include/linux/phylink.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@ enum phylink_op_type {
6363
* struct phylink_config - PHYLINK configuration structure
6464
* @dev: a pointer to a struct device associated with the MAC
6565
* @type: operation type of PHYLINK instance
66+
* @pcs_poll: MAC PCS cannot provide link change interrupt
6667
*/
6768
struct phylink_config {
6869
struct device *dev;
6970
enum phylink_op_type type;
71+
bool pcs_poll;
7072
};
7173

7274
/**

0 commit comments

Comments
 (0)