From patchwork Mon Apr 16 14:35:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Riesch X-Patchwork-Id: 152880 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 D7257B700A for ; Tue, 17 Apr 2012 00:51:29 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754391Ab2DPOv1 (ORCPT ); Mon, 16 Apr 2012 10:51:27 -0400 Received: from ns.omicron.at ([212.183.10.25]:47397 "EHLO ns.omicron.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753949Ab2DPOv0 (ORCPT ); Mon, 16 Apr 2012 10:51:26 -0400 X-Greylist: delayed 982 seconds by postgrey-1.27 at vger.kernel.org; Mon, 16 Apr 2012 10:51:25 EDT Received: from counter.omicron.at ([212.183.10.29]) by ns.omicron.at (8.13.1/8.13.1) with ESMTP id q3GEYkKI004944; Mon, 16 Apr 2012 16:34:51 +0200 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 q3GEYjgZ016567; Mon, 16 Apr 2012 16:34:45 +0200 Received: from localhost.localdomain (172.22.3.77) by mary-special.at.omicron.at (172.22.100.48) with Microsoft SMTP Server id 8.3.192.1; Mon, 16 Apr 2012 16:34:44 +0200 From: Christian Riesch To: CC: , , Manfred Rudigier , Christian Riesch , , Cyril Chemparathy Subject: [PATCH] davinci_mdio: Fix MDIO timeout check Date: Mon, 16 Apr 2012 16:35:25 +0200 Message-ID: <1334586925-11348-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 Under heavy load (flood ping) it is possible for the MDIO timeout to expire before the loop checks the GO bit again. This patch adds an additional check whether the operation was done before actually returning -ETIMEDOUT. To reproduce this bug, flood ping the device, e.g., ping -f -l 1000 After some time, a "timed out waiting for user access" warning may appear. And even worse, link may go down since the PHY reported a timeout. Signed-off-by: Christian Riesch Cc: Cc: Cyril Chemparathy --- drivers/net/ethernet/ti/davinci_mdio.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c index 2757c7d..e4e4708 100644 --- a/drivers/net/ethernet/ti/davinci_mdio.c +++ b/drivers/net/ethernet/ti/davinci_mdio.c @@ -181,6 +181,11 @@ static inline int wait_for_user_access(struct davinci_mdio_data *data) __davinci_mdio_reset(data); return -EAGAIN; } + + reg = __raw_readl(®s->user[0].access); + if ((reg & USERACCESS_GO) == 0) + return 0; + dev_err(data->dev, "timed out waiting for user access\n"); return -ETIMEDOUT; }