mbox series

[net-next,0/5] devlink: embed driver's priv data callback param into devlink_resource

Message ID 20240806143307.14839-1-przemyslaw.kitszel@intel.com (mailing list archive)
Headers show
Series devlink: embed driver's priv data callback param into devlink_resource | expand

Message

Przemek Kitszel Aug. 6, 2024, 2:33 p.m. UTC
(Patch 1)
Convert dsa to use devl_* variants of devlink resource related
calls, so we could remove devlink_* variants in next 2 patches.

(Patches 2,3)
Remove some unused functions that would otherwise need an update.

(Patch 4, the main one)
Then extend devlink resource to embed driver's priv data callback,
instead just storing a pointer (so drivers could put more context for
similar resource getters, to handle them via simple single function
instead of dumb duplication).

(Patch 5)
Make use of the new possibility from patch 4, I've picked the most
repetitive case.

Motivation: current API was to distracting for me to focus on adding my
new resources :)

I'm fine with it going through mlxsw or just netdev tree.

Przemek Kitszel (5):
  net: dsa: replace devlink resource registration calls by devl_
    variants
  devlink: remove unused devlink_resource_occ_get_register() and
    _unregister()
  devlink: remove unused devlink_resource_register()
  devlink: embed driver's priv data callback param into devlink_resource
  mlxsw: spectrum_kvdl: combine devlink resource occupation getters

 .../net/ethernet/mellanox/mlxsw/spectrum.h    |  5 +
 include/net/devlink.h                         | 18 +---
 .../ethernet/mellanox/mlx5/core/sf/hw_table.c |  5 +-
 drivers/net/ethernet/mellanox/mlxsw/core.c    |  5 +-
 .../net/ethernet/mellanox/mlxsw/spectrum.c    | 19 ++--
 .../ethernet/mellanox/mlxsw/spectrum1_kvdl.c  | 80 +++++++--------
 .../ethernet/mellanox/mlxsw/spectrum_cnt.c    |  9 +-
 .../mellanox/mlxsw/spectrum_policer.c         |  6 +-
 .../mellanox/mlxsw/spectrum_port_range.c      |  2 +-
 .../ethernet/mellanox/mlxsw/spectrum_router.c |  4 +-
 .../ethernet/mellanox/mlxsw/spectrum_span.c   |  3 +-
 drivers/net/netdevsim/dev.c                   | 14 +--
 drivers/net/netdevsim/fib.c                   | 10 +-
 net/devlink/resource.c                        | 97 +++----------------
 net/dsa/devlink.c                             | 23 +++--
 15 files changed, 115 insertions(+), 185 deletions(-)


base-commit: 10a6545f0bdcbb920c6a8a033fe342111d204915

Comments

Jiri Pirko Aug. 7, 2024, 6:51 a.m. UTC | #1
Tue, Aug 06, 2024 at 04:33:02PM CEST, przemyslaw.kitszel@intel.com wrote:
>(Patch 1)
>Convert dsa to use devl_* variants of devlink resource related
>calls, so we could remove devlink_* variants in next 2 patches.
>
>(Patches 2,3)
>Remove some unused functions that would otherwise need an update.
>
>(Patch 4, the main one)
>Then extend devlink resource to embed driver's priv data callback,
>instead just storing a pointer (so drivers could put more context for
>similar resource getters, to handle them via simple single function
>instead of dumb duplication).
>
>(Patch 5)
>Make use of the new possibility from patch 4, I've picked the most
>repetitive case.
>
>Motivation: current API was to distracting for me to focus on adding my
>new resources :)

Hmm, I don't really understand how this justifies. It just makes code
harder to follow and introduces oddities, like passing sizeof(void *).
Please don't.

>
>I'm fine with it going through mlxsw or just netdev tree.
>
>Przemek Kitszel (5):
>  net: dsa: replace devlink resource registration calls by devl_
>    variants
>  devlink: remove unused devlink_resource_occ_get_register() and
>    _unregister()
>  devlink: remove unused devlink_resource_register()
>  devlink: embed driver's priv data callback param into devlink_resource
>  mlxsw: spectrum_kvdl: combine devlink resource occupation getters
>
> .../net/ethernet/mellanox/mlxsw/spectrum.h    |  5 +
> include/net/devlink.h                         | 18 +---
> .../ethernet/mellanox/mlx5/core/sf/hw_table.c |  5 +-
> drivers/net/ethernet/mellanox/mlxsw/core.c    |  5 +-
> .../net/ethernet/mellanox/mlxsw/spectrum.c    | 19 ++--
> .../ethernet/mellanox/mlxsw/spectrum1_kvdl.c  | 80 +++++++--------
> .../ethernet/mellanox/mlxsw/spectrum_cnt.c    |  9 +-
> .../mellanox/mlxsw/spectrum_policer.c         |  6 +-
> .../mellanox/mlxsw/spectrum_port_range.c      |  2 +-
> .../ethernet/mellanox/mlxsw/spectrum_router.c |  4 +-
> .../ethernet/mellanox/mlxsw/spectrum_span.c   |  3 +-
> drivers/net/netdevsim/dev.c                   | 14 +--
> drivers/net/netdevsim/fib.c                   | 10 +-
> net/devlink/resource.c                        | 97 +++----------------
> net/dsa/devlink.c                             | 23 +++--
> 15 files changed, 115 insertions(+), 185 deletions(-)
>
>
>base-commit: 10a6545f0bdcbb920c6a8a033fe342111d204915
>-- 
>2.39.3
>