Skip to content

Commit

Permalink
net: dsa: loop: Support 4K VLANs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Florian Fainelli authored and David S. Miller committed Aug 4, 2020
1 parent 81d4e8e commit 916a8d1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/net/dsa/dsa_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
};
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 916a8d1

Please sign in to comment.