All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 09/10] Compile virtio-net only once
@ 2010-03-26 19:04 Blue Swirl
  0 siblings, 0 replies; only message in thread
From: Blue Swirl @ 2010-03-26 19:04 UTC (permalink / raw)
  To: qemu-devel

Replace access macros with direct accesses.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 Makefile.objs   |    2 +-
 Makefile.target |    2 +-
 hw/virtio-net.c |   14 +++++++-------
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/Makefile.objs b/Makefile.objs
index 7973ab2..cad6490 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -128,7 +128,7 @@ user-obj-y += cutils.o cache-utils.o

 hw-obj-y =
 hw-obj-y += loader.o
-hw-obj-y += virtio.o virtio-console.o virtio-pci.o virtio-serial-bus.o
+hw-obj-y += virtio.o virtio-console.o virtio-pci.o virtio-net.o
virtio-serial-bus.o
 hw-obj-y += fw_cfg.o pci.o pci_host.o pcie_host.o
 hw-obj-y += watchdog.o
 hw-obj-$(CONFIG_ISA_MMIO) += isa_mmio.o
diff --git a/Makefile.target b/Makefile.target
index 285c805..e43e138 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -165,7 +165,7 @@ obj-y = vl.o monitor.o machine.o gdbstub.o
 obj-y += qemu-timer.o
 # virtio has to be here due to weird dependency between PCI and virtio-net.
 # need to fix this properly
-obj-y += virtio-blk.o virtio-balloon.o virtio-net.o
+obj-y += virtio-blk.o virtio-balloon.o
 obj-y += rwhandler.o
 obj-$(CONFIG_KVM) += kvm.o kvm-all.o
 LIBS+=-lz
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index be33c68..5f04b6f 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -217,7 +217,7 @@ static int virtio_net_handle_rx_mode(VirtIONet *n,
uint8_t cmd,
         exit(1);
     }

-    on = ldub_p(elem->out_sg[1].iov_base);
+    on = *(uint8_t *)elem->out_sg[1].iov_base;

     if (cmd == VIRTIO_NET_CTRL_RX_MODE_PROMISC)
         n->promisc = on;
@@ -253,7 +253,7 @@ static int virtio_net_handle_mac(VirtIONet *n, uint8_t cmd,
     n->mac_table.multi_overflow = 0;
     memset(n->mac_table.macs, 0, MAC_TABLE_ENTRIES * ETH_ALEN);

-    mac_data.entries = ldl_le_p(elem->out_sg[1].iov_base);
+    mac_data.entries = le32_to_cpu(*(uint32_t *)elem->out_sg[1].iov_base);

     if (sizeof(mac_data.entries) +
         (mac_data.entries * ETH_ALEN) > elem->out_sg[1].iov_len)
@@ -269,7 +269,7 @@ static int virtio_net_handle_mac(VirtIONet *n, uint8_t cmd,

     n->mac_table.first_multi = n->mac_table.in_use;

-    mac_data.entries = ldl_le_p(elem->out_sg[2].iov_base);
+    mac_data.entries = le32_to_cpu(*(uint32_t *)elem->out_sg[2].iov_base);

     if (sizeof(mac_data.entries) +
         (mac_data.entries * ETH_ALEN) > elem->out_sg[2].iov_len)
@@ -299,7 +299,7 @@ static int virtio_net_handle_vlan_table(VirtIONet
*n, uint8_t cmd,
         return VIRTIO_NET_ERR;
     }

-    vid = lduw_le_p(elem->out_sg[1].iov_base);
+    vid = le32_to_cpu(*(uint32_t *)elem->out_sg[1].iov_base);

     if (vid >= MAX_VLAN)
         return VIRTIO_NET_ERR;
@@ -333,8 +333,8 @@ static void virtio_net_handle_ctrl(VirtIODevice
*vdev, VirtQueue *vq)
             exit(1);
         }

-        ctrl.class = ldub_p(elem.out_sg[0].iov_base);
-        ctrl.cmd = ldub_p(elem.out_sg[0].iov_base + sizeof(ctrl.class));
+        ctrl.class = *(uint8_t *)elem.out_sg[0].iov_base;
+        ctrl.cmd = *(uint8_t *)(elem.out_sg[0].iov_base + sizeof(ctrl.class));

         if (ctrl.class == VIRTIO_NET_CTRL_RX_MODE)
             status = virtio_net_handle_rx_mode(n, ctrl.cmd, &elem);
@@ -343,7 +343,7 @@ static void virtio_net_handle_ctrl(VirtIODevice
*vdev, VirtQueue *vq)
         else if (ctrl.class == VIRTIO_NET_CTRL_VLAN)
             status = virtio_net_handle_vlan_table(n, ctrl.cmd, &elem);

-        stb_p(elem.in_sg[elem.in_num - 1].iov_base, status);
+        *(uint8_t *)elem.in_sg[elem.in_num - 1].iov_base = status;

         virtqueue_push(vq, &elem, sizeof(status));
         virtio_notify(vdev, vq);
-- 
1.6.2.4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-03-26 19:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-26 19:04 [Qemu-devel] [PATCH 09/10] Compile virtio-net only once Blue Swirl

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.