The following function has a bug whcih I have also reported here
http://sourceforge.net/tracker/?func=detail&aid=2941074&group_id=119500&atid=684216. Under heavy traffic it can (and will and
has in my case) free up two packets in one call resulting
in the condition where where both RX?CIF flags were set and both RX?CIE
interrupt enables were disabled which in turn prevents
any more packets from getting received resulting in total lockup of the
ethernet interface.
void NE64FreeReceiveBuffer (void)
{
if (pCurrentMBuf->status & IEVENT_RXACIF_MASK)
{
pCurrentMBuf->status = 0;
IEVENT = IEVENT_RXACIF_MASK;
IMASK_RXACIE = 1;
}
if (pCurrentMBuf->status & IEVENT_RXBCIF_MASK)
{
pCurrentMBuf->status = 0;
IEVENT = IEVENT_RXBCIF_MASK;
IMASK_RXBCIE = 1;
}
}
CORRECTED CODE - note the addition of the else to prevent execution of both
ifs in one call
void NE64FreeReceiveBuffer (void)
{
if (pCurrentMBuf->status & IEVENT_RXACIF_MASK) {
pCurrentMBuf->status = 0;
IEVENT = IEVENT_RXACIF_MASK;
IMASK_RXACIE = 1;
} else if (pCurrentMBuf->status & IEVENT_RXBCIF_MASK) {
pCurrentMBuf->status = 0;
IEVENT = IEVENT_RXBCIF_MASK;
IMASK_RXBCIE = 1;
}
}