Commit Graph

631 Commits

Author SHA1 Message Date
Sepherosa Ziehau
7960e6ba99 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
2016-11-21 05:41:08 +00:00
Sepherosa Ziehau
fdc4f478ed 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
2016-11-21 05:21:15 +00:00
Sepherosa Ziehau
8f3bf5f97b hyperv/vmbus: Support transction result busy-wait.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8488
2016-11-21 05:09:43 +00:00
Sepherosa Ziehau
dc13fee60c 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
2016-11-21 05:00:51 +00:00
Dexuan Cui
8c582c7c58 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
2016-11-18 06:44:18 +00:00
Dexuan Cui
50182f1312 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
2016-11-18 06:24:22 +00:00
Dexuan Cui
871c968b3a 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
2016-11-16 09:25:00 +00:00
Dexuan Cui
522c192d38 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
2016-11-16 09:08:32 +00:00
Dexuan Cui
c8b32f717d 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
2016-11-16 09:02:17 +00:00
Sepherosa Ziehau
168fce73b5 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
2016-11-15 02:36:12 +00:00
Sepherosa Ziehau
afe30aa97f 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
2016-11-04 01:14:41 +00:00
Sepherosa Ziehau
30c90f019f 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
2016-11-02 07:18:27 +00:00
Sepherosa Ziehau
2a5a7ca81d hyperv: GC unused functions.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8406
2016-11-02 05:41:23 +00:00
Sepherosa Ziehau
a457fab84c hyperv/vmbus: Avoid extra header copy.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8395
2016-11-01 08:30:06 +00:00
Sepherosa Ziehau
8966e5d5b3 hyperv/hn: Directly fill chimney sending buffer for small packets.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8394
2016-11-01 08:20:33 +00:00
Sepherosa Ziehau
edd3f31541 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
2016-11-01 07:41:26 +00:00
Sepherosa Ziehau
23bf9e1527 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
2016-11-01 07:10:43 +00:00
Sepherosa Ziehau
15516c776e hyperv/hn: Rename cleaned up file.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8390
2016-11-01 06:54:25 +00:00
Sepherosa Ziehau
ba015837bf hyperv/hn: Cosmetic cleanup; no functional changes.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8389
2016-11-01 04:44:11 +00:00
Sepherosa Ziehau
427e366e43 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
2016-10-31 05:22:00 +00:00
Sepherosa Ziehau
82d71ca917 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
2016-10-31 05:05:12 +00:00
Sepherosa Ziehau
7ccc20da6a 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
2016-10-31 04:54:15 +00:00
Sepherosa Ziehau
8ff20a73f6 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
2016-10-31 04:46:02 +00:00
Sepherosa Ziehau
e6ed06f904 hyperv/hn: Rename cleaned up RNDIS source file.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8361
2016-10-31 01:36:28 +00:00
Sepherosa Ziehau
fb448904d9 hyeprv/hn: Rename cleaned up RNDIS header file.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8360
2016-10-28 08:53:18 +00:00
Sepherosa Ziehau
ec60eff9ab 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
2016-10-28 08:41:30 +00:00
Sepherosa Ziehau
d568f3ecfa hyperv/hn: Cleanup RNDIS related files.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8358
2016-10-28 08:32:54 +00:00
Sepherosa Ziehau
8ef7124558 hyperv/hn: Pull data path code up.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8357
2016-10-28 08:18:49 +00:00
Sepherosa Ziehau
91938ebba8 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
2016-10-28 08:08:46 +00:00
Sepherosa Ziehau
96a98cbf14 hyperv/hn: Nuke unnecessary indirection.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8355
2016-10-28 07:59:02 +00:00
Sepherosa Ziehau
68468712a7 hyperv/hn: Rename cleaned up NVS source file.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8354
2016-10-28 07:48:17 +00:00
Sepherosa Ziehau
e61005fedc hyperv/hn: Rename cleaned up NVS header file.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8353
2016-10-28 05:56:23 +00:00
Sepherosa Ziehau
0cf2aff4fa 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
2016-10-28 05:31:34 +00:00
Sepherosa Ziehau
2ae974568d hyperv/hn: NVS inclusion cleanup and forward declare functions.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8347
2016-10-27 05:33:48 +00:00
Sepherosa Ziehau
e3946ae44a 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
2016-10-27 05:26:04 +00:00
Sepherosa Ziehau
19b2340a76 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
2016-10-27 05:13:00 +00:00
Sepherosa Ziehau
d6e37dc70f 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
2016-10-27 05:04:54 +00:00
Sepherosa Ziehau
14a31e99d7 hyperv/hn: Define empty packet filter.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8342
2016-10-27 04:55:19 +00:00
Sepherosa Ziehau
5341cc1c91 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
2016-10-27 04:42:39 +00:00
Sepherosa Ziehau
90321eb752 hyperv/hn: Nuke unnecessary M_NETVSC
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8340
2016-10-27 04:28:01 +00:00
Sepherosa Ziehau
20b3dcf039 hyperv/hn: Properly configure RSS according to RSS capabilities
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8338
2016-10-27 03:43:27 +00:00
Sepherosa Ziehau
eaaa9935d4 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
2016-10-26 05:06:23 +00:00
Sepherosa Ziehau
91833b0f3c hyperv/vmbus: Add missing white space.
Submitted by:	QianYue You <t-youqi microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft
2016-10-26 04:26:17 +00:00
Sepherosa Ziehau
7888d6422d 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
2016-10-25 01:41:39 +00:00
Sepherosa Ziehau
5bf51473c0 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
2016-10-24 05:36:19 +00:00
Sepherosa Ziehau
f0dcc3114c hyperv/hn: Nuke unused forward declaration.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8314
2016-10-24 05:20:02 +00:00
Sepherosa Ziehau
121e98e697 hyperv/hn: Fix RX filter settings.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8313
2016-10-24 05:10:35 +00:00
Sepherosa Ziehau
665bc5ff49 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
2016-10-24 05:01:34 +00:00
Sepherosa Ziehau
6827d9497a hyperv/hn: Properly handle synthetic parts reattach failure.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8310
2016-10-24 03:42:34 +00:00
Sepherosa Ziehau
6aa8c9a4e0 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
2016-10-24 03:34:19 +00:00