linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
To: kbusch@kernel.org, hch@lst.de, sagi@grimberg.me
Cc: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>,
	linux-nvme@lists.infradead.org
Subject: [PATCH V4 3/3] nvme-pci: get rid of the division in the fast path
Date: Thu, 16 Jul 2020 17:51:39 -0700	[thread overview]
Message-ID: <20200717005139.18923-4-chaitanya.kulkarni@wdc.com> (raw)
In-Reply-To: <20200717005139.18923-1-chaitanya.kulkarni@wdc.com>

Since we have a macro for calculating the size of the ctrl page we can
remove the division in the fast path for nvme-pci in nvme_unmap_data().

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/nvme/host/pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 3c852a8f18ed..616db1ae137c 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -513,7 +513,8 @@ static inline bool nvme_pci_use_sgls(struct nvme_dev *dev, struct request *req)
 static void nvme_unmap_data(struct nvme_dev *dev, struct request *req)
 {
 	struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
-	const int last_prp = NVME_CTRL_PAGE_SIZE / sizeof(__le64) - 1;
+	const int last_prp = (NVME_CTRL_PAGE_SIZE >> ilog2(sizeof(__le64))) - 1;
+
 	dma_addr_t dma_addr = iod->first_dma, next_dma_addr;
 	int i;
 
-- 
2.26.0


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  parent reply	other threads:[~2020-07-17  0:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-17  0:51 [PATCH V4 0/3] nvme: fix iod size calculation in nvme_probe() Chaitanya Kulkarni
2020-07-17  0:51 ` [PATCH V4 1/3] nvme-core: replace ctrl page size with a macro Chaitanya Kulkarni
2020-07-17  0:51 ` [PATCH V4 2/3] nvme-pci: use max of PRP or SGL for iod size Chaitanya Kulkarni
2020-07-17  0:51 ` Chaitanya Kulkarni [this message]
2020-07-17  2:32   ` [PATCH V4 3/3] nvme-pci: get rid of the division in the fast path Keith Busch
2020-07-17  2:33     ` Chaitanya Kulkarni
2020-07-20 13:21 ` [PATCH V4 0/3] nvme: fix iod size calculation in nvme_probe() Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200717005139.18923-4-chaitanya.kulkarni@wdc.com \
    --to=chaitanya.kulkarni@wdc.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).