public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Roland Stigge <stigge@antcom.de>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, kevin.wells@nxp.com,
	srinivas.bakki@nxp.com, aletes.xgr@gmail.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/3] net: lpc_eth: Replace WARN() trace with simple pr_warn()
Date: Mon, 11 Jun 2012 10:53:55 +0200	[thread overview]
Message-ID: <1339404835.6001.1788.camel@edumazet-glaptop> (raw)
In-Reply-To: <4FD5AE1D.9030807@antcom.de>

On Mon, 2012-06-11 at 10:36 +0200, Roland Stigge wrote:

> I encountered cases where this happened for me on a custom board under
> heavy load.
> 
> I discussed this with Kevin Wells, the original driver author. We
> identified the case of xmit()'s TX request (from .ndo_start_xmit) with
> full TX driver buffers as valid when ethernet is busy.
> 
> But maybe this is wrong. Can you please give me a hint how the net
> subsystem makes sure that this doesn't happen under normal circumstances?

When TX ring is about to be filler, driver lpc_eth_hard_start_xmit()
calls netif_stop_queue(ndev);

So network stack should not call again lpc_eth_hard_start_xmit().

I would say the bug(s) come from __lpc_handle_xmit(), since it does :

if (netif_queue_stopped(ndev))
	netif_wake_queue(ndev);

without making sure some room is available in TX ring.

cumulative patch :

diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 8d2666f..59b37c8 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -946,16 +946,16 @@ static void __lpc_handle_xmit(struct net_device *ndev)
 			/* Update stats */
 			ndev->stats.tx_packets++;
 			ndev->stats.tx_bytes += skb->len;
-
-			/* Free buffer */
-			dev_kfree_skb_irq(skb);
 		}
+		dev_kfree_skb_irq(skb);
 
 		txcidx = readl(LPC_ENET_TXCONSUMEINDEX(pldat->net_base));
 	}
 
-	if (netif_queue_stopped(ndev))
-		netif_wake_queue(ndev);
+	if (pldat->num_used_tx_buffs <= ENET_TX_DESC/2) { 
+		if (netif_queue_stopped(ndev))
+			netif_wake_queue(ndev);
+	}
 }
 
 static int __lpc_handle_recv(struct net_device *ndev, int budget)

  reply	other threads:[~2012-06-11  8:53 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-11  8:03 [PATCH 1/3] net: lpc_eth: Replace WARN() trace with simple pr_warn() Roland Stigge
2012-06-11  8:03 ` [PATCH 2/3] net: lpc_eth: Increase number of TX descriptors Roland Stigge
2012-06-11  8:11   ` David Miller
2012-06-11  8:21   ` Eric Dumazet
2012-06-11  8:03 ` [PATCH 3/3] net: lpc_eth: Driver cleanup Roland Stigge
2012-06-11  8:10 ` [PATCH 1/3] net: lpc_eth: Replace WARN() trace with simple pr_warn() David Miller
2012-06-11  8:25 ` Eric Dumazet
2012-06-11  8:36   ` Roland Stigge
2012-06-11  8:53     ` Eric Dumazet [this message]
2012-06-11 17:21       ` [PATCH] net: lpc_eth: fix tx completion Eric Dumazet
2012-06-11 18:58         ` Roland Stigge
2012-06-11 20:13         ` David Miller
2012-06-11  9:03     ` [PATCH 1/3] net: lpc_eth: Replace WARN() trace with simple pr_warn() David Miller
2012-06-11  9:26       ` Roland Stigge
2012-06-11 19:18         ` Eric Dumazet
2012-06-13  6:16           ` Eric Dumazet
2012-06-13  9:28             ` Roland Stigge
2012-06-13  9:58               ` [PATCH net-next] net: lpc_eth: free skbs in start_xmit Eric Dumazet
2012-06-17 23:28                 ` David Miller
2012-06-11  8:39   ` [PATCH 1/3] net: lpc_eth: Replace WARN() trace with simple pr_warn() Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1339404835.6001.1788.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=aletes.xgr@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kevin.wells@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=srinivas.bakki@nxp.com \
    --cc=stigge@antcom.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox