All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: "KONRAD Frédéric" <fred.konrad@greensocs.com>
Cc: cornelia.huck@de.ibm.com, peter.maydell@linaro.org,
	aliguori@us.ibm.com, mark.burton@greensocs.com,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 6/7] virtio-net: cleanup: use QOM cast.
Date: Thu, 18 Apr 2013 14:01:21 +0300	[thread overview]
Message-ID: <20130418110121.GA19130@redhat.com> (raw)
In-Reply-To: <516FDA39.7010905@greensocs.com>

On Thu, Apr 18, 2013 at 01:34:17PM +0200, KONRAD Frédéric wrote:
> >>@@ -618,9 +614,10 @@ static void virtio_net_handle_rx(VirtIODevice *vdev, VirtQueue *vq)
> >>  static int virtio_net_can_receive(NetClientState *nc)
> >>  {
> >>      VirtIONet *n = qemu_get_nic_opaque(nc);
> >>+    VirtIODevice *vdev = VIRTIO_DEVICE(n);
> >>      VirtIONetQueue *q = 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.
> 
> Which faster non-QOM casts?
> 
> In virtio-pci there is this one:
> 
> static inline VirtIOPCIProxy *to_virtio_pci_proxy_fast(DeviceState *d)
> {
>     return container_of(d, VirtIOPCIProxy, pci_dev.qdev);
> }
> 
> Is that what you want?

Exactly, add a similar thing to cast NetClientState to VirtIONet and/or
VirtIODevice with container_of.

-- 
MST

  reply	other threads:[~2013-04-18 12:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-11 14:29 [Qemu-devel] [PATCH v3 0/7] virtio-net refactoring fred.konrad
2013-04-11 14:29 ` [Qemu-devel] [PATCH v3 1/7] virtio: add two functions to VirtioDeviceClass fred.konrad
2013-04-11 14:29 ` [Qemu-devel] [PATCH v3 2/7] virtio-net: add the virtio-net device fred.konrad
2013-04-11 14:29 ` [Qemu-devel] [PATCH v3 3/7] virtio-net-pci: switch to the new API fred.konrad
2013-04-11 14:29 ` [Qemu-devel] [PATCH v3 4/7] virtio-net-s390: " fred.konrad
2013-04-11 14:30 ` [Qemu-devel] [PATCH v3 5/7] virtio-net-ccw: " fred.konrad
2013-04-11 14:30 ` [Qemu-devel] [PATCH v3 6/7] virtio-net: cleanup: use QOM cast fred.konrad
2013-04-18  8:41   ` Michael S. Tsirkin
2013-04-18 11:34     ` KONRAD Frédéric
2013-04-18 11:01       ` Michael S. Tsirkin [this message]
2013-04-18 12:52       ` Anthony Liguori
2013-04-18 12:50     ` Anthony Liguori
2013-04-18 13:28       ` Paolo Bonzini
2013-04-11 14:30 ` [Qemu-devel] [PATCH v3 7/7] virtio-net: cleanup: init and exit function fred.konrad
2013-04-15  9:02 ` [Qemu-devel] [PATCH v3 0/7] virtio-net refactoring Cornelia Huck
2013-04-22 18:37 ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130418110121.GA19130@redhat.com \
    --to=mst@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=fred.konrad@greensocs.com \
    --cc=mark.burton@greensocs.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.