Skip to content

Commit

Permalink
net: dsa: do not skip -EOPNOTSUPP in dsa_port_vid_add
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Vivien Didelot authored and David S. Miller committed Aug 28, 2019
1 parent e65d45c commit cf36086
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions net/dsa/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 5 additions & 2 deletions net/dsa/slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit cf36086

Please sign in to comment.