Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jul 2016 05:49:14 +0000 (UTC)
From:      Sepherosa Ziehau <sephe@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r302804 - head/sys/dev/hyperv/vmbus
Message-ID:  <201607140549.u6E5nEa6045641@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sephe
Date: Thu Jul 14 05:49:14 2016
New Revision: 302804
URL: https://svnweb.freebsd.org/changeset/base/302804

Log:
  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

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	Thu Jul 14 05:33:33 2016	(r302803)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c	Thu Jul 14 05:49:14 2016	(r302804)
@@ -52,27 +52,30 @@ static void	vmbus_channel_on_offers_deli
 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
  */

Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h
==============================================================================
--- head/sys/dev/hyperv/vmbus/vmbus_reg.h	Thu Jul 14 05:33:33 2016	(r302803)
+++ head/sys/dev/hyperv/vmbus/vmbus_reg.h	Thu Jul 14 05:49:14 2016	(r302804)
@@ -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_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607140549.u6E5nEa6045641>