2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-15 16:53:54 +08:00

net: dsa: Copy the routing table into the switch structure

The new binding will not have a chip data structure, it will place the
routing directly into the switch structure. To enable backwards
compatibility, copy the routing from the chip data into the switch
structure.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Andrew Lunn 2016-06-04 21:17:00 +02:00 committed by David S. Miller
parent 4a7704ffa8
commit 66472fc04e
3 changed files with 12 additions and 3 deletions

View File

@ -3024,8 +3024,8 @@ static int mv88e6xxx_setup_global(struct mv88e6xxx_priv_state *ps)
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {
int nexthop = 0x1f; int nexthop = 0x1f;
if (i != ps->ds->index && i < ps->ds->dst->pd->nr_chips) if (i != ds->index && i < DSA_MAX_SWITCHES)
nexthop = ps->ds->cd->rtable[i] & 0x1f; nexthop = ds->rtable[i] & 0x1f;
err = _mv88e6xxx_reg_write( err = _mv88e6xxx_reg_write(
ps, REG_GLOBAL2, ps, REG_GLOBAL2,

View File

@ -148,6 +148,13 @@ struct dsa_switch {
*/ */
struct dsa_switch_driver *drv; struct dsa_switch_driver *drv;
/*
* An array of which element [a] indicates which port on this
* switch should be used to send packets to that are destined
* for switch a. Can be NULL if there is only one switch chip.
*/
s8 rtable[DSA_MAX_SWITCHES];
#ifdef CONFIG_NET_DSA_HWMON #ifdef CONFIG_NET_DSA_HWMON
/* /*
* Hardware monitoring information * Hardware monitoring information
@ -194,7 +201,7 @@ static inline u8 dsa_upstream_port(struct dsa_switch *ds)
if (dst->cpu_switch == ds->index) if (dst->cpu_switch == ds->index)
return dst->cpu_port; return dst->cpu_port;
else else
return ds->cd->rtable[dst->cpu_switch]; return ds->rtable[dst->cpu_switch];
} }
struct switchdev_trans; struct switchdev_trans;

View File

@ -297,6 +297,8 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
dst->tag_protocol = drv->tag_protocol; dst->tag_protocol = drv->tag_protocol;
} }
memcpy(ds->rtable, cd->rtable, sizeof(ds->rtable));
/* /*
* Do basic register setup. * Do basic register setup.
*/ */