Skip to content

Commit

Permalink
Merge branch 'dsa-validate-remove'
Browse files Browse the repository at this point in the history
Russell King says:

====================
net: dsa: remove validate method

These three patches remove DSA's phylink .validate method which becomes
unnecessary once the last two drivers provide phylink capabilities,
which this patch set adds. Both of these are best guesses.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Oct 11, 2023
2 parents 9bae5b0 + 63b9f7a commit 0c2d3ff
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 15 deletions.
9 changes: 9 additions & 0 deletions drivers/net/dsa/dsa_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,14 @@ static int dsa_loop_port_max_mtu(struct dsa_switch *ds, int port)
return ETH_MAX_MTU;
}

static void dsa_loop_phylink_get_caps(struct dsa_switch *dsa, int port,
struct phylink_config *config)
{
bitmap_fill(config->supported_interfaces, PHY_INTERFACE_MODE_MAX);
__clear_bit(PHY_INTERFACE_MODE_NA, config->supported_interfaces);
config->mac_capabilities = ~0;
}

static const struct dsa_switch_ops dsa_loop_driver = {
.get_tag_protocol = dsa_loop_get_protocol,
.setup = dsa_loop_setup,
Expand All @@ -295,6 +303,7 @@ static const struct dsa_switch_ops dsa_loop_driver = {
.port_vlan_del = dsa_loop_port_vlan_del,
.port_change_mtu = dsa_loop_port_change_mtu,
.port_max_mtu = dsa_loop_port_max_mtu,
.phylink_get_caps = dsa_loop_phylink_get_caps,
};

static int dsa_loop_drv_probe(struct mdio_device *mdiodev)
Expand Down
26 changes: 26 additions & 0 deletions drivers/net/dsa/vitesse-vsc73xx-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,31 @@ static int vsc73xx_get_max_mtu(struct dsa_switch *ds, int port)
return 9600 - ETH_HLEN - ETH_FCS_LEN;
}

static void vsc73xx_phylink_get_caps(struct dsa_switch *dsa, int port,
struct phylink_config *config)
{
unsigned long *interfaces = config->supported_interfaces;

if (port == 5)
return;

if (port == CPU_PORT) {
__set_bit(PHY_INTERFACE_MODE_MII, interfaces);
__set_bit(PHY_INTERFACE_MODE_REVMII, interfaces);
__set_bit(PHY_INTERFACE_MODE_GMII, interfaces);
__set_bit(PHY_INTERFACE_MODE_RGMII, interfaces);
}

if (port <= 4) {
/* Internal PHYs */
__set_bit(PHY_INTERFACE_MODE_INTERNAL, interfaces);
/* phylib default */
__set_bit(PHY_INTERFACE_MODE_GMII, interfaces);
}

config->mac_capabilities = MAC_SYM_PAUSE | MAC_10 | MAC_100 | MAC_1000;
}

static const struct dsa_switch_ops vsc73xx_ds_ops = {
.get_tag_protocol = vsc73xx_get_tag_protocol,
.setup = vsc73xx_setup,
Expand All @@ -1050,6 +1075,7 @@ static const struct dsa_switch_ops vsc73xx_ds_ops = {
.port_disable = vsc73xx_port_disable,
.port_change_mtu = vsc73xx_change_mtu,
.port_max_mtu = vsc73xx_get_max_mtu,
.phylink_get_caps = vsc73xx_phylink_get_caps,
};

static int vsc73xx_gpio_get(struct gpio_chip *chip, unsigned int offset)
Expand Down
15 changes: 0 additions & 15 deletions net/dsa/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -1554,20 +1554,6 @@ static struct phy_device *dsa_port_get_phy_device(struct dsa_port *dp)
return phydev;
}

static void dsa_port_phylink_validate(struct phylink_config *config,
unsigned long *supported,
struct phylink_link_state *state)
{
/* Skip call for drivers which don't yet set mac_capabilities,
* since validating in that case would mean their PHY will advertise
* nothing. In turn, skipping validation makes them advertise
* everything that the PHY supports, so those drivers should be
* converted ASAP.
*/
if (config->mac_capabilities)
phylink_generic_validate(config, supported, state);
}

static struct phylink_pcs *
dsa_port_phylink_mac_select_pcs(struct phylink_config *config,
phy_interface_t interface)
Expand Down Expand Up @@ -1666,7 +1652,6 @@ static void dsa_port_phylink_mac_link_up(struct phylink_config *config,
}

static const struct phylink_mac_ops dsa_port_phylink_mac_ops = {
.validate = dsa_port_phylink_validate,
.mac_select_pcs = dsa_port_phylink_mac_select_pcs,
.mac_prepare = dsa_port_phylink_mac_prepare,
.mac_config = dsa_port_phylink_mac_config,
Expand Down

0 comments on commit 0c2d3ff

Please sign in to comment.