From owner-svn-soc-all@freebsd.org Mon Jun 29 05:21:07 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2134D98D916 for ; Mon, 29 Jun 2015 05:21:07 +0000 (UTC) (envelope-from btw@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 07EE8120E for ; Mon, 29 Jun 2015 05:21:07 +0000 (UTC) (envelope-from btw@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5T5L6il083231 for ; Mon, 29 Jun 2015 05:21:06 GMT (envelope-from btw@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.9/8.14.9/Submit) id t5T5L5AP082598 for svn-soc-all@FreeBSD.org; Mon, 29 Jun 2015 05:21:05 GMT (envelope-from btw@FreeBSD.org) Date: Mon, 29 Jun 2015 05:21:05 GMT Message-Id: <201506290521.t5T5L5AP082598@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to btw@FreeBSD.org using -f From: btw@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r287709 - in soc2015/btw/head/sys: netinet netinet6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2015 05:21:07 -0000 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: