summaryrefslogtreecommitdiff
path: root/sys/dev/hyperv
Commit message (Collapse)AuthorAgeFilesLines
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-274-0/+8
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
* hyperv/hn: Enable transparent VF by default.Sepherosa Ziehau2017-10-111-1/+1
| | | | | | | | MFC after: 3 days Sponsored by: Microsoft Notes: svn path=/head/; revision=324517
* hyperv/hn: Workaround erroneous hash type observed on WS2016 for VF.Sepherosa Ziehau2017-10-113-8/+36
| | | | | | | | | | The background was described in r324489. MFC after: 3 days Sponsored by: Microsoft Notes: svn path=/head/; revision=324516
* hyperv/hn: Workaround erroneous hash type observed on WS2016.Sepherosa Ziehau2017-10-103-30/+90
| | | | | | | | | | | | | | | | | | | | Background: - UDP 4-tuple hash type is unconditionally enabled in Hyper-V on WS2016, which is _not_ affected by NDIS_OBJTYPE_RSS_PARAMS. - Non-fragment UDP/IPv4 datagrams' hash type is delivered to VM as TCP_IPV4. Currently this erroneous behavior only applies to WS2016/Windows10. Force l3/l4 protocol check, if the RXed packet's hash type is TCP_IPV4, and the Hyper-V is running on WS2016/Windows10. If the RXed packet is UDP datagram, adjust mbuf hash type to UDP_IPV4. MFC after: 3 days Sponsored by: Microsoft Notes: svn path=/head/; revision=324489
* hyperv/vmbus: Expose Hyper-V major version.Sepherosa Ziehau2017-10-102-1/+5
| | | | | | | | MFC after: 3 days Sponsored by: Microsoft Notes: svn path=/head/; revision=324488
* hyperv/vmbus: Add tunable to pin/unpin event tasks.Sepherosa Ziehau2017-10-101-4/+17
| | | | | | | | | | | | | | Event tasks are pinned to their respective CPU by default, in the same fashion as they were. Unpin the event tasks by setting hw.vmbus.pin_evttask to 0, if certain CPUs serve special purpose. MFC after: 3 days Sponsored by: Microsoft Notes: svn path=/head/; revision=324487
* hyperv/hn: Fix options RSS buildingSepherosa Ziehau2017-10-051-4/+0
| | | | | | | | | Reported by: np MFC after: 1 week Sponsored by: Microsoft Notes: svn path=/head/; revision=324316
* hyperv/hn: Unbreak i386 building.Sepherosa Ziehau2017-09-281-1/+1
| | | | | | | | | Reported by: cy MFC after: 1 week Sponsored by: Microsoft Notes: svn path=/head/; revision=324077
* hyperv/hn: Fix UDP checksum offload issue in Azure.Sepherosa Ziehau2017-09-271-2/+57
| | | | | | | | | | | | | | | | | | | UDP checksum offload does not work in Azure if following conditions are met: - sizeof(IP hdr + UDP hdr + payload) > 1420. - IP_DF is not set in IP hdr Use software checksum for UDP datagrams falling into this category. Add two tunables to disable UDP/IPv4 and UDP/IPv6 checksum offload, in case something unexpected happened. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D12429 Notes: svn path=/head/; revision=324049
* hyperv/hn: Set tcp header offset for CSUM/LSO offloading.Sepherosa Ziehau2017-09-272-27/+70
| | | | | | | | | | | No observable effect; better safe than sorry. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D12417 Notes: svn path=/head/; revision=324048
* hyperv/hn: Incease max supported MTUSepherosa Ziehau2017-09-191-2/+1
| | | | | | | | | MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D12365 Notes: svn path=/head/; revision=323729
* hyperv/hn: Fix MTU settingSepherosa Ziehau2017-09-194-2/+46
| | | | | | | | | | | | | | | - Add size of an ethernet header to the value configured to NVS. This does not seem to have any effects if MTU is 1500, but fix hypervisor side's setting if MTU > 1500. - Override the MTU setting according to the view from the hypervisor side. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D12352 Notes: svn path=/head/; revision=323728
* hyperv/hn: Apply VF's RSS settingSepherosa Ziehau2017-09-194-52/+363
| | | | | | | | | | | | | | Since in Azure SYN and SYN|ACK go through the synthetic parts while the rest of the same TCP flow goes through the VF, apply VF's RSS settings to synthetic parts to have a consistent hash value/type for the same TCP flow. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D12333 Notes: svn path=/head/; revision=323727
* hyperv/hn: Log RSS capabilities mask.Sepherosa Ziehau2017-09-051-0/+2
| | | | | | | | | | | This helps to detect when UDP hash types can be supported. MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D12177 Notes: svn path=/head/; revision=323176
* hyperv/hn: Implement SIOCGIFRSS{KEY,HASH}.Sepherosa Ziehau2017-09-051-0/+52
| | | | | | | | | | | | | The conditional compiling in the review request is removed, since these IOCTLs will be available in stable/10 and stable/11. Reviewed by: gallatin MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D12175 Notes: svn path=/head/; revision=323175
* hyperv: Update copyright for the files changed in 2017Sepherosa Ziehau2017-08-1417-17/+17
| | | | | | | | | MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11982 Notes: svn path=/head/; revision=322488
* hyperv/hn: Re-set datapath after synthetic parts reattached.Sepherosa Ziehau2017-08-141-1/+2
| | | | | | | | | | | Do this even for non-transparent mode VF. Better safe than sorry. MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11981 Notes: svn path=/head/; revision=322487
* hyperv/hn: Minor cleanupSepherosa Ziehau2017-08-141-8/+7
| | | | | | | | | MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11979 Notes: svn path=/head/; revision=322486
* hyperv/hn: Fix/enhance receiving path when VF is activated.Sepherosa Ziehau2017-08-142-31/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | - Update hn(4)'s stats properly for non-transparent mode VF. - Allow BPF tapping to hn(4) for non-transparent mode VF. - Don't setup mbuf hash, if 'options RSS' is set. In Azure, when VF is activated, TCP SYN and SYN|ACK go through hn(4) while the rest of segments and ACKs belonging to the same TCP 4-tuple go through the VF. So don't setup mbuf hash, if a VF is activated and 'options RSS' is not enabled. hn(4) and the VF may use neither the same RSS hash key nor the same RSS hash function, so the hash value for packets belonging to the same flow could be different! - Disable LRO. hn(4) will only receive broadcast packets, multicast packets, TCP SYN and SYN|ACK (in Azure), LRO is useless for these packet types. For non-transparent, we definitely _cannot_ enable LRO at all, since the LRO flush will use hn(4) as the receiving interface; i.e. hn_ifp->if_input(hn_ifp, m). While I'm here, remove unapplied comment and minor style change. MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11978 Notes: svn path=/head/; revision=322485
* hyperv/hn: Update VF's ibytes properly under transparent VF mode.Sepherosa Ziehau2017-08-141-5/+26
| | | | | | | | | | | | While, I'm here add comment about why updating VF's imcast stat is not necessary. MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11948 Notes: svn path=/head/; revision=322483
* hyperv/hn: Implement transparent mode network VF.Sepherosa Ziehau2017-08-093-41/+811
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | How network VF works with hn(4) on Hyper-V in transparent mode: - Each network VF has a cooresponding hn(4). - The network VF and the it's cooresponding hn(4) have the same hardware address. - Once the network VF is attached, the cooresponding hn(4) waits several seconds to make sure that the network VF attach routing completes, then: o Set the intersection of the network VF's if_capabilities and the cooresponding hn(4)'s if_capabilities to the cooresponding hn(4)'s if_capabilities. And adjust the cooresponding hn(4) if_capable and if_hwassist accordingly. (*) o Make sure that the cooresponding hn(4)'s TSO parameters meet the constraints posed by both the network VF and the cooresponding hn(4). (*) o The network VF's if_input is overridden. The overriding if_input changes the input packet's rcvif to the cooreponding hn(4). The network layers are tricked into thinking that all packets are neceived by the cooresponding hn(4). o If the cooresponding hn(4) was brought up, bring up the network VF. The transmission dispatched to the cooresponding hn(4) are redispatched to the network VF. o Bringing down the cooresponding hn(4) also brings down the network VF. o All IOCTLs issued to the cooresponding hn(4) are pass-through'ed to the network VF; the cooresponding hn(4) changes its internal state if necessary. o The media status of the cooresponding hn(4) solely relies on the network VF. o If there are multicast filters on the cooresponding hn(4), allmulti will be enabled on the network VF. (**) - Once the network VF is detached. Undo all damages did to the cooresponding hn(4) in the above item. NOTE: No operation should be issued directly to the network VF, if the network VF transparent mode is enabled. The network VF transparent mode can be enabled by setting tunable hw.hn.vf_transparent to 1. The network VF transparent mode is _not_ enabled by default, as of this commit. The benefit of the network VF transparent mode is that the network VF attachment and detachment are transparent to all network layers; e.g. live migration detaches and reattaches the network VF. The major drawbacks of the network VF transparent mode: - The netmap(4) support is lost, even if the VF supports it. - ALTQ does not work, since if_start method cannot be properly supported. (*) These decisions were made so that things will not be messed up too much during the transition period. (**) This does _not_ need to go through the fancy multicast filter management stuffs like what vlan(4) has, at least currently: - As of this write, multicast does not work in Azure. - As of this write, multicast packets go through the cooresponding hn(4). MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11803 Notes: svn path=/head/; revision=322299
* hyperv/kvp: Use proper size macro for adapter id.Sepherosa Ziehau2017-08-031-1/+1
| | | | | | | | | Submitted by: Christopher Ertl <Christopher.Ertl microsoft com> MFC after: 3 days Sponsored by: Microsoft Notes: svn path=/head/; revision=321965
* hyperv/hn: Add comment about ether_ifattach event subscription.Sepherosa Ziehau2017-08-011-0/+6
| | | | | | | | | MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11710 Notes: svn path=/head/; revision=321837
* hyperv/hn: Renaming and minor cleanupSepherosa Ziehau2017-08-012-48/+55
| | | | | | | | | | | This prepares for the upcoming transparent VF support. MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11708 Notes: svn path=/head/; revision=321836
* hyperv/hn: Ignore LINK_SPEED_CHANGE status.Sepherosa Ziehau2017-07-241-0/+1
| | | | | | | | | | | | | This status will be reported if the backend NIC is wireless; it's not useful. Due to the high frequency of the reporting, this could be pretty annoying; ignore it. MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11651 Notes: svn path=/head/; revision=321409
* hyperv/hn: Export VF list and VF-HN mappingSepherosa Ziehau2017-07-242-27/+280
| | | | | | | | | | | The VF-HN map will be used later on to implement "transparent VF". MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11618 Notes: svn path=/head/; revision=321407
* hyperv/storvsc: Force SPC3 for CDROM attached.Sepherosa Ziehau2017-07-201-1/+18
| | | | | | | | | | | | | | This unbreaks the CDROM attaching on GEN2 VMs. On GEN1 VMs, CDROM is attached to emulated ATA controller. PR: 220790 Submitted by: Hongjiang Zhang <honzhan microsoft com> MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11634 Notes: svn path=/head/; revision=321286
* Clean up MD pollution of bus_dma.h:Jason A. Harmening2017-07-011-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --Remove special-case handling of sparc64 bus_dmamap* functions. Replace with a more generic mechanism that allows MD busdma implementations to generate inline mapping functions by defining WANT_INLINE_DMAMAP in <machine/bus_dma.h>. This is currently useful for sparc64, x86, and arm64, which all implement non-load dmamap operations as simple wrappers around map objects which may be bus- or device-specific. --Remove NULL-checked bus_dmamap macros. Implement the equivalent NULL checks in the inlined x86 implementation. For non-x86 platforms, these checks are a minor pessimization as those platforms do not currently allow NULL maps. NULL maps were originally allowed on arm64, which appears to have been the motivation behind adding arm[64]-specific barriers to bus_dma.h, but that support was removed in r299463. --Simplify the internal interface used by the bus_dmamap_load* variants and move it to bus_dma_internal.h --Fix some drivers that directly include sys/bus_dma.h despite the recommendations of bus_dma(9) Reviewed by: kib (previous revision), marius Differential Revision: https://reviews.freebsd.org/D10729 Notes: svn path=/head/; revision=320528
* hyperv/input: Remove unnecessary inclusion.Sepherosa Ziehau2017-06-301-1/+0
| | | | | | | | | | | | The unbreaks gcc compilation. Submitted by: Ryan Libby MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11415 Notes: svn path=/head/; revision=320490
* hyperv/storvsc: Reduce log verbositySepherosa Ziehau2017-06-211-10/+21
| | | | | | | | | | | | | | | | | On some windows hosts TEST_UNIT_READY command will return SRB_STATUS_ERROR and sense data "NOT READY asc:3a,1 (Medium not present - tray closed)", this occurs periodically, and not hurt anything else. So, we prefer to ignore this kind of errors. PR: 219973 Submitted by: Hongjiang Zhang <hongzhan microsoft com> MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11271 Notes: svn path=/head/; revision=320184
* hyperv/pcib: use the device serial number as PCI domainDexuan Cui2017-06-081-0/+2
| | | | | | | | | | | | | | | Currently the PCI domain is initialized with the instance GUID in vmbus_pcib_attach(). It turns out the GUID can change across VM reboot, while some users want a persistent value for PCI domain. The solution is that we can change to use the device serial number, which starts with 1 and is unique within a VM. Obtained from: Haiyang Zhang MFC after: 1 day Sponsored by: Microsoft Notes: svn path=/head/; revision=319690
* hyperv/vmbus: Reorganize vmbus device treeSepherosa Ziehau2017-05-102-42/+158
| | | | | | | | | | | | | | | | | | | | | | | | For GEN1 Hyper-V, vmbus is attached to pcib0, which contains the resources for PCI passthrough and SR-IOV. There is no acpi_syscontainer0 on GEN1 Hyper-V. For GEN2 Hyper-V, vmbus is attached to acpi_syscontainer0, which contains the resources for PCI passthrough and SR-IOV. There is no pcib0 on GEN2 Hyper-V. The ACPI VMBUS device now only holds its _CRS, which is empty as of this commit; its existence is mainly for upward compatibility. Device tree structure is suggested by jhb@. Tested-by: dexuan@ Collabrated-wth: dexuan@ MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D10565 Notes: svn path=/head/; revision=318136
* hyperv/kbd: Channel read expects non-NULL channel argument.Sepherosa Ziehau2017-05-051-1/+1
| | | | | | | | MFC after: now Sponsored by: Microsoft Notes: svn path=/head/; revision=317821
* hyperv/hn: Use channel0, i.e. TX ring0, for TCP SYN/SYN|ACK.Sepherosa Ziehau2017-04-241-11/+91
| | | | | | | | | | | | | | | | | Hyper-V hot channel effect: Operation latency on hot channel is only _half_ of the operation latency on cold channels. This commit takes the advantage of the above Hyper-V host channel effect, and can reduce more than 75% latency and more than 50% latency stdev, i.e. lower and more stable/predictable latency, for various types of web server workloads. MFC after: 3 days Sponsored by: Microsoft Notes: svn path=/head/; revision=317353
* hyperv: Use kmem_malloc for hypercall memory due to NX bit change.Sepherosa Ziehau2017-04-191-12/+19
| | | | | | | | | Reported by: dexuan@ MFC after: now Sponsored by: Microsoft Notes: svn path=/head/; revision=317107
* hyperv/kvp: Remove always false condition.Sepherosa Ziehau2017-04-141-1/+1
| | | | | | | | | Reported by: PVS MFC after: 3 days Sponsored by: Microsoft Notes: svn path=/head/; revision=316815
* hyperv/storvsc: Use ULL for 64bits value shift.Sepherosa Ziehau2017-04-141-1/+1
| | | | | | | | | Reported by: PVS MFC after: 3 days Sponsored by: Microsoft Notes: svn path=/head/; revision=316813
* hyperv/kbd: Remove unnecessary assignment.Sepherosa Ziehau2017-04-141-1/+0
| | | | | | | | | Reported by: PVS MFC after: 3 days Sponsored by: Microsoft Notes: svn path=/head/; revision=316812
* hyperv/hn: Fixat RNDIS rxfilter after the successful RNDIS init.Sepherosa Ziehau2017-04-053-31/+103
| | | | | | | | | | | | | | | | | Under certain conditions on certain versions of Hyper-V, the RNDIS rxfilter is _not_ zero on the hypervisor side after the successful RNDIS initialization, which breaks the assumption of any following code (well, it breaks the RNDIS API contract actually). Clear the RNDIS rxfilter explicitly, drain packets sneaking through, and drain the interrupt taskqueues scheduled due to the stealth packets. Reported by: dexuan@ MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D10230 Notes: svn path=/head/; revision=316520
* hyperv/storvsc: Fixup SRB status.Sepherosa Ziehau2017-04-052-8/+8
| | | | | | | | | | | | | This unbreaks GEN2 Hyper-V cd support. Submitted by: Hongjiang Zhang <honzhan microsoft com> Reviewed by: dexuan@ MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D10212 Notes: svn path=/head/; revision=316519
* hyperv/kbd: Add support for synthetic keyboard.Sepherosa Ziehau2017-04-053-0/+1200
| | | | | | | | | | | | Synthetic keyboard is the only supported keyboard on GEN2 Hyper-V. Submitted by: Hongjiang Zhang <honzhan microsoft com> MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D10196 Notes: svn path=/head/; revision=316515
* hyperv/hn: Misaligned chimney sending buffers should not be usedSepherosa Ziehau2017-03-011-3/+8
| | | | | | | | | MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9714 Notes: svn path=/head/; revision=314485
* hyperv/hn: Make sure that RNDIS packet message is at least 4B aligned.Sepherosa Ziehau2017-03-011-2/+15
| | | | | | | | | MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9713 Notes: svn path=/head/; revision=314484
* hyperv/hn: Simplify RNDIS packet total length calculation.Sepherosa Ziehau2017-03-011-4/+3
| | | | | | | | | MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9712 Notes: svn path=/head/; revision=314483
* hyperv/hn: Simplify RNDIS packet data offset calculation.Sepherosa Ziehau2017-02-281-5/+2
| | | | | | | | | MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9699 Notes: svn path=/head/; revision=314382
* Convert PCIe Hot Plug to using pci_request_featureWarner Losh2017-02-251-0/+1
| | | | | | | | | | | | Convert PCIe hot plug support over to asking the firmware, if any, for permission to use the HotPlug hardware. Implement pci_request_feature for ACPI. All other host pci connections to allowing all valid feature requests. Sponsored by: Netflix Notes: svn path=/head/; revision=314250
* hyperv/hn: add devctl_notify for VF_UP/DOWN eventsDexuan Cui2017-01-241-0/+3
| | | | | | | | | | | Reviewed by: sephe Approved by: sephe (mentor) MFC after: 2 weeks Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9102 Notes: svn path=/head/; revision=312690
* hyperv/hn: add a sysctl name for the VF interfaceDexuan Cui2017-01-241-0/+20
| | | | | | | | | | | | | | This makes it easier for the userland script to find the releated VF interface. Reviewed by: sephe Approved by: sephe (mentor) MFC after: 2 weeks Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9101 Notes: svn path=/head/; revision=312689
* hyperv/hn: add the support for VF drivers (SR-IOV)Dexuan Cui2017-01-245-9/+192
| | | | | | | | | | | | | | | | | | | | | | | Hyper-V's NIC SR-IOV implementation needs a Hyper-V synthetic NIC and a VF NIC to work together (both NICs have the same MAC address), mainly to support seamless live migration. When the VF device becomes UP (or DOWN), the synthetic NIC driver needs to switch the data path from the synthetic NIC to the VF (or the opposite). Note: multicast/broadcast packets are still received through the synthetic NIC and we need to inject the packets through the VF interface (if the VF is UP), even if the synthetic NIC is DOWN (so we need to force the rxfilter to be NDIS_PACKET_TYPE_PROMISCUOUS, when the VF is UP). Reviewed by: sephe Approved by: sephe (mentor) MFC after: 2 weeks Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8964 Notes: svn path=/head/; revision=312688
* hyperv/hn: remove the MTU and IFF_DRV_RUNNING checking in hn_rxpkt()Dexuan Cui2017-01-241-9/+1
| | | | | | | | | | | | | | | | | | | It's unnecessary because the upper nework stack does the same checking. In the case of Hyper-V SR-IOV, we need to remove the checking because 1) multicast/broadcast packets are still received through the synthetic NIC and we need to inject the packets through the VF interface; 2) we must inject the packets even if the synthetic NIC is down, or has a different MTU from the VF device. Reviewed by: sephe Approved by: sephe (mentor) MFC after: 2 weeks Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8962 Notes: svn path=/head/; revision=312686