aboutsummaryrefslogtreecommitdiffstats
path: root/hw/virtio-net.c
AgeCommit message (Collapse)AuthorFilesLines
2009-05-18Separate virtio PCI codePaul Brook1-16/+7
Split the PCI host bindings from the VRing transport implementation. Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-05-14Virtio-net qdev conversionPaul Brook1-9/+12
Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-04-17Introduce VLANClientState::cleanup() (Mark McLoughlin)aliguori1-1/+18
We're currently leaking memory and file descriptors on device hot-unplug. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7150 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-17Remove stray GSO code from virtio_net (Mark McLoughlin)aliguori1-5/+0
Obviously merged from kvm-userspace accidentally. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7142 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-13Fix OpenSolaris gcc4 warnings: iovec type mismatches, missing 'static'blueswir11-1/+1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7103 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-05Fix oops on 2.6.25 guest (Rusty Russell)aliguori1-0/+16
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 every bit. Fortunately, we can detect this. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6975 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-13qemu:virtio-net: Check return size on the correct sg list (Alex Williamson)aliguori1-1/+1
When checking that the size of the control virtqueue return field is sufficient, use the correct sg list. Signed-off-by: Alex Williamson <alex.williamson@hp.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6845 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-16virtio: Remove malloc failure checks (Jan Kiszka)aliguori1-4/+0
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
2009-02-11qemu: return PCIDevice on net device init and record devfn (Marcelo Tosatti)aliguori1-4/+5
Change the PCI network drivers init functions to return the PCIDev, to inform which slot has been hot-plugged. Also record PCIDevice structure on NICInfo to locate for release on hot-removal. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6593 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-05qemu:virtio-net: Add VLAN filtering (Alex Williamson)aliguori1-3/+49
Use the control virtqueue to allow the guest to enable and manipulate a VLAN filter table. This allows us to drop more packets the guest doesn't want to see. We define a new VLAN class for the control virtqueue with commands ADD and DEL with usage defined in virtio-net.h. Signed-off-by: Alex Williamson <alex.williamson@hp.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6540 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-05qemu:virtio-net: Add additional MACs via a filter table (Alex Williamson)aliguori1-2/+87
Create a filter table and allow the guest to populate it with the MAC class control commands. We manage the size and usage of the filter table including enabling promiscuous and all-multi modes as necessary. The guest should therefore assume the table is infinite. Eventually this might allow us to bind directly to a hardware NIC and manipulate a physical MAC filter. The specifics of the TABLE_SET command are documented in virtio-net.h. Separate buffers in the same command are used for unicaste and multicast addresses for priority and sychronization. With this we can export the VIRTIO_NET_F_CTRL_RX feature bit. Signed-off-by: Alex Williamson <alex.williamson@hp.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6539 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-05qemu:virtio-net: Enable filtering based on MAC, promisc, broadcast and ↵aliguori1-0/+28
allmulti (Alex Williamson) Make use of the new RX_MODE control virtqueue class by dropping packets the guest doesn't want to see. Signed-off-by: Alex Williamson <alex.williamson@hp.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6538 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-05qemu:virtio-net: Add promiscuous and all-multicast mode bits (Alex Williamson)aliguori1-1/+47
Add a new RX_MODE control virtqueue class with commands PROMISC and ALLMULTI and usage documented in virtio-net.h allowing the guest to manipulate packet receiving options. We don't export a feature for this until we also add the MAC filter table. Note, for compatibility with older guest drivers we need to default to promiscuous. Signed-off-by: Alex Williamson <alex.williamson@hp.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6537 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-05qemu:virtio-net: Add a virtqueue for control commands from the guest (Alex ↵aliguori1-1/+33
Williamson) This will be used for RX mode, MAC table, VLAN table control, etc... The control transaction consists of one or more "out" sg entries and one or more "in" sg entries. The first out entry contains a header defining the class and command. Additional out entries may provide data for the command. A response via the ack entry is required and the guest will typically be waiting for it. Signed-off-by: Alex Williamson <alex.williamson@hp.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6536 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-05qemu:virtio-net: Define ETH_ALEN for use when manipulating MAC addresses ↵aliguori1-7/+7
(Alex Williamson) Makes it much easier to search too. Signed-off-by: Alex Williamson <alex.williamson@hp.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6535 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-05qemu:virtio-net: Allow setting the MAC address via set_config (Alex Williamson)aliguori1-2/+16
Allow the guest to write to the MAC address config space and update the network info string when it does. Rename get_config for symmetry. Signed-off-by: Alex Williamson <alex.williamson@hp.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6534 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-05qemu:virtio-net: Save status and add some save infrastructure (Alex Williamson)aliguori1-2/+8
The status register should probably be saved since its guest visible. Also add a little bit if infrastructure for handling various save revisions. Signed-off-by: Alex Williamson <alex.williamson@hp.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6533 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-01Add and use #defines for PCI device classesblueswir11-1/+1
This patch adds and uses #defines for PCI device classes and subclases, using a new pci_config_set_class() function, similar to the recently added pci_config_set_vendor_id() and pci_config_set_device_id(). Change since v1: fixed compilation of hw/sun4u.c Signed-off-by: Stuart Brady <stuart.brady@gmail.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6491 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-26Use the default subsystem vendor ID for virtio devices (Mark McLoughlin)aliguori1-1/+2
A subsystem vendor ID of zero isn't allowed, so we use our default ID. Gerd points out that although the PCI subsystem vendor ID is treated by the guest as the virtio vendor ID: /* we use the subsystem vendor/device id as the virtio vendor/device * id. this allows us to use the same PCI vendor/device id for all * virtio devices and to identify the particular virtio driver by * the subsytem ids */ vp_dev->vdev.id.vendor = pci_dev->subsystem_vendor; vp_dev->vdev.id.device = pci_dev->subsystem_device; it looks like only the device ID is used right now: # grep virtio modules.alias alias virtio:d00000001v* virtio_net alias virtio:d00000002v* virtio_blk alias virtio:d00000003v* virtio_console alias virtio:d00000004v* virtio-rng alias virtio:d00000005v* virtio_balloon alias pci:v00001AF4d*sv*sd*bc*sc*i* virtio_pci alias virtio:d00000009v* 9pnet_virtio so setting the subsystem vendor id to something != zero shouldn't cause trouble. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6440 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-26Use macros for virtio-net PCI vendor/device IDs (Mark McLoughlin)aliguori1-1/+3
Gerd added these macros a while back. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6438 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-13Make virtio_net_init() return void (Mark McLoughlin)aliguori1-4/+2
All PCI NIC init functions return void and nothing uses the return value from virtio_net_init(). Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6291 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-08Implement virtio_net link status (Mark McLoughlin)aliguori1-2/+21
Implement the VIRTIO_NET_F_STATUS feature by exposing the link status through virtio_net_config::status. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6250 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-07virtio-net migration fix (Mark McLoughlin)aliguori1-2/+4
We are failing to save whether the guest will supply us rx buffers using the new mergeable format; this can cause a migrated guest to crash with: virtio-net header not in first element Bump the savevm version number and refuse to load v1 saves just to be on the safe side. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6221 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-07Add a -net name=foo parameter (Mark McLoughlin)aliguori1-1/+1
Allow the user to supply a vlan client name on the command line. This is probably only useful for management tools so that they can use their own names rather than parsing the output of 'info network'. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6220 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-07add missing MAC address to info_str for some NICs (Mark McLoughlin)aliguori1-0/+2
Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6219 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-07Add a model string to VLANClientState (Mark McLoughlin)aliguori1-2/+2
Don't lose track of what type/model a vlan client is so that we can e.g. assign a global per-model id to clients. The entire patch is basically a tedious excercise in making sure the type/model string gets propagated down to qemu_new_vlan_client(). Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6216 c046a42c-6fe2-441c-8c8c-71466251a162
2008-12-17Use saner types for virtio-netaliguori1-2/+2
This was spotted by malc Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6075 c046a42c-6fe2-441c-8c8c-71466251a162
2008-12-17virtio-net supportaliguori1-0/+329
This adds virtio-net support. This is based on the virtio-net driver that exists in kvm-userspace. This also adds a new qemu_sendv_packet which virtio-net requires. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6073 c046a42c-6fe2-441c-8c8c-71466251a162