Commit Graph
62 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 2051ec231d MFC 311743
hyperv: Add method to read 64bit Hyper-V specific time value.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D9057
2017-02-21 02:15:58 +00:00
Sepherosa Ziehau 91196847ee MFC 310048,310101,310239
310048
    hyperv: Implement "enlightened" time counter, which is rdtsc based.

    Reviewed by:    kib
    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8763

310101
    hyperv: Allow userland to ro-mmap reference TSC page

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

    Reviewed by:    kib
    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8768

310239
    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
    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8789
2017-01-05 07:42:08 +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 3804da9cfc MFC 309705
hyperv/timesync: Support "sent TC" to improve accuracy.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8723
2017-01-05 06:19:07 +00:00
Sepherosa Ziehau 821466c721 MFC 309240,309242,309244,309245,309670
309240
    hyperv/vmbus: Add result polling support for xact API.

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

309242
    hyperv/vmbus: Add result polling support for message Hypercall API.

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

309244
    hyperv/vmbus: Add exec cancel support for message Hypercall API.

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

309245
    hyperv/vmbus: Use poll/cancel APIs to wait for the CHOPEN response.

    Since hypervisor does not respond CHOPEN to a revoked channel.

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

309670
    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>
    Sponsored by:   Microsoft
2017-01-05 05:46:06 +00:00
Sepherosa Ziehau f1b090735f MFC 309128,309129,309131-309136,309138-309140,309224,309225
309128
    hyperv/vmbus: Commit the GPADL id only after the connection succeeds.

    Minor style change.

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

309129
    hyperv/vmbus: Minor style changes.

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

309131
    hyperv/vmbus: Fix sysctl tree leakage, if channel open fails.

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

309132
    hyperv/vmbus: Don't close unopened channels.

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

309133
    hyperv/vmbus: GPADL disconnect error on a revoked channel is benign.

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

309134
    hyperv/vmbus: No stranded bufring GPADL is allowed.

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

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

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

309136
    hyperv/vmbus: Don't free the bufring if its GPADL can't be disconnected.

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

309138
    hyperv/vmbus: Always try disconnect/free bufring memory upon channel close

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

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

309139
    hyperv/vmbus: Propagate close error.

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

309140
    hyperv/vmbus: Add a simplified version of channel close.

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

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

309224
    hyperv/vmbus: Zero out GPADL if error happens.

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

309225
    hyperv/vmbus: Add supportive transaction wait function.

    This function supports channel revocation properly.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8611
2017-01-05 05:24:30 +00:00
Sepherosa Ziehau ded3c9314c MFC 309030,309039,309080,309081,309083
309030
    hyperv/vmbus: Set a mark on the revoked channel.

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

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

309039
    hyperv/vmbus: Merge free/active locks.

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

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

309080
    hyperv/vmbus: Implement orphan support for transaction API

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

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

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

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

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

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8546
2017-01-05 04:22:03 +00:00
Sepherosa Ziehau 51cc8831c8 MFC 308906
hyperv/vmbus: Support transction result busy-wait.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8488
2017-01-05 03:32:13 +00:00
Sepherosa Ziehau e99789cae6 MFC 308194
hyperv: GC unused functions.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8406
2016-11-14 06:31:01 +00:00
Sepherosa Ziehau f577caa6ff MFC 307624
hyperv/vmbus: Expose channel management taskqueue for driver to use.

    MFC after:      3 days
    Sponsored by:   Microsoft
2016-11-11 08:43:34 +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 3bbf3b4294 MFC 306360,306387,306389
306360
    hyperv/vmbus: Add dynamic device add and remove support

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

306387
    hyperv/vmbus: Add functions to test RX/TX bufring emptiness

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

306389
    hyperv/vmbus: Add function to drain channel interrupt task.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8045
2016-10-19 02:24:17 +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 55978ad189 MFC 304790,304791
304790
    hyperv/vmbus: Add function to calculate max # of elements in a bufring.

    Sponsored by:   Microsoft

304791
    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
    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D7622
2016-10-17 07:16:04 +00:00
Sepherosa Ziehau ea31866139 MFC 304204-304206,304252-304256
304204
    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.

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

304205
    hyperv/hn: Simplify RNDIS NVS message sending.

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

304206
    hyperv/hn: Simplify RNDIS message checks on RX path.

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

304252
    hyperv/hn: Ignore the useless TX table.

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

304253
    hyperv/hn: Simplify RNDIS RX packets acknowledgement.

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

304254
    hyperv/hn: Remove reference to nvsp_msg

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

304255
    hyperv/hn: Remove reference to nvsp_status

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

304256
    hyperv/hn: Get rid of unused bits

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D7518
2016-10-17 06:09:36 +00:00
Sepherosa Ziehau 3dcebf8dd2 MFC 303945,303947-303949,303989,303992,303998,304001,304002,304109,304111
303945
    hyperv/vmbus: Add macro to get channel packet data length.

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

303947
    hyperv/vmbus: Add APIs for various types of transactions.

    Reviewed by:    Jun Su <junsu microsoft com>
    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D7456

303948
    hyperv/hn: Switch to vmbus xact APIs for NVS initialization

    Reviewed by:    Jun Su <junsu microsoft com>
    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D7457

303949
    hyperv/vmbus: Use xact APIs to implement post message Hypercall APIs

    Avoid code duplication.

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

303989
    hyperv/hn: Simplify NDIS configuration.

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

303992
    hyperv/hn: Simplify NDIS initialization.

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

303998
    hyperv/hn: Switch to vmbus xact APIs for NVS RXBUF connection.

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

304001
    hyperv/hn: Switch to vmbus xact APIs for NVS chimney buffer connection.

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

304002
    hyperv/hn: Simplify RXBUF disconnection.

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

304109
    hyperv/hn: Simplify chimney sending buffer disconnection.

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

304111
    hyperv/hn: Switch to vmbus xact APIs for sub-channel alloc request.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D7480
2016-10-17 05:53:38 +00:00
Sepherosa Ziehau f244e0cf65 MFC 303603-303605,303764
303603
    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.

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

303604
    hyperv/storvsc: Set maxio to 128KB.

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

303605
    hyperv/storvsc: Stringent PRP list assertions

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

303764
    hyperv/vmbus: Only make sure the TX bufring will not be closed.

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

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7414
2016-10-17 05:28:06 +00:00
Sepherosa Ziehau 95ef64241a MFC 303421,303422,303470-303473
303421
    hyperv/vmbus: Avoid unnecessary mb()

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

303422
    hyperv/vmbus: Inclusion cleanup

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

303470
    hyperv/vmbus: Reindent function declarations.

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

303471
    hyperv/vmbus: Forward declare static functions

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

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

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

303473
    hyperv/vmbus: Revoke unnecessary exposure of vmbus softc

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D7348
2016-10-17 03:48:22 +00:00
Sepherosa Ziehau d50dea9f56 MFC 303066-303072,303127-303129,303131
303066
    hyperv/vmbus: Get rid of unnecessary definition.

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

303067
    hyperv/vmbus: Move IC register definition to Hyper-V utilities

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

303068
    hyperv/vmbus: Channel struct field rename

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

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

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

303070
    hyperv/vmbus: Deprecate the device private data in channel struct

    They are neither flexible nor extensible.

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

303071
    hyperv/vmbus: Hide channel struct definition.

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

303072
    hyperv/vmbus: Save MNF trigger location instead of MNF trigger index.

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

303127
    hyperv/vmbus: Save event flag location and evet flag mask.

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

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

303128
    hyperv/vmbus: Reorder channel fields.

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

303129
    hyperv/vmbus: Shuffle function declaration and macro definition.

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

303131
    hyperv: hv_vmbus_channel -> vmbus_channel

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7260
2016-10-17 03:24:03 +00:00
Sepherosa Ziehau 5a65c12b1c MFC 302888-302892,302986,303020-303022
302888
    hyperv/hn: Busdma-fy rxbuf and chimney sending buffer

    Nuke unused channel GPADL API.

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

302889
    hyperv/vmbus: Back out r302888 temporarily

    Committed by accident w/ duplicated commit log

    Sponsored by:   Microsoft OSTC

302890
    hyperv/vmbus: Function rename

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

302891
    hyperv/vmbus: Cosmetic vmbus channel close cleanup

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

302892
    hyperv/vmbus: Cleanup channel sysctl tree creation

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

302986
    hyperv/vmbus: Cosmetic vmbus channel open cleanup

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

303020
    hyperv/vmbus: Cleanup cpu based channel selection.

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

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

303021
    hyperv/vmbus: Function rename

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

303022
    hyperv/vmbus: Temp/internal variable/function rename

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7231
2016-10-17 02:44:27 +00:00
Sepherosa Ziehau bc08b2cb28 MFC 302887
hyperv/hn: Busdma-fy rxbuf and chimney sending buffer

    Nuke unused channel GPADL API.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7211
2016-10-17 02:38:44 +00:00
Sepherosa Ziehau cd234d7f7c MFC 302885,302886
302885
    hyperv/vmbus: Cleanup channel receiving.

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

302886
    hyperv/vmbus: Cleanup channel packet receiving.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7204
2016-10-17 02:36:49 +00:00
Sepherosa Ziehau 356459e66c MFC 302882-302884
302882
    hyperv/vmbus: Function rename

    And reorder the error prone parameters list.

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

302883
    hyperv/vmbus: Field rename

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

302884
    hyperv/vmbus: Factor out macros to do channel packet length conversion.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7194
2016-10-17 02:34:13 +00:00
Sepherosa Ziehau ba39b5d84c MFC 302875,302876,302878-302881
302875
    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.

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

302876
    hyperv/vmbus: Rework sglist sending.

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

302878
    hyeprv/vmbus: Rework prplist sending.

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

302879
    hyperv/vmbus: Move channel packet flags definition to vmbus.h

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

302880
    hyperv/vmbus: Move channel packet types definition to vmbus.h

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

302881
    hyperv/vmbus: Cleanup channel sending

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7178
2016-10-17 02:30:45 +00:00
Sepherosa Ziehau 72b111d394 MFC 302873,302874
302873
    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.

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

302874
    hyperv/vmbus: Field rename

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7146
2016-10-17 02:25:43 +00:00
Sepherosa Ziehau 55679539c9 MFC 302871,302872
302871
    hyperv/vmbus: Add vmbus_chan_gpadl_connect, which takes GPA physaddr

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

302872
    hyperv/vmbus: Busdma-fy channel bufring.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7140
2016-10-17 02:23:05 +00:00
Sepherosa Ziehau 50f2b11fa3 MFC 302864
hyperv/vmbus: Merge hv_channel_mgmt.c into hv_channel.c

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7126
2016-10-17 02:12:49 +00:00
Sepherosa Ziehau f027379ea4 MFC 302816-302818
302816
    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.

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

302817
    hyperv/vmbus: Field renaming to reflect reality

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

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

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7112
2016-10-17 02:02:44 +00:00
Sepherosa Ziehau 1b754800db MFC 302808-302815
302808
    hyperv/vmbus: Alloc/Free monitor param in vmbus channel alloc/free.

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

302809
    hyperv/vmbus: Move device register and channel free to the caller.

    This paves the way for more cleanup/disentangle.

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

302810
    hyperv/vmbus: Move new channel scan notification to device register

    And nuke now unnecessary function indirection.

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

302811
    hyperv/vmbus: Cleanup vmbus_chan_msgproc_choffer

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

302812
    hyperv/vmbus: Nuke the channel open state.

    Channel is either opened or not-opened.

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

302813
    hyperv/vmbus: Cleanup vmbus_chan_add()

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

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

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

302815
    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().

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7109
2016-10-17 01:59:42 +00:00
Sepherosa Ziehau 5e33f71ca9 MFC 302733,302737,302801-302806
302733
    hyperv/vmbus: Remove unused code

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

302737
    hyperv/vmbus: Cleanup channel rescind

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

302801
    hyperv/vmbus: Remove unused bits

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

302802
    hyperv: hv_guid -> struct hyperv_guid.

    This paves way for the further cleanup/disentangle.

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

302803
    hyperv/vmbus: Move channel offer message definition to vmbus_reg.h

    - Avoid bit fields.
    - Avoid unnecessary indirection.

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

302804
    hyperv/vmbus: Switch to vmbus channel message macros

    Prepare for more cleanup.

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

302805
    hyperv/vmbus: Remove unused bits

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

302806
    hyperv/vmbus: Get rid of rel{_id,id}, use channel id consistently.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7100
2016-10-17 01:47:49 +00:00
Sepherosa Ziehau c99bf9b424 MFC 302723,302726,302731
302723
    hyperv: All Hypercall parameters have same alignment requirement.

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

302726
    hyperv: Signal event input parameter is shared w/ MNF

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

302731
    hyperv/vmbus: Reorganize MNF event sending.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7088
2016-10-14 09:10:41 +00:00
Sepherosa Ziehau ed2849dae4 MFC 302707-302709
302707
    hyperv/vmbus: Nuke unused field from hv_vmbus_channel.

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

302708
    hyperv/bufring: Remove unused fields

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

302709
    hyperv/vmbus: Pack bool field into flags field

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7038
2016-10-14 08:55:49 +00:00
Sepherosa Ziehau 6286ed51ad MFC 302698-302704,302706
302698
    hyperv/vmbus: Add vmbus method for GUID base device probing.

    Reduce the exposure of hv_device.

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

302699
    hyperv/vmbus: All ivars are read-only; nuke unnecessary write_ivar

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

302700
    hyperv/vmbus: Add channel ivar accessor.

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

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

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

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

302702
    hyperv/util: Avoid the hv_device

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

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

302703
    hyperv/vmbus: Deprecate the usage of hv_device.

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

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

302704
    hyperv/hn: Avoid the hv_device

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

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

302706
    hyperv: Get rid of hv_device, which is unnecessary indirection.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7034
2016-10-14 08:45:53 +00:00
Sepherosa Ziehau 95a8eb19e5 MFC 302693-302697
302693
    hyperv/vmbus: Make channel id a field of hv_vmbus_channel.

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

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

302694
    hyperv/vmbus: Make subchan index a field of hv_vmbus_channel.

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

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

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

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

302696
    hyperv/vmbus: Add type/instance guid fields into hv_vmbus_channel

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

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

302697
    hyperv/vmbus: Remove the embedded offer message from hv_vmbus_channel

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D7021
2016-10-14 08:34:44 +00:00
Sepherosa Ziehau 926c184efb MFC 302632-302634
302632
    hyperv/vmbus: More verbose for GPADL_connect/chan_{rescind,offer}

    Reviewed by:    Dexuan Cui <decui microsoft com>, Hongjiang Zhang <honzhan microsoft com>
    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6976

302633
    hyperv/vmbus: Free sysctl properly upon channel close.

    Prepare for sub-channel re-open.

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

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

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6978
2016-10-14 08:14:51 +00:00
Sepherosa Ziehau eee91ff6b0 MFC 302617-302621,302623,302629-302631
302617
    hyperv/vmbus: Flatten channel message response processing.

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

302618
    hyperv/vmbus: Avoid tx_evtflags setting code duplication.

    MFC after:      1 week
    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6915

302619
    hyperv/vmbus: Busdma-fy Hypercall signal event input parameter.

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

302620
    hyperv: Nuke unused stuffs

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

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

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

302623
    hyperv/vmbus: Minor renaming

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

302629
    hyperv/vmbus: Rework vmbus version accessing.

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

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

302630
    hyperv/vmbus: Move GPADL index into vmbus_softc

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

302631
    hyperv/vmbus: Move channel list to vmbus_softc

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6956
2016-10-14 08:02:37 +00:00
Sepherosa Ziehau 5eb0063409 MFC 302607-302612
302607
    hyperv/vmbus: Use post message Hypercall APIs for channel open

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

302608
    hyperv/vmbus: Remove unnecessary check and unapplied comment

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

302609
    hyperv/vmbus: Use post message Hypercall APIs for GPADL connect.

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

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

302610
    hyperv/vmbus: Use post message Hypercall APIs for channel close

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

302611
    hyperv/vmbus: Use post message Hypercall APIs for GPA disconnect

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

302612
    hyperv: Nuke unused stuffs

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6913
2016-10-14 07:47:35 +00:00
Sepherosa Ziehau 204dc81c08 MFC 302543-302545,302547,302549,302554,302556,302557,302559,302606
302543
    hyperv/vmbus: Use post message Hypercall APIs for channel request

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

302544
    hyperv/hn: Add tunable to allow tcp_lro_queue_mbuf()

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

302545
    hyperv/vmbus: Function renaming.

    And pass vmbus_softc to vmbus_doattach()

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

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

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

302549
    hyperv/vmbus: Add sysctl to expose vmbus version.

    Requested by:   Hongxiong Xian <v-hoxian microsoft com>
    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6860

302554
    hyperv/vmbus: Use post message Hypercall APIs for unload

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

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

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

302557
    hyperv/vmbus: Save vmbus softc to channels.

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

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

302559
    hyperv/vmbus: Embed channel detach task in channel itself.

    GC work queue stuffs.

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

302606
    hyperv/vmbus: Reorganize vmbus scan process.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6875
2016-10-14 07:40:04 +00:00
Sepherosa Ziehau b406657c4b MFC 302540
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.

    Sponsored by:   Microsoft OSTC
    Differential Revision:  https://reviews.freebsd.org/D6830
2016-10-14 07:27:29 +00:00
Sepherosa Ziehau 7df850a759 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
2016-05-31 05:43:59 +00:00
Sepherosa Ziehau 7e118515ca hyperv: Add helpers for busdma(9) operation
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6443
2016-05-23 06:35:11 +00:00
Pedro F. Giffuni 453130d9bf sys/dev: minor spelling fixes.
Most affect comments, very few have user-visible effects.
2016-05-03 03:41:25 +00:00
Sepherosa Ziehau 96a8c456f1 hyperv/channel: Git rid of the sub-channel creation callback
It is no longer used.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
2016-04-26 05:21:27 +00:00
Sepherosa Ziehau 480805ab13 hyperv/channel: Add functions to synchronize sub-channel offers
MFC after:	1 week
Sponsored by:	Microsoft OSTC
2016-04-25 09:00:06 +00:00
Sepherosa Ziehau 7cd9b96b7a hyperv: Update copyright to 2016 for the files Microsoft changed in 2016
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6039
2016-04-22 05:01:43 +00:00
Sepherosa Ziehau 57a339543d 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
2016-03-21 06:54:21 +00:00
Sepherosa Ziehau 21640df213 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
2016-03-04 06:52:11 +00:00
Sepherosa Ziehau 6c03f94bb3 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
2016-03-02 03:07:31 +00:00
Sepherosa Ziehau 3f919777b6 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
2016-02-26 09:41:00 +00:00