提交 0e6ea2a4 编写于 作者: I Ido Schimmel 提交者: David S. Miller

mlxsw: spectrum_router: Mark IPv4 specific function accordingly

The functions to create and destroy a nexthop group are IPv4 specific
and should be renamed accordingly, so that they won't be confused with
the IPv6 specific functions in follow-up patches.
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>
上级 4f1c7f1f
...@@ -1868,10 +1868,10 @@ static void mlxsw_sp_nexthop_neigh_fini(struct mlxsw_sp *mlxsw_sp, ...@@ -1868,10 +1868,10 @@ static void mlxsw_sp_nexthop_neigh_fini(struct mlxsw_sp *mlxsw_sp,
neigh_release(n); neigh_release(n);
} }
static int mlxsw_sp_nexthop_init(struct mlxsw_sp *mlxsw_sp, static int mlxsw_sp_nexthop4_init(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_nexthop_group *nh_grp, struct mlxsw_sp_nexthop_group *nh_grp,
struct mlxsw_sp_nexthop *nh, struct mlxsw_sp_nexthop *nh,
struct fib_nh *fib_nh) struct fib_nh *fib_nh)
{ {
struct net_device *dev = fib_nh->nh_dev; struct net_device *dev = fib_nh->nh_dev;
struct in_device *in_dev; struct in_device *in_dev;
...@@ -1910,16 +1910,16 @@ static int mlxsw_sp_nexthop_init(struct mlxsw_sp *mlxsw_sp, ...@@ -1910,16 +1910,16 @@ static int mlxsw_sp_nexthop_init(struct mlxsw_sp *mlxsw_sp,
return err; return err;
} }
static void mlxsw_sp_nexthop_fini(struct mlxsw_sp *mlxsw_sp, static void mlxsw_sp_nexthop4_fini(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_nexthop *nh) struct mlxsw_sp_nexthop *nh)
{ {
mlxsw_sp_nexthop_neigh_fini(mlxsw_sp, nh); mlxsw_sp_nexthop_neigh_fini(mlxsw_sp, nh);
mlxsw_sp_nexthop_rif_fini(nh); mlxsw_sp_nexthop_rif_fini(nh);
mlxsw_sp_nexthop_remove(mlxsw_sp, nh); mlxsw_sp_nexthop_remove(mlxsw_sp, nh);
} }
static void mlxsw_sp_nexthop_event(struct mlxsw_sp *mlxsw_sp, static void mlxsw_sp_nexthop4_event(struct mlxsw_sp *mlxsw_sp,
unsigned long event, struct fib_nh *fib_nh) unsigned long event, struct fib_nh *fib_nh)
{ {
struct mlxsw_sp_nexthop_key key; struct mlxsw_sp_nexthop_key key;
struct mlxsw_sp_nexthop *nh; struct mlxsw_sp_nexthop *nh;
...@@ -1964,7 +1964,7 @@ static void mlxsw_sp_nexthop_rif_gone_sync(struct mlxsw_sp *mlxsw_sp, ...@@ -1964,7 +1964,7 @@ static void mlxsw_sp_nexthop_rif_gone_sync(struct mlxsw_sp *mlxsw_sp,
} }
static struct mlxsw_sp_nexthop_group * static struct mlxsw_sp_nexthop_group *
mlxsw_sp_nexthop_group_create(struct mlxsw_sp *mlxsw_sp, struct fib_info *fi) mlxsw_sp_nexthop4_group_create(struct mlxsw_sp *mlxsw_sp, struct fib_info *fi)
{ {
struct mlxsw_sp_nexthop_group *nh_grp; struct mlxsw_sp_nexthop_group *nh_grp;
struct mlxsw_sp_nexthop *nh; struct mlxsw_sp_nexthop *nh;
...@@ -1988,9 +1988,9 @@ mlxsw_sp_nexthop_group_create(struct mlxsw_sp *mlxsw_sp, struct fib_info *fi) ...@@ -1988,9 +1988,9 @@ mlxsw_sp_nexthop_group_create(struct mlxsw_sp *mlxsw_sp, struct fib_info *fi)
for (i = 0; i < nh_grp->count; i++) { for (i = 0; i < nh_grp->count; i++) {
nh = &nh_grp->nexthops[i]; nh = &nh_grp->nexthops[i];
fib_nh = &fi->fib_nh[i]; fib_nh = &fi->fib_nh[i];
err = mlxsw_sp_nexthop_init(mlxsw_sp, nh_grp, nh, fib_nh); err = mlxsw_sp_nexthop4_init(mlxsw_sp, nh_grp, nh, fib_nh);
if (err) if (err)
goto err_nexthop_init; goto err_nexthop4_init;
} }
err = mlxsw_sp_nexthop_group_insert(mlxsw_sp, nh_grp); err = mlxsw_sp_nexthop_group_insert(mlxsw_sp, nh_grp);
if (err) if (err)
...@@ -1999,10 +1999,10 @@ mlxsw_sp_nexthop_group_create(struct mlxsw_sp *mlxsw_sp, struct fib_info *fi) ...@@ -1999,10 +1999,10 @@ mlxsw_sp_nexthop_group_create(struct mlxsw_sp *mlxsw_sp, struct fib_info *fi)
return nh_grp; return nh_grp;
err_nexthop_group_insert: err_nexthop_group_insert:
err_nexthop_init: err_nexthop4_init:
for (i--; i >= 0; i--) { for (i--; i >= 0; i--) {
nh = &nh_grp->nexthops[i]; nh = &nh_grp->nexthops[i];
mlxsw_sp_nexthop_fini(mlxsw_sp, nh); mlxsw_sp_nexthop4_fini(mlxsw_sp, nh);
} }
fib_info_put(nh_grp->key.fi); fib_info_put(nh_grp->key.fi);
kfree(nh_grp); kfree(nh_grp);
...@@ -2010,8 +2010,8 @@ mlxsw_sp_nexthop_group_create(struct mlxsw_sp *mlxsw_sp, struct fib_info *fi) ...@@ -2010,8 +2010,8 @@ mlxsw_sp_nexthop_group_create(struct mlxsw_sp *mlxsw_sp, struct fib_info *fi)
} }
static void static void
mlxsw_sp_nexthop_group_destroy(struct mlxsw_sp *mlxsw_sp, mlxsw_sp_nexthop4_group_destroy(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_nexthop_group *nh_grp) struct mlxsw_sp_nexthop_group *nh_grp)
{ {
struct mlxsw_sp_nexthop *nh; struct mlxsw_sp_nexthop *nh;
int i; int i;
...@@ -2019,7 +2019,7 @@ mlxsw_sp_nexthop_group_destroy(struct mlxsw_sp *mlxsw_sp, ...@@ -2019,7 +2019,7 @@ mlxsw_sp_nexthop_group_destroy(struct mlxsw_sp *mlxsw_sp,
mlxsw_sp_nexthop_group_remove(mlxsw_sp, nh_grp); mlxsw_sp_nexthop_group_remove(mlxsw_sp, nh_grp);
for (i = 0; i < nh_grp->count; i++) { for (i = 0; i < nh_grp->count; i++) {
nh = &nh_grp->nexthops[i]; nh = &nh_grp->nexthops[i];
mlxsw_sp_nexthop_fini(mlxsw_sp, nh); mlxsw_sp_nexthop4_fini(mlxsw_sp, nh);
} }
mlxsw_sp_nexthop_group_refresh(mlxsw_sp, nh_grp); mlxsw_sp_nexthop_group_refresh(mlxsw_sp, nh_grp);
WARN_ON_ONCE(nh_grp->adj_index_valid); WARN_ON_ONCE(nh_grp->adj_index_valid);
...@@ -2027,9 +2027,9 @@ mlxsw_sp_nexthop_group_destroy(struct mlxsw_sp *mlxsw_sp, ...@@ -2027,9 +2027,9 @@ mlxsw_sp_nexthop_group_destroy(struct mlxsw_sp *mlxsw_sp,
kfree(nh_grp); kfree(nh_grp);
} }
static int mlxsw_sp_nexthop_group_get(struct mlxsw_sp *mlxsw_sp, static int mlxsw_sp_nexthop4_group_get(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_fib_entry *fib_entry, struct mlxsw_sp_fib_entry *fib_entry,
struct fib_info *fi) struct fib_info *fi)
{ {
struct mlxsw_sp_nexthop_group_key key; struct mlxsw_sp_nexthop_group_key key;
struct mlxsw_sp_nexthop_group *nh_grp; struct mlxsw_sp_nexthop_group *nh_grp;
...@@ -2037,7 +2037,7 @@ static int mlxsw_sp_nexthop_group_get(struct mlxsw_sp *mlxsw_sp, ...@@ -2037,7 +2037,7 @@ static int mlxsw_sp_nexthop_group_get(struct mlxsw_sp *mlxsw_sp,
key.fi = fi; key.fi = fi;
nh_grp = mlxsw_sp_nexthop_group_lookup(mlxsw_sp, key); nh_grp = mlxsw_sp_nexthop_group_lookup(mlxsw_sp, key);
if (!nh_grp) { if (!nh_grp) {
nh_grp = mlxsw_sp_nexthop_group_create(mlxsw_sp, fi); nh_grp = mlxsw_sp_nexthop4_group_create(mlxsw_sp, fi);
if (IS_ERR(nh_grp)) if (IS_ERR(nh_grp))
return PTR_ERR(nh_grp); return PTR_ERR(nh_grp);
} }
...@@ -2046,15 +2046,15 @@ static int mlxsw_sp_nexthop_group_get(struct mlxsw_sp *mlxsw_sp, ...@@ -2046,15 +2046,15 @@ static int mlxsw_sp_nexthop_group_get(struct mlxsw_sp *mlxsw_sp,
return 0; return 0;
} }
static void mlxsw_sp_nexthop_group_put(struct mlxsw_sp *mlxsw_sp, static void mlxsw_sp_nexthop4_group_put(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_fib_entry *fib_entry) struct mlxsw_sp_fib_entry *fib_entry)
{ {
struct mlxsw_sp_nexthop_group *nh_grp = fib_entry->nh_group; struct mlxsw_sp_nexthop_group *nh_grp = fib_entry->nh_group;
list_del(&fib_entry->nexthop_group_node); list_del(&fib_entry->nexthop_group_node);
if (!list_empty(&nh_grp->fib_list)) if (!list_empty(&nh_grp->fib_list))
return; return;
mlxsw_sp_nexthop_group_destroy(mlxsw_sp, nh_grp); mlxsw_sp_nexthop4_group_destroy(mlxsw_sp, nh_grp);
} }
static bool static bool
...@@ -2322,9 +2322,9 @@ mlxsw_sp_fib4_entry_create(struct mlxsw_sp *mlxsw_sp, ...@@ -2322,9 +2322,9 @@ mlxsw_sp_fib4_entry_create(struct mlxsw_sp *mlxsw_sp,
if (err) if (err)
goto err_fib4_entry_type_set; goto err_fib4_entry_type_set;
err = mlxsw_sp_nexthop_group_get(mlxsw_sp, fib_entry, fen_info->fi); err = mlxsw_sp_nexthop4_group_get(mlxsw_sp, fib_entry, fen_info->fi);
if (err) if (err)
goto err_nexthop_group_get; goto err_nexthop4_group_get;
fib4_entry->prio = fen_info->fi->fib_priority; fib4_entry->prio = fen_info->fi->fib_priority;
fib4_entry->tb_id = fen_info->tb_id; fib4_entry->tb_id = fen_info->tb_id;
...@@ -2335,7 +2335,7 @@ mlxsw_sp_fib4_entry_create(struct mlxsw_sp *mlxsw_sp, ...@@ -2335,7 +2335,7 @@ mlxsw_sp_fib4_entry_create(struct mlxsw_sp *mlxsw_sp,
return fib4_entry; return fib4_entry;
err_nexthop_group_get: err_nexthop4_group_get:
err_fib4_entry_type_set: err_fib4_entry_type_set:
kfree(fib4_entry); kfree(fib4_entry);
return ERR_PTR(err); return ERR_PTR(err);
...@@ -2344,7 +2344,7 @@ mlxsw_sp_fib4_entry_create(struct mlxsw_sp *mlxsw_sp, ...@@ -2344,7 +2344,7 @@ mlxsw_sp_fib4_entry_create(struct mlxsw_sp *mlxsw_sp,
static void mlxsw_sp_fib4_entry_destroy(struct mlxsw_sp *mlxsw_sp, static void mlxsw_sp_fib4_entry_destroy(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_fib4_entry *fib4_entry) struct mlxsw_sp_fib4_entry *fib4_entry)
{ {
mlxsw_sp_nexthop_group_put(mlxsw_sp, &fib4_entry->common); mlxsw_sp_nexthop4_group_put(mlxsw_sp, &fib4_entry->common);
kfree(fib4_entry); kfree(fib4_entry);
} }
...@@ -3022,8 +3022,8 @@ static void mlxsw_sp_router_fib_event_work(struct work_struct *work) ...@@ -3022,8 +3022,8 @@ static void mlxsw_sp_router_fib_event_work(struct work_struct *work)
break; break;
case FIB_EVENT_NH_ADD: /* fall through */ case FIB_EVENT_NH_ADD: /* fall through */
case FIB_EVENT_NH_DEL: case FIB_EVENT_NH_DEL:
mlxsw_sp_nexthop_event(mlxsw_sp, fib_work->event, mlxsw_sp_nexthop4_event(mlxsw_sp, fib_work->event,
fib_work->fnh_info.fib_nh); fib_work->fnh_info.fib_nh);
fib_info_put(fib_work->fnh_info.fib_nh->nh_parent); fib_info_put(fib_work->fnh_info.fib_nh->nh_parent);
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册