Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: dsa: Split platform data to header file

Instead of having net/dsa.h contain both the internal switch tree/driver
structures, split the relevant platform_data parts into
include/linux/platform_data/dsa.h and make that header be included by
net/dsa.h in order not to break any setup. A subsequent set of patches
will update code including net/dsa.h to include only the platform_data
header.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Florian Fainelli and committed by
David S. Miller
ecfc9372 905b464a

+70 -60
+1
MAINTAINERS
··· 10576 10576 F: net/dsa/ 10577 10577 F: include/net/dsa.h 10578 10578 F: include/linux/dsa/ 10579 + F: include/linux/platform_data/dsa.h 10579 10580 F: drivers/net/dsa/ 10580 10581 10581 10582 NETWORKING [GENERAL]
+68
include/linux/platform_data/dsa.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef __DSA_PDATA_H 3 + #define __DSA_PDATA_H 4 + 5 + struct device; 6 + struct net_device; 7 + 8 + #define DSA_MAX_SWITCHES 4 9 + #define DSA_MAX_PORTS 12 10 + #define DSA_RTABLE_NONE -1 11 + 12 + struct dsa_chip_data { 13 + /* 14 + * How to access the switch configuration registers. 15 + */ 16 + struct device *host_dev; 17 + int sw_addr; 18 + 19 + /* 20 + * Reference to network devices 21 + */ 22 + struct device *netdev[DSA_MAX_PORTS]; 23 + 24 + /* set to size of eeprom if supported by the switch */ 25 + int eeprom_len; 26 + 27 + /* Device tree node pointer for this specific switch chip 28 + * used during switch setup in case additional properties 29 + * and resources needs to be used 30 + */ 31 + struct device_node *of_node; 32 + 33 + /* 34 + * The names of the switch's ports. Use "cpu" to 35 + * designate the switch port that the cpu is connected to, 36 + * "dsa" to indicate that this port is a DSA link to 37 + * another switch, NULL to indicate the port is unused, 38 + * or any other string to indicate this is a physical port. 39 + */ 40 + char *port_names[DSA_MAX_PORTS]; 41 + struct device_node *port_dn[DSA_MAX_PORTS]; 42 + 43 + /* 44 + * An array of which element [a] indicates which port on this 45 + * switch should be used to send packets to that are destined 46 + * for switch a. Can be NULL if there is only one switch chip. 47 + */ 48 + s8 rtable[DSA_MAX_SWITCHES]; 49 + }; 50 + 51 + struct dsa_platform_data { 52 + /* 53 + * Reference to a Linux network interface that connects 54 + * to the root switch chip of the tree. 55 + */ 56 + struct device *netdev; 57 + struct net_device *of_netdev; 58 + 59 + /* 60 + * Info structs describing each of the switch chips 61 + * connected via this network interface. 62 + */ 63 + int nr_chips; 64 + struct dsa_chip_data *chip; 65 + }; 66 + 67 + 68 + #endif /* __DSA_PDATA_H */
+1 -60
include/net/dsa.h
··· 21 21 #include <linux/ethtool.h> 22 22 #include <linux/net_tstamp.h> 23 23 #include <linux/phy.h> 24 + #include <linux/platform_data/dsa.h> 24 25 #include <net/devlink.h> 25 26 #include <net/switchdev.h> 26 27 ··· 43 42 DSA_TAG_PROTO_QCA, 44 43 DSA_TAG_PROTO_TRAILER, 45 44 DSA_TAG_LAST, /* MUST BE LAST */ 46 - }; 47 - 48 - #define DSA_MAX_SWITCHES 4 49 - #define DSA_MAX_PORTS 12 50 - 51 - #define DSA_RTABLE_NONE -1 52 - 53 - struct dsa_chip_data { 54 - /* 55 - * How to access the switch configuration registers. 56 - */ 57 - struct device *host_dev; 58 - int sw_addr; 59 - 60 - /* 61 - * Reference to network devices 62 - */ 63 - struct device *netdev[DSA_MAX_PORTS]; 64 - 65 - /* set to size of eeprom if supported by the switch */ 66 - int eeprom_len; 67 - 68 - /* Device tree node pointer for this specific switch chip 69 - * used during switch setup in case additional properties 70 - * and resources needs to be used 71 - */ 72 - struct device_node *of_node; 73 - 74 - /* 75 - * The names of the switch's ports. Use "cpu" to 76 - * designate the switch port that the cpu is connected to, 77 - * "dsa" to indicate that this port is a DSA link to 78 - * another switch, NULL to indicate the port is unused, 79 - * or any other string to indicate this is a physical port. 80 - */ 81 - char *port_names[DSA_MAX_PORTS]; 82 - struct device_node *port_dn[DSA_MAX_PORTS]; 83 - 84 - /* 85 - * An array of which element [a] indicates which port on this 86 - * switch should be used to send packets to that are destined 87 - * for switch a. Can be NULL if there is only one switch chip. 88 - */ 89 - s8 rtable[DSA_MAX_SWITCHES]; 90 - }; 91 - 92 - struct dsa_platform_data { 93 - /* 94 - * Reference to a Linux network interface that connects 95 - * to the root switch chip of the tree. 96 - */ 97 - struct device *netdev; 98 - struct net_device *of_netdev; 99 - 100 - /* 101 - * Info structs describing each of the switch chips 102 - * connected via this network interface. 103 - */ 104 - int nr_chips; 105 - struct dsa_chip_data *chip; 106 45 }; 107 46 108 47 struct packet_type;