summaryrefslogtreecommitdiff
path: root/sys/dev/hyperv
Commit message (Collapse)AuthorAgeFilesLines
* MFC r356201:Hans Petter Selasky2020-01-061-1/+1
| | | | | | | | | | Fix spelling. PR: 242891 Sponsored by: Mellanox Technologies Notes: svn path=/stable/11/; revision=356411
* MFC r355796-r355797, r355799: kbd: defaults for get_fkeystr/diagKyle Evans2019-12-221-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The genkbd version of these remains exposed for stable branches, but keyboard drivers that just want to use the defaults can simply not provide their own. There shouldn't be any unset in the wild. r355796: kbd: provide default implementations of get_fkeystr/diag Most keyboard drivers are using the genkbd implementations as it is; formally use them for any that aren't set. r355797: chrome_kb: remove default get_fkeystr/diag implementations This file was missed in r355796, but no harm would have come from this. r355799: kbd: patch linker set methods, too This is needed after r355796. Some double-registration of kbd drivers needs to be sorted out, then this sysinit will simply add these drivers into the normal list and kill off any other bits in the driver that are aware of the linker set, for simplicity. Notes: svn path=/stable/11/; revision=356013
* MFC r355793: kbd drivers: use kbdd_* indirection for diag invocationKyle Evans2019-12-221-1/+1
| | | | Notes: svn path=/stable/11/; revision=356012
* MFC r355794: keyboard switch definitions: standardize on c99 initializersKyle Evans2019-12-221-19/+19
| | | | Notes: svn path=/stable/11/; revision=356007
* MFC r326645 (by imp): Define xpt_path_inq.Alexander Motin2019-08-081-4/+1
| | | | | | | | This provides a nice wrarpper around the XPT_PATH_INQ ccb creation and calling. Notes: svn path=/stable/11/; revision=350804
* MFC: 339585Wei Hu2018-10-291-1/+2
| | | | | | | | | | | | | | | r339585: Do not drop UDP traffic when TXCSUM_IPV6 flag is on PR: 231797 Submitted by: whu Reviewed by: dexuan Obtained from: Kevin Morse Sponsored by: Microsoft Differential Revision: https://bugs.freebsd.org/bugzilla/attachment.cgi?id=198333&action=diff Notes: svn path=/stable/11/; revision=339863
* MFC r337322:Dimitry Andric2018-08-171-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix build of hyperv with base gcc on i386 Summary: Base gcc fails to compile `sys/dev/hyperv/pcib/vmbus_pcib.c` for i386, with the following -Werror warnings: cc1: warnings being treated as errors /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'new_pcichild_device': /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:567: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'vmbus_pcib_on_channel_callback': /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:940: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'hv_pci_protocol_negotiation': /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:1012: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'hv_pci_enter_d0': /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:1073: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'hv_send_resources_allocated': /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:1125: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'vmbus_pcib_map_msi': /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:1730: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] This is because on i386, several casts from `uint64_t` to a pointer reduce the value from 64 bit to 32 bit. For gcc, this can be fixed by an intermediate cast to uintptr_t. Note that I am assuming the incoming values will always fit into 32 bit! Differential Revision: https://reviews.freebsd.org/D15753 Notes: svn path=/stable/11/; revision=337959
* MFC: 336426Dexuan Cui2018-07-231-0/+7
| | | | | | | | | | | | r336426 hyperv/hn: Fix panic in hypervisor code upon device detach event Submitted by: hselasky Reviewed by: dexuan Differential Revision: https://reviews.freebsd.org/D16139 Notes: svn path=/stable/11/; revision=336643
* MFC: 332385Dexuan Cui2018-04-241-14/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r332385: hyperv/storvsc: storvsc_io_done(): do not use CAM_SEL_TIMEOUT CAM_SEL_TIMEOUT was introduced in https://reviews.freebsd.org/D7521 (r304251), which claimed: "VM shall response to CAM layer with CAM_SEL_TIMEOUT to filter those invalid LUNs. Never use CAM_DEV_NOT_THERE which will block LUN scan for LUN number higher than 7." But it turns out this is not correct: I think what really filters the invalid LUNs in r304251 is that: before r304251, we could set the CAM_REQ_CMP without checking vm_srb->srb_status at all: ccb->ccb_h.status |= CAM_REQ_CMP. r304251 checks vm_srb->srb_status and sets ccb->ccb_h.status properly, so the invalid LUNs are filtered. I changed my code version to r304251 but replaced the CAM_SEL_TIMEOUT with CAM_DEV_NOT_THERE, and I confirmed the invalid LUNs can also be filtered, and I successfully hot-added and hot-removed 8 disks to/from the VM without any issue. CAM_SEL_TIMEOUT has an unwanted side effect -- see cam_periph_error(): For a selection timeout, we consider all of the LUNs on the target to be gone. If the status is CAM_DEV_NOT_THERE, then we only get rid of the device(s) specified by the path in the original CCB. This means: for a VM with a valid LUN on 3:0:0:0, when the VM inquires 3:0:0:1 and the host reports 3:0:0:1 doesn't exist and storvsc returns CAM_SEL_TIMEOUT to the CAM layer, CAM will detech 3:0:0:0 as well: this is the bug I reported recently: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=226583 PR: 226583 Reviewed by: mav Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D14690 Notes: svn path=/stable/11/; revision=332903
* MFC r331757: Correct comment typo in Hyper-VEd Maste2018-04-051-1/+1
| | | | | | | | PR: 226665 Submitted by: Ryo ONODERA Notes: svn path=/stable/11/; revision=332068
* Revert r330897:Eitan Adler2018-03-294-8/+0
| | | | | | | | | | | | | | | | | | | | 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) Notes: svn path=/stable/11/; revision=331722
* Partial merge of the SPDX changesEitan Adler2018-03-144-0/+8
| | | | | | | | | | These changes are incomplete but are making it difficult to determine what other changes can/should be merged. No objections from: pfg Notes: svn path=/stable/11/; revision=330897
* MFC r328083,328096,328116,328119,328120,328128,328135,328153,328157,Konstantin Belousov2018-02-173-6/+8
| | | | | | | | | | | | | | | 328166,328177,328199,328202,328205,328468,328470,328624,328625,328627, 328628,329214,329297,329365: Meltdown mitigation by PTI, PCID optimization of PTI, and kernel use of IBRS for some mitigations of Spectre. Tested by: emaste, Arshan Khanifar <arshankhanifar@gmail.com> Discussed with: jkim Sponsored by: The FreeBSD Foundation Notes: svn path=/stable/11/; revision=329462
* MFC 324517Sepherosa Ziehau2017-10-131-1/+1
| | | | | | | | | hyperv/hn: Enable transparent VF by default. Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=324579
* MFC 324489,324516Sepherosa Ziehau2017-10-135-37/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 324489 hyperv/hn: Workaround erroneous hash type observed on WS2016. 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. Sponsored by: Microsoft 324516 hyperv/hn: Workaround erroneous hash type observed on WS2016 for VF. The background was described in r324489. Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=324578
* MFC 324488Sepherosa Ziehau2017-10-132-1/+5
| | | | | | | | | hyperv/vmbus: Expose Hyper-V major version. Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=324577
* MFC 324487Sepherosa Ziehau2017-10-131-4/+17
| | | | | | | | | | | | | | | hyperv/vmbus: Add tunable to pin/unpin event tasks. 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. Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=324576
* MFC 324049,324077Sepherosa Ziehau2017-10-101-3/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | 324049 hyperv/hn: Fix UDP checksum offload issue in Azure. 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. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D12429 324077 hyperv/hn: Unbreak i386 building. Reported by: cy Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=324480
* MFC 324048Sepherosa Ziehau2017-10-102-27/+70
| | | | | | | | | | | | hyperv/hn: Set tcp header offset for CSUM/LSO offloading. No observable effect; better safe than sorry. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D12417 Notes: svn path=/stable/11/; revision=324479
* MFC 323728,323729Sepherosa Ziehau2017-10-105-4/+47
| | | | | | | | | | | | | | | | | | | | | | | 323728 hyperv/hn: Fix MTU setting - 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. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D12352 323729 hyperv/hn: Incease max supported MTU Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D12365 Notes: svn path=/stable/11/; revision=324477
* MFC 323727,324316Sepherosa Ziehau2017-10-104-56/+363
| | | | | | | | | | | | | | | | | | | | | | 323727 hyperv/hn: Apply VF's RSS setting 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. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D12333 324316 hyperv/hn: Fix options RSS building Reported by: np Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=324475
* MFC 323176Sepherosa Ziehau2017-10-101-0/+2
| | | | | | | | | | | | hyperv/hn: Log RSS capabilities mask. This helps to detect when UDP hash types can be supported. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D12177 Notes: svn path=/stable/11/; revision=324474
* MFC 323175Sepherosa Ziehau2017-10-101-0/+52
| | | | | | | | | | | | | | hyperv/hn: Implement SIOCGIFRSS{KEY,HASH}. The conditional compiling in the review request is removed, since these IOCTLs will be available in stable/10 and stable/11. Reviewed by: gallatin Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D12175 Notes: svn path=/stable/11/; revision=324473
* MFC 322488Sepherosa Ziehau2017-08-1717-17/+17
| | | | | | | | | | hyperv: Update copyright for the files changed in 2017 Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11982 Notes: svn path=/stable/11/; revision=322612
* MFC 322483,322485-322487Sepherosa Ziehau2017-08-172-45/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 322483 hyperv/hn: Update VF's ibytes properly under transparent VF mode. While, I'm here add comment about why updating VF's imcast stat is not necessary. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11948 322485 hyperv/hn: Fix/enhance receiving path when VF is activated. - 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. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11978 322486 hyperv/hn: Minor cleanup Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11979 322487 hyperv/hn: Re-set datapath after synthetic parts reattached. Do this even for non-transparent mode VF. Better safe than sorry. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11981 Notes: svn path=/stable/11/; revision=322605
* MFC 322299Sepherosa Ziehau2017-08-143-41/+811
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | hyperv/hn: Implement transparent mode network VF. 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). Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11803 Notes: svn path=/stable/11/; revision=322489
* MFC 321965Sepherosa Ziehau2017-08-071-1/+1
| | | | | | | | | | hyperv/kvp: Use proper size macro for adapter id. Submitted by: Christopher Ertl <Christopher.Ertl microsoft com> Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=322136
* MFC 321836,321837Sepherosa Ziehau2017-08-072-48/+61
| | | | | | | | | | | | | | | | | | | 321836 hyperv/hn: Renaming and minor cleanup This prepares for the upcoming transparent VF support. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11708 321837 hyperv/hn: Add comment about ether_ifattach event subscription. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11710 Notes: svn path=/stable/11/; revision=322135
* MFC 321409Sepherosa Ziehau2017-07-311-0/+1
| | | | | | | | | | | | | | hyperv/hn: Ignore LINK_SPEED_CHANGE status. 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. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11651 Notes: svn path=/stable/11/; revision=321750
* MFC 321407Sepherosa Ziehau2017-07-312-27/+280
| | | | | | | | | | | | hyperv/hn: Export VF list and VF-HN mapping The VF-HN map will be used later on to implement "transparent VF". Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11618 Notes: svn path=/stable/11/; revision=321748
* MFC 321286Sepherosa Ziehau2017-07-241-1/+18
| | | | | | | | | | | | | | | hyperv/storvsc: Force SPC3 for CDROM attached. 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> Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11634 Notes: svn path=/stable/11/; revision=321404
* MFC 320490Sepherosa Ziehau2017-07-071-1/+0
| | | | | | | | | | | | | hyperv/input: Remove unnecessary inclusion. The unbreaks gcc compilation. Submitted by: Ryan Libby Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11415 Notes: svn path=/stable/11/; revision=320765
* MFC 320184Sepherosa Ziehau2017-06-261-10/+21
| | | | | | | | | | | | | | | | | | | hyperv/storvsc: Reduce log verbosity 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. Approved by: re (delphij) PR: 219973 Submitted by: Hongjiang Zhang <hongzhan microsoft com> Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11271 Notes: svn path=/stable/11/; revision=320351
* MFC: 319690Dexuan Cui2017-06-141-0/+2
| | | | | | | | | | | | | | | | | | | Approved by: re (marius) r319690 hyperv/pcib: use the device serial number as PCI domain 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 Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=319943
* MFC 318136Sepherosa Ziehau2017-05-172-40/+156
| | | | | | | | | | | | | | | | | | | | | | | | | hyperv/vmbus: Reorganize vmbus device tree 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@ Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D10565 Notes: svn path=/stable/11/; revision=318392
* MFC 317821Sepherosa Ziehau2017-05-051-1/+1
| | | | | | | | | hyperv/kbd: Channel read expects non-NULL channel argument. Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=317822
* hyperv/hn: Enable sorted LRO (direct commit).Sepherosa Ziehau2017-05-021-1/+1
| | | | | | | | | | | This is a direct commit. Sorted LRO is much better than plain (linked list LRO), which hash LRO is not available on this branch. Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=317664
* MFC 317353Sepherosa Ziehau2017-04-271-11/+91
| | | | | | | | | | | | | | | | | | hyperv/hn: Use channel0, i.e. TX ring0, for TCP SYN/SYN|ACK. 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. Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=317481
* MFC 316813,316815Sepherosa Ziehau2017-04-192-2/+2
| | | | | | | | | | | | | | | | | 316813 hyperv/storvsc: Use ULL for 64bits value shift. Reported by: PVS Sponsored by: Microsoft 316815 hyperv/kvp: Remove always false condition. Reported by: PVS Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=317121
* MFC 316515,316812Sepherosa Ziehau2017-04-193-0/+1199
| | | | | | | | | | | | | | | | | | | | 316515 hyperv/kbd: Add support for synthetic keyboard. Synthetic keyboard is the only supported keyboard on GEN2 Hyper-V. Submitted by: Hongjiang Zhang <honzhan microsoft com> Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D10196 316812 hyperv/kbd: Remove unnecessary assignment. Reported by: PVS Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=317119
* MFC 317107Sepherosa Ziehau2017-04-191-12/+19
| | | | | | | | | | hyperv: Use kmem_malloc for hypercall memory due to NX bit change. Reported by: dexuan@ Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=317108
* MFC 316520Sepherosa Ziehau2017-04-103-31/+103
| | | | | | | | | | | | | | | | | | hyperv/hn: Fixat RNDIS rxfilter after the successful RNDIS init. 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@ Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D10230 Notes: svn path=/stable/11/; revision=316674
* MFC 316519Sepherosa Ziehau2017-04-102-8/+8
| | | | | | | | | | | | | | hyperv/storvsc: Fixup SRB status. This unbreaks GEN2 Hyper-V cd support. Submitted by: Hongjiang Zhang <honzhan microsoft com> Reviewed by: dexuan@ Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D10212 Notes: svn path=/stable/11/; revision=316673
* MFC r311305 (by asomers):Alexander Motin2017-03-231-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/stable/11/; revision=315812
* MFC: 314382-314485Sepherosa Ziehau2017-03-173-14/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 314382 hyperv/hn: Simplify RNDIS packet data offset calculation. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9699 314483 hyperv/hn: Simplify RNDIS packet total length calculation. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9712 314484 hyperv/hn: Make sure that RNDIS packet message is at least 4B aligned. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9713 314485 hyperv/hn: Misaligned chimney sending buffers should not be used Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9714 Notes: svn path=/stable/11/; revision=315436
* MFC 312689, 312690Dexuan Cui2017-02-221-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | Approved by: sephe (mentor) r312689 hyperv/hn: add a sysctl name for the VF interface This makes it easier for the userland script to find the releated VF interface. Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9101 r312690 hyperv/hn: add devctl_notify for VF_UP/DOWN events Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9102 Notes: svn path=/stable/11/; revision=314092
* MFC 312688Dexuan Cui2017-02-225-9/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | | Approved by: sephe (mentor) r312688 hyperv/hn: add the support for VF drivers (SR-IOV) 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) Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8964 Notes: svn path=/stable/11/; revision=314091
* MFC: 312686Dexuan Cui2017-02-221-9/+1
| | | | | | | | | | | | | | | | | | | | | | | Approved by: sephe (mentor) r312686 hyperv/hn: remove the MTU and IFF_DRV_RUNNING checking in hn_rxpkt() 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) Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8962 Notes: svn path=/stable/11/; revision=314084
* MFC: 312685Dexuan Cui2017-02-222-0/+3
| | | | | | | | | | | | | | | | | Approved by: sephe(mentor) r312685 hyperv/hn: remember the channel pointer in struct hn_rx_ring This will be used by the coming NIC SR-IOV patch. Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8909 Notes: svn path=/stable/11/; revision=314083
* MFC 311743Sepherosa Ziehau2017-02-215-17/+50
| | | | | | | | | | hyperv: Add method to read 64bit Hyper-V specific time value. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9057 Notes: svn path=/stable/11/; revision=314003