summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2016-09-16 22:44:33 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2016-09-16 22:44:33 +0000
commit8c693b550dbcd7a998a47b491c04bfc698468c97 (patch)
tree2dfb2ffa64e04a322a6b6ccda2c857ba064a26c2 /sys
parent9cbe4fd178ff0b30fbd4bc762c744555f6db577e (diff)
Switch over to the generic RNDIS header
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pv/if_hvn.c244
-rw-r--r--sys/dev/pv/rndisreg.h825
2 files changed, 134 insertions, 935 deletions
diff --git a/sys/dev/pv/if_hvn.c b/sys/dev/pv/if_hvn.c
index 5a6e6525233..bb121843476 100644
--- a/sys/dev/pv/if_hvn.c
+++ b/sys/dev/pv/if_hvn.c
@@ -55,6 +55,8 @@
#include <dev/pv/hypervreg.h>
#include <dev/pv/hypervvar.h>
+
+#include <dev/rndis.h>
#include <dev/pv/rndisreg.h>
#include <dev/pv/if_hvnreg.h>
@@ -84,15 +86,18 @@
#define HVN_RNDIS_CMPBUFSZ 512
#define HVN_RNDIS_MSG_LEN \
- (sizeof(struct rndis) + RNDIS_VLAN_PPI_SIZE + RNDIS_CSUM_PPI_SIZE)
+ (sizeof(struct rndis_packet_msg) + RNDIS_VLAN_PPI_SIZE + \
+ RNDIS_CSUM_PPI_SIZE)
struct rndis_cmd {
uint32_t rc_id;
struct hvn_nvs_rndis rc_msg;
- struct rndis *rc_req;
+ void *rc_req;
bus_dmamap_t rc_dmap;
+ bus_dma_segment_t rc_segs;
+ int rc_nsegs;
uint64_t rc_gpa;
- struct rndis rc_cmp;
+ struct rndis_packet_msg rc_cmp;
uint32_t rc_cmplen;
uint8_t rc_cmpbuf[HVN_RNDIS_CMPBUFSZ];
struct mutex rc_mtx;
@@ -117,7 +122,7 @@ struct hvn_tx_desc {
bus_dmamap_t txd_dmap;
struct vmbus_gpa txd_gpa;
struct hvn_nvs_rndis txd_cmd;
- struct rndis *txd_req;
+ struct rndis_packet_msg *txd_req;
};
struct hvn_softc {
@@ -175,7 +180,6 @@ void hvn_start(struct ifnet *);
int hvn_encap(struct hvn_softc *, struct mbuf *, struct hvn_tx_desc **);
void hvn_decap(struct hvn_softc *, struct hvn_tx_desc *);
void hvn_txeof(struct hvn_softc *, uint64_t);
-void hvn_rxeof(struct hvn_softc *, void *);
int hvn_rx_ring_create(struct hvn_softc *);
int hvn_rx_ring_destroy(struct hvn_softc *);
int hvn_tx_ring_create(struct hvn_softc *);
@@ -195,9 +199,8 @@ void hvn_nvs_detach(struct hvn_softc *);
/* RNDIS */
int hvn_rndis_attach(struct hvn_softc *);
int hvn_rndis_cmd(struct hvn_softc *, struct rndis_cmd *, int);
-void hvn_rndis_filter(struct hvn_softc *sc, uint64_t, void *);
-void hvn_rndis_input(struct hvn_softc *, caddr_t, uint32_t,
- struct mbuf_list *);
+void hvn_rndis_input(struct hvn_softc *, uint64_t, void *);
+void hvn_rxeof(struct hvn_softc *, caddr_t, uint32_t, struct mbuf_list *);
void hvn_rndis_complete(struct hvn_softc *, caddr_t, uint32_t);
int hvn_rndis_output(struct hvn_softc *, struct hvn_tx_desc *);
void hvn_rndis_status(struct hvn_softc *, caddr_t, uint32_t);
@@ -474,7 +477,6 @@ int
hvn_encap(struct hvn_softc *sc, struct mbuf *m, struct hvn_tx_desc **txd0)
{
struct hvn_tx_desc *txd;
- struct rndis_pkt *pkt;
bus_dma_segment_t *seg;
size_t rlen;
int i;
@@ -487,14 +489,12 @@ hvn_encap(struct hvn_softc *sc, struct mbuf *m, struct hvn_tx_desc **txd0)
txd = &sc->sc_tx_desc[sc->sc_tx_next];
}
- memset(txd->txd_req, 0, HVN_RNDIS_MSG_LEN);
- txd->txd_req->msg_type = RNDIS_PACKET_MSG;
-
- pkt = (struct rndis_pkt *)&txd->txd_req->msg;
- pkt->data_offset = sizeof(struct rndis_pkt);
- pkt->data_length = m->m_pkthdr.len;
- pkt->pkt_info_offset = sizeof(struct rndis_pkt);
- rlen = RNDIS_MESSAGE_SIZE(*pkt);
+ memset(txd->txd_req, 0, sizeof(*txd->txd_req));
+ txd->txd_req->rm_type = REMOTE_NDIS_PACKET_MSG;
+ txd->txd_req->rm_dataoffset = RNDIS_DATA_OFFSET;
+ txd->txd_req->rm_datalen = m->m_pkthdr.len;
+ txd->txd_req->rm_pktinfooffset = RNDIS_DATA_OFFSET;
+ rlen = sizeof(struct rndis_packet_msg);
if (bus_dmamap_load_mbuf(sc->sc_dmat, txd->txd_dmap, m, BUS_DMA_READ |
BUS_DMA_NOWAIT)) {
@@ -506,7 +506,7 @@ hvn_encap(struct hvn_softc *sc, struct mbuf *m, struct hvn_tx_desc **txd0)
/* Per-packet info adjusts rlen */
/* Final length value for the RNDIS header and data */
- txd->txd_req->msg_len = pkt->data_length + rlen;
+ txd->txd_req->rm_len = txd->txd_req->rm_datalen + rlen;
/* Attach an RNDIS message into the first slot */
txd->txd_sgl[0].gpa_page = txd->txd_gpa.gpa_page;
@@ -707,7 +707,7 @@ hvn_tx_ring_create(struct hvn_softc *sc)
txd->txd_gpa.gpa_page = atop(pa);
txd->txd_gpa.gpa_ofs = pa & PAGE_MASK;
txd->txd_gpa.gpa_len = msgsize;
- txd->txd_req = (struct rndis *)((caddr_t)sc->sc_tx_msgs +
+ txd->txd_req = (void *)((caddr_t)sc->sc_tx_msgs +
(msgsize * i));
txd->txd_id = i;
txd->txd_ready = 1;
@@ -765,7 +765,7 @@ hvn_get_lladdr(struct hvn_softc *sc)
size_t addrlen = ETHER_ADDR_LEN;
int rv;
- rv = hvn_rndis_query(sc, RNDIS_OID_802_3_PERMANENT_ADDRESS,
+ rv = hvn_rndis_query(sc, OID_802_3_PERMANENT_ADDRESS,
enaddr, &addrlen);
if (rv == 0 && addrlen == ETHER_ADDR_LEN)
memcpy(sc->sc_ac.ac_enaddr, enaddr, ETHER_ADDR_LEN);
@@ -775,7 +775,7 @@ hvn_get_lladdr(struct hvn_softc *sc)
int
hvn_set_lladdr(struct hvn_softc *sc)
{
- return (hvn_rndis_set(sc, RNDIS_OID_802_3_CURRENT_ADDRESS,
+ return (hvn_rndis_set(sc, OID_802_3_CURRENT_ADDRESS,
sc->sc_ac.ac_enaddr, ETHER_ADDR_LEN));
}
@@ -785,7 +785,7 @@ hvn_get_link_status(struct hvn_softc *sc)
uint32_t state;
size_t len = sizeof(state);
- if (hvn_rndis_query(sc, RNDIS_OID_GEN_MEDIA_CONNECT_STATUS,
+ if (hvn_rndis_query(sc, OID_GEN_MEDIA_CONNECT_STATUS,
&state, &len) == 0)
sc->sc_link_state = (state == 0) ? LINK_STATE_UP :
LINK_STATE_DOWN;
@@ -904,7 +904,7 @@ hvn_nvs_intr(void *arg)
} else if (cph->cph_type == VMBUS_CHANPKT_TYPE_RXBUF) {
switch (nvs->nvs_type) {
case HVN_NVS_TYPE_RNDIS:
- hvn_rndis_filter(sc, cph->cph_tid, cph);
+ hvn_rndis_input(sc, cph->cph_tid, cph);
break;
default:
printf("%s: unhandled NVSP packet type %d "
@@ -1055,7 +1055,7 @@ hvn_rollback_cmd(struct hvn_softc *sc, struct rndis_cmd *rc)
static inline void
hvn_free_cmd(struct hvn_softc *sc, struct rndis_cmd *rc)
{
- memset(rc->rc_req, 0, sizeof(*rc->rc_req));
+ memset(rc->rc_req, 0, sizeof(struct rndis_packet_msg));
memset(&rc->rc_cmp, 0, sizeof(rc->rc_cmp));
memset(&rc->rc_msg, 0, sizeof(rc->rc_msg));
mtx_enter(&sc->sc_cntl_fqlck);
@@ -1088,11 +1088,20 @@ hvn_rndis_attach(struct hvn_softc *sc)
sc->sc_dev.dv_xname);
goto errout;
}
- rc->rc_req = km_alloc(PAGE_SIZE, &kv_any, &kp_zero,
- &kd_waitok);
- if (rc->rc_req == NULL) {
+ if (bus_dmamem_alloc(sc->sc_dmat, PAGE_SIZE, PAGE_SIZE,
+ 0, &rc->rc_segs, 1, &rc->rc_nsegs, BUS_DMA_NOWAIT |
+ BUS_DMA_ZERO)) {
+ DPRINTF("%s: failed to allocate RNDIS command\n",
+ sc->sc_dev.dv_xname);
+ bus_dmamap_destroy(sc->sc_dmat, rc->rc_dmap);
+ goto errout;
+ }
+ if (bus_dmamem_map(sc->sc_dmat, &rc->rc_segs, rc->rc_nsegs,
+ PAGE_SIZE, (caddr_t *)&rc->rc_req, BUS_DMA_NOWAIT)) {
DPRINTF("%s: failed to allocate RNDIS command\n",
sc->sc_dev.dv_xname);
+ bus_dmamem_free(sc->sc_dmat, &rc->rc_segs,
+ rc->rc_nsegs);
bus_dmamap_destroy(sc->sc_dmat, rc->rc_dmap);
goto errout;
}
@@ -1100,7 +1109,8 @@ hvn_rndis_attach(struct hvn_softc *sc)
PAGE_SIZE, NULL, BUS_DMA_WAITOK)) {
DPRINTF("%s: failed to load RNDIS command map\n",
sc->sc_dev.dv_xname);
- km_free(rc->rc_req, PAGE_SIZE, &kv_any, &kp_zero);
+ bus_dmamem_free(sc->sc_dmat, &rc->rc_segs,
+ rc->rc_nsegs);
bus_dmamap_destroy(sc->sc_dmat, rc->rc_dmap);
goto errout;
}
@@ -1114,15 +1124,17 @@ hvn_rndis_attach(struct hvn_softc *sc)
bus_dmamap_sync(sc->sc_dmat, rc->rc_dmap, 0, PAGE_SIZE,
BUS_DMASYNC_PREREAD);
- rc->rc_req->msg_type = RNDIS_INITIALIZE_MSG;
- rc->rc_req->msg_len = RNDIS_MESSAGE_SIZE(*req);
- rc->rc_cmplen = RNDIS_MESSAGE_SIZE(*cmp);
rc->rc_id = atomic_inc_int_nv(&sc->sc_rndisrid);
- req = (struct rndis_init_req *)&rc->rc_req->msg;
- req->request_id = rc->rc_id;
- req->major_version = RNDIS_MAJOR_VERSION;
- req->minor_version = RNDIS_MINOR_VERSION;
- req->max_xfer_size = 2048; /* XXX */
+
+ req = rc->rc_req;
+ req->rm_type = REMOTE_NDIS_INITIALIZE_MSG;
+ req->rm_len = sizeof(*req);
+ req->rm_rid = rc->rc_id;
+ req->rm_ver_major = RNDIS_VERSION_MAJOR;
+ req->rm_ver_minor = RNDIS_VERSION_MINOR;
+ req->rm_max_xfersz = 2048; /* XXX */
+
+ rc->rc_cmplen = sizeof(*cmp);
bus_dmamap_sync(sc->sc_dmat, rc->rc_dmap, 0, PAGE_SIZE,
BUS_DMASYNC_PREWRITE);
@@ -1133,10 +1145,10 @@ hvn_rndis_attach(struct hvn_softc *sc)
hvn_free_cmd(sc, rc);
goto errout;
}
- cmp = (struct rndis_init_comp *)&rc->rc_cmp.msg;
- if (cmp->status != RNDIS_STATUS_SUCCESS) {
+ cmp = (struct rndis_init_comp *)&rc->rc_cmp;
+ if (cmp->rm_status != RNDIS_STATUS_SUCCESS) {
DPRINTF("%s: failed to init RNDIS, error %#x\n",
- sc->sc_dev.dv_xname, cmp->status);
+ sc->sc_dev.dv_xname, cmp->rm_status);
hvn_free_cmd(sc, rc);
goto errout;
}
@@ -1151,7 +1163,7 @@ errout:
if (rc->rc_req == NULL)
continue;
TAILQ_REMOVE(&sc->sc_cntl_fq, rc, rc_entry);
- km_free(rc->rc_req, PAGE_SIZE, &kv_any, &kp_zero);
+ bus_dmamem_free(sc->sc_dmat, &rc->rc_segs, rc->rc_nsegs);
rc->rc_req = NULL;
bus_dmamap_destroy(sc->sc_dmat, rc->rc_dmap);
}
@@ -1162,6 +1174,7 @@ int
hvn_rndis_cmd(struct hvn_softc *sc, struct rndis_cmd *rc, int timo)
{
struct hvn_nvs_rndis *msg = &rc->rc_msg;
+ struct rndis_msghdr *hdr = rc->rc_req;
struct vmbus_gpa sgl[1];
int tries = 10;
int rv;
@@ -1173,7 +1186,7 @@ hvn_rndis_cmd(struct hvn_softc *sc, struct rndis_cmd *rc, int timo)
msg->nvs_chim_idx = HVN_NVS_CHIM_IDX_INVALID;
sgl[0].gpa_page = rc->rc_gpa;
- sgl[0].gpa_len = rc->rc_req->msg_len;
+ sgl[0].gpa_len = hdr->rm_len;
sgl[0].gpa_ofs = 0;
hvn_submit_cmd(sc, rc);
@@ -1185,7 +1198,7 @@ hvn_rndis_cmd(struct hvn_softc *sc, struct rndis_cmd *rc, int timo)
tsleep(rc, PRIBIO, "hvnsendbuf", timo / 10);
else if (rv) {
DPRINTF("%s: RNDIS operation %d send error %d\n",
- sc->sc_dev.dv_xname, rc->rc_req->msg_type, rv);
+ sc->sc_dev.dv_xname, hdr->rm_type, rv);
return (rv);
}
} while (rv != 0 && --tries > 0);
@@ -1213,14 +1226,14 @@ hvn_rndis_cmd(struct hvn_softc *sc, struct rndis_cmd *rc, int timo)
break;
}
printf("%s: RNDIS opertaion %d timed out\n", sc->sc_dev.dv_xname,
- rc->rc_req->msg_type);
+ hdr->rm_type);
}
#endif
return (rv);
}
void
-hvn_rndis_filter(struct hvn_softc *sc, uint64_t tid, void *arg)
+hvn_rndis_input(struct hvn_softc *sc, uint64_t tid, void *arg)
{
struct ifnet *ifp = &sc->sc_ac.ac_if;
struct mbuf_list ml = MBUF_LIST_INITIALIZER();
@@ -1237,26 +1250,26 @@ hvn_rndis_filter(struct hvn_softc *sc, uint64_t tid, void *arg)
len = cp->cp_range[i].gpa_len;
KASSERT(off + len <= sc->sc_rx_size);
- KASSERT(len >= RNDIS_HEADER_SIZE + 4);
+ KASSERT(len >= RNDIS_HEADER_OFFSET + 4);
memcpy(&type, (caddr_t)sc->sc_rx_ring + off, sizeof(type));
switch (type) {
/* data message */
- case RNDIS_PACKET_MSG:
- hvn_rndis_input(sc, (caddr_t)sc->sc_rx_ring +
+ case REMOTE_NDIS_PACKET_MSG:
+ hvn_rxeof(sc, (caddr_t)sc->sc_rx_ring +
off, len, &ml);
break;
/* completion messages */
- case RNDIS_INITIALIZE_CMPLT:
- case RNDIS_QUERY_CMPLT:
- case RNDIS_SET_CMPLT:
- case RNDIS_RESET_CMPLT:
- case RNDIS_KEEPALIVE_CMPLT:
+ case REMOTE_NDIS_INITIALIZE_CMPLT:
+ case REMOTE_NDIS_QUERY_CMPLT:
+ case REMOTE_NDIS_SET_CMPLT:
+ case REMOTE_NDIS_RESET_CMPLT:
+ case REMOTE_NDIS_KEEPALIVE_CMPLT:
hvn_rndis_complete(sc, (caddr_t)sc->sc_rx_ring +
off, len);
break;
/* notification message */
- case RNDIS_INDICATE_STATUS_MSG:
+ case REMOTE_NDIS_INDICATE_STATUS_MSG:
hvn_rndis_status(sc, (caddr_t)sc->sc_rx_ring +
off, len);
break;
@@ -1294,12 +1307,12 @@ hvn_devget(struct hvn_softc *sc, caddr_t buf, uint32_t len)
}
void
-hvn_rndis_input(struct hvn_softc *sc, caddr_t buf, uint32_t len,
+hvn_rxeof(struct hvn_softc *sc, caddr_t buf, uint32_t len,
struct mbuf_list *ml)
{
struct ifnet *ifp = &sc->sc_ac.ac_if;
- struct rndis_pkt *pkt;
- struct rndis_pkt_info *ppi;
+ struct rndis_packet_msg *pkt;
+ struct rndis_pktinfo *pi;
struct rndis_tcp_ip_csum_info *csum;
struct ndis_8021q_info *vlan;
struct mbuf *m;
@@ -1307,45 +1320,45 @@ hvn_rndis_input(struct hvn_softc *sc, caddr_t buf, uint32_t len,
if (!(ifp->if_flags & IFF_RUNNING))
return;
- if (len < RNDIS_HEADER_SIZE + sizeof(*pkt)) {
+ if (len < RNDIS_HEADER_OFFSET + sizeof(*pkt)) {
printf("%s: data packet too short: %u\n",
sc->sc_dev.dv_xname, len);
return;
}
- pkt = (struct rndis_pkt *)(buf + RNDIS_HEADER_SIZE);
+ pkt = (struct rndis_packet_msg *)buf;
- if (pkt->data_offset + pkt->data_length > len) {
+ if (pkt->rm_dataoffset + pkt->rm_datalen > len) {
printf("%s: data packet out of bounds: %u@%u\n",
- sc->sc_dev.dv_xname, pkt->data_offset, pkt->data_length);
+ sc->sc_dev.dv_xname, pkt->rm_dataoffset, pkt->rm_datalen);
return;
}
- if ((m = hvn_devget(sc, buf + RNDIS_HEADER_SIZE + pkt->data_offset,
- pkt->data_length)) == NULL) {
+ if ((m = hvn_devget(sc, buf + RNDIS_HEADER_OFFSET + pkt->rm_dataoffset,
+ pkt->rm_datalen)) == NULL) {
ifp->if_ierrors++;
return;
}
- while (pkt->pkt_info_length > 0) {
- if (pkt->pkt_info_offset + pkt->pkt_info_length > len) {
- printf("%s: PPI out of bounds: %u@%u\n",
- sc->sc_dev.dv_xname, pkt->pkt_info_length,
- pkt->pkt_info_offset);
+ pi = (struct rndis_pktinfo *)((caddr_t)pkt + RNDIS_HEADER_OFFSET +
+ pkt->rm_pktinfooffset);
+ while (pkt->rm_pktinfolen > 0) {
+ if (pkt->rm_pktinfooffset + pkt->rm_pktinfolen > len) {
+ printf("%s: PI out of bounds: %u@%u\n",
+ sc->sc_dev.dv_xname, pkt->rm_pktinfolen,
+ pkt->rm_pktinfooffset);
break;
}
- ppi = (struct rndis_pkt_info *)((caddr_t)pkt +
- pkt->pkt_info_offset);
- if (ppi->size > pkt->pkt_info_length) {
- printf("%s: invalid PPI size: %u/%u\n",
- sc->sc_dev.dv_xname, ppi->size,
- pkt->pkt_info_length);
+ if (pi->rm_size > pkt->rm_pktinfolen) {
+ printf("%s: invalid PI size: %u/%u\n",
+ sc->sc_dev.dv_xname, pi->rm_size,
+ pkt->rm_pktinfolen);
break;
}
- switch (ppi->type) {
- case tcpip_chksum_info:
+ switch (pi->rm_type) {
+ case NDIS_PKTINFO_TYPE_CSUM:
csum = (struct rndis_tcp_ip_csum_info *)
- ((caddr_t)ppi + ppi->size);
+ ((caddr_t)pi + pi->rm_size);
if (csum->recv.ip_csum_succeeded)
m->m_pkthdr.csum_flags |= M_IPV4_CSUM_IN_OK;
if (csum->recv.tcp_csum_succeeded)
@@ -1353,19 +1366,20 @@ hvn_rndis_input(struct hvn_softc *sc, caddr_t buf, uint32_t len,
if (csum->recv.udp_csum_succeeded)
m->m_pkthdr.csum_flags |= M_UDP_CSUM_IN_OK;
break;
- case ieee_8021q_info:
+ case NDIS_PKTINFO_TYPE_VLAN:
vlan = (struct ndis_8021q_info *)
- ((caddr_t)ppi + ppi->size);
+ ((caddr_t)pi + pi->rm_size);
#if NVLAN > 0
m->m_pkthdr.ether_vtag = vlan->vlan_id;
m->m_flags |= M_VLANTAG;
#endif
break;
default:
- DPRINTF("%s: unhandled PPI %u\n", sc->sc_dev.dv_xname,
- ppi->type);
+ DPRINTF("%s: unhandled PI %u\n", sc->sc_dev.dv_xname,
+ pi->rm_type);
}
- pkt->pkt_info_length -= ppi->size;
+ pkt->rm_pktinfolen -= pi->rm_size;
+ pi = (struct rndis_pktinfo *)((caddr_t)pi + pi->rm_size);
}
ml_enqueue(ml, m);
@@ -1377,7 +1391,7 @@ hvn_rndis_complete(struct hvn_softc *sc, caddr_t buf, uint32_t len)
struct rndis_cmd *rc;
uint32_t id;
- memcpy(&id, buf + RNDIS_HEADER_SIZE, sizeof(id));
+ memcpy(&id, buf + RNDIS_HEADER_OFFSET, sizeof(id));
if ((rc = hvn_complete_cmd(sc, id)) != NULL) {
if (len < rc->rc_cmplen)
printf("%s: RNDIS response %u too short: %u\n",
@@ -1423,7 +1437,7 @@ hvn_rndis_status(struct hvn_softc *sc, caddr_t buf, uint32_t len)
{
uint32_t sta;
- memcpy(&sta, buf + RNDIS_HEADER_SIZE, sizeof(sta));
+ memcpy(&sta, buf + RNDIS_HEADER_OFFSET, sizeof(sta));
switch (sta) {
case RNDIS_STATUS_MEDIA_CONNECT:
sc->sc_link_state = LINK_STATE_UP;
@@ -1457,14 +1471,16 @@ hvn_rndis_query(struct hvn_softc *sc, uint32_t oid, void *res, size_t *length)
bus_dmamap_sync(sc->sc_dmat, rc->rc_dmap, 0, PAGE_SIZE,
BUS_DMASYNC_PREREAD);
- rc->rc_req->msg_type = RNDIS_QUERY_MSG;
- rc->rc_req->msg_len = RNDIS_MESSAGE_SIZE(*req);
- rc->rc_cmplen = RNDIS_MESSAGE_SIZE(*cmp);
rc->rc_id = atomic_inc_int_nv(&sc->sc_rndisrid);
- req = (struct rndis_query_req *)&rc->rc_req->msg;
- req->request_id = rc->rc_id;
- req->oid = oid;
- req->info_buffer_offset = sizeof(*req);
+
+ req = rc->rc_req;
+ req->rm_type = REMOTE_NDIS_QUERY_MSG;
+ req->rm_len = sizeof(*req);
+ req->rm_rid = rc->rc_id;
+ req->rm_oid = oid;
+ req->rm_infobufoffset = sizeof(*req) - RNDIS_HEADER_OFFSET;
+
+ rc->rc_cmplen = sizeof(*cmp);
bus_dmamap_sync(sc->sc_dmat, rc->rc_dmap, 0, PAGE_SIZE,
BUS_DMASYNC_PREWRITE);
@@ -1476,15 +1492,15 @@ hvn_rndis_query(struct hvn_softc *sc, uint32_t oid, void *res, size_t *length)
return (rv);
}
- cmp = (struct rndis_query_comp *)&rc->rc_cmp.msg;
- switch (cmp->status) {
+ cmp = (struct rndis_query_comp *)&rc->rc_cmp;
+ switch (cmp->rm_status) {
case RNDIS_STATUS_SUCCESS:
- if (cmp->info_buffer_length > olength) {
+ if (cmp->rm_infobuflen > olength) {
rv = EINVAL;
break;
}
- memcpy(res, rc->rc_cmpbuf, cmp->info_buffer_length);
- *length = cmp->info_buffer_length;
+ memcpy(res, rc->rc_cmpbuf, cmp->rm_infobuflen);
+ *length = cmp->rm_infobuflen;
break;
default:
*length = 0;
@@ -1509,19 +1525,20 @@ hvn_rndis_set(struct hvn_softc *sc, uint32_t oid, void *data, size_t length)
bus_dmamap_sync(sc->sc_dmat, rc->rc_dmap, 0, PAGE_SIZE,
BUS_DMASYNC_PREREAD);
- rc->rc_req->msg_type = RNDIS_SET_MSG;
- rc->rc_req->msg_len = RNDIS_MESSAGE_SIZE(*req) + length;
- rc->rc_cmplen = RNDIS_MESSAGE_SIZE(*cmp);
rc->rc_id = atomic_inc_int_nv(&sc->sc_rndisrid);
- req = (struct rndis_set_req *)&rc->rc_req->msg;
- memset(req, 0, sizeof(*req));
- req->request_id = rc->rc_id;
- req->oid = oid;
- req->info_buffer_offset = sizeof(*req);
+
+ req = rc->rc_req;
+ req->rm_type = REMOTE_NDIS_SET_MSG;
+ req->rm_len = sizeof(*req) + length;
+ req->rm_rid = rc->rc_id;
+ req->rm_oid = oid;
+ req->rm_infobufoffset = sizeof(*req) - RNDIS_HEADER_OFFSET;
+
+ rc->rc_cmplen = sizeof(*cmp);
if (length > 0) {
- KASSERT(sizeof(*req) + length < sizeof(struct rndis));
- req->info_buffer_length = length;
+ KASSERT(sizeof(*req) + length < PAGE_SIZE);
+ req->rm_infobuflen = length;
memcpy((caddr_t)(req + 1), data, length);
}
@@ -1535,8 +1552,8 @@ hvn_rndis_set(struct hvn_softc *sc, uint32_t oid, void *data, size_t length)
return (rv);
}
- cmp = (struct rndis_set_comp *)&rc->rc_cmp.msg;
- if (cmp->status != RNDIS_STATUS_SUCCESS)
+ cmp = (struct rndis_set_comp *)&rc->rc_cmp;
+ if (cmp->rm_status != RNDIS_STATUS_SUCCESS)
rv = EIO;
hvn_free_cmd(sc, rc);
@@ -1557,7 +1574,7 @@ hvn_rndis_open(struct hvn_softc *sc)
NDIS_PACKET_TYPE_ALL_MULTICAST |
NDIS_PACKET_TYPE_DIRECTED;
- rv = hvn_rndis_set(sc, RNDIS_OID_GEN_CURRENT_PACKET_FILTER,
+ rv = hvn_rndis_set(sc, OID_GEN_CURRENT_PACKET_FILTER,
&filter, sizeof(filter));
if (rv)
DPRINTF("%s: failed to set RNDIS filter to %#x\n",
@@ -1571,7 +1588,7 @@ hvn_rndis_close(struct hvn_softc *sc)
uint32_t filter = 0;
int rv;
- rv = hvn_rndis_set(sc, RNDIS_OID_GEN_CURRENT_PACKET_FILTER,
+ rv = hvn_rndis_set(sc, OID_GEN_CURRENT_PACKET_FILTER,
&filter, sizeof(filter));
if (rv)
DPRINTF("%s: failed to clear RNDIS filter\n",
@@ -1591,11 +1608,12 @@ hvn_rndis_detach(struct hvn_softc *sc)
bus_dmamap_sync(sc->sc_dmat, rc->rc_dmap, 0, PAGE_SIZE,
BUS_DMASYNC_PREREAD);
- rc->rc_req->msg_type = RNDIS_HALT_MSG;
- rc->rc_req->msg_len = RNDIS_MESSAGE_SIZE(*req);
rc->rc_id = atomic_inc_int_nv(&sc->sc_rndisrid);
- req = (struct rndis_halt_req *)&rc->rc_req->msg;
- req->request_id = rc->rc_id;
+
+ req = rc->rc_req;
+ req->rm_type = REMOTE_NDIS_HALT_MSG;
+ req->rm_len = sizeof(*req);
+ req->rm_rid = rc->rc_id;
bus_dmamap_sync(sc->sc_dmat, rc->rc_dmap, 0, PAGE_SIZE,
BUS_DMASYNC_PREWRITE);
diff --git a/sys/dev/pv/rndisreg.h b/sys/dev/pv/rndisreg.h
index da504d78c46..58e3de8c3b7 100644
--- a/sys/dev/pv/rndisreg.h
+++ b/sys/dev/pv/rndisreg.h
@@ -38,571 +38,8 @@
#define NDIS_VERSION_6_1 0x00060001
#define NDIS_VERSION_6_30 0x0006001e
-/*
- * Status codes
- */
-
-#define STATUS_SUCCESS 0x00000000
-#define STATUS_UNSUCCESSFUL 0xC0000001
-#define STATUS_PENDING 0x00000103
-#define STATUS_INSUFFICIENT_RESOURCES 0xC000009A
-#define STATUS_BUFFER_OVERFLOW 0x80000005
-#define STATUS_NOT_SUPPORTED 0xC00000BB
-
-#define RNDIS_STATUS_SUCCESS 0x00000000
-#define RNDIS_STATUS_PENDING 0x00000103
-#define RNDIS_STATUS_NOT_RECOGNIZED 0x00010001
-#define RNDIS_STATUS_NOT_COPIED 0x00010002
-#define RNDIS_STATUS_NOT_ACCEPTED 0x00010003
-#define RNDIS_STATUS_CALL_ACTIVE 0x00010007
-
-#define RNDIS_STATUS_ONLINE 0x40010003
-#define RNDIS_STATUS_RESET_START 0x40010004
-#define RNDIS_STATUS_RESET_END 0x40010005
-#define RNDIS_STATUS_RING_STATUS 0x40010006
-#define RNDIS_STATUS_CLOSED 0x40010007
-#define RNDIS_STATUS_WAN_LINE_UP 0x40010008
-#define RNDIS_STATUS_WAN_LINE_DOWN 0x40010009
-#define RNDIS_STATUS_WAN_FRAGMENT 0x4001000A
-#define RNDIS_STATUS_MEDIA_CONNECT 0x4001000B
-#define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000C
-#define RNDIS_STATUS_HARDWARE_LINE_UP 0x4001000D
-#define RNDIS_STATUS_HARDWARE_LINE_DOWN 0x4001000E
-#define RNDIS_STATUS_INTERFACE_UP 0x4001000F
-#define RNDIS_STATUS_INTERFACE_DOWN 0x40010010
-#define RNDIS_STATUS_MEDIA_BUSY 0x40010011
-#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION 0x40010012
-#define RNDIS_STATUS_WW_INDICATION 0x40010012
-#define RNDIS_STATUS_LINK_SPEED_CHANGE 0x40010013
-
#define RNDIS_STATUS_OFFLOAD_CURRENT_CONFIG 0x40020006
-#define RNDIS_STATUS_NOT_RESETTABLE 0x80010001
-#define RNDIS_STATUS_SOFT_ERRORS 0x80010003
-#define RNDIS_STATUS_HARD_ERRORS 0x80010004
-#define RNDIS_STATUS_BUFFER_OVERFLOW 0x80000005
-
-#define RNDIS_STATUS_FAILURE 0xC0000001
-#define RNDIS_STATUS_RESOURCES 0xC000009A
-#define RNDIS_STATUS_CLOSING 0xC0010002
-#define RNDIS_STATUS_BAD_VERSION 0xC0010004
-#define RNDIS_STATUS_BAD_CHARACTERISTICS 0xC0010005
-#define RNDIS_STATUS_ADAPTER_NOT_FOUND 0xC0010006
-#define RNDIS_STATUS_OPEN_FAILED 0xC0010007
-#define RNDIS_STATUS_DEVICE_FAILED 0xC0010008
-#define RNDIS_STATUS_MULTICAST_FULL 0xC0010009
-#define RNDIS_STATUS_MULTICAST_EXISTS 0xC001000A
-#define RNDIS_STATUS_MULTICAST_NOT_FOUND 0xC001000B
-#define RNDIS_STATUS_REQUEST_ABORTED 0xC001000C
-#define RNDIS_STATUS_RESET_IN_PROGRESS 0xC001000D
-#define RNDIS_STATUS_CLOSING_INDICATING 0xC001000E
-#define RNDIS_STATUS_NOT_SUPPORTED 0xC00000BB
-#define RNDIS_STATUS_INVALID_PACKET 0xC001000F
-#define RNDIS_STATUS_OPEN_LIST_FULL 0xC0010010
-#define RNDIS_STATUS_ADAPTER_NOT_READY 0xC0010011
-#define RNDIS_STATUS_ADAPTER_NOT_OPEN 0xC0010012
-#define RNDIS_STATUS_NOT_INDICATING 0xC0010013
-#define RNDIS_STATUS_INVALID_LENGTH 0xC0010014
-#define RNDIS_STATUS_INVALID_DATA 0xC0010015
-#define RNDIS_STATUS_BUFFER_TOO_SHORT 0xC0010016
-#define RNDIS_STATUS_INVALID_OID 0xC0010017
-#define RNDIS_STATUS_ADAPTER_REMOVED 0xC0010018
-#define RNDIS_STATUS_UNSUPPORTED_MEDIA 0xC0010019
-#define RNDIS_STATUS_GROUP_ADDRESS_IN_USE 0xC001001A
-#define RNDIS_STATUS_FILE_NOT_FOUND 0xC001001B
-#define RNDIS_STATUS_ERROR_READING_FILE 0xC001001C
-#define RNDIS_STATUS_ALREADY_MAPPED 0xC001001D
-#define RNDIS_STATUS_RESOURCE_CONFLICT 0xC001001E
-#define RNDIS_STATUS_NO_CABLE 0xC001001F
-
-#define RNDIS_STATUS_INVALID_SAP 0xC0010020
-#define RNDIS_STATUS_SAP_IN_USE 0xC0010021
-#define RNDIS_STATUS_INVALID_ADDRESS 0xC0010022
-#define RNDIS_STATUS_VC_NOT_ACTIVATED 0xC0010023
-#define RNDIS_STATUS_DEST_OUT_OF_ORDER 0xC0010024
-#define RNDIS_STATUS_VC_NOT_AVAILABLE 0xC0010025
-#define RNDIS_STATUS_CELLRATE_NOT_AVAILABLE 0xC0010026
-#define RNDIS_STATUS_INCOMPATABLE_QOS 0xC0010027
-#define RNDIS_STATUS_AAL_PARAMS_UNSUPPORTED 0xC0010028
-#define RNDIS_STATUS_NO_ROUTE_TO_DESTINATION 0xC0010029
-
-#define RNDIS_STATUS_TOKEN_RING_OPEN_ERROR 0xC0011000
-
-
-/*
- * Object Identifiers used by NdisRequest Query/Set Information
- */
-
-/*
- * General Objects
- */
-
-#define RNDIS_OID_GEN_SUPPORTED_LIST 0x00010101
-#define RNDIS_OID_GEN_HARDWARE_STATUS 0x00010102
-#define RNDIS_OID_GEN_MEDIA_SUPPORTED 0x00010103
-#define RNDIS_OID_GEN_MEDIA_IN_USE 0x00010104
-#define RNDIS_OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105
-#define RNDIS_OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106
-#define RNDIS_OID_GEN_LINK_SPEED 0x00010107
-#define RNDIS_OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108
-#define RNDIS_OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109
-#define RNDIS_OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A
-#define RNDIS_OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B
-#define RNDIS_OID_GEN_VENDOR_ID 0x0001010C
-#define RNDIS_OID_GEN_VENDOR_DESCRIPTION 0x0001010D
-#define RNDIS_OID_GEN_CURRENT_PACKET_FILTER 0x0001010E
-#define RNDIS_OID_GEN_CURRENT_LOOKAHEAD 0x0001010F
-#define RNDIS_OID_GEN_DRIVER_VERSION 0x00010110
-#define RNDIS_OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111
-#define RNDIS_OID_GEN_PROTOCOL_OPTIONS 0x00010112
-#define RNDIS_OID_GEN_MAC_OPTIONS 0x00010113
-#define RNDIS_OID_GEN_MEDIA_CONNECT_STATUS 0x00010114
-#define RNDIS_OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115
-#define RNDIS_OID_GEN_VENDOR_DRIVER_VERSION 0x00010116
-#define RNDIS_OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118
-#define RNDIS_OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119
-#define RNDIS_OID_GEN_MACHINE_NAME 0x0001021A
-#define RNDIS_OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B
-
-#define RNDIS_OID_GEN_XMIT_OK 0x00020101
-#define RNDIS_OID_GEN_RCV_OK 0x00020102
-#define RNDIS_OID_GEN_XMIT_ERROR 0x00020103
-#define RNDIS_OID_GEN_RCV_ERROR 0x00020104
-#define RNDIS_OID_GEN_RCV_NO_BUFFER 0x00020105
-
-#define RNDIS_OID_GEN_DIRECTED_BYTES_XMIT 0x00020201
-#define RNDIS_OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202
-#define RNDIS_OID_GEN_MULTICAST_BYTES_XMIT 0x00020203
-#define RNDIS_OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204
-#define RNDIS_OID_GEN_BROADCAST_BYTES_XMIT 0x00020205
-#define RNDIS_OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206
-#define RNDIS_OID_GEN_DIRECTED_BYTES_RCV 0x00020207
-#define RNDIS_OID_GEN_DIRECTED_FRAMES_RCV 0x00020208
-#define RNDIS_OID_GEN_MULTICAST_BYTES_RCV 0x00020209
-#define RNDIS_OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A
-#define RNDIS_OID_GEN_BROADCAST_BYTES_RCV 0x0002020B
-#define RNDIS_OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C
-
-#define RNDIS_OID_GEN_RCV_CRC_ERROR 0x0002020D
-#define RNDIS_OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E
-
-#define RNDIS_OID_GEN_GET_TIME_CAPS 0x0002020F
-#define RNDIS_OID_GEN_GET_NETCARD_TIME 0x00020210
-
-/*
- * These are connection-oriented general OIDs.
- * These replace the above OIDs for connection-oriented media.
- */
-#define RNDIS_OID_GEN_CO_SUPPORTED_LIST 0x00010101
-#define RNDIS_OID_GEN_CO_HARDWARE_STATUS 0x00010102
-#define RNDIS_OID_GEN_CO_MEDIA_SUPPORTED 0x00010103
-#define RNDIS_OID_GEN_CO_MEDIA_IN_USE 0x00010104
-#define RNDIS_OID_GEN_CO_LINK_SPEED 0x00010105
-#define RNDIS_OID_GEN_CO_VENDOR_ID 0x00010106
-#define RNDIS_OID_GEN_CO_VENDOR_DESCRIPTION 0x00010107
-#define RNDIS_OID_GEN_CO_DRIVER_VERSION 0x00010108
-#define RNDIS_OID_GEN_CO_PROTOCOL_OPTIONS 0x00010109
-#define RNDIS_OID_GEN_CO_MAC_OPTIONS 0x0001010A
-#define RNDIS_OID_GEN_CO_MEDIA_CONNECT_STATUS 0x0001010B
-#define RNDIS_OID_GEN_CO_VENDOR_DRIVER_VERSION 0x0001010C
-#define RNDIS_OID_GEN_CO_MINIMUM_LINK_SPEED 0x0001010D
-
-#define RNDIS_OID_GEN_CO_GET_TIME_CAPS 0x00010201
-#define RNDIS_OID_GEN_CO_GET_NETCARD_TIME 0x00010202
-
-/*
- * These are connection-oriented statistics OIDs.
- */
-#define RNDIS_OID_GEN_CO_XMIT_PDUS_OK 0x00020101
-#define RNDIS_OID_GEN_CO_RCV_PDUS_OK 0x00020102
-#define RNDIS_OID_GEN_CO_XMIT_PDUS_ERROR 0x00020103
-#define RNDIS_OID_GEN_CO_RCV_PDUS_ERROR 0x00020104
-#define RNDIS_OID_GEN_CO_RCV_PDUS_NO_BUFFER 0x00020105
-
-
-#define RNDIS_OID_GEN_CO_RCV_CRC_ERROR 0x00020201
-#define RNDIS_OID_GEN_CO_TRANSMIT_QUEUE_LENGTH 0x00020202
-#define RNDIS_OID_GEN_CO_BYTES_XMIT 0x00020203
-#define RNDIS_OID_GEN_CO_BYTES_RCV 0x00020204
-#define RNDIS_OID_GEN_CO_BYTES_XMIT_OUTSTANDING 0x00020205
-#define RNDIS_OID_GEN_CO_NETCARD_LOAD 0x00020206
-
-/*
- * These are objects for Connection-oriented media call-managers.
- */
-#define RNDIS_OID_CO_ADD_PVC 0xFF000001
-#define RNDIS_OID_CO_DELETE_PVC 0xFF000002
-#define RNDIS_OID_CO_GET_CALL_INFORMATION 0xFF000003
-#define RNDIS_OID_CO_ADD_ADDRESS 0xFF000004
-#define RNDIS_OID_CO_DELETE_ADDRESS 0xFF000005
-#define RNDIS_OID_CO_GET_ADDRESSES 0xFF000006
-#define RNDIS_OID_CO_ADDRESS_CHANGE 0xFF000007
-#define RNDIS_OID_CO_SIGNALING_ENABLED 0xFF000008
-#define RNDIS_OID_CO_SIGNALING_DISABLED 0xFF000009
-
-
-/*
- * 802.3 Objects (Ethernet)
- */
-
-#define RNDIS_OID_802_3_PERMANENT_ADDRESS 0x01010101
-#define RNDIS_OID_802_3_CURRENT_ADDRESS 0x01010102
-#define RNDIS_OID_802_3_MULTICAST_LIST 0x01010103
-#define RNDIS_OID_802_3_MAXIMUM_LIST_SIZE 0x01010104
-#define RNDIS_OID_802_3_MAC_OPTIONS 0x01010105
-
-/*
- *
- */
-#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001
-
-#define RNDIS_OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101
-#define RNDIS_OID_802_3_XMIT_ONE_COLLISION 0x01020102
-#define RNDIS_OID_802_3_XMIT_MORE_COLLISIONS 0x01020103
-
-#define RNDIS_OID_802_3_XMIT_DEFERRED 0x01020201
-#define RNDIS_OID_802_3_XMIT_MAX_COLLISIONS 0x01020202
-#define RNDIS_OID_802_3_RCV_OVERRUN 0x01020203
-#define RNDIS_OID_802_3_XMIT_UNDERRUN 0x01020204
-#define RNDIS_OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205
-#define RNDIS_OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206
-#define RNDIS_OID_802_3_XMIT_LATE_COLLISIONS 0x01020207
-
-
-/*
- * RNDIS MP custom OID for test
- */
-#define OID_RNDISMP_GET_RECEIVE_BUFFERS 0xFFA0C90D
-
-
-/*
- * Remote NDIS message types
- */
-#define RNDIS_PACKET_MSG 0x00000001
-#define RNDIS_INITIALIZE_MSG 0x00000002
-#define RNDIS_HALT_MSG 0x00000003
-#define RNDIS_QUERY_MSG 0x00000004
-#define RNDIS_SET_MSG 0x00000005
-#define RNDIS_RESET_MSG 0x00000006
-#define RNDIS_INDICATE_STATUS_MSG 0x00000007
-#define RNDIS_KEEPALIVE_MSG 0x00000008
-
-#define RCONDIS_MP_CREATE_VC_MSG 0x00008001
-#define RCONDIS_MP_DELETE_VC_MSG 0x00008002
-#define RCONDIS_MP_ACTIVATE_VC_MSG 0x00008005
-#define RCONDIS_MP_DEACTIVATE_VC_MSG 0x00008006
-#define RCONDIS_INDICATE_STATUS_MSG 0x00008007
-
-/*
- * Remote NDIS message completion types
- */
-#define RNDIS_INITIALIZE_CMPLT 0x80000002
-#define RNDIS_QUERY_CMPLT 0x80000004
-#define RNDIS_SET_CMPLT 0x80000005
-#define RNDIS_RESET_CMPLT 0x80000006
-#define RNDIS_KEEPALIVE_CMPLT 0x80000008
-
-#define RCONDIS_MP_CREATE_VC_CMPLT 0x80008001
-#define RCONDIS_MP_DELETE_VC_CMPLT 0x80008002
-#define RCONDIS_MP_ACTIVATE_VC_CMPLT 0x80008005
-#define RCONDIS_MP_DEACTIVATE_VC_CMPLT 0x80008006
-
-/*
- * Reserved message type for private communication between
- * lower-layer host driver and remote device, if necessary.
- */
-#define RNDIS_BUS_MSG 0xff000001
-
-/*
- * Defines for DeviceFlags in rndis_initialize_comp
- */
-#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
- */
-#define RNDIS_OBJECT_TYPE_DEFAULT 0x80
-
-#define RNDIS_OFFLOAD_PARAMS_REVISION_3 3
-#define RNDIS_OFFLOAD_PARAMS_NO_CHANGE 0
-#define RNDIS_OFFLOAD_PARAMS_LSOV2_DISABLED 1
-#define RNDIS_OFFLOAD_PARAMS_LSOV2_ENABLED 2
-#define RNDIS_OFFLOAD_PARAMS_LSOV1_ENABLED 2
-#define RNDIS_OFFLOAD_PARAMS_RSC_DISABLED 1
-#define RNDIS_OFFLOAD_PARAMS_RSC_ENABLED 2
-#define RNDIS_OFFLOAD_PARAMS_TX_RX_DISABLED 1
-#define RNDIS_OFFLOAD_PARAMS_TX_ENABLED_RX_DISABLED 2
-#define RNDIS_OFFLOAD_PARAMS_RX_ENABLED_TX_DISABLED 3
-#define RNDIS_OFFLOAD_PARAMS_TX_RX_ENABLED 4
-
-#define RNDIS_TCP_LARGE_SEND_OFFLOAD_V2_TYPE 1
-#define RNDIS_TCP_LARGE_SEND_OFFLOAD_IPV4 0
-#define RNDIS_TCP_LARGE_SEND_OFFLOAD_IPV6 1
-
-#define RNDIS_OID_TCP_OFFLOAD_CURRENT_CONFIG 0xFC01020B /* query only */
-#define RNDIS_OID_TCP_OFFLOAD_PARAMS 0xFC01020C /* set only */
-#define RNDIS_OID_TCP_OFFLOAD_HARDWARE_CAPS 0xFC01020D/* query only */
-#define RNDIS_OID_TCPCON_OFFLOAD_CURRENT_CONFIG 0xFC01020E /* query only */
-#define RNDIS_OID_TCPCON_OFFLOAD_HARDWARE_CAPS 0xFC01020F /* query */
-#define RNDIS_OID_OFFLOAD_ENCAPSULATION 0x0101010A /* set/query */
-
-/*
- * NdisInitialize message
- */
-struct rndis_init_req {
- /* RNDIS request ID */
- uint32_t request_id;
- uint32_t major_version;
- uint32_t minor_version;
- uint32_t max_xfer_size;
-};
-
-/*
- * Response to NdisInitialize
- */
-struct rndis_init_comp {
- /* RNDIS request ID */
- uint32_t request_id;
- /* RNDIS status */
- uint32_t status;
- uint32_t major_version;
- uint32_t minor_version;
- uint32_t device_flags;
- /* RNDIS medium */
- uint32_t medium;
- uint32_t max_pkts_per_msg;
- uint32_t max_xfer_size;
- uint32_t pkt_align_factor;
- uint32_t af_list_offset;
- uint32_t af_list_size;
-};
-
-/*
- * Call manager devices only: Information about an address family
- * supported by the device is appended to the response to NdisInitialize.
- */
-struct rndis_co_address_family {
- /* RNDIS AF */
- uint32_t address_family;
- uint32_t major_version;
- uint32_t minor_version;
-};
-
-/*
- * NdisHalt message
- */
-struct rndis_halt_req {
- /* RNDIS request ID */
- uint32_t request_id;
-};
-
-/*
- * NdisQueryRequest message
- */
-struct rndis_query_req {
- /* RNDIS request ID */
- uint32_t request_id;
- /* RNDIS OID */
- uint32_t oid;
- uint32_t info_buffer_length;
- uint32_t info_buffer_offset;
- /* RNDIS handle */
- uint32_t device_vc_handle;
-};
-
-/*
- * Response to NdisQueryRequest
- */
-struct rndis_query_comp {
- /* RNDIS request ID */
- uint32_t request_id;
- /* RNDIS status */
- uint32_t status;
- uint32_t info_buffer_length;
- uint32_t info_buffer_offset;
-};
-
-/*
- * NdisSetRequest message
- */
-struct rndis_set_req {
- /* RNDIS request ID */
- uint32_t request_id;
- /* RNDIS OID */
- uint32_t oid;
- uint32_t info_buffer_length;
- uint32_t info_buffer_offset;
- /* RNDIS handle */
- uint32_t device_vc_handle;
-};
-
-/*
- * Response to NdisSetRequest
- */
-struct rndis_set_comp {
- /* RNDIS request ID */
- uint32_t request_id;
- /* RNDIS status */
- uint32_t status;
-};
-
-/*
- * NdisReset message
- */
-struct rndis_reset_req {
- uint32_t reserved;
-};
-
-/*
- * Response to NdisReset
- */
-struct rndis_reset_comp {
- /* RNDIS status */
- uint32_t status;
- uint32_t addressing_reset;
-};
-
-/*
- * NdisMIndicateStatus message
- */
-struct rndis_indicate_status {
- /* RNDIS status */
- uint32_t status;
- uint32_t status_buf_length;
- uint32_t status_buf_offset;
-};
-
-/*
- * Diagnostic information passed as the status buffer in
- * rndis_indicate_status messages signifying error conditions.
- */
-struct rndis_diagnostic_info {
- /* RNDIS status */
- uint32_t diag_status;
- uint32_t error_offset;
-};
-
-/*
- * NdisKeepAlive message
- */
-struct rndis_keepalive_req {
- /* RNDIS request ID */
- uint32_t request_id;
-};
-
-/*
- * Response to NdisKeepAlive
- */
-struct rndis_keepalive_comp {
- /* RNDIS request ID */
- uint32_t request_id;
- /* RNDIS status */
- uint32_t status;
-};
-
-/*
- * Data message. All offset fields contain byte offsets from the
- * beginning of the rndis_pkt structure. All length fields are in
- * bytes. VcHandle is set to 0 for connectionless data, otherwise
- * it contains the VC handle.
- */
-struct rndis_pkt {
- uint32_t data_offset;
- uint32_t data_length;
- uint32_t oob_data_offset;
- uint32_t oob_data_length;
- uint32_t num_oob_data_elements;
- uint32_t pkt_info_offset;
- uint32_t pkt_info_length;
- /* RNDIS handle */
- uint32_t vc_handle;
- uint32_t reserved;
-};
-
-struct rndis_pkt_ex {
- uint32_t data_offset;
- uint32_t data_length;
- uint32_t oob_data_offset;
- uint32_t oob_data_length;
- uint32_t num_oob_data_elements;
- uint32_t pkt_info_offset;
- uint32_t pkt_info_length;
- /* RNDIS handle */
- uint32_t vc_handle;
- uint32_t reserved;
- uint64_t data_buf_id;
- uint32_t data_buf_offset;
- uint64_t next_header_buf_id;
- uint32_t next_header_byte_offset;
- uint32_t next_header_byte_count;
-};
-
-/*
- * Optional Out of Band data associated with a Data message.
- */
-struct rndis_oobd {
- uint32_t size;
- /* RNDIS class ID */
- uint32_t type;
- uint32_t class_info_offset;
-};
-
-/*
- * Packet extension field contents associated with a Data message.
- */
-struct rndis_pkt_info {
- uint32_t size;
- uint32_t type;
- uint32_t pkt_info_offset;
-};
-
-enum ndis_pkt_info_type {
- tcpip_chksum_info,
- ipsec_info,
- tcp_large_send_info,
- classification_handle_info,
- ndis_reserved,
- sgl_info,
- ieee_8021q_info,
- original_pkt_info,
- pkt_cancel_id,
- original_netbuf_list,
- cached_netbuf_list,
- short_pkt_padding_info,
- max_perpkt_info
-};
-
struct ndis_8021q_info {
union {
struct {
@@ -706,269 +143,13 @@ struct rndis_tcp_tso_info {
};
};
-#define RNDIS_VLAN_PPI_SIZE (sizeof(struct rndis_pkt_info) + \
+#define RNDIS_VLAN_PPI_SIZE (sizeof(struct rndis_pktinfo) + \
sizeof(struct ndis_8021q_info))
-#define RNDIS_CSUM_PPI_SIZE (sizeof(struct rndis_pkt_info) + \
+#define RNDIS_CSUM_PPI_SIZE (sizeof(struct rndis_pktinfo) + \
sizeof(struct rndis_tcp_ip_csum_info))
-#define RNDIS_TSO_PPI_SIZE (sizeof(struct rndis_pkt_info) + \
+#define RNDIS_TSO_PPI_SIZE (sizeof(struct rndis_pktinfo) + \
sizeof(struct rndis_tcp_tso_info))
-/*
- * Format of Information buffer passed in a SetRequest for the OID
- * OID_GEN_RNDIS_CONFIG_PARAMETER.
- */
-struct rndis_config_param_info {
- uint32_t name_offset;
- uint32_t name_length;
- uint32_t param_type;
- uint32_t value_offset;
- uint32_t value_length;
-};
-
-/*
- * Values for ParameterType in rndis_config_param_info
- */
-#define RNDIS_CONFIG_PARAM_TYPE_INTEGER 0
-#define RNDIS_CONFIG_PARAM_TYPE_STRING 2
-
-
-/*
- * CONDIS Miniport messages for connection oriented devices
- * that do not implement a call manager.
- */
-
-/*
- * CoNdisMiniportCreateVc message
- */
-struct rcondis_mp_create_vc {
- /* RNDIS request ID */
- uint32_t request_id;
- /* RNDIS handle */
- uint32_t ndis_vc_handle;
-};
-
-/*
- * Response to CoNdisMiniportCreateVc
- */
-struct rcondis_mp_create_vc_comp {
- /* RNDIS request ID */
- uint32_t request_id;
- /* RNDIS handle */
- uint32_t device_vc_handle;
- /* RNDIS status */
- uint32_t status;
-};
-
-/*
- * CoNdisMiniportDeleteVc message
- */
-struct rcondis_mp_delete_vc {
- /* RNDIS request ID */
- uint32_t request_id;
- /* RNDIS handle */
- uint32_t device_vc_handle;
-};
-
-/*
- * Response to CoNdisMiniportDeleteVc
- */
-struct rcondis_mp_delete_vc_comp {
- /* RNDIS request ID */
- uint32_t request_id;
- /* RNDIS status */
- uint32_t status;
-};
-
-/*
- * CoNdisMiniportQueryRequest message
- */
-struct rcondis_mp_query_req {
- /* RNDIS request ID */
- uint32_t request_id;
- /* RNDIS request type */
- uint32_t request_type;
- /* RNDIS OID */
- uint32_t oid;
- /* RNDIS handle */
- uint32_t device_vc_handle;
- uint32_t info_buf_length;
- uint32_t info_buf_offset;
-};
-
-/*
- * CoNdisMiniportSetRequest message
- */
-struct rcondis_mp_set_req {
- /* RNDIS request ID */
- uint32_t request_id;
- /* RNDIS request type */
- uint32_t request_type;
- /* RNDIS OID */
- uint32_t oid;
- /* RNDIS handle */
- uint32_t device_vc_handle;
- uint32_t info_buf_length;
- uint32_t info_buf_offset;
-};
-
-/*
- * CoNdisIndicateStatus message
- */
-struct rcondis_indicate_status {
- /* RNDIS handle */
- uint32_t ndis_vc_handle;
- /* RNDIS status */
- uint32_t status;
- uint32_t status_buf_length;
- uint32_t status_buf_offset;
-};
-
-/*
- * CONDIS Call/VC parameters
- */
-
-struct rcondis_specific_params {
- uint32_t type;
- uint32_t length;
- uint32_t offset;
-};
-
-struct rcondis_media_params {
- uint32_t flags;
- uint32_t reserved1;
- uint32_t reserved2;
- struct rcondis_specific_params media_specific;
-};
-
-struct rndis_flowspec {
- uint32_t token_rate;
- uint32_t token_bucket_size;
- uint32_t peak_bandwidth;
- uint32_t latency;
- uint32_t delay_variation;
- uint32_t service_type;
- uint32_t max_sdu_size;
- uint32_t minimum_policed_size;
-};
-
-struct rcondis_call_manager_params {
- struct rndis_flowspec transmit;
- struct rndis_flowspec receive;
- struct rcondis_specific_params call_mgr_specific;
-};
-
-/*
- * CoNdisMiniportActivateVc message
- */
-struct rcondis_mp_activate_vc_req {
- /* RNDIS request ID */
- uint32_t request_id;
- uint32_t flags;
- /* RNDIS handle */
- uint32_t device_vc_handle;
- uint32_t media_params_offset;
- uint32_t media_params_length;
- uint32_t call_mgr_params_offset;
- uint32_t call_mgr_params_length;
-};
-
-/*
- * Response to CoNdisMiniportActivateVc
- */
-struct rcondis_mp_activate_vc_comp {
- /* RNDIS request ID */
- uint32_t request_id;
- /* RNDIS status */
- uint32_t status;
-};
-
-/*
- * CoNdisMiniportDeactivateVc message
- */
-struct rcondis_mp_deactivate_vc_req {
- /* RNDIS request ID */
- uint32_t request_id;
- uint32_t flags;
- /* RNDIS handle */
- uint32_t device_vc_handle;
-};
-
-/*
- * Response to CoNdisMiniportDeactivateVc
- */
-struct rcondis_mp_deactivate_vc_comp {
- /* RNDIS request ID */
- uint32_t request_id;
- /* RNDIS status */
- uint32_t status;
-};
-
-/*
- * Container with all of the RNDIS messages
- */
-union rndis_msg_cont {
- struct rndis_pkt pkt;
- struct rndis_init_req init_req;
- struct rndis_halt_req halt_req;
- struct rndis_query_req query_req;
- struct rndis_set_req set_req;
- struct rndis_reset_req reset_req;
- struct rndis_keepalive_req keepalive_req;
- struct rndis_indicate_status indicate_status;
- struct rndis_init_comp init_comp;
- struct rndis_query_comp query_comp;
- struct rndis_set_comp set_comp;
- struct rndis_reset_comp reset_comp;
- struct rndis_keepalive_comp keepalive_comp;
- struct rcondis_mp_create_vc co_mp_create_vc;
- struct rcondis_mp_delete_vc co_mp_delete_vc;
- struct rcondis_indicate_status co_mp_status;
- struct rcondis_mp_activate_vc_req co_mp_activate_vc;
- struct rcondis_mp_deactivate_vc_req co_mp_deactivate_vc;
- struct rcondis_mp_create_vc_comp co_mp_create_vc_comp;
- struct rcondis_mp_delete_vc_comp co_mp_delete_vc_comp;
- struct rcondis_mp_activate_vc_comp co_mp_activate_vc_comp;
- struct rcondis_mp_deactivate_vc_comp co_mp_deactivate_vc_comp;
- struct rndis_pkt_ex pkt_ex;
-};
-
-/*
- * Remote NDIS message format
- */
-struct rndis {
- uint32_t msg_type;
-
- /*
- * Total length of this message, from the beginning
- * of the struct, in bytes.
- */
- uint32_t msg_len;
-
- /* Actual message */
- union rndis_msg_cont msg;
-};
-
-/*
- * get the size of an RNDIS message. Pass in the message type,
- * rndis_set_req, rndis_packet for example
- */
-#define RNDIS_HEADER_SIZE 8
-#define RNDIS_MESSAGE_SIZE(message) \
- (sizeof(message) + RNDIS_HEADER_SIZE)
-
-#define NDIS_PACKET_TYPE_DIRECTED 0x00000001
-#define NDIS_PACKET_TYPE_MULTICAST 0x00000002
-#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
-#define NDIS_PACKET_TYPE_BROADCAST 0x00000008
-#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
-#define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
-#define NDIS_PACKET_TYPE_SMT 0x00000040
-#define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
-#define NDIS_PACKET_TYPE_GROUP 0x00000100
-#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00000200
-#define NDIS_PACKET_TYPE_FUNCTIONAL 0x00000400
-#define NDIS_PACKET_TYPE_MAC_FRAME 0x00000800
-
#endif /* _DEV_PV_RNDISREG_H_ */