Skip to content

Commit ee705fa

Browse files
Stanislav Fomichevkuba-moo
authored andcommitted
docs: net: document netdev notifier expectations
We don't have a consistent state yet, but document where we think we are and where we wanna be. Signed-off-by: Stanislav Fomichev <sdf@fomichev.me> Link: https://patch.msgid.link/20250401163452.622454-8-sdf@fomichev.me Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent dbfc994 commit ee705fa

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Documentation/networking/netdevices.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,29 @@ there are two sets of interfaces: ``dev_xxx`` and ``netif_xxx`` (e.g.,
343343
acquiring the instance lock themselves, while the ``netif_xxx`` functions
344344
assume that the driver has already acquired the instance lock.
345345

346+
Notifiers and netdev instance lock
347+
==================================
348+
349+
For device drivers that implement shaping or queue management APIs,
350+
some of the notifiers (``enum netdev_cmd``) are running under the netdev
351+
instance lock.
352+
353+
For devices with locked ops, currently only the following notifiers are
354+
running under the lock:
355+
* ``NETDEV_REGISTER``
356+
* ``NETDEV_UP``
357+
358+
The following notifiers are running without the lock:
359+
* ``NETDEV_UNREGISTER``
360+
361+
There are no clear expectations for the remaining notifiers. Notifiers not on
362+
the list may run with or without the instance lock, potentially even invoking
363+
the same notifier type with and without the lock from different code paths.
364+
The goal is to eventually ensure that all (or most, with a few documented
365+
exceptions) notifiers run under the instance lock. Please extend this
366+
documentation whenever you make explicit assumption about lock being held
367+
from a notifier.
368+
346369
NETDEV_INTERNAL symbol namespace
347370
================================
348371

0 commit comments

Comments
 (0)