Commit deeaa371 authored by Petr Machata's avatar Petr Machata Committed by Jakub Kicinski

mlxsw: spectrum_router: FIB: Use tracker helpers to hold & put netdevices

Using the tracking helpers makes it easier to debug netdevice refcount
imbalances when CONFIG_NET_DEV_REFCNT_TRACKER is enabled.

Convert dev_hold() / dev_put() to netdev_hold() / netdev_put() in the
router code that deals with FIB events.
Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/5221a92e751c40447c55959f622267ccc999ed04.1690471774.git.petrm@nvidia.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 1ae489ab
...@@ -7547,6 +7547,7 @@ struct mlxsw_sp_fib6_event_work { ...@@ -7547,6 +7547,7 @@ struct mlxsw_sp_fib6_event_work {
struct mlxsw_sp_fib_event_work { struct mlxsw_sp_fib_event_work {
struct work_struct work; struct work_struct work;
netdevice_tracker dev_tracker;
union { union {
struct mlxsw_sp_fib6_event_work fib6_work; struct mlxsw_sp_fib6_event_work fib6_work;
struct fib_entry_notifier_info fen_info; struct fib_entry_notifier_info fen_info;
...@@ -7720,12 +7721,12 @@ static void mlxsw_sp_router_fibmr_event_work(struct work_struct *work) ...@@ -7720,12 +7721,12 @@ static void mlxsw_sp_router_fibmr_event_work(struct work_struct *work)
&fib_work->ven_info); &fib_work->ven_info);
if (err) if (err)
dev_warn(mlxsw_sp->bus_info->dev, "MR VIF add failed.\n"); dev_warn(mlxsw_sp->bus_info->dev, "MR VIF add failed.\n");
dev_put(fib_work->ven_info.dev); netdev_put(fib_work->ven_info.dev, &fib_work->dev_tracker);
break; break;
case FIB_EVENT_VIF_DEL: case FIB_EVENT_VIF_DEL:
mlxsw_sp_router_fibmr_vif_del(mlxsw_sp, mlxsw_sp_router_fibmr_vif_del(mlxsw_sp,
&fib_work->ven_info); &fib_work->ven_info);
dev_put(fib_work->ven_info.dev); netdev_put(fib_work->ven_info.dev, &fib_work->dev_tracker);
break; break;
} }
mutex_unlock(&mlxsw_sp->router->lock); mutex_unlock(&mlxsw_sp->router->lock);
...@@ -7796,7 +7797,8 @@ mlxsw_sp_router_fibmr_event(struct mlxsw_sp_fib_event_work *fib_work, ...@@ -7796,7 +7797,8 @@ mlxsw_sp_router_fibmr_event(struct mlxsw_sp_fib_event_work *fib_work,
case FIB_EVENT_VIF_ADD: case FIB_EVENT_VIF_ADD:
case FIB_EVENT_VIF_DEL: case FIB_EVENT_VIF_DEL:
memcpy(&fib_work->ven_info, info, sizeof(fib_work->ven_info)); memcpy(&fib_work->ven_info, info, sizeof(fib_work->ven_info));
dev_hold(fib_work->ven_info.dev); netdev_hold(fib_work->ven_info.dev, &fib_work->dev_tracker,
GFP_ATOMIC);
break; break;
} }
} }
......
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