From patchwork Thu Apr 21 17:30:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Gardiner X-Patchwork-Id: 725231 Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3LHUjI8018694 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 21 Apr 2011 17:31:07 GMT Received: from dlep33.itg.ti.com ([157.170.170.112]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id p3LHUjV3000764 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 21 Apr 2011 12:30:45 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep33.itg.ti.com (8.13.7/8.13.7) with ESMTP id p3LHUirh006786 for ; Thu, 21 Apr 2011 12:30:44 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id ABA9680656 for ; Thu, 21 Apr 2011 12:30:42 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id 34D2380626 for ; Thu, 21 Apr 2011 12:30:37 -0500 (CDT) Received: from white.ext.ti.com (localhost [127.0.0.1]) by dflp53.itg.ti.com (8.13.8/8.13.8) with ESMTP id p3LHUa0E023523 for ; Thu, 21 Apr 2011 12:30:37 -0500 (CDT) Received: from psmtp.com (na3sys009amx182.postini.com [74.125.149.163]) by white.ext.ti.com (8.13.7/8.13.7) with SMTP id p3LHUabv002044 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 21 Apr 2011 12:30:36 -0500 Received: from na3sys009aog102.obsmtp.com ([209.85.213.170]) (using TLSv1) by na3sys009amx182.postini.com ([74.125.148.10]) with SMTP; Thu, 21 Apr 2011 13:30:36 EDT Received: from mail-yx0-f170.google.com ([209.85.213.170]) (using TLSv1) by na3sys009aob102.postini.com ([74.125.148.12]) with SMTP ID DSNKTbBpu0VikHpZ9+l6+SVeh75dg4mfT8mc@postini.com; Thu, 21 Apr 2011 10:30:36 PDT Received: by mail-yx0-f170.google.com with SMTP id 11so904768yxi.1 for ; Thu, 21 Apr 2011 10:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nanometrics.ca; s=google; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=d+SyUfE069WseLUc9TF2qYmxBceYFwYJZ86mSSLy48I=; b=oxfh3hw4paRlC56WlYmA2lFZfpsEOnpp2NXA5ypulz4g58x/cOthIvL8pRburVOyOa 1IPa6PTquH3o//IOBc/knvThsbnnokkYX35gwsI7sZk/s+a//4uRxrshduhjeTze3Y85 6kxkDj8xUtqtDvl3ZgE+bN4jlpHpLZnoS3FqY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=nanometrics.ca; s=google; h=from:to:cc:subject:date:message-id:x-mailer; b=YpVPpJl/d385Wz+8fEtKrsRB1DIG8+Z3psbZpFKz6XtfrcoaHLAP/VIh8lQ+XvakUx QmA+A6XxPpmQqaJYCZyQk0wiTO6bKUDADQ2b5txcfgk9+/SVHg9uF7FxZvUL3Re9VxQx 0udXVztsqQ5LDoesJDRwWubT60hjr6JoLPBLE= Received: by 10.236.116.7 with SMTP id f7mr214782yhh.366.1303407035542; Thu, 21 Apr 2011 10:30:35 -0700 (PDT) Received: from localhost.localdomain ([206.191.47.130]) by mx.google.com with ESMTPS id x61sm924123yhn.48.2011.04.21.10.30.33 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 21 Apr 2011 10:30:34 -0700 (PDT) From: Ben Gardiner To: netdev@vger.kernel.org Subject: [PATCH] [RFC] davinci_emac: don't WARN_ON cpdma_chan_submit -ENOMEM Date: Thu, 21 Apr 2011 13:30:32 -0400 Message-Id: <1303407032-7526-1-git-send-email-bengardiner@nanometrics.ca> X-Mailer: git-send-email 1.7.1 X-pstn-neptune: 0/0/0.00/0 X-pstn-levels: (S:99.90000/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-settings: 2 (0.5000:0.0750) s cv GT3 gt2 gt1 r p m c X-pstn-addresses: from [db-null] Cc: Sriramakrishnan A G , davinci-linux-open-source@linux.davincidsp.com X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 21 Apr 2011 17:31:07 +0000 (UTC) The current implementation of emac_rx_handler, when the host is flooded, will result in a great deal of WARNs on the console; due to the return value of cpdma_chan_submit. This function can error with EINVAL and ENOMEM; the former when the channel is in an invalid state, in which case the caller is in error. The latter when a cpdma descriptor cannot be allocated. When flooded, cpdma_chan_submit will return -ENOMEM; treat the inability to allocate a cpdma descriptor as an rx error similar in behaviour to when emac_rx_alloc returns NULL. No Signed-off-by yet; not complete fix (see below). CC: Sriramakrishnan A G --- I'm new to network drivers -- and kernel development, really. I'd be happy to receive feedback on this approach of resolving the -ENOMEM when flooded. Is there a more conventional approach? Shoud these frames be recorded as 'dropped'? Testing was performed on da850evm both with and without "net: davinci_emac: fix spinlock bug with dma channel cleanup" from Sriramakrishnan A G applied. The behaviour was the same: the emac is not able to receive any frames after being flooded -- but it can still send. I would appreciate any insight into the potential causes of the lockup. Best Regards, Ben Gardiner Nanometrics Inc. http://www.nanometrics.ca --- drivers/net/davinci_emac.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 7018bfe..17c48d6 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c @@ -1037,8 +1037,12 @@ 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 == -EINVAL); + if (ret < 0) { + if (netif_msg_rx_err(priv) && net_ratelimit()) + dev_err(emac_dev, "failed cpdma submit\n"); dev_kfree_skb_any(skb); + } } static void emac_tx_handler(void *token, int len, int status)