From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Maxim Uvarov <maxim.uvarov@linaro.org>
Cc: u-boot@lists.denx.de, pbrobinson@redhat.com,
joe.hershberger@ni.com, rfried.dev@gmail.com, trini@konsulko.com,
goldsimon@gmx.de, lwip-devel@nongnu.org
Subject: Re: [PATCHv5 11/13] net/lwip: connection between cmd and lwip apps
Date: Tue, 8 Aug 2023 21:12:59 +0300 [thread overview]
Message-ID: <ZNKFq07QJwh/zzBU@hades> (raw)
In-Reply-To: <CAD8XO3bQmN0Dzp3gScPTUdgJ9OVEkdX0JsAopA9kbYzivHXwEA@mail.gmail.com>
Hi Maxim
[...]
> > > +static int lwip_empty_tmo(void) { return 0; };
> > > +int (*ulwip_tmo)(void) = lwip_empty_tmo;
> > > +void ulwip_set_tmo(int (*tmo)(void))
> > > +{
> > > + ulwip_tmo = tmo;
> > > +}
> > > +
> > > +static void ulwip_clear_tmo(void)
> > > +{
> > > + ulwip_tmo = lwip_empty_tmo;
> > > +}
> > > +
> > > +static void ulwip_timeout_handler(void)
> > > +{
> > > + eth_halt();
> > > + ulwip_tmo();
> > > + net_set_state(NETLOOP_FAIL); /* we did not get the reply */
> >
> > I am not sure what I am reading here. You use callbacks a few lines above
> > to set a timeout function. But only set it for dhcp. On top of that the
> > function for DHCP has a case for a *successful* asignment of ip addresses.
> > Why are we setting the state to fail? And why are we complicating this by
> > assigning and removing callbacks if it's only used for dhcp?
> >
> >
> I need two time out callbacks here:
> 1. Trap rx polling loop if lwip application works too long. It is used when
> code goes to net_loop() code to poll rx packets
> and nobody interrupts this loop. This timeout is used for all cmds (lwip
> apps).
>
> 2. Trap lwip application after specific timeout and then check some state.
> That is case for DHCP, where LWIP DHCP does not have
> callback for changing state. And I need to know when to stop polling loop.
Yes but is there a reason to reassing those callback to a function ptr?
Just define them and use them
[...]
> > > + ret = ulwip_dhcp();
> > > +
> > > + net_set_timeout_handler(2000UL, ulwip_timeout_handler);
> > > +
> > > + ulwip_loop();
> > > + if (IS_ENABLED(CONFIG_CMD_TFTPBOOT)) {
> > > + ulwip_clear_tmo();
> > > +
> > > + filename = env_get("bootfile");
> > > + if (!filename) {
> > > + printf("no bootfile\n");
> > > + return CMD_RET_FAILURE;
> >
> > Why is this a failure? You just have the tftp command enabled but dont
> > want to download anything
> >
> > thanks, if dhcp did not return filename, but only IP, then nothing to
> download. It's not an error.
Yes but downloading a file is not mandatory, it depends on a DHCP option. If you
want to emulate this behaviour, you need to fail only if 'bootfile' is set but
cant be downloaded.
>
>
> > > + }
> > > +
Regards
/Ilias
next prev parent reply other threads:[~2023-08-08 18:13 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-02 14:06 [PATCHv5 00/13] net/lwip: add lwip library for the network stack Maxim Uvarov
2023-08-02 14:06 ` [PATCHv5 01/13] net/lwip: add doc/develop/net_lwip.rst Maxim Uvarov
2023-08-02 21:31 ` Simon Glass
2023-08-02 14:06 ` [PATCHv5 02/13] net/lwip: integrate lwip library Maxim Uvarov
2023-08-02 21:31 ` Simon Glass
2023-08-03 14:18 ` Maxim Uvarov
2023-08-02 14:06 ` [PATCHv5 03/13] net/lwip: implement dns cmd Maxim Uvarov
2023-08-02 21:31 ` Simon Glass
2023-08-02 14:06 ` [PATCHv5 04/13] net/lwip: implement dhcp cmd Maxim Uvarov
2023-08-03 6:26 ` Ilias Apalodimas
2023-08-03 14:34 ` Maxim Uvarov
2023-08-02 14:06 ` [PATCHv5 05/13] net/lwip: implement tftp cmd Maxim Uvarov
2023-08-03 6:42 ` Ilias Apalodimas
2023-08-10 11:28 ` Maxim Uvarov
2023-08-10 19:23 ` Simon Goldschmidt
2023-08-02 14:06 ` [PATCHv5 06/13] net/lwip: implement wget cmd Maxim Uvarov
2023-08-03 6:48 ` Ilias Apalodimas
2023-08-03 14:59 ` Maxim Uvarov
2023-08-02 14:06 ` [PATCHv5 07/13] net/lwip: implement ping cmd Maxim Uvarov
2023-08-03 9:32 ` Ilias Apalodimas
2023-08-03 15:25 ` Maxim Uvarov
2023-08-02 14:06 ` [PATCHv5 08/13] net/lwip: add lwip configuration configuration Maxim Uvarov
2023-08-02 14:06 ` [PATCHv5 09/13] net/lwip: implement lwip port to u-boot Maxim Uvarov
2023-08-02 21:31 ` Simon Glass
2023-08-03 16:21 ` Maxim Uvarov
2023-08-08 10:07 ` Maxim Uvarov
2023-08-08 17:54 ` Simon Glass
2023-08-02 14:06 ` [PATCHv5 10/13] net/lwip: update .gitignore with lwip Maxim Uvarov
2023-08-02 21:31 ` Simon Glass
2023-08-03 6:01 ` Ilias Apalodimas
2023-08-02 14:06 ` [PATCHv5 11/13] net/lwip: connection between cmd and lwip apps Maxim Uvarov
2023-08-02 21:31 ` Simon Glass
2023-08-03 8:56 ` Ilias Apalodimas
2023-08-08 12:19 ` Maxim Uvarov
2023-08-08 18:12 ` Ilias Apalodimas [this message]
2023-08-09 19:29 ` Maxim Uvarov
2023-08-02 14:06 ` [PATCHv5 12/13] net/lwip: replace original net commands with lwip Maxim Uvarov
2023-08-02 21:31 ` Simon Glass
2023-08-08 14:05 ` Maxim Uvarov
2023-08-08 17:54 ` Simon Glass
2023-08-02 14:06 ` [PATCHv5 13/13] net/lwip: drop old net/wget Maxim Uvarov
2023-08-02 14:19 ` Maxim Uvarov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZNKFq07QJwh/zzBU@hades \
--to=ilias.apalodimas@linaro.org \
--cc=goldsimon@gmx.de \
--cc=joe.hershberger@ni.com \
--cc=lwip-devel@nongnu.org \
--cc=maxim.uvarov@linaro.org \
--cc=pbrobinson@redhat.com \
--cc=rfried.dev@gmail.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.