net: move net_state to net-common

Move the net_state variable into common code so that it can be used by
either the legacy network code or lwIP. This is needed for porting
across the NFS support code for use with lwIP.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
This commit is contained in:
Andrew Goodbody
2025-12-12 11:32:24 +00:00
committed by Jerome Forissier
parent 492ff73de6
commit 60c228c077
4 changed files with 20 additions and 19 deletions

View File

@@ -13,6 +13,7 @@
#include <time.h>
#define DEBUG_NET_PKT_TRACE 0 /* Trace all packet data */
#define DEBUG_INT_STATE 0 /* Internal network state changes */
/*
* The number of receive packet buffers, and the required packet buffer
@@ -114,6 +115,22 @@ struct ip_udp_hdr {
#define RINGSZ 4
#define RINGSZ_LOG2 2
/* Network loop state */
enum net_loop_state {
NETLOOP_CONTINUE,
NETLOOP_RESTART,
NETLOOP_SUCCESS,
NETLOOP_FAIL
};
extern enum net_loop_state net_state;
static inline void net_set_state(enum net_loop_state state)
{
debug_cond(DEBUG_INT_STATE, "--- NetState set to %d\n", state);
net_state = state;
}
extern int net_restart_wrap; /* Tried all network devices */
extern uchar *net_rx_packets[PKTBUFSRX]; /* Receive packets */
extern const u8 net_bcast_ethaddr[ARP_HLEN]; /* Ethernet broadcast address */