Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hyperv/netvsc/hv_net_vsc.c
Show First 20 Lines • Show All 378 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
/* | /* | ||||
* Net VSC destroy receive buffer | * Net VSC destroy receive buffer | ||||
*/ | */ | ||||
static int | static int | ||||
hv_nv_destroy_rx_buffer(netvsc_dev *net_dev) | hv_nv_destroy_rx_buffer(netvsc_dev *net_dev) | ||||
{ | { | ||||
nvsp_msg *revoke_pkt; | |||||
int ret = 0; | int ret = 0; | ||||
if (net_dev->rx_section_count) { | |||||
struct hn_nvs_rxbuf_disconn disconn; | |||||
/* | /* | ||||
* If we got a section count, it means we received a | * Disconnect RXBUF from NVS. | ||||
* send_rx_buf_complete msg | |||||
* (ie sent nvsp_msg_1_type_send_rx_buf msg) therefore, | |||||
* we need to send a revoke msg here | |||||
*/ | */ | ||||
if (net_dev->rx_section_count) { | memset(&disconn, 0, sizeof(disconn)); | ||||
/* Send the revoke receive buffer */ | disconn.nvs_type = HN_NVS_TYPE_RXBUF_DISCONN; | ||||
revoke_pkt = &net_dev->revoke_packet; | disconn.nvs_sig = HN_NVS_RXBUF_SIG; | ||||
memset(revoke_pkt, 0, sizeof(nvsp_msg)); | |||||
revoke_pkt->hdr.msg_type = nvsp_msg_1_type_revoke_rx_buf; | |||||
revoke_pkt->msgs.vers_1_msgs.revoke_rx_buf.id = | |||||
NETVSC_RECEIVE_BUFFER_ID; | |||||
ret = vmbus_chan_send(net_dev->sc->hn_prichan, | ret = vmbus_chan_send(net_dev->sc->hn_prichan, | ||||
VMBUS_CHANPKT_TYPE_INBAND, 0, revoke_pkt, sizeof(nvsp_msg), | VMBUS_CHANPKT_TYPE_INBAND, 0, &disconn, sizeof(disconn), | ||||
(uint64_t)(uintptr_t)&hn_send_ctx_none); | (uint64_t)(uintptr_t)&hn_send_ctx_none); | ||||
/* | |||||
* If we failed here, we might as well return and have a leak | |||||
* rather than continue and a bugchk | |||||
*/ | |||||
if (ret != 0) { | if (ret != 0) { | ||||
if_printf(net_dev->sc->hn_ifp, | |||||
"send rxbuf disconn failed: %d\n", ret); | |||||
return (ret); | return (ret); | ||||
} | } | ||||
net_dev->rx_section_count = 0; | net_dev->rx_section_count = 0; | ||||
} | } | ||||
/* Tear down the gpadl on the vsp end */ | /* Tear down the gpadl on the vsp end */ | ||||
if (net_dev->rx_buf_gpadl_handle) { | if (net_dev->rx_buf_gpadl_handle) { | ||||
ret = vmbus_chan_gpadl_disconnect(net_dev->sc->hn_prichan, | ret = vmbus_chan_gpadl_disconnect(net_dev->sc->hn_prichan, | ||||
▲ Show 20 Lines • Show All 664 Lines • Show Last 20 Lines |