svn commit: r307484 - in stable/11/sys: dev/hyperv/netvsc net
Sepherosa Ziehau
sephe at FreeBSD.org
Mon Oct 17 07:11:00 UTC 2016
Author: sephe
Date: Mon Oct 17 07:10:58 2016
New Revision: 307484
URL: https://svnweb.freebsd.org/changeset/base/307484
Log:
MFC 304783-304785
304783
hyperv/hn: Use definition in net/rndis.h for message type and status code.
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7620
304784
hyperv/hn: Add compat code for RNDIS reorganization phase.
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7621
304785
hyperv/hn: Use vmbus xact for RNDIS initialize.
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7624
Modified:
stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c
stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h
stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
stable/11/sys/dev/hyperv/netvsc/hv_rndis.h
stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c
stable/11/sys/dev/hyperv/netvsc/if_hnvar.h
stable/11/sys/net/rndis.h
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c
==============================================================================
--- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 07:06:14 2016 (r307483)
+++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 07:10:58 2016 (r307484)
@@ -77,7 +77,7 @@ static void hn_nvs_sent_none(struct hn_s
static void hn_nvs_sent_xact(struct hn_send_ctx *, struct hn_softc *sc,
struct vmbus_channel *, const void *, int);
-static struct hn_send_ctx hn_send_ctx_none =
+struct hn_send_ctx hn_send_ctx_none =
HN_SEND_CTX_INITIALIZER(hn_nvs_sent_none, NULL);
uint32_t
Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h
==============================================================================
--- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 07:06:14 2016 (r307483)
+++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 07:10:58 2016 (r307484)
@@ -239,6 +239,11 @@ typedef struct {
uint8_t link_state;
} netvsc_device_info;
+#define HN_XACT_REQ_PGCNT 2
+#define HN_XACT_RESP_PGCNT 2
+#define HN_XACT_REQ_SIZE (HN_XACT_REQ_PGCNT * PAGE_SIZE)
+#define HN_XACT_RESP_SIZE (HN_XACT_RESP_PGCNT * PAGE_SIZE)
+
#ifndef HN_USE_TXDESC_BUFRING
struct hn_txdesc;
SLIST_HEAD(hn_txdesc_list, hn_txdesc);
@@ -375,6 +380,8 @@ typedef struct hn_softc {
uint32_t hn_chim_gpadl;
struct hyperv_dma hn_chim_dma;
+
+ uint32_t hn_rndis_rid;
} hn_softc_t;
#define HN_FLAG_RXBUF_CONNECTED 0x0001
Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==============================================================================
--- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 07:06:14 2016 (r307483)
+++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 07:10:58 2016 (r307484)
@@ -125,9 +125,6 @@ __FBSDID("$FreeBSD$");
/* Short for Hyper-V network interface */
#define NETVSC_DEVNAME "hn"
-#define HN_XACT_REQ_SIZE (2 * PAGE_SIZE)
-#define HN_XACT_RESP_SIZE (2 * PAGE_SIZE)
-
/*
* It looks like offset 0 of buf is reserved to hold the softc pointer.
* The sc pointer evidently not needed, and is not presently populated.
Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis.h
==============================================================================
--- stable/11/sys/dev/hyperv/netvsc/hv_rndis.h Mon Oct 17 07:06:14 2016 (r307483)
+++ stable/11/sys/dev/hyperv/netvsc/hv_rndis.h Mon Oct 17 07:10:58 2016 (r307484)
@@ -31,6 +31,7 @@
#ifndef __HV_RNDIS_H__
#define __HV_RNDIS_H__
+#include <net/rndis.h>
/*
* NDIS protocol version numbers
@@ -48,95 +49,6 @@
#define NDIS_VERSION (NDIS_VERSION_5_1)
/*
- * Status codes
- */
-
-#define STATUS_SUCCESS (0x00000000L)
-#define STATUS_UNSUCCESSFUL (0xC0000001L)
-#define STATUS_PENDING (0x00000103L)
-#define STATUS_INSUFFICIENT_RESOURCES (0xC000009AL)
-#define STATUS_BUFFER_OVERFLOW (0x80000005L)
-#define STATUS_NOT_SUPPORTED (0xC00000BBL)
-
-#define RNDIS_STATUS_SUCCESS (STATUS_SUCCESS)
-#define RNDIS_STATUS_PENDING (STATUS_PENDING)
-#define RNDIS_STATUS_NOT_RECOGNIZED (0x00010001L)
-#define RNDIS_STATUS_NOT_COPIED (0x00010002L)
-#define RNDIS_STATUS_NOT_ACCEPTED (0x00010003L)
-#define RNDIS_STATUS_CALL_ACTIVE (0x00010007L)
-
-#define RNDIS_STATUS_ONLINE (0x40010003L)
-#define RNDIS_STATUS_RESET_START (0x40010004L)
-#define RNDIS_STATUS_RESET_END (0x40010005L)
-#define RNDIS_STATUS_RING_STATUS (0x40010006L)
-#define RNDIS_STATUS_CLOSED (0x40010007L)
-#define RNDIS_STATUS_WAN_LINE_UP (0x40010008L)
-#define RNDIS_STATUS_WAN_LINE_DOWN (0x40010009L)
-#define RNDIS_STATUS_WAN_FRAGMENT (0x4001000AL)
-#define RNDIS_STATUS_MEDIA_CONNECT (0x4001000BL)
-#define RNDIS_STATUS_MEDIA_DISCONNECT (0x4001000CL)
-#define RNDIS_STATUS_HARDWARE_LINE_UP (0x4001000DL)
-#define RNDIS_STATUS_HARDWARE_LINE_DOWN (0x4001000EL)
-#define RNDIS_STATUS_INTERFACE_UP (0x4001000FL)
-#define RNDIS_STATUS_INTERFACE_DOWN (0x40010010L)
-#define RNDIS_STATUS_MEDIA_BUSY (0x40010011L)
-#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION (0x40010012L)
-#define RNDIS_STATUS_WW_INDICATION RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION
-#define RNDIS_STATUS_LINK_SPEED_CHANGE (0x40010013L)
-
-#define RNDIS_STATUS_NOT_RESETTABLE (0x80010001L)
-#define RNDIS_STATUS_SOFT_ERRORS (0x80010003L)
-#define RNDIS_STATUS_HARD_ERRORS (0x80010004L)
-#define RNDIS_STATUS_BUFFER_OVERFLOW (STATUS_BUFFER_OVERFLOW)
-
-#define RNDIS_STATUS_FAILURE (STATUS_UNSUCCESSFUL)
-#define RNDIS_STATUS_RESOURCES (STATUS_INSUFFICIENT_RESOURCES)
-#define RNDIS_STATUS_CLOSING (0xC0010002L)
-#define RNDIS_STATUS_BAD_VERSION (0xC0010004L)
-#define RNDIS_STATUS_BAD_CHARACTERISTICS (0xC0010005L)
-#define RNDIS_STATUS_ADAPTER_NOT_FOUND (0xC0010006L)
-#define RNDIS_STATUS_OPEN_FAILED (0xC0010007L)
-#define RNDIS_STATUS_DEVICE_FAILED (0xC0010008L)
-#define RNDIS_STATUS_MULTICAST_FULL (0xC0010009L)
-#define RNDIS_STATUS_MULTICAST_EXISTS (0xC001000AL)
-#define RNDIS_STATUS_MULTICAST_NOT_FOUND (0xC001000BL)
-#define RNDIS_STATUS_REQUEST_ABORTED (0xC001000CL)
-#define RNDIS_STATUS_RESET_IN_PROGRESS (0xC001000DL)
-#define RNDIS_STATUS_CLOSING_INDICATING (0xC001000EL)
-#define RNDIS_STATUS_NOT_SUPPORTED (STATUS_NOT_SUPPORTED)
-#define RNDIS_STATUS_INVALID_PACKET (0xC001000FL)
-#define RNDIS_STATUS_OPEN_LIST_FULL (0xC0010010L)
-#define RNDIS_STATUS_ADAPTER_NOT_READY (0xC0010011L)
-#define RNDIS_STATUS_ADAPTER_NOT_OPEN (0xC0010012L)
-#define RNDIS_STATUS_NOT_INDICATING (0xC0010013L)
-#define RNDIS_STATUS_INVALID_LENGTH (0xC0010014L)
-#define RNDIS_STATUS_INVALID_DATA (0xC0010015L)
-#define RNDIS_STATUS_BUFFER_TOO_SHORT (0xC0010016L)
-#define RNDIS_STATUS_INVALID_OID (0xC0010017L)
-#define RNDIS_STATUS_ADAPTER_REMOVED (0xC0010018L)
-#define RNDIS_STATUS_UNSUPPORTED_MEDIA (0xC0010019L)
-#define RNDIS_STATUS_GROUP_ADDRESS_IN_USE (0xC001001AL)
-#define RNDIS_STATUS_FILE_NOT_FOUND (0xC001001BL)
-#define RNDIS_STATUS_ERROR_READING_FILE (0xC001001CL)
-#define RNDIS_STATUS_ALREADY_MAPPED (0xC001001DL)
-#define RNDIS_STATUS_RESOURCE_CONFLICT (0xC001001EL)
-#define RNDIS_STATUS_NO_CABLE (0xC001001FL)
-
-#define RNDIS_STATUS_INVALID_SAP (0xC0010020L)
-#define RNDIS_STATUS_SAP_IN_USE (0xC0010021L)
-#define RNDIS_STATUS_INVALID_ADDRESS (0xC0010022L)
-#define RNDIS_STATUS_VC_NOT_ACTIVATED (0xC0010023L)
-#define RNDIS_STATUS_DEST_OUT_OF_ORDER (0xC0010024L)
-#define RNDIS_STATUS_VC_NOT_AVAILABLE (0xC0010025L)
-#define RNDIS_STATUS_CELLRATE_NOT_AVAILABLE (0xC0010026L)
-#define RNDIS_STATUS_INCOMPATABLE_QOS (0xC0010027L)
-#define RNDIS_STATUS_AAL_PARAMS_UNSUPPORTED (0xC0010028L)
-#define RNDIS_STATUS_NO_ROUTE_TO_DESTINATION (0xC0010029L)
-
-#define RNDIS_STATUS_TOKEN_RING_OPEN_ERROR (0xC0011000L)
-
-
-/*
* Object Identifiers used by NdisRequest Query/Set Information
*/
@@ -289,82 +201,6 @@
*/
#define OID_RNDISMP_GET_RECEIVE_BUFFERS 0xFFA0C90D // Query only
-
-/*
- * Remote NDIS message types
- */
-#define REMOTE_NDIS_PACKET_MSG 0x00000001
-#define REMOTE_NDIS_INITIALIZE_MSG 0x00000002
-#define REMOTE_NDIS_HALT_MSG 0x00000003
-#define REMOTE_NDIS_QUERY_MSG 0x00000004
-#define REMOTE_NDIS_SET_MSG 0x00000005
-#define REMOTE_NDIS_RESET_MSG 0x00000006
-#define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007
-#define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008
-
-#define REMOTE_CONDIS_MP_CREATE_VC_MSG 0x00008001
-#define REMOTE_CONDIS_MP_DELETE_VC_MSG 0x00008002
-#define REMOTE_CONDIS_MP_ACTIVATE_VC_MSG 0x00008005
-#define REMOTE_CONDIS_MP_DEACTIVATE_VC_MSG 0x00008006
-#define REMOTE_CONDIS_INDICATE_STATUS_MSG 0x00008007
-
-/*
- * Remote NDIS message completion types
- */
-#define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002
-#define REMOTE_NDIS_QUERY_CMPLT 0x80000004
-#define REMOTE_NDIS_SET_CMPLT 0x80000005
-#define REMOTE_NDIS_RESET_CMPLT 0x80000006
-#define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008
-
-#define REMOTE_CONDIS_MP_CREATE_VC_CMPLT 0x80008001
-#define REMOTE_CONDIS_MP_DELETE_VC_CMPLT 0x80008002
-#define REMOTE_CONDIS_MP_ACTIVATE_VC_CMPLT 0x80008005
-#define REMOTE_CONDIS_MP_DEACTIVATE_VC_CMPLT 0x80008006
-
-/*
- * Reserved message type for private communication between lower-layer
- * host driver and remote device, if necessary.
- */
-#define REMOTE_NDIS_BUS_MSG 0xff000001
-
-/*
- * Defines for DeviceFlags in rndis_initialize_complete
- */
-#define RNDIS_DF_CONNECTIONLESS 0x00000001
-#define RNDIS_DF_CONNECTION_ORIENTED 0x00000002
-#define RNDIS_DF_RAW_DATA 0x00000004
-
-/*
- * Remote NDIS medium types.
- */
-#define RNDIS_MEDIUM_802_3 0x00000000
-#define RNDIS_MEDIUM_802_5 0x00000001
-#define RNDIS_MEDIUM_FDDI 0x00000002
-#define RNDIS_MEDIUM_WAN 0x00000003
-#define RNDIS_MEDIUM_LOCAL_TALK 0x00000004
-#define RNDIS_MEDIUM_ARCNET_RAW 0x00000006
-#define RNDIS_MEDIUM_ARCNET_878_2 0x00000007
-#define RNDIS_MEDIUM_ATM 0x00000008
-#define RNDIS_MEDIUM_WIRELESS_WAN 0x00000009
-#define RNDIS_MEDIUM_IRDA 0x0000000a
-#define RNDIS_MEDIUM_CO_WAN 0x0000000b
-/* Not a real medium, defined as an upper bound */
-#define RNDIS_MEDIUM_MAX 0x0000000d
-
-/*
- * Remote NDIS medium connection states.
- */
-#define RNDIS_MEDIA_STATE_CONNECTED 0x00000000
-#define RNDIS_MEDIA_STATE_DISCONNECTED 0x00000001
-
-/*
- * Remote NDIS version numbers
- */
-#define RNDIS_MAJOR_VERSION 0x00000001
-#define RNDIS_MINOR_VERSION 0x00000000
-
-
/*
* Remote NDIS offload parameters
*/
Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==============================================================================
--- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 07:06:14 2016 (r307483)
+++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 07:10:58 2016 (r307484)
@@ -62,6 +62,11 @@ __FBSDID("$FreeBSD$");
HV_RF_RECVINFO_HASHINF | \
HV_RF_RECVINFO_HASHVAL)
+#define HN_RNDIS_RID_COMPAT_MASK 0xffff
+#define HN_RNDIS_RID_COMPAT_MAX HN_RNDIS_RID_COMPAT_MASK
+
+#define HN_RNDIS_XFER_SIZE 2048
+
/*
* Forward declarations
*/
@@ -92,6 +97,20 @@ static void hn_rndis_sent_cb(struct hn_s
struct hn_softc *sc, struct vmbus_channel *chan,
const void *data, int dlen);
+static __inline uint32_t
+hn_rndis_rid(struct hn_softc *sc)
+{
+ uint32_t rid;
+
+again:
+ rid = atomic_fetchadd_int(&sc->hn_rndis_rid, 1);
+ if (rid == 0)
+ goto again;
+
+ /* Use upper 16 bits for non-compat RNDIS messages. */
+ return ((rid & 0xffff) << 16);
+}
+
/*
* Set the Per-Packet-Info with the specified type
*/
@@ -202,9 +221,8 @@ hv_rndis_request(rndis_device *device, u
* as a template.
*/
set = &rndis_mesg->msg.set_request;
- set->request_id = atomic_fetchadd_int(&device->new_request_id, 1);
- /* Increment to get the new value (call above returns old value) */
- set->request_id += 1;
+ set->request_id = atomic_fetchadd_int(&device->new_request_id, 1) &
+ HN_RNDIS_RID_COMPAT_MASK;
/* Add to the request list */
mtx_lock(&device->req_lock);
@@ -325,7 +343,7 @@ hv_rf_receive_response(rndis_device *dev
response->msg_len);
} else {
request->response_msg.msg.init_complete.status =
- STATUS_BUFFER_OVERFLOW;
+ RNDIS_STATUS_BUFFER_OVERFLOW;
}
sema_post(&request->wait_sema);
}
@@ -389,7 +407,7 @@ hv_rf_send_offload_request(struct hn_sof
device_printf(dev, "hv send offload request succeeded\n");
ret = 0;
} else {
- if (set_complete->status == STATUS_NOT_SUPPORTED) {
+ if (set_complete->status == RNDIS_STATUS_NOT_SUPPORTED) {
device_printf(dev, "HV Not support offload\n");
ret = 0;
} else {
@@ -552,6 +570,7 @@ hv_rf_on_receive(struct hn_softc *sc, st
{
rndis_device *rndis_dev;
const rndis_msg *rndis_hdr;
+ const struct rndis_comp_hdr *comp;
rndis_dev = sc->rndis_dev;
if (rndis_dev->state == RNDIS_DEV_UNINITIALIZED)
@@ -569,7 +588,13 @@ hv_rf_on_receive(struct hn_softc *sc, st
case REMOTE_NDIS_QUERY_CMPLT:
case REMOTE_NDIS_SET_CMPLT:
case REMOTE_NDIS_KEEPALIVE_CMPLT:
- hv_rf_receive_response(rndis_dev, rndis_hdr);
+ comp = data;
+ if (comp->rm_rid <= HN_RNDIS_RID_COMPAT_MAX) {
+ /* Transition time compat code */
+ hv_rf_receive_response(rndis_dev, rndis_hdr);
+ } else {
+ vmbus_xact_ctx_wakeup(sc->hn_xact, data, dlen);
+ }
break;
/* notification message */
@@ -865,62 +890,139 @@ exit:
return (ret);
}
-/*
- * RNDIS filter init device
- */
-static int
-hv_rf_init_device(rndis_device *device)
-{
- rndis_request *request;
- rndis_initialize_request *init;
- rndis_initialize_complete *init_complete;
- uint32_t status;
- int ret;
+static const void *
+hn_rndis_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact, uint32_t rid,
+ size_t reqlen, size_t min_complen, uint32_t comp_type)
+{
+ struct vmbus_gpa gpa[HN_XACT_REQ_PGCNT];
+ const struct rndis_comp_hdr *comp;
+ bus_addr_t paddr;
+ size_t comp_len;
+ int gpa_cnt, error;
+
+ KASSERT(rid > HN_RNDIS_RID_COMPAT_MAX, ("invalid rid %u\n", rid));
+ KASSERT(reqlen <= HN_XACT_REQ_SIZE && reqlen > 0,
+ ("invalid request length %zu", reqlen));
+ KASSERT(min_complen >= sizeof(*comp),
+ ("invalid minimum complete len %zu", min_complen));
- request = hv_rndis_request(device, REMOTE_NDIS_INITIALIZE_MSG,
- RNDIS_MESSAGE_SIZE(rndis_initialize_request));
- if (!request) {
- ret = -1;
- goto cleanup;
+ /*
+ * Setup the SG list.
+ */
+ paddr = vmbus_xact_req_paddr(xact);
+ KASSERT((paddr & PAGE_MASK) == 0,
+ ("vmbus xact request is not page aligned 0x%jx", (uintmax_t)paddr));
+ for (gpa_cnt = 0; gpa_cnt < HN_XACT_REQ_PGCNT; ++gpa_cnt) {
+ int len = PAGE_SIZE;
+
+ if (reqlen == 0)
+ break;
+ if (reqlen < len)
+ len = reqlen;
+
+ gpa[gpa_cnt].gpa_page = atop(paddr) + gpa_cnt;
+ gpa[gpa_cnt].gpa_len = len;
+ gpa[gpa_cnt].gpa_ofs = 0;
+
+ reqlen -= len;
}
+ KASSERT(reqlen == 0, ("still have %zu request data left", reqlen));
- /* Set up the rndis set */
- init = &request->request_msg.msg.init_request;
- init->major_version = RNDIS_MAJOR_VERSION;
- init->minor_version = RNDIS_MINOR_VERSION;
/*
- * Per the RNDIS document, this should be set to the max MTU
- * plus the header size. However, 2048 works fine, so leaving
- * it as is.
+ * Send this RNDIS control message and wait for its completion
+ * message.
*/
- init->max_xfer_size = 2048;
-
- device->state = RNDIS_DEV_INITIALIZING;
+ vmbus_xact_activate(xact);
+ error = hv_nv_on_send(sc->hn_prichan, HN_NVS_RNDIS_MTYPE_CTRL,
+ &hn_send_ctx_none, gpa, gpa_cnt);
+ if (error) {
+ vmbus_xact_deactivate(xact);
+ if_printf(sc->hn_ifp, "RNDIS ctrl send failed: %d\n", error);
+ return (NULL);
+ }
+ comp = vmbus_xact_wait(xact, &comp_len);
- ret = hv_rf_send_request(device, request, REMOTE_NDIS_INITIALIZE_MSG);
- if (ret != 0) {
- device->state = RNDIS_DEV_UNINITIALIZED;
- goto cleanup;
+ /*
+ * Check this RNDIS complete message.
+ */
+ if (comp_len < min_complen) {
+ if_printf(sc->hn_ifp, "invalid RNDIS comp len %zu\n", comp_len);
+ return (NULL);
+ }
+ if (comp->rm_len < min_complen) {
+ if_printf(sc->hn_ifp, "invalid RNDIS comp msglen %u\n",
+ comp->rm_len);
+ return (NULL);
+ }
+ if (comp->rm_type != comp_type) {
+ if_printf(sc->hn_ifp, "unexpected RNDIS comp 0x%08x, "
+ "expect 0x%08x\n", comp->rm_type, comp_type);
+ return (NULL);
+ }
+ if (comp->rm_rid != rid) {
+ if_printf(sc->hn_ifp, "RNDIS comp rid mismatch %u, "
+ "expect %u\n", comp->rm_rid, rid);
+ return (NULL);
}
+ /* All pass! */
+ return (comp);
+}
- sema_wait(&request->wait_sema);
+/*
+ * RNDIS filter init device
+ */
+static int
+hv_rf_init_device(rndis_device *device)
+{
+ struct hn_softc *sc = device->sc;
+ struct rndis_init_req *req;
+ const struct rndis_init_comp *comp;
+ struct vmbus_xact *xact;
+ uint32_t rid;
+ int error;
- init_complete = &request->response_msg.msg.init_complete;
- status = init_complete->status;
- if (status == RNDIS_STATUS_SUCCESS) {
- device->state = RNDIS_DEV_INITIALIZED;
- ret = 0;
- } else {
- device->state = RNDIS_DEV_UNINITIALIZED;
- ret = -1;
- }
+ /* XXX */
+ device->state = RNDIS_DEV_INITIALIZED;
-cleanup:
- if (request) {
- hv_put_rndis_request(device, request);
+ xact = vmbus_xact_get(sc->hn_xact, sizeof(*req));
+ if (xact == NULL) {
+ if_printf(sc->hn_ifp, "no xact for RNDIS init\n");
+ return (ENXIO);
+ }
+ rid = hn_rndis_rid(sc);
+ req = vmbus_xact_req_data(xact);
+ req->rm_type = REMOTE_NDIS_INITIALIZE_MSG;
+ req->rm_len = sizeof(*req);
+ req->rm_rid = rid;
+ req->rm_ver_major = RNDIS_VERSION_MAJOR;
+ req->rm_ver_minor = RNDIS_VERSION_MINOR;
+ req->rm_max_xfersz = HN_RNDIS_XFER_SIZE;
+
+ comp = hn_rndis_xact_execute(sc, xact, rid, sizeof(*req),
+ RNDIS_INIT_COMP_SIZE_MIN, REMOTE_NDIS_INITIALIZE_CMPLT);
+ if (comp == NULL) {
+ if_printf(sc->hn_ifp, "exec RNDIS init failed\n");
+ error = EIO;
+ goto done;
+ }
+
+ if (comp->rm_status != RNDIS_STATUS_SUCCESS) {
+ if_printf(sc->hn_ifp, "RNDIS init failed: status 0x%08x\n",
+ comp->rm_status);
+ error = EIO;
+ goto done;
+ }
+ if (bootverbose) {
+ if_printf(sc->hn_ifp, "RNDIS ver %u.%u, pktsz %u, pktcnt %u\n",
+ comp->rm_ver_major, comp->rm_ver_minor,
+ comp->rm_pktmaxsz, comp->rm_pktmaxcnt);
}
+ error = 0;
- return (ret);
+done:
+ if (xact != NULL)
+ vmbus_xact_put(xact);
+ return (error);
}
#define HALT_COMPLETION_WAIT_COUNT 25
Modified: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h
==============================================================================
--- stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Mon Oct 17 07:06:14 2016 (r307483)
+++ stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Mon Oct 17 07:10:58 2016 (r307484)
@@ -115,4 +115,6 @@ const void *hn_nvs_xact_execute(struct h
uint32_t hn_chim_alloc(struct hn_softc *sc);
void hn_chim_free(struct hn_softc *sc, uint32_t chim_idx);
+extern struct hn_send_ctx hn_send_ctx_none;
+
#endif /* !_IF_HNVAR_H_ */
Modified: stable/11/sys/net/rndis.h
==============================================================================
--- stable/11/sys/net/rndis.h Mon Oct 17 07:06:14 2016 (r307483)
+++ stable/11/sys/net/rndis.h Mon Oct 17 07:10:58 2016 (r307484)
@@ -146,6 +146,9 @@ struct rndis_init_comp {
uint32_t rm_aflistsz;
};
+#define RNDIS_INIT_COMP_SIZE_MIN \
+ __offsetof(struct rndis_init_comp, rm_aflistsz)
+
/* Halt the device. No response sent. */
#define REMOTE_NDIS_HALT_MSG 0x00000003
More information about the svn-src-stable-11
mailing list