From owner-svn-src-stable-11@freebsd.org Sun Aug 21 17:26:17 2016 Return-Path: Delivered-To: svn-src-stable-11@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 95B07BC09B7; Sun, 21 Aug 2016 17:26:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 4E62E1CE4; Sun, 21 Aug 2016 17:26:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7LHQGgN094403; Sun, 21 Aug 2016 17:26:16 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7LHQGed094401; Sun, 21 Aug 2016 17:26:16 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201608211726.u7LHQGed094401@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sun, 21 Aug 2016 17:26:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304568 - stable/11/sys/net X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Aug 2016 17:26:17 -0000 Author: ae Date: Sun Aug 21 17:26:16 2016 New Revision: 304568 URL: https://svnweb.freebsd.org/changeset/base/304568 Log: MFC r304313: Teach netisr_get_cpuid() to limit a given value to supported by netisr. Use netisr_get_cpuid() in netisr_select_cpuid() to limit cpuid value returned by protocol to be sure that it is not greather than nws_count. PR: 211836 Modified: stable/11/sys/net/if_epair.c stable/11/sys/net/netisr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if_epair.c ============================================================================== --- stable/11/sys/net/if_epair.c Sun Aug 21 16:06:00 2016 (r304567) +++ stable/11/sys/net/if_epair.c Sun Aug 21 17:26:16 2016 (r304568) @@ -807,9 +807,9 @@ epair_clone_create(struct if_clone *ifc, * cache locality but we can at least allow parallelism. */ sca->cpuid = - netisr_get_cpuid(sca->ifp->if_index % netisr_get_cpucount()); + netisr_get_cpuid(sca->ifp->if_index); scb->cpuid = - netisr_get_cpuid(scb->ifp->if_index % netisr_get_cpucount()); + netisr_get_cpuid(scb->ifp->if_index); /* Initialise pseudo media types. */ ifmedia_init(&sca->media, 0, epair_media_change, epair_media_status); Modified: stable/11/sys/net/netisr.c ============================================================================== --- stable/11/sys/net/netisr.c Sun Aug 21 16:06:00 2016 (r304567) +++ stable/11/sys/net/netisr.c Sun Aug 21 17:26:16 2016 (r304568) @@ -272,10 +272,7 @@ u_int netisr_get_cpuid(u_int cpunumber) { - KASSERT(cpunumber < nws_count, ("%s: %u > %u", __func__, cpunumber, - nws_count)); - - return (nws_array[cpunumber]); + return (nws_array[cpunumber % nws_count]); } /* @@ -810,10 +807,12 @@ netisr_select_cpuid(struct netisr_proto * dispatch. In the queued case, fall back on the SOURCE * policy. */ - if (*cpuidp != NETISR_CPUID_NONE) + if (*cpuidp != NETISR_CPUID_NONE) { + *cpuidp = netisr_get_cpuid(*cpuidp); return (m); + } if (dispatch_policy == NETISR_DISPATCH_HYBRID) { - *cpuidp = curcpu; + *cpuidp = netisr_get_cpuid(curcpu); return (m); } policy = NETISR_POLICY_SOURCE;