diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2020-09-10 19:48:57 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-09-11 17:30:43 -0700 |
commit | 88236591ec3bc6fbf4393b435ea8f567e06faede (patch) | |
tree | 2c3c10bbf14b3df90fc6d2877810802deafc7058 /net/dsa/slave.c | |
parent | 5899ee367ab3fec885aa04d9a2b573bf2e464e7f (diff) |
Revert "net: dsa: Add more convenient functions for installing port VLANs"
This reverts commit 314f76d7a68bab0516aa52877944e6aacfa0fc3f.
Citing that commit message, the call graph was:
dsa_slave_vlan_rx_add_vid dsa_port_setup_8021q_tagging
| |
| |
| +-------------+
| |
v v
dsa_port_vid_add dsa_slave_port_obj_add
| |
+-------+ +-------+
| |
v v
dsa_port_vlan_add
Now that tag_8021q has its own ops structure, it no longer relies on
dsa_port_vid_add, and therefore on the dsa_switch_ops to install its
VLANs.
So dsa_port_vid_add now only has one single caller. So we can simplify
the call graph to what it was before, aka:
dsa_slave_vlan_rx_add_vid dsa_slave_port_obj_add
| |
+-------+ +-------+
| |
v v
dsa_port_vlan_add
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/slave.c')
-rw-r--r-- | net/dsa/slave.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 4987f94a8f52..66a5268398a5 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1233,7 +1233,15 @@ static int dsa_slave_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid) { struct dsa_port *dp = dsa_slave_to_port(dev); + struct switchdev_obj_port_vlan vlan = { + .obj.id = SWITCHDEV_OBJ_ID_PORT_VLAN, + .vid_begin = vid, + .vid_end = vid, + /* This API only allows programming tagged, non-PVID VIDs */ + .flags = 0, + }; struct bridge_vlan_info info; + struct switchdev_trans trans; int ret; /* Check for a possible bridge VLAN entry now since there is no @@ -1252,11 +1260,25 @@ static int dsa_slave_vlan_rx_add_vid(struct net_device *dev, __be16 proto, return -EBUSY; } - ret = dsa_port_vid_add(dp, vid, 0); + /* User port... */ + trans.ph_prepare = true; + ret = dsa_port_vlan_add(dp, &vlan, &trans); + if (ret) + return ret; + + trans.ph_prepare = false; + ret = dsa_port_vlan_add(dp, &vlan, &trans); if (ret) return ret; - ret = dsa_port_vid_add(dp->cpu_dp, vid, 0); + /* And CPU port... */ + trans.ph_prepare = true; + ret = dsa_port_vlan_add(dp->cpu_dp, &vlan, &trans); + if (ret) + return ret; + + trans.ph_prepare = false; + ret = dsa_port_vlan_add(dp->cpu_dp, &vlan, &trans); if (ret) return ret; @@ -1267,6 +1289,12 @@ static int dsa_slave_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid) { struct dsa_port *dp = dsa_slave_to_port(dev); + struct switchdev_obj_port_vlan vlan = { + .vid_begin = vid, + .vid_end = vid, + /* This API only allows programming tagged, non-PVID VIDs */ + .flags = 0, + }; struct bridge_vlan_info info; int ret; @@ -1289,7 +1317,7 @@ static int dsa_slave_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, /* Do not deprogram the CPU port as it may be shared with other user * ports which can be members of this VLAN as well. */ - return dsa_port_vid_del(dp, vid); + return dsa_port_vlan_del(dp, &vlan); } struct dsa_hw_port { |