[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4c056da27c19d95ffeaba5acf1427ecadfc3f94c.camel@redhat.com>
Date: Wed, 14 Jun 2023 13:22:02 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Petr Machata <petrm@...dia.com>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
<kuba@...nel.org>, netdev@...r.kernel.org
Cc: Ido Schimmel <idosch@...dia.com>, Amit Cohen <amcohen@...dia.com>,
mlxsw@...dia.com
Subject: Re: [PATCH net-next 04/10] mlxsw: spectrum_router: Access rif->dev
from params in mlxsw_sp_rif_create()
On Mon, 2023-06-12 at 17:31 +0200, Petr Machata wrote:
> The previous patch added a helper to access a netdevice given a RIF. Using
> this helper in mlxsw_sp_rif_create() is unreasonable: the netdevice was
> given in RIF creation parameters. Just take it there.
>
> Signed-off-by: Petr Machata <petrm@...dia.com>
> Reviewed-by: Amit Cohen <amcohen@...dia.com>
> ---
> drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> index e9183c223575..da582ef8efda 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> @@ -8138,7 +8138,7 @@ mlxsw_sp_rif_create(struct mlxsw_sp *mlxsw_sp,
> err = -ENOMEM;
> goto err_rif_alloc;
> }
> - dev_hold(rif->dev);
> + dev_hold(params->dev);
> mlxsw_sp->router->rifs[rif_index] = rif;
> rif->mlxsw_sp = mlxsw_sp;
> rif->ops = ops;
> @@ -8166,12 +8166,12 @@ mlxsw_sp_rif_create(struct mlxsw_sp *mlxsw_sp,
> goto err_mr_rif_add;
> }
>
> - if (netdev_offload_xstats_enabled(rif->dev,
> + if (netdev_offload_xstats_enabled(params->dev,
> NETDEV_OFFLOAD_XSTATS_TYPE_L3)) {
> err = mlxsw_sp_router_port_l3_stats_enable(rif);
> if (err)
> goto err_stats_enable;
> - mlxsw_sp_router_hwstats_notify_schedule(rif->dev);
> + mlxsw_sp_router_hwstats_notify_schedule(params->dev);
> } else {
> mlxsw_sp_rif_counters_alloc(rif);
> }
> @@ -8189,7 +8189,7 @@ mlxsw_sp_rif_create(struct mlxsw_sp *mlxsw_sp,
> mlxsw_sp_fid_put(fid);
> err_fid_get:
> mlxsw_sp->router->rifs[rif_index] = NULL;
> - dev_put(rif->dev);
> + dev_put(params->dev);
Side note: since you are touching this, and dev_{put,hold} are now
deprecated in favour of the tracker-enabled variants netdev_{put,hold},
what about a follow-up introducing the usage of the latter helpers?
Thanks!
Paolo
Powered by blists - more mailing lists