Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hyperv/netvsc/hv_net_vsc.c
Show First 20 Lines • Show All 120 Lines • ▼ Show 20 Lines | error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_RC, | ||||
req, reqlen, &sndc); | req, reqlen, &sndc); | ||||
if (error) { | if (error) { | ||||
vmbus_xact_deactivate(xact); | vmbus_xact_deactivate(xact); | ||||
return NULL; | return NULL; | ||||
} | } | ||||
return (vmbus_xact_wait(xact, resp_len)); | return (vmbus_xact_wait(xact, resp_len)); | ||||
} | } | ||||
static __inline int | |||||
hn_nvs_req_send(struct hn_softc *sc, void *req, int reqlen) | |||||
{ | |||||
return (hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_NONE, | |||||
req, reqlen, &hn_send_ctx_none)); | |||||
} | |||||
/* | /* | ||||
* Net VSC initialize receive buffer with net VSP | * Net VSC initialize receive buffer with net VSP | ||||
* | * | ||||
* Net VSP: Network virtual services client, also known as the | * Net VSP: Network virtual services client, also known as the | ||||
* Hyper-V extensible switch and the synthetic data path. | * Hyper-V extensible switch and the synthetic data path. | ||||
*/ | */ | ||||
static int | static int | ||||
hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *sc, int rxbuf_size) | hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *sc, int rxbuf_size) | ||||
▲ Show 20 Lines • Show All 200 Lines • ▼ Show 20 Lines | if (sc->hn_flags & HN_FLAG_RXBUF_CONNECTED) { | ||||
/* | /* | ||||
* Disconnect RXBUF from NVS. | * Disconnect RXBUF from NVS. | ||||
*/ | */ | ||||
memset(&disconn, 0, sizeof(disconn)); | memset(&disconn, 0, sizeof(disconn)); | ||||
disconn.nvs_type = HN_NVS_TYPE_RXBUF_DISCONN; | disconn.nvs_type = HN_NVS_TYPE_RXBUF_DISCONN; | ||||
disconn.nvs_sig = HN_NVS_RXBUF_SIG; | disconn.nvs_sig = HN_NVS_RXBUF_SIG; | ||||
/* NOTE: No response. */ | /* NOTE: No response. */ | ||||
ret = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_NONE, | ret = hn_nvs_req_send(sc, &disconn, sizeof(disconn)); | ||||
&disconn, sizeof(disconn), &hn_send_ctx_none); | |||||
if (ret != 0) { | if (ret != 0) { | ||||
if_printf(sc->hn_ifp, | if_printf(sc->hn_ifp, | ||||
"send rxbuf disconn failed: %d\n", ret); | "send rxbuf disconn failed: %d\n", ret); | ||||
return (ret); | return (ret); | ||||
} | } | ||||
sc->hn_flags &= ~HN_FLAG_RXBUF_CONNECTED; | sc->hn_flags &= ~HN_FLAG_RXBUF_CONNECTED; | ||||
} | } | ||||
Show All 27 Lines | if (sc->hn_flags & HN_FLAG_CHIM_CONNECTED) { | ||||
/* | /* | ||||
* Disconnect chimney sending buffer from NVS. | * Disconnect chimney sending buffer from NVS. | ||||
*/ | */ | ||||
memset(&disconn, 0, sizeof(disconn)); | memset(&disconn, 0, sizeof(disconn)); | ||||
disconn.nvs_type = HN_NVS_TYPE_CHIM_DISCONN; | disconn.nvs_type = HN_NVS_TYPE_CHIM_DISCONN; | ||||
disconn.nvs_sig = HN_NVS_CHIM_SIG; | disconn.nvs_sig = HN_NVS_CHIM_SIG; | ||||
/* NOTE: No response. */ | /* NOTE: No response. */ | ||||
ret = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_NONE, | ret = hn_nvs_req_send(sc, &disconn, sizeof(disconn)); | ||||
&disconn, sizeof(disconn), &hn_send_ctx_none); | |||||
if (ret != 0) { | if (ret != 0) { | ||||
if_printf(sc->hn_ifp, | if_printf(sc->hn_ifp, | ||||
"send chim disconn failed: %d\n", ret); | "send chim disconn failed: %d\n", ret); | ||||
return (ret); | return (ret); | ||||
} | } | ||||
sc->hn_flags &= ~HN_FLAG_CHIM_CONNECTED; | sc->hn_flags &= ~HN_FLAG_CHIM_CONNECTED; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | hv_nv_send_ndis_config(struct hn_softc *sc, uint32_t mtu) | ||||
int error; | int error; | ||||
memset(&conf, 0, sizeof(conf)); | memset(&conf, 0, sizeof(conf)); | ||||
conf.nvs_type = HN_NVS_TYPE_NDIS_CONF; | conf.nvs_type = HN_NVS_TYPE_NDIS_CONF; | ||||
conf.nvs_mtu = mtu; | conf.nvs_mtu = mtu; | ||||
conf.nvs_caps = HN_NVS_NDIS_CONF_VLAN; | conf.nvs_caps = HN_NVS_NDIS_CONF_VLAN; | ||||
/* NOTE: No response. */ | /* NOTE: No response. */ | ||||
error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_NONE, | error = hn_nvs_req_send(sc, &conf, sizeof(conf)); | ||||
&conf, sizeof(conf), &hn_send_ctx_none); | |||||
if (error) | if (error) | ||||
if_printf(sc->hn_ifp, "send nvs ndis conf failed: %d\n", error); | if_printf(sc->hn_ifp, "send nvs ndis conf failed: %d\n", error); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* Net VSC connect to VSP | * Net VSC connect to VSP | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | hv_nv_connect_to_vsp(struct hn_softc *sc) | ||||
ndis.nvs_type = HN_NVS_TYPE_NDIS_INIT; | ndis.nvs_type = HN_NVS_TYPE_NDIS_INIT; | ||||
ndis.nvs_ndis_major = NDIS_VERSION_MAJOR_6; | ndis.nvs_ndis_major = NDIS_VERSION_MAJOR_6; | ||||
if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_4) | if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_4) | ||||
ndis.nvs_ndis_minor = NDIS_VERSION_MINOR_1; | ndis.nvs_ndis_minor = NDIS_VERSION_MINOR_1; | ||||
else | else | ||||
ndis.nvs_ndis_minor = NDIS_VERSION_MINOR_30; | ndis.nvs_ndis_minor = NDIS_VERSION_MINOR_30; | ||||
/* NOTE: No response. */ | /* NOTE: No response. */ | ||||
ret = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_NONE, | ret = hn_nvs_req_send(sc, &ndis, sizeof(ndis)); | ||||
&ndis, sizeof(ndis), &hn_send_ctx_none); | |||||
if (ret != 0) { | if (ret != 0) { | ||||
if_printf(sc->hn_ifp, "send nvs ndis init failed: %d\n", ret); | if_printf(sc->hn_ifp, "send nvs ndis init failed: %d\n", ret); | ||||
goto cleanup; | goto cleanup; | ||||
} | } | ||||
/* Post the big receive buffer to NetVSP */ | /* Post the big receive buffer to NetVSP */ | ||||
if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_2) | if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_2) | ||||
rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE_LEGACY; | rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE_LEGACY; | ||||
▲ Show 20 Lines • Show All 330 Lines • Show Last 20 Lines |