Commit ccd56a5f authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller

mlxsw: spectrum_router: Prepare function to return errors

The function mlxsw_sp_router_fib6_event() takes care of preparing the
needed information for the work item that actually inserts the route
into the device.

When processing an IPv6 multipath route, the function will need to
allocate an array to store pointers to all the sibling routes.

Change the function's signature to return an error code and adjust the
single call site.
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 20247fca
...@@ -6064,8 +6064,8 @@ static void mlxsw_sp_router_fib4_event(struct mlxsw_sp_fib_event_work *fib_work, ...@@ -6064,8 +6064,8 @@ static void mlxsw_sp_router_fib4_event(struct mlxsw_sp_fib_event_work *fib_work,
} }
} }
static void mlxsw_sp_router_fib6_event(struct mlxsw_sp_fib_event_work *fib_work, static int mlxsw_sp_router_fib6_event(struct mlxsw_sp_fib_event_work *fib_work,
struct fib_notifier_info *info) struct fib_notifier_info *info)
{ {
struct fib6_entry_notifier_info *fen6_info; struct fib6_entry_notifier_info *fen6_info;
...@@ -6079,6 +6079,8 @@ static void mlxsw_sp_router_fib6_event(struct mlxsw_sp_fib_event_work *fib_work, ...@@ -6079,6 +6079,8 @@ static void mlxsw_sp_router_fib6_event(struct mlxsw_sp_fib_event_work *fib_work,
fib6_info_hold(fib_work->fen6_info.rt); fib6_info_hold(fib_work->fen6_info.rt);
break; break;
} }
return 0;
} }
static void static void
...@@ -6221,7 +6223,9 @@ static int mlxsw_sp_router_fib_event(struct notifier_block *nb, ...@@ -6221,7 +6223,9 @@ static int mlxsw_sp_router_fib_event(struct notifier_block *nb,
break; break;
case AF_INET6: case AF_INET6:
INIT_WORK(&fib_work->work, mlxsw_sp_router_fib6_event_work); INIT_WORK(&fib_work->work, mlxsw_sp_router_fib6_event_work);
mlxsw_sp_router_fib6_event(fib_work, info); err = mlxsw_sp_router_fib6_event(fib_work, info);
if (err)
goto err_fib_event;
break; break;
case RTNL_FAMILY_IP6MR: case RTNL_FAMILY_IP6MR:
case RTNL_FAMILY_IPMR: case RTNL_FAMILY_IPMR:
...@@ -6233,6 +6237,10 @@ static int mlxsw_sp_router_fib_event(struct notifier_block *nb, ...@@ -6233,6 +6237,10 @@ static int mlxsw_sp_router_fib_event(struct notifier_block *nb,
mlxsw_core_schedule_work(&fib_work->work); mlxsw_core_schedule_work(&fib_work->work);
return NOTIFY_DONE; return NOTIFY_DONE;
err_fib_event:
kfree(fib_work);
return NOTIFY_BAD;
} }
struct mlxsw_sp_rif * struct mlxsw_sp_rif *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment