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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20171015162406.1118-1-roman@advem.lv>
Date:   Sun, 15 Oct 2017 19:24:06 +0300
From:   Roman Yeryomin <roman@...em.lv>
To:     netdev <netdev@...r.kernel.org>
Subject: [PATCH net-next 08/10] net: korina: optimize tx_full condition

Signed-off-by: Roman Yeryomin <roman@...em.lv>
---
 drivers/net/ethernet/korina.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
index f606f1e01af1..9520fa1e35a2 100644
--- a/drivers/net/ethernet/korina.c
+++ b/drivers/net/ethernet/korina.c
@@ -124,7 +124,6 @@ struct korina_private {
 	int tx_chain_tail;
 	enum chain_status tx_chain_status;
 	int tx_count;
-	int tx_full;
 
 	int rx_irq;
 	int tx_irq;
@@ -261,19 +260,10 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
 
 	td = &lp->td_ring[lp->tx_chain_tail];
 
-	/* stop queue when full, drop pkts if queue already full */
-	if (lp->tx_count >= (KORINA_NUM_TDS - 2)) {
-		lp->tx_full = 1;
+	/* stop queue when full */
+	if (unlikely(lp->tx_count > (KORINA_NUM_TDS - 3)))
 		netif_stop_queue(dev);
 
-		if (lp->tx_count > (KORINA_NUM_TDS - 2)) {
-			dev->stats.tx_dropped++;
-			dev_kfree_skb_any(skb);
-
-			return NETDEV_TX_BUSY;
-		}
-	}
-
 	lp->tx_count++;
 	lp->tx_skb[lp->tx_chain_tail] = skb;
 
@@ -323,10 +313,8 @@ static void korina_tx(struct net_device *dev)
 
 	/* Process all desc that are done */
 	while (IS_DMA_FINISHED(td->control)) {
-		if (lp->tx_full == 1) {
+		if (unlikely(lp->tx_count > (KORINA_NUM_TDS - 2)))
 			netif_wake_queue(dev);
-			lp->tx_full = 0;
-		}
 
 		devcs = lp->td_ring[lp->tx_next_done].devcs;
 
@@ -696,7 +684,7 @@ static int korina_alloc_ring(struct net_device *dev)
 		lp->td_ring[i].link = 0;
 	}
 	lp->tx_next_done = lp->tx_chain_head = lp->tx_chain_tail =
-			lp->tx_full = lp->tx_count = 0;
+			lp->tx_count = 0;
 	lp->tx_chain_status = desc_empty;
 
 	/* Initialize the receive descriptors */
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ