diff options
Diffstat (limited to 'net/dsa/port.c')
| -rw-r--r-- | net/dsa/port.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/net/dsa/port.c b/net/dsa/port.c index aa7ec043d5ba..1ed287b2badd 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c | |||
| @@ -370,6 +370,37 @@ int dsa_port_vlan_del(struct dsa_port *dp, | |||
| 370 | return 0; | 370 | return 0; |
| 371 | } | 371 | } |
| 372 | 372 | ||
| 373 | int dsa_port_vid_add(struct dsa_port *dp, u16 vid, u16 flags) | ||
| 374 | { | ||
| 375 | struct switchdev_obj_port_vlan vlan = { | ||
| 376 | .obj.id = SWITCHDEV_OBJ_ID_PORT_VLAN, | ||
| 377 | .flags = flags, | ||
| 378 | .vid_begin = vid, | ||
| 379 | .vid_end = vid, | ||
| 380 | }; | ||
| 381 | struct switchdev_trans trans; | ||
| 382 | int err; | ||
| 383 | |||
| 384 | trans.ph_prepare = true; | ||
| 385 | err = dsa_port_vlan_add(dp, &vlan, &trans); | ||
| 386 | if (err == -EOPNOTSUPP) | ||
| 387 | return 0; | ||
| 388 | |||
| 389 | trans.ph_prepare = false; | ||
| 390 | return dsa_port_vlan_add(dp, &vlan, &trans); | ||
| 391 | } | ||
| 392 | |||
| 393 | int dsa_port_vid_del(struct dsa_port *dp, u16 vid) | ||
| 394 | { | ||
| 395 | struct switchdev_obj_port_vlan vlan = { | ||
| 396 | .obj.id = SWITCHDEV_OBJ_ID_PORT_VLAN, | ||
| 397 | .vid_begin = vid, | ||
| 398 | .vid_end = vid, | ||
| 399 | }; | ||
| 400 | |||
| 401 | return dsa_port_vlan_del(dp, &vlan); | ||
| 402 | } | ||
| 403 | |||
| 373 | static struct phy_device *dsa_port_get_phy_device(struct dsa_port *dp) | 404 | static struct phy_device *dsa_port_get_phy_device(struct dsa_port *dp) |
| 374 | { | 405 | { |
| 375 | struct device_node *phy_dn; | 406 | struct device_node *phy_dn; |
