Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jun 2015 05:21:05 GMT
From:      btw@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r287709 - in soc2015/btw/head/sys: netinet netinet6
Message-ID:  <201506290521.t5T5L5AP082598@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: btw
Date: Mon Jun 29 05:21:04 2015
New Revision: 287709
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=287709

Log:
  Extend the socket layer to allow querying the RSS affinity of a socket
  using socket options.

Modified:
  soc2015/btw/head/sys/netinet/in.h
  soc2015/btw/head/sys/netinet/ip_output.c
  soc2015/btw/head/sys/netinet6/in6.h
  soc2015/btw/head/sys/netinet6/ip6_output.c

Modified: soc2015/btw/head/sys/netinet/in.h
==============================================================================
--- soc2015/btw/head/sys/netinet/in.h	Mon Jun 29 01:31:57 2015	(r287708)
+++ soc2015/btw/head/sys/netinet/in.h	Mon Jun 29 05:21:04 2015	(r287709)
@@ -493,6 +493,7 @@
 #define	IP_RSSBUCKETID		92   /* get RSS flowid -> bucket mapping */
 #define	IP_RECVFLOWID		93   /* bool; receive IP flowid/flowtype w/ datagram */
 #define	IP_RECVRSSBUCKETID	94   /* bool; receive IP RSS bucket id w/ datagram */
+#define	IP_RSSCPUID		95   /* int; get RSS flowid -> cpuid mapping */
 
 /*
  * Defaults and limits for options

Modified: soc2015/btw/head/sys/netinet/ip_output.c
==============================================================================
--- soc2015/btw/head/sys/netinet/ip_output.c	Mon Jun 29 01:31:57 2015	(r287708)
+++ soc2015/btw/head/sys/netinet/ip_output.c	Mon Jun 29 05:21:04 2015	(r287709)
@@ -882,6 +882,7 @@
 	int	error, optval;
 #ifdef	RSS
 	uint32_t rss_bucket;
+	uint32_t rss_cpuid;
 	int retval;
 #endif
 
@@ -1188,6 +1189,7 @@
 		case IP_RECVFLOWID:
 #ifdef	RSS
 		case IP_RSSBUCKETID:
+		case IP_RSSCPUID:
 		case IP_RECVRSSBUCKETID:
 #endif
 			switch (sopt->sopt_name) {
@@ -1267,6 +1269,14 @@
 				else
 					error = EINVAL;
 				break;
+			case IP_RSSCPUID:
+				rss_cpuid = rss_hash2cpuid(inp->inp_flowid,
+				    inp->inp_flowtype);
+				if (rss_cpuid != NETISR_CPUID_NONE)
+					optval = rss_cpuid;
+				else
+					error = EINVAL;
+				break;
 			case IP_RECVRSSBUCKETID:
 				optval = OPTBIT2(INP_RECVRSSBUCKETID);
 				break;

Modified: soc2015/btw/head/sys/netinet6/in6.h
==============================================================================
--- soc2015/btw/head/sys/netinet6/in6.h	Mon Jun 29 01:31:57 2015	(r287708)
+++ soc2015/btw/head/sys/netinet6/in6.h	Mon Jun 29 05:21:04 2015	(r287709)
@@ -485,6 +485,7 @@
 #define	IPV6_FLOWID		67 /* int; flowid of given socket */
 #define	IPV6_FLOWTYPE		68 /* int; flowtype of given socket */
 #define	IPV6_RSSBUCKETID	69 /* int; RSS bucket ID of given socket */
+#define	IPV6_RSSCPUID		70 /* int; RSS cpu ID of given socket */
 
 /*
  * The following option is private; do not use it from user applications.

Modified: soc2015/btw/head/sys/netinet6/ip6_output.c
==============================================================================
--- soc2015/btw/head/sys/netinet6/ip6_output.c	Mon Jun 29 01:31:57 2015	(r287708)
+++ soc2015/btw/head/sys/netinet6/ip6_output.c	Mon Jun 29 05:21:04 2015	(r287709)
@@ -1299,6 +1299,7 @@
 	struct thread *td;
 #ifdef	RSS
 	uint32_t rss_bucket;
+	uint32_t rss_cpuid;
 	int retval;
 #endif
 
@@ -1813,6 +1814,7 @@
 			case IPV6_FLOWTYPE:
 #ifdef	RSS
 			case IPV6_RSSBUCKETID:
+			case IPV6_RSSCPUID:
 #endif
 				switch (optname) {
 
@@ -1894,6 +1896,16 @@
 					else
 						error = EINVAL;
 					break;
+
+				case IPV6_RSSCPUID:
+					rss_cpuid =
+					    rss_hash2cpuid(in6p->inp_flowid,
+					    in6p->inp_flowtype);
+					if (rss_cpuid != NETISR_CPUID_NONE)
+						optval = rss_cpuid;
+					else
+						error = EINVAL;
+					break;
 #endif
 
 				case IPV6_BINDMULTI:



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