From: Paolo Abeni <pabeni@redhat.com>
To: Petr Machata <petrm@nvidia.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org
Cc: Ido Schimmel <idosch@nvidia.com>, Amit Cohen <amcohen@nvidia.com>,
mlxsw@nvidia.com
Subject: Re: [PATCH net-next 04/10] mlxsw: spectrum_router: Access rif->dev from params in mlxsw_sp_rif_create()
Date: Wed, 14 Jun 2023 13:22:02 +0200 [thread overview]
Message-ID: <4c056da27c19d95ffeaba5acf1427ecadfc3f94c.camel@redhat.com> (raw)
In-Reply-To: <7397c89078f4736857e9f8cbcf41f9b361960cf9.1686581444.git.petrm@nvidia.com>
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@nvidia.com>
> Reviewed-by: Amit Cohen <amcohen@nvidia.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
next prev parent reply other threads:[~2023-06-14 11:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-12 15:30 [PATCH net-next 00/10] mlxsw: Preparations for out-of-order-operations patches Petr Machata
2023-06-12 15:31 ` [PATCH net-next 01/10] mlxsw: spectrum_router: Extract a helper from mlxsw_sp_port_vlan_router_join() Petr Machata
2023-06-12 15:31 ` [PATCH net-next 02/10] mlxsw: spectrum_router: Add a helper specifically for joining a LAG Petr Machata
2023-06-12 15:31 ` [PATCH net-next 03/10] mlxsw: spectrum_router: Access rif->dev through a helper Petr Machata
2023-06-12 15:31 ` [PATCH net-next 04/10] mlxsw: spectrum_router: Access rif->dev from params in mlxsw_sp_rif_create() Petr Machata
2023-06-14 11:22 ` Paolo Abeni [this message]
2023-06-14 13:13 ` Petr Machata
2023-06-12 15:31 ` [PATCH net-next 05/10] mlxsw: spectrum_router: Access nh->rif->dev through a helper Petr Machata
2023-06-12 15:31 ` [PATCH net-next 06/10] mlxsw: spectrum_router: Access nhgi->rif " Petr Machata
2023-06-12 15:31 ` [PATCH net-next 07/10] mlxsw: spectrum_router: Extract a helper to free a RIF Petr Machata
2023-06-12 15:31 ` [PATCH net-next 08/10] mlxsw: spectrum_router: Add a helper to check if netdev has addresses Petr Machata
2023-06-12 15:31 ` [PATCH net-next 09/10] mlxsw: spectrum_router: Extract a helper for RIF migration Petr Machata
2023-06-12 15:31 ` [PATCH net-next 10/10] mlxsw: spectrum_router: Move IPIP init up Petr Machata
2023-06-14 11:30 ` [PATCH net-next 00/10] mlxsw: Preparations for out-of-order-operations patches patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4c056da27c19d95ffeaba5acf1427ecadfc3f94c.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=amcohen@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=mlxsw@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=petrm@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).