Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c578e9ab authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'netdev_tx_locked-removal'



Florian Westphal says:

====================
net: core: remove TX_LOCKED support

Not that many users left, lets kill it.

TX_LOCKED was meant to be used by LLTX drivers when spin_trylock()
failed.  Stack then re-queued if collisions happened on different
cpus or free'd the skb to prevent deadlocks.

Most of the driver removal patches fall into one of three categories:
1. remove the driver-private tx lock (and LLTX flag), or...
2. convert spin_trylock to plain spin_lock, or...
3. convert TX_LOCKED to free+TX_OK

Patches are grouped by these categories, last patch is the actual removal.
All driver changes were compile tested only with exception of atl1e.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c971c0e5 f0cdf76c
Loading
Loading
Loading
Loading
+4 −6
Original line number Original line Diff line number Diff line
@@ -131,13 +131,11 @@ stack. Driver should not change behaviour based on them.


 * LLTX driver (deprecated for hardware drivers)
 * LLTX driver (deprecated for hardware drivers)


NETIF_F_LLTX should be set in drivers that implement their own locking in
NETIF_F_LLTX is meant to be used by drivers that don't need locking at all,
transmit path or don't need locking at all (e.g. software tunnels).
e.g. software tunnels.
In ndo_start_xmit, it is recommended to use a try_lock and return
NETDEV_TX_LOCKED when the spin lock fails.  The locking should also properly
protect against other callbacks (the rules you need to find out).


Don't use it for new drivers.
This is also used in a few legacy drivers that implement their
own locking, don't use it for new (hardware) drivers.


 * netns-local device
 * netns-local device


+3 −6
Original line number Original line Diff line number Diff line
@@ -69,10 +69,9 @@ ndo_start_xmit:


	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.
	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_rx_mode. Note that the use of NETIF_F_LLTX is deprecated.
	set_rx_mode. WARNING: use of NETIF_F_LLTX is deprecated.
	Don't use it for new drivers.
	Don't use it for new drivers.


	Context: Process with BHs disabled or BH (timer),
	Context: Process with BHs disabled or BH (timer),
@@ -83,8 +82,6 @@ ndo_start_xmit:
	o NETDEV_TX_BUSY Cannot transmit packet, try later 
	o NETDEV_TX_BUSY Cannot transmit packet, try later 
	  Usually a bug, means queue start/stop flow control is broken in
	  Usually a bug, means queue start/stop flow control is broken in
	  the driver. Note: the driver must NOT put the skb in its DMA ring.
	  the driver. Note: the driver must NOT put the skb in its DMA ring.
	o NETDEV_TX_LOCKED Locking failed, please retry quickly.
	  Only valid when NETIF_F_LLTX is set.


ndo_tx_timeout:
ndo_tx_timeout:
	Synchronization: netif_tx_lock spinlock; all TX queues frozen.
	Synchronization: netif_tx_lock spinlock; all TX queues frozen.
+5 −8
Original line number Original line Diff line number Diff line
@@ -356,7 +356,7 @@ static int nes_netdev_stop(struct net_device *netdev)
/**
/**
 * nes_nic_send
 * nes_nic_send
 */
 */
static int nes_nic_send(struct sk_buff *skb, struct net_device *netdev)
static bool nes_nic_send(struct sk_buff *skb, struct net_device *netdev)
{
{
	struct nes_vnic *nesvnic = netdev_priv(netdev);
	struct nes_vnic *nesvnic = netdev_priv(netdev);
	struct nes_device *nesdev = nesvnic->nesdev;
	struct nes_device *nesdev = nesvnic->nesdev;
@@ -413,7 +413,7 @@ static int nes_nic_send(struct sk_buff *skb, struct net_device *netdev)
					netdev->name, skb_shinfo(skb)->nr_frags + 2, skb_headlen(skb));
					netdev->name, skb_shinfo(skb)->nr_frags + 2, skb_headlen(skb));
			kfree_skb(skb);
			kfree_skb(skb);
			nesvnic->tx_sw_dropped++;
			nesvnic->tx_sw_dropped++;
			return NETDEV_TX_LOCKED;
			return false;
		}
		}
		set_bit(nesnic->sq_head, nesnic->first_frag_overflow);
		set_bit(nesnic->sq_head, nesnic->first_frag_overflow);
		bus_address = pci_map_single(nesdev->pcidev, skb->data + NES_FIRST_FRAG_SIZE,
		bus_address = pci_map_single(nesdev->pcidev, skb->data + NES_FIRST_FRAG_SIZE,
@@ -454,8 +454,7 @@ static int nes_nic_send(struct sk_buff *skb, struct net_device *netdev)
	set_wqe_32bit_value(nic_sqe->wqe_words, NES_NIC_SQ_WQE_MISC_IDX, wqe_misc);
	set_wqe_32bit_value(nic_sqe->wqe_words, NES_NIC_SQ_WQE_MISC_IDX, wqe_misc);
	nesnic->sq_head++;
	nesnic->sq_head++;
	nesnic->sq_head &= nesnic->sq_size - 1;
	nesnic->sq_head &= nesnic->sq_size - 1;

	return true;
	return NETDEV_TX_OK;
}
}




@@ -673,13 +672,11 @@ static int nes_netdev_start_xmit(struct sk_buff *skb, struct net_device *netdev)
			skb_linearize(skb);
			skb_linearize(skb);
			skb_set_transport_header(skb, hoffset);
			skb_set_transport_header(skb, hoffset);
			skb_set_network_header(skb, nhoffset);
			skb_set_network_header(skb, nhoffset);
			send_rc = nes_nic_send(skb, netdev);
			if (!nes_nic_send(skb, netdev))
			if (send_rc != NETDEV_TX_OK)
				return NETDEV_TX_OK;
				return NETDEV_TX_OK;
		}
		}
	} else {
	} else {
		send_rc = nes_nic_send(skb, netdev);
		if (!nes_nic_send(skb, netdev))
		if (send_rc != NETDEV_TX_OK)
			return NETDEV_TX_OK;
			return NETDEV_TX_OK;
	}
	}


+5 −3
Original line number Original line Diff line number Diff line
@@ -543,11 +543,13 @@ int lance_start_xmit(struct sk_buff *skb, struct net_device *dev)
	static int outs;
	static int outs;
	unsigned long flags;
	unsigned long flags;


	if (!TX_BUFFS_AVAIL)
		return NETDEV_TX_LOCKED;

	netif_stop_queue(dev);
	netif_stop_queue(dev);


	if (!TX_BUFFS_AVAIL) {
		dev_consume_skb_any(skb);
		return NETDEV_TX_OK;
	}

	skblen = skb->len;
	skblen = skb->len;


#ifdef DEBUG_DRIVER
#ifdef DEBUG_DRIVER
+3 −4
Original line number Original line Diff line number Diff line
@@ -547,10 +547,8 @@ static netdev_tx_t lance_start_xmit(struct sk_buff *skb,


	local_irq_save(flags);
	local_irq_save(flags);


	if (!lance_tx_buffs_avail(lp)) {
	if (!lance_tx_buffs_avail(lp))
		local_irq_restore(flags);
		goto out_free;
		return NETDEV_TX_LOCKED;
	}


#ifdef DEBUG
#ifdef DEBUG
	/* dump the packet */
	/* dump the packet */
@@ -573,6 +571,7 @@ static netdev_tx_t lance_start_xmit(struct sk_buff *skb,


	/* Kick the lance: transmit now */
	/* Kick the lance: transmit now */
	ll->rdp = LE_C0_INEA | LE_C0_TDMD;
	ll->rdp = LE_C0_INEA | LE_C0_TDMD;
 out_free:
	dev_kfree_skb(skb);
	dev_kfree_skb(skb);


	local_irq_restore(flags);
	local_irq_restore(flags);
Loading