summaryrefslogtreecommitdiff
path: root/drivers/net/dsa
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2020-08-03 23:03:51 +0300
committerDavid S. Miller <davem@davemloft.net>2020-08-04 04:19:22 +0300
commit916a8d168e8aea52e6f7eb2e323d5dcbd5dc23d5 (patch)
tree410370e085f42359be7902029802eaa45c952687 /drivers/net/dsa
parent81d4e8e0731408c7fc66409cbf97f10f38964dc1 (diff)
downloadlinux-916a8d168e8aea52e6f7eb2e323d5dcbd5dc23d5.tar.xz
net: dsa: loop: Support 4K VLANs
Allocate a 4K array of VLANs instead of limiting ourselves to just 5 which is arbitrary. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa')
-rw-r--r--drivers/net/dsa/dsa_loop.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/net/dsa/dsa_loop.c b/drivers/net/dsa/dsa_loop.c
index 4a57238cdfd8..6e97b44c6f3f 100644
--- a/drivers/net/dsa/dsa_loop.c
+++ b/drivers/net/dsa/dsa_loop.c
@@ -48,12 +48,10 @@ struct dsa_loop_port {
u16 pvid;
};
-#define DSA_LOOP_VLANS 5
-
struct dsa_loop_priv {
struct mii_bus *bus;
unsigned int port_base;
- struct dsa_loop_vlan vlans[DSA_LOOP_VLANS];
+ struct dsa_loop_vlan vlans[VLAN_N_VID];
struct net_device *netdev;
struct dsa_loop_port ports[DSA_MAX_PORTS];
};
@@ -191,7 +189,7 @@ dsa_loop_port_vlan_prepare(struct dsa_switch *ds, int port,
/* Just do a sleeping operation to make lockdep checks effective */
mdiobus_read(bus, ps->port_base + port, MII_BMSR);
- if (vlan->vid_end > DSA_LOOP_VLANS)
+ if (vlan->vid_end > ARRAY_SIZE(ps->vlans))
return -ERANGE;
return 0;