summaryrefslogtreecommitdiffstats
path: root/libs/Network
diff options
context:
space:
mode:
authorEvan Lojewski <github@meklort.com>2020-08-04 21:04:09 -0600
committerGitHub <noreply@github.com>2020-08-04 21:04:09 -0600
commit9c333a3bd7b9094d9c494040e44dba940bdfdac7 (patch)
tree6fb084694dfc156ec0a5ed1f78a481645d5a2823 /libs/Network
parent9dccd276302d9ccee3466bc19355d41efc401bdd (diff)
downloadbcm5719-ortega-9c333a3bd7b9094d9c494040e44dba940bdfdac7.tar.gz
bcm5719-ortega-9c333a3bd7b9094d9c494040e44dba940bdfdac7.zip
network: Report an error when the RX path has hung, potentially due to a network reset. (#99)
Diffstat (limited to 'libs/Network')
-rw-r--r--libs/Network/include/Network.h1
-rw-r--r--libs/Network/rx.c21
2 files changed, 19 insertions, 3 deletions
diff --git a/libs/Network/include/Network.h b/libs/Network/include/Network.h
index 0b65755..0d13a90 100644
--- a/libs/Network/include/Network.h
+++ b/libs/Network/include/Network.h
@@ -81,6 +81,7 @@ typedef struct
/* State Trackking */
bool link_state_printed;
+ bool network_resetting;
} NetworkPort_t;
typedef union
diff --git a/libs/Network/rx.c b/libs/Network/rx.c
index bb721d2..637c3d7 100644
--- a/libs/Network/rx.c
+++ b/libs/Network/rx.c
@@ -133,6 +133,8 @@ bool Network_PassthroughRxPatcket(NetworkPort_t *port)
rxbuf = *((RegAPERxbufoffset_t *)port->rx_offset);
if ((int)rxbuf.bits.Valid)
{
+ port->network_resetting = false;
+
#if CXX_SIMULATOR
rxbuf.print();
#endif
@@ -197,7 +199,7 @@ bool Network_PassthroughRxPatcket(NetworkPort_t *port)
if (!max_loops)
{
- printf("Error waiting for fifo space. Network may be down.");
+ printf("Error waiting for fifo space. Network may be down.\n");
// Drop all packets that remain and exit.
retire.bits.Head = blockid;
retire.bits.Tail = rxbuf.bits.Tail;
@@ -261,8 +263,21 @@ bool Network_PassthroughRxPatcket(NetworkPort_t *port)
return true;
}
- else
+ else if (!port->network_resetting)
{
- return false;
+ RegAPERxPoolModeStatus_t rxmode;
+ rxmode = *((RegAPERxPoolModeStatus_t *)port->rx_mode);
+ if (rxmode.bits.Error)
+ {
+ printf("RX Error, resetting\n");
+ // Note: If we set port->rx_mode->bits.Reset to 1 here
+ // we run the risk of causing packet loss on the host,
+ // potentially resulting in a complete driver hang.
+ // Instead, we just flag this as a problem spot and wait.
+ // for the system to recover on its own.
+ port->network_resetting = true;
+ }
}
+
+ return false;
}
OpenPOWER on IntegriCloud