svn commit: r310312 - head/sys/dev/hyperv/utilities
Sepherosa Ziehau
sephe at FreeBSD.org
Tue Dec 20 04:51:16 UTC 2016
Author: sephe
Date: Tue Dec 20 04:51:14 2016
New Revision: 310312
URL: https://svnweb.freebsd.org/changeset/base/310312
Log:
hyperv/ic: Factor out function to send IC response
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8844
Modified:
head/sys/dev/hyperv/utilities/hv_heartbeat.c
head/sys/dev/hyperv/utilities/hv_shutdown.c
head/sys/dev/hyperv/utilities/hv_timesync.c
head/sys/dev/hyperv/utilities/hv_util.c
head/sys/dev/hyperv/utilities/hv_util.h
Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c
==============================================================================
--- head/sys/dev/hyperv/utilities/hv_heartbeat.c Tue Dec 20 04:05:21 2016 (r310311)
+++ head/sys/dev/hyperv/utilities/hv_heartbeat.c Tue Dec 20 04:51:14 2016 (r310312)
@@ -110,13 +110,9 @@ vmbus_heartbeat_cb(struct vmbus_channel
}
/*
- * 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
Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c
==============================================================================
--- head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 04:05:21 2016 (r310311)
+++ head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 04:51:14 2016 (r310312)
@@ -122,13 +122,9 @@ vmbus_shutdown_cb(struct vmbus_channel *
}
/*
- * 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);
if (do_shutdown)
shutdown_nice(RB_POWEROFF);
Modified: head/sys/dev/hyperv/utilities/hv_timesync.c
==============================================================================
--- head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 04:05:21 2016 (r310311)
+++ head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 04:51:14 2016 (r310312)
@@ -203,13 +203,9 @@ vmbus_timesync_cb(struct vmbus_channel *
}
/*
- * 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
Modified: head/sys/dev/hyperv/utilities/hv_util.c
==============================================================================
--- head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 04:05:21 2016 (r310311)
+++ head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 04:51:14 2016 (r310312)
@@ -287,3 +287,21 @@ hv_util_detach(device_t dev)
return (0);
}
+
+int
+vmbus_ic_sendresp(struct hv_util_sc *sc, struct vmbus_channel *chan,
+ void *data, int dlen, uint64_t xactid)
+{
+ struct vmbus_icmsg_hdr *hdr;
+ int error;
+
+ KASSERT(dlen >= sizeof(*hdr), ("invalid data length %d", dlen));
+ hdr = data;
+
+ 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);
+ return (error);
+}
Modified: head/sys/dev/hyperv/utilities/hv_util.h
==============================================================================
--- head/sys/dev/hyperv/utilities/hv_util.h Tue Dec 20 04:05:21 2016 (r310311)
+++ head/sys/dev/hyperv/utilities/hv_util.h Tue Dec 20 04:51:14 2016 (r310312)
@@ -58,5 +58,8 @@ int hv_util_detach(device_t dev);
int vmbus_ic_probe(device_t dev, const struct vmbus_ic_desc descs[]);
int vmbus_ic_negomsg(struct hv_util_sc *sc, void *data, int *dlen,
uint32_t fw_ver, uint32_t msg_ver);
+int vmbus_ic_sendresp(struct hv_util_sc *sc,
+ struct vmbus_channel *chan, void *data, int dlen,
+ uint64_t xactid);
#endif
More information about the svn-src-all
mailing list