Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Aug 2016 05:00:38 +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: r304109 - head/sys/dev/hyperv/netvsc
Message-ID:  <201608150500.u7F50cEt067858@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sephe
Date: Mon Aug 15 05:00:37 2016
New Revision: 304109
URL: https://svnweb.freebsd.org/changeset/base/304109

Log:
  hyperv/hn: Simplify chimney sending buffer disconnection.
  
  MFC after:	1 week
  Sponsored by:	Microsoft
  Differential Revision:	https://reviews.freebsd.org/D7479

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c
  head/sys/dev/hyperv/netvsc/if_hnreg.h

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c	Mon Aug 15 04:59:38 2016	(r304108)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c	Mon Aug 15 05:00:37 2016	(r304109)
@@ -436,33 +436,24 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_
 static int
 hv_nv_destroy_send_buffer(netvsc_dev *net_dev)
 {
-	nvsp_msg *revoke_pkt;
 	int ret = 0;
 
-	/*
-	 * If we got a section count, it means we received a
-	 * send_rx_buf_complete msg 
-	 * (ie sent nvsp_msg_1_type_send_rx_buf msg) therefore,
-	 * we need to send a revoke msg here
-	 */
 	if (net_dev->send_section_size) {
-		/* Send the revoke send buffer */
-		revoke_pkt = &net_dev->revoke_packet;
-		memset(revoke_pkt, 0, sizeof(nvsp_msg));
-
-		revoke_pkt->hdr.msg_type =
-		    nvsp_msg_1_type_revoke_send_buf;
-		revoke_pkt->msgs.vers_1_msgs.revoke_send_buf.id =
-		    NETVSC_SEND_BUFFER_ID;
+		struct hn_nvs_chim_disconn disconn;
 
-		ret = vmbus_chan_send(net_dev->sc->hn_prichan,
-		    VMBUS_CHANPKT_TYPE_INBAND, 0, revoke_pkt, sizeof(nvsp_msg),
-		    (uint64_t)(uintptr_t)&hn_send_ctx_none);
 		/*
-		 * If we failed here, we might as well return and have a leak 
-		 * rather than continue and a bugchk
+		 * Disconnect chimney sending buffer from NVS.
 		 */
+		memset(&disconn, 0, sizeof(disconn));
+		disconn.nvs_type = HN_NVS_TYPE_CHIM_DISCONN;
+		disconn.nvs_sig = HN_NVS_CHIM_SIG;
+
+		ret = vmbus_chan_send(net_dev->sc->hn_prichan,
+		    VMBUS_CHANPKT_TYPE_INBAND, 0, &disconn, sizeof(disconn),
+		    (uint64_t)(uintptr_t)&hn_send_ctx_none);
 		if (ret != 0) {
+			if_printf(net_dev->sc->hn_ifp,
+			    "send chim disconn failed: %d\n", ret);
 			return (ret);
 		}
 	}

Modified: head/sys/dev/hyperv/netvsc/if_hnreg.h
==============================================================================
--- head/sys/dev/hyperv/netvsc/if_hnreg.h	Mon Aug 15 04:59:38 2016	(r304108)
+++ head/sys/dev/hyperv/netvsc/if_hnreg.h	Mon Aug 15 05:00:37 2016	(r304109)
@@ -45,6 +45,7 @@
 #define HN_NVS_TYPE_RXBUF_DISCONN	103
 #define HN_NVS_TYPE_CHIM_CONN		104
 #define HN_NVS_TYPE_CHIM_CONNRESP	105
+#define HN_NVS_TYPE_CHIM_DISCONN	106
 #define HN_NVS_TYPE_NDIS_CONF		125
 
 /*
@@ -135,4 +136,12 @@ struct hn_nvs_chim_connresp {
 	uint32_t	nvs_sectsz;	/* section size */
 } __packed;
 
+/* No response */
+struct hn_nvs_chim_disconn {
+	uint32_t	nvs_type;	/* HN_NVS_TYPE_CHIM_DISCONN */
+	uint16_t	nvs_sig;	/* HN_NVS_CHIM_SIG */
+	uint8_t		nvs_rsvd[26];
+} __packed;
+CTASSERT(sizeof(struct hn_nvs_chim_disconn) >= HN_NVS_REQSIZE_MIN);
+
 #endif	/* !_IF_HNREG_H_ */



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