From owner-freebsd-net@FreeBSD.ORG Wed May 21 17:32:59 2014 Return-Path: Delivered-To: freebsd-net@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 C32C6947; Wed, 21 May 2014 17:32:59 +0000 (UTC) Received: from mail.ignoranthack.me (ignoranthack.me [199.102.79.106]) (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 A49252CE3; Wed, 21 May 2014 17:32:59 +0000 (UTC) Received: from [10.12.72.220] (unknown [69.164.56.1]) (using SSLv3 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: sbruno@ignoranthack.me) by mail.ignoranthack.me (Postfix) with ESMTPSA id B28AB194138; Wed, 21 May 2014 17:32:57 +0000 (UTC) Subject: Re: [rfc] add non-contiguous CPU ID support to in_rss.c From: Sean Bruno Reply-To: sbruno@freebsd.org To: Adrian Chadd In-Reply-To: References: Content-Type: text/plain; charset="us-ascii" Date: Wed, 21 May 2014 06:25:18 -0700 Message-ID: <1400678718.973.0.camel@bruno> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: FreeBSD Net X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 May 2014 17:32:59 -0000 On Tue, 2014-05-20 at 23:52 -0700, Adrian Chadd wrote: > Hi Robert, > > This patch uses CPU_FIRST() and CPU_NEXT() to iterate over the CPU IDs. > > Think this is alright? > > -a > > > Index: sys/netinet/in_rss.c > =================================================================== > --- sys/netinet/in_rss.c (revision 266429) > +++ sys/netinet/in_rss.c (working copy) > @@ -176,6 +176,7 @@ > rss_init(__unused void *arg) > { > u_int i; > + u_int cpuid; > > /* > * Validate tunables, coerce to sensible values. > @@ -245,11 +246,12 @@ > > /* > * Set up initial CPU assignments: round-robin by default. > - * > - * XXXRW: Need a mapping to non-contiguous IDs here. > */ > - for (i = 0; i < rss_buckets; i++) > - rss_table[i].rte_cpu = i % rss_ncpus; > + cpuid = CPU_FIRST(); > + for (i = 0; i < rss_buckets; i++) { > + rss_table[i].rte_cpu = cpuid; > + cpuid = CPU_NEXT(cpuid); > + } > > /* > * Randomize rrs_key. > __ Yah, I did something similar in igb(4) to assign queues to CPU more correctly. sean