b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | From: Russell King <rmk+kernel@armlinux.org.uk> |
| 2 | Date: Wed, 26 Feb 2020 10:23:46 +0000 |
| 3 | Subject: [PATCH] net: dsa: propagate resolved link config via mac_link_up() |
| 4 | |
| 5 | Propagate the resolved link configuration down via DSA's |
| 6 | phylink_mac_link_up() operation to allow split PCS/MAC to work. |
| 7 | |
| 8 | Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com> |
| 9 | Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> |
| 10 | Signed-off-by: David S. Miller <davem@davemloft.net> |
| 11 | --- |
| 12 | |
| 13 | --- a/drivers/net/dsa/b53/b53_common.c |
| 14 | +++ b/drivers/net/dsa/b53/b53_common.c |
| 15 | @@ -1312,7 +1312,9 @@ EXPORT_SYMBOL(b53_phylink_mac_link_down) |
| 16 | void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, |
| 17 | unsigned int mode, |
| 18 | phy_interface_t interface, |
| 19 | - struct phy_device *phydev) |
| 20 | + struct phy_device *phydev, |
| 21 | + int speed, int duplex, |
| 22 | + bool tx_pause, bool rx_pause) |
| 23 | { |
| 24 | struct b53_device *dev = ds->priv; |
| 25 | |
| 26 | --- a/drivers/net/dsa/b53/b53_priv.h |
| 27 | +++ b/drivers/net/dsa/b53/b53_priv.h |
| 28 | @@ -344,7 +344,9 @@ void b53_phylink_mac_link_down(struct ds |
| 29 | void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, |
| 30 | unsigned int mode, |
| 31 | phy_interface_t interface, |
| 32 | - struct phy_device *phydev); |
| 33 | + struct phy_device *phydev, |
| 34 | + int speed, int duplex, |
| 35 | + bool tx_pause, bool rx_pause); |
| 36 | int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering); |
| 37 | int b53_vlan_prepare(struct dsa_switch *ds, int port, |
| 38 | const struct switchdev_obj_port_vlan *vlan); |
| 39 | --- a/drivers/net/dsa/bcm_sf2.c |
| 40 | +++ b/drivers/net/dsa/bcm_sf2.c |
| 41 | @@ -661,7 +661,9 @@ static void bcm_sf2_sw_mac_link_down(str |
| 42 | static void bcm_sf2_sw_mac_link_up(struct dsa_switch *ds, int port, |
| 43 | unsigned int mode, |
| 44 | phy_interface_t interface, |
| 45 | - struct phy_device *phydev) |
| 46 | + struct phy_device *phydev, |
| 47 | + int speed, int duplex, |
| 48 | + bool tx_pause, bool rx_pause) |
| 49 | { |
| 50 | struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); |
| 51 | struct ethtool_eee *p = &priv->dev->ports[port].eee; |
| 52 | --- a/drivers/net/dsa/lantiq_gswip.c |
| 53 | +++ b/drivers/net/dsa/lantiq_gswip.c |
| 54 | @@ -1662,7 +1662,9 @@ static void gswip_phylink_mac_link_down( |
| 55 | static void gswip_phylink_mac_link_up(struct dsa_switch *ds, int port, |
| 56 | unsigned int mode, |
| 57 | phy_interface_t interface, |
| 58 | - struct phy_device *phydev) |
| 59 | + struct phy_device *phydev, |
| 60 | + int speed, int duplex, |
| 61 | + bool tx_pause, bool rx_pause) |
| 62 | { |
| 63 | struct gswip_priv *priv = ds->priv; |
| 64 | |
| 65 | --- a/drivers/net/dsa/mt7530.c |
| 66 | +++ b/drivers/net/dsa/mt7530.c |
| 67 | @@ -1441,7 +1441,9 @@ static void mt7530_phylink_mac_link_down |
| 68 | static void mt7530_phylink_mac_link_up(struct dsa_switch *ds, int port, |
| 69 | unsigned int mode, |
| 70 | phy_interface_t interface, |
| 71 | - struct phy_device *phydev) |
| 72 | + struct phy_device *phydev, |
| 73 | + int speed, int duplex, |
| 74 | + bool tx_pause, bool rx_pause) |
| 75 | { |
| 76 | struct mt7530_priv *priv = ds->priv; |
| 77 | |
| 78 | --- a/drivers/net/dsa/mv88e6xxx/chip.c |
| 79 | +++ b/drivers/net/dsa/mv88e6xxx/chip.c |
| 80 | @@ -652,7 +652,9 @@ static void mv88e6xxx_mac_link_down(stru |
| 81 | |
| 82 | static void mv88e6xxx_mac_link_up(struct dsa_switch *ds, int port, |
| 83 | unsigned int mode, phy_interface_t interface, |
| 84 | - struct phy_device *phydev) |
| 85 | + struct phy_device *phydev, |
| 86 | + int speed, int duplex, |
| 87 | + bool tx_pause, bool rx_pause) |
| 88 | { |
| 89 | if (mode == MLO_AN_FIXED) |
| 90 | mv88e6xxx_mac_link_force(ds, port, LINK_FORCED_UP); |
| 91 | --- a/drivers/net/dsa/sja1105/sja1105_main.c |
| 92 | +++ b/drivers/net/dsa/sja1105/sja1105_main.c |
| 93 | @@ -831,7 +831,9 @@ static void sja1105_mac_link_down(struct |
| 94 | static void sja1105_mac_link_up(struct dsa_switch *ds, int port, |
| 95 | unsigned int mode, |
| 96 | phy_interface_t interface, |
| 97 | - struct phy_device *phydev) |
| 98 | + struct phy_device *phydev, |
| 99 | + int speed, int duplex, |
| 100 | + bool tx_pause, bool rx_pause) |
| 101 | { |
| 102 | sja1105_inhibit_tx(ds->priv, BIT(port), false); |
| 103 | } |
| 104 | --- a/include/net/dsa.h |
| 105 | +++ b/include/net/dsa.h |
| 106 | @@ -407,7 +407,9 @@ struct dsa_switch_ops { |
| 107 | void (*phylink_mac_link_up)(struct dsa_switch *ds, int port, |
| 108 | unsigned int mode, |
| 109 | phy_interface_t interface, |
| 110 | - struct phy_device *phydev); |
| 111 | + struct phy_device *phydev, |
| 112 | + int speed, int duplex, |
| 113 | + bool tx_pause, bool rx_pause); |
| 114 | void (*phylink_fixed_state)(struct dsa_switch *ds, int port, |
| 115 | struct phylink_link_state *state); |
| 116 | /* |
| 117 | --- a/net/dsa/port.c |
| 118 | +++ b/net/dsa/port.c |
| 119 | @@ -544,7 +544,8 @@ void dsa_port_phylink_mac_link_up(struct |
| 120 | return; |
| 121 | } |
| 122 | |
| 123 | - ds->ops->phylink_mac_link_up(ds, dp->index, mode, interface, phydev); |
| 124 | + ds->ops->phylink_mac_link_up(ds, dp->index, mode, interface, phydev, |
| 125 | + speed, duplex, tx_pause, rx_pause); |
| 126 | } |
| 127 | EXPORT_SYMBOL_GPL(dsa_port_phylink_mac_link_up); |
| 128 | |
| 129 | --- a/net/dsa/dsa_priv.h |
| 130 | +++ b/net/dsa/dsa_priv.h |
| 131 | @@ -192,9 +192,11 @@ void dsa_port_phylink_mac_link_down(stru |
| 132 | unsigned int mode, |
| 133 | phy_interface_t interface); |
| 134 | void dsa_port_phylink_mac_link_up(struct phylink_config *config, |
| 135 | + struct phy_device *phydev, |
| 136 | unsigned int mode, |
| 137 | phy_interface_t interface, |
| 138 | - struct phy_device *phydev); |
| 139 | + int speed, int duplex, |
| 140 | + bool tx_pause, bool rx_pause); |
| 141 | extern const struct phylink_mac_ops dsa_port_phylink_mac_ops; |
| 142 | |
| 143 | /* slave.c */ |