Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 1 | /* |
| 2 | * include/net/dsa.h - Driver for Distributed Switch Architecture switch chips |
Lennert Buytenhek | e84665c | 2009-03-20 09:52:09 +0000 | [diff] [blame] | 3 | * Copyright (c) 2008-2009 Marvell Semiconductor |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | */ |
| 10 | |
| 11 | #ifndef __LINUX_NET_DSA_H |
| 12 | #define __LINUX_NET_DSA_H |
| 13 | |
Lennert Buytenhek | e84665c | 2009-03-20 09:52:09 +0000 | [diff] [blame] | 14 | #define DSA_MAX_SWITCHES 4 |
| 15 | #define DSA_MAX_PORTS 12 |
| 16 | |
| 17 | struct dsa_chip_data { |
| 18 | /* |
| 19 | * How to access the switch configuration registers. |
| 20 | */ |
| 21 | struct device *mii_bus; |
| 22 | int sw_addr; |
| 23 | |
| 24 | /* |
| 25 | * The names of the switch's ports. Use "cpu" to |
| 26 | * designate the switch port that the cpu is connected to, |
| 27 | * "dsa" to indicate that this port is a DSA link to |
| 28 | * another switch, NULL to indicate the port is unused, |
| 29 | * or any other string to indicate this is a physical port. |
| 30 | */ |
| 31 | char *port_names[DSA_MAX_PORTS]; |
| 32 | |
| 33 | /* |
| 34 | * An array (with nr_chips elements) of which element [a] |
| 35 | * indicates which port on this switch should be used to |
| 36 | * send packets to that are destined for switch a. Can be |
| 37 | * NULL if there is only one switch chip. |
| 38 | */ |
| 39 | s8 *rtable; |
| 40 | }; |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 41 | |
| 42 | struct dsa_platform_data { |
| 43 | /* |
| 44 | * Reference to a Linux network interface that connects |
Lennert Buytenhek | e84665c | 2009-03-20 09:52:09 +0000 | [diff] [blame] | 45 | * to the root switch chip of the tree. |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 46 | */ |
| 47 | struct device *netdev; |
| 48 | |
| 49 | /* |
Lennert Buytenhek | e84665c | 2009-03-20 09:52:09 +0000 | [diff] [blame] | 50 | * Info structs describing each of the switch chips |
| 51 | * connected via this network interface. |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 52 | */ |
Lennert Buytenhek | e84665c | 2009-03-20 09:52:09 +0000 | [diff] [blame] | 53 | int nr_chips; |
| 54 | struct dsa_chip_data *chip; |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 55 | }; |
| 56 | |
Lennert Buytenhek | cf85d08 | 2008-10-07 13:45:02 +0000 | [diff] [blame] | 57 | extern bool dsa_uses_dsa_tags(void *dsa_ptr); |
Lennert Buytenhek | 396138f | 2008-10-07 13:46:07 +0000 | [diff] [blame] | 58 | extern bool dsa_uses_trailer_tags(void *dsa_ptr); |
Lennert Buytenhek | cf85d08 | 2008-10-07 13:45:02 +0000 | [diff] [blame] | 59 | |
Lennert Buytenhek | 91da11f | 2008-10-07 13:44:02 +0000 | [diff] [blame] | 60 | |
| 61 | #endif |