diff options
author | sephe <sephe@FreeBSD.org> | 2017-01-04 02:39:00 +0000 |
---|---|---|
committer | sephe <sephe@FreeBSD.org> | 2017-01-04 02:39:00 +0000 |
commit | 273a5a38d4c101ccfe5588a69d5941cadbcd6b28 (patch) | |
tree | b672f4fb5766ca01cdd3f8b3baa19a085bc49be0 /sys/dev/hyperv/utilities/hv_timesync.c | |
parent | 923185c1556e28efc10e1d35ad9c829c7bf02ab1 (diff) | |
download | FreeBSD-src-273a5a38d4c101ccfe5588a69d5941cadbcd6b28.zip FreeBSD-src-273a5a38d4c101ccfe5588a69d5941cadbcd6b28.tar.gz |
MFC 310312-310314
310312
hyperv/ic: Factor out function to send IC response
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8844
310313
hyperv/ic: Cleanup common struct and functions.
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8845
310314
hyperv/ic: Rename cleaned up header file.
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8846
Diffstat (limited to 'sys/dev/hyperv/utilities/hv_timesync.c')
-rw-r--r-- | sys/dev/hyperv/utilities/hv_timesync.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/sys/dev/hyperv/utilities/hv_timesync.c b/sys/dev/hyperv/utilities/hv_timesync.c index 4d166b0..65bf634 100644 --- a/sys/dev/hyperv/utilities/hv_timesync.c +++ b/sys/dev/hyperv/utilities/hv_timesync.c @@ -37,8 +37,8 @@ __FBSDID("$FreeBSD$"); #include <dev/hyperv/include/hyperv.h> #include <dev/hyperv/include/vmbus.h> -#include <dev/hyperv/utilities/hv_util.h> #include <dev/hyperv/utilities/vmbus_icreg.h> +#include <dev/hyperv/utilities/vmbus_icvar.h> #include "vmbus_if.h" @@ -85,7 +85,7 @@ SYSCTL_INT(_hw_hvtimesync, OID_AUTO, sample_verbose, CTLFLAG_RWTUN, &vmbus_ts_sample_verbose, 0, "Increase sample request verbosity."); static void -vmbus_timesync(struct hv_util_sc *sc, uint64_t hvtime, uint64_t sent_tc, +vmbus_timesync(struct vmbus_ic_softc *sc, uint64_t hvtime, uint64_t sent_tc, uint8_t tsflags) { struct timespec vm_ts; @@ -150,7 +150,7 @@ vmbus_timesync(struct hv_util_sc *sc, uint64_t hvtime, uint64_t sent_tc, static void vmbus_timesync_cb(struct vmbus_channel *chan, void *xsc) { - struct hv_util_sc *sc = xsc; + struct vmbus_ic_softc *sc = xsc; struct vmbus_icmsg_hdr *hdr; const struct vmbus_icmsg_timesync *msg; int dlen, error; @@ -160,7 +160,7 @@ vmbus_timesync_cb(struct vmbus_channel *chan, void *xsc) /* * Receive request. */ - data = sc->receive_buffer; + data = sc->ic_buf; dlen = sc->ic_buflen; error = vmbus_chan_recv(chan, data, &dlen, &xactid); KASSERT(error != ENOBUFS, ("icbuf is not large enough")); @@ -203,13 +203,9 @@ vmbus_timesync_cb(struct vmbus_channel *chan, void *xsc) } /* - * Send response by echoing the updated request back. + * Send response by echoing the request back. */ - hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP; - error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0, - data, dlen, xactid); - if (error) - device_printf(sc->ic_dev, "resp send failed: %d\n", error); + vmbus_ic_sendresp(sc, chan, data, dlen, xactid); } static int @@ -223,18 +219,22 @@ static int hv_timesync_attach(device_t dev) { - return (hv_util_attach(dev, vmbus_timesync_cb)); + return (vmbus_ic_attach(dev, vmbus_timesync_cb)); } static device_method_t timesync_methods[] = { /* Device interface */ DEVMETHOD(device_probe, hv_timesync_probe), DEVMETHOD(device_attach, hv_timesync_attach), - DEVMETHOD(device_detach, hv_util_detach), + DEVMETHOD(device_detach, vmbus_ic_detach), { 0, 0 } }; -static driver_t timesync_driver = { "hvtimesync", timesync_methods, sizeof(hv_util_sc)}; +static driver_t timesync_driver = { + "hvtimesync", + timesync_methods, + sizeof(struct vmbus_ic_softc) +}; static devclass_t timesync_devclass; |