Skip to content

Commit

Permalink
net: fec: only clear a queue's work bit if the queue was emptied
Browse files Browse the repository at this point in the history
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: 4d494cd ("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>
Tested-by: Fugang Duan <fugang.duan@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Uwe Kleine-König authored and davem330 committed May 4, 2016
1 parent 20decb7 commit 1c021bb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/net/ethernet/freescale/fec_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 1c021bb

Please sign in to comment.