All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC,PATCH 1/2] netdevice: Add netif_tx_lock_q
@ 2020-03-24  9:38 David Wu
  2020-03-24  9:38 ` [RFC,PATCH 2/2] net: stmmac: Change the tx clean lock David Wu
  0 siblings, 1 reply; 4+ messages in thread
From: David Wu @ 2020-03-24  9:38 UTC (permalink / raw)
  To: netdev
  Cc: davem, kuba, joabreu, alexandre.torgue, peppe.cavallaro,
	linux-kernel, David Wu

It is similar to netif_tx_lock, but only locks one queue,
so it seems to be suitable for multiple queues.

If the current queue status is frozen, it will requeue skb,
which will not block the current thread, it improve performance
when tested.

Signed-off-by: David Wu <david.wu@rock-chips.com>
---
 include/linux/netdevice.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index b6fedd54cd8e..30054a94210e 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -4085,6 +4085,16 @@ static inline void netif_tx_lock(struct net_device *dev)
 	}
 }
 
+static inline void netif_tx_lock_q(struct netdev_queue *txq)
+{
+	int cpu;
+
+	cpu = smp_processor_id();
+	__netif_tx_lock(txq, cpu);
+	set_bit(__QUEUE_STATE_FROZEN, &txq->state);
+	__netif_tx_unlock(txq);
+}
+
 static inline void netif_tx_lock_bh(struct net_device *dev)
 {
 	local_bh_disable();
@@ -4108,6 +4118,12 @@ static inline void netif_tx_unlock(struct net_device *dev)
 	spin_unlock(&dev->tx_global_lock);
 }
 
+static inline void netif_tx_unlock_q(struct netdev_queue *txq)
+{
+	clear_bit(__QUEUE_STATE_FROZEN, &txq->state);
+	netif_schedule_queue(txq);
+}
+
 static inline void netif_tx_unlock_bh(struct net_device *dev)
 {
 	netif_tx_unlock(dev);
-- 
2.19.1




^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-16 10:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-24  9:38 [RFC,PATCH 1/2] netdevice: Add netif_tx_lock_q David Wu
2020-03-24  9:38 ` [RFC,PATCH 2/2] net: stmmac: Change the tx clean lock David Wu
2020-04-13 14:31   ` Jose Abreu
2020-04-16 10:46     ` David Wu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.