Skip to contentSkip to conversation

xen nic: use qemu_malloc

PATCH Applied Gerd Hoffmann 2 participants 5 messages Jun 8, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen nic: use qemu_malloc

---
 hw/xen_nic.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
hw/xen_nic.c +2 -2
index 048d865..5fcc701 100644
@@ -176,7 +176,7 @@ static void net_tx_packets(struct XenNetDev *netdev)
 	    if (txreq.flags & NETTXF_csum_blank) {
                 /* have read-only mapping -> can't fill checksum in-place */
                 if (!tmpbuf)
-                    tmpbuf = malloc(PAGE_SIZE);
+                    tmpbuf = qemu_malloc(PAGE_SIZE);
                 memcpy(tmpbuf, page + txreq.offset, txreq.size);
 		net_checksum_calculate(tmpbuf, txreq.size);
                 qemu_send_packet(netdev->vs, tmpbuf, txreq.size);
@@ -190,7 +190,7 @@ static void net_tx_packets(struct XenNetDev *netdev)
 	    break;
 	netdev->tx_work = 0;
     }
-    free(tmpbuf);
+    qemu_free(tmpbuf);
 }
 
 /* ------------------------------------------------------------- */
Signature · 1 line
1.6.2.2
#1 lore raw

PATCH 1/1 xen nic: check tx queue after connect.

Needed for savevm/loadvm + migration: In that case the queue might already have packets on (re-)connect. The guest wouldn't notify us because notifications are only sent when stuffing a packet into an empty queue.

---
 hw/xen_nic.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
hw/xen_nic.c +2 -0
index 5fcc701..6f03ae7 100644
@@ -354,6 +354,8 @@ static int net_connect(struct XenDevice *xendev)
 		  "remote port %d, local port %d\n",
 		  netdev->tx_ring_ref, netdev->rx_ring_ref,
 		  netdev->xendev.remote_port, netdev->xendev.local_port);
+
+    net_tx_packets(netdev);
     return 0;
 }
 
Signature · 1 line
1.6.2.2
#2 lore raw

PATCH 1/1 xen nic: use XC_PAGE_SIZE instead of PAGE_SIZE.

In reply to Gerd Hoffmann
---
 hw/xen_nic.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/xen_nic.c +1 -1
index 6f03ae7..f7fa3d7 100644
@@ -176,7 +176,7 @@ static void net_tx_packets(struct XenNetDev *netdev)
 	    if (txreq.flags & NETTXF_csum_blank) {
                 /* have read-only mapping -> can't fill checksum in-place */
                 if (!tmpbuf)
-                    tmpbuf = qemu_malloc(PAGE_SIZE);
+                    tmpbuf = qemu_malloc(XC_PAGE_SIZE);
                 memcpy(tmpbuf, page + txreq.offset, txreq.size);
 		net_checksum_calculate(tmpbuf, txreq.size);
                 qemu_send_packet(netdev->vs, tmpbuf, txreq.size);
Signature · 1 line
1.6.2.2