[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
- [Qemu-devel] [PATCH v3 0/7] virtio-net refactoring., fred . konrad, 2013/04/11
- [Qemu-devel] [PATCH v3 1/7] virtio: add two functions to VirtioDeviceClass., fred . konrad, 2013/04/11
- [Qemu-devel] [PATCH v3 2/7] virtio-net: add the virtio-net device., fred . konrad, 2013/04/11
- [Qemu-devel] [PATCH v3 3/7] virtio-net-pci: switch to the new API., fred . konrad, 2013/04/11
- [Qemu-devel] [PATCH v3 5/7] virtio-net-ccw: switch to the new API., fred . konrad, 2013/04/11
- [Qemu-devel] [PATCH v3 6/7] virtio-net: cleanup: use QOM cast., fred . konrad, 2013/04/11
[Qemu-devel] [PATCH v3 4/7] virtio-net-s390: switch to the new API., fred . konrad, 2013/04/11
[Qemu-devel] [PATCH v3 7/7] virtio-net: cleanup: init and exit function., fred . konrad, 2013/04/11
Re: [Qemu-devel] [PATCH v3 0/7] virtio-net refactoring., Cornelia Huck, 2013/04/15
Re: [Qemu-devel] [PATCH v3 0/7] virtio-net refactoring., Anthony Liguori, 2013/04/22