[PATCH 2/5] net: Move some variables to net-common files
Andrew Goodbody
andrew.goodbody at linaro.org
Tue Dec 9 17:46:33 CET 2025
On 09/12/2025 15:03, Jerome Forissier wrote:
> Hi Andrew,
>
> On 12/8/25 13:52, Andrew Goodbody wrote:
>> Make some variables available to be used by either the legacy network
>> code or LWIP by moving them into the net-common files. This also allowed
>> removing a small number of duplicated variables from the LWIP code.
>>
>> Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
>> ---
>> include/net-common.h | 21 +++++++++++++++++++--
>> include/net-legacy.h | 9 ---------
>> net/lwip/net-lwip.c | 5 -----
>> net/net-common.c | 18 ++++++++++++++++++
>> net/net.c | 21 ---------------------
>> 5 files changed, 37 insertions(+), 37 deletions(-)
>>
>> diff --git a/include/net-common.h b/include/net-common.h
>> index d7a0f7dff7e50527e77419ead9a9ff30deeea545..ea43c72ab06a782c621f61811b9774c1185d88fc 100644
>> --- a/include/net-common.h
>> +++ b/include/net-common.h
>> @@ -132,13 +132,30 @@ static inline void net_set_state(enum net_loop_state state)
>> }
>>
>> extern int net_restart_wrap; /* Tried all network devices */
>> -extern uchar *net_rx_packets[PKTBUFSRX]; /* Receive packets */
>> +extern uchar *net_rx_packets[PKTBUFSRX]; /* Receive packets */
>> +extern uchar *net_rx_packet; /* Current receive packet */
>> extern const u8 net_bcast_ethaddr[ARP_HLEN]; /* Ethernet broadcast address */
>> -extern char net_boot_file_name[1024];/* Boot File name */
>> extern struct in_addr net_ip; /* Our IP addr (0 = unknown) */
>> /* Indicates whether the pxe path prefix / config file was specified in dhcp option */
>> extern char *pxelinux_configfile;
>>
>> +/* Our IP addr (0 = unknown) */
>> +extern struct in_addr net_ip;
>> +/* Server IP addr (0 = unknown) */
>> +extern struct in_addr net_server_ip;
>> +/* Our subnet mask (0=unknown) */
>> +extern struct in_addr net_netmask;
>> +/* Our gateways IP address */
>> +extern struct in_addr net_gateway;
>> +/* Boot File name */
>> +extern char net_boot_file_name[1024];
>> +/* Indicates whether the file name was specified on the command line */
>> +extern bool net_boot_file_name_explicit;
>> +/* The actual transferred size of the bootfile (in bytes) */
>> +extern u32 net_boot_file_size;
>> +/* Boot file size in blocks as reported by the DHCP server */
>> +extern u32 net_boot_file_expected_size_in_blocks;
>> +
>> /**
>> * compute_ip_checksum() - Compute IP checksum
>> *
>
> AFAICT the following variables are NOT used by lwIP and should
> therefore stay in net-legacy.h/net.c>: net_rx_packet, net_server_ip,
> net_netmask, net_gateway, net_boot_file_name_explicit.
>
> Thanks,
OK, I was just trying to keep related variables together.
Andrew
More information about the U-Boot
mailing list