Commit 9d6e0c8b authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'net-lantiq-Fix-bugs-in-NAPI-handling'



Hauke Mehrtens says:

====================
net: lantiq: Fix bugs in NAPI handling

This fixes multiple bugs in the NAPI handling.

Changes since:
v1:
 - removed stable tag from "net: lantiq: use netif_tx_napi_add() for TX NAPI"
 - Check the NAPI budged in "net: lantiq: Use napi_complete_done()"
 - Add extra fix "net: lantiq: Disable IRQs only if NAPI gets scheduled"
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 4202c9fd 9423361d
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ static int xrx200_poll_rx(struct napi_struct *napi, int budget)
	}

	if (rx < budget) {
		napi_complete(&ch->napi);
		if (napi_complete_done(&ch->napi, rx))
			ltq_dma_enable_irq(&ch->dma);
	}

@@ -268,8 +268,11 @@ static int xrx200_tx_housekeeping(struct napi_struct *napi, int budget)
	net_dev->stats.tx_bytes += bytes;
	netdev_completed_queue(ch->priv->net_dev, pkts, bytes);

	if (netif_queue_stopped(net_dev))
		netif_wake_queue(net_dev);

	if (pkts < budget) {
		napi_complete(&ch->napi);
		if (napi_complete_done(&ch->napi, pkts))
			ltq_dma_enable_irq(&ch->dma);
	}

@@ -342,10 +345,12 @@ static irqreturn_t xrx200_dma_irq(int irq, void *ptr)
{
	struct xrx200_chan *ch = ptr;

	if (napi_schedule_prep(&ch->napi)) {
		__napi_schedule(&ch->napi);
		ltq_dma_disable_irq(&ch->dma);
	ltq_dma_ack_irq(&ch->dma);
	}

	napi_schedule(&ch->napi);
	ltq_dma_ack_irq(&ch->dma);

	return IRQ_HANDLED;
}
@@ -499,7 +504,7 @@ static int xrx200_probe(struct platform_device *pdev)

	/* setup NAPI */
	netif_napi_add(net_dev, &priv->chan_rx.napi, xrx200_poll_rx, 32);
	netif_napi_add(net_dev, &priv->chan_tx.napi, xrx200_tx_housekeeping, 32);
	netif_tx_napi_add(net_dev, &priv->chan_tx.napi, xrx200_tx_housekeeping, 32);

	platform_set_drvdata(pdev, priv);