[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200722101417.40c5a1d6@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Wed, 22 Jul 2020 10:14:17 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Parav Pandit <parav@...lanox.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, jiri@...lanox.com
Subject: Re: [PATCH net-next] devlink: Always use user_ptr[0] for devlink
and simplify post_doit
On Wed, 22 Jul 2020 18:57:11 +0300 Parav Pandit wrote:
> Currently devlink instance is searched on all doit() operations.
> But it is optionally stored into user_ptr[0]. This requires
> rediscovering devlink again doing post_doit().
>
> Few devlink commands related to port shared buffers needs 3 pointers
> (devlink, devlink_port, and devlink_sb) while executing doit commands.
> Though devlink pointer can be derived from the devlink_port during
> post_doit() operation when doit() callback has acquired devlink
> instance lock, relying on such scheme to access devlik pointer makes
> code very fragile.
>
> Hence, to avoid ambiguity in post_doit() and to avoid searching
> devlink instance again, simplify code by always storing devlink
> instance in user_ptr[0] and derive devlink_sb pointer in their
> respective callback routines.
>
> Signed-off-by: Parav Pandit <parav@...lanox.com>
> Reviewed-by: Jiri Pirko <jiri@...lanox.com>
Other options include having some static variable (since doit is always
under devlink_mutex AFAICS) or doing a tiny allocation to fit more
pointers. But whatever:
Acked-by: Jakub Kicinski <kuba@...nel.org>
Powered by blists - more mailing lists