summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorsephe <sephe@FreeBSD.org>2016-04-26 05:15:15 +0000
committersephe <sephe@FreeBSD.org>2016-04-26 05:15:15 +0000
commit75f95734a8d4ea597a5a19768e778c0f954f5ff2 (patch)
tree149ce0c680d370e44be00e9202fab6b5d94ec8d6 /sys/dev
parent936be7c264e1adf7cbdf8c16de9329d51e72332a (diff)
downloadFreeBSD-src-75f95734a8d4ea597a5a19768e778c0f954f5ff2.zip
FreeBSD-src-75f95734a8d4ea597a5a19768e778c0f954f5ff2.tar.gz
hyperv/stor: Avoid sub-channel creation callback.
Since the sub-channel offers are synchronized, we can do our own channel setup without using the sub-channel creation callback. This paves the way to whack the sub-channel creation callback. MFC after: 1 week Sponsored by: Microsoft OSTC
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
index 7477acf..f62a1ca 100644
--- a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
+++ b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
@@ -315,21 +315,14 @@ get_stor_device(struct hv_device *device,
return sc;
}
-/**
- * @brief Callback handler, will be invoked when receive mutil-channel offer
- *
- * @param context new multi-channel
- */
static void
-storvsc_handle_sc_creation(void *context)
+storvsc_subchan_attach(struct hv_vmbus_channel *new_channel)
{
- hv_vmbus_channel *new_channel;
struct hv_device *device;
struct storvsc_softc *sc;
struct vmstor_chan_props props;
int ret = 0;
- new_channel = (hv_vmbus_channel *)context;
device = new_channel->device;
sc = get_stor_device(device, TRUE);
if (sc == NULL)
@@ -362,7 +355,7 @@ storvsc_send_multichannel_request(struct hv_device *dev, int max_chans)
struct hv_storvsc_request *request;
struct vstor_packet *vstor_packet;
int request_channels_cnt = 0;
- int ret;
+ int ret, i;
/* get multichannels count that need to create */
request_channels_cnt = MIN(max_chans, mp_ncpus);
@@ -376,9 +369,6 @@ storvsc_send_multichannel_request(struct hv_device *dev, int max_chans)
request = &sc->hs_init_req;
- /* Establish a handler for multi-channel */
- dev->channel->sc_creation_callback = storvsc_handle_sc_creation;
-
/* request the host to create multi-channel */
memset(request, 0, sizeof(struct hv_storvsc_request));
@@ -414,10 +404,14 @@ storvsc_send_multichannel_request(struct hv_device *dev, int max_chans)
return;
}
- /*
- * Wait for sub-channels setup to complete.
- */
+ /* Wait for sub-channels setup to complete. */
subchan = vmbus_get_subchan(dev->channel, request_channels_cnt);
+
+ /* Attach the sub-channels. */
+ for (i = 0; i < request_channels_cnt; ++i)
+ storvsc_subchan_attach(subchan[i]);
+
+ /* Release the sub-channels. */
vmbus_rel_subchan(subchan, request_channels_cnt);
if (bootverbose)
OpenPOWER on IntegriCloud