hyperv/vmbus: Switch to vmbus channel message macros

Prepare for more cleanup.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7094
This commit is contained in:
sephe 2016-07-14 05:49:14 +00:00
parent 962908052b
commit 392e784792
2 changed files with 22 additions and 17 deletions

View File

@ -52,27 +52,30 @@ static void vmbus_channel_on_offers_delivered(struct vmbus_softc *,
static void vmbus_chan_msgproc_chrescind(struct vmbus_softc *,
const struct vmbus_message *);
/**
* Channel message dispatch table
/*
* Vmbus channel message processing.
*/
#define VMBUS_CHANMSG_PROC(name, func) \
[VMBUS_CHANMSG_TYPE_##name] = func
#define VMBUS_CHANMSG_PROC_WAKEUP(name) \
VMBUS_CHANMSG_PROC(name, vmbus_msghc_wakeup)
static const vmbus_chanmsg_proc_t
vmbus_chanmsg_process[HV_CHANNEL_MESSAGE_COUNT] = {
[HV_CHANNEL_MESSAGE_OFFER_CHANNEL] =
vmbus_channel_on_offer,
[HV_CHANNEL_MESSAGE_RESCIND_CHANNEL_OFFER] =
vmbus_chan_msgproc_chrescind,
[HV_CHANNEL_MESSAGE_ALL_OFFERS_DELIVERED] =
vmbus_channel_on_offers_delivered,
[HV_CHANNEL_MESSAGE_OPEN_CHANNEL_RESULT] =
vmbus_msghc_wakeup,
[HV_CHANNEL_MESSAGE_GPADL_CREATED] =
vmbus_msghc_wakeup,
[HV_CHANNEL_MESSAGE_GPADL_TORNDOWN] =
vmbus_msghc_wakeup,
[HV_CHANNEL_MESSAGE_VERSION_RESPONSE] =
vmbus_msghc_wakeup
vmbus_chanmsg_process[VMBUS_CHANMSG_TYPE_MAX] = {
VMBUS_CHANMSG_PROC(CHOFFER, vmbus_channel_on_offer),
VMBUS_CHANMSG_PROC(CHRESCIND, vmbus_chan_msgproc_chrescind),
VMBUS_CHANMSG_PROC(CHOFFER_DONE,vmbus_channel_on_offers_delivered),
VMBUS_CHANMSG_PROC_WAKEUP(CHOPEN_RESP),
VMBUS_CHANMSG_PROC_WAKEUP(GPADL_CONNRESP),
VMBUS_CHANMSG_PROC_WAKEUP(GPADL_DISCONNRESP),
VMBUS_CHANMSG_PROC_WAKEUP(CONNECT_RESP)
};
#undef VMBUS_CHANMSG_PROC_WAKEUP
#undef VMBUS_CHANMSG_PROC
/**
* @brief Allocate and initialize a vmbus channel object
*/

View File

@ -125,6 +125,7 @@ struct vmbus_gpa_range {
#define VMBUS_CHANMSG_TYPE_CHOFFER 1 /* NOTE */
#define VMBUS_CHANMSG_TYPE_CHRESCIND 2 /* NOTE */
#define VMBUS_CHANMSG_TYPE_CHREQUEST 3 /* REQ */
#define VMBUS_CHANMSG_TYPE_CHOFFER_DONE 4 /* NOTE */
#define VMBUS_CHANMSG_TYPE_CHOPEN 5 /* REQ */
#define VMBUS_CHANMSG_TYPE_CHOPEN_RESP 6 /* RESP */
#define VMBUS_CHANMSG_TYPE_CHCLOSE 7 /* REQ */
@ -137,6 +138,7 @@ struct vmbus_gpa_range {
#define VMBUS_CHANMSG_TYPE_CONNECT 14 /* REQ */
#define VMBUS_CHANMSG_TYPE_CONNECT_RESP 15 /* RESP */
#define VMBUS_CHANMSG_TYPE_DISCONNECT 16 /* REQ */
#define VMBUS_CHANMSG_TYPE_MAX 22
struct vmbus_chanmsg_hdr {
uint32_t chm_type; /* VMBUS_CHANMSG_TYPE_ */