mirror of https://gitee.com/openkylin/qemu.git
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>
This commit is contained in:
parent
575bafd1f3
commit
e813f0d881
|
@ -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,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue