diff mbox

[U-Boot,2/2] net: bootp: Add BOOTP specific config for timeout value

Message ID 1453490563-15336-2-git-send-email-amessier.tyco@gmail.com
State Changes Requested
Delegated to: Joe Hershberger
Headers show

Commit Message

amessier.tyco@gmail.com Jan. 22, 2016, 7:22 p.m. UTC
From: Alexandre Messier <amessier@tycoint.com>

There is currently one config option (CONFIG_NET_RETRY_COUNT) that
is available to tune the retries of the network stack.
Unfortunately, it is global to all protocols, and the value is
interpreted differently in all of them.

Add a new config option that sets directly the timeout delay used by
BOOTP, instead of it being derived from CONFIG_NET_RETRY_COUNT.

Signed-off-by: Alexandre Messier <amessier@tycoint.com>
---
 README      | 6 ++++++
 net/bootp.c | 4 ++++
 2 files changed, 10 insertions(+)

Comments

Joe Hershberger Jan. 22, 2016, 7:35 p.m. UTC | #1
On Fri, Jan 22, 2016 at 1:22 PM,  <amessier.tyco@gmail.com> wrote:
> From: Alexandre Messier <amessier@tycoint.com>
>
> There is currently one config option (CONFIG_NET_RETRY_COUNT) that
> is available to tune the retries of the network stack.
> Unfortunately, it is global to all protocols, and the value is
> interpreted differently in all of them.
>
> Add a new config option that sets directly the timeout delay used by
> BOOTP, instead of it being derived from CONFIG_NET_RETRY_COUNT.
>
> Signed-off-by: Alexandre Messier <amessier@tycoint.com>
> ---
>  README      | 6 ++++++
>  net/bootp.c | 4 ++++
>  2 files changed, 10 insertions(+)
>
> diff --git a/README b/README
> index 05966ab..9703f83 100644
> --- a/README
> +++ b/README
> @@ -2191,6 +2191,7 @@ CBFS (Coreboot Filesystem) support
>                 CONFIG_BOOTP_TIMEOFFSET
>                 CONFIG_BOOTP_VENDOREX
>                 CONFIG_BOOTP_MAY_FAIL
> +               CONFIG_BOOTP_TIMEOUT_MS
>                 CONFIG_BOOTP_DHCPREQ_BOOTFILE
>
>                 CONFIG_BOOTP_SERVERIP - TFTP server will be the serverip
> @@ -2232,6 +2233,11 @@ CBFS (Coreboot Filesystem) support
>                 the DHCP timeout and retry process takes a longer than
>                 this delay.
>
> +               CONFIG_BOOTP_TIMEOUT_MS - Explicitly configure the BOOTP
> +               timeout in milliseconds, instead of basing it on the configured
> +               number of retries, which is either CONFIG_NET_RETRY_COUNT or
> +               the BOOTP default value of 5 retries.

Please add new config options to the Kconfig system.

> +
>                 CONFIG_BOOTP_DHCPREQ_BOOTFILE - Set the bootfile name in
>                 DHCPREQUEST packet, in addition to DHCPDISCOVER. This may be
>                 needed by some DHCP servers in specific cases.
> diff --git a/net/bootp.c b/net/bootp.c
> index 8da94cf..edb0b39 100644
> --- a/net/bootp.c
> +++ b/net/bootp.c
> @@ -33,12 +33,16 @@
>   * execute that many retries, and keep sending retry packets until that time
>   * is reached.
>   */
> +#ifndef CONFIG_BOOTP_TIMEOUT_MS
>  #ifndef CONFIG_NET_RETRY_COUNT
>  # define TIMEOUT_COUNT 5               /* # of timeouts before giving up */
>  #else
>  # define TIMEOUT_COUNT (CONFIG_NET_RETRY_COUNT)
>  #endif
>  #define TIMEOUT_MS     ((3 + (TIMEOUT_COUNT * 5)) * 1000)
> +#else
> +#define TIMEOUT_MS     CONFIG_BOOTP_TIMEOUT_MS
> +#endif
>
>  #define PORT_BOOTPS    67              /* BOOTP server UDP port */
>  #define PORT_BOOTPC    68              /* BOOTP client UDP port */
> --
> 1.8.3.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
MESSIER, ALEXANDRE Jan. 22, 2016, 8:09 p.m. UTC | #2
> -----Original Message-----
> From: Joe Hershberger [mailto:joe.hershberger@gmail.com]
> Sent: January-22-16 2:36 PM
> To: amessier.tyco@gmail.com
> Cc: u-boot; Joe Hershberger; MESSIER, ALEXANDRE
> Subject: Re: [U-Boot] [PATCH 2/2] net: bootp: Add BOOTP specific config for
> timeout value
>
> On Fri, Jan 22, 2016 at 1:22 PM,  <amessier.tyco@gmail.com> wrote:
> > From: Alexandre Messier <amessier@tycoint.com>
> >
> > There is currently one config option (CONFIG_NET_RETRY_COUNT) that
> > is available to tune the retries of the network stack.
> > Unfortunately, it is global to all protocols, and the value is
> > interpreted differently in all of them.
> >
> > Add a new config option that sets directly the timeout delay used by
> > BOOTP, instead of it being derived from CONFIG_NET_RETRY_COUNT.
> >
> > Signed-off-by: Alexandre Messier <amessier@tycoint.com>
> > ---
> >  README      | 6 ++++++
> >  net/bootp.c | 4 ++++
> >  2 files changed, 10 insertions(+)
> >
> > diff --git a/README b/README
> > index 05966ab..9703f83 100644
> > --- a/README
> > +++ b/README
> > @@ -2191,6 +2191,7 @@ CBFS (Coreboot Filesystem) support
> >                 CONFIG_BOOTP_TIMEOFFSET
> >                 CONFIG_BOOTP_VENDOREX
> >                 CONFIG_BOOTP_MAY_FAIL
> > +               CONFIG_BOOTP_TIMEOUT_MS
> >                 CONFIG_BOOTP_DHCPREQ_BOOTFILE
> >
> >                 CONFIG_BOOTP_SERVERIP - TFTP server will be the serverip
> > @@ -2232,6 +2233,11 @@ CBFS (Coreboot Filesystem) support
> >                 the DHCP timeout and retry process takes a longer than
> >                 this delay.
> >
> > +               CONFIG_BOOTP_TIMEOUT_MS - Explicitly configure the BOOTP
> > +               timeout in milliseconds, instead of basing it on the configured
> > +               number of retries, which is either CONFIG_NET_RETRY_COUNT or
> > +               the BOOTP default value of 5 retries.
>
> Please add new config options to the Kconfig system.
OK will do.
>
> > +
> >                 CONFIG_BOOTP_DHCPREQ_BOOTFILE - Set the bootfile name in
> >                 DHCPREQUEST packet, in addition to DHCPDISCOVER. This may be
> >                 needed by some DHCP servers in specific cases.
> > diff --git a/net/bootp.c b/net/bootp.c
> > index 8da94cf..edb0b39 100644
> > --- a/net/bootp.c
> > +++ b/net/bootp.c
> > @@ -33,12 +33,16 @@
> >   * execute that many retries, and keep sending retry packets until that
> time
> >   * is reached.
> >   */
> > +#ifndef CONFIG_BOOTP_TIMEOUT_MS
> >  #ifndef CONFIG_NET_RETRY_COUNT
> >  # define TIMEOUT_COUNT 5               /* # of timeouts before giving up */
> >  #else
> >  # define TIMEOUT_COUNT (CONFIG_NET_RETRY_COUNT)
> >  #endif
> >  #define TIMEOUT_MS     ((3 + (TIMEOUT_COUNT * 5)) * 1000)
> > +#else
> > +#define TIMEOUT_MS     CONFIG_BOOTP_TIMEOUT_MS
> > +#endif
> >
> >  #define PORT_BOOTPS    67              /* BOOTP server UDP port */
> >  #define PORT_BOOTPC    68              /* BOOTP client UDP port */
> > --
> > 1.8.3.1
> >
> > _______________________________________________
> > U-Boot mailing list
> > U-Boot@lists.denx.de
> > https://urldefense.proofpoint.com/v2/url?u=http-
> 3A__lists.denx.de_mailman_listinfo_u-2Dboot&d=CwIBaQ&c=0YGvTs3tT-
> VMy8_v51yLDw&r=adEdfGeVvAp5D3jUKeOClnVoZZOSb93LtGg4Qgmpmjw&
> m=6vGNQE7IhCTnhn7IpITPEZMxcbzm9xD4_yl1dmVGsI0&s=M78bwo2zLUHN
> Avjy5n53KfWdSKM8CRGsFU1SSog0LKw&e=
diff mbox

Patch

diff --git a/README b/README
index 05966ab..9703f83 100644
--- a/README
+++ b/README
@@ -2191,6 +2191,7 @@  CBFS (Coreboot Filesystem) support
 		CONFIG_BOOTP_TIMEOFFSET
 		CONFIG_BOOTP_VENDOREX
 		CONFIG_BOOTP_MAY_FAIL
+		CONFIG_BOOTP_TIMEOUT_MS
 		CONFIG_BOOTP_DHCPREQ_BOOTFILE
 
 		CONFIG_BOOTP_SERVERIP - TFTP server will be the serverip
@@ -2232,6 +2233,11 @@  CBFS (Coreboot Filesystem) support
 		the DHCP timeout and retry process takes a longer than
 		this delay.
 
+		CONFIG_BOOTP_TIMEOUT_MS - Explicitly configure the BOOTP
+		timeout in milliseconds, instead of basing it on the configured
+		number of retries, which is either CONFIG_NET_RETRY_COUNT or
+		the BOOTP default value of 5 retries.
+
 		CONFIG_BOOTP_DHCPREQ_BOOTFILE - Set the bootfile name in
 		DHCPREQUEST packet, in addition to DHCPDISCOVER. This may be
 		needed by some DHCP servers in specific cases.
diff --git a/net/bootp.c b/net/bootp.c
index 8da94cf..edb0b39 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -33,12 +33,16 @@ 
  * execute that many retries, and keep sending retry packets until that time
  * is reached.
  */
+#ifndef CONFIG_BOOTP_TIMEOUT_MS
 #ifndef CONFIG_NET_RETRY_COUNT
 # define TIMEOUT_COUNT	5		/* # of timeouts before giving up */
 #else
 # define TIMEOUT_COUNT	(CONFIG_NET_RETRY_COUNT)
 #endif
 #define TIMEOUT_MS	((3 + (TIMEOUT_COUNT * 5)) * 1000)
+#else
+#define TIMEOUT_MS	CONFIG_BOOTP_TIMEOUT_MS
+#endif
 
 #define PORT_BOOTPS	67		/* BOOTP server UDP port */
 #define PORT_BOOTPC	68		/* BOOTP client UDP port */