sunhme: fix return values from sunhme_receive() during receive packet processing

The current return values in sunhme_receive() when processing incoming packets
are inverted from what they should be. Make sure that we return 0 to indicate
the packet was discarded (and polling is to be disabled) and -1 to indicate
that the packet was discarded but polling for incoming data is to be continued.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
This commit is contained in:
Mark Cave-Ayland 2019-06-30 18:21:50 +01:00
parent 1058e1a377
commit 29df47a5cc
1 changed files with 3 additions and 3 deletions

View File

@ -728,7 +728,7 @@ static ssize_t sunhme_receive(NetClientState *nc, const uint8_t *buf,
/* Do nothing if MAC RX disabled */ /* Do nothing if MAC RX disabled */
if (!(s->macregs[HME_MACI_RXCFG >> 2] & HME_MAC_RXCFG_ENABLE)) { if (!(s->macregs[HME_MACI_RXCFG >> 2] & HME_MAC_RXCFG_ENABLE)) {
return -1; return 0;
} }
trace_sunhme_rx_filter_destmac(buf[0], buf[1], buf[2], trace_sunhme_rx_filter_destmac(buf[0], buf[1], buf[2],
@ -757,14 +757,14 @@ static ssize_t sunhme_receive(NetClientState *nc, const uint8_t *buf,
/* Didn't match hash filter */ /* Didn't match hash filter */
trace_sunhme_rx_filter_hash_nomatch(); trace_sunhme_rx_filter_hash_nomatch();
trace_sunhme_rx_filter_reject(); trace_sunhme_rx_filter_reject();
return 0; return -1;
} else { } else {
trace_sunhme_rx_filter_hash_match(); trace_sunhme_rx_filter_hash_match();
} }
} else { } else {
/* Not for us */ /* Not for us */
trace_sunhme_rx_filter_reject(); trace_sunhme_rx_filter_reject();
return 0; return -1;
} }
} else { } else {
trace_sunhme_rx_filter_promisc_match(); trace_sunhme_rx_filter_promisc_match();