History | View | Annotate | Download (32.1 kB)
misc: move include files to include/qemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
net: reorganize headers
Move public headers to include/net, and leave private headers in net/.Put the virtio headers in include/net/tap.h, removing the multiple copiesthat existed. Leave include/net/tap.h as the interface for NICs, andnet/tap_int.h as the interface for OS-specific parts of the tap backend....
virtio-net: avoid sg copy
Avoid tweaking iovec during receive. This removesthe need to copy the vector.Note: we currently have an evil cast in work_around_broken_dhclientand unfortunately this patch does not fix it - justpushes the evil cast to another place....
virtio-net: use safe iov operations for rx
Avoid magling iov manually: use safe iov operationsfor processing packets incoming to guest.This also removes the requirement for virtio header tofit the first s/g entry exactly.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
virtio-net: refactor receive_hdr
Now that we know host hdr length, we don't need toduplicate the logic in receive_hdr: caller canfigure out the offset itself.
virtio-net: first s/g is always at start of buf
We know offset is 0, assert that.
virtio-net: switch tx to safe iov functions
Avoid mangling iovec manually: use safe iov_*functions.
virtio-net: simplify rx code
Remove code duplication using guest header length that we track.Drop specific layout requirement for rx buffers: things workusing generic iovec functions in any case.
virtio-net: minor code simplification
During packet filtering, we can now use host hdr lento offset incoming buffer unconditionally.
virtio-net: test peer header support at init time
There's no reason to query header support at randomtimes: at load or feature query.Driver also might not query functions.Cleaner to do it at device init.
virtio-net: enable mrg buf header in tap on linux
Modern linux supports arbitrary header size,which makes it possible to pass mrg buf headerto tap directly without iovec mangling.Use this capability when it is there.
This removes the need to deal with it in...
virtio-net: track host/guest header length
Tracking these in device state instead ofre-calculating on each packet. No functionalchanges.
virtio-net: use qemu_get_buffer() in a temp buffer
qemu_fseek() is known to be wrong. Would be removed on the nextcommit. This code should never been used (value has beenMAC_TABLE_ENTRIES since 2009).
Signed-off-by: Juan Quintela <quintela@redhat.com>...
virtio-net: update nc.link_down in virtio_net_load()
nc.link_down could not be migrated, this patch updates link_down invirtio_post_load() to keep it coincident with real link status.
Signed-off-by: Amos Kong <akong@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
virtio-net: fix used len for tx
There is no out sg for TX, so used buf length for txshould always be 0.
net: notify iothread after flushing queue
virtio-net has code to flush the queue and notify the iothreadwhenever new receive buffers are added by the guest. That isfine, and indeed we need to do the same in all other drivers.However, notifying the iothread should be work for the network...
net: Rename VLANClientState to NetClientState
The vlan feature is no longer part of net core. Rename VLANClientStateto NetClientState because net clients are not explicitly associated witha vlan at all, instead they have a peer net client to which they are...
net: Rename qemu_del_vlan_client() to qemu_del_net_client()
Another step in moving the vlan feature out of net core. Users onlydeal with NetClientState and therefore qemu_del_vlan_client() should benamed qemu_del_net_client().
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>...
hw, net: "net_client_type" -> "NetClientOptionsKind" (qapi-generated)
NET_CLIENT_TYPE_ -> NET_CLIENT_OPTIONS_KIND_
Signed-off-by: Laszlo Ersek <lersek@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
change iov_* function prototypes to be more appropriate
Reorder arguments to be more natural, readable andconsistent with other iov_* functions, and changeargument names, from: iov_from_buf(iov, iov_cnt, buf, iov_off, size)to iov_from_buf(iov, iov_cnt, offset, buf, bytes)...
virtio: check virtio_load return code
Otherwise we crash on error.
Signed-off-by: Ulrich Obergfell <uobergfe@redhat.com>Signed-off-by: Orit Wassermann <owasserm@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qdev: don't access name through info
We already have a QOM interface for this so let's use it.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qdev: move qdev->info to class
Right now, DeviceInfo acts as the class for qdev. In order to switch to aproper ObjectClass derivative, we need to ween all of the callers off ofinteracting directly with the info pointer.
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Merge remote-tracking branch 'mst/for_anthony' into staging
virtio-net: don't use vdev after virtio_cleanup
virtio_cleanup() will be changed by the following patch to remove theVirtIONet struct that gets allocated via virtio_common_init(). Ensurewe don't dereference the structure after calling the cleanup function....
iov: Update parameter usage in iov_(to|from)_buf()
iov_to_buf() has an 'offset' parameter, iov_from_buf() hasn't.This patch adds the missing parameter to iov_from_buf().It also renames the 'offset' parameter to 'iov_off' toemphasize it's the offset into the iovec and not the buffer....
change all other clock references to use nanosecond resolution accessors
This was done with:
sed -i 's/qemu_get_clock\>/qemu_get_clock_ns/' \ $(git grep -l 'qemu_get_clock\>' ) sed -i 's/qemu_new_timer\>/qemu_new_timer_ns/' \ $(git grep -l 'qemu_new_timer\>' )...
virtio-net: Fix lduw_p() pointer argument of wrong size
A pointer to a size_t variable was passed as the void * pointer tolduw_p() in virtio_net_receive(). Instead of acting on the 16-bit valuethis caused failure on big-endian hosts.
Avoid this issue in the future by using stw_p() instead. In general we...
vhost: disable on tap link down
qemu makes it possible to disable link at tap which is not communicatedto the guest but causes all packets to be dropped.
When vhost-net is enabled, vhost needs to be aware of both the virtiolink_down and the peer link_down. we switch to userspace emulation when...
vhost: force vhost off for non-MSI guests
When MSI is off, each interrupt needs to be bounced through the iothread when it's set/cleared, so vhost-net causes more context switches andhigher CPU utilization than userspace virtio which handles networking in...
virtio-net: fix cross-endianness support
virtio-net used to work on cross-endianness configurations, but doesn'tanymore with recent guest kernels, as the new features don't handleendianness correctly.
This patch fixes wrong conversion, and add missing ones to make...
virtio: move vmstate change tracking to core
Move tracking vmstate change from virtio-net to virtio.cas it is going to be used by virito-blk and virtio-pcifor the ioeventfd support.
Merge remote branch 'mst/for_anthony' into staging
Add bootindex parameter to net/block/fd device
If bootindex is specified on command line a string that describes devicein firmware readable way is added into sorted list. Later this list willbe passed into firmware to control boot order.
Signed-off-by: Gleb Natapov <gleb@redhat.com>...
virtio-net: don't dma while vm is stopped
DMA into memory while VM is stopped makes ithard to debug migration (consequitive savesresult in different files).Fixing this completely is a large effort,this patch does this for virtio-net.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>...
virtio-net: stop/start bh when appropriate
Avoid sending out packets, and modifyingmemory, when VM is stopped.Add assert statements to verify this does not happen.
Avoid scheduling bh when vhost-net is started.
Stop bh when driver disabled bus mastering...
virtio-net: Convert fprintf() to error_report()
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtio-net: unify vhost-net start/stop
Move all of vhost-net start/stop logic to a single routine,and call it from everywhere.
Additionally, start/stop vhost-net on link up/down:we should not transmit anything if user asked us toput the link down.
virtio-net: Introduce a new bottom half packet TX
Based on a patch from Mark McLoughlin, this patch introduces a newbottom half packet transmitter that avoids the latency imposed bythe tx_timer approach. Rather than scheduling a timer when a TXpacket comes in, schedule a bottom half to be run from the iothread....
virtio-net: Rename tx_timer_active to tx_waiting
De-couple this from the timer since we might want to usedifferent backends to send the packet.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
virtio-net: Limit number of packets sent per TX flush
If virtio_net_flush_tx() is called with notification disabled, we canrace with the guest, processing packets at the same rate as theyget produced. The trouble is that this means we have no guaranteed...
virtio-net: Make tx_timer timeout configurable
Add an option to make the TX mitigation timer adjustable as a deviceoption. The 150us hard coded default used currently is reasonable,but may not be suitable for all workloads, this gives us a way toadjust it using a single binary. We can't support any random option...
virtio-net: correct packet length math
We were requesting too much when checking bufferlength: size already includes host header length.
Further, we should not exit if we get a packet thatis too long, since this might not be under controlof the guest. Just drop the packet....
savevm: Add DeviceState param
When available, we'd like to be able to access the DeviceStatewhen registering a savevm. For buses with a get_dev_path()function, this will allow us to create more unique savevmid strings.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>...
virtio-net: Incorporate a DeviceState pointer and let savevm track instances
Stuff a pointer to the DeviceState into the VirtIONet structure so thatwe can easily remove the vmstate entry later. Also, let vmstate trackthe instance number (it should always be zero internally since the...
virtio-net: truncating packet
virtio net attempts to peek into virtio queue todetermine that we have enough space for the completepacket to fit. However, it fails to account for spaceconsumed by virtio net header when it does this,under stress this results in a failure...
virtio-net: stop vhost backend on vmstop
vhost net currently keeps running after vmstop,which causes trouble as qemy does not checkfor dirty pages anymore.The fix is to simply keep vm and vhost running/stoppedstatus in sync.
Tested-by: David L Stevens <dlstevens@us.ibm.com>...
virtio-net: return with value in void function
virtio-net has return with value in a void function.No idea why does it compile with gcc,but this isn't standard C.
iov: Introduce a new file for helpers around iovs, add iov_from_buf()
The virtio-net code uses iov_fill() which fills an iov from a linearbuffer. The virtio-serial-bus code does something similar in anopen-coded function.
Create a new iov.c file that has iov_from_buf()....
vhost: fix features ack
vhost driver in qemu didn't ack features, and this happensto work because we don't really require any features. However,it's better not to rely on this. This patch passes features tovhost as guest acks them.
Signed-off-by: David L Stevens <dlstevens@us.ibm.com>...
virtio-net: vhost net support
This connects virtio-net to vhost net backend.The code is structured in a way analogous to what we have with vnetheader capability in tap.
We start/stop backend on driver start/stop aswell as on save and vm start (for migration)....
error: Replace qemu_error() by error_report()
error_report() terminates the message with a newline. Strip it itfrom its arguments.
This fixes a few error messages lacking a newline:net_handle_fd_param()'s "No file descriptor named %s found", andtap_open()'s "vnet_hdr=1 requested, but no kernel support for...
error: Move qemu_error & friends into their own header
virtio-net: fix network stall under load
Fix a race condition where qemu finds that there are not enough virtioring buffers available and the guest make more buffers available beforeqemu can enable notifications.
Signed-off-by: Tom Lendacky <toml@us.ibm.com>...
virtio: net: remove dead assignment
clang-analyzer points out value assigned to 'len' is not used.
Signed-off-by: Amit Shah <amit.shah@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtio-net: mac property is mandatory
Mac feature bit isn't going to work as all network cards already have a'mac' property to set the mac address. Remove it from mask and add inget_features.
Reported-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>...
virtio: rename features -> guest_features
Rename features->guest_features. This iswhat they are, avoid confusion withhost features which we also need to keep around.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtio: add features as qdev properties
Add feature bits as properties to virtio. This makes it possible to e.g. definemachine without indirect buffer support, which is required for 0.10compatibility, or without hardware checksum support, which is required for 0.11...
net: remove VLANClientState members now in NetClientInfo
Add a NetClientInfo pointer to VLANClientState and use thatfor the typecode and function pointers.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: convert virtio to NICState
whitelist host virtio networking features
This patch is a followup to 8eca6b1bc770982595db2f7207c65051572436cb,fixing crashes when guests with 2.6.25 virtio drivers have saturatedvirtio network connections.
https://bugs.edge.launchpad.net/ubuntu/+source/qemu-kvm/+bug/458521...
virtio-net: split the has_buffers() logic from can_receive()
We should only return zero from receive() for a condition which we'llget notification of when it changes. Currently, we're returning zeroif the guest driver is not ready, but we won't ever flush our queue...
virtio-net: fix macaddr config regression
This commit:
commit 97b15621 virtio: use qdev properties for configuration.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
makes a guest using virtio-net see an empty macaddr because we never...
net: move more stuff into net/tap-win32.c, add net/tap.h
net: move net-checksum.c under net/
Also add a new net/checksum.h header
virtio-net: add tap_has_ufo flag to saved state
If we tell the guest we support UFO and then migrate to host whichdoesn't support it, we will find ourselves in grave difficulties.
Prevent this scenario by adding a flag to virtio-net's savevm formatwhich indicates whether the device requires host UFO support....
Work around dhclient brokenness
With the latest GSO/csum offload patches, any guest using an unpatched versionof dhclient (any Ubuntu guest, for instance), will no longer be able to geta DHCP address.
dhclient is actually at fault here. It uses AF_PACKET to receive DHCP responses...
Enable UFO on virtio-net and tap devices
Enable UFO on the host tap device if supported and allow setting UFOon virtio-net in the guest.
Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtio-net: enable tap offload if guest supports it
We query the guest's feature set to see if it supports offload and,if so, we enable those features on the tap interface.
virtio-net: add vnet_hdr support
With '-netdev tap,id=foo -nic model=virtio,netdev=foo' virtio-net candetect that its peer (i.e. the tap backend) supports vnet headersand advertise to the guest that it can send packets with partialchecksums and/or TSO packets....
virtio: use qdev properties for configuration.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
notify io_thread at the end of rx handling
This is a backport from qemu-kvm. Just instead of using kvm's specificnotification mechanism, we use qemu_notify_event()
Signed-off-by: Glauber Costa <glommer@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu/net: request 3 vectors in virtio-net
Request up to 3 vectors in virtio-net. Actual bindings might supplyless.
qemu/net: flag to control the number of vectors a nic has
Add an option to specify the number of MSI-X vectors for PCI NIC cards. Thiscan also be used to disable MSI-X, for compatibility with old qemu. Thisoption currently only affects virtio cards.
virtio-net: implement async packet sending
virtio-net: enable mergeable receive buffers
When virtio-net was merged in from qemu-kvm.git, the VNET_HDR relatedfeatures were dropped from the code.
However, VIRTIO_NET_F_MRG_RXBUF appears to have accidentally beendropped too. Re-instate that now.
Reported-by: Michael S. Tsirkin <mst@redhat.com>...
virtio-net: implement rx packet queueing
If we don't have room to receive a packet, we return zerofrom virtio_net_receive() and call qemu_flush_queued_packets()as soon as space becomes available.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
virtio-net: Add version_id 7 placeholder for vnet header support
Signed-off-by: Alex Williamson <alex.williamson@hp.com>Signed-off-by: Mark McLoughlin <markmc@redhat.com>
virtio-net: Use a byte to store RX mode flags
There's no need to save 4 bytes for promisc and allmulti.Use one byte each just to avoid the overhead of a bitmap.
virtio-net: reorganize receive_filter()
Reorganize receive_filter to better handle the split betweenunicast and multicast filtering. This allows us to skip thebroadcast check on unicast packets and leads to more opportunitiesfor optimization.
Signed-off-by: Alex Williamson <alex.williamson@hp.com>...
virtio-net: Fix MAC filter overflow handling
Overloading the promisc and allmulti flags for indicating filtertable overflow makes it difficult to track the actual requestedoperating mode. Split these out into separate flags.
virtio-net: MAC filter optimization
The MAC filter table is received from the guest as two separatebuffers, one with unicast entries, the other with multicastentries. If we track the index dividing the two sets, we canavoid searching the part of the table with the wrong type of...
virtio-net: Add new RX filter controls
Add a few new RX modes to better control the receive_filter. Theseare all fairly obvious features that hardware could provide.
virtio-net: Increase filter and control limits
Increase the size of the perfect filter table and control queue depth.This should give us more headroom in the MAC filter and is known to beneeded by at least one guest user. Increasing the control queue depth...
net: add fd_readv() handler to qemu_new_vlan_client() args
This, apparently, is the style we prefer - all VLANClientStateshould be an argument to qemu_new_vlan_client().
net: re-name vc->fd_read() to vc->receive()
VLANClientState's fd_read() handler doesn't read from filedescriptors, it adds a buffer to the client's receive queue.
Re-name the handlers to make things a little less confusing.
net: pass VLANClientState* as first arg to receive handlers
Give static type checking a chance to catch errors.
net: add return value to packet receive handler
This allows us to handle queue full conditions rather than droppingthe packet on the floor.
Separate virtio PCI code
Split the PCI host bindings from the VRing transport implementation.
Signed-off-by: Paul Brook <paul@codesourcery.com>
Virtio-net qdev conversion
Introduce VLANClientState::cleanup() (Mark McLoughlin)
We're currently leaking memory and file descriptors on devicehot-unplug.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7150 c046a42c-6fe2-441c-8c8c-71466251a162
Remove stray GSO code from virtio_net (Mark McLoughlin)
Obviously merged from kvm-userspace accidentally.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7142 c046a42c-6fe2-441c-8c8c-71466251a162
Fix OpenSolaris gcc4 warnings: iovec type mismatches, missing 'static'
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7103 c046a42c-6fe2-441c-8c8c-71466251a162
Fix oops on 2.6.25 guest (Rusty Russell)
I believe this is behind the following:https://bugs.edge.launchpad.net/ubuntu/jaunty/+source/linux/+bug/331128
virtio_pci in 2.6.25 didn't do feature negotiation correctly: it acked everybit. Fortunately, we can detect this....
qemu:virtio-net: Check return size on the correct sg list (Alex Williamson)
When checking that the size of the control virtqueue return fieldis sufficient, use the correct sg list.
Signed-off-by: Alex Williamson <alex.williamson@hp.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>...
virtio: Remove malloc failure checks (Jan Kiszka)
No need to check for failing qemu_malloc anymore.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6626 c046a42c-6fe2-441c-8c8c-71466251a162
qemu: return PCIDevice on net device init and record devfn (Marcelo Tosatti)
Change the PCI network drivers init functions to return the PCIDev, toinform which slot has been hot-plugged.
Also record PCIDevice structure on NICInfo to locate for release on...
qemu:virtio-net: Add VLAN filtering (Alex Williamson)
Use the control virtqueue to allow the guest to enable and manipulatea VLAN filter table. This allows us to drop more packets the guestdoesn't want to see. We define a new VLAN class for the control...
qemu:virtio-net: Add additional MACs via a filter table (Alex Williamson)
Create a filter table and allow the guest to populate it with theMAC class control commands. We manage the size and usage of thefilter table including enabling promiscuous and all-multi modes...