Fri, May 08, 2026 at 02:41:54PM +0200, [email protected] wrote:
>Add .shd_init() and .shd_fini() ops, that will be called for the first
>devlink_shd_get() (to initialize driver' priv data) and on the last
>devlink_shd_put() (to allow for the cleanup). Both ops are optional.
>
>.shd_init() could return an error, which will stop creation of shd
>instance. The initializer also gets an additional, optional param,
>that driver could use for any needs.
>
>If any of the callbacks will need to get devlink instance, it could
>be accessed by shd_priv_to_devlink().
>
>Both callbacks are called with devl_lock held and devlink registered.
>
>Next commit will make use of the callbacks, another one will make use also
>of the non-null additional param (outside of this series).
>
>Reviewed-by: Aleksandr Loktionov <[email protected]>
>Signed-off-by: Przemek Kitszel <[email protected]>
>---
>(v0) first discussed at:
>https://lore.kernel.org/netdev/[email protected]
>
>v1: remove redundant added blank line (Jiri)
>---
> include/net/devlink.h                         | 26 +++++++++++++
> .../ethernet/mellanox/mlx5/core/sh_devlink.c  |  2 +-
> net/devlink/sh_dev.c                          | 38 ++++++++++++++++++-
> 3 files changed, 63 insertions(+), 3 deletions(-)
>
>diff --git a/include/net/devlink.h b/include/net/devlink.h
>index bcd31de1f890..5d3a1337bfa1 100644
>--- a/include/net/devlink.h
>+++ b/include/net/devlink.h
>@@ -1586,6 +1586,30 @@ struct devlink_ops {
>                                   struct devlink_rate *parent,
>                                   void *priv_child, void *priv_parent,
>                                   struct netlink_ext_ack *extack);
>+
>+      /**
>+       * shd_init: Shared devlink instance initializer
>+       * @priv: shd_devlink' priv
>+       * @init_param: additional param to pass to driver callback

The "param" word still pokes me to the eye. Could we figure out some
different name? "init_ctx" perhaps?

[...]

Reply via email to