svn commit: r302737 - head/sys/dev/hyperv/vmbus
Sepherosa Ziehau
sephe at FreeBSD.org
Wed Jul 13 09:44:25 UTC 2016
Author: sephe
Date: Wed Jul 13 09:44:24 2016
New Revision: 302737
URL: https://svnweb.freebsd.org/changeset/base/302737
Log:
hyperv/vmbus: Cleanup channel rescind
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7090
Modified:
head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
head/sys/dev/hyperv/vmbus/vmbus_reg.h
Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 09:41:04 2016 (r302736)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 09:44:24 2016 (r302737)
@@ -47,10 +47,10 @@ static void vmbus_chan_detach_task(void
static void vmbus_channel_on_offer(struct vmbus_softc *,
const struct vmbus_message *);
-static void vmbus_channel_on_offer_rescind(struct vmbus_softc *,
- const struct vmbus_message *);
static void vmbus_channel_on_offers_delivered(struct vmbus_softc *,
const struct vmbus_message *);
+static void vmbus_chan_msgproc_chrescind(struct vmbus_softc *,
+ const struct vmbus_message *);
/**
* Channel message dispatch table
@@ -60,7 +60,7 @@ vmbus_chanmsg_process[HV_CHANNEL_MESSAGE
[HV_CHANNEL_MESSAGE_OFFER_CHANNEL] =
vmbus_channel_on_offer,
[HV_CHANNEL_MESSAGE_RESCIND_CHANNEL_OFFER] =
- vmbus_channel_on_offer_rescind,
+ vmbus_chan_msgproc_chrescind,
[HV_CHANNEL_MESSAGE_ALL_OFFERS_DELIVERED] =
vmbus_channel_on_offers_delivered,
[HV_CHANNEL_MESSAGE_OPEN_CHANNEL_RESULT] =
@@ -326,33 +326,34 @@ vmbus_channel_on_offer_internal(struct v
vmbus_channel_process_offer(new_channel);
}
-/**
- * @brief Rescind offer handler.
- *
- * We queue a work item to process this offer
- * synchronously.
- *
+/*
* XXX pretty broken; need rework.
*/
static void
-vmbus_channel_on_offer_rescind(struct vmbus_softc *sc,
+vmbus_chan_msgproc_chrescind(struct vmbus_softc *sc,
const struct vmbus_message *msg)
{
- const hv_vmbus_channel_rescind_offer *rescind;
- hv_vmbus_channel* channel;
+ const struct vmbus_chanmsg_chrescind *note;
+ struct hv_vmbus_channel *chan;
+
+ note = (const struct vmbus_chanmsg_chrescind *)msg->msg_data;
+ if (note->chm_chanid > VMBUS_CHAN_MAX) {
+ device_printf(sc->vmbus_dev, "invalid rescinded chan%u\n",
+ note->chm_chanid);
+ return;
+ }
- rescind = (const hv_vmbus_channel_rescind_offer *)msg->msg_data;
if (bootverbose) {
- device_printf(sc->vmbus_dev, "chan%u rescind\n",
- rescind->child_rel_id);
+ device_printf(sc->vmbus_dev, "chan%u rescinded\n",
+ note->chm_chanid);
}
- channel = sc->vmbus_chmap[rescind->child_rel_id];
- if (channel == NULL)
- return;
- sc->vmbus_chmap[rescind->child_rel_id] = NULL;
+ chan = sc->vmbus_chmap[note->chm_chanid];
+ if (chan == NULL)
+ return;
+ sc->vmbus_chmap[note->chm_chanid] = NULL;
- taskqueue_enqueue(taskqueue_thread, &channel->ch_detach_task);
+ taskqueue_enqueue(taskqueue_thread, &chan->ch_detach_task);
}
static void
Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h
==============================================================================
--- head/sys/dev/hyperv/vmbus/vmbus_reg.h Wed Jul 13 09:41:04 2016 (r302736)
+++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Wed Jul 13 09:44:24 2016 (r302737)
@@ -117,10 +117,11 @@ struct vmbus_gpa_range {
/*
* Channel messages
- * - Embedded in vmbus_message.msg_data, e.g. response.
+ * - Embedded in vmbus_message.msg_data, e.g. response and notification.
* - Embedded in hypercall_postmsg_in.hc_data, e.g. request.
*/
+#define VMBUS_CHANMSG_TYPE_CHRESCIND 2 /* NOTE */
#define VMBUS_CHANMSG_TYPE_CHREQUEST 3 /* REQ */
#define VMBUS_CHANMSG_TYPE_CHOPEN 5 /* REQ */
#define VMBUS_CHANMSG_TYPE_CHOPEN_RESP 6 /* RESP */
@@ -241,4 +242,10 @@ struct vmbus_chanmsg_chfree {
uint32_t chm_chanid;
} __packed;
+/* VMBUS_CHANMSG_TYPE_CHRESCIND */
+struct vmbus_chanmsg_chrescind {
+ struct vmbus_chanmsg_hdr chm_hdr;
+ uint32_t chm_chanid;
+} __packed;
+
#endif /* !_VMBUS_REG_H_ */
More information about the svn-src-all
mailing list