blob: 839f768f9e35c6ac175ff03d42b694839f7fd49a [file] [log] [blame]
Lennert Buytenhek91da11f2008-10-07 13:44:02 +00001/*
2 * include/net/dsa.h - Driver for Distributed Switch Architecture switch chips
Lennert Buytenheke84665c2009-03-20 09:52:09 +00003 * Copyright (c) 2008-2009 Marvell Semiconductor
Lennert Buytenhek91da11f2008-10-07 13:44:02 +00004 *
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 Buytenheke84665c2009-03-20 09:52:09 +000014#define DSA_MAX_SWITCHES 4
15#define DSA_MAX_PORTS 12
16
17struct 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 Buytenhek91da11f2008-10-07 13:44:02 +000041
42struct dsa_platform_data {
43 /*
44 * Reference to a Linux network interface that connects
Lennert Buytenheke84665c2009-03-20 09:52:09 +000045 * to the root switch chip of the tree.
Lennert Buytenhek91da11f2008-10-07 13:44:02 +000046 */
47 struct device *netdev;
48
49 /*
Lennert Buytenheke84665c2009-03-20 09:52:09 +000050 * Info structs describing each of the switch chips
51 * connected via this network interface.
Lennert Buytenhek91da11f2008-10-07 13:44:02 +000052 */
Lennert Buytenheke84665c2009-03-20 09:52:09 +000053 int nr_chips;
54 struct dsa_chip_data *chip;
Lennert Buytenhek91da11f2008-10-07 13:44:02 +000055};
56
Lennert Buytenhekcf85d082008-10-07 13:45:02 +000057extern bool dsa_uses_dsa_tags(void *dsa_ptr);
Lennert Buytenhek396138f2008-10-07 13:46:07 +000058extern bool dsa_uses_trailer_tags(void *dsa_ptr);
Lennert Buytenhekcf85d082008-10-07 13:45:02 +000059
Lennert Buytenhek91da11f2008-10-07 13:44:02 +000060
61#endif