summaryrefslogtreecommitdiffstats
path: root/sys/dev/hyperv/utilities/hv_util.c
diff options
context:
space:
mode:
authorsephe <sephe@FreeBSD.org>2016-10-13 01:43:15 +0000
committersephe <sephe@FreeBSD.org>2016-10-13 01:43:15 +0000
commit77f1bb908895d8de1488000f873da71fbdf25d25 (patch)
tree2b37086e7451faf61ac4e5270e7b14fd8aae2dda /sys/dev/hyperv/utilities/hv_util.c
parentcec90d75d1d83dbec8e8e6fb5a3446ef4e085236 (diff)
downloadFreeBSD-src-77f1bb908895d8de1488000f873da71fbdf25d25.zip
FreeBSD-src-77f1bb908895d8de1488000f873da71fbdf25d25.tar.gz
MFC 303822-303824
303822 hyperv/ic: Remove never used second parameter of hv_negotiate_version() Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7422 303823 hyperv/ic: Expose the receive buffer length for callers to use. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7423 303824 hyperv/ic: Pass the channel callback to hv_util_attach() The saved channel callback in util softc is actually never used. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7424
Diffstat (limited to 'sys/dev/hyperv/utilities/hv_util.c')
-rw-r--r--sys/dev/hyperv/utilities/hv_util.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/sys/dev/hyperv/utilities/hv_util.c b/sys/dev/hyperv/utilities/hv_util.c
index e398faa..e7ecf32 100644
--- a/sys/dev/hyperv/utilities/hv_util.c
+++ b/sys/dev/hyperv/utilities/hv_util.c
@@ -44,12 +44,13 @@
#include <dev/hyperv/utilities/hv_utilreg.h>
#include "hv_util.h"
+#define VMBUS_IC_BRSIZE (4 * PAGE_SIZE)
+
void
-hv_negotiate_version(
- struct hv_vmbus_icmsg_hdr* icmsghdrp,
- struct hv_vmbus_icmsg_negotiate* negop,
- uint8_t* buf)
+hv_negotiate_version(struct hv_vmbus_icmsg_hdr *icmsghdrp, uint8_t *buf)
{
+ struct hv_vmbus_icmsg_negotiate *negop;
+
icmsghdrp->icmsgsize = 0x10;
negop = (struct hv_vmbus_icmsg_negotiate *)&buf[
@@ -74,16 +75,15 @@ hv_negotiate_version(
}
int
-hv_util_attach(device_t dev)
+hv_util_attach(device_t dev, vmbus_chan_callback_t cb)
{
- struct hv_util_sc* softc;
- struct vmbus_channel *chan;
- int ret;
+ struct hv_util_sc *sc = device_get_softc(dev);
+ struct vmbus_channel *chan = vmbus_get_channel(dev);
+ int error;
- softc = device_get_softc(dev);
- softc->receive_buffer =
- malloc(4 * PAGE_SIZE, M_DEVBUF, M_WAITOK | M_ZERO);
- chan = vmbus_get_channel(dev);
+ sc->ic_buflen = VMBUS_IC_BRSIZE;
+ sc->receive_buffer = malloc(VMBUS_IC_BRSIZE, M_DEVBUF,
+ M_WAITOK | M_ZERO);
/*
* These services are not performance critical and do not need
@@ -94,17 +94,13 @@ hv_util_attach(device_t dev)
*/
vmbus_chan_set_readbatch(chan, false);
- ret = vmbus_chan_open(chan, 4 * PAGE_SIZE, 4 * PAGE_SIZE, NULL, 0,
- softc->callback, softc);
-
- if (ret)
- goto error0;
-
+ error = vmbus_chan_open(chan, VMBUS_IC_BRSIZE, VMBUS_IC_BRSIZE, NULL, 0,
+ cb, sc);
+ if (error) {
+ free(sc->receive_buffer, M_DEVBUF);
+ return (error);
+ }
return (0);
-
-error0:
- free(softc->receive_buffer, M_DEVBUF);
- return (ret);
}
int
OpenPOWER on IntegriCloud