Commit Graph

7 Commits

Author SHA1 Message Date
Alexey Kardashevskiy 300384f3dc virtio: Store queue descriptors in virtio_device
At the moment desc/avail/used pointers are read from the device every
time we need them. This works for now unless iommu_platform=on is used,
desc/avail/used stored in the config space are bus addresses while
SLOF should keep using the guest physical addresses.

virtio-net stores queue descriptors already, virtio-serial does it in
global statics, move them into virtio_device.

The next patch will use this to allow IOMMU.

While at this, move repeating avail->flags/idx setup into
virtio_queue_init_vq() except virtio-serial which vq_rx->avail->idx is
setup differently.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
Changes:
v4:
* removed vqs::id as it is not really used
* replaced vq_size with vq->size in virtio-serial.c
2019-12-05 14:41:07 +11:00
Nikunj A Dadhania 685af54d8a virtio-net: rework the driver to support multiple open
Found that virtio-net is using a around 200K receive buffer per device, if we
connect more than 40 virtio-net devices the heap(8MB) gets over. Because of
which allocation starts failing and the VM does not boot.

Moreover, the driver did not support opening multiple device, which is possible
using the OF client interface. As it was using globals to store the state
information of the driver.

Now the driver allocates a virtio_net structure during device open stage and
fills in the state information. This details are used during various device
functions and finally for cleaning up on close operation.

Now as the buffer memory is allocated during open and freed during the close
operations the heap usage is contained.

Reported-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-08-07 18:24:58 +10:00
Nikunj A Dadhania 6e4d62c2eb virtio-net: enable virtio 1.0
Also add a device file for non-transitional pci device id: 0x1041

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-02-08 16:40:39 +11:00
Nikunj A Dadhania aa9566d2ed virtio-net: move setup-mac to the open routine
MAC reading should be done after the initialization of the device after
the features negotiation.

Adjust the open routine accordingly. There is no point in sending the
mac address to the virtionet_open. Change the signature. Also read the
mac address directly from the config space to remove the dependency of
getting the mac address from the open routine.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-02-08 16:40:39 +11:00
Nikunj A Dadhania bcdf942b91 virtio: introduce helper for initializing virt queue
The routine takes care to allocate and set the queue address in the
device. Add these calls in virtio-net, virtio-blk and virtio-9p.

With the lack of this routine, devices like virtio-blk and virtio-9p did
not do a device reset in the driver initialization code. This helper
will fix that problem

Change the signature of virtio_set_qaddr, accepting queue address as
unsigned long argument.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-02-08 16:40:38 +11:00
Avik Sil 7ae768b04e Increase virtio-net receive queue size
Since SLOF is poll based, in a high network traffic zone desired packet might be missed
during receiving. Hence increase the receive queue size.

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
2013-11-17 16:22:02 +05:30
Avik Sil 46a32aa9c7 Add virtio-net driver in libvirtio
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 12:00:13 +05:30