Commit e84665c9 authored by Lennert Buytenhek's avatar Lennert Buytenhek Committed by David S. Miller

dsa: add switch chip cascading support

The initial version of the DSA driver only supported a single switch
chip per network interface, while DSA-capable switch chips can be
interconnected to form a tree of switch chips.  This patch adds support
for multiple switch chips on a network interface.

An example topology for a 16-port device with an embedded CPU is as
follows:

	+-----+          +--------+       +--------+
	|     |eth0    10| switch |9    10| switch |
	| CPU +----------+        +-------+        |
	|     |          | chip 0 |       | chip 1 |
	+-----+          +---++---+       +---++---+
	                     ||               ||
	                     ||               ||
	                     ||1000baseT      ||1000baseT
	                     ||ports 1-8      ||ports 9-16

This requires a couple of interdependent changes in the DSA layer:

- The dsa platform driver data needs to be extended: there is still
  only one netdevice per DSA driver instance (eth0 in the example
  above), but each of the switch chips in the tree needs its own
  mii_bus device pointer, MII management bus address, and port name
  array. (include/net/dsa.h)  The existing in-tree dsa users need
  some small changes to deal with this. (arch/arm)

- The DSA and Ethertype DSA tagging modules need to be extended to
  use the DSA device ID field on receive and demultiplex the packet
  accordingly, and fill in the DSA device ID field on transmit
  according to which switch chip the packet is heading to.
  (net/dsa/tag_{dsa,edsa}.c)

- The concept of "CPU port", which is the switch chip port that the
  CPU is connected to (port 10 on switch chip 0 in the example), needs
  to be extended with the concept of "upstream port", which is the
  port on the switch chip that will bring us one hop closer to the CPU
  (port 10 for both switch chips in the example above).

- The dsa platform data needs to specify which ports on which switch
  chips are links to other switch chips, so that we can enable DSA
  tagging mode on them.  (For inter-switch links, we always use
  non-EtherType DSA tagging, since it has lower overhead.  The CPU
  link uses dsa or edsa tagging depending on what the 'root' switch
  chip supports.)  This is done by specifying "dsa" for the given
  port in the port array.

- The dsa platform data needs to be extended with information on via
  which port to reach any given switch chip from any given switch chip.
  This info is specified via the per-switch chip data struct ->rtable[]
  array, which gives the nexthop ports for each of the other switches
  in the tree.

For the example topology above, the dsa platform data would look
something like this:

	static struct dsa_chip_data sw[2] = {
		{
			.mii_bus	= &foo,
			.sw_addr	= 1,
			.port_names[0]	= "p1",
			.port_names[1]	= "p2",
			.port_names[2]	= "p3",
			.port_names[3]	= "p4",
			.port_names[4]	= "p5",
			.port_names[5]	= "p6",
			.port_names[6]	= "p7",
			.port_names[7]	= "p8",
			.port_names[9]	= "dsa",
			.port_names[10]	= "cpu",
			.rtable		= (s8 []){ -1, 9, },
		}, {
			.mii_bus	= &foo,
			.sw_addr	= 2,
			.port_names[0]	= "p9",
			.port_names[1]	= "p10",
			.port_names[2]	= "p11",
			.port_names[3]	= "p12",
			.port_names[4]	= "p13",
			.port_names[5]	= "p14",
			.port_names[6]	= "p15",
			.port_names[7]	= "p16",
			.port_names[10]	= "dsa",
			.rtable		= (s8 []){ 10, -1, },
		},
	},

	static struct dsa_platform_data pd = {
		.netdev		= &foo,
		.nr_switches	= 2,
		.sw		= sw,
	};
Signed-off-by: default avatarLennert Buytenhek <buytenh@marvell.com>
Tested-by: default avatarGary Thomas <gary@mlbassoc.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 076d3e10
......@@ -231,14 +231,17 @@ static struct platform_device kirkwood_switch_device = {
void __init kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq)
{
int i;
if (irq != NO_IRQ) {
kirkwood_switch_resources[0].start = irq;
kirkwood_switch_resources[0].end = irq;
kirkwood_switch_device.num_resources = 1;
}
d->mii_bus = &kirkwood_ge00_shared.dev;
d->netdev = &kirkwood_ge00.dev;
for (i = 0; i < d->nr_chips; i++)
d->chip[i].mii_bus = &kirkwood_ge00_shared.dev;
kirkwood_switch_device.dev.platform_data = d;
platform_device_register(&kirkwood_switch_device);
......
......@@ -75,7 +75,7 @@ static struct mv643xx_eth_platform_data rd88f6281_ge00_data = {
.duplex = DUPLEX_FULL,
};
static struct dsa_platform_data rd88f6281_switch_data = {
static struct dsa_chip_data rd88f6281_switch_chip_data = {
.port_names[0] = "lan1",
.port_names[1] = "lan2",
.port_names[2] = "lan3",
......@@ -83,6 +83,11 @@ static struct dsa_platform_data rd88f6281_switch_data = {
.port_names[5] = "cpu",
};
static struct dsa_platform_data rd88f6281_switch_plat_data = {
.nr_chips = 1,
.chip = &rd88f6281_switch_chip_data,
};
static struct mv643xx_eth_platform_data rd88f6281_ge01_data = {
.phy_addr = MV643XX_ETH_PHY_ADDR(11),
};
......@@ -105,12 +110,12 @@ static void __init rd88f6281_init(void)
kirkwood_ge00_init(&rd88f6281_ge00_data);
kirkwood_pcie_id(&dev, &rev);
if (rev == MV88F6281_REV_A0) {
rd88f6281_switch_data.sw_addr = 10;
rd88f6281_switch_chip_data.sw_addr = 10;
kirkwood_ge01_init(&rd88f6281_ge01_data);
} else {
rd88f6281_switch_data.port_names[4] = "wan";
rd88f6281_switch_chip_data.port_names[4] = "wan";
}
kirkwood_ge00_switch_init(&rd88f6281_switch_data, NO_IRQ);
kirkwood_ge00_switch_init(&rd88f6281_switch_plat_data, NO_IRQ);
kirkwood_rtc_init();
kirkwood_sata_init(&rd88f6281_sata_data);
......
......@@ -219,14 +219,17 @@ static struct platform_device orion5x_switch_device = {
void __init orion5x_eth_switch_init(struct dsa_platform_data *d, int irq)
{
int i;
if (irq != NO_IRQ) {
orion5x_switch_resources[0].start = irq;
orion5x_switch_resources[0].end = irq;
orion5x_switch_device.num_resources = 1;
}
d->mii_bus = &orion5x_eth_shared.dev;
d->netdev = &orion5x_eth.dev;
for (i = 0; i < d->nr_chips; i++)
d->chip[i].mii_bus = &orion5x_eth_shared.dev;
orion5x_switch_device.dev.platform_data = d;
platform_device_register(&orion5x_switch_device);
......
......@@ -94,7 +94,7 @@ static struct mv643xx_eth_platform_data rd88f5181l_fxo_eth_data = {
.duplex = DUPLEX_FULL,
};
static struct dsa_platform_data rd88f5181l_fxo_switch_data = {
static struct dsa_chip_data rd88f5181l_fxo_switch_chip_data = {
.port_names[0] = "lan2",
.port_names[1] = "lan1",
.port_names[2] = "wan",
......@@ -103,6 +103,11 @@ static struct dsa_platform_data rd88f5181l_fxo_switch_data = {
.port_names[7] = "lan3",
};
static struct dsa_platform_data rd88f5181l_fxo_switch_plat_data = {
.nr_chips = 1,
.chip = &rd88f5181l_fxo_switch_chip_data,
};
static void __init rd88f5181l_fxo_init(void)
{
/*
......@@ -117,7 +122,7 @@ static void __init rd88f5181l_fxo_init(void)
*/
orion5x_ehci0_init();
orion5x_eth_init(&rd88f5181l_fxo_eth_data);
orion5x_eth_switch_init(&rd88f5181l_fxo_switch_data, NO_IRQ);
orion5x_eth_switch_init(&rd88f5181l_fxo_switch_plat_data, NO_IRQ);
orion5x_uart0_init();
orion5x_setup_dev_boot_win(RD88F5181L_FXO_NOR_BOOT_BASE,
......
......@@ -95,7 +95,7 @@ static struct mv643xx_eth_platform_data rd88f5181l_ge_eth_data = {
.duplex = DUPLEX_FULL,
};
static struct dsa_platform_data rd88f5181l_ge_switch_data = {
static struct dsa_chip_data rd88f5181l_ge_switch_chip_data = {
.port_names[0] = "lan2",
.port_names[1] = "lan1",
.port_names[2] = "wan",
......@@ -104,6 +104,11 @@ static struct dsa_platform_data rd88f5181l_ge_switch_data = {
.port_names[7] = "lan3",
};
static struct dsa_platform_data rd88f5181l_ge_switch_plat_data = {
.nr_chips = 1,
.chip = &rd88f5181l_ge_switch_chip_data,
};
static struct i2c_board_info __initdata rd88f5181l_ge_i2c_rtc = {
I2C_BOARD_INFO("ds1338", 0x68),
};
......@@ -122,7 +127,8 @@ static void __init rd88f5181l_ge_init(void)
*/
orion5x_ehci0_init();
orion5x_eth_init(&rd88f5181l_ge_eth_data);
orion5x_eth_switch_init(&rd88f5181l_ge_switch_data, gpio_to_irq(8));
orion5x_eth_switch_init(&rd88f5181l_ge_switch_plat_data,
gpio_to_irq(8));
orion5x_i2c_init();
orion5x_uart0_init();
......
......@@ -35,7 +35,7 @@ static struct mv643xx_eth_platform_data rd88f6183ap_ge_eth_data = {
.duplex = DUPLEX_FULL,
};
static struct dsa_platform_data rd88f6183ap_ge_switch_data = {
static struct dsa_chip_data rd88f6183ap_ge_switch_chip_data = {
.port_names[0] = "lan1",
.port_names[1] = "lan2",
.port_names[2] = "lan3",
......@@ -44,6 +44,11 @@ static struct dsa_platform_data rd88f6183ap_ge_switch_data = {
.port_names[5] = "cpu",
};
static struct dsa_platform_data rd88f6183ap_ge_switch_plat_data = {
.nr_chips = 1,
.chip = &rd88f6183ap_ge_switch_chip_data,
};
static struct mtd_partition rd88f6183ap_ge_partitions[] = {
{
.name = "kernel",
......@@ -89,7 +94,8 @@ static void __init rd88f6183ap_ge_init(void)
*/
orion5x_ehci0_init();
orion5x_eth_init(&rd88f6183ap_ge_eth_data);
orion5x_eth_switch_init(&rd88f6183ap_ge_switch_data, gpio_to_irq(3));
orion5x_eth_switch_init(&rd88f6183ap_ge_switch_plat_data,
gpio_to_irq(3));
spi_register_board_info(rd88f6183ap_ge_spi_slave_info,
ARRAY_SIZE(rd88f6183ap_ge_spi_slave_info));
orion5x_spi_init();
......
......@@ -106,7 +106,7 @@ static struct mv643xx_eth_platform_data wrt350n_v2_eth_data = {
.duplex = DUPLEX_FULL,
};
static struct dsa_platform_data wrt350n_v2_switch_data = {
static struct dsa_chip_data wrt350n_v2_switch_chip_data = {
.port_names[0] = "lan2",
.port_names[1] = "lan1",
.port_names[2] = "wan",
......@@ -115,6 +115,11 @@ static struct dsa_platform_data wrt350n_v2_switch_data = {
.port_names[7] = "lan4",
};
static struct dsa_platform_data wrt350n_v2_switch_plat_data = {
.nr_chips = 1,
.chip = &wrt350n_v2_switch_chip_data,
};
static void __init wrt350n_v2_init(void)
{
/*
......@@ -129,7 +134,7 @@ static void __init wrt350n_v2_init(void)
*/
orion5x_ehci0_init();
orion5x_eth_init(&wrt350n_v2_eth_data);
orion5x_eth_switch_init(&wrt350n_v2_switch_data, NO_IRQ);
orion5x_eth_switch_init(&wrt350n_v2_switch_plat_data, NO_IRQ);
orion5x_uart0_init();
orion5x_setup_dev_boot_win(WRT350N_V2_NOR_BOOT_BASE,
......
/*
* include/net/dsa.h - Driver for Distributed Switch Architecture switch chips
* Copyright (c) 2008 Marvell Semiconductor
* Copyright (c) 2008-2009 Marvell Semiconductor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -11,23 +11,47 @@
#ifndef __LINUX_NET_DSA_H
#define __LINUX_NET_DSA_H
#define DSA_MAX_PORTS 12
#define DSA_MAX_SWITCHES 4
#define DSA_MAX_PORTS 12
struct dsa_chip_data {
/*
* How to access the switch configuration registers.
*/
struct device *mii_bus;
int sw_addr;
/*
* The names of the switch's ports. Use "cpu" to
* designate the switch port that the cpu is connected to,
* "dsa" to indicate that this port is a DSA link to
* another switch, NULL to indicate the port is unused,
* or any other string to indicate this is a physical port.
*/
char *port_names[DSA_MAX_PORTS];
/*
* An array (with nr_chips elements) 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;
};
struct dsa_platform_data {
/*
* Reference to a Linux network interface that connects
* to the switch chip.
* to the root switch chip of the tree.
*/
struct device *netdev;
/*
* How to access the switch configuration registers, and
* the names of the switch ports (use "cpu" to designate
* the switch port that the cpu is connected to).
* Info structs describing each of the switch chips
* connected via this network interface.
*/
struct device *mii_bus;
int sw_addr;
char *port_names[DSA_MAX_PORTS];
int nr_chips;
struct dsa_chip_data *chip;
};
extern bool dsa_uses_dsa_tags(void *dsa_ptr);
......
/*
* net/dsa/dsa.c - Hardware switch handling
* Copyright (c) 2008 Marvell Semiconductor
* Copyright (c) 2008-2009 Marvell Semiconductor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -67,12 +67,13 @@ dsa_switch_probe(struct mii_bus *bus, int sw_addr, char **_name)
/* basic switch operations **************************************************/
static struct dsa_switch *
dsa_switch_setup(struct device *parent, struct dsa_platform_data *pd,
struct mii_bus *bus, struct net_device *dev)
dsa_switch_setup(struct dsa_switch_tree *dst, int index,
struct device *parent, struct mii_bus *bus)
{
struct dsa_chip_data *pd = dst->pd->chip + index;
struct dsa_switch_driver *drv;
struct dsa_switch *ds;
int ret;
struct dsa_switch_driver *drv;
char *name;
int i;
......@@ -81,11 +82,12 @@ dsa_switch_setup(struct device *parent, struct dsa_platform_data *pd,
*/
drv = dsa_switch_probe(bus, pd->sw_addr, &name);
if (drv == NULL) {
printk(KERN_ERR "%s: could not detect attached switch\n",
dev->name);
printk(KERN_ERR "%s[%d]: could not detect attached switch\n",
dst->master_netdev->name, index);
return ERR_PTR(-EINVAL);
}
printk(KERN_INFO "%s: detected a %s switch\n", dev->name, name);
printk(KERN_INFO "%s[%d]: detected a %s switch\n",
dst->master_netdev->name, index, name);
/*
......@@ -95,18 +97,16 @@ dsa_switch_setup(struct device *parent, struct dsa_platform_data *pd,
if (ds == NULL)
return ERR_PTR(-ENOMEM);
ds->pd = pd;
ds->master_netdev = dev;
ds->master_mii_bus = bus;
ds->dst = dst;
ds->index = index;
ds->pd = dst->pd->chip + index;
ds->drv = drv;
ds->tag_protocol = drv->tag_protocol;
ds->master_mii_bus = bus;
/*
* Validate supplied switch configuration.
*/
ds->cpu_port = -1;
for (i = 0; i < DSA_MAX_PORTS; i++) {
char *name;
......@@ -115,32 +115,28 @@ dsa_switch_setup(struct device *parent, struct dsa_platform_data *pd,
continue;
if (!strcmp(name, "cpu")) {
if (ds->cpu_port != -1) {
if (dst->cpu_switch != -1) {
printk(KERN_ERR "multiple cpu ports?!\n");
ret = -EINVAL;
goto out;
}
ds->cpu_port = i;
dst->cpu_switch = index;
dst->cpu_port = i;
} else if (!strcmp(name, "dsa")) {
ds->dsa_port_mask |= 1 << i;
} else {
ds->valid_port_mask |= 1 << i;
ds->phys_port_mask |= 1 << i;
}
}
if (ds->cpu_port == -1) {
printk(KERN_ERR "no cpu port?!\n");
ret = -EINVAL;
goto out;
}
/*
* If we use a tagging format that doesn't have an ethertype
* field, make sure that all packets from this point on get
* sent to the tag format's receive function. (Which will
* discard received packets until we set ds->ports[] below.)
* If the CPU connects to this switch, set the switch tree
* tagging protocol to the preferred tagging format of this
* switch.
*/
wmb();
dev->dsa_ptr = (void *)ds;
if (ds->dst->cpu_switch == index)
ds->dst->tag_protocol = drv->tag_protocol;
/*
......@@ -150,7 +146,7 @@ dsa_switch_setup(struct device *parent, struct dsa_platform_data *pd,
if (ret < 0)
goto out;
ret = drv->set_addr(ds, dev->dev_addr);
ret = drv->set_addr(ds, dst->master_netdev->dev_addr);
if (ret < 0)
goto out;
......@@ -169,18 +165,18 @@ dsa_switch_setup(struct device *parent, struct dsa_platform_data *pd,
/*
* Create network devices for physical switch ports.
*/
wmb();
for (i = 0; i < DSA_MAX_PORTS; i++) {
struct net_device *slave_dev;
if (!(ds->valid_port_mask & (1 << i)))
if (!(ds->phys_port_mask & (1 << i)))
continue;
slave_dev = dsa_slave_create(ds, parent, i, pd->port_names[i]);
if (slave_dev == NULL) {
printk(KERN_ERR "%s: can't create dsa slave "
"device for port %d(%s)\n",
dev->name, i, pd->port_names[i]);
printk(KERN_ERR "%s[%d]: can't create dsa "
"slave device for port %d(%s)\n",
dst->master_netdev->name,
index, i, pd->port_names[i]);
continue;
}
......@@ -192,7 +188,6 @@ dsa_switch_setup(struct device *parent, struct dsa_platform_data *pd,
out_free:
mdiobus_free(ds->slave_mii_bus);
out:
dev->dsa_ptr = NULL;
kfree(ds);
return ERR_PTR(ret);
}
......@@ -212,35 +207,42 @@ static void dsa_switch_destroy(struct dsa_switch *ds)
*/
bool dsa_uses_dsa_tags(void *dsa_ptr)
{
struct dsa_switch *ds = dsa_ptr;
struct dsa_switch_tree *dst = dsa_ptr;
return !!(ds->tag_protocol == htons(ETH_P_DSA));
return !!(dst->tag_protocol == htons(ETH_P_DSA));
}
bool dsa_uses_trailer_tags(void *dsa_ptr)
{
struct dsa_switch *ds = dsa_ptr;
struct dsa_switch_tree *dst = dsa_ptr;
return !!(ds->tag_protocol == htons(ETH_P_TRAILER));
return !!(dst->tag_protocol == htons(ETH_P_TRAILER));
}
/* link polling *************************************************************/
static void dsa_link_poll_work(struct work_struct *ugly)
{
struct dsa_switch *ds;
struct dsa_switch_tree *dst;
int i;
dst = container_of(ugly, struct dsa_switch_tree, link_poll_work);
ds = container_of(ugly, struct dsa_switch, link_poll_work);
for (i = 0; i < dst->pd->nr_chips; i++) {
struct dsa_switch *ds = dst->ds[i];
ds->drv->poll_link(ds);
mod_timer(&ds->link_poll_timer, round_jiffies(jiffies + HZ));
if (ds != NULL && ds->drv->poll_link != NULL)
ds->drv->poll_link(ds);
}
mod_timer(&dst->link_poll_timer, round_jiffies(jiffies + HZ));
}
static void dsa_link_poll_timer(unsigned long _ds)
static void dsa_link_poll_timer(unsigned long _dst)
{
struct dsa_switch *ds = (void *)_ds;
struct dsa_switch_tree *dst = (void *)_dst;
schedule_work(&ds->link_poll_work);
schedule_work(&dst->link_poll_work);
}
......@@ -303,18 +305,14 @@ static int dsa_probe(struct platform_device *pdev)
static int dsa_version_printed;
struct dsa_platform_data *pd = pdev->dev.platform_data;
struct net_device *dev;
struct mii_bus *bus;
struct dsa_switch *ds;
struct dsa_switch_tree *dst;
int i;
if (!dsa_version_printed++)
printk(KERN_NOTICE "Distributed Switch Architecture "
"driver version %s\n", dsa_driver_version);
if (pd == NULL || pd->mii_bus == NULL || pd->netdev == NULL)
return -EINVAL;
bus = dev_to_mii_bus(pd->mii_bus);
if (bus == NULL)
if (pd == NULL || pd->netdev == NULL)
return -EINVAL;
dev = dev_to_net_device(pd->netdev);
......@@ -326,36 +324,79 @@ static int dsa_probe(struct platform_device *pdev)
return -EEXIST;
}
ds = dsa_switch_setup(&pdev->dev, pd, bus, dev);
if (IS_ERR(ds)) {
dst = kzalloc(sizeof(*dst), GFP_KERNEL);
if (dst == NULL) {
dev_put(dev);
return PTR_ERR(ds);
return -ENOMEM;
}
if (ds->drv->poll_link != NULL) {
INIT_WORK(&ds->link_poll_work, dsa_link_poll_work);
init_timer(&ds->link_poll_timer);
ds->link_poll_timer.data = (unsigned long)ds;
ds->link_poll_timer.function = dsa_link_poll_timer;
ds->link_poll_timer.expires = round_jiffies(jiffies + HZ);
add_timer(&ds->link_poll_timer);
platform_set_drvdata(pdev, dst);
dst->pd = pd;
dst->master_netdev = dev;
dst->cpu_switch = -1;
dst->cpu_port = -1;
for (i = 0; i < pd->nr_chips; i++) {
struct mii_bus *bus;
struct dsa_switch *ds;
bus = dev_to_mii_bus(pd->chip[i].mii_bus);
if (bus == NULL) {
printk(KERN_ERR "%s[%d]: no mii bus found for "
"dsa switch\n", dev->name, i);
continue;
}
ds = dsa_switch_setup(dst, i, &pdev->dev, bus);
if (IS_ERR(ds)) {
printk(KERN_ERR "%s[%d]: couldn't create dsa switch "
"instance (error %ld)\n", dev->name, i,
PTR_ERR(ds));
continue;
}
dst->ds[i] = ds;
if (ds->drv->poll_link != NULL)
dst->link_poll_needed = 1;
}
platform_set_drvdata(pdev, ds);
/*
* If we use a tagging format that doesn't have an ethertype
* field, make sure that all packets from this point on get
* sent to the tag format's receive function.
*/
wmb();
dev->dsa_ptr = (void *)dst;
if (dst->link_poll_needed) {
INIT_WORK(&dst->link_poll_work, dsa_link_poll_work);
init_timer(&dst->link_poll_timer);
dst->link_poll_timer.data = (unsigned long)dst;
dst->link_poll_timer.function = dsa_link_poll_timer;
dst->link_poll_timer.expires = round_jiffies(jiffies + HZ);
add_timer(&dst->link_poll_timer);
}
return 0;
}
static int dsa_remove(struct platform_device *pdev)
{
struct dsa_switch *ds = platform_get_drvdata(pdev);
struct dsa_switch_tree *dst = platform_get_drvdata(pdev);
int i;
if (ds->drv->poll_link != NULL)
del_timer_sync(&ds->link_poll_timer);
if (dst->link_poll_needed)
del_timer_sync(&dst->link_poll_timer);
flush_scheduled_work();
dsa_switch_destroy(ds);
for (i = 0; i < dst->pd->nr_chips; i++) {
struct dsa_switch *ds = dst->ds[i];
if (ds != NULL)
dsa_switch_destroy(ds);
}
return 0;
}
......
/*
* net/dsa/dsa_priv.h - Hardware switch handling
* Copyright (c) 2008 Marvell Semiconductor
* Copyright (c) 2008-2009 Marvell Semiconductor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -19,42 +19,107 @@
struct dsa_switch {
/*
* Configuration data for the platform device that owns
* this dsa switch instance.
* Parent switch tree, and switch index.
*/
struct dsa_platform_data *pd;
struct dsa_switch_tree *dst;
int index;
/*
* References to network device and mii bus to use.
* Configuration data for this switch.
*/
struct net_device *master_netdev;
struct mii_bus *master_mii_bus;
struct dsa_chip_data *pd;
/*
* The used switch driver and frame tagging type.
* The used switch driver.
*/
struct dsa_switch_driver *drv;
__be16 tag_protocol;
/*
* Reference to mii bus to use.
*/
struct mii_bus *master_mii_bus;
/*
* Slave mii_bus and devices for the individual ports.
*/
int cpu_port;
u32 valid_port_mask;
struct mii_bus *slave_mii_bus;
struct net_device *ports[DSA_MAX_PORTS];
u32 dsa_port_mask;
u32 phys_port_mask;
struct mii_bus *slave_mii_bus;
struct net_device *ports[DSA_MAX_PORTS];
};
struct dsa_switch_tree {
/*
* Configuration data for the platform device that owns
* this dsa switch tree instance.
*/
struct dsa_platform_data *pd;
/*
* Reference to network device to use, and which tagging
* protocol to use.
*/
struct net_device *master_netdev;
__be16 tag_protocol;
/*
* The switch and port to which the CPU is attached.