349693 |
03-Jul-2019 |
vangyzen |
MFC r349285
VirtIO SCSI: validate seg_max on attach
Until head r349278 (stable/12 r349690), bhyve presented a seg_max to the guest that was too large. Detect this case and clamp it to the virtqueue size. Otherwise, we would fail the "too many segments to enqueue" assertion in virtqueue_enqueue().
I hit this by running a guest with a MAXPHYS of 256 KB.
Reviewed by: bryanv cem Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D20703 |
347878 |
16-May-2019 |
tuexen |
MFC r347233:
Remove non-functional SCTP checksum offload support for virtio.
Checksum offloading for SCTP is not currently specified for virtio. If the hypervisor announces checksum offloading support, it means TCP and UDP checksum offload. If an SCTP packet is sent and the host announced checksum offload support, the hypervisor inserts the IP checksum (16-bit) at the correct offset, but this is not the right checksum, which is a CRC32c. This results in all outgoing packets having the wrong checksum and therefore breaking SCTP based communications.
This patch removes SCTP checksum offloading support from the virtio network interface.
Thanks to Felix Weinrank for making me aware of the issue. |
346368 |
19-Apr-2019 |
mav |
MFC r346161: Fix SCSI sense data pass through. |
343660 |
01-Feb-2019 |
vmaffione |
MFC r343552
vtnet: fix typo in vtnet_free_taskqueues
Because of a typo, the code was mistakenly resetting the vtnrx_vq pointer rather than vtntx_tq.
Reviewed by: bryanv Differential Revision: https://reviews.freebsd.org/D19015 |
341478 |
04-Dec-2018 |
vmaffione |
MFC r340436
vtnet: fix netmap support
netmap(4) support for vtnet(4) was incomplete and had multiple bugs. This commit fixes those bugs to bring netmap on vtnet in a functional state.
Changelist: - handle errors returned by virtqueue_enqueue() properly (they were previously ignored) - make sure netmap XOR rest of the kernel access each virtqueue. - compute the number of netmap slots for TX and RX separately, according to whether indirect descriptors are used or not for a given virtqueue. - make sure sglist are freed according to their type (mbufs or netmap buffers) - add support for mulitiqueue and netmap host (aka sw) rings. - intercept VQ interrupts directly instead of intercepting them in txq_eof and rxq_eof. This simplifies the code and makes it easier to make sure taskqueues are not running for a VQ while it is in netmap mode. - implement vntet_netmap_config() to cope with changes in the number of queues.
Reviewed by: bryanv Approved by: gnn (mentor) Sponsored by: Sunny Valley Networks Differential Revision: https://reviews.freebsd.org/D17916 |
331722 |
29-Mar-2018 |
eadler |
Revert r330897:
This was intended to be a non-functional change. It wasn't. The commit message was thus wrong. In addition it broke arm, and merged crypto related code.
Revert with prejudice.
This revert skips files touched in r316370 since that commit was since MFCed. This revert also skips files that require $FreeBSD$ property changes.
Thank you to those who helped me get out of this mess including but not limited to gonzo, kevans, rgrimes.
Requested by: gjb (re) |
331112 |
17-Mar-2018 |
bryanv |
MFC r327958, r329601, r329602:
Sync VirtIO IDs with Linux
Add VirtIO bus config_generation method
Add more virtqueue getter methods |
330897 |
14-Mar-2018 |
eadler |
Partial merge of the SPDX changes
These changes are incomplete but are making it difficult to determine what other changes can/should be merged.
No objections from: pfg |
315812 |
23-Mar-2017 |
mav |
MFC r311305 (by asomers): Always null-terminate ccb_pathinq.(sim_vid|hba_vid|dev_name)
The sim_vid, hba_vid, and dev_name fields of struct ccb_pathinq are fixed-length strings. AFAICT the only place they're read is in sbin/camcontrol/camcontrol.c, which assumes they'll be null-terminated. However, the kernel doesn't null-terminate them. A bunch of copy-pasted code uses strncpy to write them, and doesn't guarantee null-termination. For at least 4 drivers (mpr, mps, ciss, and hyperv), the hba_vid field actually overflows. You can see the result by doing "camcontrol negotiate da0 -v".
This change null-terminates those fields everywhere they're set in the kernel. It also shortens a few strings to ensure they'll fit within the 16-character field.
PR: 215474 Reported by: Coverity CID: 1009997 1010000 1010001 1010002 1010003 1010004 1010005 CID: 1331519 1010006 1215097 1010007 1288967 1010008 1306000 CID: 1211924 1010009 1010010 1010011 1010012 1010013 1010014 CID: 1147190 1010017 1010016 1010018 1216435 1010020 1010021 CID: 1010022 1009666 1018185 1010023 1010025 1010026 1010027 CID: 1010028 1010029 1010030 1010031 1010033 1018186 1018187 CID: 1010035 1010036 1010042 1010041 1010040 1010039 |
310079 |
14-Dec-2016 |
avg |
MFC r309119: virtio_pci: fix announcement of MSI-X interrupts for queues |
304067 |
14-Aug-2016 |
smh |
MFC r303971:
Fix vtnet hang with max_virtqueue_pairs > VTNET_MAX_QUEUE_PAIRS
Sponsored by: Multiplay |
302408 |
08-Jul-2016 |
gjb |
Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle. Prune svn:mergeinfo from the new branch, as nothing has been merged here.
Additional commits post-branch will follow.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
299725 |
14-May-2016 |
kp |
vtnet: fix panic on unload
Since r276367 added the virtio_mmio support vtnet_modevent() gets called twice. This resulted in a memory leak during load and a panic on unload.
Count the loads so we only initialise once (just like cxgbe(4)), and only clean up in the final unload.
PR: 209428 Submitted by: novel@FreeBSD.org MFC after: 1 week
|
298955 |
03-May-2016 |
pfg |
sys/dev: minor spelling fixes.
Most affect comments, very few have user-visible effects.
|
295707 |
17-Feb-2016 |
imp |
Create an API to reset a struct bio (g_reset_bio). This is mandatory for all struct bio you get back from g_{new,alloc}_bio. Temporary bios that you create on the stack or elsewhere should use this before first use of the bio, and between uses of the bio. At the moment, it is nothing more than a wrapper around bzero, but that may change in the future. The wrapper also removes one place where we encode the size of struct bio in the KBI.
|
287423 |
03-Sep-2015 |
araujo |
Lower the compiler warning: unused-but-set-variable.
Approved by: bapt (mentor) Differential Revision: D3556
|
285351 |
10-Jul-2015 |
luigi |
add netmap dependency when compiled as a module
|
285091 |
03-Jul-2015 |
br |
Add 'prewrite' method allowing us to run some platform-specific code before each write happens, e.g. write-back caches. This will help booting in Bluespec simulator of CHERI processor.
|
284959 |
30-Jun-2015 |
markm |
Huge cleanup of random(4) code.
* GENERAL - Update copyright. - Make kernel options for RANDOM_YARROW and RANDOM_DUMMY. Set neither to ON, which means we want Fortuna - If there is no 'device random' in the kernel, there will be NO random(4) device in the kernel, and the KERN_ARND sysctl will return nothing. With RANDOM_DUMMY there will be a random(4) that always blocks. - Repair kern.arandom (KERN_ARND sysctl). The old version went through arc4random(9) and was a bit weird. - Adjust arc4random stirring a bit - the existing code looks a little suspect. - Fix the nasty pre- and post-read overloading by providing explictit functions to do these tasks. - Redo read_random(9) so as to duplicate random(4)'s read internals. This makes it a first-class citizen rather than a hack. - Move stuff out of locked regions when it does not need to be there. - Trim RANDOM_DEBUG printfs. Some are excess to requirement, some behind boot verbose. - Use SYSINIT to sequence the startup. - Fix init/deinit sysctl stuff. - Make relevant sysctls also tunables. - Add different harvesting "styles" to allow for different requirements (direct, queue, fast). - Add harvesting of FFS atime events. This needs to be checked for weighing down the FS code. - Add harvesting of slab allocator events. This needs to be checked for weighing down the allocator code. - Fix the random(9) manpage. - Loadable modules are not present for now. These will be re-engineered when the dust settles. - Use macros for locks. - Fix comments.
* src/share/man/... - Update the man pages.
* src/etc/... - The startup/shutdown work is done in D2924.
* src/UPDATING - Add UPDATING announcement.
* src/sys/dev/random/build.sh - Add copyright. - Add libz for unit tests.
* src/sys/dev/random/dummy.c - Remove; no longer needed. Functionality incorporated into randomdev.*.
* live_entropy_sources.c live_entropy_sources.h - Remove; content moved. - move content to randomdev.[ch] and optimise.
* src/sys/dev/random/random_adaptors.c src/sys/dev/random/random_adaptors.h - Remove; plugability is no longer used. Compile-time algorithm selection is the way to go.
* src/sys/dev/random/random_harvestq.c src/sys/dev/random/random_harvestq.h - Add early (re)boot-time randomness caching.
* src/sys/dev/random/randomdev_soft.c src/sys/dev/random/randomdev_soft.h - Remove; no longer needed.
* src/sys/dev/random/uint128.h - Provide a fake uint128_t; if a real one ever arrived, we can use that instead. All that is needed here is N=0, N++, N==0, and some localised trickery is used to manufacture a 128-bit 0ULLL.
* src/sys/dev/random/unit_test.c src/sys/dev/random/unit_test.h - Improve unit tests; previously the testing human needed clairvoyance; now the test will do a basic check of compressibility. Clairvoyant talent is still a good idea. - This is still a long way off a proper unit test.
* src/sys/dev/random/fortuna.c src/sys/dev/random/fortuna.h - Improve messy union to just uint128_t. - Remove unneeded 'static struct fortuna_start_cache'. - Tighten up up arithmetic. - Provide a method to allow eternal junk to be introduced; harden it against blatant by compress/hashing. - Assert that locks are held correctly. - Fix the nasty pre- and post-read overloading by providing explictit functions to do these tasks. - Turn into self-sufficient module (no longer requires randomdev_soft.[ch])
* src/sys/dev/random/yarrow.c src/sys/dev/random/yarrow.h - Improve messy union to just uint128_t. - Remove unneeded 'staic struct start_cache'. - Tighten up up arithmetic. - Provide a method to allow eternal junk to be introduced; harden it against blatant by compress/hashing. - Assert that locks are held correctly. - Fix the nasty pre- and post-read overloading by providing explictit functions to do these tasks. - Turn into self-sufficient module (no longer requires randomdev_soft.[ch]) - Fix some magic numbers elsewhere used as FAST and SLOW.
Differential Revision: https://reviews.freebsd.org/D2025 Reviewed by: vsevolod,delphij,rwatson,trasz,jmg Approved by: so (delphij)
|
284544 |
18-Jun-2015 |
br |
Remove duplicate defines.
Sponsored by: HEIF5
|
284348 |
13-Jun-2015 |
kp |
Fix panic when adding vtnet interfaces to a bridge
vtnet interfaces are always in promiscuous mode (at least if the VIRTIO_NET_F_CTRL_RX feature is not negotiated with the host). if_promisc() on a vtnet interface returned ENOTSUP although it has IFF_PROMISC set. This confused the bridge code. Instead we now accept all enable/disable promiscuous commands (and always keep IFF_PROMISC set).
There are also two issues with the if_bridge error handling.
If if_promisc() fails it uses bridge_delete_member() to clean up. This tries to disable promiscuous mode on the interface. That runs into an assert, because promiscuous mode was never set in the first place. (That's the panic reported in PR 200210.) We can only unset promiscuous mode if the interface actually is promiscuous. This goes against the reference counting done by if_promisc(), but only the first/last if_promic() calls can actually fail, so this is safe.
A second issue is a double free of bif. It's already freed by bridge_delete_member().
PR: 200210 Differential Revision: https://reviews.freebsd.org/D2804 Reviewed by: philip (mentor)
|
284342 |
13-Jun-2015 |
bryanv |
Fix typo when deregistering the VLAN unconfig event handler
Submitted by: Masao Uebayashi <uebayasi@tombiinc.com> MFC after: 3 days
|
283291 |
22-May-2015 |
jkim |
CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten years for head. However, it is continuously misused as the mpsafe argument for callout_init(9). Deprecate the flag and clean up callout_init() calls to make them more consistent.
Differential Revision: https://reviews.freebsd.org/D2613 Reviewed by: jhb MFC after: 2 weeks
|
282241 |
29-Apr-2015 |
jhb |
Don't free mbufs when stopping an interface in netmap mode.
Currently if you ifconfig down a vtnet interface while it is being used via netmap, the kernel panics due to trying to treat the cookie values in the virtio rings as mbufs to be freed. When netmap is enabled, these cookie values are pointers to something else.
Note that other netmap-aware drivers don't seem to need this as they store the mbuf pointers in the software rings that mirror the hardware descriptor rings, and since netmap doesn't touch those, the software state always has NULL mbuf pointers causing the loops to free mbufs to not do anything. However, vtnet reuses the same state area for both netmap and non-netmap mode, so it needs to explicitly avoid looking at the rings and treating the cookie values as mbufs if netmap is enabled.
Differential Revision: https://reviews.freebsd.org/D2348 Reviewed by: adrian, bryanv, luigi MFC after: 1 week Sponsored by: Norse Corp, Inc.
|
281698 |
18-Apr-2015 |
mav |
Do not report stripe size if it is equal to sector size.
MFC after: 1 week
|
280090 |
15-Mar-2015 |
mav |
Hide virtio features negotiation messages under bootverbose.
Those messages are noisy, but useless for average user.
MFC after: 2 weeks
|
279651 |
05-Mar-2015 |
mav |
Size of opt_io_size field is 32 bit.
MFC after: 2 weeks
|
279642 |
05-Mar-2015 |
mav |
Reenable VIRTIO_BLK_F_TOPOLOGY feature.
MFC after: 2 weeks
|
277788 |
27-Jan-2015 |
bryanv |
Rework vtblk dump handling of in flight requests
Previously, the driver resets the device and abandon the requests that are caught in flight when the dump was initiated. This was problematic if the system is resumed after the dump is completed.
While that is probably not the typical action, it is simple to rework the driver to very likely have the device usable after the dump without making it more likely for the dump to fail. The in flight requests are simply queued for completion once the dump is finished.
Requested by: markj MFC after: 1 month
|
276491 |
01-Jan-2015 |
bryanv |
Add softc flag for when the indirect descriptor feature was negotiated
MFC after: 2 weeks
|
276489 |
01-Jan-2015 |
bryanv |
Use the appropriate IPv4 or IPv6 TSO HW assist flag
MFC after: 2 weeks
|
276409 |
30-Dec-2014 |
andrew |
Set the page size in the virtio-mmio driver. Some backends, e.g QEMU, assume a 1 byte page size until told otherwise.
Sponsored by: The FreeBSD Foundation
|
276367 |
29-Dec-2014 |
andrew |
Attach vtnet to virtio_mmio. Qemu provides this as an option with AArch64.
Sponsored by: The FreeBSD Foundation
|
276358 |
29-Dec-2014 |
andrew |
Allow virtio_mmio to attach to ofwbus. Qemu places these here on at least the AArch64 virtual platform with the Linaro UEFI.
Sponsored by: The FreeBSD Foundation
|
275728 |
12-Dec-2014 |
br |
Add virtio bus 'poll' method allowing us to inform backend we are going to poll virtqueue.
Use on BERI soft-core to invalidate cpu caches.
Reviewed by: bryanv Sponsored by: DARPA, AFRL
|
275647 |
09-Dec-2014 |
br |
o Add BERI Virtio Networking Frontend (if_vtbe) o Move similar block/networking methods to common file o Follow r275640 and correct MMIO registers width o Pass value to MMIO platform_note method.
Sponsored by: DARPA, AFRL
|
275640 |
09-Dec-2014 |
andrew |
Update the virtio driver to work on the ARM AArch64 Foundation Model. There are two main parts to get it to work, 1) most of the register accesses need to be word sized, other than the config register which needs to be byte aligned, and 2) we don't need the platform driver for this to work on the Foundation Model, allow it to be NULL.
Differential Revision: https://reviews.freebsd.org/D1240 Reviewed by: bryanv Sponsored by: The FreeBSD Foundation
|
275358 |
01-Dec-2014 |
hselasky |
Start process of removing the use of the deprecated "M_FLOWID" flag from the FreeBSD network code. The flag is still kept around in the "sys/mbuf.h" header file, but does no longer have any users. Instead the "m_pkthdr.rsstype" field in the mbuf structure is now used to decide the meaning of the "m_pkthdr.flowid" field. To modify the "m_pkthdr.rsstype" field please use the existing "M_HASHTYPE_XXX" macros as defined in the "sys/mbuf.h" header file.
This patch introduces new behaviour in the transmit direction. Previously network drivers checked if "M_FLOWID" was set in "m_flags" before using the "m_pkthdr.flowid" field. This check has now now been replaced by checking if "M_HASHTYPE_GET(m)" is different from "M_HASHTYPE_NONE". In the future more hashtypes will be added, for example hashtypes for hardware dedicated flows.
"M_HASHTYPE_OPAQUE" indicates that the "m_pkthdr.flowid" value is valid and has no particular type. This change removes the need for an "if" statement in TCP transmit code checking for the presence of a valid flowid value. The "if" statement mentioned above is now a direct variable assignment which is then later checked by the respective network drivers like before.
Additional notes: - The SCTP code changes will be committed as a separate patch. - Removal of the "M_FLOWID" flag will also be done separately. - The FreeBSD version has been bumped.
MFC after: 1 month Sponsored by: Mellanox Technologies
|
275335 |
30-Nov-2014 |
bryanv |
Cleanup and performance improvement of the virtio_blk driver
- Add support for GEOM direct completion. Depending on the benchmark, this tends to give a ~30% improvement w.r.t IOPs and BW. - Remove an invariants check in the strategy routine. This assertion is caught later on by an existing panic. - Rename and resort various related functions to make more sense.
MFC after: 1 month
|
274819 |
21-Nov-2014 |
smh |
Prevent overflow issues in timeout processing
Previously, any timeout value for which (timeout * hz) will overflow the signed integer, will give weird results, since callout(9) routines will convert negative values of ticks to '1'. For unsigned integer overflow we will get sufficiently smaller timeout values than expected.
Switch from callout_reset, which requires conversion to int based ticks to callout_reset_sbt to avoid this.
Also correct isci to correctly resolve ccb timeout.
This was based on the original work done by Eygene Ryabinkin <rea@freebsd.org> back in 5 Aug 2011 which used a macro to help avoid the overlow.
Differential Revision: https://reviews.freebsd.org/D1157 Reviewed by: mav, davide MFC after: 1 month Sponsored by: Multiplay
|
274655 |
18-Nov-2014 |
br |
Add Virtio MMIO bus driver.
Sponsored by: DARPA, AFRL
|
274325 |
09-Nov-2014 |
bryanv |
Enable LRO by default when available on vtnet interfaces
The prior change to not enable LRO by default has confused several people. The configurations where LRO is problematic is not the typical use case for VirtIO, and due to other issues, this often requires checksum offloading to be disabled anyways.
PR: 185864 MFC after: 2 weeks
|
274215 |
07-Nov-2014 |
bryanv |
Several minor changes to hopefully complete the VirtIO console driver
- Support the KDB alt break sequence to enter the debugger, panic, reboot, etc. [1] - Provide emergency write feature description. Note that QEMU does not implement this feature. - Make the VTCON_FLAG_* defines sequential once again. - When the multiple port feature is not negotiated, query the rows and columns of the one console during the device attach when the size feature is negotiated. - Report failure to the device if hot plugging a port fails. - Acknowledge the console port event with an open event. This is required by the spec, but QEMU doesn't seem to care.
Submitted by: Juniper [1] MFC after: 1 month
|
274063 |
03-Nov-2014 |
bryanv |
Create the tty device after the port is completely initialized
This fixes a race with a tty open before the host is the ready.
MFC after: 1 month
|
274055 |
03-Nov-2014 |
bryanv |
Add support for the multiport feature and fix hot plug races
MFC after: 1 month
|
273515 |
23-Oct-2014 |
bryanv |
Add VirtIO console driver
Support for the multiport feature is mostly implemented, but currently disabled due to some potential races in the hot plug code paths.
Requested by: marcel MFC after: 1 month Relnotes: yes
|
271799 |
18-Sep-2014 |
glebius |
- Provide if_get_counter() method for vtnet(4). - Do not accumulate statistics on every tick. - Accumulate statistics in vtnet_setup_stat_sysctl() and in vtnet_get_counter().
Sponsored by: Netflix Sponsored by: Nginx, Inc.
|
270856 |
30-Aug-2014 |
glebius |
Use define from if_var.h to access a field inside struct if_data, that resides in struct ifnet.
Sponsored by: Nginx, Inc.
|
270063 |
16-Aug-2014 |
luigi |
Update to the current version of netmap. Mostly bugfixes or features developed in the past 6 months, so this is a 10.1 candidate.
Basically no user API changes (some bugfixes in sys/net/netmap_user.h).
In detail:
1. netmap support for virtio-net, including in netmap mode. Under bhyve and with a netmap backend [2] we reach over 1Mpps with standard APIs (e.g. libpcap), and 5-8 Mpps in netmap mode.
2. (kernel) add support for multiple memory allocators, so we can better partition physical and virtual interfaces giving access to separate users. The most visible effect is one additional argument to the various kernel functions to compute buffer addresses. All netmap-supported drivers are affected, but changes are mechanical and trivial
3. (kernel) simplify the prototype for *txsync() and *rxsync() driver methods. All netmap drivers affected, changes mostly mechanical.
4. add support for netmap-monitor ports. Think of it as a mirroring port on a physical switch: a netmap monitor port replicates traffic present on the main port. Restrictions apply. Drive carefully.
5. if_lem.c: support for various paravirtualization features, experimental and disabled by default. Most of these are described in our ANCS'13 paper [1]. Paravirtualized support in netmap mode is new, and beats the numbers in the paper by a large factor (under qemu-kvm, we measured gues-host throughput up to 10-12 Mpps).
A lot of refactoring and additional documentation in the files in sys/dev/netmap, but apart from #2 and #3 above, almost nothing of this stuff is visible to other kernel parts.
Example programs in tools/tools/netmap have been updated with bugfixes and to support more of the existing features.
This is meant to go into 10.1 so we plan an MFC before the Aug.22 deadline.
A lot of this code has been contributed by my colleagues at UNIPI, including Giuseppe Lettieri, Vincenzo Maffione, Stefano Garzarella.
MFC after: 3 days.
|
270046 |
16-Aug-2014 |
luigi |
print additional debugging info in virtqueue_dump() (not fundamental, but useful to debug performance issues on vtnet)
MFC after: 3 days
|
268481 |
10-Jul-2014 |
bryanv |
Rework when the Tx queue completion interrupt is enabled
The Tx interrupt is now kept disabled in the common case, only enabled when the number of free descriptors in the queue falls below a threshold. Transmitted frames are cleared from the VQ before subsequent transmit, or in the watchdog timer.
This was a very big performance improvement for an experimental Netmap bhyve backend.
MFC after: 1 month
|
268480 |
10-Jul-2014 |
bryanv |
Add accessor to get the number of free descriptors in the virtqueue
MFC after: 1 month
|
267858 |
25-Jun-2014 |
royger |
xen/virtio: fix balloon drivers to not mark pages as WIRED
Prevent the Xen and VirtIO balloon drivers from marking pages as wired. This prevents them from increasing the system wired page count, which can lead to mlock failing because of hitting the limit in vm.max_wired.
In the Xen case make sure pages are zeroed before giving them back to the hypervisor, or else we might be leaking data. Also remove the balloon_{append/retrieve} and link pages directly into the ballooned_pages queue using the plinks.q field in the page struct.
Sponsored by: Citrix Systems R&D Reviewed by: kib, bryanv Approved by: gibbs
dev/virtio/balloon/virtio_balloon.c: - Don't allocate pages with VM_ALLOC_WIRED.
dev/xen/balloon/balloon.c: - Don't allocate pages with VM_ALLOC_WIRED. - Make sure pages are zeroed before giving them back to the hypervisor. - Remove the balloon_entry struct and the balloon_{append/retrieve} functions and use the page plinks.q entry to link the pages directly into the ballooned_pages queue.
|
267548 |
16-Jun-2014 |
attilio |
- Modify vm_page_unwire() and vm_page_enqueue() to directly accept the queue where to enqueue pages that are going to be unwired. - Add stronger checks to the enqueue/dequeue for the pagequeues when adding and removing pages to them.
Of course, for unmanaged pages the queue parameter of vm_page_unwire() will be ignored, just as the active parameter today. This makes adding new pagequeues quicker.
This change effectively modifies the KPI. __FreeBSD_version will be, however, bumped just when the full cache of free pages will be evicted.
Sponsored by: EMC / Isilon storage division Reviewed by: alc Tested by: pho
|
267524 |
16-Jun-2014 |
bryanv |
Force two byte alignment for all control message headers
The header structure consists of two 1-byte elements, but it must always be describable by a single SG entry. Note for consistency, specify the alignment everywhere, even if the structure has the appropriate natural alignment since it contains a uint16_t.
Obtained from: DragonFlyBSD MFC after: 1 week
|
267523 |
16-Jun-2014 |
bryanv |
Make the feature negotiation code easier to follow
MFC after: 1 week
|
267522 |
16-Jun-2014 |
bryanv |
Move the VIRTIO_RING_F_* defines out of virtqueue.h into virtio_config.h
These defines are applicable to userland too, but virtqueue.h contains the kernel virtqueue interface, and is therefore not usable in userland.
Note that Linux places these defines in virtio_ring.h, but I don't want the drivers including this header file to keep the VirtIO ring opaque to everything but the virtqueue.
MFC after: 1 week
|
267521 |
16-Jun-2014 |
bryanv |
Remove kernel specific macro out of the VirtIO PCI header file
The eventual goal is to share this file with userland, so remove the macro that is only specific for virtio_pci(4). Instead, add the VIRTIO_PCI_CONFIG_OFF macro from Linux to get the config size whether MSIX is enabled or not.
MFC after: 1 week
|
267520 |
16-Jun-2014 |
bryanv |
- Remove two write-only local variables - Remove unused element in the vtnet_rxq structure
MFC after: 1 week
|
267313 |
10-Jun-2014 |
bryanv |
Always append new bios to the tail of the queue, instead of sorting them
MFC after: 1 week
|
267065 |
04-Jun-2014 |
luigi |
make sure ifp->if_transmit returns 0 if a buffer is enqueued. A similar fix should be applied to vmxnet, ixgbe, igb, i40e. (some of them previously reported by Michael Tuexen)
Drivers using if_transmit are correct, and so are most of the other drivers that reassing if_transmit.
Among other things, this bug causes panics when using netmap emulation on top of generic drivers.
Approved by: bryanv MFC after: 3 days
|
266951 |
01-Jun-2014 |
bryanv |
Split the virtio.h header file into multiple files
Reorganize the previous contexts of the file as it is in Linux. The eventual goal is to install the header files and share them between the kernel and bhyve.
MFC after: 1 week
|
264867 |
24-Apr-2014 |
bryanv |
Wait for the callout to finish before unloading the module
MFC after: 3 days
|
263102 |
13-Mar-2014 |
glebius |
Since 32-bit if_baudrate isn't enough to describe a baud rate of a 10 Gbit interface, in the r241616 a crutch was provided. It didn't work well, and finally we decided that it is time to break ABI and simply make if_baudrate a 64-bit value. Meanwhile, the entire struct if_data was reviewed.
o Remove the if_baudrate_pf crutch.
o Make all fields of struct if_data fixed machine independent size. The notion of data (packet counters, etc) are by no means MD. And it is a bug that on amd64 we've got a 64-bit counters, while on i386 32-bit, which at modern speeds overflow within a second.
This also removes quite a lot of COMPAT_FREEBSD32 code.
o Give 16 bit for the ifi_datalen field. This field was provided to make future changes to if_data less ABI breaking. Unfortunately the 8 bit size of it had effectively limited sizeof if_data to 256 bytes.
o Give 32 bits to ifi_mtu and ifi_metric. o Give 64 bits to the rest of fields, since they are counters.
__FreeBSD_version bumped.
Discussed with: emax Sponsored by: Netflix Sponsored by: Nginx, Inc.
|
261395 |
02-Feb-2014 |
bryanv |
Use m_defrag() instead of m_collapse() to compact a long mbuf chain
This should be an infrequent occurrence, so remove the per-queue counters in favor of just global counters in the softc.
|
261394 |
02-Feb-2014 |
bryanv |
Do not place the sglist used for Rx/Tx on the stack
The sglist segment array has grown to a bit over 512 bytes (on 64-bit system) which is more than ideally should be put on the stack. Instead allocate an appropriately sized sglist and hang it off each Rx/Tx queue structure.
Bump the maximum number of Tx segments to 64 to make it unlikely we'll have defragment an mbuf chain. Our previous count was rounded up to this value since it is the next power of two, so effective memory usage should not change.
Also only allocate the maximum number of Tx segments if TSO was negotiated.
|
261168 |
25-Jan-2014 |
bryanv |
Check for a full virtqueue in the multiqueue transmit path
With most hosts, we'll negotiate indirect descriptors, so all we need is one available descriptor to transmit a frame.
|
261167 |
25-Jan-2014 |
bryanv |
Avoid queue unlock followed by relock when the enable interrupt race is lost
This already happens infrequently, and the hold time is still bounded since we defer to a taskqueue after a few tries.
|
261166 |
25-Jan-2014 |
bryanv |
Move duplicated transmit start code into a single function
|
261164 |
25-Jan-2014 |
bryanv |
Remove stray space
|
261151 |
25-Jan-2014 |
bryanv |
Also include the mbuf's csum_flags in an assert message
|
261150 |
25-Jan-2014 |
bryanv |
Read and write the MAC address in the config space byte by byte
|
261149 |
25-Jan-2014 |
bryanv |
Read each field of the configuration individually
In the forthcoming VirtIO spec, the device configuration is always in little endian instead of guest edian. This is a noop change for now.
|
261147 |
25-Jan-2014 |
bryanv |
Remove spaces before tabs in the function prototype list
|
260847 |
18-Jan-2014 |
bryanv |
Add very simple virtio_random(4) driver to harvest entropy from host
Reviewed by: markm (random bits only)
|
260583 |
13-Jan-2014 |
bryanv |
Add unmapped IO support to virtio_scsi(4)
|
260582 |
13-Jan-2014 |
bryanv |
Add unmapped IO support to virtio_blk(4)
|
260566 |
12-Jan-2014 |
bryanv |
Remove incorrect bit shift when assigning the LUN request field
This caused duplicate targets appearing on Google Compute Engine instances.
PR: kern/185626 Submitted by: Venkatesh Srinivas <venkateshs@google.com> MFC after: 3 days
|
257241 |
28-Oct-2013 |
glebius |
Include necessary headers that now are available due to pollution via if_var.h.
Sponsored by: Netflix Sponsored by: Nginx, Inc.
|
257176 |
26-Oct-2013 |
glebius |
The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare to this event, adding if_var.h to files that do need it. Also, include all includes that now are included due to implicit pollution via if_var.h
Sponsored by: Netflix Sponsored by: Nginx, Inc.
|
256066 |
05-Oct-2013 |
bryanv |
Do not hold the vtnet Rx queue lock when calling up into the stack
This matches other similar drivers and avoids various LOR warnings.
Approved by: re (marius)
|
255167 |
03-Sep-2013 |
bryanv |
Complete any pending Tx frames before attempting the next transmit
Also complete pending frames in the watchdog function when the EVENT_IDX feature was negotiated just in case the completion interrupt was postponed.
|
255166 |
03-Sep-2013 |
bryanv |
Fix unintended compiler constant folding
Pointed out by: dim@
|
255131 |
01-Sep-2013 |
eadler |
Fix build with gcc
Reported by: Michael Butler <imb@protected-networks.net> Reviewed by: jilles
|
255112 |
01-Sep-2013 |
bryanv |
Import multiqueue VirtIO net driver from my user/bryanv/vtnetmq branch
This is a significant rewrite of much of the previous driver; lots of misc. cleanup was also performed, and support for a few other minor features was also added.
|
255111 |
01-Sep-2013 |
bryanv |
Sync VirtIO net device header file from recent Linux
|
255110 |
01-Sep-2013 |
bryanv |
Add optional VirtIO device method for post-attach notifications
This is called after the parent device (ie virito_pci) has completed the device attachment/initialization.
|
255109 |
01-Sep-2013 |
bryanv |
Add support for postponing VirtIO virtqueue interrupts
Partial support for the EVENT_IDX feature was added a while ago, but this commit adds an interface for the device driver to hint how long (in terms of descriptors) the next interrupt should be delayed.
The first user of this will be used to reduce VirtIO net's Tx completion interrupts.
|
254182 |
10-Aug-2013 |
kib |
Different consumers of the struct vm_page abuse pageq member to keep additional information, when the page is guaranteed to not belong to a paging queue. Usually, this results in a lot of type casts which make reasoning about the code correctness harder.
Sometimes m->object is used instead of pageq, which could cause real and confusing bugs if non-NULL m->object is leaked. See r141955 and r253140 for examples.
Change the pageq member into a union containing explicitly-typed members. Use them instead of type-punning or abusing m->object in x86 pmaps, uma and vm_page_alloc_contig().
Requested and reviewed by: alc Sponsored by: The FreeBSD Foundation
|
252709 |
04-Jul-2013 |
bryanv |
Merge virtio_scsi change from projects/virtio
r252680: Fix SIM lock not owned panic
The CAM locking requirements of registering an async callback has changed so the SIM lock must be held. Remove code that explicitly dropped the lock around the register.
Also return CAM_SEL_TIMEOUT instead of CAM_TID_INVALID for bad targets to avoid a lot console spam during bus scans.
MFC after: 1 month
|
252708 |
04-Jul-2013 |
bryanv |
Merge virtio_pci changes from projects/virtio
This commit is primarily a significant cleanup to the interrupt allocation code that had gotten a bit jumbled from having to support per-vq MSIX, shared MSIX, MSI, and legacy style interrupts.
Contains projects/virtio commits:
r246064: virtio_pci: Rewrite allocation of interrupts r246065: virtio_pci: Remove spaces before a tab r246066: virtio_pci: Dynamically allocate the virtqueue array r246304: virtio_pci: Clean up after failed virtqueue alloc attempt r246305: virtio_pci: Move no interrupt check into the PCI interrupt handlers r246308: virtio_pci: Remove unused variable
MFC after: 1 month
|
252707 |
04-Jul-2013 |
bryanv |
Merge virtio changes from projects/virtio
Contains projects/virtio commits:
r245738: virtio: Minor man page tweaks r246060: virtio: Cleanup feature description printing r246306: virtio: Remove old debugging flag r247238: virtio: Remove PRIx64 macros from format strings r247239: virtio: Constify some fields r247240: virtio: Minor code simplifications r249962: virtio: Update to my freebsd.org email address
MFC after: 1 month
|
252706 |
04-Jul-2013 |
bryanv |
Merge vtnet changes from projects/virtio
Minor changes to the network driver. A multiqueue driver that is a significant rewrite will be in merged shortly.
Contains projects/virtio commits:
r246058: vtnet: Move an mbuf ASSERT to the calling function r246059: vtnet: Tweak ASSERT message
MFC after: 1 month
|
252704 |
04-Jul-2013 |
bryanv |
Merge virtio_balloon changes from projects/virtio
Contains projects/virtio commits:
r245717: virtio_balloon: Make the softc lock a regular mutex r245718: virtio_balloon: Remove two unuseful ASSERTs r245719: virtio_balloon: More verbose ASSERT messages r245720: virtio_balloon: Simplify lowmem handling in vtballoon_inflate() r252530: virtio_balloon: Use just a kthread instead of dedciated kproc r252568: virtio_balloon: Need to use kthread_exit() after r252530
MFC after: 1 month
|
252703 |
04-Jul-2013 |
bryanv |
Merge several virtio_blk changes from projects/virtio
The notable changes of this commit are support for disk resizing and chases updates to the spec regarding write caching.
Contains projects/virtio commits:
r245713: virtio_blk: Replace __FUNCTION__ with __func__ r245714: virtio_blk: Use more consistent mutex name r245715: virtio_blk: Print device name too if failed to reinit during dump r245716: virtio_blk: Remove an unuseful ASSERT r245723: virtio_blk: Record the vendor and device information r245724: virtio_blk: Add resize support r245726: virtio_blk: More verbose ASSERT messages r245730: virtio_blk: Tweak resize announcement message r246061: virtio_blk: Do not always read entire config r246062: virtio_blk: Use topology to set the stripe size/offset r246307: virtio_blk: Correct stripe offset calculation r246063: virtio_blk: Add support for write cache enable feature r246303: virtio_blk: Expand a comment r252529: virtio_blk: Improve write cache handling r252681: virtio_blk: Remove unneeded curly braces
MFC after: 1 month
|
252702 |
04-Jul-2013 |
bryanv |
Convert VirtIO to use ithreads instead of taskqueues
Contains projects/virtio commits:
r245709: Each VirtIO device was scheduling its own taskqueue(9) to do the off-level interrupt handling. ithreads(9) is the more nature way to do this. The primary motivation for this work to better support network multiqueue. r245710: virtio: Change virtqueue intr handlers to return void r245711: virtio_blk: Remove interrupt taskqueue r245721: vtnet: Remove interrupt taskqueue r245722: virtio_scsi: Remove interrupt taskqueue r245747: vtnet: Remove taskqueue fields missed in r245721
MFC after: 1 month
|
251769 |
15-Jun-2013 |
bryanv |
Merge r250802 from bryanv/vtnetmq - Fix setting of the Rx filters
QEMU 1.4 made the descriptor requirement stricter - the size of buffer descriptor must exactly match the number of MAC addresses provided.
PR: kern/178955 MFC after: 5 days
|
249468 |
14-Apr-2013 |
mav |
MFprojects/camlock r248982: Stop abusing xpt_periph in random plases that really have no periph related to CCB, for example, bus scanning. NULL value is fine in such cases and it is correctly logged in debug messages as "noperiph". If at some point we need some real XPT periphs (alike to pmpX now), quite likely they will be per-bus, and not a single global instance as xpt_periph now.
|
247829 |
05-Mar-2013 |
bryanv |
Only set the barrier flag if the feature was negotiated
When the VirtIO barrier feature is not negotiated, the driver must enforce the proper ordering for BIO_ORDERED BIOs. All the in-flight BIOs must complete before starting the BIO, and the ordered BIO must complete before subsequent BIOs can start.
Also fix a few whitespace nits.
Reported by: neel Approved by: grehan (mentor) MFC after: 3 days
|
246713 |
12-Feb-2013 |
kib |
Reform the busdma API so that new types may be added without modifying every architecture's busdma_machdep.c. It is done by unifying the bus_dmamap_load_buffer() routines so that they may be called from MI code. The MD busdma is then given a chance to do any final processing in the complete() callback.
The cam changes unify the bus_dmamap_load* handling in cam drivers.
The arm and mips implementations are updated to track virtual addresses for sync(). Previously this was done in a type specific way. Now it is done in a generic way by recording the list of virtuals in the map.
Submitted by: jeff (sponsored by EMC/Isilon) Reviewed by: kan (previous version), scottl, mjacob (isp(4), no objections for target mode changes) Discussed with: ian (arm changes) Tested by: marius (sparc64), mips (jmallet), isci(4) on x86 (jharris), amd64 (Fabian Keil <freebsd-listen@fabiankeil.de>)
|
244200 |
14-Dec-2012 |
bryanv |
virtio: Start taskqueues threads after attach cannot fail
If virtio_setup_intr() failed during boot, we would hang in taskqueue_free() -> taskqueue_terminate() for all the taskq threads to terminate. This will never happen since the scheduler is not running by this point.
Reported by: neel, grehan Approved by: grehan (mentor)
|
244136 |
12-Dec-2012 |
bryanv |
virtio_scsi: Remove duplicated lines
These must have been accidently copied from the if statement a few lines later. Also remove parameter name from function prototype.
Approved by: grehan (mentor)
|
243857 |
04-Dec-2012 |
glebius |
Mechanically substitute flags from historic mbuf allocator with malloc(9) flags in sys/dev.
|
241495 |
12-Oct-2012 |
mav |
Fix build with PAE enabled. I doubt any code uses CAM_SCATTER_VALID or CAM_DATA_PHYS, or they ever correctly worked, but make this build at least.
|
241470 |
11-Oct-2012 |
grehan |
Virtio SCSI driver
Submitted by: Bryan Venteicher bryanv at daemoninthecloset dot org Reviewed by: grehan
|
241469 |
11-Oct-2012 |
grehan |
Patch from Bryan to fix a virtqueue issue:
virtqueue: Fix non-indirect virtqueues
We really must walk the entire descriptor chain in order to append the to be free'd chain to the existing free chain.
Submitted by: Bryan Venteicher (bryanv@daemoninthecloset.org) Reported by: cognet
|
241394 |
10-Oct-2012 |
kevlo |
Revert previous commit...
Pointyhat to: kevlo (myself)
|
241370 |
09-Oct-2012 |
kevlo |
Prefer NULL over 0 for pointers
|
240430 |
13-Sep-2012 |
grehan |
No need to leak these into the includer's namespace.
Submitted by: Bryan Venteicher bryanv at daemoninthecloset org
|
240427 |
13-Sep-2012 |
grehan |
Relax requirement of certain mb()s
Submitted by: Bryan Venteicher bryanv at daemoninthecloset org
|
238360 |
11-Jul-2012 |
grehan |
Various VirtIO improvements
PCI: - Properly handle interrupt fallback from MSIX to MSI to legacy. The host may not have sufficient resources to support MSIX, so we must be able to fallback to legacy interrupts. - Add interface to get the (sub) vendor and device IDs. - Rename flags to VTPCI_FLAG_* like other VirtIO drivers. Block: - No longer allocate vtblk_requests from separate UMA zone. malloc(9) from M_DEVBUF is sufficient. Assert segment counts at allocation. - More verbose error and debug messages. Network: - Remove stray write once variable. Virtqueue: - Shuffle code around in preparation of converting the mb()s to the appropriate atomic(9) operations. - Only walk the descriptor chain when freeing if INVARIANTS is defined since the result is only KASSERT()ed.
Submitted by: Bryan Venteicher (bryanv@daemoninthecloset.org)
|
238072 |
03-Jul-2012 |
obrien |
Do not include <sys/types.h> in the local headers. The .c files including them have already included <sys/param.h> before these headers are included.
|
234349 |
16-Apr-2012 |
grehan |
Sync with Bryan Venteicher's virtio git repo:
d04e609bdd1973cc7d2e8b38b7dcfae057b0962d virtio_blk: Use correct temporary variable in vtblk_poll_request
Obtained from: Bryan Venteicher bryanv at daemoninthecloset dot org
|
234270 |
14-Apr-2012 |
grehan |
Catch up with Bryan Venteicher's virtio git repo:
a8af6270bd96be6ccd86f70b60fa6512b710e4f0 virtio_blk: Include function name in panic string
cbdb03a694b76c5253d7ae3a59b9995b9afbb67a virtio_balloon: Do the notify outside of the lock
By the time we return from virtqueue_notify(), the descriptor will be in the used ring so we shouldn't have to sleep.
10ba392e60692529a5cbc1e9987e4064e0128447 virtio: Use DEVMETHOD_END
80cbcc4d6552cac758be67f0c99c36f23ce62110 virtqueue: Add support for VIRTIO_F_RING_EVENT_IDX
This can be used to reduce the number of guest/host and host/guest interrupts by delaying the interrupt until a certain index value is reached.
Actual use by the network driver will come along later.
8fc465969acc0c58477153e4c3530390db436c02 virtqueue: Simplify virtqueue_nused()
Since the values just wrap naturally at UINT16_MAX, we can just subtract the two values directly, rather than doing 2's complement math.
a8aa22f25959e2767d006cd621b69050e7ffb0ae virtio_blk: Remove debugging crud from 75dd732a
There seems to be an issue with Qemu (or FreeBSD VirtIO) that sets the PCI register space for the device config to bogus values. This only seems to happen after unloading and reloading the module.
d404800661cb2a9769c033f8a50b2133934501aa virtio_blk: Use better variable name
75dd732a97743d96e7c63f7ced3c2169696dadd3 virtio_blk: Partially revert 92ba40e65
Just use the virtqueue to determine if any requests are still inflight.
06661ed66b7a9efaea240f99f414c368f1bbcdc7 virtio_blk: error if allowed too few segments
Should never happen unless the host provides use with a bogus seg_max value.
4b33e5085bc87a818433d7e664a0a2c8f56a1a89 virtio_blk: Sort function declarations
426b9f5cac892c9c64cc7631966461514f7e08c6 virtio_blk: Cleanup whitespace
617c23e12c61e3c2233d942db713c6b8ff0bd112 virtio_blk: Call disk_err() on error'd completed requests
081a5712d4b2e0abf273be4d26affcf3870263a9 virtio_blk: ASSERT the ready and inflight request queues are empty
a9be2631a4f770a84145c18ee03a3f103bed4ca8 virtio_blk: Simplify check for too many segments
At the cost of a small style violation.
e00ec09da014f2e60cc75542d0ab78898672d521 virtio_blk: Add beginnings of suspend/resume
Still not sure if we need to virtio_stop()/virtio_reinit() the device before/after a suspend.
Don't start additional IO when marked as suspending.
47c71dc6ce8c238aa59ce8afd4bda5aa294bc884 virtio_blk: Panic when dealt an unhandled BIO cmd
1055544f90fb8c0cc6a2395f5b6104039606aafe virtio_blk: Add VQ enqueue/dequeue wrappers
Wrapper functions managed the added/removing to the in-flight list of requests.
Normally biodone() any completed IO when draining the virtqueue.
92ba40e65b3bb5e4acb9300ece711f1ea8f3f7f4 virtio_blk: Add in-flight list of requests
74f6d260e075443544522c0833dc2712dd93f49b virtio_blk: Rename VTBLK_FLAG_DETACHING to VTBLK_FLAG_DETACH
7aa549050f6fc6551c09c6362ed6b2a0728956ef virtio_blk: Finish all BIOs through vtblk_finish_bio()
Also properly set bio_resid in the case of errors. Most geom_disk providers seem to do the same.
9eef6d0e6f7e5dd362f71ba097f2e2e4c3744882 Added function to translate VirtIO status to error code
ef06adc337f31e1129d6d5f26de6d8d1be27bcd2 Reset dumping flag when given unexpected parameters
393b3e390c644193a2e392220dcc6a6c50b212d9 Added missing VTBLK_LOCK() in dump handler
Obtained from: Bryan Venteicher bryanv at daemoninthecloset dot org
|
232470 |
03-Mar-2012 |
jhb |
Use pci_find_cap() instead of pci_find_extcap() to locate PCI find capabilities as the latter API is deprecated for this purpose.
MFC after: 2 weeks
|
228301 |
06-Dec-2011 |
grehan |
Catch up with Bryan Venteicher's virtio Hg repo:
c162516 Remove vtblk_sector_size
c162515 Wrap long license lines
c162514 Remove vtblk_unit
c162513 Wrap long lines in the license.
c162512 Remove verbose messages when link goes up/down.
A similar message is printed elsewhere as a result of if_link_state_change().
c162511 Explicity compare pointer to NULL
c162510 Allocate the mac filter table at attach time.
c162509 Add real BSD licenses to the header files copied from Linux.
The chases upstream changes made in Linux awhile ago.
c162508 Only notify if we actually dequeued something.
c162507 Change a couple of if () { KASSERT(...) } to just KASSERTs.
In non-debug kernels, the if() { } probably get optomized away, but I guess this is clearer.
c162506 Remove VIRTIO_BLK_F_TOPOLOGY fields in the config.
TOPOLOGY has since been removed from the spec, and the FreeBSD didn't really do anything with the fields anyways.
c162505 Move vtblk_enqueue_request() outside the locks when getting the ident.
c162504 Remove soon to be uneeded trylock during dump [1]. http://lists.freebsd.org/pipermail/freebsd-current/2011-November/029226.html
c162503 Remove emtpy line
c162502 Drop frame if cannot allocate a vtnet_tx_header.
If we don't, we set OACTIVE, but if there are no other frames in flight, vtnet_txeof() will never be called to unset OACTIVE. The interface would have to be down/up'ed in order to become usable.
We could be cuter here and only do this if the virtqueue is emtpy, but its probably not worth the complication.
c162501 Start mbuf replacement loop at 1 for clarity
Obtained from: Bryan Venteicher bryanv at daemoninthecloset dot org
|
227652 |
18-Nov-2011 |
grehan |
Import virtio base, PCI front-end, and net/block/balloon drivers. Tested on Qemu/KVM, VirtualBox, and BHyVe.
Currently built as modules-only on i386/amd64. Man pages not yet hooked up, pending review.
Submitted by: Bryan Venteicher bryanv at daemoninthecloset dot org Reviewed by: bz MFC after: 4 weeks or so
|