summaryrefslogtreecommitdiff
path: root/sys/src/9/pc/ethervirtio.c
AgeCommit message (Collapse)Author
2021-07-11virtio: add non-legacy virtio 1.0 drivers for disk and ethernetcinap_lenrek
The new interface uses pci capability structures to locate the registers in a rather fine granular way making it more complicated as they can be located anywhere in any pci bar at any offset. As far as i can see, qemu (6.0.50) never uses i/o bars in non-legacy mode, so only mmio is implemented for now. The previous virtio drivers implemented the legacy interface only which uses i/o ports for all register accesses. This is still the preferred method (and also qemu default) as it is easier to emulate and most likely faster. However, some vps providers like vultr force the legacy interface to disabled with qemu -device option "disable-legacy=on" resulting on a system without a disk and ethernet.
2020-09-13kernel: massive pci code rewritecinap_lenrek
The new pci code is moved to port/pci.[hc] and shared by all ports. Each port has its own PCI controller implementation, providing the pcicfgrw*() functions for low level pci config space access. The locking for pcicfgrw*() is now done by the caller (only port/pci.c). Device drivers now need to include "../port/pci.h" in addition to "io.h". The new code now checks bridge windows and membars, while enumerating the bus, giving the pc driver a chance to re-assign them. This is needed because some UEFI implementations fail to assign the bars for some devices, so we need to do it outselfs. (See pcireservemem()). While working on this, it was discovered that the pci code assimed the smallest I/O bar size is 16 (pcibarsize()), which is wrong. I/O bars can be as small as 4 bytes. Bit 1 in an I/O bar is also reserved and should be masked off, making the port mask: port = bar & ~3;
2020-05-02ether82543gc, ether82557, ethervirtio: do kproc() call ouside of spinlockcinap_lenrek
2018-10-07pc drivers: more pci cleanupcinap_lenrek
2018-02-18devether: mux bridges, portable netconsolecinap_lenrek
2018-02-11kernel: move devether and wifi to port/cinap_lenrek
the only architecture dependence of devether was enabling interrupts, which is now done at the end of the driver's reset() function now. the wifi stack and dummy ethersink also go to port/. do the IRQ2->IRQ9 hack for pc kernels in intrenabale(), so not every caller of intrenable() has to be aware of it.
2017-06-12ethervirtio: report correct length; fail gracefully if we can't initialize ↵aiju
queues
2014-12-09ethervirtio: fix queue notifications and interrupt flags, avoid useless ↵cinap_lenrek
notifications bug: Rnointerrupt was used on Vqueue.used.flags instead of Vqueue.avail.flags. introduce vqnotify() function that notifies the device about available ring advancement. avoid queue notifications there that can be slow by checking Unonotify flag in Vqueue.used.flags. keep track of the number of notifications in the queue.
2014-12-08ethervirtio: feature negotiation, allow setting mac address, dont read isr ↵cinap_lenrek
from ifstatus, avoid indirection - properly negotiate Fctrlrx feature bit for promisc and multicast. - allow setting mac address with ea= option from plan9.ini - dont read the isr register from ifstats() as it has the side effect of reseting isr status - embedd the Vqueue array in the Ctlr structure avoiding indirection - add a interrupt counter Vqueue.nintr for statistical purposes - only read network status register if the feature has been negotiated - change name to "virtio" as "ethervirtio" is kind of redundant
2014-12-07ethervirtio: fix missing */cinap_lenrek
2014-12-07ethervirtio: implement promisc and multicast mode, cleanupcinap_lenrek
add vctlcmd() function to setup and comlete control commands. handle Vctlq and implement promiscuous and multicast mode commands. remove Vqueue.block[] and Vqueue.header. these are not properties of the queue (Vctlq as no block array). the block[] array only needs to be half the queue size as we use two descriptors per packet. fix broken shutdown() and remove useless ctl() function.
2014-12-07ethervirtio: avoid dumping packets in txproc when ring gets fullcinap_lenrek
2014-12-06pc, pc64: add and enable ethervirtio drivermischief
many thanks to cinap_lenrek, erik quanstrom and david du colombier for feedback and testing.