aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2010-10-19 17:03:24 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2010-11-21 09:16:57 -0600
commitc1ded3dc9f2d6caeb62eb3005510837a62b795d2 (patch)
tree4d638b1f5dfd5ab693ea9edffc6edd8b1e700a90
parent2871a3f6b64966bc78fce0d4033bf32fcd42401c (diff)
pcnet: Do not receive external frames in loopback mode
While not explicitly stated in the spec, it was observed on real systems that enabling loopback testing on the pcnet controller disables reception of external frames. And some legacy software relies on it, so provide this behavior. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--hw/pcnet.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/pcnet.c b/hw/pcnet.c
index b52935adf..f970bdaf3 100644
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -1048,9 +1048,10 @@ ssize_t pcnet_receive(VLANClientState *nc, const uint8_t *buf, size_t size_)
int crc_err = 0;
int size = size_;
- if (CSR_DRX(s) || CSR_STOP(s) || CSR_SPND(s) || !size)
+ if (CSR_DRX(s) || CSR_STOP(s) || CSR_SPND(s) || !size ||
+ (CSR_LOOP(s) && !s->looptest)) {
return -1;
-
+ }
#ifdef PCNET_DEBUG
printf("pcnet_receive size=%d\n", size);
#endif