1. 02 May, 2008 11 commits
    • Rusty Russell's avatar
      virtio: explicit advertisement of driver features · c45a6816
      Rusty Russell authored
      A recent proposed feature addition to the virtio block driver revealed
      some flaws in the API: in particular, we assume that feature
      negotiation is complete once a driver's probe function returns.
      
      There is nothing in the API to require this, however, and even I
      didn't notice when it was violated.
      
      So instead, we require the driver to specify what features it supports
      in a table, we can then move the feature negotiation into the virtio
      core.  The intersection of device and driver features are presented in
      a new 'features' bitmap in the struct virtio_device.
      
      Note that this highlights the difference between Linux unsigned-long
      bitmaps where each unsigned long is in native endian, and a
      straight-forward little-endian array of bytes.
      
      Drivers can still remove feature bits in their probe routine if they
      really have to.
      
      API changes:
      - dev->config->feature() no longer gets and acks a feature.
      - drivers should advertise their features in the 'feature_table' field
      - use virtio_has_feature() for extra sanity when checking feature bits
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      c45a6816
    • Rusty Russell's avatar
      virtio: change config to guest endian. · 72e61eb4
      Rusty Russell authored
      A recent proposed feature addition to the virtio block driver revealed
      some flaws in the API, in particular how easy it is to break big
      endian machines.
      
      The virtio config space was originally chosen to be little-endian,
      because we thought the config might be part of the PCI config space
      for virtio_pci.  It's actually a separate mmio region, so that
      argument holds little water; as only x86 is currently using the virtio
      mechanism, we can change this (but must do so now, before the
      impending s390 merge).
      
      API changes:
      - __virtio_config_val() just becomes a striaght vdev->config_get() call.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      72e61eb4
    • Rusty Russell's avatar
      virtio: finer-grained features for virtio_net · 5539ae96
      Rusty Russell authored
      So, we previously had a 'VIRTIO_NET_F_GSO' bit which meant that 'the
      host can handle csum offload, and any TSO (v4&v6 incl ECN) or UFO
      packets you might want to send.  I thought this was good enough for
      Linux, but it actually isn't, since we don't do UFO in software.
      
      So, add separate feature bits for what the host can handle.  Add
      equivalent ones for the guest to say what it can handle, because LRO
      is coming too (thanks Herbert!).
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      5539ae96
    • Rusty Russell's avatar
      virtio: wean net driver off NETDEV_TX_BUSY · 99ffc696
      Rusty Russell authored
      Herbert tells me that returning NETDEV_TX_BUSY from hard_start_xmit is
      seen as a poor thing to do; we should cache the packet and stop the queue.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Acked-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      99ffc696
    • Marcelo Tosatti's avatar
      virtio-blk: fix remove oops · 2e895e4c
      Marcelo Tosatti authored
      Do not unregister the major at device remove, since there might be
      another device instances around.
      
      (qemu) pci_del 0 11
      (qemu) ACPI: PCI interrupt for device 0000:00:0b.0 disabled
      (qemu) pci_del 0 10
      (qemu) ------------[ cut here ]------------
      WARNING: at block/genhd.c:126 unregister_blkdev+0x74/0x9e()
      ACPI: PCI interrupt for device 0000:00:0a.0 disabled
      Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      2e895e4c
    • Rusty Russell's avatar
      virtio: fix scatterlist sizing in net driver. · 05271685
      Rusty Russell authored
      Herbert Xu points out (within another patch) that my scatterlists are
      too short: one entry for the gso header, one for the skb->data, and
      MAX_SKB_FRAGS for all the fragments.
      
      Fix both xmit and recv sides (recv currently unused, coming in later
      patch).
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      05271685
    • Rusty Russell's avatar
      virtio: de-structify virtio_block status byte · cb38fa23
      Rusty Russell authored
      Ron Minnich points out that a struct containing a char is not always
      sizeof(char); simplest to remove the structure to avoid confusion.
      
      Cc: "ron minnich" <rminnich@gmail.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      cb38fa23
    • Christian Borntraeger's avatar
      virtio: export more headers to userspace · 81473132
      Christian Borntraeger authored
      Rusty,
      
      is there a reason why we dont export the virtio headers for
      9p, balloon, console, pci, and virtio_ring? kvm uses make sync,
      but I think it is still useful to heave these headers exported
      as they might be useful for other userspace tools.
      
      I dont export virtio.h, because it does not seem to have useful
      information for userspace and it requires scatterlist.h which is
      also not exported. See also my other mail about your "virtio:
      change config to guest endian." patch.
      Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      81473132
    • Harvey Harrison's avatar
      virtio: fix sparse return void-valued expression warnings · 597d56e4
      Harvey Harrison authored
      drivers/virtio/virtio_pci.c:148:2: warning: returning void-valued expression
      drivers/virtio/virtio_pci.c:155:2: warning: returning void-valued expression
      Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      597d56e4
    • Rusty Russell's avatar
      virtio: fix tx_ stats in virtio_net · 655aa31f
      Rusty Russell authored
      get_buf() gives the length written by the other side, which will be
      zero.  We want to add the skb length.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      655aa31f
    • Rusty Russell's avatar
      virtio: ignore corrupted virtqueues rather than spinning. · 5ef82752
      Rusty Russell authored
      A corrupt virtqueue (caused by the other end screwing up) can have
      strange results such as a driver spinning: just bail when we try to
      get a buffer from a known-broken queue.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      5ef82752
  2. 01 May, 2008 29 commits