[PATCH] net: make dhcp_run() common for NET and NET_LWIP

Tom Rini trini at konsulko.com
Thu Oct 16 17:32:34 CEST 2025


On Thu, Oct 16, 2025 at 02:53:50PM +0200, Heinrich Schuchardt wrote:
> On 10/9/25 14:30, Jerome Forissier wrote:
> > THere are currently two implementations of dhcp_run(): one in cmd/net.c
> > for NET and one in net/lwip/dhcp.c for NET_LWIP. There is no
> > justification for that. Therefore, move the NET version into
> > net/net-common.c to be used by both stacks, and drop the NET_LWIP
> > version which by the way does not look totally correct.
> > 
> > Signed-off-by: Jerome Forissier <jerome.forissier at linaro.org>
> > Suggested-by: Tom Rini <trini at konsulko.com>
> > ---
> > 
> >   cmd/net.c            | 36 ++----------------------------------
> >   include/net-common.h | 10 ++++++++++
> >   include/net-lwip.h   |  1 -
> >   net/lwip/dhcp.c      | 22 ----------------------
> >   net/net-common.c     | 35 +++++++++++++++++++++++++++++++++++
> >   5 files changed, 47 insertions(+), 57 deletions(-)
> > 
> > diff --git a/cmd/net.c b/cmd/net.c
> > index 886735ea14f6..24099764493e 100644
> > --- a/cmd/net.c
> > +++ b/cmd/net.c
> > @@ -134,8 +134,8 @@ U_BOOT_CMD(dhcp6,	3,	1,	do_dhcp6,
> >   #endif
> >   #if defined(CONFIG_CMD_DHCP)
> > -static int do_dhcp(struct cmd_tbl *cmdtp, int flag, int argc,
> > -		   char *const argv[])
> > +int do_dhcp(struct cmd_tbl *cmdtp, int flag, int argc,
> > +	    char *const argv[])
> 
> Thank you for all this clean up work.
> 
> Should we move the dhcp command to a new file cmd/dhcp.c to get rid of all
> the related '#if' statements?

Might be a reasonable cleanup, yes. But at some point, the legacy
network stack will be for SPL only, ideally.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20251016/eeaf220d/attachment.sig>


More information about the U-Boot mailing list