Skip to contentSkip to conversation

Patch "net: fec: only clear a queue's work bit if the queue was emptied" has been added to the 4.5-stable tree

PATCH [email protected] 1 participant 1 message May 16, 2016

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

net: fec: only clear a queue's work bit if the queue was emptied

to the 4.5-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
net-fec-only-clear-a-queue-s-work-bit-if-the-queue-was-emptied.patch
and it can be found in the queue-4.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Mon May 16 11:20:33 PDT 2016

From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <[email protected]>
Date: Tue, 3 May 2016 16:38:53 +0200
Subject: net: fec: only clear a queue's work bit if the queue was emptied
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <[email protected]>

[ Upstream commit 1c021bb717a70aaeaa4b25c91f43c2aeddd922de ]

In the receive path a queue's work bit was cleared unconditionally even if fec_enet_rx_queue only read out a part of the available packets from the hardware. This resulted in not reading any packets in the next napi turn and so packets were delayed or lost.

The obvious fix is to only clear a queue's bit when the queue was emptied.

Fixes 4d494cdc92b3 ("net: fec: change data structure to support multiqueue")
---
 drivers/net/ethernet/freescale/fec_main.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +8 -2
@@ -1566,9 +1566,15 @@ fec_enet_rx(struct net_device *ndev, int
 	struct fec_enet_private *fep = netdev_priv(ndev);
 
 	for_each_set_bit(queue_id, &fep->work_rx, FEC_ENET_MAX_RX_QS) {
-		clear_bit(queue_id, &fep->work_rx);
-		pkt_received += fec_enet_rx_queue(ndev,
+		int ret;
+
+		ret = fec_enet_rx_queue(ndev,
 					budget - pkt_received, queue_id);
+
+		if (ret < budget - pkt_received)
+			clear_bit(queue_id, &fep->work_rx);
+
+		pkt_received += ret;
 	}
 	return pkt_received;
 }

Patches currently in stable-queue which might be from [email protected] are

queue-4.5/net-fec-only-clear-a-queue-s-work-bit-if-the-queue-was-emptied.patch