From patchwork Wed Feb 22 16:26:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Riesch X-Patchwork-Id: 142505 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 7C059B6EE6 for ; Thu, 23 Feb 2012 03:45:10 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753818Ab2BVQpJ (ORCPT ); Wed, 22 Feb 2012 11:45:09 -0500 Received: from ns.omicron.at ([212.183.10.25]:58324 "EHLO ns.omicron.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751042Ab2BVQpH (ORCPT ); Wed, 22 Feb 2012 11:45:07 -0500 X-Greylist: delayed 994 seconds by postgrey-1.27 at vger.kernel.org; Wed, 22 Feb 2012 11:45:06 EST Received: from counter.omicron.at ([212.183.10.29]) by ns.omicron.at (8.13.1/8.13.1) with ESMTP id q1MGRKQw005734; Wed, 22 Feb 2012 17:27:25 +0100 Received: from mary.at.omicron.at (mary.at.omicron.at [172.22.100.48]) by counter.omicron.at (8.14.4/8.14.4) with ESMTP id q1MGRK7F027294; Wed, 22 Feb 2012 17:27:20 +0100 Received: from localhost.localdomain (172.22.3.81) by mary-special.at.omicron.at (172.22.100.48) with Microsoft SMTP Server id 8.3.192.1; Wed, 22 Feb 2012 17:27:18 +0100 From: Christian Riesch To: CC: , , Manfred Rudigier , Christian Riesch , "Hegde, Vinay" , Cyril Chemparathy , Sascha Hauer Subject: [RFC PATCH] davinci_emac: Do not accidentally free all rx dma descriptors during init Date: Wed, 22 Feb 2012 17:26:51 +0100 Message-ID: <1329928011-32746-1-git-send-email-christian.riesch@omicron.at> X-Mailer: git-send-email 1.7.0.4 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch fixes a regression that was introduced by commit 0a5f38467765ee15478db90d81e40c269c8dda20 davinci_emac: Add Carrier Link OK check in Davinci RX Handler Said commit adds a check whether the carrier link is ok. If the link is not ok, the skb is freed and no new dma descriptor added to the rx dma channel. This causes trouble during initialization when the carrier status has not yet been updated. If a lot of packets are received while netif_carrier_ok returns false, all dma descriptors are freed and the rx dma transfer is stopped. To reproduce the bug, flood ping the davinci board while doing ifconfig eth0 down ifconfig eth0 up on the board. After that, the rx path stops working and the overrun value reported by ifconfig is counting up. This patch reverts commit 0a5f38467765ee15478db90d81e40c269c8dda20 and instead issues warnings only if cpdma_chan_submit returns -ENOMEM. Signed-off-by: Christian Riesch Cc: Hegde, Vinay Cc: Cyril Chemparathy Cc: Sascha Hauer --- Hi, This patch fixes the initialization problem that I described. However I am not sure if it correctly fixes the problem that was addressed by the original patch, 0a5f38467765ee15478db90d81e40c269c8dda20. Thanks for your comments! Regards, Christian drivers/net/ethernet/ti/davinci_emac.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 4fa0bcb..4b2f545 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c @@ -1009,7 +1009,7 @@ static void emac_rx_handler(void *token, int len, int status) int ret; /* free and bail if we are shutting down */ - if (unlikely(!netif_running(ndev) || !netif_carrier_ok(ndev))) { + if (unlikely(!netif_running(ndev))) { dev_kfree_skb_any(skb); return; } @@ -1038,7 +1038,9 @@ static void emac_rx_handler(void *token, int len, int status) recycle: ret = cpdma_chan_submit(priv->rxchan, skb, skb->data, skb_tailroom(skb), GFP_KERNEL); - if (WARN_ON(ret < 0)) + + WARN_ON(ret == -ENOMEM); + if (unlikely(ret < 0)) dev_kfree_skb_any(skb); }