devlink: expose instance locking and add locked port registering
It should be familiar and beneficial to expose devlink instance lock to the drivers. This way drivers can block devlink from calling them during critical sections without breakneck locking. Add port helpers, port splitting callbacks will be the first target. Use 'devl_' prefix for "explicitly locked" API. Initial RFC used '__devlink' but that's too much typing. devl_lock_is_held() is not defined without lockdep, which is the same behavior as lockdep_is_held() itself. Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -1479,6 +1479,17 @@ void *devlink_priv(struct devlink *devlink);
|
||||
struct devlink *priv_to_devlink(void *priv);
|
||||
struct device *devlink_to_dev(const struct devlink *devlink);
|
||||
|
||||
/* Devlink instance explicit locking */
|
||||
void devl_lock(struct devlink *devlink);
|
||||
void devl_unlock(struct devlink *devlink);
|
||||
void devl_assert_locked(struct devlink *devlink);
|
||||
bool devl_lock_is_held(struct devlink *devlink);
|
||||
|
||||
int devl_port_register(struct devlink *devlink,
|
||||
struct devlink_port *devlink_port,
|
||||
unsigned int port_index);
|
||||
void devl_port_unregister(struct devlink_port *devlink_port);
|
||||
|
||||
struct ib_device;
|
||||
|
||||
struct net *devlink_net(const struct devlink *devlink);
|
||||
|
||||
Reference in New Issue
Block a user