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 <[email protected]>
---
 include/net-common.h | 17 +++++++++++++++++
 include/net-legacy.h | 17 -----------------
 net/net-common.c     |  3 +++
 net/net.c            |  2 --
 4 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/include/net-common.h b/include/net-common.h
index 
f5cff3e7c0c5d25f154e7730fad52cf03f71b875..d7a0f7dff7e50527e77419ead9a9ff30deeea545
 100644
--- a/include/net-common.h
+++ b/include/net-common.h
@@ -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 */
diff --git a/include/net-legacy.h b/include/net-legacy.h
index 
9564e97d238daa2ce919ebaa60bdaf4466d76b14..0a10121b0cf50898a90bb1179966f01dbdda65ad
 100644
--- a/include/net-legacy.h
+++ b/include/net-legacy.h
@@ -25,7 +25,6 @@ struct udevice;
 #define DEBUG_LL_STATE 0       /* Link local state machine changes */
 #define DEBUG_DEV_PKT 0                /* Packets or info directed to the 
device */
 #define DEBUG_NET_PKT 0                /* Packets on info on the network at 
large */
-#define DEBUG_INT_STATE 0      /* Internal network state changes */
 
 /* ARP hardware address length */
 #define ARP_HLEN 6
@@ -369,22 +368,6 @@ bool arp_is_waiting(void);         /* Waiting for ARP 
reply? */
 void net_set_icmp_handler(rxhand_icmp_f *f); /* Set ICMP RX handler */
 void net_set_timeout_handler(ulong t, thand_f *f);/* Set timeout handler */
 
-/* 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;
-}
-
 /*
  * net_get_async_tx_pkt_buf - Get a packet buffer that is not in use for
  *                           sending an asynchronous reply
diff --git a/net/net-common.c b/net/net-common.c
index 
c68e19fc03e64a740d05b998ef0efb9fce311543..ec1e179f7d9cdd459dc3b8c2d13f6e478ad4ce87
 100644
--- a/net/net-common.c
+++ b/net/net-common.c
@@ -6,6 +6,9 @@
 #include <linux/time.h>
 #include <rtc.h>
 
+/* Network loop state */
+enum net_loop_state net_state;
+
 void copy_filename(char *dst, const char *src, int size)
 {
        if (src && *src && (*src == '"')) {
diff --git a/net/net.c b/net/net.c
index 
f579f6ac5bcced5a05a340b000a1ca9c2651c6da..03a39419d10817aff5f12badc0f604a403fe7fb2
 100644
--- a/net/net.c
+++ b/net/net.c
@@ -163,8 +163,6 @@ const u8 net_null_ethaddr[6];
 #if defined(CONFIG_API) || defined(CONFIG_EFI_LOADER)
 void (*push_packet)(void *, int len) = 0;
 #endif
-/* Network loop state */
-enum net_loop_state net_state;
 /* Tried all network devices */
 int            net_restart_wrap;
 /* Network loop restarted */

-- 
2.47.3

Reply via email to