Author: sephe
Date: Mon Oct 17 02:19:55 2016
New Revision: 307452
URL: https://svnweb.freebsd.org/changeset/base/307452

Log:
  MFC 302867-302870
  
  302867
      hyperv/vmbus: Remove unused struct
  
      Sponsored by:   Microsoft OSTC
      Differential Revision:  https://reviews.freebsd.org/D7127
  
  302868
      hyperv/vmbus: Function rename
  
      Sponsored by:   Microsoft OSTC
      Differential Revision:  https://reviews.freebsd.org/D7129
  
  302869
      hyperv/vmbus: Remove unused function definition/declaration.
  
      Sponsored by:   Microsoft OSTC
      Differential Revision:  https://reviews.freebsd.org/D7131
  
  302870
      hyperv/vmbus: Use iovec for bufring scatter/gather list.
  
      Sponsored by:   Microsoft OSTC
      Differential Revision:  https://reviews.freebsd.org/D7134

Modified:
  stable/11/sys/dev/hyperv/vmbus/hv_channel.c
  stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c
  stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
  stable/11/sys/dev/hyperv/vmbus/vmbus.c
  stable/11/sys/dev/hyperv/vmbus/vmbus_var.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c
==============================================================================
--- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 02:12:49 2016        
(r307451)
+++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 02:19:55 2016        
(r307452)
@@ -616,7 +616,7 @@ hv_vmbus_channel_send_packet(
        uint64_t                aligned_data;
        uint32_t                packet_len_aligned;
        boolean_t               need_sig;
-       hv_vmbus_sg_buffer_list buffer_list[3];
+       struct iovec            iov[3];
 
        packet_len = sizeof(hv_vm_packet_descriptor) + buffer_len;
        packet_len_aligned = HV_ALIGN_UP(packet_len, sizeof(uint64_t));
@@ -630,17 +630,16 @@ hv_vmbus_channel_send_packet(
        desc.length8 = (uint16_t) (packet_len_aligned >> 3);
        desc.transaction_id = request_id;
 
-       buffer_list[0].data = &desc;
-       buffer_list[0].length = sizeof(hv_vm_packet_descriptor);
+       iov[0].iov_base = &desc;
+       iov[0].iov_len = sizeof(hv_vm_packet_descriptor);
 
-       buffer_list[1].data = buffer;
-       buffer_list[1].length = buffer_len;
+       iov[1].iov_base = buffer;
+       iov[1].iov_len = buffer_len;
 
-       buffer_list[2].data = &aligned_data;
-       buffer_list[2].length = packet_len_aligned - packet_len;
+       iov[2].iov_base = &aligned_data;
+       iov[2].iov_len = packet_len_aligned - packet_len;
 
-       ret = hv_ring_buffer_write(&channel->outbound, buffer_list, 3,
-           &need_sig);
+       ret = hv_ring_buffer_write(&channel->outbound, iov, 3, &need_sig);
 
        /* TODO: We should determine if this is optional */
        if (ret == 0 && need_sig)
@@ -668,7 +667,7 @@ hv_vmbus_channel_send_packet_pagebuffer(
        uint32_t                                packet_len;
        uint32_t                                page_buflen;
        uint32_t                                packetLen_aligned;
-       hv_vmbus_sg_buffer_list                 buffer_list[4];
+       struct iovec                            iov[4];
        hv_vmbus_channel_packet_page_buffer     desc;
        uint32_t                                descSize;
        uint64_t                                alignedData = 0;
@@ -694,20 +693,19 @@ hv_vmbus_channel_send_packet_pagebuffer(
        desc.transaction_id = request_id;
        desc.range_count = page_count;
 
-       buffer_list[0].data = &desc;
-       buffer_list[0].length = descSize;
+       iov[0].iov_base = &desc;
+       iov[0].iov_len = descSize;
 
-       buffer_list[1].data = page_buffers;
-       buffer_list[1].length = page_buflen;
+       iov[1].iov_base = page_buffers;
+       iov[1].iov_len = page_buflen;
 
-       buffer_list[2].data = buffer;
-       buffer_list[2].length = buffer_len;
+       iov[2].iov_base = buffer;
+       iov[2].iov_len = buffer_len;
 
-       buffer_list[3].data = &alignedData;
-       buffer_list[3].length = packetLen_aligned - packet_len;
+       iov[3].iov_base = &alignedData;
+       iov[3].iov_len = packetLen_aligned - packet_len;
 
-       ret = hv_ring_buffer_write(&channel->outbound, buffer_list, 4,
-           &need_sig);
+       ret = hv_ring_buffer_write(&channel->outbound, iov, 4, &need_sig);
 
        /* TODO: We should determine if this is optional */
        if (ret == 0 && need_sig)
@@ -735,7 +733,7 @@ hv_vmbus_channel_send_packet_multipagebu
        uint32_t                packet_len_aligned;
        uint32_t                pfn_count;
        uint64_t                aligned_data = 0;
-       hv_vmbus_sg_buffer_list buffer_list[3];
+       struct iovec            iov[3];
        hv_vmbus_channel_packet_multipage_buffer desc;
 
        pfn_count =
@@ -772,17 +770,16 @@ hv_vmbus_channel_send_packet_multipagebu
        memcpy(desc.range.pfn_array, multi_page_buffer->pfn_array,
                pfn_count * sizeof(uint64_t));
 
-       buffer_list[0].data = &desc;
-       buffer_list[0].length = desc_size;
+       iov[0].iov_base = &desc;
+       iov[0].iov_len = desc_size;
 
-       buffer_list[1].data = buffer;
-       buffer_list[1].length = buffer_len;
+       iov[1].iov_base = buffer;
+       iov[1].iov_len = buffer_len;
 
-       buffer_list[2].data = &aligned_data;
-       buffer_list[2].length = packet_len_aligned - packet_len;
+       iov[2].iov_base = &aligned_data;
+       iov[2].iov_len = packet_len_aligned - packet_len;
 
-       ret = hv_ring_buffer_write(&channel->outbound, buffer_list, 3,
-           &need_sig);
+       ret = hv_ring_buffer_write(&channel->outbound, iov, 3, &need_sig);
 
        /* TODO: We should determine if this is optional */
        if (ret == 0 && need_sig)
@@ -1233,7 +1230,7 @@ vmbus_chan_msgproc_choffer(struct vmbus_
                 * Error is ignored here; don't have much to do if error
                 * really happens.
                 */
-               hv_vmbus_child_device_register(chan);
+               vmbus_add_child(chan);
        }
 }
 
@@ -1274,7 +1271,7 @@ vmbus_chan_detach_task(void *xchan, int 
 
        if (VMBUS_CHAN_ISPRIMARY(chan)) {
                /* Only primary channel owns the device */
-               hv_vmbus_child_device_unregister(chan);
+               vmbus_delete_child(chan);
                /* NOTE: DO NOT free primary channel for now */
        } else {
                struct vmbus_softc *sc = chan->vmbus_sc;
@@ -1336,7 +1333,7 @@ vmbus_chan_destroy_all(struct vmbus_soft
                TAILQ_REMOVE(&sc->vmbus_prichans, chan, ch_prilink);
                mtx_unlock(&sc->vmbus_prichan_lock);
 
-               hv_vmbus_child_device_unregister(chan);
+               vmbus_delete_child(chan);
                vmbus_chan_free(chan);
 
                mtx_lock(&sc->vmbus_prichan_lock);

Modified: stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c
==============================================================================
--- stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c     Mon Oct 17 02:12:49 
2016        (r307451)
+++ stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c     Mon Oct 17 02:19:55 
2016        (r307452)
@@ -252,7 +252,7 @@ hv_ring_buffer_needsig_on_write(
 static uint32_t        copy_to_ring_buffer(
                        hv_vmbus_ring_buffer_info*      ring_info,
                        uint32_t                        start_write_offset,
-                       char*                           src,
+                       const uint8_t                   *src,
                        uint32_t                        src_len);
 
 static uint32_t copy_from_ring_buffer(
@@ -261,16 +261,6 @@ static uint32_t copy_from_ring_buffer(
                        uint32_t                        dest_len,
                        uint32_t                        start_read_offset);
 
-
-/**
- * @brief Get the interrupt mask for the specified ring buffer.
- */
-uint32_t
-hv_vmbus_get_ring_buffer_interrupt_mask(hv_vmbus_ring_buffer_info *rbi) 
-{
-       return rbi->ring_buffer->interrupt_mask;
-}
-
 /**
  * @brief Initialize the ring buffer.
  */
@@ -307,8 +297,8 @@ void hv_ring_buffer_cleanup(hv_vmbus_rin
 int
 hv_ring_buffer_write(
        hv_vmbus_ring_buffer_info*      out_ring_info,
-       hv_vmbus_sg_buffer_list         sg_buffers[],
-       uint32_t                        sg_buffer_count,
+       const struct iovec              iov[],
+       uint32_t                        iovlen,
        boolean_t                       *need_sig)
 {
        int i = 0;
@@ -320,8 +310,8 @@ hv_ring_buffer_write(
        volatile uint32_t next_write_location;
        uint64_t prev_indices = 0;
 
-       for (i = 0; i < sg_buffer_count; i++) {
-           total_bytes_to_write += sg_buffers[i].length;
+       for (i = 0; i < iovlen; i++) {
+           total_bytes_to_write += iov[i].iov_len;
        }
 
        total_bytes_to_write += sizeof(uint64_t);
@@ -350,10 +340,9 @@ hv_ring_buffer_write(
 
        old_write_location = next_write_location;
 
-       for (i = 0; i < sg_buffer_count; i++) {
+       for (i = 0; i < iovlen; i++) {
            next_write_location = copy_to_ring_buffer(out_ring_info,
-               next_write_location, (char *) sg_buffers[i].data,
-               sg_buffers[i].length);
+               next_write_location, iov[i].iov_base, iov[i].iov_len);
        }
 
        /*
@@ -492,11 +481,11 @@ hv_ring_buffer_read(
  *
  * Assume there is enough room. Handles wrap-around in dest case only!
  */
-uint32_t
+static uint32_t
 copy_to_ring_buffer(
        hv_vmbus_ring_buffer_info*      ring_info,
        uint32_t                        start_write_offset,
-       char*                           src,
+       const uint8_t                   *src,
        uint32_t                        src_len)
 {
        char *ring_buffer = get_ring_buffer(ring_info);

Modified: stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
==============================================================================
--- stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h      Mon Oct 17 02:12:49 
2016        (r307451)
+++ stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h      Mon Oct 17 02:19:55 
2016        (r307452)
@@ -35,39 +35,12 @@
 #include <sys/lock.h>
 #include <sys/mutex.h>
 #include <sys/sema.h>
+#include <sys/_iovec.h>
 
 #include <dev/hyperv/include/hyperv.h>
 
 struct vmbus_softc;
 
-typedef struct {
-       void*           data;
-       uint32_t        length;
-} hv_vmbus_sg_buffer_list;
-
-typedef struct {
-       uint32_t        current_interrupt_mask;
-       uint32_t        current_read_index;
-       uint32_t        current_write_index;
-       uint32_t        bytes_avail_to_read;
-       uint32_t        bytes_avail_to_write;
-} hv_vmbus_ring_buffer_debug_info;
-
-typedef struct {
-       uint32_t                rel_id;
-       struct hyperv_guid      interface_type;
-       struct hyperv_guid      interface_instance;
-       uint32_t                monitor_id;
-       uint32_t                server_monitor_pending;
-       uint32_t                server_monitor_latency;
-       uint32_t                server_monitor_connection_id;
-       uint32_t                client_monitor_pending;
-       uint32_t                client_monitor_latency;
-       uint32_t                client_monitor_connection_id;
-       hv_vmbus_ring_buffer_debug_info inbound;
-       hv_vmbus_ring_buffer_debug_info outbound;
-} hv_vmbus_channel_debug_info;
-
 /*
  * The format must be the same as hv_vm_data_gpa_direct
  */
@@ -118,8 +91,8 @@ void                 hv_ring_buffer_cleanup(
 
 int                    hv_ring_buffer_write(
                                hv_vmbus_ring_buffer_info       *ring_info,
-                               hv_vmbus_sg_buffer_list         sg_buffers[],
-                               uint32_t                        sg_buff_count,
+                               const struct iovec              iov[],
+                               uint32_t                        iovlen,
                                boolean_t                       *need_sig);
 
 int                    hv_ring_buffer_peek(
@@ -133,22 +106,10 @@ int                       hv_ring_buffer_read(
                                uint32_t                        buffer_len,
                                uint32_t                        offset);
 
-uint32_t               hv_vmbus_get_ring_buffer_interrupt_mask(
-                               hv_vmbus_ring_buffer_info       *ring_info);
-
-void                   hv_vmbus_dump_ring_info(
-                               hv_vmbus_ring_buffer_info       *ring_info,
-                               char                            *prefix);
-
 void                   hv_ring_buffer_read_begin(
                                hv_vmbus_ring_buffer_info       *ring_info);
 
 uint32_t               hv_ring_buffer_read_end(
                                hv_vmbus_ring_buffer_info       *ring_info);
 
-int                    hv_vmbus_child_device_register(
-                                       struct hv_vmbus_channel *chan);
-int                    hv_vmbus_child_device_unregister(
-                                       struct hv_vmbus_channel *chan);
-
 #endif  /* __HYPERV_PRIV_H__ */

Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c
==============================================================================
--- stable/11/sys/dev/hyperv/vmbus/vmbus.c      Mon Oct 17 02:12:49 2016        
(r307451)
+++ stable/11/sys/dev/hyperv/vmbus/vmbus.c      Mon Oct 17 02:19:55 2016        
(r307452)
@@ -1021,7 +1021,7 @@ vmbus_child_pnpinfo_str(device_t dev, de
 }
 
 int
-hv_vmbus_child_device_register(struct hv_vmbus_channel *chan)
+vmbus_add_child(struct hv_vmbus_channel *chan)
 {
        struct vmbus_softc *sc = chan->vmbus_sc;
        device_t parent = sc->vmbus_dev;
@@ -1046,7 +1046,7 @@ done:
 }
 
 int
-hv_vmbus_child_device_unregister(struct hv_vmbus_channel *chan)
+vmbus_delete_child(struct hv_vmbus_channel *chan)
 {
        int error;
 

Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_var.h
==============================================================================
--- stable/11/sys/dev/hyperv/vmbus/vmbus_var.h  Mon Oct 17 02:12:49 2016        
(r307451)
+++ stable/11/sys/dev/hyperv/vmbus/vmbus_var.h  Mon Oct 17 02:19:55 2016        
(r307452)
@@ -146,6 +146,8 @@ struct vmbus_msghc;
 void   vmbus_event_proc(struct vmbus_softc *, int);
 void   vmbus_event_proc_compat(struct vmbus_softc *, int);
 void   vmbus_handle_intr(struct trapframe *);
+int    vmbus_add_child(struct hv_vmbus_channel *);
+int    vmbus_delete_child(struct hv_vmbus_channel *);
 
 void   vmbus_et_intr(struct trapframe *);
 
_______________________________________________
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