summaryrefslogtreecommitdiffstats
path: root/include/net/devlink.h
diff options
context:
space:
mode:
authorLeon Romanovsky <leonro@nvidia.com>2021-08-14 12:57:28 +0300
committerDavid S. Miller <davem@davemloft.net>2021-08-14 13:59:10 +0100
commit437ebfd90a2567aab19dce47bafc81ebd8a63324 (patch)
treefefa6f3a33ef008dea4a8f615ebafd3e1a8c9d9b /include/net/devlink.h
parent7ca973dc9fe589dc0ab2650641f4c7a19cc49ecd (diff)
downloadlinux-437ebfd90a2567aab19dce47bafc81ebd8a63324.tar.gz
linux-437ebfd90a2567aab19dce47bafc81ebd8a63324.tar.bz2
linux-437ebfd90a2567aab19dce47bafc81ebd8a63324.zip
devlink: Count struct devlink consumers
The struct devlink itself is protected by internal lock and doesn't need global lock during operation. That global lock is used to protect addition/removal new devlink instances from the global list in use by all devlink consumers in the system. The future conversion of linked list to be xarray will allow us to actually delete that lock, but first we need to count all struct devlink users. The reference counting provides us a way to ensure that no new user space commands success to grab devlink instance which is going to be destroyed makes it is safe to access it without lock. Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/devlink.h')
-rw-r--r--include/net/devlink.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/net/devlink.h b/include/net/devlink.h
index 1151497c0ec5..4c60d61d92da 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -56,6 +56,8 @@ struct devlink {
*/
u8 reload_failed:1,
reload_enabled:1;
+ refcount_t refcount;
+ struct completion comp;
char priv[0] __aligned(NETDEV_ALIGN);
};