From owner-svn-src-head@freebsd.org Tue Apr 26 05:15:16 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E14E2B1D45F; Tue, 26 Apr 2016 05:15:16 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 986001793; Tue, 26 Apr 2016 05:15:16 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3Q5FFYw057858; Tue, 26 Apr 2016 05:15:15 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3Q5FFS4057857; Tue, 26 Apr 2016 05:15:15 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201604260515.u3Q5FFS4057857@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 26 Apr 2016 05:15:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298616 - head/sys/dev/hyperv/storvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2016 05:15:17 -0000 Author: sephe Date: Tue Apr 26 05:15:15 2016 New Revision: 298616 URL: https://svnweb.freebsd.org/changeset/base/298616 Log: 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 Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Apr 26 05:08:55 2016 (r298615) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Apr 26 05:15:15 2016 (r298616) @@ -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 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 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 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)