Skip to content

Commit 8823659

Browse files
vladimirolteandavem330
authored andcommitted
Revert "net: dsa: Add more convenient functions for installing port VLANs"
This reverts commit 314f76d. 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 <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5899ee3 commit 8823659

File tree

3 files changed

+31
-38
lines changed

3 files changed

+31
-38
lines changed

net/dsa/dsa_priv.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,6 @@ int dsa_port_vlan_add(struct dsa_port *dp,
164164
struct switchdev_trans *trans);
165165
int dsa_port_vlan_del(struct dsa_port *dp,
166166
const struct switchdev_obj_port_vlan *vlan);
167-
int dsa_port_vid_add(struct dsa_port *dp, u16 vid, u16 flags);
168-
int dsa_port_vid_del(struct dsa_port *dp, u16 vid);
169167
int dsa_port_link_register_of(struct dsa_port *dp);
170168
void dsa_port_link_unregister_of(struct dsa_port *dp);
171169
extern const struct phylink_mac_ops dsa_port_phylink_mac_ops;

net/dsa/port.c

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -433,39 +433,6 @@ int dsa_port_vlan_del(struct dsa_port *dp,
433433
return dsa_port_notify(dp, DSA_NOTIFIER_VLAN_DEL, &info);
434434
}
435435

436-
int dsa_port_vid_add(struct dsa_port *dp, u16 vid, u16 flags)
437-
{
438-
struct switchdev_obj_port_vlan vlan = {
439-
.obj.id = SWITCHDEV_OBJ_ID_PORT_VLAN,
440-
.flags = flags,
441-
.vid_begin = vid,
442-
.vid_end = vid,
443-
};
444-
struct switchdev_trans trans;
445-
int err;
446-
447-
trans.ph_prepare = true;
448-
err = dsa_port_vlan_add(dp, &vlan, &trans);
449-
if (err)
450-
return err;
451-
452-
trans.ph_prepare = false;
453-
return dsa_port_vlan_add(dp, &vlan, &trans);
454-
}
455-
EXPORT_SYMBOL(dsa_port_vid_add);
456-
457-
int dsa_port_vid_del(struct dsa_port *dp, u16 vid)
458-
{
459-
struct switchdev_obj_port_vlan vlan = {
460-
.obj.id = SWITCHDEV_OBJ_ID_PORT_VLAN,
461-
.vid_begin = vid,
462-
.vid_end = vid,
463-
};
464-
465-
return dsa_port_vlan_del(dp, &vlan);
466-
}
467-
EXPORT_SYMBOL(dsa_port_vid_del);
468-
469436
static struct phy_device *dsa_port_get_phy_device(struct dsa_port *dp)
470437
{
471438
struct device_node *phy_dn;

net/dsa/slave.c

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,15 @@ static int dsa_slave_vlan_rx_add_vid(struct net_device *dev, __be16 proto,
12331233
u16 vid)
12341234
{
12351235
struct dsa_port *dp = dsa_slave_to_port(dev);
1236+
struct switchdev_obj_port_vlan vlan = {
1237+
.obj.id = SWITCHDEV_OBJ_ID_PORT_VLAN,
1238+
.vid_begin = vid,
1239+
.vid_end = vid,
1240+
/* This API only allows programming tagged, non-PVID VIDs */
1241+
.flags = 0,
1242+
};
12361243
struct bridge_vlan_info info;
1244+
struct switchdev_trans trans;
12371245
int ret;
12381246

12391247
/* 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,
12521260
return -EBUSY;
12531261
}
12541262

1255-
ret = dsa_port_vid_add(dp, vid, 0);
1263+
/* User port... */
1264+
trans.ph_prepare = true;
1265+
ret = dsa_port_vlan_add(dp, &vlan, &trans);
1266+
if (ret)
1267+
return ret;
1268+
1269+
trans.ph_prepare = false;
1270+
ret = dsa_port_vlan_add(dp, &vlan, &trans);
12561271
if (ret)
12571272
return ret;
12581273

1259-
ret = dsa_port_vid_add(dp->cpu_dp, vid, 0);
1274+
/* And CPU port... */
1275+
trans.ph_prepare = true;
1276+
ret = dsa_port_vlan_add(dp->cpu_dp, &vlan, &trans);
1277+
if (ret)
1278+
return ret;
1279+
1280+
trans.ph_prepare = false;
1281+
ret = dsa_port_vlan_add(dp->cpu_dp, &vlan, &trans);
12601282
if (ret)
12611283
return ret;
12621284

@@ -1267,6 +1289,12 @@ static int dsa_slave_vlan_rx_kill_vid(struct net_device *dev, __be16 proto,
12671289
u16 vid)
12681290
{
12691291
struct dsa_port *dp = dsa_slave_to_port(dev);
1292+
struct switchdev_obj_port_vlan vlan = {
1293+
.vid_begin = vid,
1294+
.vid_end = vid,
1295+
/* This API only allows programming tagged, non-PVID VIDs */
1296+
.flags = 0,
1297+
};
12701298
struct bridge_vlan_info info;
12711299
int ret;
12721300

@@ -1289,7 +1317,7 @@ static int dsa_slave_vlan_rx_kill_vid(struct net_device *dev, __be16 proto,
12891317
/* Do not deprogram the CPU port as it may be shared with other user
12901318
* ports which can be members of this VLAN as well.
12911319
*/
1292-
return dsa_port_vid_del(dp, vid);
1320+
return dsa_port_vlan_del(dp, &vlan);
12931321
}
12941322

12951323
struct dsa_hw_port {

0 commit comments

Comments
 (0)