[PATCH v2] net: moxa: fix TX overrun memory leak
David Miller
davem at davemloft.net
Mon Mar 27 20:50:26 PDT 2017
From: Jonas Jensen <jonas.jensen at gmail.com>
Date: Mon, 27 Mar 2017 14:31:19 +0200
> @@ -25,6 +25,7 @@
> #include <linux/of_irq.h>
> #include <linux/crc32.h>
> #include <linux/crc32c.h>
> +#include <linux/circ_buf.h>
>
> #include "moxart_ether.h"
>
> @@ -297,6 +298,7 @@ static void moxart_tx_finished(struct net_device *ndev)
> tx_tail = TX_NEXT(tx_tail);
> }
> priv->tx_tail = tx_tail;
> + netif_wake_queue(ndev);
> }
>
> static irqreturn_t moxart_mac_interrupt(int irq, void *dev_id)
Doing the wakeup unconditionally is very wasteful, you just need to do it
when enough space has been made available.
Therefore the wakeup should be more like:
if (netif_queue_stopped(ndev) &&
moxart_tx_queue_space(ndev) >= MOXART_TX_WAKEUP_THRESHOLD)
netif_wake_queue();
Otherwise you're just going to flap back and forth under high load and
get almost not packet batching at all, hurting performance.
More information about the linux-arm-kernel
mailing list