[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220825103400.1356995-1-jiri@resnulli.us>
Date: Thu, 25 Aug 2022 12:33:53 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
edumazet@...gle.com, andrew@...n.ch, vivien.didelot@...il.com,
f.fainelli@...il.com, olteanv@...il.com, tariqt@...dia.com,
moshe@...dia.com, saeedm@...dia.com
Subject: [patch net-next 0/7] devlink: sanitize per-port region creation/destruction
From: Jiri Pirko <jiri@...dia.com>
Currently the only user of per-port devlink regions is DSA. All drivers
that use regions register them before devlink registration. For DSA,
this was not possible as the internals of struct devlink_port needed for
region creation are initialized during port registration.
This introduced a mismatch in creation flow of devlink and devlink port
regions. As you can see, it causes the DSA driver to make the port
init/exit flow a bit cumbersome.
Fix this by introducing port_init/fini() which could be optionally
called by drivers like DSA, to prepare struct devlink_port to be used
for region creation purposes before devlink port register is called.
Force similar limitation as for devlink params and disallow to create
regions after devlink or devlink port are registered. That allows to
simplify the devlink region internal API to not to rely on
devlink->lock.
Tested with dsa_look with out-of-tree patch implementing devlink port
regions there kindly provided by Vladimir Oltean.
Jiri Pirko (7):
netdevsim: don't re-create dummy region during devlink reload
net: devlink: introduce port registered assert helper and use it
net: devlink: introduce a flag to indicate devlink port being
registered
net: devlink: add port_init/fini() helpers to allow
pre-register/post-unregister functions
net: dsa: move port_setup/teardown to be called outside devlink port
registered area
net: dsa: don't do devlink port setup early
net: devlink: convert region create/destroy() to be forbidden on
registered devlink/port
drivers/net/ethernet/mellanox/mlx4/crdump.c | 20 +-
drivers/net/netdevsim/dev.c | 18 +-
include/net/devlink.h | 12 +-
net/core/devlink.c | 154 ++++++++--------
net/dsa/dsa2.c | 191 ++++++++------------
5 files changed, 178 insertions(+), 217 deletions(-)
--
2.37.1
Powered by blists - more mailing lists