@@ -314,24 +314,22 @@ napi->poll:
314314 softirq
315315 will be called with interrupts disabled by netconsole.
316316
317- struct netdev_queue_mgmt_ops synchronization rules
318- ==================================================
319-
320- All queue management ndo callbacks are holding netdev instance lock.
321-
322- RTNL and netdev instance lock
323- =============================
317+ netdev instance lock
318+ ====================
324319
325320Historically, all networking control operations were protected by a single
326321global lock known as ``rtnl_lock ``. There is an ongoing effort to replace this
327322global lock with separate locks for each network namespace. Additionally,
328323properties of individual netdev are increasingly protected by per-netdev locks.
329324
330325For device drivers that implement shaping or queue management APIs, all control
331- operations will be performed under the netdev instance lock. Currently, this
332- instance lock is acquired within the context of ``rtnl_lock ``. The drivers
333- can also explicitly request instance lock to be acquired via
334- ``request_ops_lock ``. In the future, there will be an option for individual
326+ operations will be performed under the netdev instance lock.
327+ Drivers can also explicitly request instance lock to be held during ops
328+ by setting ``request_ops_lock `` to true. Code comments and docs refer
329+ to drivers which have ops called under the instance lock as "ops locked".
330+ See also the documentation of the ``lock `` member of struct net_device.
331+
332+ In the future, there will be an option for individual
335333drivers to opt out of using ``rtnl_lock `` and instead perform their control
336334operations directly under the netdev instance lock.
337335
@@ -343,8 +341,40 @@ there are two sets of interfaces: ``dev_xxx`` and ``netif_xxx`` (e.g.,
343341acquiring the instance lock themselves, while the ``netif_xxx `` functions
344342assume that the driver has already acquired the instance lock.
345343
344+ struct net_device_ops
345+ ---------------------
346+
347+ ``ndos `` are called without holding the instance lock for most drivers.
348+
349+ "Ops locked" drivers will have most of the ``ndos `` invoked under
350+ the instance lock.
351+
352+ struct ethtool_ops
353+ ------------------
354+
355+ Similarly to ``ndos `` the instance lock is only held for select drivers.
356+ For "ops locked" drivers all ethtool ops without exceptions should
357+ be called under the instance lock.
358+
359+ struct net_shaper_ops
360+ ---------------------
361+
362+ All net shaper callbacks are invoked while holding the netdev instance
363+ lock. ``rtnl_lock `` may or may not be held.
364+
365+ Note that supporting net shapers automatically enables "ops locking".
366+
367+ struct netdev_queue_mgmt_ops
368+ ----------------------------
369+
370+ All queue management callbacks are invoked while holding the netdev instance
371+ lock. ``rtnl_lock `` may or may not be held.
372+
373+ Note that supporting struct netdev_queue_mgmt_ops automatically enables
374+ "ops locking".
375+
346376Notifiers and netdev instance lock
347- ==================================
377+ ----------------------------------
348378
349379For device drivers that implement shaping or queue management APIs,
350380some of the notifiers (``enum netdev_cmd ``) are running under the netdev
0 commit comments