[NET]: netdevice locking assumptions documentation
Update the documentation about locking assumptions. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
963bd949b1
commit
1722933323
|
@ -20,7 +20,6 @@ private data which gets freed when the network device is freed. If
|
||||||
separately allocated data is attached to the network device
|
separately allocated data is attached to the network device
|
||||||
(dev->priv) then it is up to the module exit handler to free that.
|
(dev->priv) then it is up to the module exit handler to free that.
|
||||||
|
|
||||||
|
|
||||||
struct net_device synchronization rules
|
struct net_device synchronization rules
|
||||||
=======================================
|
=======================================
|
||||||
dev->open:
|
dev->open:
|
||||||
|
@ -43,16 +42,17 @@ dev->get_stats:
|
||||||
|
|
||||||
dev->hard_start_xmit:
|
dev->hard_start_xmit:
|
||||||
Synchronization: netif_tx_lock spinlock.
|
Synchronization: netif_tx_lock spinlock.
|
||||||
|
|
||||||
When the driver sets NETIF_F_LLTX in dev->features this will be
|
When the driver sets NETIF_F_LLTX in dev->features this will be
|
||||||
called without holding netif_tx_lock. In this case the driver
|
called without holding netif_tx_lock. In this case the driver
|
||||||
has to lock by itself when needed. It is recommended to use a try lock
|
has to lock by itself when needed. It is recommended to use a try lock
|
||||||
for this and return -1 when the spin lock fails.
|
for this and return NETDEV_TX_LOCKED when the spin lock fails.
|
||||||
The locking there should also properly protect against
|
The locking there should also properly protect against
|
||||||
set_multicast_list
|
set_multicast_list.
|
||||||
Context: Process with BHs disabled or BH (timer).
|
|
||||||
Notes: netif_queue_stopped() is guaranteed false
|
Context: Process with BHs disabled or BH (timer),
|
||||||
Interrupts must be enabled when calling hard_start_xmit.
|
will be called with interrupts disabled by netconsole.
|
||||||
(Interrupts must also be enabled when enabling the BH handler.)
|
|
||||||
Return codes:
|
Return codes:
|
||||||
o NETDEV_TX_OK everything ok.
|
o NETDEV_TX_OK everything ok.
|
||||||
o NETDEV_TX_BUSY Cannot transmit packet, try later
|
o NETDEV_TX_BUSY Cannot transmit packet, try later
|
||||||
|
@ -74,4 +74,5 @@ dev->poll:
|
||||||
Synchronization: __LINK_STATE_RX_SCHED bit in dev->state. See
|
Synchronization: __LINK_STATE_RX_SCHED bit in dev->state. See
|
||||||
dev_close code and comments in net/core/dev.c for more info.
|
dev_close code and comments in net/core/dev.c for more info.
|
||||||
Context: softirq
|
Context: softirq
|
||||||
|
will be called with interrupts disabled by netconsole.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue