|
@@ -149,7 +149,7 @@ uchar NetEtherNullAddr[6];
|
|
void (*push_packet)(void *, int len) = 0;
|
|
void (*push_packet)(void *, int len) = 0;
|
|
#endif
|
|
#endif
|
|
/* Network loop state */
|
|
/* Network loop state */
|
|
-int NetState;
|
|
|
|
|
|
+enum net_loop_state net_state;
|
|
/* Tried all network devices */
|
|
/* Tried all network devices */
|
|
int NetRestartWrap;
|
|
int NetRestartWrap;
|
|
/* Network loop restarted */
|
|
/* Network loop restarted */
|
|
@@ -212,7 +212,7 @@ void net_auto_load(void)
|
|
* Just use BOOTP/RARP to configure system;
|
|
* Just use BOOTP/RARP to configure system;
|
|
* Do not use TFTP to load the bootfile.
|
|
* Do not use TFTP to load the bootfile.
|
|
*/
|
|
*/
|
|
- NetState = NETLOOP_SUCCESS;
|
|
|
|
|
|
+ net_set_state(NETLOOP_SUCCESS);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
#if defined(CONFIG_CMD_NFS)
|
|
#if defined(CONFIG_CMD_NFS)
|
|
@@ -290,7 +290,7 @@ int NetLoop(enum proto_t protocol)
|
|
restart:
|
|
restart:
|
|
memcpy(NetOurEther, eth_get_dev()->enetaddr, 6);
|
|
memcpy(NetOurEther, eth_get_dev()->enetaddr, 6);
|
|
|
|
|
|
- NetState = NETLOOP_CONTINUE;
|
|
|
|
|
|
+ net_set_state(NETLOOP_CONTINUE);
|
|
|
|
|
|
/*
|
|
/*
|
|
* Start the ball rolling with the given start function. From
|
|
* Start the ball rolling with the given start function. From
|
|
@@ -399,7 +399,7 @@ restart:
|
|
|
|
|
|
/*
|
|
/*
|
|
* Main packet reception loop. Loop receiving packets until
|
|
* Main packet reception loop. Loop receiving packets until
|
|
- * someone sets `NetState' to a state that terminates.
|
|
|
|
|
|
+ * someone sets `net_state' to a state that terminates.
|
|
*/
|
|
*/
|
|
for (;;) {
|
|
for (;;) {
|
|
WATCHDOG_RESET();
|
|
WATCHDOG_RESET();
|
|
@@ -451,7 +451,7 @@ restart:
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- switch (NetState) {
|
|
|
|
|
|
+ switch (net_state) {
|
|
|
|
|
|
case NETLOOP_RESTART:
|
|
case NETLOOP_RESTART:
|
|
NetRestarted = 1;
|
|
NetRestarted = 1;
|
|
@@ -475,6 +475,9 @@ restart:
|
|
|
|
|
|
case NETLOOP_FAIL:
|
|
case NETLOOP_FAIL:
|
|
goto done;
|
|
goto done;
|
|
|
|
+
|
|
|
|
+ case NETLOOP_CONTINUE:
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -492,7 +495,7 @@ done:
|
|
static void
|
|
static void
|
|
startAgainTimeout(void)
|
|
startAgainTimeout(void)
|
|
{
|
|
{
|
|
- NetState = NETLOOP_RESTART;
|
|
|
|
|
|
+ net_set_state(NETLOOP_RESTART);
|
|
}
|
|
}
|
|
|
|
|
|
static void
|
|
static void
|
|
@@ -523,7 +526,7 @@ void NetStartAgain(void)
|
|
|
|
|
|
if ((!retry_forever) && (NetTryCount >= retrycnt)) {
|
|
if ((!retry_forever) && (NetTryCount >= retrycnt)) {
|
|
eth_halt();
|
|
eth_halt();
|
|
- NetState = NETLOOP_FAIL;
|
|
|
|
|
|
+ net_set_state(NETLOOP_FAIL);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -540,10 +543,10 @@ void NetStartAgain(void)
|
|
NetSetTimeout(10000UL, startAgainTimeout);
|
|
NetSetTimeout(10000UL, startAgainTimeout);
|
|
NetSetHandler(startAgainHandler);
|
|
NetSetHandler(startAgainHandler);
|
|
} else {
|
|
} else {
|
|
- NetState = NETLOOP_FAIL;
|
|
|
|
|
|
+ net_set_state(NETLOOP_FAIL);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- NetState = NETLOOP_RESTART;
|
|
|
|
|
|
+ net_set_state(NETLOOP_RESTART);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|