1 From 471c40bde606ec0b1ce8c616f7998739c7a783a6 Mon Sep 17 00:00:00 2001
2 From: Ivan Bornyakov <i.bornyakov@metrotek.ru>
3 Date: Fri, 10 Feb 2023 18:46:27 +0300
4 Subject: [PATCH 10/21] net: phylink: support validated pause and autoneg in
7 In fixed-link setup phylink_parse_fixedlink() unconditionally sets
8 Pause, Asym_Pause and Autoneg bits to "supported" bitmap, while MAC may
11 This leads to ethtool reporting:
13 > Supported pause frame use: Symmetric Receive-only
14 > Supports auto-negotiation: Yes
16 regardless of what is actually supported.
18 Instead of unconditionally set Pause, Asym_Pause and Autoneg it is
19 sensible to set them according to validated "supported" bitmap, i.e. the
20 result of phylink_validate().
22 Signed-off-by: Ivan Bornyakov <i.bornyakov@metrotek.ru>
23 Signed-off-by: David S. Miller <davem@davemloft.net>
25 drivers/net/phy/phylink.c | 17 ++++++++++++++---
26 1 file changed, 14 insertions(+), 3 deletions(-)
28 --- a/drivers/net/phy/phylink.c
29 +++ b/drivers/net/phy/phylink.c
30 @@ -709,6 +709,7 @@ static int phylink_parse_fixedlink(struc
31 struct fwnode_handle *fwnode)
33 struct fwnode_handle *fixed_node;
34 + bool pause, asym_pause, autoneg;
35 const struct phy_setting *s;
36 struct gpio_desc *desc;
38 @@ -781,13 +782,23 @@ static int phylink_parse_fixedlink(struc
39 linkmode_copy(pl->link_config.advertising, pl->supported);
40 phylink_validate(pl, pl->supported, &pl->link_config);
42 + pause = phylink_test(pl->supported, Pause);
43 + asym_pause = phylink_test(pl->supported, Asym_Pause);
44 + autoneg = phylink_test(pl->supported, Autoneg);
45 s = phy_lookup_setting(pl->link_config.speed, pl->link_config.duplex,
47 linkmode_zero(pl->supported);
48 phylink_set(pl->supported, MII);
49 - phylink_set(pl->supported, Pause);
50 - phylink_set(pl->supported, Asym_Pause);
51 - phylink_set(pl->supported, Autoneg);
54 + phylink_set(pl->supported, Pause);
57 + phylink_set(pl->supported, Asym_Pause);
60 + phylink_set(pl->supported, Autoneg);
63 __set_bit(s->bit, pl->supported);
64 __set_bit(s->bit, pl->link_config.lp_advertising);