Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Oct 2016 08:48:36 +0000 (UTC)
From:      Sepherosa Ziehau <sephe@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r307031 - stable/10/sys/dev/hyperv/vmbus
Message-ID:  <201610110848.u9B8maju038324@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sephe
Date: Tue Oct 11 08:48:36 2016
New Revision: 307031
URL: https://svnweb.freebsd.org/changeset/base/307031

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/10/sys/dev/hyperv/vmbus/hv_channel.c
  stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c
  stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
  stable/10/sys/dev/hyperv/vmbus/vmbus.c
  stable/10/sys/dev/hyperv/vmbus/vmbus_var.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel.c
==============================================================================
--- stable/10/sys/dev/hyperv/vmbus/hv_channel.c	Tue Oct 11 08:41:27 2016	(r307030)
+++ stable/10/sys/dev/hyperv/vmbus/hv_channel.c	Tue Oct 11 08:48:36 2016	(r307031)
@@ -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/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c
==============================================================================
--- stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c	Tue Oct 11 08:41:27 2016	(r307030)
+++ stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c	Tue Oct 11 08:48:36 2016	(r307031)
@@ -254,7 +254,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(
@@ -263,16 +263,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.
  */
@@ -309,8 +299,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;
@@ -322,8 +312,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);
@@ -352,10 +342,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);
 	}
 
 	/*
@@ -494,11 +483,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/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
==============================================================================
--- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h	Tue Oct 11 08:41:27 2016	(r307030)
+++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h	Tue Oct 11 08:48:36 2016	(r307031)
@@ -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/10/sys/dev/hyperv/vmbus/vmbus.c
==============================================================================
--- stable/10/sys/dev/hyperv/vmbus/vmbus.c	Tue Oct 11 08:41:27 2016	(r307030)
+++ stable/10/sys/dev/hyperv/vmbus/vmbus.c	Tue Oct 11 08:48:36 2016	(r307031)
@@ -1101,7 +1101,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;
@@ -1126,7 +1126,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/10/sys/dev/hyperv/vmbus/vmbus_var.h
==============================================================================
--- stable/10/sys/dev/hyperv/vmbus/vmbus_var.h	Tue Oct 11 08:41:27 2016	(r307030)
+++ stable/10/sys/dev/hyperv/vmbus/vmbus_var.h	Tue Oct 11 08:48:36 2016	(r307031)
@@ -145,6 +145,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 *);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610110848.u9B8maju038324>