From 8b7acc79b9adb4dda6cc867b90e3a1e873f4f7e8 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 14 Nov 2013 14:53:46 +0100 Subject: [PATCH 1/2] smc91c111: Fix receive starvation In case the smc91c111 interface signals that it cannot receive more packets the packets are queued and further reception will be disabled. In case the interface is again ready to receive packets notify the upper layer. Signed-off-by: Sebastian Huber Signed-off-by: Stefan Hajnoczi --- hw/net/smc91c111.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/net/smc91c111.c b/hw/net/smc91c111.c index f5963e2cbe..a8e29b3b42 100644 --- a/hw/net/smc91c111.c +++ b/hw/net/smc91c111.c @@ -185,6 +185,7 @@ static void smc91c111_release_packet(smc91c111_state *s, int packet) s->allocated &= ~(1 << packet); if (s->tx_alloc == 0x80) smc91c111_tx_alloc(s); + qemu_flush_queued_packets(qemu_get_queue(s->nic)); } /* Flush the TX FIFO. */ From 96e35046e4a97df5b4e1e24e217eb1e1701c7c71 Mon Sep 17 00:00:00 2001 From: Amos Kong Date: Mon, 18 Nov 2013 23:32:17 +0800 Subject: [PATCH 2/2] virtio-net: fix the memory leak in rxfilter_notify() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit object_get_canonical_path() returns a gchar*, it should be freed by the caller. Signed-off-by: Amos Kong Reviewed-by: Michael S. Tsirkin Reviewed-by: Vlad Yasevich Reviewed-by: Andreas Färber Signed-off-by: Stefan Hajnoczi --- hw/net/virtio-net.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 613f144d12..b75c753305 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -200,16 +200,16 @@ static void rxfilter_notify(NetClientState *nc) VirtIONet *n = qemu_get_nic_opaque(nc); if (nc->rxfilter_notify_enabled) { + gchar *path = object_get_canonical_path(OBJECT(n->qdev)); if (n->netclient_name) { event_data = qobject_from_jsonf("{ 'name': %s, 'path': %s }", - n->netclient_name, - object_get_canonical_path(OBJECT(n->qdev))); + n->netclient_name, path); } else { - event_data = qobject_from_jsonf("{ 'path': %s }", - object_get_canonical_path(OBJECT(n->qdev))); + event_data = qobject_from_jsonf("{ 'path': %s }", path); } monitor_protocol_event(QEVENT_NIC_RX_FILTER_CHANGED, event_data); qobject_decref(event_data); + g_free(path); /* disable event notification to avoid events flooding */ nc->rxfilter_notify_enabled = 0;