From patchwork Thu Oct 4 15:38:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas KANDAGATLA X-Patchwork-Id: 189198 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 BC3052C0397 for ; Fri, 5 Oct 2012 01:40:41 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965642Ab2JDPkk (ORCPT ); Thu, 4 Oct 2012 11:40:40 -0400 Received: from eu1sys200aog104.obsmtp.com ([207.126.144.117]:45638 "EHLO eu1sys200aog104.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965609Ab2JDPkj (ORCPT ); Thu, 4 Oct 2012 11:40:39 -0400 Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob104.postini.com ([207.126.147.11]) with SMTP ID DSNKUG2t81N45qHT3cyJrKBIkUI6iUqRRee0@postini.com; Thu, 04 Oct 2012 15:40:39 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 1D7A511E; Thu, 4 Oct 2012 15:40:34 +0000 (GMT) Received: from mail7.sgp.st.com (mail7.sgp.st.com [164.129.223.81]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9A3BA4CD5; Thu, 4 Oct 2012 15:40:34 +0000 (GMT) Received: from localhost (king.bri.st.com [10.65.51.147]) by mail7.sgp.st.com (MOS 4.3.3-GA) with ESMTP id AOR81389 (AUTH srinivak); Thu, 4 Oct 2012 17:40:34 +0200 From: Srinivas KANDAGATLA To: netdev@vger.kernel.org Cc: srinivas.kandagatla@st.com, davem@davemloft.net Subject: [RFC:PATCH 3.6.0-] net/ipconfig: Extend ipconfig retries to device open Date: Thu, 4 Oct 2012 16:38:43 +0100 Message-Id: <1349365123-25826-1-git-send-email-srinivas.kandagatla@st.com> X-Mailer: git-send-email 1.7.0.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Srinivas Kandagatla This patch adds retries to ipconfig at device open, the reason to do this is: Lets say If some mdio bus driver decide to use defered probe when it does not find any phys on the bus. The same mdio-bus driver is re-probed as part of lateinit calls. However ipconfig also fits into lateinit calls, so if ipconfig is called before the re-probe of mdio-bus driver, the mac driver will fail to find a valid PHY on the mdio-bus. Real use case here, is that for phy modes like RMII where the clock to the PHY should be supplied by MAC which can only happen once MAC driver is setup. In my setup Am using stmmac MAC driver and mdio-gpio driver. Moreover ipconfig code already uses retries in dynamic ip case, so extending it to device open would help cases as described. Signed-off-by: Srinivas Kandagatla --- Hi All, Recently I did try defered probe to address a sequencing issue with our STMMAC and mdio-gpio driver when PHY is in RMII mode. Things did not work as expected, because ipconfig and defered probe both of them are called at lateinit call level. So I was back to sequencing problem again. As, ipconfig code already uses retries in dynamic ip case, so extending it to device open helped in my case. Comments? Am open for any suggestions to address this issue. Thanks, srini net/ipv4/ipconfig.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index 67e8a6b..c30505e 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c @@ -1375,9 +1375,7 @@ static int __init wait_for_devices(void) static int __init ip_auto_config(void) { __be32 addr; -#ifdef IPCONFIG_DYNAMIC int retries = CONF_OPEN_RETRIES; -#endif int err; #ifdef CONFIG_PROC_FS @@ -1398,12 +1396,22 @@ static int __init ip_auto_config(void) /* Setup all network devices */ err = ic_open_devs(); + + if (err && --retries) { + pr_info("IP-Config: Reopening network devices...\n"); + ssleep(1); + goto try_try_again; + } + if (err) return err; /* Give drivers a chance to settle */ msleep(CONF_POST_OPEN); +#ifdef IPCONFIG_DYNAMIC + retries = CONF_OPEN_RETRIES; +#endif /* * If the config information is insufficient (e.g., our IP address or * IP address of the boot server is missing or we have multiple network