Subject: Doubt about locking in ixgb driver

From: Mithlesh Thukral <[email-masked]>
Date: Wed, 9 Aug 2006 18:54:14 +0530

hi all,

The transmit functions of ethernet drivers (dev->hard_start_xmit) are 
protected to prevent multiple execution of transmits going  in parallel. The 
general scheme used by most of driver is :
1. Reset NETIF_F_LLTX flag in dev->features and then use kernel locking given 
through HARD_TX_LOCK (net/core/dev.c:3417)
		OR
2. Use a internal lock of driver generally kept in adapter to prevent multiple 
accesses.

In ixgb driver (drivers/net/ixgb/), there is a lock in adapter of driver 
(adapter->tx_lock). But this is left before the ixgb_xmit_frame() function 
returns. The access to adapter->tx_ring.next_to_use which i suppose will be 
the index of next element to use from tx_ring is accessed outside the area 
where lock is held. What will prevent race condition during accessing 
adapter->tx_ring.next_to_use ?
How does multiple instances of xmit not run or multiple instances of xmit 
running is fine ?

Regards,
Mithlesh Thukral