Skip to content

Commit 46efe4e

Browse files
vladimirolteandavem330
authored andcommitted
net: dsa: felix: stop calling ocelot_port_{enable,disable}
ocelot_port_enable touches ANA_PORT_PORT_CFG, which has the following fields: - LOCKED_PORTMOVE_CPU, LEARNDROP, LEARNCPU, LEARNAUTO, RECV_ENA, all of which are written with their hardware default values, also runtime invariants. So it makes no sense to write these during every .ndo_open. - PORTID_VAL: this field has an out-of-reset value of zero for all ports and must be initialized by software. Additionally, the ocelot_setup_logical_port_ids() code path sets up different logical port IDs for the ports in a hardware LAG, and we absolutely don't want .ndo_open to interfere there and reset those values. So in fact the write from ocelot_port_enable can better be moved to ocelot_init_port, and the .ndo_open hook deleted. ocelot_port_disable touches DEV_MAC_ENA_CFG and QSYS_SWITCH_PORT_MODE_PORT_ENA, in an attempt to undo what ocelot_adjust_link did. But since .ndo_stop does not get called each time the link falls (i.e. this isn't a substitute for .phylink_mac_link_down), felix already does better at this by writing those registers already in felix_phylink_mac_link_down. So keep ocelot_port_disable (for now, until ocelot is converted to phylink too), and just delete the felix call to it, which is not necessary. Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e871ee6 commit 46efe4e

File tree

4 files changed

+9
-38
lines changed

4 files changed

+9
-38
lines changed

drivers/net/dsa/ocelot/felix.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -796,23 +796,6 @@ static int felix_vlan_del(struct dsa_switch *ds, int port,
796796
return ocelot_vlan_del(ocelot, port, vlan->vid);
797797
}
798798

799-
static int felix_port_enable(struct dsa_switch *ds, int port,
800-
struct phy_device *phy)
801-
{
802-
struct ocelot *ocelot = ds->priv;
803-
804-
ocelot_port_enable(ocelot, port, phy);
805-
806-
return 0;
807-
}
808-
809-
static void felix_port_disable(struct dsa_switch *ds, int port)
810-
{
811-
struct ocelot *ocelot = ds->priv;
812-
813-
return ocelot_port_disable(ocelot, port);
814-
}
815-
816799
static void felix_phylink_validate(struct dsa_switch *ds, int port,
817800
unsigned long *supported,
818801
struct phylink_link_state *state)
@@ -1615,8 +1598,6 @@ const struct dsa_switch_ops felix_switch_ops = {
16151598
.phylink_mac_config = felix_phylink_mac_config,
16161599
.phylink_mac_link_down = felix_phylink_mac_link_down,
16171600
.phylink_mac_link_up = felix_phylink_mac_link_up,
1618-
.port_enable = felix_port_enable,
1619-
.port_disable = felix_port_disable,
16201601
.port_fdb_dump = felix_fdb_dump,
16211602
.port_fdb_add = felix_fdb_add,
16221603
.port_fdb_del = felix_fdb_del,

drivers/net/ethernet/mscc/ocelot.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -514,19 +514,6 @@ void ocelot_adjust_link(struct ocelot *ocelot, int port,
514514
}
515515
EXPORT_SYMBOL(ocelot_adjust_link);
516516

517-
void ocelot_port_enable(struct ocelot *ocelot, int port,
518-
struct phy_device *phy)
519-
{
520-
/* Enable receiving frames on the port, and activate auto-learning of
521-
* MAC addresses.
522-
*/
523-
ocelot_write_gix(ocelot, ANA_PORT_PORT_CFG_LEARNAUTO |
524-
ANA_PORT_PORT_CFG_RECV_ENA |
525-
ANA_PORT_PORT_CFG_PORTID_VAL(port),
526-
ANA_PORT_PORT_CFG, port);
527-
}
528-
EXPORT_SYMBOL(ocelot_port_enable);
529-
530517
void ocelot_port_disable(struct ocelot *ocelot, int port)
531518
{
532519
struct ocelot_port *ocelot_port = ocelot->ports[port];
@@ -1956,6 +1943,15 @@ void ocelot_init_port(struct ocelot *ocelot, int port)
19561943
/* Disable source address learning for standalone mode */
19571944
ocelot_port_set_learning(ocelot, port, false);
19581945

1946+
/* Set the port's initial logical port ID value, enable receiving
1947+
* frames on it, and configure the MAC address learning type to
1948+
* automatic.
1949+
*/
1950+
ocelot_write_gix(ocelot, ANA_PORT_PORT_CFG_LEARNAUTO |
1951+
ANA_PORT_PORT_CFG_RECV_ENA |
1952+
ANA_PORT_PORT_CFG_PORTID_VAL(port),
1953+
ANA_PORT_PORT_CFG, port);
1954+
19591955
/* Enable vcap lookups */
19601956
ocelot_vcap_enable(ocelot, port);
19611957
}

drivers/net/ethernet/mscc/ocelot_net.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,6 @@ static int ocelot_port_open(struct net_device *dev)
449449
{
450450
struct ocelot_port_private *priv = netdev_priv(dev);
451451
struct ocelot_port *ocelot_port = &priv->port;
452-
struct ocelot *ocelot = ocelot_port->ocelot;
453-
int port = priv->chip_port;
454452
int err;
455453

456454
if (priv->serdes) {
@@ -474,8 +472,6 @@ static int ocelot_port_open(struct net_device *dev)
474472
phy_attached_info(priv->phy);
475473
phy_start(priv->phy);
476474

477-
ocelot_port_enable(ocelot, port, priv->phy);
478-
479475
return 0;
480476
}
481477

include/soc/mscc/ocelot.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -798,8 +798,6 @@ void ocelot_init_port(struct ocelot *ocelot, int port);
798798
void ocelot_deinit_port(struct ocelot *ocelot, int port);
799799

800800
/* DSA callbacks */
801-
void ocelot_port_enable(struct ocelot *ocelot, int port,
802-
struct phy_device *phy);
803801
void ocelot_port_disable(struct ocelot *ocelot, int port);
804802
void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data);
805803
void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data);

0 commit comments

Comments
 (0)