From owner-svn-src-head@freebsd.org Wed Jul 13 04:39:17 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 AC058B93BB3; Wed, 13 Jul 2016 04:39:17 +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 83A311EA8; Wed, 13 Jul 2016 04:39:17 +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 u6D4dGMZ078426; Wed, 13 Jul 2016 04:39:16 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D4dGaW078422; Wed, 13 Jul 2016 04:39:16 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130439.u6D4dGaW078422@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 04:39:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302696 - in head/sys/dev/hyperv: include vmbus 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.22 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: Wed, 13 Jul 2016 04:39:17 -0000 Author: sephe Date: Wed Jul 13 04:39:16 2016 New Revision: 302696 URL: https://svnweb.freebsd.org/changeset/base/302696 Log: hyperv/vmbus: Add type/instance guid fields into hv_vmbus_channel This prepares to remove the unnecessary offer message embedding in hv_vmbus_channel. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7020 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 04:31:08 2016 (r302695) +++ head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 04:39:16 2016 (r302696) @@ -632,6 +632,9 @@ typedef struct hv_vmbus_channel { TAILQ_ENTRY(hv_vmbus_channel) ch_link; uint32_t ch_subidx; /* subchan index */ + struct hv_guid ch_guid_type; + struct hv_guid ch_guid_inst; + struct sysctl_ctx_list ch_sysctl_ctx; } hv_vmbus_channel; Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 04:31:08 2016 (r302695) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 04:39:16 2016 (r302696) @@ -127,11 +127,9 @@ vmbus_channel_process_offer(hv_vmbus_cha } TAILQ_FOREACH(channel, &sc->vmbus_chlist, ch_link) { - if (memcmp(&channel->offer_msg.offer.interface_type, - &new_channel->offer_msg.offer.interface_type, + if (memcmp(&channel->ch_guid_type, &new_channel->ch_guid_type, sizeof(hv_guid)) == 0 && - memcmp(&channel->offer_msg.offer.interface_instance, - &new_channel->offer_msg.offer.interface_instance, + memcmp(&channel->ch_guid_inst, &new_channel->ch_guid_inst, sizeof(hv_guid)) == 0) break; } @@ -212,9 +210,7 @@ vmbus_channel_process_offer(hv_vmbus_cha * (We need to set the device field before calling * hv_vmbus_child_device_add()) */ - new_channel->device = hv_vmbus_child_device_create( - new_channel->offer_msg.offer.interface_type, - new_channel->offer_msg.offer.interface_instance, new_channel); + new_channel->device = hv_vmbus_child_device_create(new_channel); /* * Add the new device to the bus. This will kick off device-driver @@ -296,6 +292,8 @@ vmbus_channel_on_offer_internal(struct v new_channel->ch_subidx = offer->offer.sub_channel_index; if (offer->monitor_allocated) 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 Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed Jul 13 04:31:08 2016 (r302695) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed Jul 13 04:39:16 2016 (r302696) @@ -213,9 +213,7 @@ void hv_vmbus_release_unattached_chann struct vmbus_softc *); struct hv_device* hv_vmbus_child_device_create( - hv_guid device_type, - hv_guid device_instance, - hv_vmbus_channel *channel); + struct hv_vmbus_channel *channel); void hv_vmbus_child_device_register(struct vmbus_softc *, struct hv_device *child_dev); Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Wed Jul 13 04:31:08 2016 (r302695) +++ head/sys/dev/hyperv/vmbus/vmbus.c Wed Jul 13 04:39:16 2016 (r302696) @@ -1017,8 +1017,7 @@ vmbus_child_pnpinfo_str(device_t dev, de } struct hv_device * -hv_vmbus_child_device_create(hv_guid type, hv_guid instance, - hv_vmbus_channel *channel) +hv_vmbus_child_device_create(struct hv_vmbus_channel *channel) { hv_device *child_dev; @@ -1028,8 +1027,8 @@ hv_vmbus_child_device_create(hv_guid typ child_dev = malloc(sizeof(hv_device), M_DEVBUF, M_WAITOK | M_ZERO); child_dev->channel = channel; - memcpy(&child_dev->class_id, &type, sizeof(hv_guid)); - memcpy(&child_dev->device_id, &instance, sizeof(hv_guid)); + child_dev->class_id = channel->ch_guid_type; + child_dev->device_id = channel->ch_guid_inst; return (child_dev); }