summaryrefslogtreecommitdiffstats
path: root/sys/dev/hyperv/utilities
diff options
context:
space:
mode:
authorsephe <sephe@FreeBSD.org>2016-10-12 02:09:53 +0000
committersephe <sephe@FreeBSD.org>2016-10-12 02:09:53 +0000
commitabbac49956f6e03854c7d1661c708c28e28eb40d (patch)
tree4d4112d2008e83d8287c38071c1cd0332f21f4f4 /sys/dev/hyperv/utilities
parente1a4efcb70d351a2a2be00f017b2ee84aa8ba46b (diff)
downloadFreeBSD-src-abbac49956f6e03854c7d1661c708c28e28eb40d.zip
FreeBSD-src-abbac49956f6e03854c7d1661c708c28e28eb40d.tar.gz
MFC 302885,302886
302885 hyperv/vmbus: Cleanup channel receiving. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7202 302886 hyperv/vmbus: Cleanup channel packet receiving. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7204
Diffstat (limited to 'sys/dev/hyperv/utilities')
-rw-r--r--sys/dev/hyperv/utilities/hv_heartbeat.c8
-rw-r--r--sys/dev/hyperv/utilities/hv_kvp.c14
-rw-r--r--sys/dev/hyperv/utilities/hv_shutdown.c7
-rw-r--r--sys/dev/hyperv/utilities/hv_timesync.c6
4 files changed, 23 insertions, 12 deletions
diff --git a/sys/dev/hyperv/utilities/hv_heartbeat.c b/sys/dev/hyperv/utilities/hv_heartbeat.c
index cf5c073..660103e 100644
--- a/sys/dev/hyperv/utilities/hv_heartbeat.c
+++ b/sys/dev/hyperv/utilities/hv_heartbeat.c
@@ -52,7 +52,7 @@ hv_heartbeat_cb(void *context)
{
uint8_t* buf;
hv_vmbus_channel* channel;
- uint32_t recvlen;
+ int recvlen;
uint64_t requestid;
int ret;
@@ -64,8 +64,10 @@ hv_heartbeat_cb(void *context)
buf = softc->receive_buffer;;
channel = softc->channel;
- ret = hv_vmbus_channel_recv_packet(channel, buf, PAGE_SIZE, &recvlen,
- &requestid);
+ recvlen = PAGE_SIZE;
+ ret = vmbus_chan_recv(channel, buf, &recvlen, &requestid);
+ KASSERT(ret != ENOBUFS, ("hvheartbeat recvbuf is not large enough"));
+ /* XXX check recvlen to make sure that it contains enough data */
if ((ret == 0) && recvlen > 0) {
diff --git a/sys/dev/hyperv/utilities/hv_kvp.c b/sys/dev/hyperv/utilities/hv_kvp.c
index ef87a8c..b0b25c6 100644
--- a/sys/dev/hyperv/utilities/hv_kvp.c
+++ b/sys/dev/hyperv/utilities/hv_kvp.c
@@ -626,8 +626,10 @@ hv_kvp_process_request(void *context, int pending)
kvp_buf = sc->util_sc.receive_buffer;;
channel = sc->util_sc.channel;
- ret = hv_vmbus_channel_recv_packet(channel, kvp_buf, 2 * PAGE_SIZE,
- &recvlen, &requestid);
+ recvlen = 2 * PAGE_SIZE;
+ ret = vmbus_chan_recv(channel, kvp_buf, &recvlen, &requestid);
+ KASSERT(ret != ENOBUFS, ("hvkvp recvbuf is not large enough"));
+ /* XXX check recvlen to make sure that it contains enough data */
while ((ret == 0) && (recvlen > 0)) {
@@ -691,9 +693,11 @@ hv_kvp_process_request(void *context, int pending)
/*
* Try reading next buffer
*/
- recvlen = 0;
- ret = hv_vmbus_channel_recv_packet(channel, kvp_buf, 2 * PAGE_SIZE,
- &recvlen, &requestid);
+ recvlen = 2 * PAGE_SIZE;
+ ret = vmbus_chan_recv(channel, kvp_buf, &recvlen, &requestid);
+ KASSERT(ret != ENOBUFS, ("hvkvp recvbuf is not large enough"));
+ /* XXX check recvlen to make sure that it contains enough data */
+
hv_kvp_log_info("%s: read: context %p, ret =%d, recvlen=%d\n",
__func__, context, ret, recvlen);
}
diff --git a/sys/dev/hyperv/utilities/hv_shutdown.c b/sys/dev/hyperv/utilities/hv_shutdown.c
index 4cca5a6..49b2d87 100644
--- a/sys/dev/hyperv/utilities/hv_shutdown.c
+++ b/sys/dev/hyperv/utilities/hv_shutdown.c
@@ -67,8 +67,11 @@ hv_shutdown_cb(void *context)
softc = (hv_util_sc*)context;
buf = softc->receive_buffer;;
channel = softc->channel;
- ret = hv_vmbus_channel_recv_packet(channel, buf, PAGE_SIZE,
- &recv_len, &request_id);
+
+ recv_len = PAGE_SIZE;
+ ret = vmbus_chan_recv(channel, buf, &recv_len, &request_id);
+ KASSERT(ret != ENOBUFS, ("hvshutdown recvbuf is not large enough"));
+ /* XXX check recv_len to make sure that it contains enough data */
if ((ret == 0) && recv_len > 0) {
diff --git a/sys/dev/hyperv/utilities/hv_timesync.c b/sys/dev/hyperv/utilities/hv_timesync.c
index 1071cdd..e2e4321 100644
--- a/sys/dev/hyperv/utilities/hv_timesync.c
+++ b/sys/dev/hyperv/utilities/hv_timesync.c
@@ -144,8 +144,10 @@ hv_timesync_cb(void *context)
channel = softc->util_sc.channel;
time_buf = softc->util_sc.receive_buffer;
- ret = hv_vmbus_channel_recv_packet(channel, time_buf,
- PAGE_SIZE, &recvlen, &requestId);
+ recvlen = PAGE_SIZE;
+ ret = vmbus_chan_recv(channel, time_buf, &recvlen, &requestId);
+ KASSERT(ret != ENOBUFS, ("hvtimesync recvbuf is not large enough"));
+ /* XXX check recvlen to make sure that it contains enough data */
if ((ret == 0) && recvlen > 0) {
icmsghdrp = (struct hv_vmbus_icmsg_hdr *) &time_buf[
OpenPOWER on IntegriCloud