Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jul 2016 07:16:46 +0000 (UTC)
From:      Sepherosa Ziehau <sephe@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r302882 - in head/sys/dev/hyperv: include netvsc storvsc utilities vmbus
Message-ID:  <201607150716.u6F7GkGX016682@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sephe
Date: Fri Jul 15 07:16:46 2016
New Revision: 302882
URL: https://svnweb.freebsd.org/changeset/base/302882

Log:
  hyperv/vmbus: Function rename
  
  And reorder the error prone parameters list.
  
  MFC after:	1 week
  Sponsored by:	Microsoft OSTC
  Differential Revision:	https://reviews.freebsd.org/D7191

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/include/vmbus.h
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  head/sys/dev/hyperv/utilities/hv_heartbeat.c
  head/sys/dev/hyperv/utilities/hv_kvp.c
  head/sys/dev/hyperv/utilities/hv_shutdown.c
  head/sys/dev/hyperv/utilities/hv_timesync.c
  head/sys/dev/hyperv/vmbus/hv_channel.c

Modified: head/sys/dev/hyperv/include/hyperv.h
==============================================================================
--- head/sys/dev/hyperv/include/hyperv.h	Fri Jul 15 07:07:17 2016	(r302881)
+++ head/sys/dev/hyperv/include/hyperv.h	Fri Jul 15 07:16:46 2016	(r302882)
@@ -323,14 +323,6 @@ int		hv_vmbus_channel_open(
 
 void		hv_vmbus_channel_close(hv_vmbus_channel *channel);
 
-int		hv_vmbus_channel_send_packet(
-				hv_vmbus_channel*	channel,
-				void*			buffer,
-				uint32_t		buffer_len,
-				uint64_t		request_id,
-				uint16_t		type,
-				uint16_t		flags);
-
 int		hv_vmbus_channel_establish_gpadl(
 				hv_vmbus_channel*	channel,
 				/* must be phys and virt contiguous */

Modified: head/sys/dev/hyperv/include/vmbus.h
==============================================================================
--- head/sys/dev/hyperv/include/vmbus.h	Fri Jul 15 07:07:17 2016	(r302881)
+++ head/sys/dev/hyperv/include/vmbus.h	Fri Jul 15 07:16:46 2016	(r302882)
@@ -59,6 +59,8 @@ struct vmbus_gpa {
 
 struct hv_vmbus_channel;
 
+int	vmbus_chan_send(struct hv_vmbus_channel *chan, uint16_t type,
+	    uint16_t flags, void *data, int dlen, uint64_t xactid);
 int	vmbus_chan_send_sglist(struct hv_vmbus_channel *chan,
 	    struct vmbus_gpa sg[], int sglen, void *data, int dlen,
 	    uint64_t xactid);

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c	Fri Jul 15 07:07:17 2016	(r302881)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c	Fri Jul 15 07:16:46 2016	(r302882)
@@ -183,9 +183,9 @@ hv_nv_init_rx_buffer_with_net_vsp(struct
 
 	/* Send the gpadl notification request */
 
-	ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt,
-	    sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt,
-	    VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC);
+	ret = vmbus_chan_send(sc->hn_prichan,
+	    VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
+	    init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt);
 	if (ret != 0) {
 		goto cleanup;
 	}
@@ -276,9 +276,9 @@ hv_nv_init_send_buffer_with_net_vsp(stru
 
 	/* Send the gpadl notification request */
 
-	ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt,
-  	    sizeof(nvsp_msg), (uint64_t)init_pkt,
-	    VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC);
+	ret = vmbus_chan_send(sc->hn_prichan,
+	    VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
+  	    init_pkt, sizeof(nvsp_msg), (uint64_t)init_pkt);
 	if (ret != 0) {
 		goto cleanup;
 	}
@@ -335,10 +335,9 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_
 		revoke_pkt->msgs.vers_1_msgs.revoke_rx_buf.id =
 		    NETVSC_RECEIVE_BUFFER_ID;
 
-		ret = hv_vmbus_channel_send_packet(net_dev->sc->hn_prichan,
-		    revoke_pkt, sizeof(nvsp_msg),
-		    (uint64_t)(uintptr_t)revoke_pkt,
-		    VMBUS_CHANPKT_TYPE_INBAND, 0);
+		ret = vmbus_chan_send(net_dev->sc->hn_prichan,
+		    VMBUS_CHANPKT_TYPE_INBAND, 0, revoke_pkt, sizeof(nvsp_msg),
+		    (uint64_t)(uintptr_t)revoke_pkt);
 
 		/*
 		 * If we failed here, we might as well return and have a leak 
@@ -403,10 +402,10 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne
 		revoke_pkt->msgs.vers_1_msgs.revoke_send_buf.id =
 		    NETVSC_SEND_BUFFER_ID;
 
-		ret = hv_vmbus_channel_send_packet(net_dev->sc->hn_prichan,
+		ret = vmbus_chan_send(net_dev->sc->hn_prichan,
+		    VMBUS_CHANPKT_TYPE_INBAND, 0,
 		    revoke_pkt, sizeof(nvsp_msg),
-		    (uint64_t)(uintptr_t)revoke_pkt,
-		    VMBUS_CHANPKT_TYPE_INBAND, 0);
+		    (uint64_t)(uintptr_t)revoke_pkt);
 		/*
 		 * If we failed here, we might as well return and have a leak 
 		 * rather than continue and a bugchk
@@ -470,9 +469,9 @@ hv_nv_negotiate_nvsp_protocol(struct hn_
 	init_pkt->msgs.init_msgs.init.protocol_version_2 = nvsp_ver;
 
 	/* Send the init request */
-	ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt,
-	    sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt,
-	    VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC);
+	ret = vmbus_chan_send(sc->hn_prichan,
+	    VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
+	    init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt);
 	if (ret != 0)
 		return (-1);
 
@@ -513,9 +512,8 @@ hv_nv_send_ndis_config(struct hn_softc *
 		= 1;
 
 	/* Send the configuration packet */
-	ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt,
-	    sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt,
-	    VMBUS_CHANPKT_TYPE_INBAND, 0);
+	ret = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, 0,
+	    init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt);
 	if (ret != 0)
 		return (-EINVAL);
 
@@ -592,9 +590,8 @@ hv_nv_connect_to_vsp(struct hn_softc *sc
 
 	/* Send the init request */
 
-	ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt,
-	    sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt,
-	    VMBUS_CHANPKT_TYPE_INBAND, 0);
+	ret = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, 0,
+	    init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt);
 	if (ret != 0) {
 		goto cleanup;
 	}
@@ -816,9 +813,9 @@ hv_nv_on_send(struct hv_vmbus_channel *c
 		ret = vmbus_chan_send_sglist(chan, pkt->gpa, pkt->gpa_cnt,
 		    &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt);
 	} else {
-		ret = hv_vmbus_channel_send_packet(chan,
-		    &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt,
-		    VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC);
+		ret = vmbus_chan_send(chan,
+		    VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
+		    &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt);
 	}
 
 	return (ret);
@@ -917,8 +914,8 @@ hv_nv_on_receive_completion(struct hv_vm
 
 retry_send_cmplt:
 	/* Send the completion */
-	ret = hv_vmbus_channel_send_packet(chan, &rx_comp_msg,
-	    sizeof(nvsp_msg), tid, VMBUS_CHANPKT_TYPE_COMP, 0);
+	ret = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_COMP, 0,
+	    &rx_comp_msg, sizeof(nvsp_msg), tid);
 	if (ret == 0) {
 		/* success */
 		/* no-op */

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c	Fri Jul 15 07:07:17 2016	(r302881)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c	Fri Jul 15 07:16:46 2016	(r302882)
@@ -1166,9 +1166,9 @@ hv_rf_on_device_add(struct hn_softc *sc,
 	init_pkt->msgs.vers_5_msgs.subchannel_request.num_subchannels =
 	    net_dev->num_channel - 1;
 
-	ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt,
-	    sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt,
-	    VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC);
+	ret = vmbus_chan_send(sc->hn_prichan,
+	    VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
+	    init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt);
 	if (ret != 0) {
 		device_printf(dev, "Fail to allocate subchannel\n");
 		goto out;

Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Fri Jul 15 07:07:17 2016	(r302881)
+++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Fri Jul 15 07:16:46 2016	(r302882)
@@ -356,13 +356,9 @@ storvsc_send_multichannel_request(struct
 	vstor_packet->flags = REQUEST_COMPLETION_FLAG;
 	vstor_packet->u.multi_channels_cnt = request_channels_cnt;
 
-	ret = hv_vmbus_channel_send_packet(
-	    sc->hs_chan,
-	    vstor_packet,
-	    VSTOR_PKT_SIZE,
-	    (uint64_t)(uintptr_t)request,
-	    VMBUS_CHANPKT_TYPE_INBAND,
-	    VMBUS_CHANPKT_FLAG_RC);
+	ret = vmbus_chan_send(sc->hs_chan,
+	    VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
+	    vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request);
 
 	/* wait for 5 seconds */
 	ret = sema_timedwait(&request->synch_sema, 5 * hz);
@@ -427,13 +423,9 @@ hv_storvsc_channel_init(struct storvsc_s
 	vstor_packet->flags = REQUEST_COMPLETION_FLAG;
 
 
-	ret = hv_vmbus_channel_send_packet(
-			sc->hs_chan,
-			vstor_packet,
-			VSTOR_PKT_SIZE,
-			(uint64_t)(uintptr_t)request,
-			VMBUS_CHANPKT_TYPE_INBAND,
-			VMBUS_CHANPKT_FLAG_RC);
+	ret = vmbus_chan_send(sc->hs_chan,
+	    VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
+	    vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request);
 
 	if (ret != 0)
 		goto cleanup;
@@ -461,13 +453,9 @@ hv_storvsc_channel_init(struct storvsc_s
 		/* revision is only significant for Windows guests */
 		vstor_packet->u.version.revision = 0;
 
-		ret = hv_vmbus_channel_send_packet(
-			sc->hs_chan,
-			vstor_packet,
-			VSTOR_PKT_SIZE,
-			(uint64_t)(uintptr_t)request,
-			VMBUS_CHANPKT_TYPE_INBAND,
-			VMBUS_CHANPKT_FLAG_RC);
+		ret = vmbus_chan_send(sc->hs_chan,
+		    VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
+		    vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request);
 
 		if (ret != 0)
 			goto cleanup;
@@ -504,13 +492,9 @@ hv_storvsc_channel_init(struct storvsc_s
 	vstor_packet->operation = VSTOR_OPERATION_QUERYPROPERTIES;
 	vstor_packet->flags = REQUEST_COMPLETION_FLAG;
 
-	ret = hv_vmbus_channel_send_packet(
-				sc->hs_chan,
-				vstor_packet,
-				VSTOR_PKT_SIZE,
-				(uint64_t)(uintptr_t)request,
-				VMBUS_CHANPKT_TYPE_INBAND,
-				VMBUS_CHANPKT_FLAG_RC);
+	ret = vmbus_chan_send(sc->hs_chan,
+	    VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
+	    vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request);
 
 	if ( ret != 0)
 		goto cleanup;
@@ -540,13 +524,9 @@ hv_storvsc_channel_init(struct storvsc_s
 	vstor_packet->operation = VSTOR_OPERATION_ENDINITIALIZATION;
 	vstor_packet->flags = REQUEST_COMPLETION_FLAG;
 
-	ret = hv_vmbus_channel_send_packet(
-			sc->hs_chan,
-			vstor_packet,
-			VSTOR_PKT_SIZE,
-			(uint64_t)(uintptr_t)request,
-			VMBUS_CHANPKT_TYPE_INBAND,
-			VMBUS_CHANPKT_FLAG_RC);
+	ret = vmbus_chan_send(sc->hs_chan,
+	    VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
+	    vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request);
 
 	if (ret != 0) {
 		goto cleanup;
@@ -631,12 +611,10 @@ hv_storvsc_host_reset(struct storvsc_sof
 	vstor_packet->operation = VSTOR_OPERATION_RESETBUS;
 	vstor_packet->flags = REQUEST_COMPLETION_FLAG;
 
-	ret = hv_vmbus_channel_send_packet(dev->channel,
-			vstor_packet,
-			VSTOR_PKT_SIZE,
-			(uint64_t)(uintptr_t)&sc->hs_reset_req,
-			VMBUS_CHANPKT_TYPE_INBAND,
-			VMBUS_CHANPKT_FLAG_RC);
+	ret = vmbus_chan_send(dev->channel,
+	    VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
+	    vstor_packet, VSTOR_PKT_SIZE,
+	    (uint64_t)(uintptr_t)&sc->hs_reset_req);
 
 	if (ret != 0) {
 		goto cleanup;
@@ -694,13 +672,9 @@ hv_storvsc_io_request(struct storvsc_sof
 		    &request->prp_list.gpa_range, request->prp_cnt,
 		    vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request);
 	} else {
-		ret = hv_vmbus_channel_send_packet(
-			outgoing_channel,
-			vstor_packet,
-			VSTOR_PKT_SIZE,
-			(uint64_t)(uintptr_t)request,
-			VMBUS_CHANPKT_TYPE_INBAND,
-			VMBUS_CHANPKT_FLAG_RC);
+		ret = vmbus_chan_send(outgoing_channel,
+		    VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
+		    vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request);
 	}
 	mtx_lock(&request->softc->hs_lock);
 

Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c
==============================================================================
--- head/sys/dev/hyperv/utilities/hv_heartbeat.c	Fri Jul 15 07:07:17 2016	(r302881)
+++ head/sys/dev/hyperv/utilities/hv_heartbeat.c	Fri Jul 15 07:16:46 2016	(r302882)
@@ -87,8 +87,8 @@ hv_heartbeat_cb(void *context)
 	    icmsghdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION |
 				 HV_ICMSGHDRFLAG_RESPONSE;
 
-	    hv_vmbus_channel_send_packet(channel, buf, recvlen, requestid,
-		VMBUS_CHANPKT_TYPE_INBAND, 0);
+	    vmbus_chan_send(channel, VMBUS_CHANPKT_TYPE_INBAND, 0,
+	        buf, recvlen, requestid);
 	}
 }
 

Modified: head/sys/dev/hyperv/utilities/hv_kvp.c
==============================================================================
--- head/sys/dev/hyperv/utilities/hv_kvp.c	Fri Jul 15 07:07:17 2016	(r302881)
+++ head/sys/dev/hyperv/utilities/hv_kvp.c	Fri Jul 15 07:16:46 2016	(r302882)
@@ -575,11 +575,9 @@ hv_kvp_respond_host(hv_kvp_sc *sc, int e
 	hv_icmsg_hdrp->status = error;
 	hv_icmsg_hdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION | HV_ICMSGHDRFLAG_RESPONSE;
 
-	error = hv_vmbus_channel_send_packet(sc->util_sc.channel,
-			sc->rcv_buf,
-			sc->host_msg_len, sc->host_msg_id,
-			VMBUS_CHANPKT_TYPE_INBAND, 0);
-
+	error = vmbus_chan_send(sc->util_sc.channel,
+	    VMBUS_CHANPKT_TYPE_INBAND, 0, sc->rcv_buf, sc->host_msg_len,
+	    sc->host_msg_id);
 	if (error)
 		hv_kvp_log_info("%s: hv_kvp_respond_host: sendpacket error:%d\n",
 			__func__, error);

Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c
==============================================================================
--- head/sys/dev/hyperv/utilities/hv_shutdown.c	Fri Jul 15 07:07:17 2016	(r302881)
+++ head/sys/dev/hyperv/utilities/hv_shutdown.c	Fri Jul 15 07:16:46 2016	(r302882)
@@ -105,9 +105,8 @@ hv_shutdown_cb(void *context)
 	icmsghdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION |
 				 HV_ICMSGHDRFLAG_RESPONSE;
 
-	    hv_vmbus_channel_send_packet(channel, buf,
-					recv_len, request_id,
-					VMBUS_CHANPKT_TYPE_INBAND, 0);
+	    vmbus_chan_send(channel, VMBUS_CHANPKT_TYPE_INBAND, 0,
+	        buf, recv_len, request_id);
 	}
 
 	if (execute_shutdown)

Modified: head/sys/dev/hyperv/utilities/hv_timesync.c
==============================================================================
--- head/sys/dev/hyperv/utilities/hv_timesync.c	Fri Jul 15 07:07:17 2016	(r302881)
+++ head/sys/dev/hyperv/utilities/hv_timesync.c	Fri Jul 15 07:16:46 2016	(r302882)
@@ -163,9 +163,8 @@ hv_timesync_cb(void *context)
 	    icmsghdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION
 		| HV_ICMSGHDRFLAG_RESPONSE;
 
-	    hv_vmbus_channel_send_packet(channel, time_buf,
-		recvlen, requestId,
-		VMBUS_CHANPKT_TYPE_INBAND, 0);
+	    vmbus_chan_send(channel, VMBUS_CHANPKT_TYPE_INBAND, 0,
+	        time_buf, recvlen, requestId);
 	}
 }
 

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_channel.c	Fri Jul 15 07:07:17 2016	(r302881)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c	Fri Jul 15 07:16:46 2016	(r302882)
@@ -622,8 +622,8 @@ hv_vmbus_channel_close(struct hv_vmbus_c
 }
 
 int
-hv_vmbus_channel_send_packet(struct hv_vmbus_channel *chan,
-    void *data, uint32_t dlen, uint64_t xactid, uint16_t type, uint16_t flags)
+vmbus_chan_send(struct hv_vmbus_channel *chan, uint16_t type, uint16_t flags,
+    void *data, int dlen, uint64_t xactid)
 {
 	struct vmbus_chanpkt pkt;
 	int pktlen, pad_pktlen, hlen, error;



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