Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
Show First 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | if (relid == 0) { | ||||
* XXX channel0 will not be processed; skip it. | * XXX channel0 will not be processed; skip it. | ||||
*/ | */ | ||||
printf("VMBUS: got channel0 offer\n"); | printf("VMBUS: got channel0 offer\n"); | ||||
} else { | } else { | ||||
sc->vmbus_chmap[relid] = new_channel; | sc->vmbus_chmap[relid] = new_channel; | ||||
} | } | ||||
TAILQ_FOREACH(channel, &sc->vmbus_chlist, ch_link) { | TAILQ_FOREACH(channel, &sc->vmbus_chlist, ch_link) { | ||||
if (memcmp(&channel->offer_msg.offer.interface_type, | if (memcmp(&channel->ch_guid_type, &new_channel->ch_guid_type, | ||||
&new_channel->offer_msg.offer.interface_type, | |||||
sizeof(hv_guid)) == 0 && | sizeof(hv_guid)) == 0 && | ||||
memcmp(&channel->offer_msg.offer.interface_instance, | memcmp(&channel->ch_guid_inst, &new_channel->ch_guid_inst, | ||||
&new_channel->offer_msg.offer.interface_instance, | |||||
sizeof(hv_guid)) == 0) | sizeof(hv_guid)) == 0) | ||||
break; | break; | ||||
} | } | ||||
if (channel == NULL) { | if (channel == NULL) { | ||||
/* Install the new primary channel */ | /* Install the new primary channel */ | ||||
TAILQ_INSERT_TAIL(&sc->vmbus_chlist, new_channel, ch_link); | TAILQ_INSERT_TAIL(&sc->vmbus_chlist, new_channel, ch_link); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | vmbus_channel_process_offer(hv_vmbus_channel *new_channel) | ||||
new_channel->state = HV_CHANNEL_OPEN_STATE; | new_channel->state = HV_CHANNEL_OPEN_STATE; | ||||
/* | /* | ||||
* Start the process of binding this offer to the driver | * Start the process of binding this offer to the driver | ||||
* (We need to set the device field before calling | * (We need to set the device field before calling | ||||
* hv_vmbus_child_device_add()) | * hv_vmbus_child_device_add()) | ||||
*/ | */ | ||||
new_channel->device = hv_vmbus_child_device_create( | new_channel->device = hv_vmbus_child_device_create(new_channel); | ||||
new_channel->offer_msg.offer.interface_type, | |||||
new_channel->offer_msg.offer.interface_instance, new_channel); | |||||
/* | /* | ||||
* Add the new device to the bus. This will kick off device-driver | * Add the new device to the bus. This will kick off device-driver | ||||
* binding which eventually invokes the device driver's AddDevice() | * binding which eventually invokes the device driver's AddDevice() | ||||
* method. | * method. | ||||
*/ | */ | ||||
hv_vmbus_child_device_register(new_channel->vmbus_sc, | hv_vmbus_child_device_register(new_channel->vmbus_sc, | ||||
new_channel->device); | new_channel->device); | ||||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | vmbus_channel_on_offer_internal(struct vmbus_softc *sc, | ||||
hv_vmbus_channel* new_channel; | hv_vmbus_channel* new_channel; | ||||
/* Allocate the channel object and save this offer */ | /* Allocate the channel object and save this offer */ | ||||
new_channel = hv_vmbus_allocate_channel(sc); | new_channel = hv_vmbus_allocate_channel(sc); | ||||
new_channel->ch_id = offer->child_rel_id; | new_channel->ch_id = offer->child_rel_id; | ||||
new_channel->ch_subidx = offer->offer.sub_channel_index; | new_channel->ch_subidx = offer->offer.sub_channel_index; | ||||
if (offer->monitor_allocated) | if (offer->monitor_allocated) | ||||
new_channel->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; | new_channel->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; | ||||
new_channel->ch_guid_type = offer->offer.interface_type; | |||||
new_channel->ch_guid_inst = offer->offer.interface_instance; | |||||
/* | /* | ||||
* By default we setup state to enable batched | * By default we setup state to enable batched | ||||
* reading. A specific service can choose to | * reading. A specific service can choose to | ||||
* disable this prior to opening the channel. | * disable this prior to opening the channel. | ||||
*/ | */ | ||||
new_channel->batched_reading = TRUE; | new_channel->batched_reading = TRUE; | ||||
▲ Show 20 Lines • Show All 277 Lines • Show Last 20 Lines |