提交 1b8f09a0 编写于 作者: I Ido Schimmel 提交者: David S. Miller

mlxsw: spectrum_router: Destroy RIF only based on its struct

Now that all the information to create a RIF is contained within the RIF
struct itself, we can also simplify the destruction logic.
Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
Signed-off-by: NJiri Pirko <jiri@mellanox.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 ab01ae91
...@@ -3091,11 +3091,9 @@ mlxsw_sp_port_vlan_rif_sp_create(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan, ...@@ -3091,11 +3091,9 @@ mlxsw_sp_port_vlan_rif_sp_create(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan,
} }
static void static void
mlxsw_sp_port_vlan_rif_sp_destroy(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan, mlxsw_sp_port_vlan_rif_sp_destroy(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_rif *rif) struct mlxsw_sp_rif *rif)
{ {
struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp_port_vlan->mlxsw_sp_port;
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
struct mlxsw_sp_vr *vr = &mlxsw_sp->router->vrs[rif->vr_id]; struct mlxsw_sp_vr *vr = &mlxsw_sp->router->vrs[rif->vr_id];
struct net_device *l3_dev = rif->dev; struct net_device *l3_dev = rif->dev;
struct mlxsw_sp_fid *f = rif->f; struct mlxsw_sp_fid *f = rif->f;
...@@ -3124,11 +3122,12 @@ mlxsw_sp_port_vlan_rif_sp_join(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan, ...@@ -3124,11 +3122,12 @@ mlxsw_sp_port_vlan_rif_sp_join(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan,
struct net_device *l3_dev) struct net_device *l3_dev)
{ {
struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp_port_vlan->mlxsw_sp_port; struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp_port_vlan->mlxsw_sp_port;
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
u16 vid = mlxsw_sp_port_vlan->vid; u16 vid = mlxsw_sp_port_vlan->vid;
struct mlxsw_sp_rif *rif; struct mlxsw_sp_rif *rif;
int err; int err;
rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp_port->mlxsw_sp, l3_dev); rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, l3_dev);
if (!rif) { if (!rif) {
rif = mlxsw_sp_port_vlan_rif_sp_create(mlxsw_sp_port_vlan, rif = mlxsw_sp_port_vlan_rif_sp_create(mlxsw_sp_port_vlan,
l3_dev); l3_dev);
...@@ -3163,7 +3162,7 @@ mlxsw_sp_port_vlan_rif_sp_join(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan, ...@@ -3163,7 +3162,7 @@ mlxsw_sp_port_vlan_rif_sp_join(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan,
mlxsw_sp_port_vid_learning_set(mlxsw_sp_port, vid, true); mlxsw_sp_port_vid_learning_set(mlxsw_sp_port, vid, true);
err_port_vid_learning_set: err_port_vid_learning_set:
if (rif->f->ref_count == 0) if (rif->f->ref_count == 0)
mlxsw_sp_port_vlan_rif_sp_destroy(mlxsw_sp_port_vlan, rif); mlxsw_sp_port_vlan_rif_sp_destroy(mlxsw_sp, rif);
return err; return err;
} }
...@@ -3171,6 +3170,7 @@ static void ...@@ -3171,6 +3170,7 @@ static void
mlxsw_sp_port_vlan_rif_sp_leave(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan) mlxsw_sp_port_vlan_rif_sp_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_port *mlxsw_sp_port = mlxsw_sp_port_vlan->mlxsw_sp_port;
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
struct mlxsw_sp_fid *fid = mlxsw_sp_port_vlan->fid; struct mlxsw_sp_fid *fid = mlxsw_sp_port_vlan->fid;
u16 vid = mlxsw_sp_port_vlan->vid; u16 vid = mlxsw_sp_port_vlan->vid;
...@@ -3184,7 +3184,7 @@ mlxsw_sp_port_vlan_rif_sp_leave(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan) ...@@ -3184,7 +3184,7 @@ mlxsw_sp_port_vlan_rif_sp_leave(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan)
mlxsw_sp_port_vid_learning_set(mlxsw_sp_port, vid, true); mlxsw_sp_port_vid_learning_set(mlxsw_sp_port, vid, true);
if (fid->ref_count == 0) if (fid->ref_count == 0)
mlxsw_sp_port_vlan_rif_sp_destroy(mlxsw_sp_port_vlan, fid->rif); mlxsw_sp_port_vlan_rif_sp_destroy(mlxsw_sp, fid->rif);
} }
static int mlxsw_sp_inetaddr_port_vlan_event(struct net_device *l3_dev, static int mlxsw_sp_inetaddr_port_vlan_event(struct net_device *l3_dev,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册