From owner-svn-src-all@FreeBSD.ORG Tue Sep 16 03:26:42 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BA80FA73; Tue, 16 Sep 2014 03:26:42 +0000 (UTC) Received: from svn.freebsd.org (svn.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 8CF729AA; Tue, 16 Sep 2014 03:26:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8G3QgxW087677; Tue, 16 Sep 2014 03:26:42 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8G3QgaK087676; Tue, 16 Sep 2014 03:26:42 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201409160326.s8G3QgaK087676@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 16 Sep 2014 03:26:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r271660 - head/sys/netinet 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.18-1 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, 16 Sep 2014 03:26:42 -0000 Author: adrian Date: Tue Sep 16 03:26:42 2014 New Revision: 271660 URL: http://svnweb.freebsd.org/changeset/base/271660 Log: Ensure the correct software IPv4 hash is done based on the configured RSS parameters, rather than assuming we're hashing IPv4+UDP and IPv4+TCP. Modified: head/sys/netinet/in_rss.c Modified: head/sys/netinet/in_rss.c ============================================================================== --- head/sys/netinet/in_rss.c Tue Sep 16 01:59:19 2014 (r271659) +++ head/sys/netinet/in_rss.c Tue Sep 16 03:26:42 2014 (r271660) @@ -671,7 +671,9 @@ rss_mbuf_software_hash_v4(const struct m * XXX TODO: does the hardware hash on 4-tuple if IP * options are present? */ - if (proto == IPPROTO_TCP && is_frag == 0) { + if ((rss_gethashconfig_local() & RSS_HASHTYPE_RSS_TCP_IPV4) && + (proto == IPPROTO_TCP) && + (is_frag == 0)) { if (m->m_len < iphlen + sizeof(struct tcphdr)) { printf("%s: short TCP frame?\n", __func__); return (-1); @@ -683,7 +685,9 @@ rss_mbuf_software_hash_v4(const struct m proto, hashval, hashtype); - } else if (proto == IPPROTO_UDP && is_frag == 0) { + } else if ((rss_gethashconfig_local() & RSS_HASHTYPE_RSS_UDP_IPV4) && + (proto == IPPROTO_UDP) && + (is_frag == 0)) { uh = (struct udphdr *)((caddr_t)ip + iphlen); if (m->m_len < iphlen + sizeof(struct udphdr)) { printf("%s: short UDP frame?\n", __func__); @@ -695,7 +699,7 @@ rss_mbuf_software_hash_v4(const struct m proto, hashval, hashtype); - } else { + } else if (rss_gethashconfig_local() & RSS_HASHTYPE_RSS_IPV4) { /* Default to 2-tuple hash */ return rss_proto_software_hash_v4(ip->ip_src, ip->ip_dst, 0, /* source port */ @@ -703,6 +707,9 @@ rss_mbuf_software_hash_v4(const struct m 0, /* IPPROTO_IP */ hashval, hashtype); + } else { + printf("%s: no available hashtypes!\n", __func__); + return (-1); } }