alistair23-linux/arch/arm
Lennert Buytenhek e84665c9cb 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: Lennert Buytenhek <buytenh@marvell.com>
Tested-by: Gary Thomas <gary@mlbassoc.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-03-21 19:06:54 -07:00
..
boot Merge branch 'for-rmk' of git://git.kernel.org/pub/scm/linux/kernel/git/ycmiao/pxa-linux-2.6 into devel 2008-12-02 22:07:40 +00:00
common [ARM] clkdev: fix clock matching 2009-01-24 11:41:20 +00:00
configs [ARM] 5390/1: AT91: Watchdog fixes 2009-02-14 16:01:57 +00:00
include/asm net: new user space API for time stamping of incoming and outgoing packets 2009-02-15 22:43:33 -08:00
kernel [ARM] 5417/1: Set the correct cacheid for ARMv6 CPUs with ARMv7 style MMU 2009-03-03 12:11:26 +00:00
lib Merge branch 'clps7500' into devel 2008-11-27 12:39:43 +00:00
mach-aaec2000 arm: struct device - replace bus_id with dev_name(), dev_set_name() 2009-01-06 10:44:43 -08:00
mach-at91 [ARM] at91: fix for Atmel AT91 powersaving 2009-02-22 22:37:21 +00:00
mach-clps711x [ARM] clps711x: fix warning in edb7211-mm.c 2009-01-08 16:29:42 +00:00
mach-davinci usb: musb: make Davinci *work* in mainline 2009-02-27 14:40:51 -08:00
mach-ebsa110 [ARM] Hide ISA DMA API when ISA_DMA_API is unset 2008-11-29 18:42:40 +00:00
mach-ep93xx [ARM] 5405/1: ep93xx: remove unused gesbc9312.h header 2009-02-19 16:13:02 +00:00
mach-footbridge Merge branch 'devel' 2009-01-08 22:01:49 +00:00
mach-h720x [ARM] fix AT91, davinci, h720x, ks8695, msm, mx2, mx3, netx, omap1, omap2, pxa, s3c 2009-01-08 16:29:42 +00:00
mach-imx [ARM] i.MX add missing include 2009-01-12 12:14:40 +01:00
mach-integrator libata-sff: fix incorrect EH message 2009-01-26 06:36:16 -05:00
mach-iop13xx [ARM] Hide ISA DMA API when ISA_DMA_API is unset 2008-11-29 18:42:40 +00:00
mach-iop32x [ARM] Hide ISA DMA API when ISA_DMA_API is unset 2008-11-29 18:42:40 +00:00
mach-iop33x [ARM] fix missing includes for iop33x and sa1100_ir 2008-12-01 23:01:19 +00:00
mach-ixp4xx Merge branch 'cpus4096-for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-01-02 11:44:09 -08:00
mach-ixp23xx [ARM] Hide ISA DMA API when ISA_DMA_API is unset 2008-11-29 18:42:40 +00:00
mach-ixp2000 [ARM] Hide ISA DMA API when ISA_DMA_API is unset 2008-11-29 18:42:40 +00:00
mach-kirkwood dsa: add switch chip cascading support 2009-03-21 19:06:54 -07:00
mach-ks8695 [ARM] fix AT91, davinci, h720x, ks8695, msm, mx2, mx3, netx, omap1, omap2, pxa, s3c 2009-01-08 16:29:42 +00:00
mach-l7200 [ARM] Add a common typesafe __io implementation 2008-11-30 11:45:54 +00:00
mach-lh7a40x arm: struct device - replace bus_id with dev_name(), dev_set_name() 2009-01-06 10:44:43 -08:00
mach-loki [ARM] Hide ISA DMA API when ISA_DMA_API is unset 2008-11-29 18:42:40 +00:00
mach-msm [ARM] msm: fix build errors 2009-01-28 10:19:52 +00:00
mach-mv78xx0 [ARM] 5401/1: Orion: fix edge triggered GPIO interrupt support 2009-02-17 22:37:09 +00:00
mach-mx1 [ARM] MXC: remove dependency to other include files from irqs.h 2008-12-18 16:40:11 +01:00
mach-mx2 [ARM] fix AT91, davinci, h720x, ks8695, msm, mx2, mx3, netx, omap1, omap2, pxa, s3c 2009-01-08 16:29:42 +00:00
mach-mx3 [ARM] fix AT91, davinci, h720x, ks8695, msm, mx2, mx3, netx, omap1, omap2, pxa, s3c 2009-01-08 16:29:42 +00:00
mach-netx [ARM] fix netx 2009-01-08 16:29:44 +00:00
mach-ns9xxx Merge branch 'cpus4096-for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-01-02 11:44:09 -08:00
mach-omap1 ARM: OMAP: Fix hsmmc init, v2 2009-01-29 08:57:16 -08:00
mach-omap2 OMAP: enable smc911x support for LDP platform 2009-03-02 22:29:37 -08:00
mach-orion5x dsa: add switch chip cascading support 2009-03-21 19:06:54 -07:00
mach-pnx4008 [ARM] fix pnx4008 2009-01-08 16:29:43 +00:00
mach-pxa [ARM] pxa: stop and disable IRQ for each DMA channels at startup 2009-01-21 11:29:19 +08:00
mach-realview [ARM] Fix realview build 2009-01-08 16:29:41 +00:00
mach-rpc Add i2c_board_info for RiscPC PCF8583 2009-02-24 19:19:50 +01:00
mach-s3c24a0/include/mach [ARM] S3C24A0: Remove duplicate <mach/io.h> file 2008-12-18 16:35:59 +00:00
mach-s3c2400 [ARM] remove a common set of __virt_to_bus definitions 2008-11-28 15:36:49 +00:00
mach-s3c2410 [ARM] fix AT91, davinci, h720x, ks8695, msm, mx2, mx3, netx, omap1, omap2, pxa, s3c 2009-01-08 16:29:42 +00:00
mach-s3c2412 [ARM] S3C: Remove unnecessary <linux/delay.h> includes 2008-12-18 16:36:02 +00:00
mach-s3c2440 [ARM] 5358/1: AT2440EVB: Use new include path of mci.h 2009-01-08 16:29:41 +00:00
mach-s3c2442 [ARM] Arrange for platforms to select appropriate CPU support 2008-11-27 12:38:00 +00:00
mach-s3c2443 [ARM] S3C: Remove unnecessary <linux/delay.h> includes 2008-12-18 16:36:02 +00:00
mach-s3c6400 [ARM] fix AT91, davinci, h720x, ks8695, msm, mx2, mx3, netx, omap1, omap2, pxa, s3c 2009-01-08 16:29:42 +00:00
mach-s3c6410 Merge branch 'next-s3c64xx-device' into next-merged 2008-12-18 16:17:37 +00:00
mach-sa1100 rename platform_driver name "flash" to "sa1100-mtd" 2009-01-31 01:21:58 +01:00
mach-shark [ARM] Rename ISA mach/dma.h header to mach/isa-dma.h 2008-11-29 18:49:55 +00:00
mach-versatile arm: struct device - replace bus_id with dev_name(), dev_set_name() 2009-01-06 10:44:43 -08:00
mach-w90x900 [ARM] w90x900: fix build errors and warnings 2009-01-12 13:51:03 +00:00
mm [ARM] 5416/1: Use unused address in v6_early_abort 2009-03-03 12:11:25 +00:00
nwfpe [ARM] Convert asm/uaccess.h to linux/uaccess.h 2008-09-06 11:35:55 +01:00
oprofile cpumask: make irq_set_affinity() take a const struct cpumask 2008-12-13 21:20:26 +10:30
plat-iop [ARM] iop: iop3xx needs registers mapped uncached+unbuffered 2008-11-09 11:18:36 +00:00
plat-mxc mmc: Add a MX2/MX3 specific SDHC driver 2009-02-02 20:57:05 +01:00
plat-omap ARM: OMAP: Fix hsmmc init, v2 2009-01-29 08:57:16 -08:00
plat-orion [ARM] 5401/1: Orion: fix edge triggered GPIO interrupt support 2009-02-17 22:37:09 +00:00
plat-s3c [ARM] fix AT91, davinci, h720x, ks8695, msm, mx2, mx3, netx, omap1, omap2, pxa, s3c 2009-01-08 16:29:42 +00:00
plat-s3c24xx [ARM] fix AT91, davinci, h720x, ks8695, msm, mx2, mx3, netx, omap1, omap2, pxa, s3c 2009-01-08 16:29:42 +00:00
plat-s3c64xx [ARM] 5411/1: S3C64XX: Fix EINT unmask 2009-02-24 19:12:31 +00:00
tools [ARM] Update mach-types 2008-11-30 16:39:42 +00:00
vfp [ARM] 5349/1: VFP: Add PM code to save and restore current VFP state 2008-12-18 21:21:34 +00:00
Kconfig Staging: Kconfig for ARCH=arm,8300, cris 2009-01-06 13:51:38 -08:00
Kconfig-nommu [ARM] 4532/1: allow configuration of processor ID 2007-10-12 23:43:02 +01:00
Kconfig.debug [ARM] CONFIG_DEBUG_STACK_USAGE 2008-01-26 14:50:06 +00:00
Makefile Merge branch 'next-merged' of git://aeryn.fluff.org.uk/bjdooks/linux into devel 2008-12-18 22:15:30 +00:00