Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148319818
D7125.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D7125.diff
View Options
Index: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
===================================================================
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
@@ -37,13 +37,8 @@
#include <dev/hyperv/vmbus/vmbus_reg.h>
#include <dev/hyperv/vmbus/vmbus_var.h>
-typedef void (*vmbus_chanmsg_proc_t)
- (struct vmbus_softc *, const struct vmbus_message *);
-
static void vmbus_chan_detach_task(void *, int);
-static void vmbus_channel_on_offers_delivered(struct vmbus_softc *,
- const struct vmbus_message *);
static void vmbus_chan_msgproc_choffer(struct vmbus_softc *,
const struct vmbus_message *);
static void vmbus_chan_msgproc_chrescind(struct vmbus_softc *,
@@ -52,27 +47,16 @@
/*
* 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[VMBUS_CHANMSG_TYPE_MAX] = {
+vmbus_chan_msgprocs[VMBUS_CHANMSG_TYPE_MAX] = {
VMBUS_CHANMSG_PROC(CHOFFER, vmbus_chan_msgproc_choffer),
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)
+ VMBUS_CHANMSG_PROC_WAKEUP(GPADL_DISCONNRESP)
};
-#undef VMBUS_CHANMSG_PROC_WAKEUP
-#undef VMBUS_CHANMSG_PROC
-
static struct hv_vmbus_channel *
vmbus_chan_alloc(struct vmbus_softc *sc)
{
@@ -390,19 +374,6 @@
}
}
-/**
- *
- * @brief Invoked when all offers have been delivered.
- */
-static void
-vmbus_channel_on_offers_delivered(struct vmbus_softc *sc,
- const struct vmbus_message *msg __unused)
-{
-
- /* No more new channels for the channel request. */
- vmbus_scan_done(sc);
-}
-
/*
* Detach all devices and destroy the corresponding primary channels.
*/
@@ -538,13 +509,10 @@
uint32_t msg_type;
msg_type = ((const struct vmbus_chanmsg_hdr *)msg->msg_data)->chm_type;
- if (msg_type >= VMBUS_CHANMSG_TYPE_MAX) {
- device_printf(sc->vmbus_dev, "unknown message type 0x%x\n",
- msg_type);
- return;
- }
+ KASSERT(msg_type < VMBUS_CHANMSG_TYPE_MAX,
+ ("invalid message type %u", msg_type));
- msg_proc = vmbus_chanmsg_process[msg_type];
+ msg_proc = vmbus_chan_msgprocs[msg_type];
if (msg_proc != NULL)
msg_proc(sc, msg);
}
Index: head/sys/dev/hyperv/vmbus/vmbus.c
===================================================================
--- head/sys/dev/hyperv/vmbus/vmbus.c
+++ head/sys/dev/hyperv/vmbus/vmbus.c
@@ -98,7 +98,12 @@
static void vmbus_disconnect(struct vmbus_softc *);
static int vmbus_scan(struct vmbus_softc *);
static void vmbus_scan_wait(struct vmbus_softc *);
+static void vmbus_scan_newchan(struct vmbus_softc *);
static void vmbus_scan_newdev(struct vmbus_softc *);
+static void vmbus_scan_done(struct vmbus_softc *,
+ const struct vmbus_message *);
+static void vmbus_chanmsg_handle(struct vmbus_softc *,
+ const struct vmbus_message *);
static int vmbus_sysctl_version(SYSCTL_HANDLER_ARGS);
@@ -122,6 +127,12 @@
VMBUS_VERSION_WS2008
};
+static const vmbus_chanmsg_proc_t
+vmbus_chanmsg_handlers[VMBUS_CHANMSG_TYPE_MAX] = {
+ VMBUS_CHANMSG_PROC(CHOFFER_DONE, vmbus_scan_done),
+ VMBUS_CHANMSG_PROC_WAKEUP(CONNECT_RESP)
+};
+
static struct vmbus_msghc *
vmbus_msghc_alloc(bus_dma_tag_t parent_dtag)
{
@@ -480,7 +491,7 @@
return error;
}
-void
+static void
vmbus_scan_newchan(struct vmbus_softc *sc)
{
mtx_lock(&sc->vmbus_scan_lock);
@@ -489,8 +500,9 @@
mtx_unlock(&sc->vmbus_scan_lock);
}
-void
-vmbus_scan_done(struct vmbus_softc *sc)
+static void
+vmbus_scan_done(struct vmbus_softc *sc,
+ const struct vmbus_message *msg __unused)
{
mtx_lock(&sc->vmbus_scan_lock);
sc->vmbus_scan_chcnt |= VMBUS_SCAN_CHCNT_DONE;
@@ -560,6 +572,27 @@
}
static void
+vmbus_chanmsg_handle(struct vmbus_softc *sc, const struct vmbus_message *msg)
+{
+ vmbus_chanmsg_proc_t msg_proc;
+ uint32_t msg_type;
+
+ msg_type = ((const struct vmbus_chanmsg_hdr *)msg->msg_data)->chm_type;
+ if (msg_type >= VMBUS_CHANMSG_TYPE_MAX) {
+ device_printf(sc->vmbus_dev, "unknown message type 0x%x\n",
+ msg_type);
+ return;
+ }
+
+ msg_proc = vmbus_chanmsg_handlers[msg_type];
+ if (msg_proc != NULL)
+ msg_proc(sc, msg);
+
+ /* Channel specific processing */
+ vmbus_chan_msgproc(sc, msg);
+}
+
+static void
vmbus_msg_task(void *xsc, int pending __unused)
{
struct vmbus_softc *sc = xsc;
@@ -572,7 +605,7 @@
break;
} else if (msg->msg_type == HYPERV_MSGTYPE_CHANNEL) {
/* Channel message */
- vmbus_chan_msgproc(sc,
+ vmbus_chanmsg_handle(sc,
__DEVOLATILE(const struct vmbus_message *, msg));
}
Index: head/sys/dev/hyperv/vmbus/vmbus_var.h
===================================================================
--- head/sys/dev/hyperv/vmbus/vmbus_var.h
+++ head/sys/dev/hyperv/vmbus/vmbus_var.h
@@ -52,6 +52,17 @@
#define VMBUS_CONNID_MESSAGE 1
#define VMBUS_CONNID_EVENT 2
+struct vmbus_message;
+struct vmbus_softc;
+
+typedef void (*vmbus_chanmsg_proc_t)(struct vmbus_softc *,
+ const struct vmbus_message *);
+
+#define VMBUS_CHANMSG_PROC(name, func) \
+ [VMBUS_CHANMSG_TYPE_##name] = func
+#define VMBUS_CHANMSG_PROC_WAKEUP(name) \
+ VMBUS_CHANMSG_PROC(name, vmbus_msghc_wakeup)
+
struct vmbus_pcpu_data {
u_long *intr_cnt; /* Hyper-V interrupt counter */
struct vmbus_message *message; /* shared messages */
@@ -151,9 +162,6 @@
void vmbus_msghc_wakeup(struct vmbus_softc *, const struct vmbus_message *);
void vmbus_msghc_reset(struct vmbus_msghc *, size_t);
-void vmbus_scan_done(struct vmbus_softc *);
-void vmbus_scan_newchan(struct vmbus_softc *);
-
uint32_t vmbus_gpadl_alloc(struct vmbus_softc *);
#endif /* !_VMBUS_VAR_H_ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 18, 3:55 AM (6 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29877159
Default Alt Text
D7125.diff (5 KB)
Attached To
Mode
D7125: hyperv/vmbus: Move bus related message processing into vmbus.
Attached
Detach File
Event Timeline
Log In to Comment