Message ID | 20200617083132.1847234-5-linus.walleij@linaro.org |
---|---|
State | Changes Requested |
Delegated to: | David Miller |
Headers | show |
Series | [net-next,1/5,v2] net: dsa: tag_rtl4_a: Implement Realtek 4 byte A tag | expand |
On Wed, Jun 17, 2020 at 10:31:32AM +0200, Linus Walleij wrote: > The RTL8366 DSA switches will not work unless we set > up a default VLAN for each port. We are currently using > e.g. VLAN 1..6 for a 5-port switch as default VLANs. > > This is not very helpful for users, move it to allocate > the top VLANs for default instead, for example on > RTL8366RB there are 16 VLANs so instead of using > VLAN 1..6 as default use VLAN 10..15 so VLAN 1 > thru VLAN 9 is available for users. > > Cc: DENG Qingfang <dqfext@gmail.com> > Cc: Mauri Sandberg <sandberg@mailfence.com> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> > --- > ChangeLog v1->v2: > - Rebase on v5.8-rc1. > --- > drivers/net/dsa/rtl8366.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c > index 7f0691a6da13..4e7562b41598 100644 > --- a/drivers/net/dsa/rtl8366.c > +++ b/drivers/net/dsa/rtl8366.c > @@ -260,8 +260,8 @@ static int rtl8366_set_default_vlan_and_pvid(struct realtek_smi *smi, > u16 vid; > int ret; > > - /* This is the reserved default VLAN for this port */ > - vid = port + 1; > + /* Use the top VLANs for per-port default VLAN */ > + vid = smi->num_vlan_mc - smi->num_ports + port; Hi Linus I've not looked at the whole driver much, but i'm surprised the change is this small. Is there any checks when user space ask for a VLAN to be added to a port to see if it is already in use an return -EBUSY or -EINVAL or something? Andrew
diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c index 7f0691a6da13..4e7562b41598 100644 --- a/drivers/net/dsa/rtl8366.c +++ b/drivers/net/dsa/rtl8366.c @@ -260,8 +260,8 @@ static int rtl8366_set_default_vlan_and_pvid(struct realtek_smi *smi, u16 vid; int ret; - /* This is the reserved default VLAN for this port */ - vid = port + 1; + /* Use the top VLANs for per-port default VLAN */ + vid = smi->num_vlan_mc - smi->num_ports + port; if (port == smi->cpu_port) /* For the CPU port, make all ports members of this
The RTL8366 DSA switches will not work unless we set up a default VLAN for each port. We are currently using e.g. VLAN 1..6 for a 5-port switch as default VLANs. This is not very helpful for users, move it to allocate the top VLANs for default instead, for example on RTL8366RB there are 16 VLANs so instead of using VLAN 1..6 as default use VLAN 10..15 so VLAN 1 thru VLAN 9 is available for users. Cc: DENG Qingfang <dqfext@gmail.com> Cc: Mauri Sandberg <sandberg@mailfence.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- ChangeLog v1->v2: - Rebase on v5.8-rc1. --- drivers/net/dsa/rtl8366.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)