mlxsw_sp_port_vlan
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_vid(mlxsw_sp_port, vid);
if (!mlxsw_sp_port_vlan)
mlxsw_sp_port_vlan_destroy(mlxsw_sp_port_vlan);
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_create(mlxsw_sp_port,
if (IS_ERR(mlxsw_sp_port_vlan)) {
err = PTR_ERR(mlxsw_sp_port_vlan);
mlxsw_sp_port->default_vlan = mlxsw_sp_port_vlan;
mlxsw_sp_port_vlan_destroy(mlxsw_sp_port_vlan);
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan, *tmp;
list_for_each_entry_safe(mlxsw_sp_port_vlan, tmp,
mlxsw_sp_port_vlan->vid == MLXSW_SP_DEFAULT_VID)
mlxsw_sp_port_vlan_destroy(mlxsw_sp_port_vlan);
mlxsw_sp_port_vlan_cleanup(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan)
if (mlxsw_sp_port_vlan->bridge_port)
mlxsw_sp_port_vlan_bridge_leave(mlxsw_sp_port_vlan);
else if (mlxsw_sp_port_vlan->fid)
mlxsw_sp_port_vlan_router_leave(mlxsw_sp_port_vlan);
struct mlxsw_sp_port_vlan *
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_vid(mlxsw_sp_port, vid);
if (mlxsw_sp_port_vlan)
mlxsw_sp_port_vlan = kzalloc_obj(*mlxsw_sp_port_vlan);
if (!mlxsw_sp_port_vlan) {
mlxsw_sp_port_vlan->mlxsw_sp_port = mlxsw_sp_port;
mlxsw_sp_port_vlan->vid = vid;
list_add(&mlxsw_sp_port_vlan->list, &mlxsw_sp_port->vlans_list);
return mlxsw_sp_port_vlan;
void mlxsw_sp_port_vlan_destroy(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan)
struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp_port_vlan->mlxsw_sp_port;
u16 vid = mlxsw_sp_port_vlan->vid;
mlxsw_sp_port_vlan_cleanup(mlxsw_sp_port_vlan);
list_del(&mlxsw_sp_port_vlan->list);
kfree(mlxsw_sp_port_vlan);
struct mlxsw_sp_port_vlan *default_vlan;
static inline struct mlxsw_sp_port_vlan *
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
list_for_each_entry(mlxsw_sp_port_vlan, &mlxsw_sp_port->vlans_list,
if (mlxsw_sp_port_vlan->vid == vid)
return mlxsw_sp_port_vlan;
mlxsw_sp_port_vlan_bridge_leave(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan);
struct mlxsw_sp_port_vlan *
void mlxsw_sp_port_vlan_destroy(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan);
mlxsw_sp_port_vlan_router_leave(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan);
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
list_for_each_entry_reverse(mlxsw_sp_port_vlan,
struct mlxsw_sp_fid *fid = mlxsw_sp_port_vlan->fid;
u16 vid = mlxsw_sp_port_vlan->vid;
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
list_for_each_entry(mlxsw_sp_port_vlan, &mlxsw_sp_port->vlans_list,
struct mlxsw_sp_fid *fid = mlxsw_sp_port_vlan->fid;
u16 vid = mlxsw_sp_port_vlan->vid;
list_for_each_entry_continue_reverse(mlxsw_sp_port_vlan,
struct mlxsw_sp_fid *fid = mlxsw_sp_port_vlan->fid;
u16 vid = mlxsw_sp_port_vlan->vid;
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_vid(mlxsw_sp_port,
if (WARN_ON(!mlxsw_sp_port_vlan))
return mlxsw_sp_port_vlan_router_join_existing(mlxsw_sp_port_vlan,
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_vid(mlxsw_sp_port,
if (WARN_ON(!mlxsw_sp_port_vlan))
__mlxsw_sp_port_vlan_router_leave(mlxsw_sp_port_vlan);
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan)
struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp_port_vlan->mlxsw_sp_port;
params->vid = mlxsw_sp_port_vlan->vid;
__mlxsw_sp_port_vlan_router_join(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan,
struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp_port_vlan->mlxsw_sp_port;
u16 vid = mlxsw_sp_port_vlan->vid;
mlxsw_sp_rif_subport_params_init(¶ms, mlxsw_sp_port_vlan);
mlxsw_sp_port_vlan->fid = fid;
__mlxsw_sp_port_vlan_router_leave(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan)
struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp_port_vlan->mlxsw_sp_port;
struct mlxsw_sp_fid *fid = mlxsw_sp_port_vlan->fid;
u16 vid = mlxsw_sp_port_vlan->vid;
mlxsw_sp_port_vlan->fid = NULL;
mlxsw_sp_port_vlan_router_join_existing(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan,
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port_vlan->mlxsw_sp_port->mlxsw_sp;
return __mlxsw_sp_port_vlan_router_join(mlxsw_sp_port_vlan, l3_dev,
mlxsw_sp_port_vlan_router_leave(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan)
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port_vlan->mlxsw_sp_port->mlxsw_sp;
__mlxsw_sp_port_vlan_router_leave(mlxsw_sp_port_vlan);
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_vid(mlxsw_sp_port, vid);
if (WARN_ON(!mlxsw_sp_port_vlan))
return __mlxsw_sp_port_vlan_router_join(mlxsw_sp_port_vlan,
__mlxsw_sp_port_vlan_router_leave(mlxsw_sp_port_vlan);
mlxsw_sp_port_vlan_fid_join(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan,
struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp_port_vlan->mlxsw_sp_port;
u16 vid = mlxsw_sp_port_vlan->vid;
mlxsw_sp_port_vlan->fid = fid;
mlxsw_sp_port_vlan_fid_leave(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan)
struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp_port_vlan->mlxsw_sp_port;
struct mlxsw_sp_fid *fid = mlxsw_sp_port_vlan->fid;
u16 vid = mlxsw_sp_port_vlan->vid;
mlxsw_sp_port_vlan->fid = NULL;
mlxsw_sp_port_vlan_bridge_join(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan,
struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp_port_vlan->mlxsw_sp_port;
u16 vid = mlxsw_sp_port_vlan->vid;
if (mlxsw_sp_port_vlan->bridge_port)
err = mlxsw_sp_port_vlan_fid_join(mlxsw_sp_port_vlan, bridge_port,
list_add(&mlxsw_sp_port_vlan->bridge_vlan_node,
mlxsw_sp_port_vlan->bridge_port = bridge_port;
mlxsw_sp_port_vlan_fid_leave(mlxsw_sp_port_vlan);
mlxsw_sp_port_vlan_bridge_leave(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan)
struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp_port_vlan->mlxsw_sp_port;
struct mlxsw_sp_fid *fid = mlxsw_sp_port_vlan->fid;
u16 vid = mlxsw_sp_port_vlan->vid;
bridge_port = mlxsw_sp_port_vlan->bridge_port;
list_del(&mlxsw_sp_port_vlan->bridge_vlan_node);
mlxsw_sp_port_vlan_fid_leave(mlxsw_sp_port_vlan);
mlxsw_sp_port_vlan->bridge_port = NULL;
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_vid(mlxsw_sp_port, vid);
if (mlxsw_sp_port_vlan &&
mlxsw_sp_port_vlan->bridge_port != bridge_port)
if (!mlxsw_sp_port_vlan) {
mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_create(mlxsw_sp_port,
if (IS_ERR(mlxsw_sp_port_vlan))
return PTR_ERR(mlxsw_sp_port_vlan);
err = mlxsw_sp_port_vlan_bridge_join(mlxsw_sp_port_vlan, bridge_port,
mlxsw_sp_port_vlan_destroy(mlxsw_sp_port_vlan);
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_bridge(mlxsw_sp_port,
if (!mlxsw_sp_port_vlan)
fid_index = mlxsw_sp_fid_index(mlxsw_sp_port_vlan->fid);
vid = mlxsw_sp_port_vlan->vid;
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_bridge(mlxsw_sp_port,
if (!mlxsw_sp_port_vlan)
fid_index = mlxsw_sp_fid_index(mlxsw_sp_port_vlan->fid);
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_vid(mlxsw_sp_port, vid);
if (WARN_ON(!mlxsw_sp_port_vlan))
mlxsw_sp_port_vlan_bridge_leave(mlxsw_sp_port_vlan);
mlxsw_sp_port_vlan_destroy(mlxsw_sp_port_vlan);
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_bridge(mlxsw_sp_port,
if (!mlxsw_sp_port_vlan)
fid_index = mlxsw_sp_fid_index(mlxsw_sp_port_vlan->fid);
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
list_for_each_entry(mlxsw_sp_port_vlan, &mlxsw_sp_port->vlans_list,
if (mlxsw_sp_port_vlan->bridge_port &&
mlxsw_sp_port_vlan->bridge_port->bridge_device->dev ==
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_vid(mlxsw_sp_port, vid);
if (WARN_ON(!mlxsw_sp_port_vlan))
if (mlxsw_sp_port_vlan->fid)
mlxsw_sp_port_vlan_router_leave(mlxsw_sp_port_vlan);
err = mlxsw_sp_port_vlan_bridge_join(mlxsw_sp_port_vlan, bridge_port,
mlxsw_sp_port_vlan_bridge_leave(mlxsw_sp_port_vlan);
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_vid(mlxsw_sp_port, vid);
if (!mlxsw_sp_port_vlan || !mlxsw_sp_port_vlan->bridge_port)
mlxsw_sp_port_vlan_bridge_leave(mlxsw_sp_port_vlan);
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_fid(mlxsw_sp_port, fid);
if (!mlxsw_sp_port_vlan) {
bridge_port = mlxsw_sp_port_vlan->bridge_port;
vid = bridge_device->vlan_enabled ? mlxsw_sp_port_vlan->vid : 0;
evid = mlxsw_sp_port_vlan->vid;
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_fid(mlxsw_sp_port, fid);
if (!mlxsw_sp_port_vlan) {
bridge_port = mlxsw_sp_port_vlan->bridge_port;
vid = bridge_device->vlan_enabled ? mlxsw_sp_port_vlan->vid : 0;
lag_vid = mlxsw_sp_port_vlan->vid;
static struct mlxsw_sp_port_vlan *
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
list_for_each_entry(mlxsw_sp_port_vlan, &mlxsw_sp_port->vlans_list,
if (!mlxsw_sp_port_vlan->bridge_port)
if (mlxsw_sp_port_vlan->bridge_port->bridge_device !=
mlxsw_sp_port_vlan->vid != vid)
return mlxsw_sp_port_vlan;
static struct mlxsw_sp_port_vlan*
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
list_for_each_entry(mlxsw_sp_port_vlan, &mlxsw_sp_port->vlans_list,
struct mlxsw_sp_fid *fid = mlxsw_sp_port_vlan->fid;
return mlxsw_sp_port_vlan;
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
list_for_each_entry(mlxsw_sp_port_vlan, &bridge_vlan->port_vlan_list,
if (mlxsw_sp_port_vlan->mlxsw_sp_port != mlxsw_sp_port)
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
list_for_each_entry(mlxsw_sp_port_vlan, &bridge_vlan->port_vlan_list,
if (mlxsw_sp_port_vlan->mlxsw_sp_port != mlxsw_sp_port)
return mlxsw_sp_fid_flood_set(mlxsw_sp_port_vlan->fid,
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
list_for_each_entry(mlxsw_sp_port_vlan, &bridge_vlan->port_vlan_list,
u16 local_port = mlxsw_sp_port_vlan->mlxsw_sp_port->local_port;
err = mlxsw_sp_fid_flood_set(mlxsw_sp_port_vlan->fid,
list_for_each_entry_continue_reverse(mlxsw_sp_port_vlan,
u16 local_port = mlxsw_sp_port_vlan->mlxsw_sp_port->local_port;
mlxsw_sp_fid_flood_set(mlxsw_sp_port_vlan->fid, packet_type,
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
list_for_each_entry(mlxsw_sp_port_vlan, &bridge_vlan->port_vlan_list,
if (mlxsw_sp_port_vlan->mlxsw_sp_port != mlxsw_sp_port)