Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Jan 2016 20:35:26 +0000 (UTC)
From:      Jim Harris <jimharris@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r293354 - head/sys/dev/nvme
Message-ID:  <201601072035.u07KZQm3034967@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601072035.u07KZQm3034967>