[PATCH V2] ipconfig: Inform user if carrier is not ready

Subsystems: networking [general], networking [ipv4/ipv6], the rest

STALE5108d

9 messages, 3 authors, 2012-09-14 · open the first message on its own page

[PATCH V2] ipconfig: Inform user if carrier is not ready

From: Erwan Velu <hidden>
Date: 2012-09-14 19:08:23

From: Erwan Velu <redacted>

While using the ip= option at the cmdline, the kernel can hold the boot
process for 2 minutes (CONF_CARRIER_TIMEOUT) if the carrier is not
present.

While waiting the carrier, user is not informed about this situation and
so could think the kernel is frozen.

If we don't get the carrier after some seconds, let's display a message to
inform the user about the remaining time before reaching the timeout.

Signed-off-by: Erwan Velu <redacted>
---
  net/ipv4/ipconfig.c |   12 ++++++++++++
  1 file changed, 12 insertions(+)
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 67e8a6b..413d22d 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -90,6 +90,7 @@
  /* Define the friendly delay before and after opening net devices */
  #define CONF_POST_OPEN        10    /* After opening: 10 msecs */
  #define CONF_CARRIER_TIMEOUT    120000    /* Wait for carrier timeout */
+#define CONF_WARN_CARRIER_TIMEOUT 5000    /* Time before showing a 
warning message  */

  /* Define the timeout for waiting for a DHCP/BOOTP/RARP reply */
  #define CONF_OPEN_RETRIES     2    /* (Re)open devices twice */
@@ -205,6 +206,7 @@ static int __init ic_open_devs(void)
      struct net_device *dev;
      unsigned short oflags;
      unsigned long start;
+    unsigned int loops=0;

      last = &ic_first_dev;
      rtnl_lock();
@@ -266,6 +268,16 @@ static int __init ic_open_devs(void)
              if (ic_is_init_dev(dev) && netif_carrier_ok(dev))
                  goto have_carrier;

+        /* This loop is blocking the boot process until
+         * we get the carrier or reach the timeout.
+         * We have to inform the user about the situation as
+         * it could look like a kernel freeze.
+         * After CONF_WARN_CARRIER_TIMEOUT milliseconds,
+         * we display the remaing time before reaching the timeout. */
+        if (++loops == CONF_WARN_CARRIER_TIMEOUT) {
+            pr_info("IP-Config: Waiting up to %d seconds for carrier on 
interface\n",
+                (CONF_CARRIER_TIMEOUT - CONF_WARN_CARRIER_TIMEOUT)/ 1000);
+        }
          msleep(1);
      }
  have_carrier:
-- 
1.7.10

Re: [PATCH V2] ipconfig: Inform user if carrier is not ready

From: David Miller <davem@davemloft.net>
Date: 2012-09-14 19:17:28

From: Erwan Velu <redacted>
Date: Fri, 14 Sep 2012 21:08:16 +0200
+        /* This loop is blocking the boot process until
+         * we get the carrier or reach the timeout.
+         * We have to inform the user about the situation as
+         * it could look like a kernel freeze.
+         * After CONF_WARN_CARRIER_TIMEOUT milliseconds,
+ * we display the remaing time before reaching the timeout. */
This is badly formatted, either because you explicitly did so
or because your email client corrupted the patch.

Either way you have to fix this before we can seriously consider
your patch.

Re: [PATCH V2] ipconfig: Inform user if carrier is not ready

From: Rick Jones <hidden>
Date: 2012-09-14 19:19:49

On 09/14/2012 12:08 PM, Erwan Velu wrote:
From: Erwan Velu <redacted>

While using the ip= option at the cmdline, the kernel can hold the boot
process for 2 minutes (CONF_CARRIER_TIMEOUT) if the carrier is not
present.

While waiting the carrier, user is not informed about this situation and
so could think the kernel is frozen.

If we don't get the carrier after some seconds, let's display a message to
inform the user about the remaining time before reaching the timeout.
That should be much better than upwards of 120 messages.

rick jones

[PATCH V3] ipconfig: Inform user if carrier is not ready

From: Erwan Velu <hidden>
Date: 2012-09-14 19:30:51

From: Erwan Velu <redacted>

While using the ip= option at the cmdline, the kernel can hold the boot
process for 2 minutes (CONF_CARRIER_TIMEOUT) if the carrier is not
present.

While waiting the carrier, user is not informed about this situation and
so could think the kernel is frozen.

If we don't get the carrier after some seconds, let's display a message to
inform the user about the remaining time before reaching the timeout.

Signed-off-by: Erwan Velu <redacted>
---
  net/ipv4/ipconfig.c |   12 ++++++++++++
  1 file changed, 12 insertions(+)
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 67e8a6b..b79dca6 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -90,6 +90,7 @@
  /* Define the friendly delay before and after opening net devices */
  #define CONF_POST_OPEN        10    /* After opening: 10 msecs */
  #define CONF_CARRIER_TIMEOUT    120000    /* Wait for carrier timeout */
+#define CONF_WARN_CARRIER_TIMEOUT 5000    /* Time before showing a 
warning message  */

  /* Define the timeout for waiting for a DHCP/BOOTP/RARP reply */
  #define CONF_OPEN_RETRIES     2    /* (Re)open devices twice */
@@ -205,6 +206,7 @@ static int __init ic_open_devs(void)
      struct net_device *dev;
      unsigned short oflags;
      unsigned long start;
+    unsigned int loops=0;

      last = &ic_first_dev;
      rtnl_lock();
@@ -266,6 +268,16 @@ static int __init ic_open_devs(void)
              if (ic_is_init_dev(dev) && netif_carrier_ok(dev))
                  goto have_carrier;

+        /* This loop is blocking the boot process until
+           we get the carrier or reach the timeout.
+           We have to inform the user about the situation as
+           it could look like a kernel freeze.
+           After CONF_WARN_CARRIER_TIMEOUT milliseconds,
+           we display the remaing time before reaching the timeout.*/
+        if (++loops == CONF_WARN_CARRIER_TIMEOUT) {
+            pr_info("IP-Config: Waiting up to %d seconds for carrier on 
interface\n",
+                (CONF_CARRIER_TIMEOUT - CONF_WARN_CARRIER_TIMEOUT)/ 1000);
+        }
          msleep(1);
      }
  have_carrier:
-- 
1.7.10

Re: [PATCH V2] ipconfig: Inform user if carrier is not ready

From: Erwan Velu <hidden>
Date: 2012-09-14 19:31:33

Le 14/09/2012 21:17, David Miller a écrit :
This is badly formatted, either because you explicitly did so or 
because your email client corrupted the patch. Either way you have to 
fix this before we can seriously consider your patch. 
All apollogies, that was my stupid fault.

That's fixed. Sent as V3.

Thanks for proof-reading this stupid patch :)

Erwan

Re: [PATCH V3] ipconfig: Inform user if carrier is not ready

From: David Miller <davem@davemloft.net>
Date: 2012-09-14 19:42:29

Your email client is still corrupting this patch.

Turn off all transformations in your outgoing emails such as
text formatting and such.

In fact, email the patch to yourself, and make sure you can successfully
apply the result.

Also, you have formatted the comment improperly.

Don't format comments:

	/* Like
	   this.  */

but rather, format them:

	/* Like
	 * this.
	 */

You also didn't style the variable declaration and assignment properly,
there must be a space around the "=" sign, like this:

	unsigned int loops = 0;

Thanks.

Re: [PATCH V3] ipconfig: Inform user if carrier is not ready

From: Erwan Velu <hidden>
Date: 2012-09-14 20:13:07

Le 14/09/2012 21:42, David Miller a écrit :
Your email client is still corrupting this patch.

Turn off all transformations in your outgoing emails such as
text formatting and such.

In fact, email the patch to yourself, and make sure you can successfully
apply the result
I didn't succeed at making thunderbird not corrupting the patch...
I did put the patch on an http link to insure no corruption will occurs.

http://pubz.free.fr/0001-ipconfig-Inform-user-if-carrier-is-not-ready.patch

Hope this will be acceptable....

Cheers,

Re: [PATCH V3] ipconfig: Inform user if carrier is not ready

From: David Miller <davem@davemloft.net>
Date: 2012-09-14 20:23:33

From: Erwan Velu <redacted>
Date: Fri, 14 Sep 2012 22:13:00 +0200
I didn't succeed at making thunderbird not corrupting the patch...
Read Documentation/email-clients.txt in the kernel tree for help.

Re: [PATCH V3] ipconfig: Inform user if carrier is not ready

From: Erwan Velu <hidden>
Date: 2012-09-14 20:59:18

Le 14/09/2012 22:23, David Miller a écrit :
From: Erwan Velu <redacted>
Date: Fri, 14 Sep 2012 22:13:00 +0200
quoted
I didn't succeed at making thunderbird not corrupting the patch...
Read Documentation/email-clients.txt in the kernel tree for help.
Sent with git send-email... this time this will be far better I hope..
Thanks rick for pointing this.

Sorry for this long thread about newbie posting...

Erwan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help