Index: head/sys/dev/hyperv/netvsc/hv_net_vsc.c =================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c @@ -63,7 +63,8 @@ static void hv_nv_on_send_completion(netvsc_dev *net_dev, struct hv_device *device, hv_vm_packet_descriptor *pkt); static void hv_nv_on_receive(netvsc_dev *net_dev, - struct hv_device *device, hv_vm_packet_descriptor *pkt); + struct hv_device *device, struct hv_vmbus_channel *chan, + hv_vm_packet_descriptor *pkt); /* * @@ -865,7 +866,7 @@ */ static void hv_nv_on_receive(netvsc_dev *net_dev, struct hv_device *device, - hv_vm_packet_descriptor *pkt) + struct hv_vmbus_channel *chan, hv_vm_packet_descriptor *pkt) { hv_vm_transfer_page_packet_header *vm_xfer_page_pkt; nvsp_msg *nvsp_msg_pkt; @@ -915,7 +916,7 @@ net_vsc_pkt->tot_data_buf_len = vm_xfer_page_pkt->ranges[i].byte_count; - hv_rf_on_receive(net_dev, device, net_vsc_pkt); + hv_rf_on_receive(net_dev, device, chan, net_vsc_pkt); if (net_vsc_pkt->status != nvsp_status_success) { status = nvsp_status_failure; } @@ -928,7 +929,6 @@ */ hv_nv_on_receive_completion(device, vm_xfer_page_pkt->d.transaction_id, status); - hv_rf_receive_rollup(net_dev); } /* @@ -1002,7 +1002,7 @@ hv_nv_on_send_completion(net_dev, device, desc); break; case HV_VMBUS_PACKET_TYPE_DATA_USING_TRANSFER_PAGES: - hv_nv_on_receive(net_dev, device, desc); + hv_nv_on_receive(net_dev, device, chan, desc); break; default: device_printf(dev, @@ -1036,5 +1036,5 @@ if (bufferlen > NETVSC_PACKET_SIZE) free(buffer, M_NETVSC); - hv_rf_channel_rollup(net_dev); + hv_rf_channel_rollup(chan); } Index: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c =================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c @@ -684,8 +684,9 @@ } void -netvsc_channel_rollup(struct hv_device *device_ctx) +netvsc_channel_rollup(struct hv_vmbus_channel *chan) { + struct hv_device *device_ctx = chan->device; struct hn_softc *sc = device_get_softc(device_ctx->device); struct hn_tx_ring *txr = &sc->hn_tx_ring[0]; /* TODO: vRSS */ #if defined(INET) || defined(INET6) @@ -1135,9 +1136,10 @@ * Note: This is no longer used as a callback */ int -netvsc_recv(struct hv_device *device_ctx, netvsc_packet *packet, +netvsc_recv(struct hv_vmbus_channel *chan, netvsc_packet *packet, rndis_tcp_ip_csum_info *csum_info) { + struct hv_device *device_ctx = chan->device; struct hn_softc *sc = device_get_softc(device_ctx->device); struct hn_rx_ring *rxr = &sc->hn_rx_ring[0]; /* TODO: vRSS */ struct mbuf *m_new; @@ -1305,11 +1307,6 @@ return (0); } -void -netvsc_recv_rollup(struct hv_device *device_ctx __unused) -{ -} - /* * Rules for using sc->temp_unusable: * 1. sc->temp_unusable can only be read or written while holding NV_LOCK() Index: head/sys/dev/hyperv/netvsc/hv_rndis.h =================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis.h +++ head/sys/dev/hyperv/netvsc/hv_rndis.h @@ -1046,11 +1046,11 @@ /* * Externs */ -int netvsc_recv(struct hv_device *device_ctx, - netvsc_packet *packet, - rndis_tcp_ip_csum_info *csum_info); -void netvsc_recv_rollup(struct hv_device *device_ctx); -void netvsc_channel_rollup(struct hv_device *device_ctx); +struct hv_vmbus_channel; + +int netvsc_recv(struct hv_vmbus_channel *chan, + netvsc_packet *packet, rndis_tcp_ip_csum_info *csum_info); +void netvsc_channel_rollup(struct hv_vmbus_channel *chan); void* hv_set_rppi_data(rndis_msg *rndis_mesg, uint32_t rppi_size, Index: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h =================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.h +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.h @@ -95,11 +95,12 @@ /* * Externs */ +struct hv_vmbus_channel; -int hv_rf_on_receive(netvsc_dev *net_dev, - struct hv_device *device, netvsc_packet *pkt); +int hv_rf_on_receive(netvsc_dev *net_dev, struct hv_device *device, + struct hv_vmbus_channel *chan, netvsc_packet *pkt); void hv_rf_receive_rollup(netvsc_dev *net_dev); -void hv_rf_channel_rollup(netvsc_dev *net_dev); +void hv_rf_channel_rollup(struct hv_vmbus_channel *chan); int hv_rf_on_device_add(struct hv_device *device, void *additl_info); int hv_rf_on_device_remove(struct hv_device *device, boolean_t destroy_channel); int hv_rf_on_open(struct hv_device *device); Index: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c =================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c @@ -58,6 +58,7 @@ static void hv_rf_receive_indicate_status(rndis_device *device, rndis_msg *response); static void hv_rf_receive_data(rndis_device *device, rndis_msg *message, + struct hv_vmbus_channel *chan, netvsc_packet *pkt); static int hv_rf_query_device(rndis_device *device, uint32_t oid, void *result, uint32_t *result_size); @@ -405,7 +406,8 @@ * RNDIS filter receive data */ static void -hv_rf_receive_data(rndis_device *device, rndis_msg *message, netvsc_packet *pkt) +hv_rf_receive_data(rndis_device *device, rndis_msg *message, + struct hv_vmbus_channel *chan, netvsc_packet *pkt) { rndis_packet *rndis_pkt; ndis_8021q_info *rppi_vlan_info; @@ -443,14 +445,15 @@ } csum_info = hv_get_ppi_data(rndis_pkt, tcpip_chksum_info); - netvsc_recv(device->net_dev->dev, pkt, csum_info); + netvsc_recv(chan, pkt, csum_info); } /* * RNDIS filter on receive */ int -hv_rf_on_receive(netvsc_dev *net_dev, struct hv_device *device, netvsc_packet *pkt) +hv_rf_on_receive(netvsc_dev *net_dev, struct hv_device *device, + struct hv_vmbus_channel *chan, netvsc_packet *pkt) { rndis_device *rndis_dev; rndis_msg *rndis_hdr; @@ -473,7 +476,7 @@ /* data message */ case REMOTE_NDIS_PACKET_MSG: - hv_rf_receive_data(rndis_dev, rndis_hdr, pkt); + hv_rf_receive_data(rndis_dev, rndis_hdr, chan, pkt); break; /* completion messages */ case REMOTE_NDIS_INITIALIZE_CMPLT: @@ -957,32 +960,9 @@ request->halt_complete_flag = 1; } -/* - * RNDIS filter when "all" reception is done - */ void -hv_rf_receive_rollup(netvsc_dev *net_dev) +hv_rf_channel_rollup(struct hv_vmbus_channel *chan) { - rndis_device *rndis_dev; - - rndis_dev = (rndis_device *)net_dev->extension; - netvsc_recv_rollup(rndis_dev->net_dev->dev); -} -void -hv_rf_channel_rollup(netvsc_dev *net_dev) -{ - rndis_device *rndis_dev; - - rndis_dev = (rndis_device *)net_dev->extension; - - /* - * This could be called pretty early, so we need - * to make sure everything has been setup. - */ - if (rndis_dev == NULL || - rndis_dev->net_dev == NULL || - rndis_dev->net_dev->dev == NULL) - return; - netvsc_channel_rollup(rndis_dev->net_dev->dev); + netvsc_channel_rollup(chan); }