Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/vmbus/vmbus.c
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | |||||
static void | static void | ||||
vmbus_msg_task(void *xsc, int pending __unused) | vmbus_msg_task(void *xsc, int pending __unused) | ||||
{ | { | ||||
struct vmbus_softc *sc = xsc; | struct vmbus_softc *sc = xsc; | ||||
volatile struct vmbus_message *msg; | volatile struct vmbus_message *msg; | ||||
msg = VMBUS_PCPU_GET(sc, message, curcpu) + VMBUS_SINT_MESSAGE; | msg = VMBUS_PCPU_GET(sc, message, curcpu) + VMBUS_SINT_MESSAGE; | ||||
for (;;) { | for (;;) { | ||||
const hv_vmbus_channel_msg_table_entry *entry; | |||||
hv_vmbus_channel_msg_header *hdr; | |||||
hv_vmbus_channel_msg_type msg_type; | |||||
if (msg->msg_type == VMBUS_MSGTYPE_NONE) { | if (msg->msg_type == VMBUS_MSGTYPE_NONE) { | ||||
/* No message */ | /* No message */ | ||||
break; | break; | ||||
} else if (msg->msg_type != VMBUS_MSGTYPE_CHANNEL) { | } else if (msg->msg_type == VMBUS_MSGTYPE_CHANNEL) { | ||||
/* Not a channel message */ | /* Channel message */ | ||||
goto handled; | vmbus_chan_msgproc(sc, msg); | ||||
} | } | ||||
/* XXX: update messageHandler interface */ | |||||
hdr = __DEVOLATILE(hv_vmbus_channel_msg_header *, | |||||
msg->msg_data); | |||||
msg_type = hdr->message_type; | |||||
if (msg_type >= HV_CHANNEL_MESSAGE_COUNT) { | |||||
printf("VMBUS: unknown message type = %d\n", msg_type); | |||||
goto handled; | |||||
} | |||||
entry = &g_channel_message_table[msg_type]; | |||||
if (entry->messageHandler) | |||||
entry->messageHandler(hdr); | |||||
handled: | |||||
msg->msg_type = VMBUS_MSGTYPE_NONE; | msg->msg_type = VMBUS_MSGTYPE_NONE; | ||||
/* | /* | ||||
* Make sure the write to msg_type (i.e. set to | * Make sure the write to msg_type (i.e. set to | ||||
* VMBUS_MSGTYPE_NONE) happens before we read the | * VMBUS_MSGTYPE_NONE) happens before we read the | ||||
* msg_flags and EOMing. Otherwise, the EOMing will | * msg_flags and EOMing. Otherwise, the EOMing will | ||||
* not deliver any more messages since there is no | * not deliver any more messages since there is no | ||||
* empty slot | * empty slot | ||||
* | * | ||||
▲ Show 20 Lines • Show All 647 Lines • Show Last 20 Lines |