Commit Graph
198 Commits
Author SHA1 Message Date
Sepherosa Ziehau 698685a6df MFC 322488
hyperv: Update copyright for the files changed in 2017

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D11982
2017-08-17 05:09:22 +00:00
Sepherosa Ziehau 55f58c7517 MFC 322483,322485-322487
322483
    hyperv/hn: Update VF's ibytes properly under transparent VF mode.

    While, I'm here add comment about why updating VF's imcast stat is
    not necessary.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D11948

322485
    hyperv/hn: Fix/enhance receiving path when VF is activated.

    - Update hn(4)'s stats properly for non-transparent mode VF.
    - Allow BPF tapping to hn(4) for non-transparent mode VF.
    - Don't setup mbuf hash, if 'options RSS' is set.
      In Azure, when VF is activated, TCP SYN and SYN|ACK go through hn(4)
      while the rest of segments and ACKs belonging to the same TCP 4-tuple
      go through the VF.  So don't setup mbuf hash, if a VF is activated
      and 'options RSS' is not enabled.  hn(4) and the VF may use neither
      the same RSS hash key nor the same RSS hash function, so the hash
      value for packets belonging to the same flow could be different!
    - Disable LRO.
      hn(4) will only receive broadcast packets, multicast packets, TCP
      SYN and SYN|ACK (in Azure), LRO is useless for these packet types.
      For non-transparent, we definitely _cannot_ enable LRO at all, since
      the LRO flush will use hn(4) as the receiving interface; i.e.
      hn_ifp->if_input(hn_ifp, m).

    While I'm here, remove unapplied comment and minor style change.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D11978

322486
    hyperv/hn: Minor cleanup

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D11979

322487
    hyperv/hn: Re-set datapath after synthetic parts reattached.

    Do this even for non-transparent mode VF. Better safe than sorry.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D11981
2017-08-17 03:48:50 +00:00
Sepherosa Ziehau 2d976b9280 MFC 322299
hyperv/hn: Implement transparent mode network VF.

    How network VF works with hn(4) on Hyper-V in transparent mode:

    - Each network VF has a cooresponding hn(4).
    - The network VF and the it's cooresponding hn(4) have the same hardware
      address.
    - Once the network VF is attached, the cooresponding hn(4) waits several
      seconds to make sure that the network VF attach routing completes, then:
      o  Set the intersection of the network VF's if_capabilities and the
         cooresponding hn(4)'s if_capabilities to the cooresponding hn(4)'s
         if_capabilities.  And adjust the cooresponding hn(4) if_capable and
         if_hwassist accordingly. (*)
      o  Make sure that the cooresponding hn(4)'s TSO parameters meet the
         constraints posed by both the network VF and the cooresponding hn(4).
         (*)
      o  The network VF's if_input is overridden.  The overriding if_input
         changes the input packet's rcvif to the cooreponding hn(4).  The
         network layers are tricked into thinking that all packets are
         neceived by the cooresponding hn(4).
      o  If the cooresponding hn(4) was brought up, bring up the network VF.
         The transmission dispatched to the cooresponding hn(4) are
         redispatched to the network VF.
      o  Bringing down the cooresponding hn(4) also brings down the network
         VF.
      o  All IOCTLs issued to the cooresponding hn(4) are pass-through'ed to
         the network VF; the cooresponding hn(4) changes its internal state
         if necessary.
      o  The media status of the cooresponding hn(4) solely relies on the
         network VF.
      o  If there are multicast filters on the cooresponding hn(4), allmulti
         will be enabled on the network VF. (**)
    - Once the network VF is detached.  Undo all damages did to the
      cooresponding hn(4) in the above item.

    NOTE:
    No operation should be issued directly to the network VF, if the
    network VF transparent mode is enabled.  The network VF transparent mode
    can be enabled by setting tunable hw.hn.vf_transparent to 1.  The network
    VF transparent mode is _not_ enabled by default, as of this commit.

    The benefit of the network VF transparent mode is that the network VF
    attachment and detachment are transparent to all network layers; e.g. live
    migration detaches and reattaches the network VF.

    The major drawbacks of the network VF transparent mode:
    - The netmap(4) support is lost, even if the VF supports it.
    - ALTQ does not work, since if_start method cannot be properly supported.

    (*)
    These decisions were made so that things will not be messed up too much
    during the transition period.

    (**)
    This does _not_ need to go through the fancy multicast filter management
    stuffs like what vlan(4) has, at least currently:
    - As of this write, multicast does not work in Azure.
    - As of this write, multicast packets go through the cooresponding hn(4).

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D11803
2017-08-14 06:29:24 +00:00
Sepherosa Ziehau 08a082605c MFC 321836,321837
321836
    hyperv/hn: Renaming and minor cleanup

    This prepares for the upcoming transparent VF support.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D11708

321837
    hyperv/hn: Add comment about ether_ifattach event subscription.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D11710
2017-08-07 03:03:40 +00:00
Sepherosa Ziehau 87b7d757ff MFC 321409
hyperv/hn: Ignore LINK_SPEED_CHANGE status.

    This status will be reported if the backend NIC is wireless; it's not
    useful.  Due to the high frequency of the reporting, this could be
    pretty annoying; ignore it.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D11651
2017-07-31 03:04:39 +00:00
Sepherosa Ziehau 177d705e4b MFC 321407
hyperv/hn: Export VF list and VF-HN mapping

    The VF-HN map will be used later on to implement "transparent VF".

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D11618
2017-07-31 02:48:18 +00:00
Sepherosa Ziehau 5212d8fb10 hyperv/hn: Enable sorted LRO (direct commit).
This is a direct commit.  Sorted LRO is much better than plain
(linked list LRO), which hash LRO is not available on this
branch.

Sponsored by:	Microsoft
2017-05-02 01:30:46 +00:00
Sepherosa Ziehau 00758a543d MFC 317353
hyperv/hn: Use channel0, i.e. TX ring0, for TCP SYN/SYN|ACK.

    Hyper-V hot channel effect:
    Operation latency on hot channel is only _half_ of the operation
    latency on cold channels.

    This commit takes the advantage of the above Hyper-V host channel
    effect, and can reduce more than 75% latency and more than 50%
    latency stdev, i.e. lower and more stable/predictable latency,
    for various types of web server workloads.

    Sponsored by:   Microsoft
2017-04-27 01:58:20 +00:00
Sepherosa Ziehau 7c618b095d MFC 316520
hyperv/hn: Fixat RNDIS rxfilter after the successful RNDIS init.

    Under certain conditions on certain versions of Hyper-V, the RNDIS
    rxfilter is _not_ zero on the hypervisor side after the successful
    RNDIS initialization, which breaks the assumption of any following
    code (well, it breaks the RNDIS API contract actually).  Clear the
    RNDIS rxfilter explicitly, drain packets sneaking through, and drain
    the interrupt taskqueues scheduled due to the stealth packets.

    Reported by:    dexuan@
    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D10230
2017-04-10 05:17:18 +00:00
Sepherosa Ziehau a8de2e6adb MFC: 314382-314485
314382
    hyperv/hn: Simplify RNDIS packet data offset calculation.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D9699

314483
    hyperv/hn: Simplify RNDIS packet total length calculation.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D9712

314484
    hyperv/hn: Make sure that RNDIS packet message is at least 4B aligned.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D9713

314485
    hyperv/hn: Misaligned chimney sending buffers should not be used

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D9714
2017-03-17 02:48:29 +00:00
Dexuan Cui 12d16a843d MFC 312689, 312690
Approved by:	sephe (mentor)

r312689
    hyperv/hn: add a sysctl name for the VF interface

    This makes it easier for the userland script to find the releated
    VF interface.

    Reviewed by:	sephe
    Approved by:	sephe (mentor)
    Sponsored by:	Microsoft
    Differential Revision:	https://reviews.freebsd.org/D9101

r312690
    hyperv/hn: add devctl_notify for VF_UP/DOWN events

    Reviewed by:	sephe
    Approved by:	sephe (mentor)
    Sponsored by:	Microsoft
    Differential Revision:	https://reviews.freebsd.org/D9102
2017-02-22 08:37:51 +00:00
Dexuan Cui 0a469cc861 MFC 312688
Approved by:	sephe (mentor)

r312688
    hyperv/hn: add the support for VF drivers (SR-IOV)

    Hyper-V's NIC SR-IOV implementation needs a Hyper-V synthetic NIC and
    a VF NIC to work together (both NICs have the same MAC address), mainly to
    support seamless live migration.

    When the VF device becomes UP (or DOWN), the synthetic NIC driver needs
    to switch the data path from the synthetic NIC to the VF (or the opposite).

    Note: multicast/broadcast packets are still received through the synthetic
    NIC and we need to inject the packets through the VF interface (if the VF is
    UP), even if the synthetic NIC is DOWN (so we need to force the rxfilter
    to be NDIS_PACKET_TYPE_PROMISCUOUS, when the VF is UP).

    Reviewed by:	sephe
    Approved by:	sephe (mentor)
    Sponsored by:	Microsoft
    Differential Revision:	https://reviews.freebsd.org/D8964
2017-02-22 08:26:51 +00:00
Dexuan Cui d172e524eb MFC: 312686
Approved by:	sephe (mentor)

r312686
    hyperv/hn: remove the MTU and IFF_DRV_RUNNING checking in hn_rxpkt()

    It's unnecessary because the upper nework stack does the same checking.

    In the case of Hyper-V SR-IOV, we need to remove the checking because
    1) multicast/broadcast packets are still received through the synthetic
    NIC and we need to inject the packets through the VF interface;
    2) we must inject the packets even if the synthetic NIC is down, or has
    a different MTU from the VF device.

    Reviewed by:	sephe
    Approved by:	sephe (mentor)
    Sponsored by:	Microsoft
    Differential Revision:	https://reviews.freebsd.org/D8962
2017-02-22 06:12:33 +00:00
Dexuan Cui 3ee49a5389 MFC: 312685
Approved by:	sephe(mentor)

r312685
    hyperv/hn: remember the channel pointer in struct hn_rx_ring

    This will be used by the coming NIC SR-IOV patch.

    Reviewed by:	sephe
    Approved by:	sephe (mentor)
    Sponsored by:	Microsoft
    Differential Revision:	https://reviews.freebsd.org/D8909
2017-02-22 06:06:58 +00:00
Sepherosa Ziehau 99aaf46a17 MFC 310652,310657,310658
310652
    hyperv/hn: Consolidate hn_{suspend,resume}

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8907

310657
    hyperv/hn: Function renaming; no functional changes.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8908

310658
    hyperv/hn: Factor out function to set rxfilter.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8928
2017-01-05 08:57:49 +00:00
Sepherosa Ziehau 83f82fff0a MFC 309874,309875
309874
    hyperv/vmbus: Add channel polling support.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8738

309875
    hyperv/hn: Add polling support

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8739
2017-01-05 06:25:16 +00:00
Sepherosa Ziehau 27312151c5 MFC 309346,309348,309353
309346
    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.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8674

309348
    hyperv/hn: Don't hold txdesc, if no BPFs are attached.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8675

309353
    hyperv/hn: Add 'options RSS' support.

    Reviewed by:    adrian
    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8676
2017-01-05 06:11:53 +00:00
Sepherosa Ziehau 170000e203 MFC 309310,309311,309316,309318
309310
    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.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8654

309311
    hyperv/hn: Allow multiple TX taskqueues.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8655

309316
    hyperv/vmbus: Add DEVMETHOD to map cpu to event taskq.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8658

309318
    hyperv/hn: Allow TX to share event taskqueues.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8659
2017-01-05 05:51:00 +00:00
Sepherosa Ziehau 0a94c8f24d MFC 309226-309231,309235
309226
    hyperv/hn: Utilize vmbus_chan_xact_wait

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8612

309227
    hyperv/hn: Fix detach error handling.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8613

309228
    hyperv/hn: Fix multi-packet RNDIS message aggregation size setting.

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

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8619

309229
    hyperv/hn: Fix attach error handling

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8620

309230
    hyperv/hn: Enable multi-packet RNDIS message support by default.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8621

309231
    hyperv/hn: Fix vmbus_chan_subidx usage.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8629

309235
    hyperv/hn: Simplify RSS indirect table fixup API

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8630
2017-01-05 05:29:51 +00:00
Sepherosa Ziehau 03e22918f1 MFC 309085
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.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8559
2017-01-05 04:59:37 +00:00
Sepherosa Ziehau 9f292ac831 MFC 308908,308909
308908
    hyperv/hn: Allow enabling IPv6 TX checksum offloading and IPv6 TSO.

    They are still disabled by default.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8490

308909
    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.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8520
2017-01-05 03:42:29 +00:00
Sepherosa Ziehau cd849a0cfc MFC 308907
hyperv/hn: Fix WITNESS warnings

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

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8489
2017-01-05 03:35:51 +00:00
Sepherosa Ziehau 94e5638e56 MFC 308905
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.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8560
2017-01-05 03:25:38 +00:00
Sepherosa Ziehau 51aabc1054 MFC 308166,308167
308166
    hyperv/hn: Move TSO packet fixup to an earlier place for if_transmit.

    While TSO packet header may be still cache-hot.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8393

308167
    hyperv/hn: Directly fill chimney sending buffer for small packets.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8394
2016-11-14 06:25:22 +00:00
Sepherosa Ziehau f784ba5a1e MFC 308164
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.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8392
2016-11-14 06:03:29 +00:00
Sepherosa Ziehau 4d13d8a7f9 MFC 308163
hyperv/hn: Rename cleaned up file.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8390
2016-11-14 06:00:30 +00:00
Sepherosa Ziehau c6e36ad8b7 MFC 308162
hyperv/hn: Cosmetic cleanup; no functional changes.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8389
2016-11-14 05:41:37 +00:00
Sepherosa Ziehau 178d1cda04 MFC 308117-308120
308117
    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.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8367

308118
    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...

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8368

308119
    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.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8369

308120
    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.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8370
2016-11-14 05:37:34 +00:00
Sepherosa Ziehau 787e8fff46 MFC 308018,308116
308018
    hyeprv/hn: Rename cleaned up RNDIS header file.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8360

308116
    hyperv/hn: Rename cleaned up RNDIS source file.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8361
2016-11-14 05:24:05 +00:00
Sepherosa Ziehau ecb9b6f9bc MFC 308013-308017
308013
    hyperv/hn: Nuke unnecessary indirection.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8355

308014
    hyperv/hn: Reorganize RX path; mainly pull non-control code path up

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8356

308015
    hyperv/hn: Pull data path code up.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8357

308016
    hyperv/hn: Cleanup RNDIS related files.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8358

308017
    hyperv/hn: Change header guardian; in preparation for the upcoming rename.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8359
2016-11-14 03:49:28 +00:00
Sepherosa Ziehau 8ba2cd0fb7 MFC 308011,308012
308011
    hyperv/hn: Rename cleaned up NVS header file.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8353

308012
    hyperv/hn: Rename cleaned up NVS source file.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8354
2016-11-14 03:36:59 +00:00
Sepherosa Ziehau 3078f0ad56 MFC 307989-307991,308010
307989
    hyperv/hn: Move hn_softc to if_hnvar.h

    While I'm here, use consistent macro names.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8345

307990
    hyperv/hn: Move send context to NVS domain.

    Since all sends are encapsulated in NVS messages.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8346

307991
    hyperv/hn: NVS inclusion cleanup and forward declare functions.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8347

308010
    hyperv/hn: Change header guardian; in preparation for the upcoming rename.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8352
2016-11-14 03:19:17 +00:00
Sepherosa Ziehau 60335cba49 MFC 307985-307988
307985
    hyperv/hn: Nuke unnecessary M_NETVSC

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8340

307986
    hyperv/hn: Move %b format string for capabilities near their definition.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8341

307987
    hyperv/hn: Define empty packet filter.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8342

307988
    hyperv/hn: Shuffle chimney sending buffer alloc/free around.

    This paves way for more chimney sending buffer reorganization.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8343
2016-11-14 03:14:43 +00:00
Sepherosa Ziehau 73c876a86f MFC 307983
hyperv/hn: Properly configure RSS according to RSS capabilities

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8338
2016-11-14 03:07:48 +00:00
Sepherosa Ziehau bbdb10de4e MFC 307893
hyperv/hn: Set baudrate properly

    PR:             208931
    Submitted by:   Eugene Grosbein <ports grosbein net>
    Reported by:    Eugene Grosbein <ports grosbein net>
    Sponsored by:   Microsoft
2016-11-14 03:01:30 +00:00
Sepherosa Ziehau 8ce0800403 MFC 307844
hyperv/hn: Nuke unused forward declaration.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8314
2016-11-11 09:00:29 +00:00
Sepherosa Ziehau 0975a554cf MFC 307843
hyperv/hn: Fix RX filter settings.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8313
2016-11-11 08:57:52 +00:00
Sepherosa Ziehau 2781a3fce1 MFC 307840,307842
307840
    hyperv/hn: Properly handle synthetic parts reattach failure.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8310

307842
    hyperv/hn: Start link status check, if no network changes were pending.

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

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8311
2016-11-11 08:55:45 +00:00
Sepherosa Ziehau a20822619e MFC 307838,307839
307838
    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.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8308

307839
    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.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8309
2016-11-11 08:52:23 +00:00
Sepherosa Ziehau fc47007715 MFC 307710-307712,307714
307710
    hyperv/hn: Always query RSS capabilities.

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

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8291

307711
    hyperv/hn: Check NVS version for HASHVAL pktinfo on sending path.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8293

307712
    hyperv/hn: Add network change support.

    Currently the network change is simulated by link status changes.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8295

307714
    hyperv/hn: Function renaming; consistent w/ hardware capabilities query.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8296
2016-11-11 08:49:28 +00:00
Sepherosa Ziehau 255593866e MFC 307012,307013,307262
307012
    hyperv/vmbus: Allow driver to inject synchronous task into channel taskq.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8208

307013
    hyperv/hn: Rework link status support.

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

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8209

307262
    hyperv/hn: Management parts always need suspend and resume.

    Sponsored by:   Microsoft
2016-10-19 07:27:45 +00:00
Sepherosa Ziehau 9a190f1937 MFC 306936-306939
306936
    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.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8088

306937
    hyperv/hn: Fix if_hw_tsomax setup.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8089

306938
    hyperv/hn: Generalize RSS capabilities query.

    - Support NDIS < 6.30.
    - Stringent response checks.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8090

306939
    hyperv/hn: Suffix NDIS offload size with NDIS version.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8091
2016-10-19 07:24:32 +00:00
Sepherosa Ziehau 2329fe1271 MFC 306484,306485
306484
    hyperv/vmbus: Add missing vmbus_if.c to module build.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8067

306485
    hyperv/hn: Add stubs for OFFLOAD_CURRENT_CONFIG and NETWORK_CHANGE status

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8068
2016-10-19 07:16:26 +00:00
Sepherosa Ziehau af2235b257 MFC 306482,306483
306482
    hyperv/hn: If synthetic parts are detached, don't touch them.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8065

306483
    hyperv/hn: Fix detach and attach error handling.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8066
2016-10-19 07:08:28 +00:00
Sepherosa Ziehau a635d2c2f9 MFC 306433
hyperv/hn: Don't set HASHVAL pktinfo for NDIS < 6.30

    This unbreaks packet sending on WS2008R2.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8057
2016-10-19 06:59:45 +00:00
Sepherosa Ziehau 39d3a211a9 MFC 306431,306432
306431
    hyperv/hn: Move TX tasks' draining into hn_suspend().

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

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8055

306432
    hyperv/hn: Consolidate hn_init() and hn_stop()

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8056
2016-10-19 06:57:18 +00:00
Sepherosa Ziehau b099571c36 MFC 306393
hyperv/hn: Flatten RX filter configuration.

    This paves way for more fixes.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8049
2016-10-19 05:38:50 +00:00
Sepherosa Ziehau 497b046dce MFC 306390-306392
306390
    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.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8046

306391
    hyperv/hn: Reorganize the synthetic parts detach.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8047

306392
    hyperv/hn: Reorder the comment a little bit.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8048
2016-10-19 05:08:46 +00:00
Sepherosa Ziehau 77690698dd MFC 306072-306074,306076
306072
    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.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D7960

306073
    hyperv/hn: Allocate bufrings in attach DEVMETHOD.

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

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D7961

306074
    hyperv/vmbus: Assert that the bufring address is page aligned.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D7962

306076
    hyperv/hn: Put debug messages under bootverbose

    While I'm here, strip blank line.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D7963
2016-10-19 02:14:04 +00:00
Sepherosa Ziehau 1b39630478 MFC 306013,306014
306013
    hyperv/hn: Fix ifnet hwassist setup.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D7948

306014
    hyperv/hn: Let the caller of hn_nvs_doinit() do the error logging.

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

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D7950
2016-10-19 02:08:04 +00:00