* [PATCH] net: fec: only clear a queue's work bit if the queue was emptied
@ 2016-05-03 14:38 Uwe Kleine-König
2016-05-03 14:42 ` Lucas Stach
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2016-05-03 14:38 UTC (permalink / raw)
To: Fugang Duan, David S . Miller; +Cc: kernel, netdev
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")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,
I created this patch against net/master. If you think it's to late to
get it into 4.6 and it doesn't fit on net-next/master, just tell me and
I will rebase.
Best regards
Uwe
drivers/net/ethernet/freescale/fec_main.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 08243c2ff4b4..2a03857cca18 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1521,9 +1521,15 @@ fec_enet_rx(struct net_device *ndev, int budget)
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;
}
--
2.8.0.rc3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net: fec: only clear a queue's work bit if the queue was emptied
2016-05-03 14:38 [PATCH] net: fec: only clear a queue's work bit if the queue was emptied Uwe Kleine-König
@ 2016-05-03 14:42 ` Lucas Stach
2016-05-04 2:12 ` Fugang Duan
2016-05-04 18:09 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Lucas Stach @ 2016-05-03 14:42 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: Fugang Duan, David S . Miller, netdev, kernel
Am Dienstag, den 03.05.2016, 16:38 +0200 schrieb Uwe Kleine-König:
> 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")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
> ---
> Hello,
>
> I created this patch against net/master. If you think it's to late to
> get it into 4.6 and it doesn't fit on net-next/master, just tell me and
> I will rebase.
>
> Best regards
> Uwe
>
>
> drivers/net/ethernet/freescale/fec_main.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index 08243c2ff4b4..2a03857cca18 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1521,9 +1521,15 @@ fec_enet_rx(struct net_device *ndev, int budget)
> 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;
> }
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] net: fec: only clear a queue's work bit if the queue was emptied
2016-05-03 14:38 [PATCH] net: fec: only clear a queue's work bit if the queue was emptied Uwe Kleine-König
2016-05-03 14:42 ` Lucas Stach
@ 2016-05-04 2:12 ` Fugang Duan
2016-05-04 18:09 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Fugang Duan @ 2016-05-04 2:12 UTC (permalink / raw)
To: Uwe Kleine-König, David S . Miller
Cc: kernel@pengutronix.de, netdev@vger.kernel.org
From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Sent: Tuesday, May 03, 2016 10:39 PM
> To: Fugang Duan <fugang.duan@nxp.com>; David S . Miller
> <davem@davemloft.net>
> Cc: kernel@pengutronix.de; netdev@vger.kernel.org
> Subject: [PATCH] net: fec: only clear a queue's work bit if the queue was
> emptied
>
> 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")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
>
> I created this patch against net/master. If you think it's to late to get it into 4.6
> and it doesn't fit on net-next/master, just tell me and I will rebase.
>
> Best regards
> Uwe
>
>
> drivers/net/ethernet/freescale/fec_main.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index 08243c2ff4b4..2a03857cca18 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1521,9 +1521,15 @@ fec_enet_rx(struct net_device *ndev, int budget)
> 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;
> }
> --
> 2.8.0.rc3
Tested-by: Fugang Duan <fugang.duan@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: fec: only clear a queue's work bit if the queue was emptied
2016-05-03 14:38 [PATCH] net: fec: only clear a queue's work bit if the queue was emptied Uwe Kleine-König
2016-05-03 14:42 ` Lucas Stach
2016-05-04 2:12 ` Fugang Duan
@ 2016-05-04 18:09 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2016-05-04 18:09 UTC (permalink / raw)
To: u.kleine-koenig; +Cc: fugang.duan, kernel, netdev
From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date: Tue, 3 May 2016 16:38:53 +0200
> 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")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-05-04 18:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-03 14:38 [PATCH] net: fec: only clear a queue's work bit if the queue was emptied Uwe Kleine-König
2016-05-03 14:42 ` Lucas Stach
2016-05-04 2:12 ` Fugang Duan
2016-05-04 18:09 ` 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).