[PATCH net-next] net: systemport: Add support for BQL

Subsystems: broadcom systemport ethernet driver, networking drivers, the rest

STALE3131d

3 messages, 2 authors, 2018-03-29 · open the first message on its own page

[PATCH net-next] net: systemport: Add support for BQL

From: Florian Fainelli <f.fainelli@gmail.com>
Date: 2018-03-29 19:27:18

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

Re: [PATCH net-next] net: systemport: Add support for BQL

From: Florian Fainelli <f.fainelli@gmail.com>
Date: 2018-03-29 19:30:17

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

Re: [PATCH net-next] net: systemport: Add support for BQL

From: David Miller <davem@davemloft.net>
Date: 2018-03-29 19:56:52

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:
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help