lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180329192711.19215-1-f.fainelli@gmail.com>
Date:   Thu, 29 Mar 2018 12:27:11 -0700
From:   Florian Fainelli <f.fainelli@...il.com>
To:     netdev@...r.kernel.org
Cc:     davem@...emloft.net, opendmb@...il.com,
        Florian Fainelli <f.fainelli@...il.com>
Subject: [PATCH net-next] net: systemport: Add support for BQL

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@...il.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ