From owner-svn-src-all@freebsd.org Thu Jan 7 20:35:27 2016 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 C9C8EA66514; Thu, 7 Jan 2016 20:35:27 +0000 (UTC) (envelope-from jimharris@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 7DBCB1A58; Thu, 7 Jan 2016 20:35:27 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u07KZQS7034968; Thu, 7 Jan 2016 20:35:26 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u07KZQm3034967; Thu, 7 Jan 2016 20:35:26 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201601072035.u07KZQm3034967@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Thu, 7 Jan 2016 20:35:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293354 - head/sys/dev/nvme 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: Thu, 07 Jan 2016 20:35:27 -0000 Author: jimharris Date: Thu Jan 7 20:35:26 2016 New Revision: 293354 URL: https://svnweb.freebsd.org/changeset/base/293354 Log: nvme: replace NVME_CEILING macro with howmany() Suggested by: rpokala MFC after: 3 days Modified: head/sys/dev/nvme/nvme_ctrlr.c Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Thu Jan 7 20:34:06 2016 (r293353) +++ head/sys/dev/nvme/nvme_ctrlr.c Thu Jan 7 20:35:26 2016 (r293354) @@ -42,12 +42,6 @@ __FBSDID("$FreeBSD$"); #include "nvme_private.h" -/* - * Used for calculating number of CPUs to assign to each core and number of I/O - * queues to allocate per controller. - */ -#define NVME_CEILING(num, div) ((((num) - 1) / (div)) + 1) - static void nvme_ctrlr_construct_and_submit_aer(struct nvme_controller *ctrlr, struct nvme_async_event_request *aer); static void nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr); @@ -152,7 +146,7 @@ nvme_ctrlr_construct_io_qpairs(struct nv * a controller could theoretically support fewer I/O queues than * MSI-X vectors. So calculate again here just to be safe. */ - ctrlr->num_cpus_per_ioq = NVME_CEILING(mp_ncpus, ctrlr->num_io_queues); + ctrlr->num_cpus_per_ioq = howmany(mp_ncpus, ctrlr->num_io_queues); ctrlr->ioq = malloc(ctrlr->num_io_queues * sizeof(struct nvme_qpair), M_NVME, M_ZERO | M_WAITOK); @@ -1029,9 +1023,9 @@ nvme_ctrlr_setup_interrupts(struct nvme_ * admin queue. */ ctrlr->num_cpus_per_ioq = max(min_cpus_per_ioq, - NVME_CEILING(mp_ncpus, num_vectors_available - 1)); + howmany(mp_ncpus, num_vectors_available - 1)); - ctrlr->num_io_queues = NVME_CEILING(mp_ncpus, ctrlr->num_cpus_per_ioq); + ctrlr->num_io_queues = howmany(mp_ncpus, ctrlr->num_cpus_per_ioq); num_vectors_requested = ctrlr->num_io_queues + 1; num_vectors_allocated = num_vectors_requested;