Skip to content

Commit f904f15

Browse files
Russell Kingdavem330
authored andcommitted
net: phylink: allow ethtool -A to change flow control advertisement
When ethtool -A is used to change the pause modes, the pause advertisement is not being changed, but the documentation in uapi/linux/ethtool.h says we should be. Add that capability to phylink. Signed-off-by: Russell King <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4e5aeb4 commit f904f15

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

drivers/net/phy/phylink.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,7 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl,
13851385
!pause->autoneg && pause->rx_pause != pause->tx_pause)
13861386
return -EINVAL;
13871387

1388+
mutex_lock(&pl->state_mutex);
13881389
config->pause = 0;
13891390
if (pause->autoneg)
13901391
config->pause |= MLO_PAUSE_AN;
@@ -1393,6 +1394,22 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl,
13931394
if (pause->tx_pause)
13941395
config->pause |= MLO_PAUSE_TX;
13951396

1397+
/*
1398+
* See the comments for linkmode_set_pause(), wrt the deficiencies
1399+
* with the current implementation. A solution to this issue would
1400+
* be:
1401+
* ethtool Local device
1402+
* rx tx Pause AsymDir
1403+
* 0 0 0 0
1404+
* 1 0 1 1
1405+
* 0 1 0 1
1406+
* 1 1 1 1
1407+
* and then use the ethtool rx/tx enablement status to mask the
1408+
* rx/tx pause resolution.
1409+
*/
1410+
linkmode_set_pause(config->advertising, pause->tx_pause,
1411+
pause->rx_pause);
1412+
13961413
/* If we have a PHY, phylib will call our link state function if the
13971414
* mode has changed, which will trigger a resolve and update the MAC
13981415
* configuration.
@@ -1405,6 +1422,7 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl,
14051422
phylink_mac_config(pl, &pl->link_config);
14061423
phylink_mac_an_restart(pl);
14071424
}
1425+
mutex_unlock(&pl->state_mutex);
14081426

14091427
return 0;
14101428
}

0 commit comments

Comments
 (0)