From owner-svn-src-head@freebsd.org Wed May 11 13:20:30 2016 Return-Path: Delivered-To: svn-src-head@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 C6D8FB36CB2; Wed, 11 May 2016 13:20:30 +0000 (UTC) (envelope-from zbb@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 7F91D1520; Wed, 11 May 2016 13:20:30 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4BDKTg7067859; Wed, 11 May 2016 13:20:29 GMT (envelope-from zbb@FreeBSD.org) Received: (from zbb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4BDKTWX067857; Wed, 11 May 2016 13:20:29 GMT (envelope-from zbb@FreeBSD.org) Message-Id: <201605111320.u4BDKTWX067857@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zbb set sender to zbb@FreeBSD.org using -f From: Zbigniew Bodek Date: Wed, 11 May 2016 13:20:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r299443 - head/sys/dev/vnic X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2016 13:20:30 -0000 Author: zbb Date: Wed May 11 13:20:29 2016 New Revision: 299443 URL: https://svnweb.freebsd.org/changeset/base/299443 Log: Bind CQ interrupts and tasks to separate CPUs in VNIC Delegate interrupts and completion tasks on separate CPUs for each VNIC. Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D6229 Modified: head/sys/dev/vnic/nicvf_main.c head/sys/dev/vnic/nicvf_queues.h Modified: head/sys/dev/vnic/nicvf_main.c ============================================================================== --- head/sys/dev/vnic/nicvf_main.c Wed May 11 12:58:12 2016 (r299442) +++ head/sys/dev/vnic/nicvf_main.c Wed May 11 13:20:29 2016 (r299443) @@ -1296,6 +1296,7 @@ nicvf_release_net_interrupts(struct nicv static int nicvf_allocate_net_interrupts(struct nicvf *nic) { + u_int cpuid; int irq, rid; int qidx; int ret = 0; @@ -1332,6 +1333,20 @@ nicvf_allocate_net_interrupts(struct nic (irq - NICVF_INTR_ID_CQ), device_get_unit(nic->dev)); goto error; } + cpuid = (device_get_unit(nic->dev) * CMP_QUEUE_CNT) + qidx; + cpuid %= mp_ncpus; + /* + * Save CPU ID for later use when system-wide RSS is enabled. + * It will be used to pit the CQ task to the same CPU that got + * interrupted. + */ + nic->qs->cq[qidx].cmp_cpuid = cpuid; + if (bootverbose) { + device_printf(nic->dev, "bind CQ%d IRQ to CPU%d\n", + qidx, cpuid); + } + /* Bind interrupts to the given CPU */ + bus_bind_intr(nic->dev, nic->msix_entries[irq].irq_res, cpuid); } /* Register RBDR interrupt */ Modified: head/sys/dev/vnic/nicvf_queues.h ============================================================================== --- head/sys/dev/vnic/nicvf_queues.h Wed May 11 12:58:12 2016 (r299442) +++ head/sys/dev/vnic/nicvf_queues.h Wed May 11 13:20:29 2016 (r299443) @@ -296,6 +296,7 @@ struct cmp_queue { struct task cmp_task; struct taskqueue *cmp_taskq; + u_int cmp_cpuid; /* CPU to which bind the CQ task */ void *desc; struct q_desc_mem dmem;