netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: systemport: Add support for BQL
@ 2018-03-29 19:27 Florian Fainelli
  2018-03-29 19:30 ` Florian Fainelli
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2018-03-29 19:27 UTC (permalink / raw)
  To: netdev; +Cc: davem, opendmb, Florian Fainelli

We had all the accounting done already, but we did not plumb BQL. In
order to avoid fetching twice the netdev_queue pointer in the TX
reclamation path, move the queue waking into __bcm_sysport_tx_reclaim()
so we can update BQL and wake the TX queue there in one go.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/broadcom/bcmsysport.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 4e26f606a7f2..22ec8d5452bf 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -903,6 +903,7 @@ static unsigned int __bcm_sysport_tx_reclaim(struct bcm_sysport_priv *priv,
 	struct net_device *ndev = priv->netdev;
 	unsigned int txbds_processed = 0;
 	struct bcm_sysport_cb *cb;
+	struct netdev_queue *txq;
 	unsigned int txbds_ready;
 	unsigned int c_index;
 	u32 hw_ind;
@@ -945,10 +946,16 @@ static unsigned int __bcm_sysport_tx_reclaim(struct bcm_sysport_priv *priv,
 
 	ring->c_index = c_index;
 
+	txq = netdev_get_tx_queue(ndev, ring->index);
+	netdev_tx_completed_queue(txq, pkts_compl, bytes_compl);
+
 	netif_dbg(priv, tx_done, ndev,
 		  "ring=%d c_index=%d pkts_compl=%d, bytes_compl=%d\n",
 		  ring->index, ring->c_index, pkts_compl, bytes_compl);
 
+	if (pkts_compl)
+		netif_tx_wake_queue(txq);
+
 	return pkts_compl;
 }
 
@@ -956,17 +963,11 @@ static unsigned int __bcm_sysport_tx_reclaim(struct bcm_sysport_priv *priv,
 static unsigned int bcm_sysport_tx_reclaim(struct bcm_sysport_priv *priv,
 					   struct bcm_sysport_tx_ring *ring)
 {
-	struct netdev_queue *txq;
 	unsigned int released;
 	unsigned long flags;
 
-	txq = netdev_get_tx_queue(priv->netdev, ring->index);
-
 	spin_lock_irqsave(&ring->lock, flags);
 	released = __bcm_sysport_tx_reclaim(priv, ring);
-	if (released)
-		netif_tx_wake_queue(txq);
-
 	spin_unlock_irqrestore(&ring->lock, flags);
 
 	return released;
@@ -1359,6 +1360,8 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb,
 	desc->addr_status_len = len_status;
 	wmb();
 
+	netdev_tx_sent_queue(txq, skb->len);
+
 	/* Write this descriptor address to the RING write port */
 	tdma_port_write_desc_addr(priv, desc, ring->index);
 
@@ -1584,6 +1587,7 @@ static void bcm_sysport_fini_tx_ring(struct bcm_sysport_priv *priv,
 	napi_disable(&ring->napi);
 	cancel_work_sync(&ring->dim.dim.work);
 	netif_napi_del(&ring->napi);
+	netdev_tx_reset_queue(netdev_get_tx_queue(priv->netdev, ring->index));
 
 	bcm_sysport_tx_clean(priv, ring);
 
-- 
2.14.1

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

* Re: [PATCH net-next] net: systemport: Add support for BQL
  2018-03-29 19:27 [PATCH net-next] net: systemport: Add support for BQL Florian Fainelli
@ 2018-03-29 19:30 ` Florian Fainelli
  2018-03-29 19:56   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2018-03-29 19:30 UTC (permalink / raw)
  To: netdev, davem; +Cc: opendmb

On 03/29/2018 12:27 PM, Florian Fainelli wrote:
> We had all the accounting done already, but we did not plumb BQL. In
> order to avoid fetching twice the netdev_queue pointer in the TX
> reclamation path, move the queue waking into __bcm_sysport_tx_reclaim()
> so we can update BQL and wake the TX queue there in one go.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

David, please disregard this patch, I found a bunch of issues, and it
won't apply with the coalescing patch series.
-- 
Florian

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

* Re: [PATCH net-next] net: systemport: Add support for BQL
  2018-03-29 19:30 ` Florian Fainelli
@ 2018-03-29 19:56   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2018-03-29 19:56 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev, opendmb

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Thu, 29 Mar 2018 12:30:08 -0700

> On 03/29/2018 12:27 PM, Florian Fainelli wrote:
>> We had all the accounting done already, but we did not plumb BQL. In
>> order to avoid fetching twice the netdev_queue pointer in the TX
>> reclamation path, move the queue waking into __bcm_sysport_tx_reclaim()
>> so we can update BQL and wake the TX queue there in one go.
>> 
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> David, please disregard this patch, I found a bunch of issues, and it
> won't apply with the coalescing patch series.

Sure, no problem.

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

end of thread, other threads:[~2018-03-29 19:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-29 19:27 [PATCH net-next] net: systemport: Add support for BQL Florian Fainelli
2018-03-29 19:30 ` Florian Fainelli
2018-03-29 19:56   ` 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).