All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: axboe@kernel.dk, keith.busch@intel.com
Cc: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 06/10] nvme: allow for size limitations from transport drivers
Date: Mon,  6 Jun 2016 23:20:48 +0200	[thread overview]
Message-ID: <1465248052-17811-7-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1465248052-17811-1-git-send-email-hch@lst.de>

Some transport drivers may have a lower transfer size than
the controller. So allow the transport to set it in the
controller max_hw_sectors.

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 1a51584..b582c11 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1088,6 +1088,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
 	struct nvme_id_ctrl *id;
 	u64 cap;
 	int ret, page_shift;
+	u32 max_hw_sectors;
 
 	ret = ctrl->ops->reg_read32(ctrl, NVME_REG_VS, &ctrl->vs);
 	if (ret) {
@@ -1120,9 +1121,11 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
 	memcpy(ctrl->model, id->mn, sizeof(id->mn));
 	memcpy(ctrl->firmware_rev, id->fr, sizeof(id->fr));
 	if (id->mdts)
-		ctrl->max_hw_sectors = 1 << (id->mdts + page_shift - 9);
+		max_hw_sectors = 1 << (id->mdts + page_shift - 9);
 	else
-		ctrl->max_hw_sectors = UINT_MAX;
+		max_hw_sectors = UINT_MAX;
+	ctrl->max_hw_sectors =
+		min_not_zero(ctrl->max_hw_sectors, max_hw_sectors);
 
 	if ((ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) && id->vs[3]) {
 		unsigned int max_hw_sectors;
-- 
2.1.4

WARNING: multiple messages have this Message-ID (diff)
From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH 06/10] nvme: allow for size limitations from transport drivers
Date: Mon,  6 Jun 2016 23:20:48 +0200	[thread overview]
Message-ID: <1465248052-17811-7-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1465248052-17811-1-git-send-email-hch@lst.de>

Some transport drivers may have a lower transfer size than
the controller. So allow the transport to set it in the
controller max_hw_sectors.

Reviewed-by: Sagi Grimberg <sagi at grimberg.me>
Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 drivers/nvme/host/core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 1a51584..b582c11 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1088,6 +1088,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
 	struct nvme_id_ctrl *id;
 	u64 cap;
 	int ret, page_shift;
+	u32 max_hw_sectors;
 
 	ret = ctrl->ops->reg_read32(ctrl, NVME_REG_VS, &ctrl->vs);
 	if (ret) {
@@ -1120,9 +1121,11 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
 	memcpy(ctrl->model, id->mn, sizeof(id->mn));
 	memcpy(ctrl->firmware_rev, id->fr, sizeof(id->fr));
 	if (id->mdts)
-		ctrl->max_hw_sectors = 1 << (id->mdts + page_shift - 9);
+		max_hw_sectors = 1 << (id->mdts + page_shift - 9);
 	else
-		ctrl->max_hw_sectors = UINT_MAX;
+		max_hw_sectors = UINT_MAX;
+	ctrl->max_hw_sectors =
+		min_not_zero(ctrl->max_hw_sectors, max_hw_sectors);
 
 	if ((ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) && id->vs[3]) {
 		unsigned int max_hw_sectors;
-- 
2.1.4

  parent reply	other threads:[~2016-06-06 21:20 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-06 21:20 general preparation for NVMe over Fabrics support Christoph Hellwig
2016-06-06 21:20 ` Christoph Hellwig
2016-06-06 21:20 ` [PATCH 01/10] nvme.h: add RTD3R, RTD3E and OAES fields Christoph Hellwig
2016-06-06 21:20   ` Christoph Hellwig
2016-06-07  8:10   ` Johannes Thumshirn
2016-06-07  8:10     ` Johannes Thumshirn
2016-06-07  8:10     ` Johannes Thumshirn
2016-06-07  8:38     ` Johannes Thumshirn
2016-06-07  8:38       ` Johannes Thumshirn
2016-06-07  8:38       ` Johannes Thumshirn
2016-06-07 10:49     ` Christoph Hellwig
2016-06-07 10:49       ` Christoph Hellwig
2016-06-06 21:20 ` [PATCH 02/10] nvme.h: Add get_log_page command strucure Christoph Hellwig
2016-06-06 21:20   ` Christoph Hellwig
2016-06-06 21:20 ` [PATCH 03/10] nvme.h: add NVM command set SQE/CQE size defines Christoph Hellwig
2016-06-06 21:20   ` Christoph Hellwig
2016-06-06 21:20 ` [PATCH 04/10] nvme.h: add AER constants Christoph Hellwig
2016-06-06 21:20   ` Christoph Hellwig
2016-06-06 21:20 ` [PATCH 05/10] nvme.h: add constants for PSDT and FUSE values Christoph Hellwig
2016-06-06 21:20   ` Christoph Hellwig
2016-06-06 21:20 ` Christoph Hellwig [this message]
2016-06-06 21:20   ` [PATCH 06/10] nvme: allow for size limitations from transport drivers Christoph Hellwig
2016-06-06 21:20 ` [PATCH 07/10] nvme: factor out a add nvme_is_write helper Christoph Hellwig
2016-06-06 21:20   ` Christoph Hellwig
2016-06-06 21:20 ` [PATCH 08/10] nvme: move the workaround for I/O queue-less controllers from PCIe to core Christoph Hellwig
2016-06-06 21:20   ` Christoph Hellwig
2016-06-06 21:20 ` [PATCH 09/10] nvme: update nvme_cancel_io() a bit Christoph Hellwig
2016-06-06 21:20   ` Christoph Hellwig
2016-06-06 21:20 ` [PATCH 10/10] nvme: move nvme_cancel_request() to core.c Christoph Hellwig
2016-06-06 21:20   ` Christoph Hellwig
2016-06-09 16:38 ` general preparation for NVMe over Fabrics support Keith Busch
2016-06-09 16:38   ` Keith Busch
2016-06-09 17:12   ` Christoph Hellwig
2016-06-09 17:12     ` Christoph Hellwig
2016-06-12 13:33   ` Jens Axboe
2016-06-12 13:33     ` Jens Axboe
2016-06-13  8:03     ` Christoph Hellwig
2016-06-13  8:03       ` 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=1465248052-17811-7-git-send-email-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=keith.busch@intel.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.