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);
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to