qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 6/7] virtio-net: cleanup: use QOM cast.


From: Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH v3 6/7] virtio-net: cleanup: use QOM cast.
Date: Thu, 18 Apr 2013 14:01:21 +0300

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 via email to

[Prev in Thread] Current Thread [Next in Thread]