]> git.baikalelectronics.ru Git - kernel.git/commit
devlink: Count struct devlink consumers
authorLeon Romanovsky <leonro@nvidia.com>
Sat, 14 Aug 2021 09:57:28 +0000 (12:57 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sat, 14 Aug 2021 12:59:10 +0000 (13:59 +0100)
commit355e81635a1a66e696730e7cb1606685acea0cd8
treefefa6f3a33ef008dea4a8f615ebafd3e1a8c9d9b
parentd7d5acf23eefe5309fda1a2fdf641f65b8f3f0cd
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>
include/net/devlink.h
net/core/devlink.c