From patchwork Fri Mar 26 19:04:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 48719 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C459BB7CE7 for ; Sat, 27 Mar 2010 07:20:18 +1100 (EST) Received: from localhost ([127.0.0.1]:57476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NvFwh-0006nA-Hq for incoming@patchwork.ozlabs.org; Fri, 26 Mar 2010 16:15:55 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NvEpq-0002rS-KD for qemu-devel@nongnu.org; Fri, 26 Mar 2010 15:04:46 -0400 Received: from [140.186.70.92] (port=33007 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NvEpl-0002nr-K7 for qemu-devel@nongnu.org; Fri, 26 Mar 2010 15:04:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NvEpi-0007cV-S7 for qemu-devel@nongnu.org; Fri, 26 Mar 2010 15:04:40 -0400 Received: from mail-pw0-f45.google.com ([209.85.160.45]:47657) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NvEpi-0007Za-Lz for qemu-devel@nongnu.org; Fri, 26 Mar 2010 15:04:38 -0400 Received: by mail-pw0-f45.google.com with SMTP id 9so6228560pwi.4 for ; Fri, 26 Mar 2010 12:04:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:received:message-id :subject:from:to:content-type; bh=bV+PK/LE+4tQ9OG+x1HM+lIAP4pbPht+CufJxyUdXeg=; b=XRwCNwcdA5FOiwsYjJXY5OPCSFXpo9WLcIV/85ZhmdM/P+LdXeUXhCwviHmPRMaeOW iM+TX20WMpCJyiXRaePSHdvFHqNpNW2XRvTsFqnlNuavCmdYlmx2kR8uSIHCBtcXUreI gYbRXD1rgzc6DCIW0zqYoDdBtBqGndyUaj1kQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=WdSungF2CbYYwaq0mq8W3Ib8nEq4wbjllGF9SQigWbSjde6FBDKZV9BiZigvVX9tMR cfJkfGZp1bcySH8wvSQgHN3saR1DxAXpqNEZdDGIwqPy4+RkM6Q3YSSvylpmoZHb+KZQ GyU6Q+m3yaPPw5WkRS1sERkBl+u4+gb8BTevE= MIME-Version: 1.0 Received: by 10.141.51.13 with HTTP; Fri, 26 Mar 2010 12:04:38 -0700 (PDT) Date: Fri, 26 Mar 2010 21:04:38 +0200 Received: by 10.141.4.4 with SMTP id g4mr1341319rvi.275.1269630278282; Fri, 26 Mar 2010 12:04:38 -0700 (PDT) Message-ID: From: Blue Swirl To: qemu-devel X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH 09/10] Compile virtio-net only once X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Replace access macros with direct accesses. Signed-off-by: Blue Swirl --- Makefile.objs | 2 +- Makefile.target | 2 +- hw/virtio-net.c | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) 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); 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)