xref: /openbmc/linux/include/net/dsa.h (revision ecba1060)
1 /*
2  * include/net/dsa.h - Driver for Distributed Switch Architecture switch chips
3  * Copyright (c) 2008-2009 Marvell Semiconductor
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 
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 };
41 
42 struct dsa_platform_data {
43 	/*
44 	 * Reference to a Linux network interface that connects
45 	 * to the root switch chip of the tree.
46 	 */
47 	struct device	*netdev;
48 
49 	/*
50 	 * Info structs describing each of the switch chips
51 	 * connected via this network interface.
52 	 */
53 	int		nr_chips;
54 	struct dsa_chip_data	*chip;
55 };
56 
57 extern bool dsa_uses_dsa_tags(void *dsa_ptr);
58 extern bool dsa_uses_trailer_tags(void *dsa_ptr);
59 
60 
61 #endif
62