mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
netdev: Move _xmit_lock and xmit_lock_owner into netdev_queue.
Accesses are mostly structured such that when there are multiple TX queues the code transformations will be a little bit simpler. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
eb6aafe3f8
commit
c773e847ea
10 changed files with 146 additions and 45 deletions
|
@ -258,7 +258,7 @@ DEFINE_PER_CPU(struct softnet_data, softnet_data);
|
|||
|
||||
#ifdef CONFIG_DEBUG_LOCK_ALLOC
|
||||
/*
|
||||
* register_netdevice() inits dev->_xmit_lock and sets lockdep class
|
||||
* register_netdevice() inits txq->_xmit_lock and sets lockdep class
|
||||
* according to dev->type
|
||||
*/
|
||||
static const unsigned short netdev_lock_type[] =
|
||||
|
@ -1758,19 +1758,19 @@ gso:
|
|||
if (dev->flags & IFF_UP) {
|
||||
int cpu = smp_processor_id(); /* ok because BHs are off */
|
||||
|
||||
if (dev->xmit_lock_owner != cpu) {
|
||||
if (txq->xmit_lock_owner != cpu) {
|
||||
|
||||
HARD_TX_LOCK(dev, cpu);
|
||||
HARD_TX_LOCK(dev, txq, cpu);
|
||||
|
||||
if (!netif_queue_stopped(dev) &&
|
||||
!netif_subqueue_stopped(dev, skb)) {
|
||||
rc = 0;
|
||||
if (!dev_hard_start_xmit(skb, dev)) {
|
||||
HARD_TX_UNLOCK(dev);
|
||||
HARD_TX_UNLOCK(dev, txq);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
HARD_TX_UNLOCK(dev);
|
||||
HARD_TX_UNLOCK(dev, txq);
|
||||
if (net_ratelimit())
|
||||
printk(KERN_CRIT "Virtual device %s asks to "
|
||||
"queue packet!\n", dev->name);
|
||||
|
@ -3761,6 +3761,20 @@ static void rollback_registered(struct net_device *dev)
|
|||
dev_put(dev);
|
||||
}
|
||||
|
||||
static void __netdev_init_queue_locks_one(struct netdev_queue *dev_queue,
|
||||
struct net_device *dev)
|
||||
{
|
||||
spin_lock_init(&dev_queue->_xmit_lock);
|
||||
netdev_set_lockdep_class(&dev_queue->_xmit_lock, dev->type);
|
||||
dev_queue->xmit_lock_owner = -1;
|
||||
}
|
||||
|
||||
static void netdev_init_queue_locks(struct net_device *dev)
|
||||
{
|
||||
__netdev_init_queue_locks_one(&dev->tx_queue, dev);
|
||||
__netdev_init_queue_locks_one(&dev->rx_queue, dev);
|
||||
}
|
||||
|
||||
/**
|
||||
* register_netdevice - register a network device
|
||||
* @dev: device to register
|
||||
|
@ -3795,9 +3809,7 @@ int register_netdevice(struct net_device *dev)
|
|||
BUG_ON(!dev_net(dev));
|
||||
net = dev_net(dev);
|
||||
|
||||
spin_lock_init(&dev->_xmit_lock);
|
||||
netdev_set_lockdep_class(&dev->_xmit_lock, dev->type);
|
||||
dev->xmit_lock_owner = -1;
|
||||
netdev_init_queue_locks(dev);
|
||||
|
||||
dev->iflink = -1;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue