Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8b0d3ea5 authored by Vivien Didelot's avatar Vivien Didelot Committed by David S. Miller
Browse files

net: dsa: store CPU port pointer in the tree



A dsa_switch_tree instance holds a dsa_switch pointer and a port index
to identify the switch port to which the CPU is attached.

Now that the DSA layer has a dsa_port structure to hold this data, use
it to point the switch CPU port.

This patch simply substitutes s/dst->cpu_switch/dst->cpu_dp->ds/ and
s/dst->cpu_port/dst->cpu_dp->index/.

Signed-off-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 631581bf
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1344,7 +1344,7 @@ EXPORT_SYMBOL(b53_fdb_dump);
int b53_br_join(struct dsa_switch *ds, int port, struct net_device *br)
{
	struct b53_device *dev = ds->priv;
	s8 cpu_port = ds->dst->cpu_port;
	s8 cpu_port = ds->dst->cpu_dp->index;
	u16 pvlan, reg;
	unsigned int i;

@@ -1390,7 +1390,7 @@ void b53_br_leave(struct dsa_switch *ds, int port, struct net_device *br)
{
	struct b53_device *dev = ds->priv;
	struct b53_vlan *vl = &dev->vlans[0];
	s8 cpu_port = ds->dst->cpu_port;
	s8 cpu_port = ds->dst->cpu_dp->index;
	unsigned int i;
	u16 pvlan, reg, pvid;

+2 −2
Original line number Diff line number Diff line
@@ -228,7 +228,7 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port,
			      struct phy_device *phy)
{
	struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
	s8 cpu_port = ds->dst[ds->index].cpu_port;
	s8 cpu_port = ds->dst->cpu_dp->index;
	unsigned int i;
	u32 reg;

@@ -832,7 +832,7 @@ static int bcm_sf2_sw_set_wol(struct dsa_switch *ds, int port,
{
	struct net_device *p = ds->dst[ds->index].master_netdev;
	struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
	s8 cpu_port = ds->dst[ds->index].cpu_port;
	s8 cpu_port = ds->dst->cpu_dp->index;
	struct ethtool_wolinfo pwol;

	p->ethtool_ops->get_wol(p, &pwol);
+1 −1
Original line number Diff line number Diff line
@@ -176,7 +176,7 @@ static int mv88e6060_setup_port(struct dsa_switch *ds, int p)
		  ((p & 0xf) << PORT_VLAN_MAP_DBNUM_SHIFT) |
		   (dsa_is_cpu_port(ds, p) ?
			ds->enabled_port_mask :
			BIT(ds->dst->cpu_port)));
			BIT(ds->dst->cpu_dp->index)));

	/* Port Association Vector: when learning source addresses
	 * of packets, add the address to the address database using
+1 −1
Original line number Diff line number Diff line
@@ -507,7 +507,7 @@ qca8k_setup(struct dsa_switch *ds)
		pr_warn("regmap initialization failed");

	/* Initialize CPU port pad mode (xMII type, delays...) */
	phy_mode = of_get_phy_mode(ds->ports[ds->dst->cpu_port].dn);
	phy_mode = of_get_phy_mode(ds->dst->cpu_dp->dn);
	if (phy_mode < 0) {
		pr_err("Can't find phy-mode for master device\n");
		return phy_mode;
+6 −7
Original line number Diff line number Diff line
@@ -137,10 +137,9 @@ struct dsa_switch_tree {
	const struct ethtool_ops *master_orig_ethtool_ops;

	/*
	 * The switch and port to which the CPU is attached.
	 * The switch port to which the CPU is attached.
	 */
	struct dsa_switch	*cpu_switch;
	s8			cpu_port;
	struct dsa_port		*cpu_dp;

	/*
	 * Data for the individual switch chips.
@@ -251,7 +250,7 @@ struct dsa_switch {

static inline bool dsa_is_cpu_port(struct dsa_switch *ds, int p)
{
	return !!(ds == ds->dst->cpu_switch && p == ds->dst->cpu_port);
	return ds->dst->cpu_dp == &ds->ports[p];
}

static inline bool dsa_is_dsa_port(struct dsa_switch *ds, int p)
@@ -279,10 +278,10 @@ static inline u8 dsa_upstream_port(struct dsa_switch *ds)
	 * Else return the (DSA) port number that connects to the
	 * switch that is one hop closer to the cpu.
	 */
	if (dst->cpu_switch == ds)
		return dst->cpu_port;
	if (dst->cpu_dp->ds == ds)
		return dst->cpu_dp->index;
	else
		return ds->rtable[dst->cpu_switch->index];
		return ds->rtable[dst->cpu_dp->ds->index];
}

struct switchdev_trans;
Loading