netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] r8169: make use of xmit_more and __netdev_sent_queue
@ 2018-11-24 23:12 Heiner Kallweit
  2018-11-24 23:13 ` [PATCH net-next 1/2] net: core: add __netdev_sent_queue as variant of __netdev_tx_sent_queue Heiner Kallweit
  2018-11-24 23:14 ` [PATCH net-next 2/2] r8169: make use of xmit_more and __netdev_sent_queue Heiner Kallweit
  0 siblings, 2 replies; 4+ messages in thread
From: Heiner Kallweit @ 2018-11-24 23:12 UTC (permalink / raw)
  To: David Miller, Realtek linux nic maintainers; +Cc: netdev@vger.kernel.org

This series adds helper __netdev_sent_queue to the core and makes use
of it in the r8169 driver.

Heiner Kallweit (2):
  net: core: add __netdev_sent_queue as variant of __netdev_tx_sent_queue
  r8169: make use of xmit_more and __netdev_sent_queue

 drivers/net/ethernet/realtek/r8169.c | 19 +++++++++----------
 include/linux/netdevice.h            |  8 ++++++++
 2 files changed, 17 insertions(+), 10 deletions(-)

-- 
2.19.1

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

* [PATCH net-next 1/2] net: core: add __netdev_sent_queue as variant of __netdev_tx_sent_queue
  2018-11-24 23:12 [PATCH net-next 0/2] r8169: make use of xmit_more and __netdev_sent_queue Heiner Kallweit
@ 2018-11-24 23:13 ` Heiner Kallweit
  2018-11-24 23:14 ` [PATCH net-next 2/2] r8169: make use of xmit_more and __netdev_sent_queue Heiner Kallweit
  1 sibling, 0 replies; 4+ messages in thread
From: Heiner Kallweit @ 2018-11-24 23:13 UTC (permalink / raw)
  To: David Miller, Realtek linux nic maintainers; +Cc: netdev@vger.kernel.org

Similar to netdev_sent_queue add helper __netdev_sent_queue as variant
of __netdev_tx_sent_queue.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 include/linux/netdevice.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 1dcc0628b..a417fa501 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3214,6 +3214,14 @@ static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes)
 	netdev_tx_sent_queue(netdev_get_tx_queue(dev, 0), bytes);
 }
 
+static inline bool __netdev_sent_queue(struct net_device *dev,
+				       unsigned int bytes,
+				       bool xmit_more)
+{
+	return __netdev_tx_sent_queue(netdev_get_tx_queue(dev, 0), bytes,
+				      xmit_more);
+}
+
 static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
 					     unsigned int pkts, unsigned int bytes)
 {
-- 
2.19.1

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

* [PATCH net-next 2/2] r8169: make use of xmit_more and __netdev_sent_queue
  2018-11-24 23:12 [PATCH net-next 0/2] r8169: make use of xmit_more and __netdev_sent_queue Heiner Kallweit
  2018-11-24 23:13 ` [PATCH net-next 1/2] net: core: add __netdev_sent_queue as variant of __netdev_tx_sent_queue Heiner Kallweit
@ 2018-11-24 23:14 ` Heiner Kallweit
  2018-11-25  1:55   ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Heiner Kallweit @ 2018-11-24 23:14 UTC (permalink / raw)
  To: David Miller, Realtek linux nic maintainers; +Cc: netdev@vger.kernel.org

Make use of xmit_more and add the functionality introduced with
3e59020abf0f ("net: bql: add __netdev_tx_sent_queue()").
I used the mlx4 driver as template.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/realtek/r8169.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 5ee684f9e..7a979c1e5 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -6070,6 +6070,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
 	dma_addr_t mapping;
 	u32 opts[2], len;
 	int frags;
+	bool stop_queue;
 
 	if (unlikely(!rtl_tx_slots_avail(tp, skb_shinfo(skb)->nr_frags))) {
 		netif_err(tp, drv, dev, "BUG! Tx Ring full when queue awake!\n");
@@ -6110,8 +6111,6 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
 
 	txd->opts2 = cpu_to_le32(opts[1]);
 
-	netdev_sent_queue(dev, skb->len);
-
 	skb_tx_timestamp(skb);
 
 	/* Force memory writes to complete before releasing descriptor */
@@ -6124,16 +6123,16 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
 
 	tp->cur_tx += frags + 1;
 
-	RTL_W8(tp, TxPoll, NPQ);
+	stop_queue = !rtl_tx_slots_avail(tp, MAX_SKB_FRAGS);
+	if (unlikely(stop_queue))
+		netif_stop_queue(dev);
 
-	mmiowb();
+	if (__netdev_sent_queue(dev, skb->len, skb->xmit_more)) {
+		RTL_W8(tp, TxPoll, NPQ);
+		mmiowb();
+	}
 
-	if (!rtl_tx_slots_avail(tp, MAX_SKB_FRAGS)) {
-		/* Avoid wrongly optimistic queue wake-up: rtl_tx thread must
-		 * not miss a ring update when it notices a stopped queue.
-		 */
-		smp_wmb();
-		netif_stop_queue(dev);
+	if (unlikely(stop_queue)) {
 		/* Sync with rtl_tx:
 		 * - publish queue status and cur_tx ring index (write barrier)
 		 * - refresh dirty_tx ring index (read barrier).
-- 
2.19.1

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

* Re: [PATCH net-next 2/2] r8169: make use of xmit_more and __netdev_sent_queue
  2018-11-24 23:14 ` [PATCH net-next 2/2] r8169: make use of xmit_more and __netdev_sent_queue Heiner Kallweit
@ 2018-11-25  1:55   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-11-25  1:55 UTC (permalink / raw)
  To: hkallweit1; +Cc: nic_swsd, netdev

From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Sun, 25 Nov 2018 00:14:58 +0100

> Make use of xmit_more and add the functionality introduced with
> 3e59020abf0f ("net: bql: add __netdev_tx_sent_queue()").
> I used the mlx4 driver as template.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Series looks great, but please fix the reverse christmas tree:

> diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
> index 5ee684f9e..7a979c1e5 100644
> --- a/drivers/net/ethernet/realtek/r8169.c
> +++ b/drivers/net/ethernet/realtek/r8169.c
> @@ -6070,6 +6070,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
>  	dma_addr_t mapping;
>  	u32 opts[2], len;
>  	int frags;
> +	bool stop_queue;

here, thanks.

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

end of thread, other threads:[~2018-11-25 12:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-24 23:12 [PATCH net-next 0/2] r8169: make use of xmit_more and __netdev_sent_queue Heiner Kallweit
2018-11-24 23:13 ` [PATCH net-next 1/2] net: core: add __netdev_sent_queue as variant of __netdev_tx_sent_queue Heiner Kallweit
2018-11-24 23:14 ` [PATCH net-next 2/2] r8169: make use of xmit_more and __netdev_sent_queue Heiner Kallweit
2018-11-25  1:55   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).