1 /*- 2 * Copyright (c) 2016 Microsoft Corp. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice unmodified, this list of conditions, and the following 10 * disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27 #ifndef _DEV_PV_IF_HVNREG_H_ 28 #define _DEV_PV_IF_HVNREG_H_ 29 30 #define HVN_NVS_PROTO_VERSION_1 0x00002 31 #define HVN_NVS_PROTO_VERSION_2 0x30002 32 #define HVN_NVS_PROTO_VERSION_4 0x40000 33 #define HVN_NVS_PROTO_VERSION_5 0x50000 34 35 #define HVN_NVS_RXBUF_SIG 0x2409 36 #define HVN_NVS_CHIM_SIG 0x1984 37 38 #define HVN_NVS_CHIM_IDX_INVALID 0xffffffff 39 40 #define HVN_NVS_RNDIS_MTYPE_DATA 0 41 #define HVN_NVS_RNDIS_MTYPE_CTRL 1 42 43 /* 44 * NVS message transaction status codes. 45 */ 46 #define HVN_NVS_STATUS_OK 1 47 #define HVN_NVS_STATUS_FAILED 2 48 49 /* 50 * NVS request/response message types. 51 */ 52 #define HVN_NVS_TYPE_INIT 1 53 #define HVN_NVS_TYPE_INIT_RESP 2 54 #define HVN_NVS_TYPE_NDIS_INIT 100 55 #define HVN_NVS_TYPE_RXBUF_CONN 101 56 #define HVN_NVS_TYPE_RXBUF_CONNRESP 102 57 #define HVN_NVS_TYPE_RXBUF_DISCONN 103 58 #define HVN_NVS_TYPE_CHIM_CONN 104 59 #define HVN_NVS_TYPE_CHIM_CONNRESP 105 60 #define HVN_NVS_TYPE_CHIM_DISCONN 106 61 #define HVN_NVS_TYPE_RNDIS 107 62 #define HVN_NVS_TYPE_RNDIS_ACK 108 63 #define HVN_NVS_TYPE_NDIS_CONF 125 64 #define HVN_NVS_TYPE_VFASSOC_NOTE 128 /* notification */ 65 #define HVN_NVS_TYPE_SET_DATAPATH 129 66 #define HVN_NVS_TYPE_SUBCH_REQ 133 67 #define HVN_NVS_TYPE_SUBCH_RESP 133 /* same as SUBCH_REQ */ 68 #define HVN_NVS_TYPE_TXTBL_NOTE 134 /* notification */ 69 70 /* 71 * Any size less than this one will _not_ work, e.g. hn_nvs_init 72 * only has 12B valid data, however, if only 12B data were sent, 73 * Hypervisor would never reply. 74 */ 75 #define HVN_NVS_REQSIZE_MIN 32 76 77 /* NVS message common header */ 78 struct hvn_nvs_hdr { 79 uint32_t nvs_type; 80 } __packed; 81 82 struct hvn_nvs_init { 83 uint32_t nvs_type; /* HVN_NVS_TYPE_INIT */ 84 uint32_t nvs_ver_min; 85 uint32_t nvs_ver_max; 86 uint8_t nvs_rsvd[20]; 87 } __packed; 88 89 struct hvn_nvs_init_resp { 90 uint32_t nvs_type; /* HVN_NVS_TYPE_INIT_RESP */ 91 uint32_t nvs_ver; /* deprecated */ 92 uint32_t nvs_rsvd; 93 uint32_t nvs_status; /* HVN_NVS_STATUS_ */ 94 } __packed; 95 96 /* No response */ 97 struct hvn_nvs_ndis_conf { 98 uint32_t nvs_type; /* HVN_NVS_TYPE_NDIS_CONF */ 99 uint32_t nvs_mtu; 100 uint32_t nvs_rsvd; 101 uint64_t nvs_caps; /* HVN_NVS_NDIS_CONF_ */ 102 uint8_t nvs_rsvd1[12]; 103 } __packed; 104 105 #define HVN_NVS_NDIS_CONF_SRIOV 0x0004 106 #define HVN_NVS_NDIS_CONF_VLAN 0x0008 107 108 /* No response */ 109 struct hvn_nvs_ndis_init { 110 uint32_t nvs_type; /* HVN_NVS_TYPE_NDIS_INIT */ 111 uint32_t nvs_ndis_major; /* NDIS_VERSION_MAJOR_ */ 112 uint32_t nvs_ndis_minor; /* NDIS_VERSION_MINOR_ */ 113 uint8_t nvs_rsvd[20]; 114 } __packed; 115 116 struct hvn_nvs_rxbuf_conn { 117 uint32_t nvs_type; /* HVN_NVS_TYPE_RXBUF_CONN */ 118 uint32_t nvs_gpadl; /* RXBUF vmbus GPADL */ 119 uint16_t nvs_sig; /* HVN_NVS_RXBUF_SIG */ 120 uint8_t nvs_rsvd[22]; 121 } __packed; 122 123 struct hvn_nvs_rxbuf_sect { 124 uint32_t nvs_start; 125 uint32_t nvs_slotsz; 126 uint32_t nvs_slotcnt; 127 uint32_t nvs_end; 128 } __packed; 129 130 struct hvn_nvs_rxbuf_conn_resp { 131 uint32_t nvs_type; /* HVN_NVS_TYPE_RXBUF_CONNRESP */ 132 uint32_t nvs_status; /* HVN_NVS_STATUS_ */ 133 uint32_t nvs_nsect; /* # of elem in nvs_sect */ 134 struct hvn_nvs_rxbuf_sect nvs_sect[0]; 135 } __packed; 136 137 /* No response */ 138 struct hvn_nvs_rxbuf_disconn { 139 uint32_t nvs_type; /* HVN_NVS_TYPE_RXBUF_DISCONN */ 140 uint16_t nvs_sig; /* HVN_NVS_RXBUF_SIG */ 141 uint8_t nvs_rsvd[26]; 142 } __packed; 143 144 struct hvn_nvs_chim_conn { 145 uint32_t nvs_type; /* HVN_NVS_TYPE_CHIM_CONN */ 146 uint32_t nvs_gpadl; /* chimney buf vmbus GPADL */ 147 uint16_t nvs_sig; /* NDIS_NVS_CHIM_SIG */ 148 uint8_t nvs_rsvd[22]; 149 } __packed; 150 151 struct hvn_nvs_chim_conn_resp { 152 uint32_t nvs_type; /* HVN_NVS_TYPE_CHIM_CONNRESP */ 153 uint32_t nvs_status; /* HVN_NVS_STATUS_ */ 154 uint32_t nvs_sectsz; /* section size */ 155 } __packed; 156 157 /* No response */ 158 struct hvn_nvs_chim_disconn { 159 uint32_t nvs_type; /* HVN_NVS_TYPE_CHIM_DISCONN */ 160 uint16_t nvs_sig; /* HVN_NVS_CHIM_SIG */ 161 uint8_t nvs_rsvd[26]; 162 } __packed; 163 164 #define HVN_NVS_SUBCH_OP_ALLOC 1 165 166 struct hvn_nvs_subch_req { 167 uint32_t nvs_type; /* HVN_NVS_TYPE_SUBCH_REQ */ 168 uint32_t nvs_op; /* HVN_NVS_SUBCH_OP_ */ 169 uint32_t nvs_nsubch; 170 uint8_t nvs_rsvd[20]; 171 } __packed; 172 173 struct hvn_nvs_subch_resp { 174 uint32_t nvs_type; /* HVN_NVS_TYPE_SUBCH_RESP */ 175 uint32_t nvs_status; /* HVN_NVS_STATUS_ */ 176 uint32_t nvs_nsubch; 177 } __packed; 178 179 struct hvn_nvs_rndis { 180 uint32_t nvs_type; /* HVN_NVS_TYPE_RNDIS */ 181 uint32_t nvs_rndis_mtype;/* HVN_NVS_RNDIS_MTYPE_ */ 182 /* 183 * Chimney sending buffer index and size. 184 * 185 * NOTE: 186 * If nvs_chim_idx is set to HVN_NVS_CHIM_IDX_INVALID 187 * and nvs_chim_sz is set to 0, then chimney sending 188 * buffer is _not_ used by this RNDIS message. 189 */ 190 uint32_t nvs_chim_idx; 191 uint32_t nvs_chim_sz; 192 uint8_t nvs_rsvd[16]; 193 } __packed; 194 195 struct hvn_nvs_rndis_ack { 196 uint32_t nvs_type; /* HVN_NVS_TYPE_RNDIS_ACK */ 197 uint32_t nvs_status; /* HVN_NVS_STATUS_ */ 198 uint8_t nvs_rsvd[24]; 199 } __packed; 200 201 #endif /* _DEV_PV_IF_HVNREG_H_ */ 202