From: Tom Rini <trini@konsulko.com>
To: Maxim Uvarov <maxim.uvarov@linaro.org>
Cc: Peter Robinson <pbrobinson@gmail.com>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
u-boot@lists.denx.de, pbrobinson@redhat.com,
joe.hershberger@ni.com, rfried.dev@gmail.com, goldsimon@gmx.de,
lwip-devel@nongnu.org
Subject: Re: [PATCHv6 04/14] net/lwip: implement dhcp cmd
Date: Thu, 17 Aug 2023 11:10:12 -0400 [thread overview]
Message-ID: <20230817151012.GC1515023@bill-the-cat> (raw)
In-Reply-To: <CAD8XO3aAyA-m6BAkOnxw9uF2w_kadgSAwF3iRU_uBw-jq9iJJA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4783 bytes --]
On Thu, Aug 17, 2023 at 08:55:17PM +0600, Maxim Uvarov wrote:
> On Thu, 17 Aug 2023 at 20:04, Peter Robinson <pbrobinson@gmail.com> wrote:
>
> > On Thu, Aug 17, 2023 at 2:46 PM Maxim Uvarov <maxim.uvarov@linaro.org>
> > wrote:
> > >
> > > On Mon, 14 Aug 2023 at 21:29, Tom Rini <trini@konsulko.com> wrote:
> > >
> > > > On Mon, Aug 14, 2023 at 09:18:19PM +0600, Maxim Uvarov wrote:
> > > > > On Mon, 14 Aug 2023 at 20:21, Ilias Apalodimas <
> > > > ilias.apalodimas@linaro.org>
> > > > > wrote:
> > > > >
> > > > > > On Mon, Aug 14, 2023 at 07:32:43PM +0600, Maxim Uvarov wrote:
> > > > > > > Implement function for dhcp command with lwIP variant. Usage and
> > > > output
> > > > > > is
> > > > > > > the same as the original command. This code called by
> > compatibility
> > > > code
> > > > > > > between U-Boot and lwIP.
> > > > > >
> > > > > > Same as the dns command
> > > > > >
> > > > > > >
> > > > > > > Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
> > > > > > > ---
> > > > > > > include/net/lwip.h | 10 +++++++
> > > > > > > net/lwip/Makefile | 1 +
> > > > > > > net/lwip/apps/dhcp/lwip-dhcp.c | 51
> > > > ++++++++++++++++++++++++++++++++++
> > > > > > > 3 files changed, 62 insertions(+)
> > > > > > > create mode 100644 net/lwip/apps/dhcp/lwip-dhcp.c
> > > > > > >
> > > > > > > diff --git a/include/net/lwip.h b/include/net/lwip.h
> > > > > > > index c83b5c8231..2f035280eb 100644
> > > > > > > --- a/include/net/lwip.h
> > > > > > > +++ b/include/net/lwip.h
> > > > > > > @@ -15,3 +15,13 @@ int do_lwip_dns(struct cmd_tbl *cmdtp, int
> > flag,
> > > > int
> > > > > > argc,
> > > > > > > * Other value < 0, if error
> > > > > > > */
> > > > > > > int ulwip_dns(char *name, char *varname);
> > > > > > > +
> > > > > > > +/*
> > > > > > > +* This function creates the DHCP request to obtain IP address.
> > If
> > > > DHCP
> > > > > > server
> > > > > >
> > > > > > Sphinx needs something more, please check the existing functions
> > > > > >
> > > > > > > +* returns file name, this file will be downloaded with tftp.
> > After
> > > > this
> > > > > > > +* function you need to invoke the polling loop to process
> > network
> > > > > > communication.
> > > > > > > +*
> > > > > > > +* Return: 0 if success
> > > > > > > +* Other value < 0, if error
> > > > > > > +*/
> > > > > > > +int ulwip_dhcp(void);
> > > > > > > diff --git a/net/lwip/Makefile b/net/lwip/Makefile
> > > > > > > index 6d2c00605b..59323fb325 100644
> > > > > > > --- a/net/lwip/Makefile
> > > > > > > +
> > > > > > > +static struct dhcp dhcp;
> > > > > > > +
> > > > > > > +static int ulwip_dhcp_tmo(void)
> > > > > > > +{
> > > > > > > + switch (dhcp.state) {
> > > > > > > + case DHCP_STATE_BOUND:
> > > > > > > + env_set("bootfile", dhcp.boot_file_name);
> > > > > > > + env_set("ipaddr",
> > ip4addr_ntoa(&dhcp.offered_ip_addr));
> > > > > > > + env_set("netmask",
> > > > ip4addr_ntoa(&dhcp.offered_sn_mask));
> > > > > > > + env_set("serverip",
> > > > ip4addr_ntoa(&dhcp.server_ip_addr));
> > > > > > > + printf("DHCP client bound to address %s\n",
> > > > > > ip4addr_ntoa(&dhcp.offered_ip_addr));
> > > > > > > + break;
> > > > > > > + default:
> > > > > > > + return -1;
> > > > > > > + }
> > > > > > > +
> > > > > > > + return 0;
> > > > > > > +}
> > > > > > > +
> > > > > > > +int ulwip_dhcp(void)
> > > > > > > +{
> > > > > > > + int err;
> > > > > > > + struct netif *netif;
> > > > > > > +
> > > > > > > + ulwip_set_tmo(ulwip_dhcp_tmo);
> > > > > > > + netif = netif_get_by_index(1);
> > > > > >
> > > > > > What's (1)?
> > > > > >
> > > > > >
> > > > > Only one lwip netif is registered. 1 - here is the index of netif. I
> > > > don't
> > > > > think that there is any definition for that...
> > > > >
> > > >
> > > > And there's only ever going to be one interface (even if we have ipv4
> > > > and ipv60 ? If so, define it to something please, thanks.
> > > >
> > > > --
> > > > Tom
> > > >
> > >
> > > Yes, one interface has 2 addresses ipv4 and ipv6.
> >
> > What about a device like a router which may have multiple wired
> > ethernet interface?
>
> Yea, looks like we need lwip netif per U-Boots eth_devs. I did not yet
> support several eth devices, but it will be good to add this to not break
> existing functionality..
The general case ends up being if we have more than one interface,
ethact is what's used. I'm unsure off-hand if some of the fancier
networking-centric chipsets and devices have something more complex
setup in their stacks.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
next prev parent reply other threads:[~2023-08-17 15:10 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-14 13:32 [PATCHv6 00/14] net/lwip: add lwip library for the network stack Maxim Uvarov
2023-08-14 13:32 ` [PATCHv6 01/14] net/lwip: add doc/develop/net_lwip.rst Maxim Uvarov
2023-08-14 14:10 ` Ilias Apalodimas
2023-08-14 13:32 ` [PATCHv6 02/14] net/lwip: integrate lwIP library Maxim Uvarov
2023-08-14 14:13 ` Ilias Apalodimas
2023-08-14 13:32 ` [PATCHv6 03/14] net/lwip: implement dns cmd Maxim Uvarov
2023-08-14 14:19 ` Ilias Apalodimas
2023-08-14 15:15 ` Maxim Uvarov
2023-08-15 12:42 ` Maxim Uvarov
2023-08-15 14:42 ` Tom Rini
2023-08-16 10:26 ` Ilias Apalodimas
2023-08-16 11:01 ` Maxim Uvarov
2023-08-16 11:54 ` Ilias Apalodimas
2023-08-16 12:24 ` Maxim Uvarov
2023-08-14 13:32 ` [PATCHv6 04/14] net/lwip: implement dhcp cmd Maxim Uvarov
2023-08-14 14:21 ` Ilias Apalodimas
2023-08-14 15:18 ` Maxim Uvarov
2023-08-14 15:29 ` Tom Rini
2023-08-17 13:46 ` Maxim Uvarov
2023-08-17 14:04 ` Peter Robinson
2023-08-17 14:55 ` Maxim Uvarov
2023-08-17 15:10 ` Tom Rini [this message]
2023-08-18 9:39 ` Maxim Uvarov
2023-08-18 11:14 ` Peter Robinson
2023-08-18 14:24 ` Tom Rini
2023-08-14 13:32 ` [PATCHv6 05/14] net/lwip: implement tftp cmd Maxim Uvarov
2023-08-14 14:25 ` Ilias Apalodimas
2023-08-14 18:54 ` Maxim Uvarov
2023-08-14 13:32 ` [PATCHv6 06/14] net/lwip: implement wget cmd Maxim Uvarov
2023-08-16 8:38 ` Ilias Apalodimas
2023-08-14 13:32 ` [PATCHv6 07/14] net/lwip: implement ping cmd Maxim Uvarov
2023-08-16 8:42 ` Ilias Apalodimas
2023-08-16 9:09 ` Maxim Uvarov
2023-08-16 14:39 ` Simon Glass
2023-08-16 20:15 ` Maxim Uvarov
2023-08-18 3:10 ` Simon Glass
2023-08-18 9:27 ` Maxim Uvarov
2023-08-22 18:56 ` Simon Glass
2023-08-14 13:32 ` [PATCHv6 08/14] net/lwip: add lwIP configuration Maxim Uvarov
2023-08-14 13:32 ` [PATCHv6 09/14] net/lwip: implement lwIP port to U-Boot Maxim Uvarov
2023-08-16 9:01 ` Ilias Apalodimas
2023-08-18 12:53 ` Maxim Uvarov
2023-08-18 18:21 ` Simon Goldschmidt
2023-08-14 13:32 ` [PATCHv6 10/14] net/lwip: update .gitignore with lwIP Maxim Uvarov
2023-08-14 13:32 ` [PATCHv6 11/14] net/lwip: connection between cmd and lwip apps Maxim Uvarov
2023-08-16 9:12 ` Ilias Apalodimas
2023-08-14 13:32 ` [PATCHv6 12/14] net/lwip: replace original net commands with lwip Maxim Uvarov
2023-08-14 13:32 ` [PATCHv6 13/14] net/lwip: split net.h to net.h, arp.h and eth.h Maxim Uvarov
2023-08-14 13:32 ` [PATCHv6 14/14] net/lwip: drop old net/wget 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=20230817151012.GC1515023@bill-the-cat \
--to=trini@konsulko.com \
--cc=goldsimon@gmx.de \
--cc=ilias.apalodimas@linaro.org \
--cc=joe.hershberger@ni.com \
--cc=lwip-devel@nongnu.org \
--cc=maxim.uvarov@linaro.org \
--cc=pbrobinson@gmail.com \
--cc=pbrobinson@redhat.com \
--cc=rfried.dev@gmail.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.