Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Oct 2016 07:37:30 +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: r307710 - head/sys/dev/hyperv/netvsc
Message-ID:  <201610210737.u9L7bUrX037100@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sephe
Date: Fri Oct 21 07:37:29 2016
New Revision: 307710
URL: https://svnweb.freebsd.org/changeset/base/307710

Log:
  hyperv/hn: Always query RSS capabilities.
  
  - This avoid distributing NDIS version check.
  - Only NDIS 6.20 required (earlier NDIS uses different indirect table
    format).
  
  MFC after:	1 week
  Sponsored by:	Microsoft
  Differential Revision:	https://reviews.freebsd.org/D8291

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

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c	Fri Oct 21 07:35:49 2016	(r307709)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c	Fri Oct 21 07:37:29 2016	(r307710)
@@ -3408,10 +3408,9 @@ hn_synth_alloc_subchans(struct hn_softc 
 	int nchan, rxr_cnt, error;
 
 	nchan = *nsubch + 1;
-	if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_30 || nchan == 1) {
+	if (nchan == 1) {
 		/*
-		 * Either RSS is not supported, or multiple RX/TX rings
-		 * are not requested.
+		 * Multiple RX/TX rings are not requested.
 		 */
 		*nsubch = 0;
 		return (0);

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c	Fri Oct 21 07:35:49 2016	(r307709)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c	Fri Oct 21 07:37:29 2016	(r307710)
@@ -744,15 +744,13 @@ hn_rndis_get_rsscaps(struct hn_softc *sc
 
 	*rxr_cnt = 0;
 
+	if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_20)
+		return (EOPNOTSUPP);
+
 	memset(&in, 0, sizeof(in));
 	in.ndis_hdr.ndis_type = NDIS_OBJTYPE_RSS_CAPS;
-	if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_30) {
-		in.ndis_hdr.ndis_rev = NDIS_RSS_CAPS_REV_1;
-		in.ndis_hdr.ndis_size = NDIS_RSS_CAPS_SIZE_6_0;
-	} else {
-		in.ndis_hdr.ndis_rev = NDIS_RSS_CAPS_REV_2;
-		in.ndis_hdr.ndis_size = NDIS_RSS_CAPS_SIZE;
-	}
+	in.ndis_hdr.ndis_rev = NDIS_RSS_CAPS_REV_2;
+	in.ndis_hdr.ndis_size = NDIS_RSS_CAPS_SIZE;
 
 	caps_len = NDIS_RSS_CAPS_SIZE;
 	error = hn_rndis_query2(sc, OID_GEN_RECEIVE_SCALE_CAPABILITIES,
@@ -1027,10 +1025,12 @@ hn_rndis_conf_rss(struct hn_softc *sc, u
 	int error;
 
 	/*
-	 * Only NDIS 6.30+ is supported.
+	 * Only NDIS 6.20+ is supported:
+	 * We only support 4bytes element in indirect table, which has been
+	 * adopted since NDIS 6.20.
 	 */
-	KASSERT(sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30,
-	    ("NDIS 6.30+ is required, NDIS version 0x%08x", sc->hn_ndis_ver));
+	KASSERT(sc->hn_ndis_ver >= HN_NDIS_VERSION_6_20,
+	    ("NDIS 6.20+ is required, NDIS version 0x%08x", sc->hn_ndis_ver));
 
 	/*
 	 * NOTE:

Modified: head/sys/dev/hyperv/netvsc/if_hnreg.h
==============================================================================
--- head/sys/dev/hyperv/netvsc/if_hnreg.h	Fri Oct 21 07:35:49 2016	(r307709)
+++ head/sys/dev/hyperv/netvsc/if_hnreg.h	Fri Oct 21 07:37:29 2016	(r307710)
@@ -36,6 +36,7 @@
  * NDIS protocol version numbers
  */
 #define HN_NDIS_VERSION_6_1		0x00060001
+#define HN_NDIS_VERSION_6_20		0x00060014
 #define HN_NDIS_VERSION_6_30		0x0006001e
 #define HN_NDIS_VERSION_MAJOR(ver)	(((ver) & 0xffff0000) >> 16)
 #define HN_NDIS_VERSION_MINOR(ver)	((ver) & 0xffff)



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