From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1USnl6-0006T4-2c for qemu-devel@nongnu.org; Thu, 18 Apr 2013 08:16:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1USnky-0007Za-Gu for qemu-devel@nongnu.org; Thu, 18 Apr 2013 08:16:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30256) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1USnXA-0002uL-28 for qemu-devel@nongnu.org; Thu, 18 Apr 2013 08:01:48 -0400 Date: Thu, 18 Apr 2013 14:01:21 +0300 From: "Michael S. Tsirkin" Message-ID: <20130418110121.GA19130@redhat.com> References: <1365690602-22729-1-git-send-email-fred.konrad@greensocs.com> <1365690602-22729-7-git-send-email-fred.konrad@greensocs.com> <20130418084126.GA16686@redhat.com> <516FDA39.7010905@greensocs.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <516FDA39.7010905@greensocs.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 6/7] virtio-net: cleanup: use QOM cast. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: KONRAD =?iso-8859-1?Q?Fr=E9d=E9ric?= Cc: cornelia.huck@de.ibm.com, peter.maydell@linaro.org, aliguori@us.ibm.com, mark.burton@greensocs.com, qemu-devel@nongnu.org On Thu, Apr 18, 2013 at 01:34:17PM +0200, KONRAD Fr=E9d=E9ric wrote: > >>@@ -618,9 +614,10 @@ static void virtio_net_handle_rx(VirtIODevice *v= dev, VirtQueue *vq) > >> static int virtio_net_can_receive(NetClientState *nc) > >> { > >> VirtIONet *n =3D qemu_get_nic_opaque(nc); > >>+ VirtIODevice *vdev =3D VIRTIO_DEVICE(n); > >> VirtIONetQueue *q =3D virtio_net_get_subqueue(nc); > >>- if (!n->vdev.vm_running) { > >>+ if (!vdev->vm_running) { > >> return 0; > >> } > >BTW this is data path so was supposed to use the faster non-QOM casts. > >Also in other places below. This was applied meanwhile, but maybe we > >could revert the relevant chunks? Or maybe everyone who cares about > >speed uses vhost-net anyway so we don't care ... > > > >I point datapath below in case it's useful. >=20 > Which faster non-QOM casts? >=20 > In virtio-pci there is this one: >=20 > static inline VirtIOPCIProxy *to_virtio_pci_proxy_fast(DeviceState *d) > { > return container_of(d, VirtIOPCIProxy, pci_dev.qdev); > } >=20 > Is that what you want? Exactly, add a similar thing to cast NetClientState to VirtIONet and/or VirtIODevice with container_of. --=20 MST