svn commit: r304327 - head/sys/dev/hyperv/netvsc

Sepherosa Ziehau sephe at FreeBSD.org
Thu Aug 18 05:34:00 UTC 2016


Author: sephe
Date: Thu Aug 18 05:33:58 2016
New Revision: 304327
URL: https://svnweb.freebsd.org/changeset/base/304327

Log:
  hyperv/hn: Pass RX packet info to netvsc_recv.
  
  This paves to nuke netvsc_packet, which does not serves much
  purpose now.
  
  MFC after:	1 week
  Sponsored by:	Microsoft
  Differential Revision:	https://reviews.freebsd.org/D7541

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/netvsc/hv_rndis.h
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  head/sys/dev/hyperv/netvsc/if_hnvar.h

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h	Thu Aug 18 05:07:02 2016	(r304326)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h	Thu Aug 18 05:33:58 2016	(r304327)
@@ -275,7 +275,6 @@ typedef void (*pfn_on_send_rx_completion
 #endif
 
 typedef struct netvsc_packet_ {
-	uint16_t	vlan_tci;
 	uint32_t	status;
 	uint32_t	tot_data_buf_len;
 	void		*data;

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c	Thu Aug 18 05:07:02 2016	(r304326)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c	Thu Aug 18 05:33:58 2016	(r304327)
@@ -1278,9 +1278,7 @@ hn_lro_rx(struct lro_ctrl *lc, struct mb
  */
 int
 netvsc_recv(struct hn_rx_ring *rxr, netvsc_packet *packet,
-    const rndis_tcp_ip_csum_info *csum_info,
-    const struct rndis_hash_info *hash_info,
-    const struct rndis_hash_value *hash_value)
+    const struct hn_recvinfo *info)
 {
 	struct ifnet *ifp = rxr->hn_ifp;
 	struct mbuf *m_new;
@@ -1332,28 +1330,28 @@ netvsc_recv(struct hn_rx_ring *rxr, netv
 		do_csum = 0;
 
 	/* receive side checksum offload */
-	if (csum_info != NULL) {
+	if (info->csum_info != NULL) {
 		/* IP csum offload */
-		if (csum_info->receive.ip_csum_succeeded && do_csum) {
+		if (info->csum_info->receive.ip_csum_succeeded && do_csum) {
 			m_new->m_pkthdr.csum_flags |=
 			    (CSUM_IP_CHECKED | CSUM_IP_VALID);
 			rxr->hn_csum_ip++;
 		}
 
 		/* TCP/UDP csum offload */
-		if ((csum_info->receive.tcp_csum_succeeded ||
-		     csum_info->receive.udp_csum_succeeded) && do_csum) {
+		if ((info->csum_info->receive.tcp_csum_succeeded ||
+		     info->csum_info->receive.udp_csum_succeeded) && do_csum) {
 			m_new->m_pkthdr.csum_flags |=
 			    (CSUM_DATA_VALID | CSUM_PSEUDO_HDR);
 			m_new->m_pkthdr.csum_data = 0xffff;
-			if (csum_info->receive.tcp_csum_succeeded)
+			if (info->csum_info->receive.tcp_csum_succeeded)
 				rxr->hn_csum_tcp++;
 			else
 				rxr->hn_csum_udp++;
 		}
 
-		if (csum_info->receive.ip_csum_succeeded &&
-		    csum_info->receive.tcp_csum_succeeded)
+		if (info->csum_info->receive.ip_csum_succeeded &&
+		    info->csum_info->receive.tcp_csum_succeeded)
 			do_lro = 1;
 	} else {
 		const struct ether_header *eh;
@@ -1409,19 +1407,18 @@ netvsc_recv(struct hn_rx_ring *rxr, netv
 		}
 	}
 skip:
-	if ((packet->vlan_tci != 0) &&
-	    (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0) {
-		m_new->m_pkthdr.ether_vtag = packet->vlan_tci;
+	if (info->vlan_info != NULL) {
+		m_new->m_pkthdr.ether_vtag = info->vlan_info->u1.s1.vlan_id;
 		m_new->m_flags |= M_VLANTAG;
 	}
 
-	if (hash_info != NULL && hash_value != NULL) {
+	if (info->hash_info != NULL && info->hash_value != NULL) {
 		rxr->hn_rss_pkts++;
-		m_new->m_pkthdr.flowid = hash_value->hash_value;
-		if ((hash_info->hash_info & NDIS_HASH_FUNCTION_MASK) ==
+		m_new->m_pkthdr.flowid = info->hash_value->hash_value;
+		if ((info->hash_info->hash_info & NDIS_HASH_FUNCTION_MASK) ==
 		    NDIS_HASH_FUNCTION_TOEPLITZ) {
 			uint32_t type =
-			    (hash_info->hash_info & NDIS_HASH_TYPE_MASK);
+			    (info->hash_info->hash_info & NDIS_HASH_TYPE_MASK);
 
 			switch (type) {
 			case NDIS_HASH_IPV4:
@@ -1450,8 +1447,8 @@ skip:
 			}
 		}
 	} else {
-		if (hash_value != NULL) {
-			m_new->m_pkthdr.flowid = hash_value->hash_value;
+		if (info->hash_value != NULL) {
+			m_new->m_pkthdr.flowid = info->hash_value->hash_value;
 		} else {
 			m_new->m_pkthdr.flowid = rxr->hn_rx_idx;
 			hash_type = M_HASHTYPE_OPAQUE;

Modified: head/sys/dev/hyperv/netvsc/hv_rndis.h
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_rndis.h	Thu Aug 18 05:07:02 2016	(r304326)
+++ head/sys/dev/hyperv/netvsc/hv_rndis.h	Thu Aug 18 05:33:58 2016	(r304327)
@@ -1088,11 +1088,10 @@ typedef struct rndismp_rx_bufs_info_ {
  */
 struct hn_rx_ring;
 struct hn_tx_ring;
+struct hn_recvinfo;
 
 int netvsc_recv(struct hn_rx_ring *rxr,
-    netvsc_packet *packet, const rndis_tcp_ip_csum_info *csum_info,
-    const struct rndis_hash_info *hash_info,
-    const struct rndis_hash_value *hash_value);
+    netvsc_packet *packet, const struct hn_recvinfo *info);
 void netvsc_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr);
 
 void* hv_set_rppi_data(rndis_msg *rndis_mesg,

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c	Thu Aug 18 05:07:02 2016	(r304326)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c	Thu Aug 18 05:33:58 2016	(r304327)
@@ -52,13 +52,6 @@ __FBSDID("$FreeBSD$");
 #include <dev/hyperv/netvsc/hv_rndis_filter.h>
 #include <dev/hyperv/netvsc/if_hnreg.h>
 
-struct hv_rf_recvinfo {
-	const ndis_8021q_info		*vlan_info;
-	const rndis_tcp_ip_csum_info	*csum_info;
-	const struct rndis_hash_info	*hash_info;
-	const struct rndis_hash_value	*hash_value;
-};
-
 #define HV_RF_RECVINFO_VLAN	0x1
 #define HV_RF_RECVINFO_CSUM	0x2
 #define HV_RF_RECVINFO_HASHINF	0x4
@@ -444,7 +437,7 @@ hv_rf_receive_indicate_status(rndis_devi
 }
 
 static int
-hv_rf_find_recvinfo(const rndis_packet *rpkt, struct hv_rf_recvinfo *info)
+hv_rf_find_recvinfo(const rndis_packet *rpkt, struct hn_recvinfo *info)
 {
 	const rndis_per_packet_info *ppi;
 	uint32_t mask, len;
@@ -530,7 +523,7 @@ hv_rf_receive_data(struct hn_rx_ring *rx
 {
 	rndis_packet *rndis_pkt;
 	uint32_t data_offset;
-	struct hv_rf_recvinfo info;
+	struct hn_recvinfo info;
 
 	rndis_pkt = &message->msg.packet;
 
@@ -559,13 +552,7 @@ hv_rf_receive_data(struct hn_rx_ring *rx
 		if_printf(rxr->hn_ifp, "recvinfo parsing failed\n");
 		return;
 	}
-
-	if (info.vlan_info != NULL)
-		pkt->vlan_tci = info.vlan_info->u1.s1.vlan_id;
-	else
-		pkt->vlan_tci = 0;
-
-	netvsc_recv(rxr, pkt, info.csum_info, info.hash_info, info.hash_value);
+	netvsc_recv(rxr, pkt, &info);
 }
 
 /*

Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h
==============================================================================
--- head/sys/dev/hyperv/netvsc/if_hnvar.h	Thu Aug 18 05:07:02 2016	(r304326)
+++ head/sys/dev/hyperv/netvsc/if_hnvar.h	Thu Aug 18 05:33:58 2016	(r304327)
@@ -35,7 +35,6 @@
 #include <dev/hyperv/netvsc/if_hnreg.h>
 
 struct netvsc_dev_;
-struct nvsp_msg_;
 
 struct vmbus_channel;
 struct hn_send_ctx;
@@ -51,6 +50,18 @@ struct hn_send_ctx {
 	int			hn_chim_sz;
 };
 
+struct rndis_hash_info;
+struct rndix_hash_value;
+struct ndis_8021q_info_;
+struct rndis_tcp_ip_csum_info_;
+
+struct hn_recvinfo {
+	const struct ndis_8021q_info_	*vlan_info;
+	const struct rndis_tcp_ip_csum_info_ *csum_info;
+	const struct rndis_hash_info	*hash_info;
+	const struct rndis_hash_value	*hash_value;
+};
+
 #define HN_SEND_CTX_INITIALIZER(cb, cbarg)		\
 {							\
 	.hn_cb		= cb,				\


More information about the svn-src-head mailing list