]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: dsa: do not skip -EOPNOTSUPP in dsa_port_vid_add
authorVivien Didelot <vivien.didelot@gmail.com>
Sun, 25 Aug 2019 17:25:16 +0000 (13:25 -0400)
committerDavid S. Miller <davem@davemloft.net>
Wed, 28 Aug 2019 03:17:27 +0000 (20:17 -0700)
Currently dsa_port_vid_add returns 0 if the switch returns -EOPNOTSUPP.

This function is used in the tag_8021q.c code to offload the PVID of
ports, which would simply not work if .port_vlan_add is not supported
by the underlying switch.

Do not skip -EOPNOTSUPP in dsa_port_vid_add but only when necessary,
that is to say in dsa_slave_vlan_rx_add_vid.

Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/port.c
net/dsa/slave.c

index f75301456430bdf5af333c5e870a5ee5fce5761b..ef28df7ecbde3d7b87d38630e421a2f4392c4f46 100644 (file)
@@ -382,8 +382,8 @@ int dsa_port_vid_add(struct dsa_port *dp, u16 vid, u16 flags)
 
        trans.ph_prepare = true;
        err = dsa_port_vlan_add(dp, &vlan, &trans);
-       if (err == -EOPNOTSUPP)
-               return 0;
+       if (err)
+               return err;
 
        trans.ph_prepare = false;
        return dsa_port_vlan_add(dp, &vlan, &trans);
index 33f41178afccf207abfeafd7e3fa05cf0e832129..9d61d9dbf001f2e76f8f12e90e141cb6c1739aef 100644 (file)
@@ -1082,8 +1082,11 @@ static int dsa_slave_vlan_rx_add_vid(struct net_device *dev, __be16 proto,
                        return -EBUSY;
        }
 
-       /* This API only allows programming tagged, non-PVID VIDs */
-       return dsa_port_vid_add(dp, vid, 0);
+       ret = dsa_port_vid_add(dp, vid, 0);
+       if (ret && ret != -EOPNOTSUPP)
+               return ret;
+
+       return 0;
 }
 
 static int dsa_slave_vlan_rx_kill_vid(struct net_device *dev, __be16 proto,