From owner-svn-src-all@freebsd.org Tue Aug 25 06:13:00 2015 Return-Path: Delivered-To: svn-src-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 F0E7E99A3D5; Tue, 25 Aug 2015 06:13:00 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (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 C7FC0EF9; Tue, 25 Aug 2015 06:13:00 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7P6D0Ig062767; Tue, 25 Aug 2015 06:13:00 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7P6D07S062766; Tue, 25 Aug 2015 06:13:00 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201508250613.t7P6D07S062766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 25 Aug 2015 06:13:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287124 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2015 06:13:01 -0000 Author: adrian Date: Tue Aug 25 06:12:59 2015 New Revision: 287124 URL: https://svnweb.freebsd.org/changeset/base/287124 Log: Call the new RSS hash calculation function to correctly calculate a hash based on the configured requirements for the protocol. Tested: * UDP IPv6 TX/RX testing, w/ RSS enabled, 82599 ixgbe(4) hardware Modified: head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Tue Aug 25 05:31:00 2015 (r287123) +++ head/sys/netinet6/udp6_usrreq.c Tue Aug 25 06:12:59 2015 (r287124) @@ -840,19 +840,36 @@ udp6_output(struct inpcb *inp, struct mb m->m_pkthdr.csum_data = offsetof(struct udphdr, uh_sum); } - /* - * XXX for now assume UDP is 2-tuple. - * Later on this may become configurable as 4-tuple; - * we should support that. - * - * XXX .. and we should likely cache this in the inpcb. - */ #ifdef RSS - m->m_pkthdr.flowid = rss_hash_ip6_2tuple(faddr, laddr); - M_HASHTYPE_SET(m, M_HASHTYPE_RSS_IPV6); + { + uint32_t hash_val, hash_type; + uint8_t pr; + + pr = inp->inp_socket->so_proto->pr_protocol; + /* + * Calculate an appropriate RSS hash for UDP and + * UDP Lite. + * + * The called function will take care of figuring out + * whether a 2-tuple or 4-tuple hash is required based + * on the currently configured scheme. + * + * Later later on connected socket values should be + * cached in the inpcb and reused, rather than constantly + * re-calculating it. + * + * UDP Lite is a different protocol number and will + * likely end up being hashed as a 2-tuple until + * RSS / NICs grow UDP Lite protocol awareness. + */ + if (rss_proto_software_hash_v6(faddr, laddr, fport, + inp->inp_lport, pr, &hash_val, &hash_type) == 0) { + m->m_pkthdr.flowid = hash_val; + M_HASHTYPE_SET(m, hash_type); + } + } #endif flags = 0; - #ifdef RSS /* * Don't override with the inp cached flowid.