Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hyperv/utilities/hv_kvp.c
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | |||||
#include <sys/kthread.h> | #include <sys/kthread.h> | ||||
#include <sys/syscallsubr.h> | #include <sys/syscallsubr.h> | ||||
#include <sys/sysproto.h> | #include <sys/sysproto.h> | ||||
#include <sys/un.h> | #include <sys/un.h> | ||||
#include <sys/endian.h> | #include <sys/endian.h> | ||||
#include <sys/_null.h> | #include <sys/_null.h> | ||||
#include <sys/signal.h> | #include <sys/signal.h> | ||||
#include <sys/syslog.h> | #include <sys/syslog.h> | ||||
#include <sys/systm.h> | |||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <net/if_arp.h> | #include <net/if_arp.h> | ||||
#include <dev/hyperv/include/hyperv.h> | #include <dev/hyperv/include/hyperv.h> | ||||
#include <dev/hyperv/netvsc/hv_net_vsc.h> | #include <dev/hyperv/netvsc/hv_net_vsc.h> | ||||
#include "unicode.h" | #include "unicode.h" | ||||
#include "hv_kvp.h" | #include "hv_kvp.h" | ||||
▲ Show 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | hv_kvp_negotiate_version(struct hv_vmbus_icmsg_hdr *icmsghdrp, | ||||
icframe_vercnt = negop->icframe_vercnt; | icframe_vercnt = negop->icframe_vercnt; | ||||
icmsg_vercnt = negop->icmsg_vercnt; | icmsg_vercnt = negop->icmsg_vercnt; | ||||
/* | /* | ||||
* Select the framework version number we will support | * Select the framework version number we will support | ||||
*/ | */ | ||||
if ((icframe_vercnt >= 2) && (negop->icversion_data[1].major == 3)) { | if ((icframe_vercnt >= 2) && (negop->icversion_data[1].major == 3)) { | ||||
icframe_vercnt = 3; | icframe_vercnt = 3; | ||||
if (icmsg_vercnt >= 2) | if (icmsg_vercnt > 2) | ||||
icmsg_vercnt = 4; | icmsg_vercnt = 4; | ||||
else | else | ||||
icmsg_vercnt = 3; | icmsg_vercnt = 3; | ||||
} else { | } else { | ||||
icframe_vercnt = 1; | icframe_vercnt = 1; | ||||
icmsg_vercnt = 1; | icmsg_vercnt = 1; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 485 Lines • ▼ Show 20 Lines | while ((pending_cnt>0) || ((ret == 0) && (recvlen > 0))) { | ||||
mtx_unlock(&kvp_globals.pending_mutex); | mtx_unlock(&kvp_globals.pending_mutex); | ||||
/* | /* | ||||
* Try reading next buffer | * Try reading next buffer | ||||
*/ | */ | ||||
recvlen = 0; | recvlen = 0; | ||||
ret = hv_vmbus_channel_recv_packet(channel, kvp_buf, 2 * PAGE_SIZE, | ret = hv_vmbus_channel_recv_packet(channel, kvp_buf, 2 * PAGE_SIZE, | ||||
&recvlen, &requestid); | &recvlen, &requestid); | ||||
hv_kvp_log_info("%s: read: context %p, pending_cnt %ju ret =%d, recvlen=%d\n", | hv_kvp_log_info("%s: read: context %p, pending_cnt %llu ret =%d, recvlen=%d\n", | ||||
__func__, context, pending_cnt, ret, recvlen); | __func__, context, (unsigned long long)pending_cnt, ret, recvlen); | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* Callback routine that gets called whenever there is a message from host | * Callback routine that gets called whenever there is a message from host | ||||
*/ | */ | ||||
void | void | ||||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* This function is called by the hv_kvp_deinit - | * This function is called by the hv_kvp_deinit - | ||||
* destroy character device | * destroy character device | ||||
*/ | */ | ||||
static void | static void | ||||
hv_kvp_dev_destroy(void) | hv_kvp_dev_destroy(void) | ||||
{ | { | ||||
if (daemon_task != NULL) { | if (daemon_task != NULL) { | ||||
PROC_LOCK(daemon_task); | PROC_LOCK(daemon_task); | ||||
kern_psignal(daemon_task, SIGKILL); | kern_psignal(daemon_task, SIGKILL); | ||||
PROC_UNLOCK(daemon_task); | PROC_UNLOCK(daemon_task); | ||||
} | } | ||||
destroy_dev(hv_kvp_dev); | destroy_dev(hv_kvp_dev); | ||||
free(hv_kvp_dev_buf, M_HV_KVP_DEV_BUF); | free(hv_kvp_dev_buf, M_HV_KVP_DEV_BUF); | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 175 Lines • Show Last 20 Lines |