History log of /freebsd-head/sys/dev/hyperv/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
820bed5bb1a355f994be690e662c43bdafd7932d 31-Aug-2020 whu <whu@FreeBSD.org> Hyper-V: storvsc: Enhance srb_status code handling.

In hv_storvsc_io_request() when coring, prevent changing of the send channel
from the base channel to another one. storvsc_poll always probes on the base
channel.

Based upon conversations with Microsoft, changed the handling of srb_status
codes. Most we should never get, others yes. All are treated as retry-able
except for two. We should not get these statuses, but if we ever do, the I/O
state is not known.

Submitted by: Alexander Sideropoulos <Alexander.Sideropoulos@netapp.com>
Reviewed by: trasz, allanjude, whu
MFC after: 1 week
Sponsored by: Netapp Inc
Differential Revision: https://reviews.freebsd.org/D25756
torvsc/hv_storvsc_drv_freebsd.c
torvsc/hv_vstorage.h
cb6991c162b515096aa8ac50465ab2be1af0c372 30-Jul-2020 whu <whu@FreeBSD.org> Prevent framebuffer mmio space from being allocated to other devices on HyperV.

On Gen2 VMs, Hyper-V provides mmio space for framebuffer.
This mmio address range is not useable for other PCI devices.
Currently only efifb driver is using this range without reserving
it from system.
Therefore, vmbus driver reserves it before any other PCI device
drivers start to request mmio addresses.

PR: 222996
Submitted by: weh@microsoft.com
Reported by: dmitry_kuleshov@ukr.net
Reviewed by: decui@microsoft.com
Sponsored by: Microsoft
mbus/vmbus.c
6e1865cfa7ce6b695df8ece2526bf1ee6eb3c0e1 22-May-2020 whu <whu@FreeBSD.org> Socket AF_HYPERV should return failure when it is not running on HyperV

Reported by: pho
Sponsored by: Microsoft
vsock/hv_sock.c
46b379aa12cecba1c8f41f4e9f4c01135ddd52f0 20-May-2020 lwhsu <lwhsu@FreeBSD.org> Fix i386 build for r361275

kponsored by: The FreeBSD Foundation
vsock/hv_sock.c
mbus/vmbus_br.c
7a58be336ed276a7c0024a657b39f496d003de5d 20-May-2020 whu <whu@FreeBSD.org> HyperV socket implementation for FreeBSD

This change adds Hyper-V socket feature in FreeBSD. New socket address
family AF_HYPERV and its kernel support are added.

Submitted by: Wei Hu <weh@microsoft.com>
Reviewed by: Dexuan Cui <decui@microsoft.com>
Relnotes: yes
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D24061
vsock/hv_sock.c
vsock/hv_sock.h
nclude/vmbus.h
mbus/vmbus.c
mbus/vmbus_br.c
mbus/vmbus_brvar.h
mbus/vmbus_chan.c
mbus/vmbus_chanvar.h
mbus/vmbus_reg.h
ad355b0a9dbd6a8aabe7c081a731d24904a0f2c1 26-Feb-2020 kaktus <kaktus@FreeBSD.org> Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)

r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Mark all obvious cases as MPSAFE. All entries that haven't been marked
as MPSAFE before are by default marked as NEEDGIANT

Approved by: kib (mentor, blanket)
Commented by: kib, gallatin, melifaro
Differential Revision: https://reviews.freebsd.org/D23718
etvsc/if_hn.c
b28561216a1c7ac45c87e1dffa75d5674d442d7c 24-Feb-2020 glebius <glebius@FreeBSD.org> Although most of the NIC drivers are epoch ready, due to peer pressure
switch over to opt-in instead of opt-out for epoch.

Instead of IFF_NEEDSEPOCH, provide IFF_KNOWSEPOCH. If driver marks
itself with IFF_KNOWSEPOCH, then ether_input() would not enter epoch
when processing its packets.

Now this will create recursive entrance in epoch in >90% network
drivers, but will guarantee safeness of the transition.

Mark several tested drivers as IFF_KNOWSEPOCH.

Reviewed by: hselasky, jeff, bz, gallatin
Differential Revision: https://reviews.freebsd.org/D23674
etvsc/if_hn.c
38d2f2c7fdfcf2098ed5f8737a71ad5763dcbad3 13-Feb-2020 kib <kib@FreeBSD.org> hyperv: Add Hygon Dhyana support.

Submitted by: Pu Wen <puwen@hygon.cn>
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D23563
mbus/amd64/hyperv_machdep.c
f425ba950c4fc7491741e125d0c39334a91dcdfc 23-Jan-2020 glebius <glebius@FreeBSD.org> Introduce flag IFF_NEEDSEPOCH that marks Ethernet interfaces that
supposedly may call into ether_input() without network epoch.

They all need to be reviewed before 13.0-RELEASE. Some may need
be fixed. The flag is not planned to be used in the kernel for
a long time.
etvsc/if_hn.c
650da643c8759c9269362af48f5ad3daebf79b2d 14-Jan-2020 avg <avg@FreeBSD.org> storvsc: port a Linux patch, properly set residual data length on errors

This change is based on Linux commit 40630f462824ee. csio.resid should
account for transfer_len only for success and SRB_STATUS_DATA_OVERRUN
condition.

I am not sure how exactly this change works, but I have a report from a
user that they see lots of checksum errors when running a pool scrub
concurrently with iozone -l 1 -s 100G. After applying this patch the
problem cannot be reproduced.

Reviewed by: nobody
Sponsored by: CyberSecure
Differential Revision: https://reviews.freebsd.org/D22312
torvsc/hv_storvsc_drv_freebsd.c
torvsc/hv_vstorage.h
2b0a7441a9bd12e994024438760d26d58ad918ec 30-Dec-2019 hselasky <hselasky@FreeBSD.org> Fix spelling.

PR: 242891
MFC after: 1 week
Sponsored by: Mellanox Technologies
etvsc/if_hn.c
7ad4335d297e851a21973555433fbd17acfb8474 26-Dec-2019 kevans <kevans@FreeBSD.org> Revert r355806: kbd drivers: don't double register keyboard drivers

r356087 made it rather innocuous to double-register built-in keyboard
drivers; we now set a flag to indicate that it's been registered and only
act once on a registration anyways. There is no misleading here, as the
follow-up kbd_delete_driver will actually remove the driver as needed now
that the linker set isn't also consulted after kbdinit.
nput/hv_kbd.c
9334768587d6e18e7f5e4c386ff32a9dac363b54 16-Dec-2019 kevans <kevans@FreeBSD.org> kbd drivers: don't double register keyboard drivers

Keyboard drivers are generally registered via linker set. In these cases,
they're also available as kmods which use KPI for registering/unregistering
keyboard drivers outside of the linker set.

For built-in modules, we still fire off MOD_LOAD and maybe even MOD_UNLOAD
if an error occurs, leading to registration via linker set and at MOD_LOAD
time.

This is a minor optimization at best, but it keeps the internal kbd driver
tidy as a future change will merge the linker set driver list into its
internal keyboard_drivers list via SYSINIT and simplify driver lookup by
removing the need to consult the linker set.
nput/hv_kbd.c
7e14ccc50a1c0349aecd3006736e0a59bfdda21d 16-Dec-2019 kevans <kevans@FreeBSD.org> 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 and make
genkbd_get_fkeystr/genkbd_diag private.
nput/hv_kbd.c
a62290e68d448a2ff98bba85d1b23c187d343779 16-Dec-2019 kevans <kevans@FreeBSD.org> keyboard switch definitions: standardize on c99 initializers

A future change will provide default implementations for some of these where
it makes sense and most of them are already using the genkbd
implementation (e.g. get_fkeystr, diag).
nput/hv_kbd.c
a27fb5e94e2df4915c86d24c2236178f0e669c97 16-Dec-2019 kevans <kevans@FreeBSD.org> kbd drivers: use kbdd_* indirection for diag invocation

These invocations were directly calling enkbd_diag(), rather than
indirection back through kbdd_diag/kbdsw. While they're functionally
equivent, invoking kbdd_diag where feasible (i.e. not in a diag
implementation) makes it easier to visually identify locking needs in these
other drivers.
nput/hv_kbd.c
cbb8fbef22c341aa422746974be0522d1fd6c478 19-Nov-2019 avg <avg@FreeBSD.org> hyperv/storvsc: stash a pointer to hv_storvsc_request in ccb

A SIM-private field is used for that.
The pointer can be useful when examining a state of a queued ccb.
E.g., a ccb on a da_softc.pending_ccbs.

MFC after: 2 weeks
torvsc/hv_storvsc_drv_freebsd.c
42011dc102f61e1ed69c9ebd225a481f152ff7b1 09-Jul-2019 whu <whu@FreeBSD.org> hyperv/vmbus: Fix the wrong size in ndis_offload structure

Submitted by: whu
MFC after: 2 weeks
Sponsored by: Microsoft
etvsc/ndis.h
b16c552f6e6aa7895e654c0f7f36ff60f0b096b7 09-Jul-2019 whu <whu@FreeBSD.org> hyperv/vmbus: Update VMBus version 4.0 and 5.0 support.

Add VMBus protocol version 4.0. and 5.0 to support Windows 10 and newer HyperV hosts.

For VMBus 4.0 and newer HyperV, the netvsc gpadl teardown must be done after vmbus close.

Submitted by: whu
MFC after: 2 weeks
Sponsored by: Microsoft
nclude/hyperv.h
nclude/vmbus.h
etvsc/hn_nvs.c
etvsc/if_hn.c
mbus/vmbus.c
5499ddf2ec86a4b1480a412782d4173b3cea3b52 26-Oct-2018 takawata <takawata@FreeBSD.org> Distinguish _CID match and _HID match and make lower priority probe
when _CID match.

Reviewed by: jhb, imp
Differential Revision:https://reviews.freebsd.org/D16468
mbus/vmbus_res.c
9de81ae09f353f9149e29dbfe48005e7346e99e9 22-Oct-2018 whu <whu@FreeBSD.org> Do not trop UDP traffic when TXCSUM_IPV6 flag is on

PR: 231797
Submitted by: whu
Reviewed by: dexuan
Obtained from: Kevin Morse
MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://bugs.freebsd.org/bugzilla/attachment.cgi?id=198333&action=diff
etvsc/if_hn.c
3799d78beb4cf81baac99c1256126e10696fc4e3 25-Aug-2018 alc <alc@FreeBSD.org> Eliminate the arena parameter to kmem_free(). Implicitly this corrects an
error in the function hypercall_memfree(), where the wrong arena was being
passed to kmem_free().

Introduce a per-page flag, VPO_KMEM_EXEC, to mark physical pages that are
mapped in kmem with execute permissions. Use this flag to determine which
arena the kmem virtual addresses are returned to.

Eliminate UMA_SLAB_KRWX. The introduction of VPO_KMEM_EXEC makes it
redundant.

Update the nearby comment for UMA_SLAB_KERNEL.

Reviewed by: kib, markj
Discussed with: jeff
Approved by: re (marius)
Differential Revision: https://reviews.freebsd.org/D16845
mbus/hyperv.c
4ce21fcbeaf66e2031419afa4737448e99284ce0 21-Aug-2018 alc <alc@FreeBSD.org> Eliminate kmem_malloc()'s unused arena parameter. (The arena parameter
became unused in FreeBSD 12.x as a side-effect of the NUMA-related
changes.)

Reviewed by: kib, markj
Discussed with: jeff, re@
Differential Revision: https://reviews.freebsd.org/D16825
mbus/hyperv.c
c10831e5dc97666466e60e08a6a0e5f3929f5d28 04-Aug-2018 dim <dim@FreeBSD.org> 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
MFC after: 3 days
cib/vmbus_pcib.c
c1e9eab13f3be320ceb54e24f4e0be2173cea18f 29-Jul-2018 kib <kib@FreeBSD.org> Use SMAP on amd64.

Ifuncs selectors dispatch copyin(9) family to the suitable variant, to
set rflags.AC around userspace access. Rflags.AC bit is cleared in
all kernel entry points unconditionally even on machines not
supporting SMAP.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D13838
mbus/amd64/vmbus_vector.S
754fc2f7213885dc6dcd8d1e7a1f072516d7971c 17-Jul-2018 dexuan <dexuan@FreeBSD.org> hyperv/hn: Fix panic in hypervisor code upon device detach event

Submitted by: hselasky
Reviewed by: dexuan
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D16139
etvsc/if_hn.c
45de58405efe1d47b2ec1e0b17cda4e777db6e90 07-Jul-2018 dexuan <dexuan@FreeBSD.org> hyperv: Fix boot-up after malloc() returns memory of NX by default now

FreeBSD VM can't boot up on Hyper-V after the recent malloc change in
r335068: Make UMA and malloc(9) return non-executable memory in most cases.

The hypercall page here must be executable.
Fix the boot-up issue by adding M_EXEC.

PR: 229167
Sponsored by: Microsoft
mbus/hyperv.c
fbaec7d1e3d64be2d1e8a14727388bb68dd1e516 26-May-2018 vangyzen <vangyzen@FreeBSD.org> if_hn: fix use of uninitialized variable

omcast was used without being initialized in the non-multicast case.
The only effect was that the interface's multicast output counter could be
incorrect.

Reported by: Coverity
CID: 1379662
MFC after: 3 days
Sponsored by: Dell EMC
etvsc/if_hn.c
7aeac9ef1893e0b29408213e3a320d9d1ef28357 18-May-2018 mmacy <mmacy@FreeBSD.org> ifnet: Replace if_addr_lock rwlock with epoch + mutex

Run on LLNW canaries and tested by pho@

gallatin:
Using a 14-core, 28-HTT single socket E5-2697 v3 with a 40GbE MLX5
based ConnectX 4-LX NIC, I see an almost 12% improvement in received
packet rate, and a larger improvement in bytes delivered all the way
to userspace.

When the host receiving 64 streams of netperf -H $DUT -t UDP_STREAM -- -m 1,
I see, using nstat -I mce0 1 before the patch:

InMpps OMpps InGbs OGbs err TCP Est %CPU syscalls csw irq GBfree
4.98 0.00 4.42 0.00 4235592 33 83.80 4720653 2149771 1235 247.32
4.73 0.00 4.20 0.00 4025260 33 82.99 4724900 2139833 1204 247.32
4.72 0.00 4.20 0.00 4035252 33 82.14 4719162 2132023 1264 247.32
4.71 0.00 4.21 0.00 4073206 33 83.68 4744973 2123317 1347 247.32
4.72 0.00 4.21 0.00 4061118 33 80.82 4713615 2188091 1490 247.32
4.72 0.00 4.21 0.00 4051675 33 85.29 4727399 2109011 1205 247.32
4.73 0.00 4.21 0.00 4039056 33 84.65 4724735 2102603 1053 247.32

After the patch

InMpps OMpps InGbs OGbs err TCP Est %CPU syscalls csw irq GBfree
5.43 0.00 4.20 0.00 3313143 33 84.96 5434214 1900162 2656 245.51
5.43 0.00 4.20 0.00 3308527 33 85.24 5439695 1809382 2521 245.51
5.42 0.00 4.19 0.00 3316778 33 87.54 5416028 1805835 2256 245.51
5.42 0.00 4.19 0.00 3317673 33 90.44 5426044 1763056 2332 245.51
5.42 0.00 4.19 0.00 3314839 33 88.11 5435732 1792218 2499 245.52
5.44 0.00 4.19 0.00 3293228 33 91.84 5426301 1668597 2121 245.52

Similarly, netperf reports 230Mb/s before the patch, and 270Mb/s after the patch

Reviewed by: gallatin
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D15366
etvsc/if_hn.c
e3089a0318da0fd3fcf84a63442d9d5cf9c78911 13-Apr-2018 kib <kib@FreeBSD.org> i386 4/4G split.

The change makes the user and kernel address spaces on i386
independent, giving each almost the full 4G of usable virtual addresses
except for one PDE at top used for trampoline and per-CPU trampoline
stacks, and system structures that must be always mapped, namely IDT,
GDT, common TSS and LDT, and process-private TSS and LDT if allocated.

By using 1:1 mapping for the kernel text and data, it appeared
possible to eliminate assembler part of the locore.S which bootstraps
initial page table and KPTmap. The code is rewritten in C and moved
into the pmap_cold(). The comment in vmparam.h explains the KVA
layout.

There is no PCID mechanism available in protected mode, so each
kernel/user switch forth and back completely flushes the TLB, except
for the trampoline PTD region. The TLB invalidations for userspace
becomes trivial, because IPI handlers switch page tables. On the other
hand, context switches no longer need to reload %cr3.

copyout(9) was rewritten to use vm_fault_quick_hold(). An issue for
new copyout(9) is compatibility with wiring user buffers around sysctl
handlers. This explains two kind of locks for copyout ptes and
accounting of the vslock() calls. The vm_fault_quick_hold() AKA slow
path, is only tried after the 'fast path' failed, which temporary
changes mapping to the userspace and copies the data to/from small
per-cpu buffer in the trampoline. If a page fault occurs during the
copy, it is short-circuit by exception.s to not even reach C code.

The change was motivated by the need to implement the Meltdown
mitigation, but instead of KPTI the full split is done. The i386
architecture already shows the sizing problems, in particular, it is
impossible to link clang and lld with debugging. I expect that the
issues due to the virtual address space limits would only exaggerate
and the split gives more liveness to the platform.

Tested by: pho
Discussed with: bde
Sponsored by: The FreeBSD Foundation
MFC after: 1 month
Differential revision: https://reviews.freebsd.org/D14633
mbus/i386/vmbus_vector.S
922c675756c4308d7820ea5b2ee4146f7bbdf30e 10-Apr-2018 dexuan <dexuan@FreeBSD.org> 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
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D14690
torvsc/hv_storvsc_drv_freebsd.c
b3c581c6350c2c5b2946c151e5d5129a266a2b38 30-Mar-2018 emaste <emaste@FreeBSD.org> Correct comment typo in Hyper-V

PR: 226665
Submitted by: Ryo ONODERA
MFC after: 3 days
mbus/hyperv.c
6fe54a534393de74240a489e0ad0c2a20005a03e 20-Mar-2018 emaste <emaste@FreeBSD.org> Rename assym.s to assym.inc

assym is only to be included by other .s files, and should never
actually be assembled by itself.

Reviewed by: imp, bdrewery (earlier)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D14180
mbus/amd64/vmbus_vector.S
mbus/i386/vmbus_vector.S
c35d24e497ef2fa5d08a59ddb20123e9d9f58cc4 17-Jan-2018 kib <kib@FreeBSD.org> PTI for amd64.

The implementation of the Kernel Page Table Isolation (KPTI) for
amd64, first version. It provides a workaround for the 'meltdown'
vulnerability. PTI is turned off by default for now, enable with the
loader tunable vm.pmap.pti=1.

The pmap page table is split into kernel-mode table and user-mode
table. Kernel-mode table is identical to the non-PTI table, while
usermode table is obtained from kernel table by leaving userspace
mappings intact, but only leaving the following parts of the kernel
mapped:

kernel text (but not modules text)
PCPU
GDT/IDT/user LDT/task structures
IST stacks for NMI and doublefault handlers.

Kernel switches to user page table before returning to usermode, and
restores full kernel page table on the entry. Initial kernel-mode
stack for PTI trampoline is allocated in PCPU, it is only 16
qwords. Kernel entry trampoline switches page tables. then the
hardware trap frame is copied to the normal kstack, and execution
continues.

IST stacks are kept mapped and no trampoline is needed for
NMI/doublefault, but of course page table switch is performed.

On return to usermode, the trampoline is used again, iret frame is
copied to the trampoline stack, page tables are switched and iretq is
executed. The case of iretq faulting due to the invalid usermode
context is tricky, since the frame for fault is appended to the
trampoline frame. Besides copying the fault frame and original
(corrupted) frame to kstack, the fault frame must be patched to make
it look as if the fault occured on the kstack, see the comment in
doret_iret detection code in trap().

Currently kernel pages which are mapped during trampoline operation
are identical for all pmaps. They are registered using
pmap_pti_add_kva(). Besides initial registrations done during boot,
LDT and non-common TSS segments are registered if user requested their
use. In principle, they can be installed into kernel page table per
pmap with some work. Similarly, PCPU can be hidden from userspace
mapping using trampoline PCPU page, but again I do not see much
benefits besides complexity.

PDPE pages for the kernel half of the user page tables are
pre-allocated during boot because we need to know pml4 entries which
are copied to the top-level paging structure page, in advance on a new
pmap creation. I enforce this to avoid iterating over the all
existing pmaps if a new PDPE page is needed for PTI kernel mappings.
The iteration is a known problematic operation on i386.

The need to flush hidden kernel translations on the switch to user
mode make global tables (PG_G) meaningless and even harming, so PG_G
use is disabled for PTI case. Our existing use of PCID is
incompatible with PTI and is automatically disabled if PTI is
enabled. PCID can be forced on only for developer's benefit.

MCE is known to be broken, it requires IST stack to operate completely
correctly even for non-PTI case, and absolutely needs dedicated IST
stack because MCE delivery while trampoline did not switched from PTI
stack is fatal. The fix is pending.

Reviewed by: markj (partially)
Tested by: pho (previous version)
Discussed with: jeff, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
mbus/amd64/vmbus_vector.S
mbus/i386/vmbus_vector.S
mbus/vmbus.c
e3a601760bd315d6762cb31fa859b304317d577f 06-Dec-2017 imp <imp@FreeBSD.org> Define xpt_path_inq.

This provides a nice wrarpper around the XPT_PATH_INQ ccb creation and
calling.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D13387
torvsc/hv_storvsc_drv_freebsd.c
1537078d8f2e62e82de3c08bdcae0fd79dc35a4a 27-Nov-2017 pfg <pfg@FreeBSD.org> sys/dev: further adoption of SPDX licensing ID tags.

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.
nclude/hyperv.h
torvsc/hv_storvsc_drv_freebsd.c
torvsc/hv_vstorage.h
tilities/hv_kvp.h
74acc5b16c2f2a31aef02e84914301a738a54a92 11-Oct-2017 sephe <sephe@FreeBSD.org> hyperv/hn: Enable transparent VF by default.

MFC after: 3 days
Sponsored by: Microsoft
etvsc/if_hn.c
6366e7bab0bd5bea094d10f1fe6a37490411612a 11-Oct-2017 sephe <sephe@FreeBSD.org> hyperv/hn: Workaround erroneous hash type observed on WS2016 for VF.

The background was described in r324489.

MFC after: 3 days
Sponsored by: Microsoft
etvsc/hn_rndis.c
etvsc/if_hn.c
etvsc/ndis.h
be6e0310105f164c393926b0520c5f4d856eb27a 10-Oct-2017 sephe <sephe@FreeBSD.org> 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.

MFC after: 3 days
Sponsored by: Microsoft
etvsc/hn_nvs.c
etvsc/if_hn.c
etvsc/if_hnvar.h
5a41a31fdad74308d308ce0a66e338ba5e3fd079 10-Oct-2017 sephe <sephe@FreeBSD.org> hyperv/vmbus: Expose Hyper-V major version.

MFC after: 3 days
Sponsored by: Microsoft
nclude/hyperv.h
mbus/hyperv.c
a2497afcb7ab2d72c3c18261f146be5ce95c63c6 10-Oct-2017 sephe <sephe@FreeBSD.org> 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.

MFC after: 3 days
Sponsored by: Microsoft
mbus/vmbus.c
e521cc6466669ecdef3dd61276fba62653053ff7 05-Oct-2017 sephe <sephe@FreeBSD.org> hyperv/hn: Fix options RSS building

Reported by: np
MFC after: 1 week
Sponsored by: Microsoft
etvsc/if_hn.c
11859da3f988f7a443e1fe2540d75989350631d8 28-Sep-2017 sephe <sephe@FreeBSD.org> hyperv/hn: Unbreak i386 building.

Reported by: cy
MFC after: 1 week
Sponsored by: Microsoft
etvsc/if_hn.c
b69ef721ad60c6cab4e287b8c037b084d900f3f8 27-Sep-2017 sephe <sephe@FreeBSD.org> 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.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D12429
etvsc/if_hn.c
8fc41247cb6dcb6e27d417024c003ff5e8576cb2 27-Sep-2017 sephe <sephe@FreeBSD.org> hyperv/hn: Set tcp header offset for CSUM/LSO offloading.

No observable effect; better safe than sorry.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D12417
etvsc/if_hn.c
etvsc/ndis.h
74e7b4226c51b7ef765362311609e00ec3d8e98c 19-Sep-2017 sephe <sephe@FreeBSD.org> hyperv/hn: Incease max supported MTU

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D12365
etvsc/if_hnvar.h
284eaa3f705a12169d9006d2d249e6feeac631e5 19-Sep-2017 sephe <sephe@FreeBSD.org> 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.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D12352
etvsc/hn_nvs.c
etvsc/hn_rndis.c
etvsc/hn_rndis.h
etvsc/if_hn.c
becc8347a803f11f1c364f591009a2b0a683dcb6 19-Sep-2017 sephe <sephe@FreeBSD.org> 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.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D12333
etvsc/hn_rndis.c
etvsc/if_hn.c
etvsc/if_hnvar.h
etvsc/ndis.h
ab9d242c8d9454177ef6b1acdc1e90edb3b67e4d 05-Sep-2017 sephe <sephe@FreeBSD.org> hyperv/hn: Log RSS capabilities mask.

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
etvsc/hn_rndis.c
464b6d24883d73dcad66d18ff76dac7af99bd62e 05-Sep-2017 sephe <sephe@FreeBSD.org> 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
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D12175
etvsc/if_hn.c
6a2d79f56bfd04c47d8cdf22578828cfbe1466ca 14-Aug-2017 sephe <sephe@FreeBSD.org> hyperv: Update copyright for the files changed in 2017

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11982
nclude/hyperv.h
etvsc/hn_nvs.c
etvsc/hn_nvs.h
etvsc/hn_rndis.c
etvsc/hn_rndis.h
etvsc/if_hn.c
etvsc/if_hnreg.h
etvsc/if_hnvar.h
cib/vmbus_pcib.c
torvsc/hv_storvsc_drv_freebsd.c
torvsc/hv_vstorage.h
tilities/hv_kvp.c
tilities/vmbus_timesync.c
mbus/amd64/hyperv_machdep.c
mbus/hyperv.c
mbus/vmbus.c
mbus/vmbus_et.c
a4ceea128a68a76453252a31dd36a2eb8b74629c 14-Aug-2017 sephe <sephe@FreeBSD.org> hyperv/hn: Re-set datapath after synthetic parts reattached.

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
etvsc/if_hn.c
3142e35944630824d2148249a38b845e63d22ae4 14-Aug-2017 sephe <sephe@FreeBSD.org> hyperv/hn: Minor cleanup

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11979
etvsc/if_hn.c
744451beeff892f1b30f25cd75467acef5cd3d6d 14-Aug-2017 sephe <sephe@FreeBSD.org> 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.

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11978
etvsc/if_hn.c
etvsc/if_hnvar.h
19ec4cf79d4e2629e372b32c2f9c75af2b9506be 14-Aug-2017 sephe <sephe@FreeBSD.org> 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.

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11948
etvsc/if_hn.c
4b42c6e8a428d4e3cd3e3a180229e8d1c84f4aec 09-Aug-2017 sephe <sephe@FreeBSD.org> 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).

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11803
etvsc/if_hn.c
etvsc/if_hnreg.h
etvsc/if_hnvar.h
5863c3132c82f4c107a40cdeb1bc13ef3aec67da 03-Aug-2017 sephe <sephe@FreeBSD.org> hyperv/kvp: Use proper size macro for adapter id.

Submitted by: Christopher Ertl <Christopher.Ertl microsoft com>
MFC after: 3 days
Sponsored by: Microsoft
tilities/hv_kvp.c
571da5685cbcf677d1b3b8f26c7bfb946a29e60a 01-Aug-2017 sephe <sephe@FreeBSD.org> hyperv/hn: Add comment about ether_ifattach event subscription.

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11710
etvsc/if_hn.c
f1555b6b440f069d650c449d7e11b94a5e2ed5fd 01-Aug-2017 sephe <sephe@FreeBSD.org> hyperv/hn: Renaming and minor cleanup

This prepares for the upcoming transparent VF support.

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11708
etvsc/if_hn.c
etvsc/if_hnvar.h
f305deb3bcf2ddb3ecba0c7f12a8dccd72dfd427 24-Jul-2017 sephe <sephe@FreeBSD.org> 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.

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11651
etvsc/if_hn.c
e57775e637415e03a78a37ef1ed7bbabbef3cdd0 24-Jul-2017 sephe <sephe@FreeBSD.org> hyperv/hn: Export VF list and VF-HN mapping

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
etvsc/if_hn.c
etvsc/if_hnvar.h
4d77702aa0567b4d2bd81d13e1a98dc574ff4b5e 20-Jul-2017 sephe <sephe@FreeBSD.org> 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>
MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11634
torvsc/hv_storvsc_drv_freebsd.c
d1caaa930005d8e83736591419549f62a1596d76 01-Jul-2017 jah <jah@FreeBSD.org> Clean up MD pollution of bus_dma.h:

--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
torvsc/hv_storvsc_drv_freebsd.c
94aedec1e5d8a688205dc5bf991c207180e040e2 30-Jun-2017 sephe <sephe@FreeBSD.org> hyperv/input: Remove unnecessary inclusion.

The unbreaks gcc compilation.

Submitted by: Ryan Libby
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11415
nput/hv_kbdc.c
4323de0de82e5a6a6e4ed515fd869129d1b8ea82 21-Jun-2017 sephe <sephe@FreeBSD.org> 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.

PR: 219973
Submitted by: Hongjiang Zhang <hongzhan microsoft com>
MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11271
torvsc/hv_storvsc_drv_freebsd.c
dfcaf984ee86e37e196011a5f73afe7291fbad4f 08-Jun-2017 dexuan <dexuan@FreeBSD.org> 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
MFC after: 1 day
Sponsored by: Microsoft
cib/vmbus_pcib.c
5877c4f28d28aefa32b2f1f05bd9bdcee2b15399 10-May-2017 sephe <sephe@FreeBSD.org> 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@
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D10565
mbus/vmbus.c
mbus/vmbus_res.c
067e38e286da60d9bed0ad623f807a5577e695f6 05-May-2017 sephe <sephe@FreeBSD.org> hyperv/kbd: Channel read expects non-NULL channel argument.

MFC after: now
Sponsored by: Microsoft
nput/hv_kbd.c
91a23f2d4a05ddcc5a012d2dc8f0c1b2f59a0f1c 24-Apr-2017 sephe <sephe@FreeBSD.org> 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.

MFC after: 3 days
Sponsored by: Microsoft
etvsc/if_hn.c
db3fd9c10a1fab3ee2b290af80d32a88d4433946 19-Apr-2017 sephe <sephe@FreeBSD.org> hyperv: Use kmem_malloc for hypercall memory due to NX bit change.

Reported by: dexuan@
MFC after: now
Sponsored by: Microsoft
mbus/hyperv.c
792d8e91e0bc2592e738ab21a4f15286d49ac056 14-Apr-2017 sephe <sephe@FreeBSD.org> hyperv/kvp: Remove always false condition.

Reported by: PVS
MFC after: 3 days
Sponsored by: Microsoft
tilities/hv_kvp.c
d63cadf8968391537a0f8dbb505576920fbf6a68 14-Apr-2017 sephe <sephe@FreeBSD.org> hyperv/storvsc: Use ULL for 64bits value shift.

Reported by: PVS
MFC after: 3 days
Sponsored by: Microsoft
torvsc/hv_storvsc_drv_freebsd.c
12926ed8ea8173f65bbf513f86764124bb58d09a 14-Apr-2017 sephe <sephe@FreeBSD.org> hyperv/kbd: Remove unnecessary assignment.

Reported by: PVS
MFC after: 3 days
Sponsored by: Microsoft
nput/hv_kbdc.c
27e51e25757600613a980aaaf34a8e3b0603e677 05-Apr-2017 sephe <sephe@FreeBSD.org> 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@
MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D10230
etvsc/hn_rndis.c
etvsc/hn_rndis.h
etvsc/if_hn.c
3d99062ca4018807d3243d57da21d5bb1233fc2e 05-Apr-2017 sephe <sephe@FreeBSD.org> hyperv/storvsc: Fixup SRB status.

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
torvsc/hv_storvsc_drv_freebsd.c
torvsc/hv_vstorage.h
8da6a9ea752e2ae86ce48992bc1c8a8def9b3bcf 05-Apr-2017 sephe <sephe@FreeBSD.org> 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>
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D10196
nput/hv_kbd.c
nput/hv_kbdc.c
nput/hv_kbdc.h
bf0a3b4be655e975fe2cb234dbc482df75c20ab3 01-Mar-2017 sephe <sephe@FreeBSD.org> hyperv/hn: Misaligned chimney sending buffers should not be used

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D9714
etvsc/hn_nvs.c
357eaaacb0d93f557c12e1951c82de6be0649a97 01-Mar-2017 sephe <sephe@FreeBSD.org> hyperv/hn: Make sure that RNDIS packet message is at least 4B aligned.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D9713
etvsc/hn_rndis.c
f72c601aa292d59f84791e7bdcefca43dc454bdb 01-Mar-2017 sephe <sephe@FreeBSD.org> hyperv/hn: Simplify RNDIS packet total length calculation.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D9712
etvsc/if_hn.c
2e63fa086761755b3079fc8df74a6105caa98a2e 28-Feb-2017 sephe <sephe@FreeBSD.org> hyperv/hn: Simplify RNDIS packet data offset calculation.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D9699
etvsc/if_hn.c
ce9844cd72f107687918332f8fd4a9387282b349 25-Feb-2017 imp <imp@FreeBSD.org> Convert PCIe Hot Plug to using pci_request_feature

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
cib/vmbus_pcib.c
76cd3d132849e818eb8d6c6ba081b6553c000d08 24-Jan-2017 dexuan <dexuan@FreeBSD.org> hyperv/hn: add devctl_notify for VF_UP/DOWN events

Reviewed by: sephe
Approved by: sephe (mentor)
MFC after: 2 weeks
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D9102
etvsc/if_hn.c
66d60a991233e55d274c21aa8623b2dbf68ecd88 24-Jan-2017 dexuan <dexuan@FreeBSD.org> 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)
MFC after: 2 weeks
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D9101
etvsc/if_hn.c
0d205f947a262bd0cde2bfa4d783ad66fe50fb92 24-Jan-2017 dexuan <dexuan@FreeBSD.org> 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)
MFC after: 2 weeks
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8964
etvsc/hn_nvs.c
etvsc/hn_nvs.h
etvsc/if_hn.c
etvsc/if_hnreg.h
etvsc/if_hnvar.h
e6a11a0e4e5cef1ea287c9554944aec6083701b1 24-Jan-2017 dexuan <dexuan@FreeBSD.org> 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)
MFC after: 2 weeks
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8962
etvsc/if_hn.c
efde53fa0cd75dd049482d7381b7d48252abb2b6 24-Jan-2017 dexuan <dexuan@FreeBSD.org> 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)
MFC after: 2 weeks
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8909
etvsc/if_hn.c
etvsc/if_hnvar.h
5f62cf7ec46eead86e2bcdd939d225683d4d4e27 09-Jan-2017 sephe <sephe@FreeBSD.org> hyperv: Add method to read 64bit Hyper-V specific time value.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D9057
nclude/hyperv.h
tilities/vmbus_timesync.c
mbus/amd64/hyperv_machdep.c
mbus/hyperv.c
mbus/vmbus_et.c
2d89a50f96f54f0f3d4408dc71f81cc51258125c 04-Jan-2017 asomers <asomers@FreeBSD.org> 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
Reviewed by: imp, sephe, slm
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9037
Differential Revision: https://reviews.freebsd.org/D9038
torvsc/hv_storvsc_drv_freebsd.c
39facbac7a1a94c8e80b792b46e1af9a2c0e268a 28-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Factor out function to set rxfilter.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8928
etvsc/if_hn.c
5aa4a394c9331ff66bae8afef03b5959a84860ce 28-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Function renaming; no functional changes.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8908
etvsc/if_hn.c
c9b5e5f0a8bf98605ae6a9dfd15e2136dad3a06f 28-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Consolidate hn_{suspend,resume}

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8907
etvsc/if_hn.c
3e7ea7675d8df130057059f93e3a5303e72279dc 28-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Nuke unnecessary critical sections.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8906
mbus/vmbus.c
mbus/vmbus_chan.c
mbus/vmbus_var.h
e85634d2d08f77e52ba88fa704bd428afe9c4044 23-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/ic: Allow applying the samples from hypervisor unconditionally.

MFC after: 1 week
Sponsored by: Microsoft
tilities/vmbus_timesync.c
11f244c4d5e4504331a0d1650559df8e721e2fa3 23-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/ic: Fix version4 timesync message format.

It is not compat w/ the old timesync message format, which the message
type stays the same as the old timesync message.

MFC after: 1 week
Sponsored by: Microsoft
tilities/vmbus_icreg.h
tilities/vmbus_timesync.c
e73132be3979d19cebc4d380ae0239a76a0f089e 21-Dec-2016 sephe <sephe@FreeBSD.org> hyperv: Unbreak EARLY_AP_STARUP Hyper-V bootstrap by using intrhook

Properly working pause and friends are required.

MFC after: 3 days
Sponsored by: Microsoft
mbus/vmbus.c
mbus/vmbus_var.h
81b01fc0f3852efdf8439b99c9a49c5e6509d5c4 21-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/storvsc: The max channel in PDU actually means the max sub-chans.

Use proper name for local variables. PDU fields' name was not changed yet.
While I'm here, make # of usable channels tunable. This eases further
testing.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8851
torvsc/hv_storvsc_drv_freebsd.c
74ff94765ee4106aafe202f8e370d5ce585d3e36 20-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/ic: Rename cleaned up files.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8850
tilities/hv_heartbeat.c
tilities/hv_shutdown.c
tilities/hv_timesync.c
tilities/vmbus_heartbeat.c
tilities/vmbus_shutdown.c
tilities/vmbus_timesync.c
1e8a5107d05e4b4d2b3c9c4eef5c17a8dc87fadc 20-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/ic: Cleanup driver glue.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8849
tilities/hv_heartbeat.c
tilities/hv_shutdown.c
tilities/hv_timesync.c
ccc1d74c5c2b71e0307e2366a798505e4fa28d39 20-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/ic: Rname cleaned up file.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8848
tilities/hv_util.c
tilities/vmbus_ic.c
e8eb94da16e075d7b395fd9b9fc5fad7f1d968d3 20-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/ic: Inclusion cleanup

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8847
tilities/hv_heartbeat.c
tilities/hv_shutdown.c
tilities/hv_timesync.c
tilities/hv_util.c
fca200a88ae9fbd2d8f4102978dc82ebbeb55488 20-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/ic: Rename cleaned up header file.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8846
tilities/hv_heartbeat.c
tilities/hv_kvp.c
tilities/hv_shutdown.c
tilities/hv_snapshot.c
tilities/hv_timesync.c
tilities/hv_util.c
tilities/hv_util.h
tilities/vmbus_icvar.h
3d66160304e937a632e787e3b661110cd0115ab3 20-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/ic: Cleanup common struct and functions.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8845
tilities/hv_heartbeat.c
tilities/hv_kvp.c
tilities/hv_shutdown.c
tilities/hv_snapshot.c
tilities/hv_timesync.c
tilities/hv_util.c
tilities/hv_util.h
e4bb7a507b045a4a5efbf6c03908da4b9fe240af 20-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/ic: Factor out function to send IC response

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8844
tilities/hv_heartbeat.c
tilities/hv_shutdown.c
tilities/hv_timesync.c
tilities/hv_util.c
tilities/hv_util.h
25e2f312328ff891b009d7aae2bcb44c110b32d8 19-Dec-2016 sephe <sephe@FreeBSD.org> hyperv: Implement userspace gettimeofday(2) with Hyper-V reference TSC

This 6 times gettimeofday performance, as measured by
tools/tools/syscall_timing

Reviewed by: kib
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8789
mbus/amd64/hyperv_machdep.c
43a02131947097389a971434f30b4627962ea721 15-Dec-2016 sephe <sephe@FreeBSD.org> hyperv: Allow userland to ro-mmap reference TSC page

This paves way to implement VDSO for the enlightened time counter.

Reviewed by: kib
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8768
nclude/hyperv.h
mbus/amd64/hyperv_machdep.c
mbus/hyperv_reg.h
aa25f6d75301bf84bf92c2600b98c87a62538d8b 14-Dec-2016 sephe <sephe@FreeBSD.org> hyperv: Implement "enlightened" time counter, which is rdtsc based.

Reviewed by: kib
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8763
nclude/hyperv.h
mbus/amd64/hyperv_machdep.c
mbus/hyperv_reg.h
e3c83e4556db162d5b54833d2e9974a1152394eb 12-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Add polling support

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8739
etvsc/if_hn.c
etvsc/if_hnvar.h
39150ad6fb258c15eebaf30f35c4161e5dc0bb86 12-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Add channel polling support.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8738
nclude/vmbus.h
mbus/vmbus_chan.c
mbus/vmbus_chanvar.h
80c55f08a05ab3b26a73b226ccb56adc3122a55c 09-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/storvsc: Minor style changes; no functional changes.

Reported by: rpokala
MFC after: 1 week
Sponsored by: Microsoft
torvsc/hv_storvsc_drv_freebsd.c
c7444a12c9275ab0b0aac38ead1781199e18f441 09-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/storvsc: Fix the SCSI disk attachment issue.

On pre-WS2016 Hyper-V, if the only LUNs > 7 are used, then all disks
fails to attach. Mainly because those versions of Hyper-V do not set
SRB_STATUS properly and deliver junky INQUERY responses.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
Reported by: Hongxiong Xian <v-hoxian microsoft com>
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8724
torvsc/hv_storvsc_drv_freebsd.c
6091327a9bff85a6725d3737785e9f256b9b31c2 08-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/timesync: Support "sent TC" to improve accuracy.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8723
nclude/hyperv.h
tilities/hv_timesync.c
tilities/vmbus_icreg.h
mbus/hyperv_reg.h
mbus/hyperv_var.h
mbus/vmbus_et.c
092f1602f50b9a6ad9b323468b7a9b62ef587afb 08-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Utilize vmbus_chan_run_task()

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8686
mbus/vmbus_chan.c
f980a6124c06e08bf1686e5aaec46c6dd39960f4 07-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Use pause if possible.

This makes booting on Hyper-V w/ small # of vCPUs work properly.

Reported by: Hongxiong Xian <v-hoxian microsoft com>, Hongjiang Zhang <honzhan microsoft com>
MFC after: 1 week
Sponsored by: Microsoft
mbus/vmbus_chan.c
d00d549125acd389e5508e4d995d9a37b8200aef 01-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Add 'options RSS' support.

Reviewed by: adrian
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8676
etvsc/if_hn.c
95dbf6d04affccdc5218e61dd8029ad32903a6ec 01-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Don't hold txdesc, if no BPFs are attached.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8675
etvsc/if_hn.c
a3a423047cc360d92c22c0e9abdac38464f2cb73 01-Dec-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Add HN_DEBUG kernel option.

If bufring is used for per-TX ring descs, don't update "available"
counter, which is only used to help debugging.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8674
etvsc/if_hn.c
7d2e0ee5fa4740eff22266aa34689720e1a363b5 30-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/storvsc: Don't use timedwait.

The timeout is unnecessary.

Reviewed by: jhb
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8656
torvsc/hv_storvsc_drv_freebsd.c
e7498d2d46b749f1e206e552117e41cd913a9cef 30-Nov-2016 sephe <sephe@FreeBSD.org> hypver/vmbus: Remove extra assertion.

It is asserted by vmbus_chan_gpadl_connect() now.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8660
mbus/vmbus_chan.c
8a84dc62058c7c9d182d46fa393a899fabffb15e 30-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Allow TX to share event taskqueues.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8659
etvsc/if_hn.c
4497d765e2492ea42be0fdf829a7e9b73123dcb1 30-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Add DEVMETHOD to map cpu to event taskq.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8658
mbus/vmbus.c
mbus/vmbus_if.m
06bb1b5f322152c7ef213c3472a993f60e615e96 30-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Allow multiple TX taskqueues.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8655
etvsc/if_hn.c
etvsc/if_hnvar.h
738c61bc0ed66674eec81f7a0bd507afd51263e8 30-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Nuke the unused TX taskqueue CPU binding tunable.

It was an experimental tunable, and is now deemed to be road blocker
for further changes. Time to retire it.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8654
etvsc/if_hn.c
87c91dcad254e889ae8a4cecc88d35883ce84914 28-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Use poll/cancel APIs to wait for the CHOPEN response.

Since hypervisor does not respond CHOPEN to a revoked channel.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8636
mbus/vmbus_chan.c
8124601f7090e9c8643177761c10397f9acf45b3 28-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Add exec cancel support for message Hypercall API.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8635
mbus/vmbus.c
mbus/vmbus_var.h
fe7c9942431eb762b484281caf6d97ff0979a6bc 28-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Add result polling support for message Hypercall API.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8634
mbus/vmbus.c
mbus/vmbus_var.h
7ad79e66adbc814922402450e179ef816862a941 28-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Add result polling support for xact API.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8633
nclude/vmbus_xact.h
mbus/vmbus_xact.c
0197a06a52b9058337219d2cbc45e8cba0632ec0 28-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Stringent GPADL parameter assertion.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8632
mbus/vmbus_chan.c
677c0a73d820013a25e72ab40016da7f03a964b7 28-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Make sure that the allocated GPADL is not zero.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8631
mbus/vmbus.c
8d4258a0ce237722d9fa794a769a834a67c57dd8 28-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Simplify RSS indirect table fixup API

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8630
etvsc/if_hn.c
72bc625d67a79de55125ce8ea7570607882f59f8 28-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Fix vmbus_chan_subidx usage.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8629
etvsc/if_hn.c
31e5d78146de9014169cc0376fe0ca433e481ff8 28-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Enable multi-packet RNDIS message support by default.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8621
etvsc/if_hn.c
41af246c4337880cb34fde5db3d13deadef27f36 28-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Fix attach error handling

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8620
etvsc/hn_nvs.c
etvsc/hn_rndis.c
etvsc/if_hn.c
d01f31829b251bdc25f7394d7cf8986a91545dae 28-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Fix multi-packet RNDIS message aggregation size setting.

Just in case that no chimney sending buffer can be used.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8619
etvsc/if_hn.c
9c0617e0cd6a48f889bbcdf62ee2870fb5f4df11 28-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Fix detach error handling.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8613
etvsc/hn_nvs.c
etvsc/if_hn.c
etvsc/if_hnvar.h
7379c46064ba8c0c4146a65499c07d303c6eebd3 28-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Utilize vmbus_chan_xact_wait

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8612
etvsc/hn_nvs.c
etvsc/hn_rndis.c
b8a9c2fa2472191f3f694f1bf094ebe77846bf64 28-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Add supportive transaction wait function.

This function supports channel revocation properly.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8611
nclude/vmbus.h
mbus/vmbus_chan.c
c04f9daaadb6cf6671f1731b3a7fab6ed1b95d7b 28-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Zero out GPADL if error happens.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8601
mbus/vmbus_chan.c
c587e876ec32761f1fc8c7c88de9b2dc5c489f8b 25-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Add a simplified version of channel close.

So that the caller can know the channel close error and react accordingly.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8600
nclude/vmbus.h
mbus/vmbus_chan.c
898548e1d55b8cb1fa8b2737eb82177af22be767 25-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Propagate close error.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8599
mbus/vmbus_chan.c
845be7922119a6e81c43cafec403423de115e1ee 25-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Always try disconnect/free bufring memory upon channel close

While I'm here, minor wording and style changes.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8598
mbus/vmbus_chan.c
043a26ce245598610987ef46ca8506979bc7da0d 25-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Don't free the bufring if its GPADL can't be disconnected.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8570
mbus/vmbus_chan.c
37e0317e88ab69e4af94b9b8ee49618041d88ae1 25-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Return EISCONN if the bufring GPADL can't be disconnected.

So that the callers of vmbus_chan_open_br() could handle the passed in
bufring memory properly.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8569
nclude/vmbus.h
mbus/vmbus_chan.c
a2c9690ced82072a882ccc1267e89f654ef4b56e 25-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: No stranded bufring GPADL is allowed.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8568
mbus/vmbus_chan.c
9fb540c5891e94a4f31465cf9fe40537e04d32b3 25-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: GPADL disconnect error on a revoked channel is benign.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8567
mbus/vmbus_chan.c
b296d71f70ab5934e245e1a2e0f5a0d01d8b6c51 25-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Don't close unopened channels.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8566
mbus/vmbus_chan.c
34312086a052b94f0df01086a50b7c61950d0b52 25-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Fix sysctl tree leakage, if channel open fails.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8565
mbus/vmbus_chan.c
30eee36619f4e103bca74052cead5fb38d6b0828 25-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Minor style changes.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8564
mbus/vmbus_chan.c
8540461bc28cd55c44326f88fe3edcf36345ed4a 25-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Commit the GPADL id only after the connection succeeds.

Minor style change.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8563
mbus/vmbus_chan.c
9a27398b752ca54b8f78b0dfe49a11a8473a2b54 25-Nov-2016 dexuan <dexuan@FreeBSD.org> hyperv/vmbus,pcib: unbreak build in case NEW_PCIB is undefined

vmbus_pcib requires NEW_PCIB, but in case that's not defined, we at
least shouldn't break build.

Reviewed by: sephe
Approved by: sephe (mentor)
MFC after: 3 days
Sponsored by: Microsoft
cib/vmbus_pcib.c
mbus/vmbus.c
mbus/vmbus_var.h
d38ed1a5651e009ec926d896f4ed6947163c26d8 24-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Fix primary channel revocation

Since hypervisor will not drain the TX bufring, once the channels are
revoked:
- Setup vmbus orphan handler properly.
- Make sure that suspension will not wait the TX bufring draining
forever.
- GC the pending TX descs on detach path, before freeing the busdma
stuffs.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8559
etvsc/hn_nvs.c
etvsc/if_hn.c
f3d8e7d9abf25e412c5e49088261f20cb7a5dac2 24-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Fix the multi-channel revoking on vmbus side.

- Reference count the sub-channel when channel offer message is
processed, so that immediate rescind message on the same channel
will not race sub-channel open on driver side.
- Drop the above reference when sub-channel is closed, this closely
mimics the hypervisor's reaction when primary channel is closed
on the VM side. No drivers use sub-channel after primary channel
is closed.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8546
mbus/vmbus_chan.c
mbus/vmbus_chanvar.h
db1aaff31affbd6e62e565c3cc5d3239a13b1248 24-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Fix the primary channel revoking on vmbus side.

Drivers can now use vmbus_chan_{is_revoked,set_orphan,unset_orphan}() and
vmbus_xact_ctx_orphan() to fix their attach/detach DEVMETHODs for revoked
primary channels.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8545
nclude/vmbus.h
mbus/vmbus_chan.c
mbus/vmbus_chanvar.h
3298d7d4fd848e9dc95db62563d9d0b7af020c5e 24-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Implement orphan support for transaction API

It will be used to fix the primary channel revocation support.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8525
nclude/vmbus_xact.h
mbus/vmbus_xact.c
dde1496487cc6add5269605388f8be79367b17af 23-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Merge free/active locks.

These functions are only used by management stuffs, so there are
no needs to introduce extra complexity.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8524
mbus/vmbus_xact.c
12672bc87909c1a70077b2651ccab9e5f4e20237 23-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Set a mark on the revoked channel.

This will be used to fix device detach DEVMETHOD for revoked primary
channel.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8522
nclude/vmbus.h
mbus/vmbus_chan.c
mbus/vmbus_chanvar.h
90a2ed06206ed3a67479c0b4d80b49d3161fdc6e 21-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Don't abuse hn_{tx,rx}_ring_inuse.

Just in case, the # of TX/RX rings is changed upon synthetic parts
re-attach.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8520
etvsc/if_hn.c
96a6324bf6bad6d8bcb8fee1f0f9def46125d3f6 21-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Allow enabling IPv6 TX checksum offloading and IPv6 TSO.

They are still disabled by default.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8490
etvsc/hn_rndis.c
etvsc/if_hn.c
9e72ff06a9c8f807ae3c4647eecd42a8926c841d 21-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Fix WITNESS warnings

And re-enable SIOCADDMULTI/SIOCDELMULTI, after WITNESS warning is fixed.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8489
etvsc/hn_nvs.c
etvsc/hn_rndis.c
etvsc/if_hn.c
etvsc/if_hnvar.h
77f95a7d186408532074deda7acbb0c582233af6 21-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Support transction result busy-wait.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8488
nclude/vmbus_xact.h
mbus/vmbus_xact.c
0b818a9bb24c271556d683bcb4ca90939c3f852c 21-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Implement RNDIS multi-packet message support.

Currently, it is only applied to packet sent through chimney sending
buffers. Not enabled by default yet.

This one gives 20%~30% performance boost for non-TSO usage in both
bit/packet rate tests and nginx performance test.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8560
etvsc/hn_rndis.c
etvsc/if_hn.c
etvsc/if_hnvar.h
d05147d4c898c38430e96f7b1e57dccce519ddf4 18-Nov-2016 dexuan <dexuan@FreeBSD.org> hyperv/pcib: change the file name: pcib.c -> vmbus_pcib.c

This makes the file name and the variable naming in the file consistent.

Reviewed by: sephe
Approved by: sephe (mentor)
MFC after: 1 week
Sponsored by: Microsoft
cib/pcib.c
cib/vmbus_pcib.c
2b2586d8f7243b639775b82757834067ae30958b 18-Nov-2016 dexuan <dexuan@FreeBSD.org> hyperv/vmbus,pcib: Add MODULE_DEPEND on pci

We'd better add this dependency explicitly, though usually the pci
driver is built into the kernel by default.

Reviewed by: sephe
Approved by: sephe (mentor)
MFC after: 1 week
Sponsored by: Microsoft
cib/pcib.c
mbus/vmbus.c
d17e215710953b61bbfd2453d22aaaab747e4104 16-Nov-2016 dexuan <dexuan@FreeBSD.org> hyperv/pcib: enable PCIe pass-through (a.k.a. Discrete Device Assignment)

The feature enables us to pass through physical PCIe devices to FreeBSD VM
running on Hyper-V (Windows Server 2016) to get near-native performance with
low CPU utilization.

The patch implements a PCI bridge driver to support the feature:

1) The pcib driver talks to the host to discover device(s) and presents
the device(s) to FreeBSD's pci driver via PCI configuration space (note:
to access the configuration space, we don't use the standard I/O port
0xCF8/CFC method; instead, we use an MMIO-based method supplied by Hyper-V,
which is very similar to the 0xCF8/CFC method).

2) The pcib driver allocates resources for the device(s) and initialize
the related BARs, when the device driver's attach method is invoked;

3) The pcib driver talks to the host to create MSI/MSI-X interrupt
remapping between the guest and the host;

4) The pcib driver supports device hot add/remove.

Reviewed by: sephe
Approved by: sephe (mentor)
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8332
cib/pcib.c
7e8608dbb1916ef1ac3b4f698b98eda93faf59a3 16-Nov-2016 dexuan <dexuan@FreeBSD.org> hyperv/vmbus: add new vmbus methods to support PCIe pass-through

The new methods will be used by the coming pcib driver.

Reviewed by: sephe
Approved by: sephe (mentor)
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8409
mbus/vmbus.c
mbus/vmbus_var.h
d16d83d31d8474f120b1d4f9a586d1dcfe2235b2 16-Nov-2016 dexuan <dexuan@FreeBSD.org> hyperv/vmbus: add a new method to get vcpu_id

vcpu_id is host's representation of guest CPU.
We get the mapping between vcpu_id and FreeBSD kernel's cpu id when VMBus
driver is loaded. Later, when a driver, like the coming pcib driver, talks
to the host and needs to refer to a guest CPU, the driver must use the
vcpu_id.

Reviewed by: jhb, sephe
Approved by: sephe (mentor)
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8410
mbus/vmbus.c
mbus/vmbus_if.m
cf8bc16b1e75f7216f63c11ea15fa20fe37be571 15-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vss: Add driver and tools for VSS

VSS stands for "Volume Shadow Copy Service". Unlike virtual machine
snapshot, it only takes snapshot for the virtual disks, so both
filesystem and applications have to aware of it, and cooperate the
whole VSS process.

This driver exposes two device files to the userland:

/dev/hv_fsvss_dev

Normally userland programs should _not_ mess with this device file.
It is currently used by the hv_vss_daemon(8), which freezes and
thaws the filesystem. NOTE: currently only UFS is supported, if
the system mounts _any_ other filesystems, the hv_vss_daemon(8)
will veto the VSS process.

If hv_vss_daemon(8) was disabled, then this device file must be
opened, and proper ioctls must be issued to keep the VSS working.

/dev/hv_appvss_dev

Userland application can opened this device file to receive the
VSS freeze notification, hold the VSS for a while (mainly to flush
application data to filesystem), release the VSS process, and
receive the VSS thaw notification i.e. applications can run again.

The VSS will still work, even if this device file is not opened.
However, only filesystem consistency is promised, if this device
file is not opened or is not operated properly.

hv_vss_daemon(8) is started by devd(8) by default. It can be disabled
by editting /etc/devd/hyperv.conf.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
Reviewed by: kib, mckusick
MFC after: 3 weeks
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8224
tilities/hv_snapshot.c
tilities/hv_snapshot.h
35daf8bed48f7b8faa4531b04c034fe03bffa4db 04-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Reset ch_dev, once the child is deleted.

So it will not be mis-used later on, e.g. in vmbus_chan_printf().

Submitted by: dexuan
Reported by: dexuan
MFC after: 1 week
Sponsored by: Microsoft
mbus/vmbus.c
ef604ebdccf7572b49860b746c675ae91d07b4fc 02-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/kvp: Don't mix message status codes and function return values.

While I'm here, move message status codes to hv_utilreg.h, since they
will be used by the upcoming VSS stuffs.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8391
tilities/hv_kvp.c
tilities/hv_kvp.h
tilities/hv_utilreg.h
97da4ad3b0e2ecf57cd1eb3d5bf20350736e1a5e 02-Nov-2016 sephe <sephe@FreeBSD.org> hyperv: GC unused functions.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8406
nclude/hyperv.h
nclude/vmbus.h
mbus/vmbus_chan.c
60508385a99bd79c485a7e48a7b969ce5c4c0caa 01-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Avoid extra header copy.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8395
mbus/vmbus_chan.c
ecb888cfe8cab261b3d204263da66e183c0ad5e0 01-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Directly fill chimney sending buffer for small packets.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8394
etvsc/if_hn.c
ceada2e8de32802437a6a391948462f638d1686a 01-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Move TSO packet fixup to an earlier place for if_transmit.

While TSO packet header may be still cache-hot.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8393
etvsc/if_hn.c
f1b1b24c76d1e464715b478b25cf733e835926db 01-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Regroup if_start related functions.

And put them under HN_IFSTART_SUPPORT, which is by default on until
we whack the if_start related bits from base system.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8392
etvsc/if_hn.c
b67ebb11542c6360f95d90f36cb2759617471321 01-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Rename cleaned up file.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8390
etvsc/hv_netvsc_drv_freebsd.c
etvsc/if_hn.c
9547c6021c85cf4a54b6a699048d0bf71f540b03 01-Nov-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Cosmetic cleanup; no functional changes.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8389
etvsc/hv_netvsc_drv_freebsd.c
c29e32cf7530b0043f2b770fbaec13c615c41e20 31-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Don't start shared TX taskq, if the hypervisor is not Hyper-V.

- Move the SYSINIT to DRIVER/SECOND, i.e. after the vm_guest becomes
determistic.
- Minor style changes.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8370
etvsc/hv_netvsc_drv_freebsd.c
4f04814f5bd62a7278d20eb8d30d3f83a33f8e92 31-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Reset do_lro, if the hash types are not TCP related.

Mainly because the host side only set TCPCS and IPCS even for
UDP datagrams.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8369
etvsc/hv_netvsc_drv_freebsd.c
efeebd338f8e3fff80d97d0e3c9b113e58622268 31-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Cleanup RXBUF ack processing.

- Increase the # of retries.
- Add comment.
- Log error, if RXBUF ack fails.
- Add stat for RXBUF ack failures.

RXBUF ack really should _not_ fail...

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8368
etvsc/hv_netvsc_drv_freebsd.c
etvsc/if_hnvar.h
82d08d7520036775f3dfcc8b3c2a225789936566 31-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Rework temporary channel packet buffer expanding.

And use large default temporary channel packer buffer; we really
don't want it to be expanded at run time.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8367
etvsc/hv_netvsc_drv_freebsd.c
etvsc/if_hnvar.h
b5122619a39e23f9e952b6eef5367d794fee8577 31-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Rename cleaned up RNDIS source file.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8361
etvsc/hn_rndis.c
etvsc/hv_rndis_filter.c
74a4ba55510acfe083fee69d45794f602a244a22 28-Oct-2016 sephe <sephe@FreeBSD.org> hyeprv/hn: Rename cleaned up RNDIS header file.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8360
etvsc/hn_rndis.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
0d524ff23188e488907618f8f5372b3a43442674 28-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Change header guardian; in preparation for the upcoming rename.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8359
etvsc/hv_rndis_filter.h
eb978bb14d39d9795eb41281466756357786d0e2 28-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Cleanup RNDIS related files.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8358
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
etvsc/if_hnvar.h
f9a861bf79c9daf5e08f99986ecb30438bc1bff8 28-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Pull data path code up.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8357
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/if_hnvar.h
963767d43e426978c58bcae252be8720ea85be3e 28-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Reorganize RX path; mainly pull non-control code path up

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8356
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
etvsc/if_hnvar.h
375567d32c1b2ee42a4a395c80e72698e96a36dc 28-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Nuke unnecessary indirection.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8355
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
etvsc/if_hnvar.h
dd7bef5f96919078c6d3ee770bb0c763fdcda5c2 28-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Rename cleaned up NVS source file.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8354
etvsc/hn_nvs.c
etvsc/hv_net_vsc.c
06dae764b5afa40dd32b82d7b8e72d0d392d33fc 28-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Rename cleaned up NVS header file.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8353
etvsc/hn_nvs.h
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
f7025d8c3cb110d296e0a81809f2cd668b924951 28-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Change header guardian; in preparation for the upcoming rename.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8352
etvsc/hv_net_vsc.h
65de6ee79a0cfd27a2b96a623a06d02447449911 27-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: NVS inclusion cleanup and forward declare functions.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8347
etvsc/hv_net_vsc.c
28ab57d34929d68cc6cf98fcb62189c0bb4c1930 27-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Move send context to NVS domain.

Since all sends are encapsulated in NVS messages.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8346
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/if_hnvar.h
d2af2cc01928c2166509751ba4b1d9d9fd2dcaa8 27-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Move hn_softc to if_hnvar.h

While I'm here, use consistent macro names.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8345
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/if_hnvar.h
1759ebe4523966cfa957dfdc161ceb0ee93259e0 27-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Shuffle chimney sending buffer alloc/free around.

This paves way for more chimney sending buffer reorganization.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8343
etvsc/hv_net_vsc.c
etvsc/hv_netvsc_drv_freebsd.c
etvsc/if_hnvar.h
d031f86f85788eed22dce68abeb65cdc87b167fb 27-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Define empty packet filter.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8342
etvsc/hv_netvsc_drv_freebsd.c
etvsc/if_hnvar.h
56fb7a1d4422733d51c3d1d8102d5a5ecaa94215 27-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Move %b format string for capabilities near their definition.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8341
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
86d54eef2b0aa7803343094999ecf268c17c21e7 27-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Nuke unnecessary M_NETVSC

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8340
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
afcf06b6649587e78e520cb3717530a81213f920 27-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Properly configure RSS according to RSS capabilities

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8338
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/ndis.h
a2c3198ca0564c664cb6693117f63e2bf27849f8 26-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Implement vmbus_chan_printf.

And use it for vmbus channel logging, which can log the channel
owner's name properly, instead of vmbus0.

Submitted by: QianYue You <t-youqi microsoft com>
MFC after: 1 week
Sponsored by: Microsoft
mbus/vmbus_chan.c
1a17845c5648edf0f9b3303d16a40bed47f22ccd 26-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Add missing white space.

Submitted by: QianYue You <t-youqi microsoft com>
MFC after: 1 week
Sponsored by: Microsoft
mbus/vmbus.c
e57ec55e201d11e94f8ef77f0eee70cbe212ca28 25-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Set baudrate properly

PR: 208931
Submitted by: Eugene Grosbein <ports grosbein net>
Reported by: Eugene Grosbein <ports grosbein net>
MFC after: 1 week
Sponsored by: Microsoft
etvsc/hv_netvsc_drv_freebsd.c
4852ebe98749518f9afb6ab79ac44eda241e47f2 24-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/ic: Rework framework/message version negotiation.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
Modified by: sephe
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8280
tilities/hv_heartbeat.c
tilities/hv_kvp.c
tilities/hv_kvp.h
tilities/hv_shutdown.c
tilities/hv_timesync.c
tilities/hv_util.c
tilities/hv_util.h
tilities/hv_utilreg.h
tilities/vmbus_icreg.h
b32eac72112d43e56a29f8a99f0dd7c0ba0665a9 24-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Nuke unused forward declaration.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8314
etvsc/if_hnvar.h
5dd046f63c64cc6b60119f3decbfad687cca064a 24-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Fix RX filter settings.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8313
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
951eda704f1fc34724f95f2f2ff68133adc6ceb7 24-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Start link status check, if no network changes were pending.

Link status check is much more lightweight than network change detection.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8311
etvsc/hv_netvsc_drv_freebsd.c
2996ef4628ac7e8e521c4ab20d9fe639b41308e3 24-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Properly handle synthetic parts reattach failure.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8310
etvsc/hv_netvsc_drv_freebsd.c
62142d087b72e010f0fb8497c14ccbaf0957edbd 24-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Fix chimney sending buffer leakage upon NVS sending failure.

This will not happen in real world, since TX consumption of the vmbus
TX bufring is limitted. Better safe than sorry.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8309
etvsc/hv_netvsc_drv_freebsd.c
3f7e8737d47548a18a96dd8a24e640a227a8c25f 24-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Move chimney buffer index and size to txdesc.

All RNDIS control messages have used SG list for a while. This makes
the send context suitable for further refactoring.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8308
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/if_hnvar.h
c9b2fb9f0100cbecc0aebda18ac779e0ff61bcef 21-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Function renaming; consistent w/ hardware capabilities query.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8296
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/if_hnvar.h
af310e5e05621082a6f02fe167bed52cc2f6b17e 21-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Add network change support.

Currently the network change is simulated by link status changes.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8295
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/if_hnvar.h
etvsc/ndis.h
d10298a127954b8800613b90836095f1b0cfeb47 21-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Check NVS version for HASHVAL pktinfo on sending path.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8293
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
49c3662ce5694a55906bc27bba1ea16df1245620 21-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Always query RSS capabilities.

- This avoid distributing NDIS version check.
- Only NDIS 6.20 required (earlier NDIS uses different indirect table
format).

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8291
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/if_hnreg.h
b4afcf142fd2513f22ed1c98088864b268d47693 19-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Expose channel management taskqueue for driver to use.

MFC after: 3 days
Sponsored by: Microsoft
nclude/vmbus.h
mbus/vmbus_chan.c
ee6e6166db6d8ab4a31c71c82bff604c31643cf4 14-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Add __FBSDID

Sponsored by: Microsoft
mbus/vmbus_br.c
f481115329bfc6d76337329c50ced753aeaa397b 14-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Management parts always need suspend and resume.

MFC after: 3 days
Sponsored by: Microsoft
etvsc/hv_netvsc_drv_freebsd.c
5cee782b2ae472e318c66312ea843d0aa72f152d 14-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/stor: Fix off-by-one bug; this brings back TRIM support.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
Reported by: Lili Deng <v-lide microsoft com>
MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8238
torvsc/hv_storvsc_drv_freebsd.c
0eeac369c37cf117addc440b5f7d867bd33138a8 11-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Rework link status support.

This is the preamble for network device SR-IOV and
NDIS_STATUS_NETWORK_CHANGE handling.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8209
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/if_hnvar.h
e1e67dd91b5b074fe6ef278206a0f6144a1911be 11-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Allow driver to inject synchronous task into channel taskq.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8208
nclude/vmbus.h
mbus/vmbus_chan.c
fce72f9619e53fbbd85556dc985f732a6aa3f6af 10-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Suffix NDIS offload size with NDIS version.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8091
etvsc/hv_rndis_filter.c
etvsc/ndis.h
6dfcd4055f5d794e6d7d61b767bba59135a0f290 10-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Generalize RSS capabilities query.

- Support NDIS < 6.30.
- Stringent response checks.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8090
etvsc/hv_rndis_filter.c
dd8232697a18607e80628934c7ade1a8fff678cf 10-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Fix if_hw_tsomax setup.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8089
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/if_hnvar.h
b7a49dcdb35fdd3d87312b06a6177dbe16b0e65c 10-Oct-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Fix checksum offload settings

The _correct_ way to identify the supported checksum offloading and
TSO parameters is to query OID_TCP_OFFLOAD_HARDWARE_CAPABILITIES.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8088
etvsc/hv_rndis_filter.c
etvsc/ndis.h
7c97b5526b72609794c2889b5ab304570dc2328e 30-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Add stubs for OFFLOAD_CURRENT_CONFIG and NETWORK_CHANGE status

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8068
etvsc/hv_rndis_filter.c
d977220fb8ea9107541195076d6bb1ec30aa433b 30-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Fix detach and attach error handling.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8066
etvsc/hv_netvsc_drv_freebsd.c
53b603805aca1c1116e6cc58bc386fd0c4c67744 30-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: If synthetic parts are detached, don't touch them.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8065
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
891c695d6e2da8b3ab10054235d334166d7a11d1 29-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Don't set HASHVAL pktinfo for NDIS < 6.30

This unbreaks packet sending on WS2008R2.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8057
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
5bee7e5b982aca4fbd8090c4444c3ee729b7d4bf 29-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Consolidate hn_init() and hn_stop()

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8056
etvsc/hv_netvsc_drv_freebsd.c
fbc29ffcc21cee4581a6bd8f3dd1934bde832c2b 29-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Move TX tasks' draining into hn_suspend().

This prepares to consolidate hn_stop() and netvsc_detach().

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8055
etvsc/hv_netvsc_drv_freebsd.c
4608daaf6528880565a0ebebb8a4ece10e71781e 29-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/storvsc: Fix the blkvsc disk attachment issues.

- The original 'disengage' ATA controller model does not work properly
for all possible disk configurations. Use the newly added ATA disk
veto eventhandler to fit into all possible disk configuration.
- If the 'invalid LUN' happens on blkvsc controllers, return
CAM_DEV_NOT_THERE so that CAM will not destroy attached disks under
the blkvsc controllers.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
Discussed with: mav
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7693
tordisengage/hv_ata_pci_disengage.c
torvsc/hv_storvsc_drv_freebsd.c
053cb8ebe2dd01d4e982e0e447a5261877f2819a 28-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Flatten RX filter configuration.

This paves way for more fixes.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8049
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
etvsc/if_hnvar.h
edf1b455670cb3a735603b4d42419e354ab029da 28-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Reorder the comment a little bit.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8048
etvsc/hv_netvsc_drv_freebsd.c
66e7b4fa47f24ca6490d04cc02f4eca4d1354631 28-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Reorganize the synthetic parts detach.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8047
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
etvsc/if_hnvar.h
a5aad6f58b2ac809cf4b0f55b623b9cb2c2ff472 28-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Suspend and resume the backend properly upon MTU change.

Suspend:
- Prevent the backend from being touched on TX path.
- Clear the RNDIS RX filter, and wait for RX to drain.
- Make sure that NVS see the chimney sending buffer and RXBUF
disconnection, before unlink these buffers from the channel.

Resume:
- Reconfigure the RNDIS filter.
- Allow TX path to work on the backend.
- Kick start the TX eof task, in case the OACTIVE is set.

This fixes various panics, when the interface has traffic and MTU
is being changed.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8046
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
2b56b359d571b29ac65a2aae7c5f454926a4b90b 28-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Add function to drain channel interrupt task.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8045
nclude/vmbus.h
mbus/vmbus_chan.c
525ba9df058d424486dd78c548db8bf8a40325d0 28-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Add functions to test RX/TX bufring emptiness

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8044
nclude/vmbus.h
mbus/vmbus_brvar.h
mbus/vmbus_chan.c
47ad6aabc5f91db3dce8d8793772f162469e0849 27-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Add dynamic device add and remove support

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8008
mbus/vmbus.c
mbus/vmbus_chan.c
mbus/vmbus_chanvar.h
mbus/vmbus_var.h
6db214c947fcd7fd884c570a10471670105ff926 21-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Put debug messages under bootverbose

While I'm here, strip blank line.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7963
etvsc/hv_netvsc_drv_freebsd.c
dabe14a5c1cfb938f5e906d4f1b661eeb89b9ac8 21-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Assert that the bufring address is page aligned.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7962
mbus/vmbus_chan.c
7063640de7b5ab2b0b199c37b82a17757553d21a 21-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Allocate bufrings in attach DEVMETHOD.

So that reinitialization, e.g. MTU change, will not fail when the system
memory is excessively fragmented.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7961
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
08260b5996e74744ef4ac89f86180a2ee51907a8 21-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Allow bufrings preallocation.

The assumption that the channel is only opened upon synthetic device
attach time no longer holds, e.g. Hyper-V network device MTU changes.
We have to allow device drivers to preallocate bufrings, e.g. in
attach DEVMETHOD, to prevent bufring allocation failure once the
system memory is fragmented after running for a while.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7960
nclude/vmbus.h
mbus/vmbus_chan.c
9ec843e04e904cf6c30c0c5ee2adcd8dcaa78302 20-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/storvsc: Fix SRB length setting.

This fixes disk discovery issue on WS2008R2 Hyper-V, which plagued
us since 10.2-release.

Reported by: many
MFC after: 3 days
Sponsored by: Microsoft
torvsc/hv_storvsc_drv_freebsd.c
b2221eff7a3abc7029a24c304a16613ecc23e998 20-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Let the caller of hn_nvs_doinit() do the error logging.

So that NVS version probing failure does not look too scary.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7950
etvsc/hv_net_vsc.c
9dd94538df4fa56fb715d19b93802fe67f5bbf4c 20-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Fix ifnet hwassist setup.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7948
etvsc/hv_netvsc_drv_freebsd.c
45119492d5948ba112b7d018ceff1118a982eb8c 19-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Allow RSS capability flipping upon attach/reinit.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7927
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
c231ab8ef160c6d9cf9e0a09db912a4e2e4596d4 19-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Stringent RSS sysctl checks

- Don't change RNDIS RSS configuration for RSS key sysctl, if the
interface is not capable of RSS yet.
- Don't change RSS indirect table (both cached one and RNDIS RSS
configuration), if the interface is not capable of RSS yet.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7924
etvsc/hv_netvsc_drv_freebsd.c
d5de427dd3e57d534438cbf8074ea6214393164f 19-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Don't allow MTU change, if it is not supported by the NVS.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7923
etvsc/hv_netvsc_drv_freebsd.c
f5b041ff244edce1365b2791c67c89de404e2a26 19-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Save capabilities for later use.

And don't allow capability changes during reinitialization, which
breaks too much static configuration.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7922
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
80dd1ec11def0fdd20630a135fa8e9ecda010b85 19-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Don't allow NVS and NDIS version change upon reinitailization

NVS and NDIS version change would break too much assumption and static
configuration.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7919
etvsc/hv_net_vsc.c
ba2004cd6c844764ce00c93ef42630a6512e6749 19-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Apply RSS indirect table fixup before configure RNDIS RSS.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7916
etvsc/hv_netvsc_drv_freebsd.c
0fa46353e7c1ba12d608728ee248718caf9a7fe0 18-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Add sysctls to dynamic adjust RSS key and indirect table

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7890
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/if_hnvar.h
etvsc/ndis.h
f29c827bf6a782b127721bcb1f18481f17c1a8f6 18-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Don't mess up RSS key and indirect table after attachment.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7889
etvsc/hv_netvsc_drv_freebsd.c
a239b508b11f379fe4f385e65c309d9e64eab53b 18-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Put debug message under bootverbose

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7875
etvsc/hv_netvsc_drv_freebsd.c
a2ca134cde532b5eb949b9cd9b20adedc676b12d 18-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Regroup ifnet setup code.

While I'm here, add comment along the attach DEVMETHOD.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7874
etvsc/hv_netvsc_drv_freebsd.c
64f12ccd11923fb533e5e4ecc2f0e40798034586 14-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Fix some ifnet settings

- ifnet.if_mtu does not require explicit setting.
- ifnet.if_hdrlen must be set after ether_ifattach().

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7873
etvsc/hv_netvsc_drv_freebsd.c
1b470cd3538ef21437d260352814f5df123bc552 14-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Remove the FreeBSD_version check for TSO configuration

It is available on both stable/10 and stable/11. This eases future MFCs
to stable/10.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7872
etvsc/hv_netvsc_drv_freebsd.c
fd9a262eae559e5792de70950efff7893ef61e39 14-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Bring in shims from stable/10

This eases future MFCs to stable/10.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7871
etvsc/hv_netvsc_drv_freebsd.c
170f6a6944e2a5420b828256d4f6d58b31d8e915 14-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Use sx for the main lock.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7870
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
a815aec5cd91224d9bd184c6620ffd81c5e4ee60 14-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Cleanup hn_ioctl.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7869
etvsc/hv_netvsc_drv_freebsd.c
fd8dfeb125a571e48f60003ae76bad532ff2d31b 14-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Function renaming: hn_ifinit -> hn_init

No functional changes.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7868
etvsc/hv_netvsc_drv_freebsd.c
fcda2f656afb8e1ce2cb57b6237c6166c77ace6f 14-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Deprecate hn_softc_t

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7867
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
e885a46d4df187e027b041c0ffcd9a0ade67f8d4 14-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Remove unused softc field

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7866
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
9d9b2b037d371ce2a075b3335528889ba2378bbd 14-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Make sure that the sub-channel count is valid.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7865
mbus/vmbus_chan.c
26f5a0e4f4fa7c60d3cdbb427dfbca4243984d81 14-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Pull RSS key and indirect table setup up.

This paves the way for the dynamic RSS key and indirect table setting.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7864
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/if_hnvar.h
60bb07b68b4dafd18b36e8295ecde8da055eed10 13-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Reorganize synthetic parts attach code.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7860
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
etvsc/if_hnvar.h
85acf9b538649b4d92829d7b5dcf52ad55f4718b 13-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Regroup synthetic parts attach code.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7859
etvsc/hv_netvsc_drv_freebsd.c
da85e5baaddd97b40c2249ea2fd4785ef2e825a8 13-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Reorganize channel attach/detach code.

This paves the way for further attach/detach code reorganization.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7858
etvsc/hv_net_vsc.c
etvsc/hv_netvsc_drv_freebsd.c
684e8a79fe97e30a9918db3ba52f692adb009cca 12-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Pull ether address and link status extraction up.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7831
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
etvsc/if_hnvar.h
ffce6742421c86ba64319d7ab66d9848793f24d4 12-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Reorganize RNDIS attach

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7830
etvsc/hv_rndis_filter.c
bf4d7e1d2a154cba65d4fe1ad6ccc6f9688c1ac7 12-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Reorganize sub-channel allocation.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7829
etvsc/hv_net_vsc.c
etvsc/hv_rndis_filter.c
etvsc/if_hnvar.h
11f8950daad14e0db9768b8c28ce909345b97833 12-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Function rename.

- Minor style changes.
- Nuke unnecessary indirection.
- Nuke unapplied comment.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7827
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_rndis_filter.c
204cca463fef37369bc137eb9af6e9ee717bd139 12-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Rename chimney sending buffer connect/disconnect functions.

Minor cleanup and wording in error messages.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7825
etvsc/hv_net_vsc.c
baa521c8b93571591a54fb73840f4c962804d30e 12-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Rename RXBUF connect/disconnect functions.

Minor cleanup and wording in error messages.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7823
etvsc/hv_net_vsc.c
39f6441a8ea677fa555710e06374eac3315ee175 08-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Factor out NVS NDIS initialization

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7811
etvsc/hv_net_vsc.c
74509a382444fac263fbde48efa33be6f10c4b57 08-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Function renaming.

While I'm here, remove obvious comment.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7810
etvsc/hv_net_vsc.c
0e9e962441e98d613afc6c7b262dc4ad51452b50 08-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/kvp: Fix IPv4/IPv6 address injection support.

The GUID string provided by hypervisor has leading and trailing braces,
while our GUID string does not have braces at all. Both braces should
be ignored, when the GUID strings are compared.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
Modified by: sephe
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7809
tilities/hv_kvp.c
86910a48b1764456fd28569338b9693b00c37ca3 08-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Pass MTU around.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7808
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
9ab972f191c63e74dcd1fef079b4cd663f3334dd 08-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Factor out function to do NVS initialization.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7807
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/if_hnreg.h
fa238131f1a9057a8f2f99dc8f41d68757176ea6 08-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Push RXBUF size adjustment down.

It is not used in other places.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7806
etvsc/hv_net_vsc.c
9583bc58f6ae68155a8406263a1e263e5c04cb07 08-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Pull vmbus channel open up.

While I'm here, pull up the channel callback related code too.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7805
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
c95ee8c109dc243978c149d377f8115132a39077 07-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Nuke unused bits

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7795
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis.h
etvsc/hv_rndis_filter.c
etvsc/if_hnreg.h
etvsc/if_hnvar.h
bd058446e9ceee07fcbc7c1c1678dd59d9de2583 07-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Simplify per-packet-info construction.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7794
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis.h
etvsc/hv_rndis_filter.c
etvsc/if_hnreg.h
etvsc/if_hnvar.h
38aa4a3d7cda3094c652e5e1896f74b02262af2c 07-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Cleanup RNDIS packet message encapsulation.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7793
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis.h
etvsc/hv_rndis_filter.c
d6bee07c16f7ccfe8a67a9b700a8e45ea754a3a2 07-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Avoid bit fields for TXCSUM setup.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7792
etvsc/hv_netvsc_drv_freebsd.c
etvsc/ndis.h
9dd95eb0d4c26fc36a82f784e0f1fa17e333fc58 06-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Avoid bit fields for LSOv2 setup.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7786
etvsc/hv_netvsc_drv_freebsd.c
etvsc/ndis.h
6f4440fbaae5bf57663011dbf52dfb7064218a47 06-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Fix VLAN tag setup for outgoing VLAN packets.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7785
etvsc/hv_netvsc_drv_freebsd.c
etvsc/ndis.h
c0bfc06f57458424f5cfe5cc0bf1eb1d5b0dacb9 06-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Stringent RNDIS packet message length/offset check.

While I'm here, use definition in net/rndis.h

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7782
etvsc/hv_rndis_filter.c
ac30c91cf9e40514cfe85973f9d02498611379a5 05-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Stringent RNDIS control message length check.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7758
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
a27cd8364d586a1dc09034e9ab7bc8f6d93904ff 05-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Stringent NVS RNDIS packets length checks.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7755
etvsc/hv_net_vsc.c
088ee2c76a02c37174a83ed86b2877605cb8fa54 05-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Stringent NVS notification length check.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7753
etvsc/hv_net_vsc.c
07bd11a4ea57f192c105e21b2b856e189761bdff 05-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Stringent header length and total length check.

While I'm here, minor style changes.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7752
mbus/vmbus_chan.c
mbus/vmbus_reg.h
0f4a5baf74b3c77959e3146cebc4d7ab083811ff 02-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/ic: Cleanup timesync channel callback.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7745
tilities/hv_timesync.c
tilities/vmbus_icreg.h
d9ecf9bddbb5ea589c9e378ba15fc28387ddc96c 02-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/ic: Cleanup shutdown channel callback.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7744
tilities/hv_shutdown.c
tilities/vmbus_icreg.h
65a297b1913bc10c28aafea5b94eb81eeee689b1 02-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/ic: Minor style fix.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7743
tilities/hv_heartbeat.c
d2779e1b332967efb8b8fe633fd4089f521cd589 02-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Use the per-packet-info types defined by net/rndis.h

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7737
etvsc/hv_rndis_filter.c
4e23bcc244d42de59119b1aa7899cf95da0d5c38 02-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Simplify RX hash related bits.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7736
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/if_hnreg.h
etvsc/if_hnvar.h
46f531e66b1d4e7bbee553f6fed87dfcb716443a 02-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Rework RXCSUM related bits

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7735
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/if_hnvar.h
etvsc/ndis.h
9bc99b737b065911fdaf6c04c6eba411046b2a26 01-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Fix VLAN tag construction.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7716
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/if_hnvar.h
etvsc/ndis.h
fea56cd2fd80916d5764961008ee74d2fe4412af 01-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Stringent per-packet-info verification.

While I'm here, minor style changes.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7709
etvsc/hv_rndis_filter.c
51bada0ecfdb99270c31346f249e497d1f542b49 01-Sep-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Remove unused function

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7706
etvsc/hv_rndis.h
etvsc/hv_rndis_filter.c
6949bf9f3f3e87dc838cf3066e0e328accf031bf 31-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/timesync: Rework time adjustment policy

- By default, adjust time upon SYNC request. It can be disabled
through hw.hvtimesync.ignore_sync_req. SYNC request will be
sent by hypervisor the host is resumed, rebooted, etc.
- By default, adjust time upon SAMPLE request, if there is 100ms
difference between VM time and hypervisor time. This can be
disabled through hw.hvtimesync.sample_drift.

And nuke the unnecessary task, since channel callback is running
in a Hyper-V taskqueue nowadays.

Submitted by: YanZhe Chen <t-yachen microsoft com>
Discussed with: Dexuan Cui <decui microsoft com>, Hongjiang Zhang <honzhan microsoft com>, sephe
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7707
tilities/hv_timesync.c
5c3601c6451b19fdf07588ce4b100833e13e0ba4 31-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Consolidate NVS transaction execution.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7704
etvsc/hv_net_vsc.c
etvsc/hv_rndis_filter.c
etvsc/if_hnvar.h
2f84fd716e3884111318db2461b87b47476e05e2 30-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Remove unnecessary NULL check.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7690
etvsc/hv_rndis_filter.c
55b42605799b1ec691e7a3447c2106ea09557cc1 30-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Log packet message alignment.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7689
etvsc/hv_rndis_filter.c
41918d1106fa869867aa29d91c181e769bd82333 30-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Remove the useless rndis_device and related bits

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7687
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
63a72a77239b7f3707a7173113040990b024125f 30-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Switch to new RNDIS transaction execution for halt.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7686
etvsc/hv_net_vsc.c
etvsc/hv_rndis_filter.c
etvsc/if_hnvar.h
9d4e07fea89209242a73798cd12aeef1fdc83cf4 30-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Factor out func to exec RNDIS transaction w/o checking result

It will be used by RNDIS HALT and RESET.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7685
etvsc/hv_rndis_filter.c
f0b1e3f94c9a4ec129cd9a88096b5fc5d316c595 30-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Remove unused function

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7684
etvsc/hv_rndis_filter.c
e64ce689a50b2218ba0bfac2a30a711e771c5d7a 30-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Switch to new RNDIS set for RX filters.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7683
etvsc/hv_rndis_filter.c
f3fa9706f1be7384a27831293b2aa516e9f4c653 30-Aug-2016 sephe <sephe@FreeBSD.org> net/rndis: Packet types are defined by NDIS; not RNDIS specific.

Reviewed by: hps
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7681
etvsc/hv_rndis.h
34a8e48444d44cdc07f9292010318f09b9d05912 30-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Indentation and field comment fixup for ndis.h.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7680
etvsc/ndis.h
465861b3f3713d5de58f303f1e28707bd4e39034 30-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Move OIDs to net/rndis.h; they are standard NDIS OIDs.

Actually all OIDs defined in net/rndis.h are standard NDIS OIDs.
While I'm here, use the verbose macro name as in NDIS spec.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7679
etvsc/hv_rndis_filter.c
etvsc/ndis.h
e6580be47dba23254cabc9cc3f84a16ed8444520 29-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Switch to new RNDIS set for RSS parameters.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7658
etvsc/hv_net_vsc.h
etvsc/hv_rndis.h
etvsc/hv_rndis_filter.c
etvsc/ndis.h
74f52cbba9c8afa4fb384274aad56c59b4433daa 29-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Fix # of channels setting, if RSS is not available.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7657
etvsc/hv_rndis_filter.c
a9589796bc5ef0b93a4e258061d6312eb60bd110 29-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Switch to new RNDIS query for RSS capabilities extraction.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7656
etvsc/hv_rndis_filter.c
etvsc/ndis.h
f58263378efdab8770e87798d7274ddc0f63a037 29-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Switch to new RNDIS query for link status extraction.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7654
etvsc/hv_rndis_filter.c
d9a088e165d0a3bae115339a94e9000ccae38da6 29-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Add definition for NDIS media state.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7652
etvsc/hv_netvsc_drv_freebsd.c
etvsc/ndis.h
ccf7079f9175d8fdb28679542a3f096197a8d126 26-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Use vmbus xact for RNDIS set.

And use new RNDIS set to configure NDIS offloading parameters.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7641
etvsc/hv_rndis_filter.c
etvsc/ndis.h
68e90f3a5502ffd3a63d319daca6d3bb57b206ef 26-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Save the adopted NDIS version for RNDIS to use later.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7640
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis.h
54142c676ec1dbcf9208e098eb5e8c84fb68819e 26-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Use vmbus xact for RNDIS query.

And switch MAC address query to use new RNDIS query function.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7639
etvsc/hv_rndis_filter.c
4dc6a90e5f758d192dcb9e7310442a034a8f150b 25-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/storvsc: Increase queue depth and rework channel selection.

- Increasing queue depth gives ~100% performance improvement for
randwrite fio test in Azure.
- New channel selection, which takes LUN id and the current cpuid
into consideration, gives additional ~20% performance improvement
for ranwrite fio test in Azure.

Submitted by: Hongzhang Jiang <honzhan microsoft com>
Modified by: sephe
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7622
torvsc/hv_storvsc_drv_freebsd.c
torvsc/hv_vstorage.h
b864f0ef69497ac240ab82e8b99af6d66d9094f2 25-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Add function to calculate max # of elements in a bufring.

MFC after: 1 week
Sponsored by: Microsoft
nclude/vmbus.h
mbus/vmbus_brvar.h
mbus/vmbus_chan.c
dad64e986216e421f48dd1ca0b82216c8b6bce65 25-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/ic: Update total message size if negotiate message size grows.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7627
tilities/hv_heartbeat.c
tilities/hv_shutdown.c
tilities/hv_timesync.c
tilities/hv_util.c
tilities/hv_util.h
29337f1b1bd70a98136f77e188de238cbd9dfef4 25-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/ic: Cleanup heartbeat channel callback.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7626
tilities/hv_heartbeat.c
tilities/vmbus_icreg.h
dcbc2f8fcdfc822a1ab6b93bb96832b70808464d 25-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Use vmbus xact for RNDIS initialize.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7624
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/if_hnvar.h
87e8626558067eace804e07223e5bcaa918abb6c 25-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Add compat code for RNDIS reorganization phase.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7621
etvsc/hv_rndis_filter.c
5b9ae032f117374c6e8885df184611642aab7814 25-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Use definition in net/rndis.h for message type and status code.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7620
etvsc/hv_rndis.h
etvsc/hv_rndis_filter.c
50f4719b11778adde29ef19e3ab25c45c96617b8 24-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/ic: Redefine IC version negotiate message.

And stringent input IC version negotiate message checks.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7614
tilities/hv_heartbeat.c
tilities/hv_shutdown.c
tilities/hv_timesync.c
tilities/hv_util.c
tilities/hv_util.h
tilities/vmbus_icreg.h
afdb7b42e8b5ac93c57235b878db66b3b7011ded 24-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Log a warning for RESET_CMPLT.

RESET is not used by the hn(4) at all, and RESET_CMPLT does not even
have a rid to match with the pending requests. So, let's put it
onto an independent switch branch and log a warning about it.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7602
etvsc/hv_rndis_filter.c
1d1770e55bad741cfc898d016461822a44b39245 24-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Remove the redundant rid setting for RNDIS HALT.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7595
etvsc/hv_rndis_filter.c
bb5254e8460b936002119468a728eb378728c705 22-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Factor out function to simplify NVS request sending

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7578
etvsc/hv_net_vsc.c
0cc5137c63e395ba021088a5404a7ef9e1ea59df 22-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Factor out function to execute NVS transactions.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7577
etvsc/hv_net_vsc.c
etvsc/hv_rndis_filter.c
etvsc/if_hnvar.h
3073b8bd93100b60de95dd4543313ed26df39c40 22-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Get rid of netvsc_dev

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7575
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
893260f870e79789bd18ee2731f3e86f800e17f0 22-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Move chimney sending buffer to hn_softc

And don't recreate chimney sending buffer for each primary channel
open, it is now created in device_attach DEVMETHOD and destroyed
in device_detach DEVMETHOD.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7574
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/if_hnvar.h
f9f5c03d33a1952d591a706ec7f753c05adf1dfe 19-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Move RXBUF to hn_softc

And don't recreate RXBUF for each primary channel open, it is now
created in device_attach DEVMETHOD and destroyed in device_detach
DEVMETHOD.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7556
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
d5c45577355ded3506f0b5fc63261647759b7929 19-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Remove the useless num_channel

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7555
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
4cfbfb09e4de5ba8495fff6922e56e45d7980154 19-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Remove assign-only struct field

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7554
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
8a5dd6d3fad5e879e4d492486ae25c903588a225 19-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Move NVS version to softc

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7553
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
55d14b734135cff15966327a30949d4f799a06db 18-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/kvp: Remove unnecessary function parameter.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7550
tilities/hv_kvp.c
c8a9b96e6e68d15a3a1d9db766a5e77c24d57586 18-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Get rid of the useless netvsc_packet

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7544
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis.h
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
d48b69133f11206b6d42ca9e05e910505575bd28 18-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Constify RNDIS messages on RX path.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7542
etvsc/hv_rndis_filter.c
39e56f00e0131f6135f94bc2133b021f19153b10 18-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Pass RX packet info to netvsc_recv.

This paves to nuke netvsc_packet, which does not serves much
purpose now.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7541
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis.h
etvsc/hv_rndis_filter.c
etvsc/if_hnvar.h
c24d51a7f2d3d6a3af3e5e507c4b79b6d2531958 17-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/util: Factor out helper for IC device_probe DEVMETHOD

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7530
tilities/hv_heartbeat.c
tilities/hv_kvp.c
tilities/hv_shutdown.c
tilities/hv_timesync.c
tilities/hv_util.c
tilities/hv_util.h
6b1ea3b570bf62baf8dc3e84a14ed917430369bb 17-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/util: Don't reference hn_softc in KVP

hn_softc is private data struct.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7519
tilities/hv_kvp.c
4561a8d9c2f0fb688dbec172015fbf7e14cb61fb 17-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Get rid of unused bits

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7518
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
93e9768e255fda1928a5f9551531d3d41d3fa9d9 17-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Remove reference to nvsp_status

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7517
etvsc/hv_net_vsc.c
etvsc/hv_rndis_filter.c
ee90d2aeb37da008cd42576cc887f110f11ba115 17-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Remove reference to nvsp_msg

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7516
etvsc/hv_net_vsc.c
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/if_hnvar.h
3d5002ca019fbdd566a42704cda68dcb691a484f 17-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Simplify RNDIS RX packets acknowledgement.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7515
etvsc/hv_net_vsc.c
etvsc/if_hnreg.h
4dccd195225994df99cd66465780bfb0e1350727 17-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Ignore the useless TX table.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7514
etvsc/hv_net_vsc.c
etvsc/if_hnreg.h
336a9723e0ded301241baf8316b18e105e723c87 17-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/storvsc: Deliver CAM_SEL_TIMEOUT upon SRB status error.

SRB status is set to 0x20 by the hypervisor, if the specified LUN is
unaccessible, and even worse the INQUIRY response will not be set by
the hypervisor at all under this situation. Additionally, SRB status
is 0x20 too, for TUR on an unaccessible LUN.

Deliver CAM_SEL_TIMEOUT to CAM upon SRB status errors as suggested by
Scott Long, other values seems improper.

This commit fixes the Hyper-V disk hotplug support.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7521
torvsc/hv_storvsc_drv_freebsd.c
torvsc/hv_vstorage.h
e1f56cc39c5a04a26a0837642b7f99536744c2ab 16-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Simplify RNDIS message checks on RX path.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7502
etvsc/hv_net_vsc.c
etvsc/if_hnreg.h
86f8b8d9833a6ad293f5a2451430b01543b1be4b 16-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Simplify RNDIS NVS message sending.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7501
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/if_hnreg.h
etvsc/if_hnvar.h
b2c45dd5311242f7faaef91942b2b106add55dce 16-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Factor out hn_nvs_send/hn_nvs_send_sglist

Avoid unnecessary message type setting and centralize the send context
to transaction id cast.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7500
nclude/vmbus.h
etvsc/hv_net_vsc.c
etvsc/hv_rndis_filter.c
etvsc/if_hnvar.h
272ccfa447227c447c7062f3142f6a6068be5cc8 15-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Switch to vmbus xact APIs for sub-channel alloc request.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7480
etvsc/hv_net_vsc.c
etvsc/hv_rndis_filter.c
etvsc/if_hnreg.h
etvsc/if_hnvar.h
374f44eb4809375c28497c5af671dda16d3b5b8e 15-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Simplify chimney sending buffer disconnection.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7479
etvsc/hv_net_vsc.c
etvsc/if_hnreg.h
37d89631356335dc743cc6ed4eec470e7e80ac6f 12-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Simplify RXBUF disconnection.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7472
etvsc/hv_net_vsc.c
etvsc/if_hnreg.h
684039b4f527fbb2c939d36a671d818d342b4b49 12-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Switch to vmbus xact APIs for NVS chimney buffer connection.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7470
etvsc/hv_net_vsc.c
etvsc/if_hnreg.h
9fe9108fd69c547c745fb1343a9a689e34919ef8 12-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Switch to vmbus xact APIs for NVS RXBUF connection.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7469
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/if_hnreg.h
41454cb7755650a777e164b9f2d149747428401d 12-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Simplify NDIS initialization.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7467
etvsc/hv_net_vsc.c
etvsc/hv_rndis.h
etvsc/if_hnreg.h
dc65554f90e2e6fd7befe3d294ee6bbc3105236c 12-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Simplify NDIS configuration.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7466
etvsc/hv_net_vsc.c
etvsc/if_hnreg.h
9bfc057440a14ba74a01e9367751098801bb33a1 11-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Use xact APIs to implement post message Hypercall APIs

Avoid code duplication.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7458
nclude/vmbus_xact.h
etvsc/hv_netvsc_drv_freebsd.c
mbus/vmbus.c
mbus/vmbus_var.h
mbus/vmbus_xact.c
f013a29591bd190a4687cc24135c5bbea71647e9 11-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Switch to vmbus xact APIs for NVS initialization

Reviewed by: Jun Su <junsu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7457
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/if_hnreg.h
etvsc/if_hnvar.h
88b2243c5af8e32ecae28fe8993c2e1cbd4cf61e 11-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Add APIs for various types of transactions.

Reviewed by: Jun Su <junsu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7456
nclude/vmbus_xact.h
mbus/vmbus_xact.c
5a7b37f2702bb82f4afa7ee913af59a7d8bb13d0 11-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Add macro to get channel packet data length.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7455
nclude/vmbus.h
71e8fde12e835a20572f2c155b0d50d62c3dfdb3 10-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Reorganize send done callback.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7450
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
etvsc/if_hnvar.h
572ce929c2182c5c1d5a8a9eb4626404a21d66ee 09-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Move gpa array out of netvsc_packet.

Prepare to deprecate the netvsc_packet.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7436
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
09307c0dd05da6511d76d557aca83412f91796f8 08-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/ic: Pass the channel callback to hv_util_attach()

The saved channel callback in util softc is actually never used.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7424
tilities/hv_heartbeat.c
tilities/hv_kvp.c
tilities/hv_shutdown.c
tilities/hv_timesync.c
tilities/hv_util.c
tilities/hv_util.h
212da37ab342b5168f1c10ad7f57bc2b5e4cf77c 08-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/ic: Expose the receive buffer length for callers to use.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7423
tilities/hv_heartbeat.c
tilities/hv_kvp.c
tilities/hv_shutdown.c
tilities/hv_timesync.c
tilities/hv_util.c
tilities/hv_util.h
1cad2f4090acfd7e4d8b6d1d4a1a083458a4e2f6 08-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/ic: Remove never used second parameter of hv_negotiate_version()

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7422
tilities/hv_heartbeat.c
tilities/hv_shutdown.c
tilities/hv_timesync.c
tilities/hv_util.c
tilities/hv_util.h
eb3942a3435dfc30e9fbc11d41e6bb5a963b5934 05-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Only make sure the TX bufring will not be closed.

KVP can write data, whose size is > 1/2 TX bufring size.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7414
mbus/vmbus_brvar.h
4b9098483e005dd003d2688b7882437a8e46f3dd 04-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/storvsc: Claim SPC-3 conformance, thus enable UNMAP support

The Hyper-V on pre-win10 systems will only report SPC-2 conformance,
but it actually conforms to SPC-3. The INQUIRY response is adjusted
to propagate the SPC-3 version information to CAM.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7405
torvsc/hv_storvsc_drv_freebsd.c
0fe87551afd96a088bc92bd0a8330ac90fcdcdd3 01-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/storvsc: Stringent PRP list assertions

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7361
torvsc/hv_storvsc_drv_freebsd.c
20e31bda3a59909b429e77c98ed56ed21aae0771 01-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/storvsc: Set maxio to 128KB.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7360
torvsc/hv_storvsc_drv_freebsd.c
db2d1992dc2bf2f035544571516691d293ed0f90 01-Aug-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Remove the artificial entry limit of SG and PRP list.

Just make sure that the total channel packet size does not exceed 1/2
data size of the TX bufring.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7359
nclude/vmbus.h
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
torvsc/hv_storvsc_drv_freebsd.c
mbus/vmbus_brvar.h
mbus/vmbus_chan.c
0bce0d8016d030c8c6060ca6b197149141252625 29-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/storvsc: Use busdma(9) and enable PIM_UNMAPPED by default.

The UNMAPPED I/O greatly improves userland direct disk I/O performance
by 35% ~ 135%.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7195
torvsc/hv_storvsc_drv_freebsd.c
78c8dd4eeda07eb3d29c48d3ca9a3b36ccd74f7a 29-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Revoke unnecessary exposure of vmbus softc

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7348
mbus/vmbus.c
mbus/vmbus_var.h
14a0ac609e016744b688858dbe265cf8efb14a69 29-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move driver glue to the beginning of the files

Just as most of other drivers do. And move sysinit function close
to its SYSINIT.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7347
mbus/vmbus.c
mbus/vmbus_et.c
411cc97b94f4d0deb8fb2592f4a16704549c7a17 29-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Forward declare static functions

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7346
mbus/hyperv.c
mbus/vmbus.c
mbus/vmbus_br.c
mbus/vmbus_chan.c
mbus/vmbus_et.c
20fd9fe3c8dc6e9f463bfc08a9b703d8af5928d7 29-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Reindent function declarations.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7344
nclude/hyperv.h
nclude/hyperv_busdma.h
nclude/vmbus.h
mbus/vmbus_chanvar.h
mbus/vmbus_var.h
e25fea92c50c3d6a56b18c937b4e975fc70bd19f 28-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Inclusion cleanup

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7334
nclude/hyperv.h
nclude/vmbus.h
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
torvsc/hv_storvsc_drv_freebsd.c
tilities/hv_heartbeat.c
tilities/hv_shutdown.c
tilities/hv_timesync.c
mbus/hyperv.c
mbus/vmbus.c
mbus/vmbus_chan.c
mbus/vmbus_et.c
mbus/vmbus_var.h
39ec7142ff89e346853e754c18832dbb0a12495e 28-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Avoid unnecessary mb()

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7333
mbus/vmbus_br.c
3202a130ab0386dc7aa9309d3d9172b044481353 27-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Rename cleaned up bufring code

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7318
mbus/hv_ring_buffer.c
mbus/vmbus_br.c
cf9435425a0024898f62348571e25385602da56a 27-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Cleanup RX bufring read process.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7317
mbus/hv_ring_buffer.c
mbus/vmbus_brvar.h
7718d7bb791055ec9e9b78515c77d32f032c6d9c 27-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Stringent RX bufring data length checks.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7316
mbus/hv_ring_buffer.c
d60be6e7f1a82a1c55f5c912b0998afdc52c95f1 27-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Cleanup TX bufring write process.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7315
mbus/hv_ring_buffer.c
b1f601813ea9d0969006ba7636c140b3577a0d6f 27-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Update comment for bufring

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7314
mbus/hv_ring_buffer.c
3ddc2898285c6c4cada01548269f0ef22371fc73 27-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Use different struct for RX/TX bufring.

So that they can use suitable MP synchronization mechanism.

While I'm here change the bufring init/read/write function names.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7313
mbus/hv_ring_buffer.c
mbus/vmbus_brvar.h
mbus/vmbus_chan.c
mbus/vmbus_chanvar.h
9196141e814bad42cfb38d5aed18499573877e07 27-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Initialize RX/TX bufring mutex at channel creation time

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7312
mbus/hv_ring_buffer.c
mbus/vmbus_brvar.h
mbus/vmbus_chan.c
480342006977b24630030501a510926df51a94c6 26-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Nuke unnecessary accessor functions.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7303
mbus/hv_ring_buffer.c
5ae29845fa8f5d1b8294626a6d21a4a0d3521d50 25-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move bufring info definition to vmbus_brvar.h

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7282
mbus/vmbus_brvar.h
mbus/vmbus_chanvar.h
bd9f2e3fe10b550210186275b7e70898a2d126d4 25-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Rename hv_vmbus_priv.h to vmbus_brvar.h

It only contains bufring related bits for a while.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7281
etvsc/hv_rndis_filter.c
mbus/hv_ring_buffer.c
mbus/hv_vmbus_priv.h
mbus/hyperv.c
mbus/hyperv_reg.h
mbus/vmbus.c
mbus/vmbus_brvar.h
mbus/vmbus_chan.c
66d14e48cc48afc00fe07939784d86d58650f976 22-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move vmbus bufring definition to vmbus_reg.h

And add more comment about its fields.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7269
mbus/hv_ring_buffer.c
mbus/vmbus_chanvar.h
mbus/vmbus_reg.h
f2317f1d8fd5bb33fa642de8ecff5c5e439fa676 22-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Cleanup and augment bufring sysctl tree creation

Binary state node is added, so that userland programs do not have
to parse human readable state string.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7268
mbus/hv_ring_buffer.c
mbus/hv_vmbus_priv.h
mbus/vmbus_chan.c
ab64e0a11ce7d1c42c34fbf32229d0b203651ee4 22-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Cosmetic bufring cleanup.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7267
mbus/hv_ring_buffer.c
a76f7615f99b7c776628993fc70e7170ce651486 21-Jul-2016 sephe <sephe@FreeBSD.org> hyperv: hv_vmbus_channel -> vmbus_channel

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7260
nclude/vmbus.h
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis.h
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
torvsc/hv_storvsc_drv_freebsd.c
tilities/hv_heartbeat.c
tilities/hv_kvp.c
tilities/hv_shutdown.c
tilities/hv_timesync.c
tilities/hv_util.c
tilities/hv_util.h
mbus/vmbus.c
mbus/vmbus_chan.c
mbus/vmbus_chanvar.h
mbus/vmbus_var.h
0e71cf638cf22ce808e1533ea09e7b1049e17e68 21-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Shuffle function declaration and macro definition.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7259
nclude/hyperv.h
nclude/vmbus.h
mbus/vmbus_chanvar.h
mbus/vmbus_var.h
41ee36189502ee64a238e75450b085c929d5184d 21-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Reorder channel fields.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7258
mbus/vmbus_chan.c
mbus/vmbus_chanvar.h
dd759fdea05eded192568e1aac066f3af0c1b657 21-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Save event flag location and evet flag mask.

This avoids unnecessary access to the vmbus_softc struct on sending path.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7257
mbus/vmbus_chan.c
mbus/vmbus_chanvar.h
e32ef6ab8911302788aca8b489b24211fd92a15c 20-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Save MNF trigger location instead of MNF trigger index.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7246
mbus/vmbus_chan.c
mbus/vmbus_chanvar.h
018951c51383c3ffb532d4d15ceec67bffc0ab50 20-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Hide channel struct definition.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7245
nclude/hyperv.h
nclude/vmbus.h
etvsc/hv_net_vsc.c
etvsc/hv_netvsc_drv_freebsd.c
torvsc/hv_storvsc_drv_freebsd.c
tilities/hv_kvp.c
mbus/hv_vmbus_priv.h
mbus/vmbus_chan.c
mbus/vmbus_chanvar.h
b9b8074b2e11db27120119401f81023fbdaf436b 20-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Deprecate the device private data in channel struct

They are neither flexible nor extensible.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7244
nclude/hyperv.h
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis.h
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
ae2759f1e4f4434ef1f33de8a9af863ea4b05d94 20-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Pass channel as the first argument for channel callback

The prepares to kill device private fields in channel struct, which
are not flexible and extensible.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7243
nclude/hyperv.h
etvsc/hv_net_vsc.c
torvsc/hv_storvsc_drv_freebsd.c
tilities/hv_heartbeat.c
tilities/hv_kvp.c
tilities/hv_shutdown.c
tilities/hv_timesync.c
tilities/hv_util.c
tilities/hv_util.h
mbus/vmbus_chan.c
3baa357428cce2cb417f9906ddf6144aec689b8d 20-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Channel struct field rename

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7242
nclude/hyperv.h
etvsc/hv_net_vsc.c
etvsc/hv_netvsc_drv_freebsd.c
torvsc/hv_storvsc_drv_freebsd.c
mbus/vmbus.c
mbus/vmbus_chan.c
3bcc5025272cc66ee2ec8b72787bb83007e5d8be 20-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move IC register definition to Hyper-V utilities

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7241
nclude/hyperv.h
tilities/hv_heartbeat.c
tilities/hv_kvp.c
tilities/hv_shutdown.c
tilities/hv_timesync.c
tilities/hv_util.c
tilities/hv_utilreg.h
7f73bf05b03c4e4afb6788f337616ea95dceeab9 20-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Get rid of unnecessary definition.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7240
nclude/hyperv.h
etvsc/hv_net_vsc.h
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
902843537858e694d40117216b6dd335032c0133 19-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Rename laundered vmbus channel code

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7232
mbus/hv_channel.c
mbus/vmbus_chan.c
edcb0937eabf199212a73d8d04eca01380e738c3 19-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Temp/internal variable/function rename

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7231
mbus/hv_channel.c
a065e1fbe16a82f4988ef32506d5e75e999c17fc 19-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Function rename

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7230
nclude/hyperv.h
nclude/vmbus.h
etvsc/hv_net_vsc.c
torvsc/hv_storvsc_drv_freebsd.c
tilities/hv_util.c
mbus/hv_channel.c
7ed04d956ad628951ff251d6b71123c190953c6d 19-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Cleanup cpu based channel selection.

And create cpu to channel map at device attach time for storvsc(4).

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7229
nclude/hyperv.h
nclude/vmbus.h
torvsc/hv_storvsc_drv_freebsd.c
mbus/hv_channel.c
682879488a297b2b4b5b12ef02ca94fcd2cbae14 18-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Cosmetic vmbus channel open cleanup

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7217
nclude/hyperv.h
mbus/hv_channel.c
mbus/vmbus_reg.h
ea266fe243555936f13d9827a4b86d6661a70568 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Cleanup channel sysctl tree creation

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7214
mbus/hv_channel.c
ff5036688ebc20d5b6bff719da8a78a90d2d06b9 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Cosmetic vmbus channel close cleanup

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7213
mbus/hv_channel.c
ef6b6cbf463234e26acedf1d5d55e9b226a5c9c0 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Function rename

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7212
nclude/hyperv.h
nclude/vmbus.h
etvsc/hv_net_vsc.c
etvsc/hv_netvsc_drv_freebsd.c
torvsc/hv_storvsc_drv_freebsd.c
mbus/hv_channel.c
3491a0177c47691d4098ef7d3414ff6ef931b547 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Back out r302888 temporarily

Committed by accident w/ duplicated commit log

MFC after: 1 week
Sponsored by: Microsoft OSTC
nclude/hyperv.h
nclude/vmbus.h
etvsc/hv_net_vsc.c
etvsc/hv_netvsc_drv_freebsd.c
torvsc/hv_storvsc_drv_freebsd.c
mbus/hv_channel.c
e7d187d84342386ed000ad596065701ed20bbabf 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Busdma-fy rxbuf and chimney sending buffer

Nuke unused channel GPADL API.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7211
nclude/hyperv.h
nclude/vmbus.h
etvsc/hv_net_vsc.c
etvsc/hv_netvsc_drv_freebsd.c
torvsc/hv_storvsc_drv_freebsd.c
mbus/hv_channel.c
6d3cd9ab4a55c893e05e73eb85a5b4ebd86a45e6 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Busdma-fy rxbuf and chimney sending buffer

Nuke unused channel GPADL API.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7211
nclude/hyperv.h
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
mbus/hv_channel.c
b17c393ac07a12e5bd0f975860917c631253f75d 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Cleanup channel packet receiving.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7204
nclude/hyperv.h
nclude/vmbus.h
etvsc/hv_net_vsc.c
mbus/hv_channel.c
mbus/vmbus_reg.h
b3c68b33ee1385af23ec52087a1b249e909f6c94 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Cleanup channel receiving.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7202
nclude/hyperv.h
nclude/vmbus.h
torvsc/hv_storvsc_drv_freebsd.c
tilities/hv_heartbeat.c
tilities/hv_kvp.c
tilities/hv_shutdown.c
tilities/hv_timesync.c
mbus/hv_channel.c
mbus/vmbus_reg.h
a63b8b4b63a684a43d17c90b9dd11a0bde09d083 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Factor out macros to do channel packet length conversion.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7194
mbus/hv_channel.c
mbus/vmbus_reg.h
e3d23c0367eb40ce791a5ff4692ab35a1d4df47e 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Field rename

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7193
mbus/hv_channel.c
mbus/vmbus_reg.h
61e1edf748ba63bcc32bb304172e19fb4e0c8c3b 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Function rename

And reorder the error prone parameters list.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7191
nclude/hyperv.h
nclude/vmbus.h
etvsc/hv_net_vsc.c
etvsc/hv_rndis_filter.c
torvsc/hv_storvsc_drv_freebsd.c
tilities/hv_heartbeat.c
tilities/hv_kvp.c
tilities/hv_shutdown.c
tilities/hv_timesync.c
mbus/hv_channel.c
e5034558ec3179a95db6f50f58b656e938080120 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Cleanup channel sending

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7178
mbus/hv_channel.c
d5273e35be9ca9a1ef1c161a7991cefe1af31f02 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move channel packet types definition to vmbus.h

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7177
nclude/hyperv.h
nclude/vmbus.h
etvsc/hv_net_vsc.c
etvsc/hv_rndis_filter.c
torvsc/hv_storvsc_drv_freebsd.c
tilities/hv_heartbeat.c
tilities/hv_kvp.c
tilities/hv_shutdown.c
tilities/hv_timesync.c
mbus/hv_channel.c
36aeaa4457345eacc64a1706de743814657e2a56 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move channel packet flags definition to vmbus.h

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7176
nclude/hyperv.h
nclude/vmbus.h
etvsc/hv_net_vsc.c
etvsc/hv_rndis_filter.c
torvsc/hv_storvsc_drv_freebsd.c
mbus/hv_channel.c
575d5bbbc995d3b9f9677658182277e4196fa466 15-Jul-2016 sephe <sephe@FreeBSD.org> hyeprv/vmbus: Rework prplist sending.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7175
nclude/hyperv.h
nclude/vmbus.h
torvsc/hv_storvsc_drv_freebsd.c
mbus/hv_channel.c
mbus/hv_vmbus_priv.h
mbus/vmbus_reg.h
9b6f77136275a53677db7392be617d11df632ead 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Rework sglist sending.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7156
nclude/hyperv.h
nclude/vmbus.h
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
mbus/hv_channel.c
mbus/hv_vmbus_priv.h
mbus/vmbus_reg.h
2bab08ccf2221600ff02463b88841fa81e09b688 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Redefine channel packet.

The channel packet header will be shared w/ PRP (physical region page)
list channel packet and SG (scatter gather) list channel packet.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7155
mbus/hv_channel.c
mbus/vmbus_reg.h
f7879d9f337422ff7f4cdb77516e8a84ec0ac41a 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Field rename

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7146
nclude/hyperv.h
mbus/hv_channel.c
69496392ed70563d9e5eec7b071f3d172f18309f 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Set vcpuid to 0, if MSR_HV_VP_INDEX does not exist.

Mainly for compatibility. While I'm here, rename cpuid related
fields in hv_vmbus_channel.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7141
nclude/hyperv.h
mbus/hv_channel.c
mbus/vmbus.c
fe99c6a2470fb448bda64d745d40afdbca126d58 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Busdma-fy channel bufring.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7140
nclude/hyperv.h
mbus/hv_channel.c
65f03aefc41b821006599f8b4812e41b448636f9 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Add vmbus_chan_gpadl_connect, which takes GPA physaddr

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7139
nclude/hyperv.h
mbus/hv_channel.c
5e44fc08712777898329063866274e94aa4497ce 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Use iovec for bufring scatter/gather list.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7134
mbus/hv_channel.c
mbus/hv_ring_buffer.c
mbus/hv_vmbus_priv.h
8337a845316dc1a398cc9e6d82afb74a0e540f9c 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Remove unused function definition/declaration.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7131
mbus/hv_ring_buffer.c
mbus/hv_vmbus_priv.h
b9fd9c46b0afa215cd405ab8ac6c4d295d6cf023 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Function rename

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7129
mbus/hv_channel.c
mbus/hv_vmbus_priv.h
mbus/vmbus.c
mbus/vmbus_var.h
ffc3ec7c8954597f804877bf55ce1fec14c9a740 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Remove unused struct

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7127
mbus/hv_vmbus_priv.h
dc2684d3a58c029850098d1dcb2d44da7194d9a2 15-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Merge hv_channel_mgmt.c into hv_channel.c

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7126
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
55e82d913f59153f3ab76a7296c22493fdae9f83 14-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move bus related message processing into vmbus.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7125
mbus/hv_channel_mgmt.c
mbus/vmbus.c
mbus/vmbus_var.h
d0e66a45d5e1648fcba33859b366d69fefa68e69 14-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Sub-channel related fields renaming

And reorganize comment.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7113
nclude/hyperv.h
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
b9dddaba1f15b4ffd487a4e83b2542bd4494c317 14-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Fix the racy channel close.

It is not safe to iterate the sub-channel list w/o lock on the
close path, while it's even more difficult to hold the lock
and iterate the sub-channel list. We leverage the
vmbua_{get,rel}_subchan() functions to solve this dilemma.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7112
mbus/hv_channel.c
632673c3cb1b54a5b3948c138d98e50de2efa5ad 14-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Field renaming to reflect reality

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7111
nclude/hyperv.h
mbus/hv_channel_mgmt.c
mbus/vmbus.c
mbus/vmbus_var.h
1d5eeebc861ecdeaa8d4555a064fa826b5b671c5 14-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Release vmbus channel lock before detach devices

Device detach method may sleep.

While I'm here, rename the function, fix indentation and function
comment.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7110
mbus/hv_channel_mgmt.c
mbus/hv_vmbus_priv.h
mbus/vmbus.c
mbus/vmbus_var.h
9f740dd35021de96f61e66a10ee32a5c0e173d03 14-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Only add primary channels to vmbus channel list

- Make the vmbus_chan_add more straightforward.
- Partially fix the hv_vmbus_release_unattached_channels().

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7109
mbus/hv_channel_mgmt.c
089d55deb22ee72eee6600093c50ed5df8828dc3 14-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Use sub-channel index to detect primary channel

In case that VMBUS_CHAN_ISPRIMARY is needed in the early place of
channel setup.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7108
nclude/hyperv.h
etvsc/hv_netvsc_drv_freebsd.c
mbus/hv_channel_mgmt.c
e09f507913b7e3554a7e21a43c77da9f2b4f0761 14-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Cleanup vmbus_chan_add()

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7106
mbus/hv_channel_mgmt.c
611248e7f01b1f2e80c1814e2e243a233b8459a7 14-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Nuke the channel open state.

Channel is either opened or not-opened.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7105
nclude/hyperv.h
etvsc/hv_net_vsc.c
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
mbus/hv_vmbus_priv.h
ebd466b0f75dfbdb9219438982ec0636d1fc1743 14-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Cleanup vmbus_chan_msgproc_choffer

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7104
mbus/hv_channel_mgmt.c
1cbc5132af0641151ef17ef1af2fbefd4a799bdd 14-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move new channel scan notification to device register

And nuke now unnecessary function indirection.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7103
mbus/hv_channel_mgmt.c
mbus/vmbus.c
224825f7be20ec5d2b30648ca4a228f179d7830c 14-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move device register and channel free to the caller.

This paves the way for more cleanup/disentangle.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7102
mbus/hv_channel_mgmt.c
9021b311f5904e6e5054e8a98a3fb9cb09145eff 14-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Alloc/Free monitor param in vmbus channel alloc/free.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7101
mbus/hv_channel_mgmt.c
mbus/hv_vmbus_priv.h
4c55dfb963ab0a6c4273e7098c335a4c5eb96e61 14-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Get rid of rel{_id,id}, use channel id consistently.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7100
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
05d204f0882ccb0677d171be3f35e00fecbf3c5b 14-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Remove unused bits

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7095
nclude/hyperv.h
mbus/hv_channel_mgmt.c
392e784792e788900903361064bb15053fcb65bf 14-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Switch to vmbus channel message macros

Prepare for more cleanup.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7094
mbus/hv_channel_mgmt.c
mbus/vmbus_reg.h
962908052b42d0c8a52e47b12e6c26cf742c2eb1 14-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move channel offer message definition to vmbus_reg.h

- Avoid bit fields.
- Avoid unnecessary indirection.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7093
mbus/hv_channel_mgmt.c
mbus/vmbus_reg.h
eb6a63d67170501fad82a244e3e35455af3f91d6 14-Jul-2016 sephe <sephe@FreeBSD.org> hyperv: hv_guid -> struct hyperv_guid.

This paves way for the further cleanup/disentangle.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7092
nclude/hyperv.h
etvsc/hv_netvsc_drv_freebsd.c
torvsc/hv_storvsc_drv_freebsd.c
tilities/hv_heartbeat.c
tilities/hv_kvp.c
tilities/hv_shutdown.c
tilities/hv_timesync.c
mbus/hv_channel_mgmt.c
mbus/hv_vmbus_priv.h
mbus/hyperv.c
mbus/vmbus.c
mbus/vmbus_if.m
592dc5a9dd0a9888e8bd59300bb6e4df72a13ff5 14-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Remove unused bits

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7091
nclude/hyperv.h
f2c0116d53b0c80ddbb375fbe80333969eae6133 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Cleanup channel rescind

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7090
mbus/hv_channel_mgmt.c
mbus/vmbus_reg.h
5284a17d460dc07c8313d00c0a8682ad3de26b11 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Remove unused code

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7089
mbus/hv_vmbus_priv.h
776713aedf138fc6eb7113edcded2aacebccdfbd 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Reorganize MNF event sending.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7088
nclude/hyperv.h
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
mbus/vmbus.c
mbus/vmbus_reg.h
mbus/vmbus_var.h
d6534dc2b21203ea08bee8a3ee79fa4f2460ba36 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv: Signal event input parameter is shared w/ MNF

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7087
nclude/hyperv.h
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
mbus/hyperv.c
mbus/hyperv_reg.h
mbus/hyperv_var.h
6feb9c9e2d3986eedc6e3612531e017de98713ee 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv: All Hypercall parameters have same alignment requirement.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7086
mbus/hv_channel_mgmt.c
mbus/hyperv_reg.h
mbus/vmbus.c
5f2e1502f887d103fd219c8bfc135ddcfef540e1 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Install different task function for batch/non-batch channels

This avoids bunch of unnecessary checks on hot path and simplifies the
channel processing.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7085
mbus/hv_channel.c
6ef685651bc41633c0ea0962a68fe19cf860563c 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Remove unnecessary callback check.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7046
mbus/hv_channel.c
40a0cd0c7d8e8a4c64b67dfbd115bfd412eaaec5 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Pack bool field into flags field

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7038
nclude/hyperv.h
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
6b19f5e95c7d1d95958040625fe093d8fcb2a23d 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/bufring: Remove unused fields

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7037
nclude/hyperv.h
mbus/hv_ring_buffer.c
f033e62fd39104c74bb171490067ae070a50a087 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Nuke unused field from hv_vmbus_channel.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7036
nclude/hyperv.h
mbus/hv_channel_mgmt.c
b8ae38bff0f975a499f3cfd0a0532095b7767b57 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv: Get rid of hv_device, which is unnecessary indirection.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7034
nclude/hyperv.h
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
mbus/hv_vmbus_priv.h
mbus/vmbus.c
4f58713202ba9fe1a8640c10407e51e73ab4f3fe 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Avoid the hv_device

This paves way to nuke the hv_device, which is actually an unncessary
indirection.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7033
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
0159c1e4b589b4d0e1f954385aa9eec469756904 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Deprecate the usage of hv_device.

This paves way to nuke the hv_device, which is actually an unncessary
indirection.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7032
nclude/hyperv.h
mbus/hv_channel_mgmt.c
mbus/hv_vmbus_priv.h
mbus/vmbus.c
a6b8a25abf9a31e4f8e63b53cbfb70c991227bc8 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/util: Avoid the hv_device

This paves way to nuke the hv_device, which is actually an unncessary
indirection.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7028
tilities/hv_heartbeat.c
tilities/hv_kvp.c
tilities/hv_shutdown.c
tilities/hv_timesync.c
tilities/hv_util.c
tilities/hv_util.h
9b892840cd510431a411d6fb653cb67046a5c22f 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/stor: Avoid the hv_device and nuke the broken get_stor_device

This paves way to nuke the hv_device, which is actually an unncessary
indirection.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7027
torvsc/hv_storvsc_drv_freebsd.c
e9cc4a9f4ed01763019d58828ea5023c1461ad16 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Add channel ivar accessor.

This makes life easier during the transition period to nuke the hv_device.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7026
nclude/hyperv.h
mbus/vmbus.c
8c2d93f18afe62c2728dd158ad654e889bfe3fa2 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: All ivars are read-only; nuke unnecessary write_ivar

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7025
mbus/vmbus.c
8bfa0bfb6c5f71b13e6c3ddfb20c3c7940a2243a 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Add vmbus method for GUID base device probing.

Reduce the exposure of hv_device.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7024
etvsc/hv_netvsc_drv_freebsd.c
torvsc/hv_storvsc_drv_freebsd.c
tilities/hv_heartbeat.c
tilities/hv_kvp.c
tilities/hv_shutdown.c
tilities/hv_timesync.c
mbus/vmbus.c
mbus/vmbus_if.m
8e81e0f97826e2a786e9e4eadc77d0cc7079567c 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Remove the embedded offer message from hv_vmbus_channel

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7021
nclude/hyperv.h
mbus/hv_channel_mgmt.c
cdcc7208eff44ca5382c158922e3fec454938a11 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Add type/instance guid fields into hv_vmbus_channel

This prepares to remove the unnecessary offer message embedding in
hv_vmbus_channel.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7020
nclude/hyperv.h
mbus/hv_channel_mgmt.c
mbus/hv_vmbus_priv.h
mbus/vmbus.c
da8616cbd82ec304a4bc70d39af131f5732f760d 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Add flags field into hv_vmbus_channel for MNF indication

This prepares to remove the unnecessary offer message embedding in
hv_vmbus_channel.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7019
nclude/hyperv.h
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
1dea27b5466d536b58860be81007e9b15fa2a551 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Make subchan index a field of hv_vmbus_channel.

This prepares to remove the unnecessary offer message embedding in
hv_vmbus_channel.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7015
nclude/hyperv.h
etvsc/hv_netvsc_drv_freebsd.c
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
6003f3acd0e0493cdda79ac7a459e28a130ce12d 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Make channel id a field of hv_vmbus_channel.

This prepares to remove the unnecessary offer message embedding in
hv_vmbus_channel.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7014
nclude/hyperv.h
etvsc/hv_netvsc_drv_freebsd.c
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
4dfc26febbbba1b487afa6e5c8cca752f8ab3e13 13-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Merge hv_connection.c into hv_channel.c

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7004
mbus/hv_channel.c
mbus/hv_connection.c
mbus/vmbus_var.h
056deab5dfe9e5616cb41f0c3a6b34b872d90c89 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Destroy channel list lock upon attach failure and detach.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7003
mbus/vmbus.c
97adb9a66f7d892b9577ff34140aa90ea0896ed8 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Remove needed bits

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7002
mbus/hv_connection.c
mbus/hv_vmbus_priv.h
mbus/vmbus.c
10f9cb85457d789db00883bc0d51316b0f240b33 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move channel map to vmbus_softc

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6982
mbus/hv_channel_mgmt.c
mbus/hv_connection.c
mbus/hv_vmbus_priv.h
mbus/vmbus.c
mbus/vmbus_var.h
95650f7121288ced1ddeec674237b0a2386a4c9f 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Fix sub-channel re-open support.

For multi-channel devices, once the primary channel is closed,
a set of 'rescind' messages for sub-channels will be delivered
by Hypervisor. Sub-channel MUST be freed according to these
'rescind' messages; directly re-openning sub-channels in the
same fashion as the primary channel's re-opening does NOT work
at all.

After the primary channel is re-opened, requested # of sub-
channels will be delivered though 'channel offer' messages, and
this set of newly offered channels can be opened along side with
the primary channel.

This unbreaks the MTU setting for hn(4), which requires re-
openning all existsing channels upon MTU change.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6978
nclude/hyperv.h
etvsc/hv_netvsc_drv_freebsd.c
mbus/hv_channel_mgmt.c
mbus/vmbus_reg.h
9eb88450185968c8f81a4c49f227bf3b47102d03 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Free sysctl properly upon channel close.

Prepare for sub-channel re-open.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6977
nclude/hyperv.h
mbus/hv_channel.c
ec334e6f7ee62c31d212a7d950dc0d0773c8c50f 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: More verbose for GPADL_connect/chan_{rescind,offer}

Reviewed by: Dexuan Cui <decui microsoft com>, Hongjiang Zhang <honzhan microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6976
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
8080ef114da5f2ebd8aa8526ea565284f0b78291 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move channel list to vmbus_softc

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6956
nclude/hyperv.h
mbus/hv_channel_mgmt.c
mbus/hv_connection.c
mbus/hv_vmbus_priv.h
mbus/vmbus.c
mbus/vmbus_var.h
efd4115e0cc95b5da7e55d21d35d32606f80d547 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move GPADL index into vmbus_softc

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6954
mbus/hv_channel.c
mbus/hv_connection.c
mbus/hv_vmbus_priv.h
mbus/vmbus.c
mbus/vmbus_var.h
0a9d808c0ad511f97880f92711a8db40b7a81dc2 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Rework vmbus version accessing.

Instead of global variable, vmbus version is accessed through
a vmbus DEVMETHOD now.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6953
nclude/hyperv.h
etvsc/hv_netvsc_drv_freebsd.c
torvsc/hv_storvsc_drv_freebsd.c
mbus/hv_channel_mgmt.c
mbus/hv_connection.c
mbus/vmbus.c
mbus/vmbus_if.m
mbus/vmbus_var.h
9321cae82996295f258be6fbdb57a85c4b8960d9 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Minor renaming

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6919
mbus/vmbus.c
mbus/vmbus_reg.h
37a4b5f644bdbfdcb3fc185c2cd4298da69be342 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Don't be oversmart in default cpu selection.

Pin the channel to cpu0 by default. Drivers having special channel-cpu
mapping requirement should call vmbus_channel_cpu_{set,rr}() themselves.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6918
nclude/hyperv.h
torvsc/hv_storvsc_drv_freebsd.c
mbus/hv_channel_mgmt.c
c172a1e56a9d6b468788682d662b3ffa630c0171 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv: Nuke unused stuffs

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6917
mbus/hv_vmbus_priv.h
mbus/hyperv.c
96d2197c7c16ad229c50e2c22dfe7d7caf384dbe 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Busdma-fy Hypercall signal event input parameter.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6916
nclude/hyperv.h
nclude/hyperv_busdma.h
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
mbus/hv_connection.c
mbus/hv_vmbus_priv.h
mbus/hyperv.c
mbus/hyperv_reg.h
mbus/hyperv_var.h
mbus/vmbus.c
mbus/vmbus_var.h
f6675b808d937689209689d3dddf678ee684d68a 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Avoid tx_evtflags setting code duplication.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6915
mbus/hv_channel.c
mbus/hv_connection.c
9194fae8ed6e893b9d5a832c3335f84882e7d661 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Flatten channel message response processing.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6914
mbus/hv_channel_mgmt.c
bbc8a9fd63125ff10de56d93f9bda875d2fe0ac9 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv: Nuke unused stuffs

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6913
nclude/hyperv.h
mbus/hv_connection.c
mbus/hv_vmbus_priv.h
mbus/hyperv.c
423e60a9f6be15a567d3155221cee08d8c592b6f 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Use post message Hypercall APIs for GPA disconnect

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6912
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
mbus/vmbus_reg.h
214a5c6f9ae35725bff86d409bd51a9d85d19bcd 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Use post message Hypercall APIs for channel close

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6906
mbus/hv_channel.c
mbus/vmbus_reg.h
a1f46208c68107573b414db92ff6271a16826f1a 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Use post message Hypercall APIs for GPADL connect.

This also fixes memory leakge if sub-connect messages are needed.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6878
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
mbus/vmbus.c
mbus/vmbus_reg.h
mbus/vmbus_var.h
54b1a4f0d77ac5443a91a6883459e9239aa8b47d 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Remove unnecessary check and unapplied comment

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6877
mbus/hv_channel.c
d44d2cb6bea737c1944070de3062d86dec49db60 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Use post message Hypercall APIs for channel open

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6876
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
mbus/vmbus_reg.h
953b39a0f0fac2472ef0f9092970984d340ad0af 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Reorganize vmbus scan process.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6875
mbus/hv_channel_mgmt.c
mbus/hv_vmbus_priv.h
mbus/vmbus.c
mbus/vmbus_var.h
2d2d5090052a987069c501ea3a7b73691347dae1 12-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/stor: Save the response status and xfer length properly.

The current command response handling discards status and xfer
length unconditionally, so that all of the commands would be
considered successful, even if errors happened. When errors
really happens, this causes all kinds of wiredness, since the
buffer will not be filled on the host side and sense data will
be ignored.

Most of the time, errors do not happen, however, error does
happen for the request sent immediately after the disk resizing.
Discarding the SCSI status (SCSI_STATUS_CHECK_COND) and sense
data (capacity changes) prevents the disk resizing from working
properly.

This commit saves the response status and xfer length properly
for later use.

Submitted by: Dexuan Cui <decui microsoft com>
Noticed by: sephe
MFC after: 3 days
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7181
torvsc/hv_storvsc_drv_freebsd.c
77f3ce8d74699be2e958f4c082c1838e6e1abb39 11-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Embed channel detach task in channel itself.

GC work queue stuffs.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6864
nclude/hyperv.h
mbus/hv_channel_mgmt.c
600fe4f0cc48d4979fbf29f4ba618612236b84bf 11-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Save vmbus softc to channels.

So that we don't need to access the global vmbus softc.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6863
nclude/hyperv.h
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
mbus/hv_connection.c
mbus/hv_vmbus_priv.h
edfc6f770c4115d537262767c897ee280ee74968 11-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Create channel synchronously.

The device probe/attach has been move to a different thread, so the
reasons to create the channel asynchronously are no longer valid.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6862
mbus/hv_channel_mgmt.c
24b9f0b7ad650c4c69953b5336ba3a4c830c4cc3 11-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Use post message Hypercall APIs for unload

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6861
mbus/hv_connection.c
mbus/vmbus.c
mbus/vmbus_reg.h
71485b42e828ff076ea544094a238a3a4f7f3dd9 11-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Add sysctl to expose vmbus version.

Requested by: Hongxiong Xian <v-hoxian microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6860
mbus/vmbus.c
81f0bc87c6721303d5c55054ae4e9a7bcd2383af 11-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Explicitly assign channel message process array.

While I'm here, remove the useless message type from message process
array, which is not used and serves no purposes at all.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6858
mbus/hv_channel_mgmt.c
e836f313c06660509292a0139d743b5538a26146 11-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Function renaming.

And pass vmbus_softc to vmbus_doattach()

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6842
mbus/vmbus.c
8e8642b6732ef86c93da4d04fc67c3eb7859b03b 11-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Add tunable to allow tcp_lro_queue_mbuf()

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6841
etvsc/hv_netvsc_drv_freebsd.c
1f27113f2d5eb606c449af26b433cd802906d36d 11-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Use post message Hypercall APIs for channel request

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6831
mbus/hv_channel_mgmt.c
mbus/hv_vmbus_priv.h
mbus/vmbus.c
mbus/vmbus_reg.h
187620ec479c064b89a998d295ebf81b71db24ad 11-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/stor: Fix the INQUIRY checks

Don't check the area that the host has not filled.

PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209443
PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210425
Submitted by: Hongjiang Zhang <honzhan microsoft com>
Reviewed by: sephe, Dexuan Cui <decui microsoft com>
MFC after: 3 days
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6955
torvsc/hv_storvsc_drv_freebsd.c
a53e8c1810b6c8c3d7ee0d3002b52da4dc887211 11-Jul-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Implement a new set of APIs for post message Hypercall

And use this new APIs for Initial Contact post message Hypercall.
More post message Hypercalls will be converted.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6830
nclude/hyperv.h
mbus/hv_channel_mgmt.c
mbus/hv_connection.c
mbus/hv_vmbus_priv.h
mbus/hyperv.c
mbus/hyperv_reg.h
mbus/hyperv_var.h
mbus/vmbus.c
mbus/vmbus_reg.h
mbus/vmbus_var.h
3737ca68018823f1f072a3fafbb209d321834399 08-Jun-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Change tx_evtflags type to u_long to match vmbus_evtflags

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6745
mbus/hv_channel.c
mbus/hv_connection.c
mbus/vmbus.c
mbus/vmbus_reg.h
mbus/vmbus_var.h
1f0b9095a5874fad8aec0bbf0eeaff727a63e72b 08-Jun-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Busdma-fy MNF and event flags.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6744
mbus/hv_channel.c
mbus/hv_connection.c
mbus/hv_vmbus_priv.h
mbus/vmbus.c
mbus/vmbus_var.h
7acd138965d96ffd22d5af9e51a5cc261951eb6a 07-Jun-2016 sephe <sephe@FreeBSD.org> net: Use M_HASHTYPE_OPAQUE_HASH if the mbuf flowid has hash properties

Reviewed by: hps, erj, tuexen
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6688
etvsc/hv_netvsc_drv_freebsd.c
19a01c597792c8b73c8f0b59ae864c56f66f000d 06-Jun-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Constify channel message

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6708
mbus/hv_channel_mgmt.c
mbus/vmbus.c
mbus/vmbus_var.h
54ecbe72e36bc7b6428dd9e4b5e3507f572ca08a 06-Jun-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Factor out channel message processing

This paves the way for further cleanup.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6707
mbus/hv_channel_mgmt.c
mbus/hv_vmbus_priv.h
mbus/vmbus.c
mbus/vmbus_var.h
bacfbc095208434b305a497620d56a352861fb2d 06-Jun-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Define type for channel messages.

And fix message processing; only channel messages are supported.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6706
mbus/hv_connection.c
mbus/vmbus.c
mbus/vmbus_reg.h
10afae237a7eee7dac5042ebfa7d999a66fa1e9f 06-Jun-2016 sephe <sephe@FreeBSD.org> hyperv: Move machine dependent bits into machine dependent files.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6701
mbus/amd64/hyperv_machdep.c
mbus/hyperv.c
mbus/hyperv_machdep.h
mbus/i386/hyperv_machdep.c
e6448344d4a588a7e0ec3874480c44ea1fe24be5 01-Jun-2016 sephe <sephe@FreeBSD.org> hyperv: Rename some cleaned up/almost cleaned up files

MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/amd64/hv_vector.S
mbus/amd64/vmbus_vector.S
mbus/hv_et.c
mbus/hv_hv.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hyperv.c
mbus/i386/hv_vector.S
mbus/i386/vmbus_vector.S
mbus/vmbus.c
mbus/vmbus_et.c
f6411f5ef35d2017294619ca81841bd056d47798 01-Jun-2016 sephe <sephe@FreeBSD.org> hyperv/channel: Only cpu0 is supported as channel target cpu on WIN7

MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_channel_mgmt.c
62f3a9db5010c68ca0bfb7a52a3738abb43952b1 01-Jun-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Redefine event flags.

- Nuke unnecessary union.
- Avoid convoluted macro indirection.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6671
mbus/hv_channel_mgmt.c
mbus/hv_connection.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
mbus/vmbus_reg.h
mbus/vmbus_var.h
c4dececd7153346ef6a6be99faf7321438fcafd6 31-May-2016 sephe <sephe@FreeBSD.org> hyperv/kvp: Use if_xname.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6641
tilities/hv_kvp.c
c91f47db7a315f12661901dbe88aad6fed96ec55 31-May-2016 sephe <sephe@FreeBSD.org> hyperv: Move guid2str from vmbus file to hyperv file

- Use uint8_t for GUID byte array.
- Define GUID string length.
- Break long lines.
- Nuke unnecessary stack variable.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6640
nclude/hyperv.h
tilities/hv_kvp.c
mbus/hv_hv.c
mbus/hv_vmbus_drv_freebsd.c
f5a9c2db296dcab50471088d943f0cf3677d0193 31-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: White space cleanup

No functional changes

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6637
mbus/hv_vmbus_drv_freebsd.c
2340a2d693963cdd1aa79b0e9835e98c7f3af4fe 31-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Redefine SynIC message.

- Avoid unnecessary indirection.
- Avoid bit fields.
- Use __packed.

Reviewed by: Jun Su <junsu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6636
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
mbus/vmbus_reg.h
35979a025e9a30875041e1e4bd4925f7706f974e 31-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move global vmbus id array to stack.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6603
mbus/hv_vmbus_drv_freebsd.c
22f842425f11c9369a1a37beb9606eae5c8093d6 31-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Indentation cleanup

No functional changes.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6602
mbus/i386/hv_vector.S
1d0f0760f812bcb8281b60588f49fec87566b7fb 31-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Rename ISR functions

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6601
mbus/amd64/hv_vector.S
mbus/hv_vmbus_drv_freebsd.c
mbus/i386/hv_vector.S
mbus/vmbus_var.h
02067b6b421e6305f6cb229f64ad5f88a3b664d5 31-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Process event timer before checking events

And update comment.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6600
mbus/hv_vmbus_drv_freebsd.c
bbb4f18f01ea8dd3f707ada0da73e7bf0e3101c4 30-May-2016 sephe <sephe@FreeBSD.org> hyperv/et: Allow Hyper-V event timer be disabled

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6599
mbus/hv_et.c
7efc15badd756816589f5924b60bb4c2e194cddb 30-May-2016 sephe <sephe@FreeBSD.org> hyperv/et: Device renaming; consistent w/ other Hyper-V utils

While I'm here, prefix function names w/ vmbus, since unlike Hyper-V
timecounter, Hyper-V event timer will not work w/o vmbus.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6598
mbus/hv_et.c
6c8e86bb6c49e256ed2a9b6d797632d06d63a2ac 30-May-2016 sephe <sephe@FreeBSD.org> hyperv: Move timer frequency definition to common place.

And cleanup event timer period settings.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6597
mbus/hv_et.c
mbus/hv_hv.c
mbus/hyperv_var.h
2ba028b67602d658899a8d9a4010814b2e2ba2db 30-May-2016 sephe <sephe@FreeBSD.org> hyperv/et: Make sure only one event timer will be registered

This nullifies the need to use softc.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6591
mbus/hv_et.c
14da1054022b895ac19a1e5e8a48aa887bfc7a4b 30-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move SINT settings to vmbus_var.h

While I'm here remove the event timer's dependency on hv_vmbus_priv.h

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6574
mbus/hv_connection.c
mbus/hv_et.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
mbus/vmbus_var.h
2fbd57ad6e48cf5d0a37d6b4f0a42caf387230b2 30-May-2016 sephe <sephe@FreeBSD.org> hyperv/et: Fix STIMER0 operations.

- Make sure that STIMER0 is disabled before writting to it, since
writing to an enabled STIMER will result in undefined behaviour.
- It is unnecessary to reconfigure STIMER0 upon each et_start().
- Make sure that MSR_HV_REF_TIME_COUNT will not return 0, since
writing 0 to STIMER_COUNT will disable the target STIMER.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6573
mbus/hv_et.c
99dd54c8161f3c182c8e3b322f2cd97be31c6f36 27-May-2016 sephe <sephe@FreeBSD.org> hyperv: Test features before enabling optional functionalities

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6571
mbus/hv_et.c
mbus/hv_hv.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
mbus/hyperv_reg.h
mbus/hyperv_var.h
025a099e5b76000fcdee82f3d3ab2c3d0f8a73b2 27-May-2016 sephe <sephe@FreeBSD.org> hyperv: Clean up Hyper-V timecounter a bit.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6569
mbus/hv_hv.c
cb11e42f2f0daf45f706783da75fcbea80c566c4 27-May-2016 sephe <sephe@FreeBSD.org> hyperv: GC unneeded bits

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6568
mbus/hv_vmbus_priv.h
a6e6e29d4b866e91c7a1fa610af9eb9d9ddcb818 27-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move MSR EOM to hyperv_reg.h

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6567
mbus/hv_vmbus_drv_freebsd.c
mbus/hyperv_reg.h
cc4a2417e2fcd8a8b52c17df59c5fc86b94a6978 27-May-2016 sephe <sephe@FreeBSD.org> hyperv: Move timer related MSRs into hyperv_reg.h

And avoid bit fields for event timer.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6566
mbus/hv_et.c
mbus/hv_hv.c
mbus/hyperv_reg.h
b295eb2eaf256498b269eb8b57f532b0408e3428 27-May-2016 sephe <sephe@FreeBSD.org> hyperv: Move CPUID related bits to hyperv_reg.h and give them clean name

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6565
mbus/hv_hv.c
mbus/hv_vmbus_priv.h
mbus/hyperv_reg.h
f060a13316237e39da2e11fb19407e2d7492cb05 26-May-2016 sephe <sephe@FreeBSD.org> hyperv: Rework guest id settings according to Hyper-V spec

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6553
mbus/hv_hv.c
mbus/hyperv_reg.h
de35596831c863c295b43b621442ee9cf64d63de 25-May-2016 sephe <sephe@FreeBSD.org> hyperv: Preserve required bits when disable Hypercall

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6530
mbus/hv_hv.c
65ac34ef0ae4a02394a592705ddfc6127c339f72 25-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Rework SynIC setup and teardown

- Avoid bit fields.
- Fix SINT setup (preserve required bits).

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6529
mbus/hv_vmbus_drv_freebsd.c
mbus/hyperv_reg.h
587cba2ddf95db03f44f142f38e6cf17ef9a0f8d 25-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Nuke unnecessary MSR read

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6528
mbus/hv_vmbus_drv_freebsd.c
8eadb055c6d1db4f4123891434320d928ba74edd 25-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Pass vmbus softc to vmbus_synic_setup

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6527
mbus/hv_vmbus_drv_freebsd.c
8dd29b205bd5c90e8f1a83a539b717e883d917b2 25-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Minor style and white space cleanup

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6523
mbus/hv_vmbus_drv_freebsd.c
ae7646a74b6dfec8dd3ed52935b79c39ca2b55fd 25-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move two global flags into vmbus softc

And pack them into one flag field.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6522
mbus/hv_hv.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
mbus/vmbus_var.h
2a3e3576d0fa51c3ead7a13253e68e84849a1bf9 25-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move vcpuid into vmbus softc per-cpu data

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6521
mbus/hv_channel_mgmt.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
mbus/vmbus_var.h
b29320f7e9b593852061315dfdf7aeb3b700f573 25-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move event/message taskqueue/task to vmbus softc

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6520
mbus/hv_channel.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
mbus/vmbus_var.h
7379c4d052bbec13b7aee401e38fd50d18a412d7 25-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Allocate/setup IDT vector after all ISR resources are ready

And release IDT vector before releasing ISR resources on interrupt
teardown path. We still have some work to do on the interrupt tearing
down path.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6519
mbus/hv_vmbus_drv_freebsd.c
d75fddcdf511f78cdb064b17d0740fb7959b77cd 25-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Check hyperv_dmamem_alloc return value

Though it is highly unlikely this function would fail w/ BUS_DMA_WAITOK,
we had better to check its return value; better safe then sorry here.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6518
mbus/hv_vmbus_drv_freebsd.c
54d59147ecacfadb6045cf308c105e769537b127 24-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Free message taskqueue during interrupt teardown

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6506
mbus/hv_vmbus_drv_freebsd.c
a5aadae397fe8952e0c8bd64e87e5b7540b9f8c7 24-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Factor out functions for vmbus interrupt set/teardown

This paves way for further cleanup and fix.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6505
mbus/hv_vmbus_drv_freebsd.c
5442766ff0e7155687c740012e7d6f473b161bea 24-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Git rid of sc version of pcpu data extraction macro

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6503
mbus/hv_connection.c
mbus/hv_vmbus_drv_freebsd.c
mbus/vmbus_var.h
0450eff37ffa7a8f923eed2f7c8acc4157a04f93 24-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Use busdma(9) for messages and event flags

And
- Move message and event flags to vmbus_softc per-cpu data.
- Get rid of hv_setup_arg, which serves no purpose now.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6502
mbus/hv_connection.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
mbus/vmbus_var.h
3bdd50f6423d836419172afa7559a5ba5b874f65 24-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move SynIC setup/teardown from hyperv file to vmbus file

Avoid unnecessary exposure.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6501
mbus/hv_hv.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
0268d1361df9bcae9dd7a1f3cbcadfd59f7f47b5 24-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Rename local variable and break long lines

No functional changes.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6500
mbus/hv_vmbus_drv_freebsd.c
58d0fe7e6204946f90a68f1d37eb503c4b2f18ef 24-May-2016 sephe <sephe@FreeBSD.org> hyperv/busdma: Take BUS_DMA_ZERO into account

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6499
mbus/hyperv_busdma.c
3152684792d09507325f5d58cb846f3b35d1f9bf 24-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Pass vmbus_softc and curcpu to hv_vmbus_isr()

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6498
mbus/hv_vmbus_drv_freebsd.c
34fcd5745a2301c885fa3e936eaac103d8ec3e0a 24-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move vmbus interrupt counter into vmbus softc

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6497
mbus/hv_vmbus_drv_freebsd.c
mbus/vmbus_var.h
b48bf88aecdcd15f2ade62ff8e942f497584f0c4 23-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Move IDT vector to vmbus_softc

Prepare to get rid of the hv_setup_arg.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6449
mbus/hv_hv.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
mbus/vmbus_var.h
fc43db2e9e18e852e97d1daa68830e16220dbb5b 23-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Get rid of vmbus_devp

While I'm here, nuke useless print in vmbus_attach().

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6447
mbus/hv_vmbus_drv_freebsd.c
mbus/vmbus_var.h
9b8c2e4a6f313e1dc68aac6f7b69e4623c8324d2 23-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Declare Synic message and event w/ proper types

Avoid ugly casts.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6446
mbus/hv_connection.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
7fe01c346db99048659a6e158f6463a19d5ce867 23-May-2016 sephe <sephe@FreeBSD.org> hyperv: Move Hypercall setup to an early place.

It does not belong to the vmbus.

While I'm here rework the Hypercall setup, e.g. use busdma(9)
and avoid bit fields.

Discussed with: Jun Su <junsu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6445
mbus/hv_hv.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
mbus/hyperv_reg.h
584c5b9bae8bd1977478b359c2ad7fbb8db089ac 23-May-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Use hyperv busdma(9) helper.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6444
etvsc/hv_netvsc_drv_freebsd.c
86f0ce9eecb21a4a9faaeaf3c673dc0f5bc3d401 23-May-2016 sephe <sephe@FreeBSD.org> hyperv: Add helpers for busdma(9) operation

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6443
nclude/hyperv_busdma.h
mbus/hyperv_busdma.c
f5153143b671d08542baece375800a25b9c0c2ef 23-May-2016 sephe <sephe@FreeBSD.org> hyperv: Move guest id setup to early place

And
- Rework the guest id composition.
- Nuke useless saved guest_id.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6430
mbus/hv_hv.c
mbus/hv_vmbus_priv.h
a381878b79fd6c33e741e41db4bd328c72de56a7 18-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Use consistent device description as other devices

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6418
mbus/hv_vmbus_drv_freebsd.c
60d602f8ed7be0f31fcd6b6fce7cc994cc44e62d 18-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Minor function definition style fixup

Reviewed by: Jun Su <junsu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6417
mbus/hv_connection.c
mbus/hv_vmbus_drv_freebsd.c
e0c2d90f648e3c81e56bdb2ed734ce02dfd64a5f 18-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Fix SYSINIT function prototype and usage.

Reviewed by: Jun Su <junsu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6416
mbus/hv_vmbus_drv_freebsd.c
0ed893f528718bb289b489358f2643614f5a8154 18-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Reindent and cleanup devmethods.

While I'm here, use DEVMETHOD_END.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6415
mbus/hv_vmbus_drv_freebsd.c
37c6dd98866404bce0514538f7c186a8b5420979 18-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Staticize vmbus_devclass

Reviewed by: Jun Su <junsu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6414
mbus/hv_vmbus_drv_freebsd.c
8799309932ccfc74ee59801bacc7e453691ac6aa 18-May-2016 sephe <sephe@FreeBSD.org> hyperv: Set vm_guest to VM_GUEST_VM, if hypervisor is not Hyper-V

Reviewed by: kib
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6412
mbus/hv_hv.c
94be75844d6a3687a46877db54f0c9f827bf91fb 18-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Nuke unnecessary function indirection

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6411
mbus/hv_vmbus_drv_freebsd.c
e08952bffd7a79c4b80d4d45ecea889e0b69b41a 18-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Remove useless modevent handler

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6410
mbus/hv_vmbus_drv_freebsd.c
dc27d2be742522708e9a3be6ede0a3dddb3ed245 18-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Function renaming vmbus_msg_swintr -> vmbus_msg_task

It is not an SWI handler for a long time.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6409
mbus/hv_vmbus_drv_freebsd.c
c319671ad30d4578025bd6c10bea7c9c63b21ff7 18-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Utilize curcpu

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6408
mbus/hv_vmbus_drv_freebsd.c
36730e9ddd58ff76ffb13c301512166f96823d89 18-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Minor white space and style cleanup

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6407
mbus/hv_vmbus_drv_freebsd.c
9abf04c746561d9e12c2cee493b4d7bba7c0b626 18-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Avoid two unnecessary protocol checks on isr handling path

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6405
mbus/hv_connection.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
mbus/vmbus_var.h
edf920d9b74db2c121dc9e1301164a0288519a55 18-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Use atomic swap and flsl to process event flags

Greatly reduce the locked instructions and reduce number of inner loops.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6404
mbus/hv_connection.c
a7fbb439deca1a9ef787b371ae06a230d21c97e8 18-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Reduce the # of event loops by recording event flag count

Use vmbus softc to save vmbus per-cpu data. More stuffs will be moved
into vmbus softc.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6403
mbus/hv_channel.c
mbus/hv_connection.c
mbus/hv_vmbus_drv_freebsd.c
mbus/vmbus_var.h
57befc8d8df987b720e9fce2ad078f6891361b3b 18-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Use unsigned long for event bits.

And move base channel id calculation out of inner loop. This prepares
for more event processing optimization.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6384
mbus/hv_connection.c
mbus/hv_vmbus_priv.h
156fd4834ab9a6f666ba46003a8fd7bd64dfdb39 17-May-2016 eadler <eadler@FreeBSD.org> Don't repeat the the word 'the'

(one manual change to fix grammar)

Confirmed With: db
Approved by: secteam (not really, but this is a comment typo fix)
torvsc/hv_storvsc_drv_freebsd.c
3761743489689618f0e7668cc92077979f225df9 16-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Use atomic_testandclear

Prepare to use unsigned long for event channel bit array.

Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6382
mbus/hv_connection.c
9a6b37a52effc5da8adb38a423c513e38eedd4b0 16-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Fix event processing loop indentation.

No functional changes.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6334
mbus/hv_connection.c
7a5db367da5daf364039c65c452063f63e25a598 16-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Simplify event processing

For channel0, it will never be processed on event handling path,
so there is no need to install it. After skipping in the channel0
installation, we could discard the channel0 check on event
handling hot code path.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6333
mbus/hv_channel_mgmt.c
mbus/hv_connection.c
a9da8398ffe7b6e1f68944464cb4b97adf1d122f 16-May-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Simplify event processing

While I'm here, remove useless comment and unnecessary return.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6332
mbus/hv_connection.c
186de2f12a689e15223c0d232e2c900ef38430d9 16-May-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Combine per-packet-information parsing.

MFC after: 1 week
Sponsored by: Microsoft OSTC
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis.h
etvsc/hv_rndis_filter.c
bcc5b0c55d8b271169672e8a6ef07f362e25873b 14-May-2016 jhb <jhb@FreeBSD.org> Add an EARLY_AP_STARTUP option to start APs earlier during boot.

Currently, Application Processors (non-boot CPUs) are started by
MD code at SI_SUB_CPU, but they are kept waiting in a "pen" until
SI_SUB_SMP at which point they are released to run kernel threads.
SI_SUB_SMP is one of the last SYSINIT levels, so APs don't enter
the scheduler and start running threads until fairly late in the
boot.

This change moves SI_SUB_SMP up to just before software interrupt
threads are created allowing the APs to start executing kernel
threads much sooner (before any devices are probed). This allows
several initialization routines that need to perform initialization
on all CPUs to now perform that initialization in one step rather
than having to defer the AP initialization to a second SYSINIT run
at SI_SUB_SMP. It also permits all CPUs to be available for
handling interrupts before any devices are probed.

This last feature fixes a problem on with interrupt vector exhaustion.
Specifically, in the old model all device interrupts were routed
onto the boot CPU during boot. Later after the APs were released at
SI_SUB_SMP, interrupts were redistributed across all CPUs.

However, several drivers for multiqueue hardware allocate N interrupts
per CPU in the system. In a system with many CPUs, just a few drivers
doing this could exhaust the available pool of interrupt vectors on
the boot CPU as each driver was allocating N * mp_ncpu vectors on the
boot CPU. Now, drivers will allocate interrupts on their desired CPUs
during boot meaning that only N interrupts are allocated from the boot
CPU instead of N * mp_ncpu.

Some other bits of code can also be simplified as smp_started is
now true much earlier and will now always be true for these bits of
code. This removes the need to treat the single-CPU boot environment
as a special case.

As a transition aid, the new behavior is available under a new kernel
option (EARLY_AP_STARTUP). This will allow the option to be turned off
if need be during initial testing. I plan to enable this on x86 by
default in a followup commit in the next few days and to have all
platforms moved over before 11.0. Once the transition is complete,
the option will be removed along with the !EARLY_AP_STARTUP code.

These changes have only been tested on x86. Other platform maintainers
are encouraged to port their architectures over as well. The main
things to check for are any uses of smp_started in MD code that can be
simplified and SI_SUB_SMP SYSINITs in MD code that can be removed in
the EARLY_AP_STARTUP case (e.g. the interrupt shuffling).

PR: kern/199321
Reviewed by: markj, gnn, kib
Sponsored by: Netflix
mbus/hv_vmbus_drv_freebsd.c
5e72012d2ebb1e8afd835746b8c64443e30a9287 12-May-2016 sephe <sephe@FreeBSD.org> hyperv/stor: Enable INQUIRY result check only on WIN10 like host systems

On WIN8 like host systems, when rescan happens, the already installed
disks seem to return random invalid results for INQUIRY.

More investigation is under way to figure out why random invalid INQUIRY
results are delivered to VM on WIN8 like host systems.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
Reviewed by: sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6316
torvsc/hv_storvsc_drv_freebsd.c
torvsc/hv_vstorage.h
effd024064d08a962dcdaefd9a2cbbb740495117 11-May-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Extract RSS hash value and type.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6287
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis.h
etvsc/hv_rndis_filter.c
eed4bd22add2269ccde27996035581801316c610 03-May-2016 pfg <pfg@FreeBSD.org> sys/dev: minor spelling fixes.

Most affect comments, very few have user-visible effects.
nclude/hyperv.h
tilities/hv_kvp.c
bfb191f240107e9d6573c5106848927ba7b82ec6 27-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Add stat for # of chimney sending tries

MFC after: 1 week
Sponsored by: Microsoft OSTC
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
4db0839c2cca96408065b0dd4ac862683e879baf 27-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Mark sysctls MPSAFE

MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_channel.c
mbus/hv_ring_buffer.c
361ca6326f0a09c544b16b95bee107385d7462a7 27-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Mark sysctls MPSAFE

MFC after: 1 week
Sponsored by: Microsoft OSTC
etvsc/hv_netvsc_drv_freebsd.c
f44128794a3b065bae57e72273f08e52e386b959 27-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Remove unapplied comment.

Chimney sending buffers are shared across channels.

MFC after: 1 week
Sponsored by: Microsoft OSTC
etvsc/hv_netvsc_drv_freebsd.c
9faf9cad616b990fb90318369a8c27e40f15eb1b 27-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Restart sending earlier once we gathered some free TX descs

This greatly reduces the oqdrops under heavy workload.

For TCP send/recv test (10K concurrent connections):
oqdrops is reduced by 17% on sending side, and 57% on receiving side.

For nginx-1.8/wrk-4 1KB object test (10K concurrent connections,
4 requests/connection):
oqdrops is reduced by 44% on nginx side, and 10% on wrk side.

MFC after: 1 week
Sponsored by: Microsoft OSTC
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
94d1b679ab1271680a97062c871453e398d0f71c 26-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Change description to "Hyper-V Network Interface"

This is consistent w/ other Hyper-V devices.

MFC after: 1 week
Sponsored by: Microsoft OSTC
etvsc/hv_netvsc_drv_freebsd.c
493d8c5c487c2bf4a0f7726c6ec7b10bd63e13a6 26-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/stor: Set description properly in probe devmethod

MFC after: 1 week
Sponsored by: Microsoft OSTC
torvsc/hv_storvsc_drv_freebsd.c
f54e02829bc569bcd71bef22973dc9cf1f8517e8 26-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/channel: Git rid of the sub-channel creation callback

It is no longer used.

MFC after: 1 week
Sponsored by: Microsoft OSTC
nclude/hyperv.h
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
75f95734a8d4ea597a5a19768e778c0f954f5ff2 26-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/stor: Avoid sub-channel creation callback.

Since the sub-channel offers are synchronized, we can do our own
channel setup without using the sub-channel creation callback.

This paves the way to whack the sub-channel creation callback.

MFC after: 1 week
Sponsored by: Microsoft OSTC
torvsc/hv_storvsc_drv_freebsd.c
936be7c264e1adf7cbdf8c16de9329d51e72332a 26-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Avoid sub-channel creation callback.

Since the sub-channel offers are synchronized, we can do our own
channel setup without using the sub-channel creation callback.

This paves the way to whack the sub-channel creation callback.

MFC after: 1 week
Sponsored by: Microsoft OSTC
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis.h
35bcf1a1373adbb433f9eb46de9b81de3db7627b 26-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/stor: Synchronize sub-channel offers

MFC after: 1 week
Sponsored by: Microsoft OSTC
torvsc/hv_storvsc_drv_freebsd.c
f3d0188e03bca2dbf6e92741bdebd44c01b067f7 26-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/stor: Remove the useless hs_open_multi_channel

This fixes the sub-channel offer race after Hyper-V device probe/attach
is moved to vmbus SYSINIT/attach.

MFC after: 1 week
Sponsored by: Microsoft OSTC
torvsc/hv_storvsc_drv_freebsd.c
2c5612e0c5230fe1c56c42e5a22807eb8c14e562 25-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Synchronize sub-channel offers

MFC after: 1 week
Sponsored by: Microsoft OSTC
etvsc/hv_netvsc_drv_freebsd.c
aecc2d7ed58a2ef971a51c1bcb0e044f32de2cb4 25-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/channel: Add functions to synchronize sub-channel offers

MFC after: 1 week
Sponsored by: Microsoft OSTC
nclude/hyperv.h
mbus/hv_channel_mgmt.c
c34a514c4ab74d0e572373b7f1c800f4dfa85d21 25-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/channel: Log a warning about duplicated primary channel offer

MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_channel_mgmt.c
99c6a9d880c03282b91502ac47747e6552497b52 25-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/channel: Remove unapplied comment

MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_channel_mgmt.c
7f872f57a538da0aa0e61185c7deb041338758ed 25-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/channel: Minor style changes; no functional changes.

MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_channel_mgmt.c
92fd97ad08437c959381c2f9708aadc90adb0be0 25-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/channel: Remove the unnecessary 'new' flag

MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_channel_mgmt.c
9e6717b415739ea51cffd77149a887342f4e837a 25-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/et: Strip extra white space in function name

Reported by: Sascha Wildner <saw online de>
MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_et.c
8350a9cf25dc26ee4b863d50a1221fcb8af563ea 25-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Allow users to configure ifq or bufring depth.

MFC after: 1 week
Sponsored by: Microsoft OSTC
etvsc/hv_netvsc_drv_freebsd.c
b622a5ef08e12b1134ca40811623e1b58a2dbf33 25-Apr-2016 sephe <sephe@FreeBSD.org> hn: Increase odrops for if_transmit method if drbr_enqueue fails.

MFC after: 1 week
Sponsored by: Microsoft OSTC
etvsc/hv_netvsc_drv_freebsd.c
e78e1803876a8d9c2ece3740993b3ba2ce6bbcdf 22-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/et: Make Hyper-V event timer a device.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: sephe, Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5957
mbus/hv_et.c
mbus/hv_hv.c
mbus/hv_vmbus_drv_freebsd.c
09f48df71ee206eac7a278253eff0b7cfa0e8151 22-Apr-2016 sephe <sephe@FreeBSD.org> hyperv: Update copyright to 2016 for the files Microsoft changed in 2016

Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6039
nclude/hyperv.h
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis.h
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
torvsc/hv_storvsc_drv_freebsd.c
tilities/hv_heartbeat.c
tilities/hv_kvp.c
tilities/hv_kvp.h
tilities/hv_shutdown.c
tilities/hv_timesync.c
tilities/hv_util.c
tilities/hv_util.h
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
mbus/hv_connection.c
mbus/hv_et.c
mbus/hv_hv.c
mbus/hv_ring_buffer.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
dced14581edc6350b8ae59f1e5e4fca5639130be 19-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Make device probe/attach synchronous w/ vmbus attach/SYSINIT

Discussed with: Jun Su <junsu microsoft com>, Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_channel_mgmt.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
4a9731a7d44304f95e42a80198335c9021180fc6 19-Apr-2016 sephe <sephe@FreeBSD.org> hyperv: Remove two assign-only local variables

Submitted by: Jun Su <junsu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_channel_mgmt.c
44da7878ee0d3ad8a30496610029ddf6cafbdf53 15-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Hide ring to channel linkage message under bootverbose

Suggested by: Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
etvsc/hv_netvsc_drv_freebsd.c
2ef9f4ba782013921caf1b760dec37a0696fa518 15-Apr-2016 sephe <sephe@FreeBSD.org> hyperv: No need to zero out softc

MFC after: 1 week
Sponsored by: Microsoft OSTC
etvsc/hv_netvsc_drv_freebsd.c
torvsc/hv_storvsc_drv_freebsd.c
eed64434eee2a8aabe5ead1c5c1ff608685341c8 15-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/stor: Use xpt_done_direct() upon I/O completion

Reviewed by: mav
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5955
torvsc/hv_storvsc_drv_freebsd.c
ef894df2779b2ee9638d91d4648012fc8fcf87dd 15-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Put multi-channel offer logging under bootverbose

Suggested by: Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_channel_mgmt.c
35f0fde238dd6878a9abbed4a4e426af91bad286 15-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/stor: Temporary disable the wrongly done command timeout.

It will be reenabled once the request processing is corrected.

MFC after: 1 week
Sponsored by: Microsoft OSTC
torvsc/hv_storvsc_drv_freebsd.c
3d593173121c94e1e0c292e67eba37c36230ecd4 15-Apr-2016 sephe <sephe@FreeBSD.org> hyperv: Deprecate HYPERV option by moving Hyper-V IDT vector into vmbus

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: jhb, kib, sephe
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5910
mbus/amd64/hv_vector.S
mbus/hv_vmbus_drv_freebsd.c
mbus/i386/hv_vector.S
3eeca05f1b31c0a604359cc0f0096ecdb08947ac 13-Apr-2016 sephe <sephe@FreeBSD.org> hyperv: device_get_softc does not return NULL

MFC after: 1 week
Sponsored by: Microsoft OSTC
etvsc/hv_netvsc_drv_freebsd.c
torvsc/hv_storvsc_drv_freebsd.c
6b5bb617956b791bb54cbdf3b199378a7cc7f717 13-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Merge duplicated version check for events

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5911
mbus/hv_connection.c
mbus/hv_vmbus_drv_freebsd.c
7dfefb4ad04aecb6eadead5e200a940b1d8631af 12-Apr-2016 sephe <sephe@FreeBSD.org> hyperv: Replace 0 w/ NULL

Submitted by: pfg
MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_hv.c
mbus/hv_vmbus_drv_freebsd.c
8fa5339871c1aa1a5659de14cb349fec0cae50d2 11-Apr-2016 sephe <sephe@FreeBSD.org> hyperv: Typo

Noticed by: kib
MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_hv.c
5aac05162c339436db8f586aef69d4c6c4d5d889 11-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Remove unnecessary NULL checks

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5905
etvsc/hv_net_vsc.c
etvsc/hv_rndis_filter.c
07c17a9d10ed0669b7e63d2f72e49d7bde32b10b 11-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/hn: By default enable multiple TX/RX rings, aka vRSS.

Reviewed by: Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5880
etvsc/hv_netvsc_drv_freebsd.c
c49d153732add588250197d631d76ec1539965e4 11-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Cap default # of rings to 8.

8 gives the best performance in both Azure and local Hyper-V on both
10Ge and 40Ge. More rings are still allowed by manual configuration.

Reviewed by: Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5879
etvsc/hv_netvsc_drv_freebsd.c
710f9bdd7a9e9726409854be3cc2246048cd3c74 11-Apr-2016 sephe <sephe@FreeBSD.org> hyperv: Define macro for Hyper-V interface

Suggested by: rpokala
MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_hv.c
ed18aa785e35157f85eb7c3276aef49a7f9acf5e 11-Apr-2016 sephe <sephe@FreeBSD.org> hyperv: Print more features

And add comment about the MSR features.

MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_hv.c
mbus/hv_vmbus_priv.h
7e6f8b31670ae92494f9510a48d7d589492dec6a 11-Apr-2016 sephe <sephe@FreeBSD.org> hyperv: Break long line

MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_hv.c
dbf747e96c50495258170a73aa5a6ab288b8b958 11-Apr-2016 sephe <sephe@FreeBSD.org> hyperv: Declare hyperv_{features,recommends} properly

MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_vmbus_priv.h
28d2243294e521bd34a063a402382b21ad03b262 11-Apr-2016 sephe <sephe@FreeBSD.org> hyperv: Resurrect r297481

This time we make sure that the TIME_REF_COUNT MSR exists.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: sephe, Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_hv.c
297e2d2f528a41d9a9614e9b34049801f6935b31 11-Apr-2016 sephe <sephe@FreeBSD.org> hyperv: Identify Hyper-V features and recommends properly

Features bits will be used to detect devices, e.g. timers, which
do not have corresponding event channels.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: sephe, Dexuan Cui <decui microsoft com>
Rearranged by: sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_hv.c
mbus/hv_vmbus_priv.h
43950de88e5f22790360783b053e31c28f4359bf 11-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Get rid of max_leaf detection; this is actually not used.

It will be replaced by a new one.

MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_hv.c
1cae14fc17208fc1f7c1250539d02a07136ec002 11-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Nuke unused function

MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_hv.c
mbus/hv_vmbus_priv.h
b63211eed5e20b9ad1b7649373ab39eff72e2521 10-Apr-2016 pfg <pfg@FreeBSD.org> Cleanup unnecessary semicolons from the kernel.

Found with devel/coccinelle.
tilities/hv_heartbeat.c
tilities/hv_kvp.c
tilities/hv_shutdown.c
e099b3defecad889c8551888e1fb721a4dedab27 08-Apr-2016 sephe <sephe@FreeBSD.org> hyperv: Revert r297481

Use vm_guest == VM_GUEST_HV is not enough to determine whether FreeBSD
is running on Hyper-V or not. What a mess.

Reported by: smokehydration tutanota com
Sponsored by: Microsoft OSTC
mbus/hv_hv.c
018d7a211836a779a9658847a01b4972f5eded2f 07-Apr-2016 sephe <sephe@FreeBSD.org> hyperv: Use lapic_{alloc,free}_ipi to allocate private interrupt vector

Suggested by: jhb
Reviewed by: Dexuan Cui <decui microsoft com>, Jun Su <junsu microsoft com>
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5850
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
4ca2f015b050cde68fe91a8138b89220d58c27cc 07-Apr-2016 sephe <sephe@FreeBSD.org> hyperv: Typo in r297634

Noticed by: hiren
MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_vmbus_drv_freebsd.c
728fb34a75c56183c03f5ca278a29d04a298a692 07-Apr-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Use default mtx for channel message queue

First of all sema_post() can't be called w/ spinlock, and the channel
message queue processing is not on hot code path, i.e. spinlock is not
necessary.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: sephe, Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5812
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
mbus/hv_connection.c
51ae60a9ec85a0f03cf9c12cbe9e656f79b70667 07-Apr-2016 sephe <sephe@FreeBSD.org> hyperv: Use mb() instead of atomic_thread_fence_seq_cst()

Since atomic_thread_fence_seq_cst() will become compiler fence on UP kernel.

Reviewed by: kib, Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5852
mbus/hv_vmbus_drv_freebsd.c
d0428dd51cb76234d1d95cd80c1d247adfa0c2bb 01-Apr-2016 sephe <sephe@FreeBSD.org> tcp/lro: Use tcp_lro_flush_all in device drivers to avoid code duplication

And factor out tcp_lro_rx_done, which deduplicates the same logic with
netinet/tcp_lro.c

Reviewed by: gallatin (1st version), hps, zbb, np, Dexuan Cui <decui microsoft com>
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5725
etvsc/hv_netvsc_drv_freebsd.c
cff47489671a6ec6470f706f530df99c158511b0 01-Apr-2016 sephe <sephe@FreeBSD.org> hyperv: Register Hyper-V timer early enough for TSC freq calibration

The i8254 simulation in Hyper-V is kinda broken and is not available
in Generation 2 Hyper-V VMs, so Hyper-V timer must be registered early
enough so that it can be used to do the TSC freq calibration.

This fixes the notorious warning like this:
calcru: runtime went backwards from 50 usec to 25 usec for pid 0 (kernel)

Submitted by: Dexuan Cui <decui microsoft com>
Reviewed by: kib, sephe
Tested by: kib, sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5778
mbus/hv_hv.c
6bdd8730ffebf9505d9229cc155703f003bb152a 24-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Create per-cpu fast taskqueue for msg handling

Using one taskqueue does not work, since the EOM MSR must be written
on the msg's owner CPU.

Noticed by: Jun Su <junsu microsoft com>
Discussed with: Jun Su <junsu microsoft com>, Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
5b08863f1f700850af80483dbc2adaac78b021b3 24-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/utils: Allow hint to disable individual utility

Reviewed by: kib, Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5714
tilities/hv_heartbeat.c
tilities/hv_kvp.c
tilities/hv_shutdown.c
tilities/hv_timesync.c
c939ef2e215069b4fe694e5cdaf44045ae31b30a 24-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: use a better retry method in hv_vmbus_post_message()

Most often, hv_vmbus_post_message() doesn't fail. However, it fails
intermittently when GPADLs of large shared memory is to be established
with the host, e.g. on the hn(4) attach path: a GPADL of 15MB sendbuf
is created, for which lots of messages will be flooded to the host.
The host side tries to throttle the message rate by returning
HV_STATUS_INSUFFICIENT_BUFFERS.

Before this commit, we do several retries for failed messages, but the
delay between each retry is pretty/too low, which will cause sporadic
message posting failure. We now use large delay (>=1ms) between each
retry to fix the message posting failure.

Submitted by: Dexuan Cui <decui microsoft com>
Reviewed by: sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5715
mbus/hv_connection.c
mbus/hv_vmbus_priv.h
8d85ea9ae3d1812fa86cfac5ef87a606c29c86a9 22-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/hn: When short of mbufs on the RX path, don't spam the console.

Instead, increase the IQDROPS counter.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5693
etvsc/hv_netvsc_drv_freebsd.c
a0ef0ff6aef730dc4384ab7ac5799580e279a441 22-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Factor out hn_set_lro_lenlim()

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5692
etvsc/hv_netvsc_drv_freebsd.c
de7ddcd5bb02e9be801f0b3c669f3d85a03b6d06 22-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Reduce TCP segment aggregation limit for multiple RX rings

This mainly used to improve ACK timeliness when multiple RX rings
are enabled.

This value gives the best performance in both Azure and Hyper-V
environment, w/ both 10Ge and 40Ge using non-{INVARIANTS,WITNESS}
kernel.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5691
etvsc/hv_netvsc_drv_freebsd.c
68fbcea1f7232ab04eaf7e05dbb2efc0ee5f8719 22-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Remove NULL check for taskqueue_create_fast(M_WAITOK)

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: Dexuan Cui <decui microsoft com>, sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5215
mbus/hv_vmbus_drv_freebsd.c
a0d63dadacf4bdac1e2b890250b81e90940f4bc8 22-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Use taskqueue_fast for non-performance critical messages

This gets rid of the per-cpu SWIs.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: Dexuan Cui <decui microsoft com>, sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5215
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
f63fc21fdc1517b6b714bafdf2b29a99ad2c2d3b 22-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/evttimer: Use an independent message slot so that it can work

Using the same message slot as the other types of the messages has
the side effect that the event timer message could be deferred to
the swi threads to run (lacking of trapframe and the original code
didn't even handle that, so the event timer was actually broken).

As of this commit we use an independent message slot for event timer,
so that we could handle all of event timer messages in the interrupt
handler directly. Note, the message slot for event timer is still
bind to the same interrupt vector as the other types of messages.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: sephe
Discussed with: Jun Su <junsu microsoft com>, Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5696
mbus/hv_et.c
mbus/hv_hv.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
ec5a1ffccc7228677634b794bff1cdea613a3536 21-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Implement bus_child_pnpinfo_str method

Submitted by: Jun Su <junsu microsoft com>
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5669
mbus/hv_vmbus_drv_freebsd.c
69c67129ef741e6f5b0a83aad47136a2cb177916 21-Mar-2016 sephe <sephe@FreeBSD.org> hyperv: Factor out snprinf_hv_guid()

Submitted by: Ju Sun <junsu microsoft com>
Reviewed by: Dexuan Cui <decui microsoft com>, sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5651
nclude/hyperv.h
tilities/hv_kvp.c
mbus/hv_vmbus_drv_freebsd.c
3ab0a5dbab2d261aae76850db74a921d46c135d8 10-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Make the # of TX rings configurable.

Rename the tunables to avoid confusion.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5578
etvsc/hv_netvsc_drv_freebsd.c
d48c96020a6f1997d5529f0ebb05b89d210eac73 10-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Factor out hn_channel_attach

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5577
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
44ec51ed734625d05a72560f368990635e373cb5 10-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Move if_initname to an earlier place

So that functions shared w/ attach path could use if_printf().

While I'm here, remove unnecessary if_dunit and if_dname assignment.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5576
etvsc/hv_netvsc_drv_freebsd.c
34dccb186cbb3f1fe0eb3877c9f156d761bfb4c6 04-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Add per-TX ring stats for # of transmitted packets

MFC after: 2 weeks
Sponsored by: Microsoft OSTC
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
4d21c6fd3ea01f45bc5c11caf049590a83ba64b3 04-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Pass channel to send done callbacks.

Mainly to strigent the data packet send done check.

MFC after: 2 weeks
Sponsored by: Microsoft OSTC
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
d9fcd284eb0719f7e67e79fd5bc76e1f00454972 04-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Add multiple channel support, a.k.a. vRSS

Each channel contains one RX ring and one TX ring. And we
try to distribute the channels to different evenly.

Note: Currently we don't have enough information to extract
the RSS type and RSS hash value from the received packets.

This greatly improves the TX/RX performance for 8 virtual CPU
Hyper-V over 10Ge: it can max out 10Ge for TCP when multiple
RX/TX rings are enabled.

This almost doubles the TX/RX performance for locally connected
Hyper-Vs: was 6Gbps w/ 128 TCP streams, now 11Gbps w/ multiple
RX/TX rings enabled.

It is not enabled by default; it will be switched on after more
tests.

Collaborated with: Hongjiang Zhang <honzhan microsoft com>
MFC after: 2 week
Sponsored by: Microsoft OSTC
nclude/hyperv.h
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis.h
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
mbus/hv_channel_mgmt.c
0b49e8be12cef3ef5a660191f2960b680dc19028 02-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Make # of rings configurable

And since the host may not being able to allocate the # of rings
requested by us, save the # of rings allocated by the host in the
ring_inuse counters; use ring_inuse counters for run time operation.

This paves the way for the upcoming vRSS support.

MFC after: 1 week
Sponsored by: Microsoft OSTC
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
2867239b7d31f10e8a3776bf9e7c597a5d99cf4f 02-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Fix typo in comment

MFC after: 1 week
Sponsored by: Microsoft OSTC
etvsc/hv_net_vsc.c
b3707d51d2a26fe52f58b586b7b4e6d845702908 02-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Make read buffer per-channel

Submitted by: Hongjiang Zhang <honzhan microsoft com>
Reorganized by: sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC
nclude/hyperv.h
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
e63d109762412f1f9b5d3c56ddafd80f00275989 02-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Pass channel to hv_nv_on_receive_completion()

While I'm here, staticize this function.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
Modified by: sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
0e614805cdb2afcbda109c46dfea47be879374fd 02-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/chan: Factor out the vcpu setting

And use it for cpu0 assignment; it does not sound right to assume that
cpu0 maps to vcpu0. And this factored out function will be exposed to
drivers, if driver specific CPU binding is needed, e.g. hn(4).

Move default cpu select after saving channel offer message. This makes
sure that all useful information of the channel has been setup.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5504
mbus/hv_channel_mgmt.c
bdb3e3de734f08e507040b04ce33879721108fe5 02-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/chan: Function renaming; no functional change

The renamed function create a sysctl tree for channel, and many
non-statistics nodes exists, so don't claim it only adds sysctl
nodes for statistics.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5503
mbus/hv_channel.c
e1124555b1dbc006105e9d46faa296b020dab5b1 02-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/chan: Add sysctl node to check whether monitor is allocated or not

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5502
mbus/hv_channel.c
15b2caff0f7170f0c4bb31748f12833744f7985c 01-Mar-2016 jhb <jhb@FreeBSD.org> Remove taskqueue_enqueue_fast().

taskqueue_enqueue() was changed to support both fast and non-fast
taskqueues 10 years ago in r154167. It has been a compat shim ever
since. It's time for the compat shim to go.

Submitted by: Howard Su <howard0su@gmail.com>
Reviewed by: sephe
Differential Revision: https://reviews.freebsd.org/D5131
mbus/hv_connection.c
b0c32dfce5d841baeb471e44c38123707f37e96e 01-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/channel: Nuke useless stack variable

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5499
mbus/hv_channel.c
65d6c54a61e6a072bf74f79f14efa0bc0954ab5e 01-Mar-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Set hash per-packet-info for each packet transmission

So that the host could dispatch the TX done back to this TX ring's
owner channel

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5498
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis.h
62517cc3146261ea135285ef32ce74057c20648a 29-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/channel: Add sysctl node for channel owner cpu

And add sysctl node for sub-channel's channel id.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5489
mbus/hv_channel.c
e6e9e0871bcff3f6ba412aa099d12b4864107af4 29-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Utilize mbuf flowid

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5488
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
3dc97c4341b6c5a0163c12badc7f50628cecf4e6 29-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Put LRO aggregation limit settings under FreeBSD version check

This simplifies MFC to 10-stable

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5487
etvsc/hv_netvsc_drv_freebsd.c
4e31975335d1e8909602fc4d865c7571ffc02db2 29-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Switch to if_transmit by default after r296178

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5485
etvsc/hv_netvsc_drv_freebsd.c
8b886cf3a72e7ac9a7a9b625f43e0deb76ed2952 29-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/channel: Add debug sysctl nodes for channel indices

It would serve as a debug tool, if the shared buffer ring's indices
stopped updating.

Submitted by: HongJiang Zhang <honzhan microsoft com>
Reviewed by: sephe, Jun Su <junsu microsoft com>
Modified by: sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5402
mbus/hv_channel.c
mbus/hv_ring_buffer.c
mbus/hv_vmbus_priv.h
77e3b4f157e3cdacd1a05938fff6478f8da56d35 29-Feb-2016 sephe <sephe@FreeBSD.org> hyperv: Use proper fence function to keep store-load order for msgs

sfence only makes sure about the store-store order, which is not
sufficient here. Use atomic_thread_fence_seq_cst() as suggested
jhb and kib (a locked op in the nutshell, which should have the

Reviewed by: jhb, kib, Jun Su <junsu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5436
mbus/hv_vmbus_drv_freebsd.c
3ad5c70e916b469f068dc8ad647efd070683443f 26-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Make transmission path channel aware

Chimney sending buffer still needs conversion, which will be done
along with the upcoming vRSS support.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5457
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
87bdb7fbba0cfa15ed24a10d605b45f870000ae7 26-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Remove the useless num_outstanding_sends

We rely on taskqueue draining now.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5456
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
7f715ff4c3a5722b100666951b26064f160f641a 26-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Associate TX/RX ring with channel

This fixes the TX/RX ring selection for TX/RX done.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5454
nclude/hyperv.h
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
f2f0a7acdb3132dd87c9a03f4e21309a7b5d03b8 26-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Pass channel to TX/RX done

This is preamble to associate the TX/RX rings to their channel.

While I'm here, revoke unused netvsc_recv_rollup.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5453
etvsc/hv_net_vsc.c
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis.h
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
c7e0ebb7ac1921bc625c7f67fa61024e8f88b072 26-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Pass channel as the channel callback argument

This is the preamble to pass channel back to hn(4) upon TX/RX done.

Reviewed by: Hongjiang Zhang <honzhan microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5452
etvsc/hv_net_vsc.c
72da1841b8df04fa1bfadaaeb0b41c49f41ffda0 26-Feb-2016 sephe <sephe@FreeBSD.org> hyperv: Always set device for channels

And unregister hv_device only for primary channels, who own the hv_device.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5451
nclude/hyperv.h
torvsc/hv_storvsc_drv_freebsd.c
mbus/hv_channel_mgmt.c
f35c38ca8b4a1bc96f36e2e5646f37e10933bfc1 26-Feb-2016 sephe <sephe@FreeBSD.org> hyperv: Remove useless channel inbound_lock

It serves no purpose.

Reviewed by: Hongjiang Zhang <honzhan microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5450
nclude/hyperv.h
etvsc/hv_net_vsc.c
torvsc/hv_storvsc_drv_freebsd.c
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
90988c1816c4c962221da2b8a89714543b6d9392 26-Feb-2016 sephe <sephe@FreeBSD.org> hyperv: Use atomic_fetchadd_int to get GPADL id.

Reviewed by: Hongjiang Zhang <honzhan microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5439
mbus/hv_channel.c
8664f74f796f4217fedd62af6b3653c6091f73e4 25-Feb-2016 sephe <sephe@FreeBSD.org> hyperv: Wait 5 seconds for hyperv result, instead of 500ms

This addresses various devices (network, stoarge) attach failure.

Reported by: Hongxiong Xian <v-hoxian microsoft com>
Tested by: Hongxiong Xian <v-hoxian microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5435
etvsc/hv_rndis_filter.c
mbus/hv_channel.c
mbus/hv_connection.c
a9e53514f10ae3c5a2aaad205f978f9a6787fcf4 25-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Hold the TX ring lock then drain TX desc buf_ring

Reported by: Hongxiong Xian <v-hoxian microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
etvsc/hv_netvsc_drv_freebsd.c
c2acb503cc21bd09f066ee7a1192a4d00e2e740c 25-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Implement ifnet.if_transmit method

It will be turned on by default later.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5415
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
e015c6acdca331874c7639de84d171a0b237f127 24-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Use free(9) for interrupt page; it is allocated by malloc(9)

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5417
mbus/hv_connection.c
630fac3f5985f54bdac85fb89c0e01e9cf3e955d 24-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/utils: Code rearrange and cleanup

Split heartbeat, shutdown and timesync out of utils code
and name them properly.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: adrian, sephe, Hongjiang Zhang <honzhan microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5216
nclude/hyperv.h
tilities/hv_heartbeat.c
tilities/hv_kvp.c
tilities/hv_kvp.h
tilities/hv_shutdown.c
tilities/hv_timesync.c
tilities/hv_util.c
tilities/hv_util.h
48943a725d0500ad8b6e0f52178b8c2b0bd3ec5c 23-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/stor: Fix print format

Detected by: PVS Static Analysis
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5388
torvsc/hv_storvsc_drv_freebsd.c
6d826ae146ff766a3ca70a448498cf419b43e702 23-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Use IFQ_DRV_PREPEND instead of IF_PREPEND

IF_PREPEND promises out-of-order packet sending when the TX desc list
is depleted. It was overlooked and copied blindly when the transmission
path was partially rewritten.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5386
etvsc/hv_netvsc_drv_freebsd.c
e53b711aeb4e6e357eb2ab03ce34b307d3706ae6 23-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Factor out hn_send_pkt() from hn_start_locked()

It will be shared w/ the upcoming ifnet.if_transmit method
implementation.

No functional change.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5385
etvsc/hv_netvsc_drv_freebsd.c
ad68cf93b11d0db8c7664ce8557cc38db6aa7468 22-Feb-2016 skra <skra@FreeBSD.org> As <machine/vmparam.h> is included from <vm/vm_param.h>, there is no
need to include it explicitly when <vm/vm_param.h> is already included.

Suggested by: alc
Reviewed by: alc
Differential Revision: https://reviews.freebsd.org/D5379
etvsc/hv_netvsc_drv_freebsd.c
f934858b00eda7d7460269d213081d11998103d4 22-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Add TX method for txeof processing.

Preamble to implement ifnet.if_transmit method.

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5346
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
0c4347a68ad817361671d46a6732edf603e2a04e 22-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Staticize and rename packet TX done function

It is only used in hv_netvsc_drv_freebsd.c; and rename it to hn_tx_done()
mainly to reserve "xmit" for ifnet.if_transmit implement.

While I'm here, remove unapplied comment.

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5345
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
2f000e909dce7f35ebd2362ad0af977d432167e6 22-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Rename TX related function and struct fields a bit

Preamble to implement the ifnet.if_transmit method.

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5344
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
85642385a3a0dabe19e7402beebdc7cd305b55b1 19-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Free the txdesc buf_ring when the TX ring is destroyed

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5318
etvsc/hv_netvsc_drv_freebsd.c
eb31612e67176eaa7d18e1f735507a1447523553 19-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Enable IP header checksum offloading for WIN8 (WinServ2012)

Tested on Windows Server 2012.

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5317
etvsc/hv_netvsc_drv_freebsd.c
3bbfde8f104b0c0d8c1b830fb8d227528b61e8b2 19-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Add option to bind TX taskqueues to the specified CPU

It will be used to help tracking host side transmission ring selection
issue; and it will be turned on by default, once we have concrete result.

Reviewed by: adrian, Jun Su <junsu microsoft com>
Approved by: adrian (mento)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5316
etvsc/hv_netvsc_drv_freebsd.c
1d033f316cb6507343722bb7b0d069b0a6062613 18-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Use buf_ring for txdesc list

So one spinlock is avoided, which would be potentially dangerous for
virtual machine, if the spinlock holder was scheduled out by the host,
as noted by royger.

Old spinlock based txdesc list is still kept around, so we could have
a safe fallback.

No performance regression nor improvement is observed.

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5290
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
d132cf04ec42a0805c159e1367742a61a032bfdd 18-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Split TX ring data structure out of softc

This paves the way for upcoming vRSS stuffs and eases more code cleanup.

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5283
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
eae1d5211589255a25c686339bdf7e94002c2706 18-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Use non-fast taskqueue for transmission

Performance stays same; so no need to use fast taskqueue here.

Suggested by: royger
Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5282
etvsc/hv_netvsc_drv_freebsd.c
96fda2e2fae2eb88ef880eb83ce4ecd5b589be3b 18-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Use taskqueue_enqueue()

This also eases experiment on the non-fast taskqueue.

Reviewed by: adrian, Jun Su <junsu microsoft com>
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5276
etvsc/hv_netvsc_drv_freebsd.c
6d988a8a3aceabb1bed0172de3194aa3ff54ac3c 18-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Split RX ring data structure out of softc

This paves the way for upcoming vRSS stuffs and eases more code cleanup.

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5275
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
8fbe53549fb82d749ca71f2f94c425f9092b20a7 18-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Change global tunable prefix to hw.hn

And use SYSCTL+CTLFLAG_RDTUN for them.

Suggested by: adrian
Reviewed by: adrian, Hongjiang Zhang <honzhan microsoft com>
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5274
etvsc/hv_netvsc_drv_freebsd.c
0bc3ca0f91f8d99899b9215b20ca30dd4f58516d 18-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Always do transmission scheduling.

This one gives the best performance so far.

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5273
etvsc/hv_netvsc_drv_freebsd.c
6c751167c1da18ab11e3750e5c124a20f3781453 18-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Add option to allow sharing TX taskq between hn instances

It is off by default. This eases further experimenting on this driver.

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5272
etvsc/hv_netvsc_drv_freebsd.c
36548a454124b9d013c3f537fef8fcff29c73b04 18-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Set the TCP ACK/data segment aggregation limit

Set TCP ACK append limit to 1, i.e. aggregate 2 ACKs at most. Aggregating
anything more than 2 hurts TCP sending performance in hyperv. This
significantly improves the TCP sending performance when the number of
concurrent connetion is low (2~8). And it greatly stabilizes the TCP
sending performance in other cases.

Set TCP data segments aggregation length limit to 37500. Without this
limitation, hn(4) could aggregate ~45 TCP data segments for each
connection (even at 64 or more connections) before dispatching them to
socket code; large aggregation slows down ACK sending and eventually
hurts/destabilizes TCP reception performance. This setting stabilizes
and improves TCP reception performance for >4 concurrent connections
significantly.

Make them sysctls so they could be adjusted.

Reviewed by: adrian, gallatin (previous version), hselasky (previous version)
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5185
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
edc6e1d8ce18726bd50edfa28716a970ea318afa 14-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Fix typo in comment

Noticed by: avos
Reviewed by: adrian, avos, Hongjiang Zhang <honzhan microsoft com>
Approved by: adrian
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5199
etvsc/hv_netvsc_drv_freebsd.c
53270ee78850775ed6b7c609013336e470e9c5fc 05-Feb-2016 sephe <sephe@FreeBSD.org> hyperv: Use malloc for page allocation.

We will eventually convert them to use busdma.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: adrian, sephe, Dexuan Cui <decui microsoft com>
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5087
mbus/hv_channel.c
mbus/hv_connection.c
mbus/hv_vmbus_priv.h
9cc4c0881fabfdb6aa445c5bcb5bbb01f5b801f4 05-Feb-2016 sephe <sephe@FreeBSD.org> hyperv: Use WAITOK in the places where we can wait

And convert rndis non-hot path spinlock to mutex.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: adrian, sephe
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5081
etvsc/hv_net_vsc.c
etvsc/hv_rndis_filter.c
mbus/hv_connection.c
mbus/hv_hv.c
mbus/hv_vmbus_drv_freebsd.c
241c7a11bd40d303492821ebef545ea3ffbca849 05-Feb-2016 sephe <sephe@FreeBSD.org> hyperv: Use standard taskqueue instead of hv_work_queue

HyperV code was ported from Linux. There is an implementation of
work queue called hv_work_queue. In FreeBSD, taskqueue could be
used for the same purpose. Convert all the consumer of hv_work_queue
to use taskqueue, and remove work queue implementation.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: adrian, Hongjiang Zhang <honzhan microsoft com>
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4963
nclude/hyperv.h
tilities/hv_kvp.c
tilities/hv_util.c
mbus/hv_channel_mgmt.c
mbus/hv_connection.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
43993ba1f9ee4bff5c7ee1666dde2f5fc919456b 05-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Add an option to always do transmission scheduling

It is off by default. This eases more experiment on hn(4).

Reviewed by: adrian, Hongjiang Zhang <honzhan microsoft com>
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5175
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
7430ccc0b2ffdfeff940e281d6587c8b43711180 05-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Move LRO flush to the channel processing rollup

This significantly increases LRO aggregation ratio when there are
large amount of connections (improves reception performance a lot).

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5167
etvsc/hv_netvsc_drv_freebsd.c
20bba3d409e4485f894baa5adf473c71e506e05d 05-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Increase LRO entry count to 128 by default

hn(4) only has one RX ring currently, so default 8 LRO entries
are too small.

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5166
etvsc/hv_netvsc_drv_freebsd.c
3652c35a2d3ff5c1dd4988bb765c0007e0e950a6 05-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Recover half of the chimney sending space

We lost half of the chimney sending space, because we mis-used
ffs() on a 64 bits mask, where ffsl() should be used.

While I'm here:
- Use system atomic operation instead.
- Stringent chimney sending index assertion.

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5159
etvsc/hv_net_vsc.c
3ebbdfb23a21faaa68626895a808fcdce3cc5fce 05-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Factor out hn_encap() from hn_start_locked()

It will be shared w/ upcoming ifnet.if_transmit implementaion.

No functional changes.

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5158
etvsc/hv_netvsc_drv_freebsd.c
0f6048195a8cbc8c5077108f37514f9c77145c4a 05-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Obey IFCAP_RXCSUM configure

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5104
etvsc/hv_netvsc_drv_freebsd.c
2f57b75e686fe630f9eb8d2bcee5eb9463002c1a 05-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Add sysctls to trust host side UDP and IP csum verification

Reviewed by: adrian, Hongjiang Zhang <honzhan microsoft com>
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5103
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
25d1f76bed7e8e6f5df4963d9b9bb400cb494129 05-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Enable UDP RXCSUM

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5102
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
f8cf3cfcd0044ac1740e661a5bd94e2f10a684e8 05-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Enable IP header checksum offloading

So that:
- TCP/IP stack will not do unnecessary IP header checksum for TSO
packets.
- Reduce guest load for non-TSO IP packets.

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5099
etvsc/hv_netvsc_drv_freebsd.c
f74912c36af597a5dfb50308315ee2d73390dac3 05-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Reorganize TX csum offloading

- For non-TSO offloading, we don't need to access mbuf to know
which csum offloading is requested, we can just use the
CSUM_{IP,TCP,UDP} in the csum_flags.
- For TSO offloading, we still can depend on CSUM_{TSO4,TSO6}
in the csum_flags to tell whether the TSO packet is an IPv4
TSO packet or an IPv6 TSO packet.

This streamlines csum offloading handling (remove the two goto)
and allows us the nuke the unnecessary get_transport_proto_type().

Reviewed by: adrian, Hongjiang Zhang <honzhan microsoft com>
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5098
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
072319c51c99365ea0478266ce51c6192d07afa8 05-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Avoid duplicate csum features settings

- Record csum features in softc, so we don't need to duplicate the
logic from attach path to ioctl path.
- Protect if_capenable and if_hwassist changes by main lock.
- Prefer turn on/off bits in if_hwassist explicitly instead of using
XOR.

Reviewed by: adrian, Hongjiang Zhang <honzhan microsoft com>
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5085
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
4b1b0d73e2df6a6716d3b447b0e18133218ee66b 05-Feb-2016 sephe <sephe@FreeBSD.org> hyperv/stor: Fix the NULL pointer dereference

Reported by: Netapp
Submitted by: Hongjiang Zhang <honzhan microsoft com>
Reviewed by: adrian, sephe, Dexuan Cui <decui microsoft com>
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5097
torvsc/hv_storvsc_drv_freebsd.c
bfd20a73f3257eeeb2bfe0392c20705dff23849f 27-Jan-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Event handling code refactor.

- Use taskqueue instead of swi for event handling.
- Scan the interrupt flags in filter
- Disable ringbuffer interrupt mask in filter to ensure no unnecessary
interrupts.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: adrian, sephe, Dexuan <decui microsoft com>
Approved by: adrian (mentor)
MFC after: 2 weeks
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4920
nclude/hyperv.h
mbus/hv_channel.c
mbus/hv_connection.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
cb8114cddde04c71f498ec034550e219a6adac73 26-Jan-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Improve sending performance

- Avoid main lock contention by trylock for if_start, if that fails,
schedule TX taskqueue for if_start
- Don't do direct sending if the packet to be sent is large, e.g.
TSO packet.

This change gives me stable 9.1Gbps TCP sending performance w/ TSO
over a 10Gbe directly connected network (the performance fluctuated
between 4Gbps and 9Gbps before this commit). It also improves non-
TSO TCP sending performance a lot.

Reviewed by: adrian, royger
Approved by: adrian (mentor)
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5074
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
23ee6b6bf28dd68ee75ec7a21424cd765fb32fb4 25-Jan-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Avoid extra copy of page information.

The page information array could contain up to 32 elements (i.e. 512B).
And on network side w/ TSO, 11+ (176B+) elements, i.e. ~44K TSO packet,
in the page information array is quite common.

This saves us some cpu cycles.

Reviewed by: adrian, delphij
Approved by: adrian (mentor)
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4992
mbus/hv_channel.c
271daa3aab08274e110c384e43baf70bef5d49ec 25-Jan-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Trust host TCP segment checksum verification by default.

According to all available information, VMSWITCH always does the
TCP segment checksum verification before sending the segment to
guest.

Reviewed by: adrian, delphij, Hongjiang Zhang <honzhan microsoft com>
Approved by: adrian (mentor)
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4991
etvsc/hv_netvsc_drv_freebsd.c
d90c6457ead3152460e5d1ee19b0180fdfa2bc38 25-Jan-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Remove unnecessary zeroing out the netvsc_packet

All used fields are setup one by one, so there is no need to zero
out this large struct.

While I'm here, move the stack variable near its usage.

Reviewed by: adrian, delphij, Jun Su <junsu microsoft com>
Approved by: adrian (mentor)
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4978
etvsc/hv_netvsc_drv_freebsd.c
57b5318144b4a54c88a4894aaf4ad096bd47ad07 25-Jan-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Use m_copydata for chimney sending.

While I'm here, move stack variables near their usage.

Reviewed by: adrian, delphij, Jun Su <junsu microsoft com>
Approved by: adrian (mentor)
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4977
etvsc/hv_netvsc_drv_freebsd.c
0a5322d713fae91f59f47ae6ebe361fa5e68c91f 25-Jan-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Partly rework transmission path

- Avoid unnecessary malloc/free on transmission path.
- busdma(9)-fy transmission path.
- Properly handle IFF_DRV_OACTIVE. This should fix the network
stalls reported by many.
- Properly setup TSO parameters.
- Properly handle bpf(4) tapping. This 5 times the performance
during TCP sending test, when there is one bpf(4) attached.
- Allow size of chimney sending be tuned on a running system.
Default value still needs more test to determine.

Reviewed by: adrian, delphij
Approved by: adrian (mentor)
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4972
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis.h
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
132b95f01cef8eea9b84c33c9e5e689de4dd850a 22-Jan-2016 sephe <sephe@FreeBSD.org> hyperv/stor: Verify returned inquiry data before further dispatching

Windows 10 and Window 2016 will return all zero inquiry data for
non-existing slots. If we dispatched them, then a lot of useless
(0 sized) disks would be created. So we verify the returned inquiry
data (valid type, non-empty vendor/product/revision etc.), before
further dispatching.

Minor white space cleanup and wording fix.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
Reviewed by: adrian, sephe, Jun Su <junsu microsoft com>
Approved by: adrian (mentor)
Modified by: sephe
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4928
torvsc/hv_storvsc_drv_freebsd.c
3e83d3a20344f0535767a5d9cb110d3e9571c049 22-Jan-2016 sephe <sephe@FreeBSD.org> hyperv/vmbus: Lookup channel through id table

Vmbus event handler will need to find the channel by its relative
id, when software interrupt for event happens. The original lookup
searches the channel list, which is not very efficient. We now
create a table indexed by the channel relative id to speed up
the channel lookup.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
Reviewed by: delphij, adrain, sephe, Dexuan Cui <decui microsoft com>
Approved by: adrian (mentor)
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4802
mbus/hv_channel_mgmt.c
mbus/hv_connection.c
mbus/hv_vmbus_priv.h
456370e53073cd38d0ddc4001283f1c131d1428e 19-Jan-2016 hselasky <hselasky@FreeBSD.org> Add optimizing LRO wrapper:

- Add optimizing LRO wrapper which pre-sorts all incoming packets
according to the hash type and flowid. This prevents exhaustion of
the LRO entries due to too many connections at the same time.
Testing using a larger number of higher bandwidth TCP connections
showed that the incoming ACK packet aggregation rate increased from
~1.3:1 to almost 3:1. Another test showed that for a number of TCP
connections greater than 16 per hardware receive ring, where 8 TCP
connections was the LRO active entry limit, there was a significant
improvement in throughput due to being able to fully aggregate more
than 8 TCP stream. For very few very high bandwidth TCP streams, the
optimizing LRO wrapper will add CPU usage instead of reducing CPU
usage. This is expected. Network drivers which want to use the
optimizing LRO wrapper needs to call "tcp_lro_queue_mbuf()" instead
of "tcp_lro_rx()" and "tcp_lro_flush_all()" instead of
"tcp_lro_flush()". Further the LRO control structure must be
initialized using "tcp_lro_init_args()" passing a non-zero number
into the "lro_mbufs" argument.

- Make LRO statistics 64-bit. Previously 32-bit integers were used for
statistics which can be prone to wrap-around. Fix this while at it
and update all SYSCTL's which expose LRO statistics.

- Ensure all data is freed when destroying a LRO control structures,
especially leftover LRO entries.

- Reduce number of memory allocations needed when setting up a LRO
control structure by precomputing the total amount of memory needed.

- Add own memory allocation counter for LRO.

- Bump the FreeBSD version to force recompilation of all KLDs due to
change of the LRO control structure size.

Sponsored by: Mellanox Technologies
Reviewed by: gallatin, sbruno, rrs, gnn, transport
Tested by: Netflix
Differential Revision: https://reviews.freebsd.org/D4914
etvsc/hv_netvsc_drv_freebsd.c
796a32d5d8f99b19b28222a29d1dced45a802cea 14-Jan-2016 sephe <sephe@FreeBSD.org> hyperv: set receive buffer size according to NVSP protocol version

If the NVSP protocol version is not greater than NVSP_PROTOCOL_VERSION_2,
then the recv buffer size is 15MB, otherwise the buffer size is 16MB.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
Reviewed by: royger, Dexuan Cui <decui microsoft com>, adrian
Approved by: adrian (mentor)
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4814
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
8453ef2fe2f8f988ab353a63d33db069c040309c 14-Jan-2016 sephe <sephe@FreeBSD.org> hyperv: add interrupt counters

Submitted by: Howard Su <howard0su gmail com>
Reviewed by: royger, Dexuan Cui <decui microsoft com>, adrian
Approved by: adrian (mentor)
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4693
mbus/hv_connection.c
mbus/hv_vmbus_drv_freebsd.c
8d45cbc0b64c600ed23a3d5f2e846340c47ae4b6 14-Jan-2016 sephe <sephe@FreeBSD.org> hyperv: implement an event timer

Submitted by: Howard Su <howard0su@gmail.com>
Reviewed by: delphij, royger, adrian
Approved by: adrian (mentor)
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4676
mbus/hv_et.c
mbus/hv_hv.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
929b65cffca9614c601b4a36df1acac5150d0787 14-Jan-2016 sephe <sephe@FreeBSD.org> hyperv: remove unused vmbus definitions

We don't need them at all.

Submitted by: Dexuan Cui <decui microsoft com>
Sponsored by: Microsoft OSTC
Reviewed by: royger, adrian, delphij
Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D4595
nclude/hyperv.h
a3d3d84a95935e2c2fc259d5d825bd0768f8f2ef 14-Jan-2016 sephe <sephe@FreeBSD.org> hyperv: use x86 generic code to do the hypervisor detection

This is first step to move the generic part of HV code into kernel instead
of module, so that it is possible to use hypercall to implement some other
paravirtualization code in the kernel.

Submitted by: Howard Su <howard0su@gmail.com>
Reviewed by: royger, delphij, adrian
Approved by: adrian (mentor)
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D3072
mbus/hv_connection.c
mbus/hv_hv.c
mbus/hv_vmbus_drv_freebsd.c
8767bf77c4cc94de7b5c2c60f2cd35938425be0d 14-Jan-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Unbreak LINT-NOIP

Reported by: bz
Approved by: adrain (mentor)
Sponsored by: Microsoft OSTC
etvsc/hv_netvsc_drv_freebsd.c
0517d6cfae2a854c90ccf67ec23cfa18945a67ac 12-Jan-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Removed unused netvsc_init()

Submitted by: Dexuan Cui <decui microsoft com>
Reviewed by: me, adrian, royger,
Hongjiang Zhang <honzhan microsoft com>
Approved by: adrian (mentor)
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4594
etvsc/hv_netvsc_drv_freebsd.c
b0c6076d095bb9c7e2d0d02477484605e62c01f4 12-Jan-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Avoid mbuf cluster allocation, if the packet is small.

This one mainly avoids mbuf cluster allocation for TCP ACKs during
TCP sending tests. And it gives me ~200Mbps improvement (4.7Gbps
-> 4.9Gbps), when running iperf3 TCP sending test w/ 16 connections.

While I'm here, nuke the unnecessary zeroing out pkthdr.csum_flags.

Reviewed by: adrain
Approved by: adrian (mentor)
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4853
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
fa64dde96e6db540e75874fd06f000187af0924d 12-Jan-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Implement SIOC[SG]IFMEDIA support

Many applications and kernel modules (e.g. bridge) rely on the ifmedia
status report; give them what they want.

Submitted by: Dexuan Cui <decui microsoft com>
Reviewed by: Jun Su <junsu microsoftc com>, me, adrian
Modified by: me (minor)
Original differential: https://reviews.freebsd.org/D4611
Differential Revision: https://reviews.freebsd.org/D4852
Approved by: adrian (mentor)
Sponsored by: Microsoft OSTC
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
b493955d70f7db2ca259d1243bc39bc21c749c7b 12-Jan-2016 sephe <sephe@FreeBSD.org> hyperv/hn: Implement LRO

- Implement the LRO using tcp_lro APIs, and LRO is enabled by default.
- Add several stats sysctl nodes.
- Check IP/TCP length before sending the packet to tcp_lro_rx(), if host
does not provide RX csum information (*); and add an option through
sysctl to always trust host TCP segment csum checks (default is off).
- Add sysctl to control the LRO entry depth; it is disabled by default.
It is used to avoid holding too much TCP segments in driver. Limiting
the LRO entry depth helps a lot in a one/two streams RX test.

This one 3x the RX performance on my local test (3Gbps -> 10Gbps), and
~2x the RX performance over a directly connected 40Ge network (5Gbps ->
9Gbps).

(*) It seems the host stops supplying csum information, once the network
load is high. This still needs investigation...

Reviewed by: Hongjiang Zhang <honzhan microsoft com>,
Dexuan Cui <decui microsoft com>,
Jun Su <junsu microsoft com>,
delphij
Tested by: me (local),
Hongjiang Zhang <honzhan microsoft com>
(directly connected 40Ge)
Approved by: delphij (mentor), adrian (mentor, no objection)
With feedback from: delphij, Hongjiang Zhang <honzhan microsoft com>
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4824
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis.h
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
850d0994e48b0ef68d33875e26326d44931fcf1e 29-Dec-2015 delphij <delphij@FreeBSD.org> hyperv: vmbus: run non-blocking message handlers in vmbus_msg_swintr()

We'll remove the per-channel control_work_queue because it can't properly
do serialization of message handling, e.g., when there are 2 NIC devices,
vmbus_channel_on_offer() -> hv_queue_work_item() has a race condition:
for an SMP VM, vmbus_channel_process_offer() can run concurrently on
different CPUs and if the second NIC's
vmbus_channel_process_offer() -> hv_vmbus_child_device_register() runs
first, the second NIC's name will be hn0 and the first NIC's name will
be hn1!

We can fix the race condition by removing the per-channel control_work_queue
and run all the message handlers in the global
hv_vmbus_g_connection.work_queue -- we'll do this in the next patch.

With the coming next patch, we have to run the non-blocking handlers
directly in the kernel thread vmbus_msg_swintr(), because the special
handling of sub-channel: when a sub-channel (e.g., of the storvsc driver)
is received and being handled in vmbus_channel_on_offer() running on the
global hv_vmbus_g_connection.work_queue, vmbus_channel_process_offer()
invokes channel->sc_creation_callback, i.e., storvsc_handle_sc_creation,
and the callback will invoke hv_vmbus_channel_open() -> hv_vmbus_post_message
and expect a further reply from the host, but the handling of the further
messag can't be done because the current message's handling hasn't finished
yet; as result, hv_vmbus_channel_open() -> sema_timedwait() will time out
and th device can't work.

Also renamed the handler type from hv_pfn_channel_msg_handler to
vmbus_msg_handler: the 'pfn' and 'channel' in the old name make no sense.

Submitted by: Dexuan Cui <decui microsoft com>
Reviewed by: royger
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D4596
mbus/hv_channel_mgmt.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
1e469c559048fe6ec3641da3bb21ab87215c6506 29-Dec-2015 delphij <delphij@FreeBSD.org> hyperv: vmbus: remove the per-channel control_work_queue

Now vmbus_channel_on_offer() -> vmbus_channel_process_offer() can
safely run on the global hv_vmbus_g_connection.work_queue now.

We remove the per-channel control_work_queue to achieve the proper
serialization of the message handling.

I removed the bogus TODO in vmbus_channel_on_offer(): a vmbus offer
can only come from the parent partition, i.e., the host.

PR: kern/205156
Submitted by: Dexuan Cui <decui microsoft com>
Reviewed by: Howard Su <howard0su gmail com>, delphij
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D4597
nclude/hyperv.h
mbus/hv_channel_mgmt.c
41d598fdddc33d33a063c904043fea9bcc8867db 23-Dec-2015 ngie <ngie@FreeBSD.org> Remove redundant vmbus_select_outgoing_channel declaration already handled
in include/hyperv.h

This unbreaks the gcc 4.2.1 kernel build of hyperv

Differential Revision: https://reviews.freebsd.org/D4684
MFC after: 3 days
Reviewed by: royger
Sponsored by: EMC / Isilon Storage Division
mbus/hv_channel_mgmt.c
7330ea873340f2c45f4ce57a83881226f441e142 15-Dec-2015 royger <royger@FreeBSD.org> hyperv/kvp: wake up the daemon if it's sleeping due to poll()

Without the patch, there is a race condition: when poll() is invoked(),
if kvp_globals.daemon_busy is false, the daemon won't be timely
woke up, because hv_kvp_send_msg_to_daemon() can't wake up the daemon
in this case.

Submitted by: Dexuan Cui <decui@microsoft.com>
Sponsored by: Microsoft OSTC
Reviewed by: delphij, royger
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D4258
tilities/hv_kvp.c
a7bfea84af3452826c8a78ce3dfb68723af50ea3 22-Nov-2015 whu <whu@FreeBSD.org> Ignore the inbound checksum flags when doing packet forwarding in netvsc driver.

PR: 20363
Submitted by: whu
Reviewed by: royger, whu
Approved by: royger
MFC after: 1 week
Relnotes: No
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4131
etvsc/hv_netvsc_drv_freebsd.c
eb8aae544f9d158c06c16e632bfd51da386d28b6 22-Jul-2015 whu <whu@FreeBSD.org> Do not enable UDP checksum offloading when running on the Hyper-V on
Windows Server 2012 and earlier hosts.

Submitted by: whu
Reviewed by: royger
Approved by: royger
MFC after: 3 days
Relnotes: No
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D3086
etvsc/hv_netvsc_drv_freebsd.c
69a4e9c7040829950bf88b444250cc269e1484b6 27-Jun-2015 bz <bz@FreeBSD.org> Fix compilation without INET6 and without INET and INET6 after
offload support was introduced in r284746.

While here also fix the ioctl() handler for IPv4 added in r279819,
which was never compiled in given opt_inet.h was not included.
etvsc/hv_netvsc_drv_freebsd.c
71f5e477907b183fef33897b05d98b3a721f7670 24-Jun-2015 whu <whu@FreeBSD.org> TSO and checksum offloading support for Netvsc driver on Hyper-V.

Submitted by: whu
Reviewed by: royger
Approved by: royger
MFC after: 1 week
Relnotes: yes
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D2517
nclude/hyperv.h
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis.h
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
318c4f97e694c1972b55450cafe914f39977d179 22-May-2015 jkim <jkim@FreeBSD.org> 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
torvsc/hv_storvsc_drv_freebsd.c
e1077ab7dc2d0fb32e342337d5a456cbfaf9f2d4 18-May-2015 whu <whu@FreeBSD.org> Add support for SCSI disk hot add and remove. Also add padding according to
the requirement of different hypervisor releases.

Submitted by: whu
Reviewed by: royger
Approved by: royger
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D2512
torvsc/hv_storvsc_drv_freebsd.c
torvsc/hv_vstorage.h
0b81a496572c1f07b5403b35bdf7d54c37e4367e 29-Apr-2015 whu <whu@FreeBSD.org> Microsoft vmbus, storage and other related driver enhancements for HyperV.
- Vmbus multi channel support.
- Vector interrupt support.
- Signal optimization.
- Storvsc driver performance improvement.
- Scatter and gather support for storvsc driver.
- Minor bug fix for KVP driver.
Thanks royger, jhb and delphij from FreeBSD community for the reviews
and comments. Also thanks Hovy Xu from NetApp for the contributions to
the storvsc driver.

PR: 195238
Submitted by: whu
Reviewed by: royger, jhb, delphij
Approved by: royger
MFC after: 2 weeks
Relnotes: yes
Sponsored by: Microsoft OSTC
nclude/hyperv.h
torvsc/hv_storvsc_drv_freebsd.c
torvsc/hv_vstorage.h
tilities/hv_kvp.c
tilities/hv_util.c
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
mbus/hv_connection.c
mbus/hv_hv.c
mbus/hv_ring_buffer.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
6ec28e3ef5577476d1e4077999ef62ea3636937f 09-Mar-2015 delphij <delphij@FreeBSD.org> Fix CARP when in use in a HyperV environment:

- Bump link state when stopping or starting the interface;
- Don't handle SIOCGIFADDR specially, similar to r277103.

This change is based on a previous revision from Andy Zhang
(Microsoft) who did the diagnostic work and many thanks to
them for their help in supporting the HyperV work.

PR: kern/187203
MFC after: 2 weeks
etvsc/hv_netvsc_drv_freebsd.c
dd63bf99a2e07e9e0fae2c230c2dc6505f21618d 21-Nov-2014 smh <smh@FreeBSD.org> 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
torvsc/hv_storvsc_drv_freebsd.c
6306f795601112ca48fd1c75441b82ff98ca8b57 07-Nov-2014 glebius <glebius@FreeBSD.org> Remove struct arpcom. It is unused by most interface types, that allocate
it, except Ethernet, where it carried ng_ether(4) pointer.
For now carry the pointer in if_l2com directly.

Sponsored by: Netflix
Sponsored by: Nginx, Inc.
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
df9d3cfbe51efddf1b10c9fec6b33aa5e1b9a90c 24-Oct-2014 delphij <delphij@FreeBSD.org> Return BUS_PROBE_DEFAULT instead of BUS_PROBE_VENDOR or 0 for in-tree
driver. This change was verified by Microsoft.
etvsc/hv_netvsc_drv_freebsd.c
tordisengage/hv_ata_pci_disengage.c
torvsc/hv_storvsc_drv_freebsd.c
tilities/hv_util.c
7f34195e3d132fb8cd1a81e03265ef4373b87921 21-Oct-2014 gjb <gjb@FreeBSD.org> Fix an issue where a FreeBSD virtual machine provisioned in
the Microsoft Azure service does not recognize the second
attached disk on the system.

Submitted by: kyliel@Microsoft
Patched by: weh@Microsoft
PR: 194376
MFC after: 3 days
X-MFC-10.1: yes, ASAP
Sponsored by: The FreeBSD Foundation
torvsc/hv_storvsc_drv_freebsd.c
b3b337a80e78f4cc2d0c75f98e4685bee9c749c9 19-Sep-2014 glebius <glebius@FreeBSD.org> Mechanically convert to if_inc_counter().
etvsc/hv_netvsc_drv_freebsd.c
edc7ea3a5d36632b4b34de01da7109a81c9b39cf 13-Sep-2014 delphij <delphij@FreeBSD.org> Import HyperV Key-Value Pair (KVP) driver and daemon code by Microsoft,
many thanks for their continued support of FreeBSD.

While I'm there, also implement a new build knob, WITHOUT_HYPERV to
disable building and installing of the HyperV utilities when necessary.

The HyperV utilities are only built for i386 and amd64 targets.

This is a stable/10 candidate for inclusion with 10.1-RELEASE.

Submitted by: Wei Hu <weh microsoft com>
MFC after: 1 week
nclude/hyperv.h
tilities/hv_kvp.c
tilities/hv_kvp.h
tilities/hv_util.c
tilities/unicode.h
9b93b159b3ea9f280f03355c9555fe9aae9622fb 30-Aug-2014 glebius <glebius@FreeBSD.org> Use define from if_var.h to access a field inside struct if_data,
that resides in struct ifnet.

Sponsored by: Nginx, Inc.
etvsc/hv_netvsc_drv_freebsd.c
4ba44b5d1b7c7e2c3780164d22209a058d1f2d90 05-Apr-2014 imp <imp@FreeBSD.org> Make some unwise casts. On i386 these casts wind up being safe. Rather
than disturb the API, go with these casts to shut gcc up.
etvsc/hv_net_vsc.c
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis_filter.c
torvsc/hv_storvsc_drv_freebsd.c
0d3fbce5f2331d94d273480e7d61ca764e204a63 14-Mar-2014 delphij <delphij@FreeBSD.org> Hide a few messages under bootverbose.

Reviewed by: Abhishek Gupta
MFC after: 2 weeks
etvsc/hv_netvsc_drv_freebsd.c
5b661a59bd2579497e71bcc7bcfe2c5a4d29de55 06-Mar-2014 mav <mav@FreeBSD.org> Minor fix to r262789.

MFC after: 6 days
torvsc/hv_storvsc_drv_freebsd.c
e91188eee20c821ff614105cd5251e0c3e4a2ab2 05-Mar-2014 mav <mav@FreeBSD.org> Remove custom bus scanner code and fix use of CAM's default scanner.

This fixes kernel panic during boot, caused by incompatibility of recent
CAM locking changes and this bus scanner code.

Submitted by: Microsoft
MFC after: 1 week
torvsc/hv_storvsc_drv_freebsd.c
529a68392aaff36206eb2baffaee3a3f6ccebc12 16-Jan-2014 glebius <glebius@FreeBSD.org> Another round of removing historical mbuf(9) allocator flags.
They are breeding! New ones arouse since last round.

Sponsored by: Nginx, Inc.
etvsc/hv_netvsc_drv_freebsd.c
fe4a871aa66f0c4daf4c612d8f40db9fdb867583 10-Dec-2013 pjd <pjd@FreeBSD.org> Fix missing new line after:

Netvsc initializing...

during boot.
etvsc/hv_netvsc_drv_freebsd.c
ebba0d128d5f4183ac9f8f5a2895665ecdef4277 29-Oct-2013 delphij <delphij@FreeBSD.org> Don't reference pointer before testing whether it is
NULL.

Submitted by: Clement Lecigne <clecigne google com>
Reviewed by: grehan
MFC after: 3 days
etvsc/hv_netvsc_drv_freebsd.c
3e9a158ce7652da767f5b651a6b4d18234233cd8 29-Oct-2013 nwhitehorn <nwhitehorn@FreeBSD.org> More BUS_PROBE_NOWILDCARD sweeping. Some devices here (if_ath_ahb and siba)
resist easy conversion since they implement a great deal of their attach
logic inside probe(). Some of this could be fixed by moving it to attach(),
but some requires something more subtle than BUS_PROBE_NOWILDCARD.
mbus/hv_vmbus_drv_freebsd.c
f469ae1d459eb17461e1fdfa9af613fb107e7be2 28-Oct-2013 glebius <glebius@FreeBSD.org> Include necessary headers that now are available due to pollution
via if_var.h.

Sponsored by: Netflix
Sponsored by: Nginx, Inc.
etvsc/hv_net_vsc.c
etvsc/hv_netvsc_drv_freebsd.c
c8b87aac87e22758fbcdf291666bda6e70f5a0d5 13-Oct-2013 gibbs <gibbs@FreeBSD.org> Centralize the detection logic for the Hyper-V hypervisor.

Submitted by: Roger Pau Monné
Sponsored by: Citrix Systems R&D
Reviewed by: gibbs, grehan
Approved by: re (gjb)

sys/sys/systm.h:
* Add a new VM_GUEST type, VM_GUEST_HV (HyperV guest).

sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c:
sys/dev/hyperv/vmbus/hv_hv.c:
sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c:
* Set vm_guest to VM_GUEST_HV and use that on other HyperV related
devices instead of cloning the cpuid hypervisor check.
* Cleanup the vmbus_identify function.
tordisengage/hv_ata_pci_disengage.c
mbus/hv_hv.c
mbus/hv_vmbus_drv_freebsd.c
e4009f5516f79caa88c5fb675da03a4db378248e 12-Oct-2013 grehan <grehan@FreeBSD.org> Fix a lock-order reversal in the net driver by dropping the lock
and holding a reference prior to calling further into the hyperv
stack.

Added missing FreeBSD idents.

Submitted by: Microsoft hyperv dev team
Approved by: re@ (gjb)
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
35b7675f726443ac3856400e0cf111b9dfc30e93 11-Oct-2013 grehan <grehan@FreeBSD.org> Fix vmbus channel memory leak where incorrect length parameter was
being passed to contigfree().

Submitted by: Microsoft hyperv dev team
Approved by: re@ (glebius)
nclude/hyperv.h
mbus/hv_channel.c
7abe80694b31886fb2e3d83bbd2abff1d87f474a 10-Oct-2013 grehan <grehan@FreeBSD.org> Allow the legacy CDROM device to be accessed in a FreeBSD guest, while
still using enlightened drivers for other block devices.

Submitted by: Microsoft hyperv dev team, mav@
Approved by: re@
tordisengage/hv_ata_pci_disengage.c
ee09e09e18dadec88f8003162abd4820c128df3f 10-Oct-2013 dim <dim@FreeBSD.org> In sys/dev/hyperv, fix a number of gcc warnings about usage of anonymous
union members in strict C99, by giving them names. While here, add some
FreeBSD keywords where they were missing.

Approved by: re (gjb)
Reviewed by: grehan
torvsc/hv_storvsc_drv_freebsd.c
torvsc/hv_vstorage.h
mbus/hv_channel.c
mbus/hv_hv.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
716c2031c71f1b1fbd78da6494f5c5e2a5115e9b 05-Oct-2013 gibbs <gibbs@FreeBSD.org> Correct panic caused by attaching both Xen PV and HyperV virtualization
aware drivers on Xen hypervisors that advertise support for some
HyperV features.

x86/xen/hvm.c:
When running in HVM mode on a Xen hypervisor, set vm_guest
to VM_GUEST_XEN so other virtualization aware components in
the FreeBSD kernel can detect this mode is active.

dev/hyperv/vmbus/hv_hv.c:
Use vm_guest to ignore Xen's HyperV emulation when Xen is
detected and Xen PV drivers are active.

Reported by: Shanker Balan
Submitted by: Roger Pau Monné
Sponsored by: Citrix Systems R&D
Reviewed by: gibbs
Approved by: re (Xen blanket)
mbus/hv_hv.c
0804d47dcd22f1cab4a3021cc52352f3c65960bb 19-Sep-2013 grehan <grehan@FreeBSD.org> Reorder the hypervisor presence test to avoid claiming ATA disks
on non hyperv systems.

Reviewed by: neel, abgupta at microsoft dot com
Approved by: re@ (hrs)
tordisengage/hv_ata_pci_disengage.c
8294851167d283a6efac0918755ae401ac730eda 09-Sep-2013 grehan <grehan@FreeBSD.org> Revert the kvp code - there's still some work that
needs to be done for that.

Discussed with: Microsoft hyper-v devs
tilities/hv_kvp.c
tilities/hv_kvp.h
tilities/hv_util.c
182a56e295b4378df6a37e1b8422fb6eec08613a 09-Sep-2013 grehan <grehan@FreeBSD.org> Latest update from Microsoft.

Obtained from: Microsoft Hyper-v dev team
EADME
tilities/hv_kvp.c
tilities/hv_kvp.h
tilities/hv_util.c
mbus/hv_hv.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h
fd121a9c7b0c558bd6523654b46615e4cf221074 01-Aug-2013 grehan <grehan@FreeBSD.org> IFC @ r253862

- change the SI_SUB_RUN_SCHEDULER sysinits in hv_utilc and
hv_netvsc_drv_freebsd.c to SI_SUB_KTHREAD_IDLE, since the
former is no longer in FreeBSD.
The use of these SYSINITs can probably be removed.
c8195f5331ccad33ad4e265362523f51b96abd5c 17-Jul-2013 grehan <grehan@FreeBSD.org> Microsoft have changed their policy on how the hyper-v code will
be pulled into FreeBSD. From now, FreeBSD will be considered the
upstream repo.

First step: move the drivers away from the contrib area and into
the base system.

A follow-on commit will include the drivers in the amd64 GENERIC kernel.
EADME
nclude/hyperv.h
etvsc/hv_net_vsc.c
etvsc/hv_net_vsc.h
etvsc/hv_netvsc_drv_freebsd.c
etvsc/hv_rndis.h
etvsc/hv_rndis_filter.c
etvsc/hv_rndis_filter.h
tordisengage/hv_ata_pci_disengage.c
torvsc/hv_storvsc_drv_freebsd.c
torvsc/hv_vstorage.h
tilities/hv_util.c
mbus/hv_channel.c
mbus/hv_channel_mgmt.c
mbus/hv_connection.c
mbus/hv_hv.c
mbus/hv_ring_buffer.c
mbus/hv_vmbus_drv_freebsd.c
mbus/hv_vmbus_priv.h