net: dsa: allocate ports on touch

Allocate the struct dsa_port the first time it is accessed with
dsa_port_touch, and remove the static dsa_port array from the
dsa_switch structure.

Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
This commit is contained in:
Vivien Didelot
2019-10-21 16:51:29 -04:00
committed by Jakub Kicinski
parent d5a619bf60
commit 05f294a852
2 changed files with 14 additions and 4 deletions

View File

@@ -277,9 +277,7 @@ struct dsa_switch {
*/
bool vlan_filtering;
/* Dynamically allocated ports, keep last */
size_t num_ports;
struct dsa_port ports[];
};
static inline struct dsa_port *dsa_to_port(struct dsa_switch *ds, int p)