Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
Show First 20 Lines • Show All 271 Lines • ▼ Show 20 Lines | hv_rf_send_request(rndis_device *device, rndis_request *request, | ||||
if (message_type != REMOTE_NDIS_HALT_MSG) | if (message_type != REMOTE_NDIS_HALT_MSG) | ||||
cb = hn_rndis_sent_cb; | cb = hn_rndis_sent_cb; | ||||
else | else | ||||
cb = hn_rndis_sent_halt; | cb = hn_rndis_sent_halt; | ||||
if (tot_data_buf_len < net_dev->send_section_size) { | if (tot_data_buf_len < net_dev->send_section_size) { | ||||
send_buf_section_idx = hv_nv_get_next_send_section(net_dev); | send_buf_section_idx = hv_nv_get_next_send_section(net_dev); | ||||
if (send_buf_section_idx != | if (send_buf_section_idx != HN_NVS_CHIM_IDX_INVALID) { | ||||
NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX) { | |||||
char *dest = ((char *)net_dev->send_buf + | char *dest = ((char *)net_dev->send_buf + | ||||
send_buf_section_idx * net_dev->send_section_size); | send_buf_section_idx * net_dev->send_section_size); | ||||
memcpy(dest, &request->request_msg, request->request_msg.msg_len); | memcpy(dest, &request->request_msg, request->request_msg.msg_len); | ||||
send_buf_section_size = tot_data_buf_len; | send_buf_section_size = tot_data_buf_len; | ||||
gpa_cnt = 0; | gpa_cnt = 0; | ||||
goto sendit; | goto sendit; | ||||
} | } | ||||
/* Failed to allocate chimney send buffer; move on */ | /* Failed to allocate chimney send buffer; move on */ | ||||
} | } | ||||
send_buf_section_idx = NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX; | send_buf_section_idx = HN_NVS_CHIM_IDX_INVALID; | ||||
send_buf_section_size = 0; | send_buf_section_size = 0; | ||||
sendit: | sendit: | ||||
hn_send_ctx_init(&request->send_ctx, cb, request, | hn_send_ctx_init(&request->send_ctx, cb, request, | ||||
send_buf_section_idx, send_buf_section_size); | send_buf_section_idx, send_buf_section_size); | ||||
return hv_nv_on_send(device->net_dev->sc->hn_prichan, false, | return hv_nv_on_send(device->net_dev->sc->hn_prichan, | ||||
&request->send_ctx, gpa, gpa_cnt); | HN_NVS_RNDIS_MTYPE_CTRL, &request->send_ctx, gpa, gpa_cnt); | ||||
} | } | ||||
/* | /* | ||||
* RNDIS filter receive response | * RNDIS filter receive response | ||||
*/ | */ | ||||
static void | static void | ||||
hv_rf_receive_response(rndis_device *device, rndis_msg *response) | hv_rf_receive_response(rndis_device *device, rndis_msg *response) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 963 Lines • ▼ Show 20 Lines | hv_rf_on_close(struct hn_softc *sc) | ||||
return (hv_rf_close_device((rndis_device *)net_dev->extension)); | return (hv_rf_close_device((rndis_device *)net_dev->extension)); | ||||
} | } | ||||
static void | static void | ||||
hn_rndis_sent_cb(struct hn_send_ctx *sndc, struct netvsc_dev_ *net_dev, | hn_rndis_sent_cb(struct hn_send_ctx *sndc, struct netvsc_dev_ *net_dev, | ||||
struct vmbus_channel *chan __unused, const struct nvsp_msg_ *msg __unused, | struct vmbus_channel *chan __unused, const struct nvsp_msg_ *msg __unused, | ||||
int dlen __unused) | int dlen __unused) | ||||
{ | { | ||||
if (sndc->hn_chim_idx != NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX) | if (sndc->hn_chim_idx != HN_NVS_CHIM_IDX_INVALID) | ||||
hn_chim_free(net_dev, sndc->hn_chim_idx); | hn_chim_free(net_dev, sndc->hn_chim_idx); | ||||
} | } | ||||
static void | static void | ||||
hn_rndis_sent_halt(struct hn_send_ctx *sndc, struct netvsc_dev_ *net_dev, | hn_rndis_sent_halt(struct hn_send_ctx *sndc, struct netvsc_dev_ *net_dev, | ||||
struct vmbus_channel *chan __unused, const struct nvsp_msg_ *msg __unused, | struct vmbus_channel *chan __unused, const struct nvsp_msg_ *msg __unused, | ||||
int dlen __unused) | int dlen __unused) | ||||
{ | { | ||||
rndis_request *request = sndc->hn_cbarg; | rndis_request *request = sndc->hn_cbarg; | ||||
if (sndc->hn_chim_idx != NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX) | if (sndc->hn_chim_idx != HN_NVS_CHIM_IDX_INVALID) | ||||
hn_chim_free(net_dev, sndc->hn_chim_idx); | hn_chim_free(net_dev, sndc->hn_chim_idx); | ||||
/* | /* | ||||
* Notify hv_rf_halt_device() about halt completion. | * Notify hv_rf_halt_device() about halt completion. | ||||
* The halt code must wait for completion before freeing | * The halt code must wait for completion before freeing | ||||
* the transaction resources. | * the transaction resources. | ||||
*/ | */ | ||||
request->halt_complete_flag = 1; | request->halt_complete_flag = 1; | ||||
} | } | ||||
void | void | ||||
hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr) | hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr) | ||||
{ | { | ||||
netvsc_channel_rollup(rxr, txr); | netvsc_channel_rollup(rxr, txr); | ||||
} | } |