Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Oct 2017 05:30:49 +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-11@freebsd.org
Subject:   svn commit: r324473 - stable/11/sys/dev/hyperv/netvsc
Message-ID:  <201710100530.v9A5UnBr091513@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sephe
Date: Tue Oct 10 05:30:49 2017
New Revision: 324473
URL: https://svnweb.freebsd.org/changeset/base/324473

Log:
  MFC 323175
  
      hyperv/hn: Implement SIOCGIFRSS{KEY,HASH}.
  
      The conditional compiling in the review request is removed, since
      these IOCTLs will be available in stable/10 and stable/11.
  
      Reviewed by:    gallatin
      Sponsored by:   Microsoft
      Differential Revision:  https://reviews.freebsd.org/D12175

Modified:
  stable/11/sys/dev/hyperv/netvsc/if_hn.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/hyperv/netvsc/if_hn.c
==============================================================================
--- stable/11/sys/dev/hyperv/netvsc/if_hn.c	Tue Oct 10 05:25:46 2017	(r324472)
+++ stable/11/sys/dev/hyperv/netvsc/if_hn.c	Tue Oct 10 05:30:49 2017	(r324473)
@@ -3316,6 +3316,8 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 	struct ifreq *ifr = (struct ifreq *)data, ifr_vf;
 	struct ifnet *vf_ifp;
 	int mask, error = 0;
+	struct ifrsskey *ifrk;
+	struct ifrsshash *ifrh;
 
 	switch (cmd) {
 	case SIOCSIFMTU:
@@ -3571,6 +3573,56 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 		}
 		HN_UNLOCK(sc);
 		error = ifmedia_ioctl(ifp, ifr, &sc->hn_media, cmd);
+		break;
+
+	case SIOCGIFRSSHASH:
+		ifrh = (struct ifrsshash *)data;
+		HN_LOCK(sc);
+		if (sc->hn_rx_ring_inuse == 1) {
+			HN_UNLOCK(sc);
+			ifrh->ifrh_func = RSS_FUNC_NONE;
+			ifrh->ifrh_types = 0;
+			break;
+		}
+
+		if (sc->hn_rss_hash & NDIS_HASH_FUNCTION_TOEPLITZ)
+			ifrh->ifrh_func = RSS_FUNC_TOEPLITZ;
+		else
+			ifrh->ifrh_func = RSS_FUNC_PRIVATE;
+
+		ifrh->ifrh_types = 0;
+		if (sc->hn_rss_hash & NDIS_HASH_IPV4)
+			ifrh->ifrh_types |= RSS_TYPE_IPV4;
+		if (sc->hn_rss_hash & NDIS_HASH_TCP_IPV4)
+			ifrh->ifrh_types |= RSS_TYPE_TCP_IPV4;
+		if (sc->hn_rss_hash & NDIS_HASH_IPV6)
+			ifrh->ifrh_types |= RSS_TYPE_IPV6;
+		if (sc->hn_rss_hash & NDIS_HASH_IPV6_EX)
+			ifrh->ifrh_types |= RSS_TYPE_IPV6_EX;
+		if (sc->hn_rss_hash & NDIS_HASH_TCP_IPV6)
+			ifrh->ifrh_types |= RSS_TYPE_TCP_IPV6;
+		if (sc->hn_rss_hash & NDIS_HASH_TCP_IPV6_EX)
+			ifrh->ifrh_types |= RSS_TYPE_TCP_IPV6_EX;
+		HN_UNLOCK(sc);
+		break;
+
+	case SIOCGIFRSSKEY:
+		ifrk = (struct ifrsskey *)data;
+		HN_LOCK(sc);
+		if (sc->hn_rx_ring_inuse == 1) {
+			HN_UNLOCK(sc);
+			ifrk->ifrk_func = RSS_FUNC_NONE;
+			ifrk->ifrk_keylen = 0;
+			break;
+		}
+		if (sc->hn_rss_hash & NDIS_HASH_FUNCTION_TOEPLITZ)
+			ifrk->ifrk_func = RSS_FUNC_TOEPLITZ;
+		else
+			ifrk->ifrk_func = RSS_FUNC_PRIVATE;
+		ifrk->ifrk_keylen = NDIS_HASH_KEYSIZE_TOEPLITZ;
+		memcpy(ifrk->ifrk_key, sc->hn_rss.rss_key,
+		    NDIS_HASH_KEYSIZE_TOEPLITZ);
+		HN_UNLOCK(sc);
 		break;
 
 	default:



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