aboutsummaryrefslogtreecommitdiff
path: root/hw/net/mcf_fec.c
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2015-07-15 18:19:08 +0800
committerStefan Hajnoczi <stefanha@redhat.com>2015-07-27 14:12:18 +0100
commite813f0d8813944061fa9bde861cf6899379843e6 (patch)
treec13196af225190f0efc22fe1208067391e4de28b /hw/net/mcf_fec.c
parent575bafd1f387c5f06b59cf2515f6bb1eff9d119d (diff)
downloadqemu-e813f0d8813944061fa9bde861cf6899379843e6.zip
qemu-e813f0d8813944061fa9bde861cf6899379843e6.tar.gz
qemu-e813f0d8813944061fa9bde861cf6899379843e6.tar.bz2
mcf_fec: Drop mcf_fec_can_receive
The semantics of .can_receive requires us to flush the queue explicitly when s->rx_enabled becomes true after it returns 0, but the packet being queued is not meaningful since the guest hasn't activated the card. Let's just drop the packet in this case. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Jason Wang <jasowang@redhat.com> Message-id: 1436955553-22791-8-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hw/net/mcf_fec.c')
-rw-r--r--hw/net/mcf_fec.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/hw/net/mcf_fec.c b/hw/net/mcf_fec.c
index e63af1b..4e6939f 100644
--- a/hw/net/mcf_fec.c
+++ b/hw/net/mcf_fec.c
@@ -397,12 +397,6 @@ static void mcf_fec_write(void *opaque, hwaddr addr,
mcf_fec_update(s);
}
-static int mcf_fec_can_receive(NetClientState *nc)
-{
- mcf_fec_state *s = qemu_get_nic_opaque(nc);
- return s->rx_enabled;
-}
-
static ssize_t mcf_fec_receive(NetClientState *nc, const uint8_t *buf, size_t size)
{
mcf_fec_state *s = qemu_get_nic_opaque(nc);
@@ -417,7 +411,7 @@ static ssize_t mcf_fec_receive(NetClientState *nc, const uint8_t *buf, size_t si
DPRINTF("do_rx len %d\n", size);
if (!s->rx_enabled) {
- fprintf(stderr, "mcf_fec_receive: Unexpected packet\n");
+ return -1;
}
/* 4 bytes for the CRC. */
size += 4;
@@ -490,7 +484,6 @@ static const MemoryRegionOps mcf_fec_ops = {
static NetClientInfo net_mcf_fec_info = {
.type = NET_CLIENT_OPTIONS_KIND_NIC,
.size = sizeof(NICState),
- .can_receive = mcf_fec_can_receive,
.receive = mcf_fec_receive,
};