linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: Sagi Grimberg <sagi@grimberg.me>,
	Max Gurtovoy <maxg@mellanox.com>,
	Bart Van Assche <bvanassche@acm.org>,
	linux-rdma@vger.kernel.org, linux-scsi@vger.kernel.org,
	megaraidlinux.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com,
	linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 5/8] IB/iser: set virt_boundary_mask in the scsi host
Date: Mon, 17 Jun 2019 14:19:57 +0200	[thread overview]
Message-ID: <20190617122000.22181-6-hch@lst.de> (raw)
In-Reply-To: <20190617122000.22181-1-hch@lst.de>

This ensures all proper DMA layer handling is taken care of by the
SCSI midlayer.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/infiniband/ulp/iser/iscsi_iser.c | 35 +++++-------------------
 1 file changed, 7 insertions(+), 28 deletions(-)

diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 9c185a8dabd3..841b66397a57 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -613,6 +613,7 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
 	struct Scsi_Host *shost;
 	struct iser_conn *iser_conn = NULL;
 	struct ib_conn *ib_conn;
+	struct ib_device *ib_dev;
 	u32 max_fr_sectors;
 
 	shost = iscsi_host_alloc(&iscsi_iser_sht, 0, 0);
@@ -643,16 +644,19 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
 		}
 
 		ib_conn = &iser_conn->ib_conn;
+		ib_dev = ib_conn->device->ib_device;
 		if (ib_conn->pi_support) {
-			u32 sig_caps = ib_conn->device->ib_device->attrs.sig_prot_cap;
+			u32 sig_caps = ib_dev->attrs.sig_prot_cap;
 
 			scsi_host_set_prot(shost, iser_dif_prot_caps(sig_caps));
 			scsi_host_set_guard(shost, SHOST_DIX_GUARD_IP |
 						   SHOST_DIX_GUARD_CRC);
 		}
 
-		if (iscsi_host_add(shost,
-				   ib_conn->device->ib_device->dev.parent)) {
+		if (!(ib_dev->attrs.device_cap_flags & IB_DEVICE_SG_GAPS_REG))
+			shost->virt_boundary_mask = ~MASK_4K;
+
+		if (iscsi_host_add(shost, ib_dev->dev.parent)) {
 			mutex_unlock(&iser_conn->state_mutex);
 			goto free_host;
 		}
@@ -958,30 +962,6 @@ static umode_t iser_attr_is_visible(int param_type, int param)
 	return 0;
 }
 
-static int iscsi_iser_slave_alloc(struct scsi_device *sdev)
-{
-	struct iscsi_session *session;
-	struct iser_conn *iser_conn;
-	struct ib_device *ib_dev;
-
-	mutex_lock(&unbind_iser_conn_mutex);
-
-	session = starget_to_session(scsi_target(sdev))->dd_data;
-	iser_conn = session->leadconn->dd_data;
-	if (!iser_conn) {
-		mutex_unlock(&unbind_iser_conn_mutex);
-		return -ENOTCONN;
-	}
-	ib_dev = iser_conn->ib_conn.device->ib_device;
-
-	if (!(ib_dev->attrs.device_cap_flags & IB_DEVICE_SG_GAPS_REG))
-		blk_queue_virt_boundary(sdev->request_queue, ~MASK_4K);
-
-	mutex_unlock(&unbind_iser_conn_mutex);
-
-	return 0;
-}
-
 static struct scsi_host_template iscsi_iser_sht = {
 	.module                 = THIS_MODULE,
 	.name                   = "iSCSI Initiator over iSER",
@@ -994,7 +974,6 @@ static struct scsi_host_template iscsi_iser_sht = {
 	.eh_device_reset_handler= iscsi_eh_device_reset,
 	.eh_target_reset_handler = iscsi_eh_recover_target,
 	.target_alloc		= iscsi_target_alloc,
-	.slave_alloc            = iscsi_iser_slave_alloc,
 	.proc_name              = "iscsi_iser",
 	.this_id                = -1,
 	.track_queue_depth	= 1,
-- 
2.20.1


  parent reply	other threads:[~2019-06-17 12:20 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 12:19 properly communicate queue limits to the DMA layer v2 Christoph Hellwig
2019-06-17 12:19 ` [PATCH 1/8] scsi: add a host / host template field for the virt boundary Christoph Hellwig
2019-06-17 20:51   ` Bart Van Assche
2019-06-18  0:35   ` Ming Lei
2019-06-20  6:17     ` Kashyap Desai
2019-06-17 12:19 ` [PATCH 2/8] scsi: take the DMA max mapping size into account Christoph Hellwig
2019-06-17 20:56   ` Bart Van Assche
2019-07-22  6:00     ` Ming Lei
2019-07-22  6:18       ` Dexuan-Linux Cui
2019-07-22  7:40       ` Damien Le Moal
2019-06-17 12:19 ` [PATCH 3/8] ufshcd: set max_segment_size in the scsi host template Christoph Hellwig
2019-06-17 20:58   ` Bart Van Assche
2019-06-17 12:19 ` [PATCH 4/8] storvsc: set virt_boundary_mask " Christoph Hellwig
2019-06-17 20:59   ` Bart Van Assche
2019-06-17 12:19 ` Christoph Hellwig [this message]
2019-06-17 17:34   ` [PATCH 5/8] IB/iser: set virt_boundary_mask in the scsi host Sagi Grimberg
2019-06-24 22:32   ` Max Gurtovoy
2019-06-17 12:19 ` [PATCH 6/8] IB/srp: " Christoph Hellwig
2019-06-17 17:35   ` Sagi Grimberg
2019-06-17 21:01   ` Bart Van Assche
2019-06-24 22:33   ` Max Gurtovoy
2019-06-17 12:19 ` [PATCH 7/8] mpt3sas: set an unlimited max_segment_size for SAS 3.0 HBAs Christoph Hellwig
2019-06-18  0:46   ` Ming Lei
2019-06-20  7:04     ` Suganath Prabu Subramani
2019-06-20  7:08       ` Suganath Prabu Subramani
2019-06-17 12:20 ` [PATCH 8/8] megaraid_sas: set an unlimited max_segment_size Christoph Hellwig
2019-07-15 16:58 ` properly communicate queue limits to the DMA layer v2 Christoph Hellwig
2019-07-15 17:33   ` Martin K. Petersen
2019-07-15 17:46     ` Christoph Hellwig
2019-07-17  3:07       ` Martin K. Petersen

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=20190617122000.22181-6-hch@lst.de \
    --to=hch@lst.de \
    --cc=MPT-FusionLinux.pdl@broadcom.com \
    --cc=bvanassche@acm.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=maxg@mellanox.com \
    --cc=megaraidlinux.pdl@broadcom.com \
    --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).