From patchwork Tue Apr 2 13:06:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 785320 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FF7980C0C; Tue, 2 Apr 2024 13:07:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712063233; cv=none; b=EsX/weEkqwlNPU37inmErHVraSNXfXaIHb4y0ecEntecm/VpRy++MZotgkch8blmwItNuiMnD9hPRb/AtQ2dujQ+HVcUGIwiy2xFML9uSgo0+y0AYBhcc0n8E1VDsl+ObeQLkSvcJvSQ8J2wehNR1cXGcmQre8o298fds8M5J4Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712063233; c=relaxed/simple; bh=1LVYuvb0wII3osqaUEAerAD393oGrgk64M3p7jVmttA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Xd8S2Ih+PEGgxHLLCy4OwDUJZXqLqEn+ddbLL9bqIfFHSTXWNN9OvYUjAyfv+shUIML9jFTFERPa7UwuCiOJm6NeVmr3xD/Oo05AReNGAB2Rz22NAGVbk2VPWGJw1QXnMM2UJpG3xVMLFtYfYjSlHQGUDhMOXGX6naC7/5OQ/tM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=0e88JAfn; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="0e88JAfn" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=p5X2PaxxYoyr+dxLtTTLAIf/1GAJYNRYTlreOACgm8s=; b=0e88JAfnvVbWfddLlzCK67DrQJ rTt5Bc7GvK7GzIp5FBkSLLzKF9UKrbEtZx952KHcugFf4m9LdHQnpsXkErkrzNtaQp4w9l4KxpOZ5 BCm3GCzrbfA9E83u39HdKJYr0/dZrGaYCuRLkO3yFfwUcUuPpMRyuTm667rSDqQZLlXosRVV7mTjm LAeeC/55yxiCYAS5xgdrdTEaiQbzdHkjT+vWTTIC5L8DAW2phEz+YMCaxePgmmlOfvN6fx6iaw56F 7/l6oC7QUMdS6NiOmyhki1qd/TTEiigUGsz5EhMe5bU/RHECrt8N607kyO6817Y+0oriM5MN+GuhR nzdxR36g==; Received: from [2001:4bb8:199:60a5:c70:4a89:bc61:2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrdqv-0000000BFO9-1FZB; Tue, 02 Apr 2024 13:07:01 +0000 From: Christoph Hellwig To: Jens Axboe , "Martin K. Petersen" Cc: Damien Le Moal , Niklas Cassel , Takashi Sakamoto , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , "Juergen E. Fischer" , Xiang Chen , HighPoint Linux Team , Tyrel Datwyler , Brian King , Lee Duncan , Chris Leech , Mike Christie , John Garry , Jason Yan , Kashyap Desai , Sumit Saxena , Shivasharan S , Chandrakanth patil , Jack Wang , Nilesh Javali , GR-QLogic-Storage-Upstream@marvell.com, Greg Kroah-Hartman , Alim Akhtar , Avri Altman , Bart Van Assche , Krzysztof Kozlowski , Alan Stern , linux-block@vger.kernel.org, linux-ide@vger.kernel.org, linux1394-devel@lists.sourceforge.net, MPT-FusionLinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, megaraidlinux.pdl@broadcom.com, mpi3mr-linuxdrv.pdl@broadcom.com, linux-samsung-soc@vger.kernel.org, linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net Subject: [PATCH 05/23] scsi_transport_fc: add a max_bsg_segments field to struct fc_function_template Date: Tue, 2 Apr 2024 15:06:27 +0200 Message-Id: <20240402130645.653507-6-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240402130645.653507-1-hch@lst.de> References: <20240402130645.653507-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html ibmvfc only supports a single segment for BSG FC passthrough. Instead of having it set a queue limits after creating the BSD queues, add a field so that the FC transport can set it before allocating the queue. Signed-off-by: Christoph Hellwig Reviewed-by: Damien Le Moal --- drivers/scsi/ibmvscsi/ibmvfc.c | 5 +---- drivers/scsi/scsi_transport_fc.c | 2 ++ include/scsi/scsi_transport_fc.h | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index 05b126bfd18b55..a3d1013c83075c 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c @@ -5541,8 +5541,6 @@ static void ibmvfc_tgt_add_rport(struct ibmvfc_target *tgt) rport->supported_classes |= FC_COS_CLASS2; if (be32_to_cpu(tgt->service_parms.class3_parms[0]) & 0x80000000) rport->supported_classes |= FC_COS_CLASS3; - if (rport->rqst_q) - blk_queue_max_segments(rport->rqst_q, 1); } else tgt_dbg(tgt, "rport add failed\n"); spin_unlock_irqrestore(vhost->host->host_lock, flags); @@ -6391,8 +6389,6 @@ static int ibmvfc_probe(struct vio_dev *vdev, const struct vio_device_id *id) ibmvfc_init_sub_crqs(vhost); - if (shost_to_fc_host(shost)->rqst_q) - blk_queue_max_segments(shost_to_fc_host(shost)->rqst_q, 1); dev_set_drvdata(dev, vhost); spin_lock(&ibmvfc_driver_lock); list_add_tail(&vhost->queue, &ibmvfc_head); @@ -6547,6 +6543,7 @@ static struct fc_function_template ibmvfc_transport_functions = { .get_starget_port_id = ibmvfc_get_starget_port_id, .show_starget_port_id = 1, + .max_bsg_segments = 1, .bsg_request = ibmvfc_bsg_request, .bsg_timeout = ibmvfc_bsg_timeout, }; diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 0799700b0fca77..7d088b8da07578 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -4288,6 +4288,7 @@ fc_bsg_hostadd(struct Scsi_Host *shost, struct fc_host_attrs *fc_host) snprintf(bsg_name, sizeof(bsg_name), "fc_host%d", shost->host_no); scsi_init_limits(shost, &lim); + lim.max_segments = min_not_zero(lim.max_segments, i->f->max_bsg_segments); q = bsg_setup_queue(dev, bsg_name, &lim, fc_bsg_dispatch, fc_bsg_job_timeout, i->f->dd_bsg_size); if (IS_ERR(q)) { @@ -4320,6 +4321,7 @@ fc_bsg_rportadd(struct Scsi_Host *shost, struct fc_rport *rport) return -ENOTSUPP; scsi_init_limits(shost, &lim); + lim.max_segments = min_not_zero(lim.max_segments, i->f->max_bsg_segments); q = bsg_setup_queue(dev, dev_name(dev), &lim, fc_bsg_dispatch_prep, fc_bsg_job_timeout, i->f->dd_bsg_size); if (IS_ERR(q)) { diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index 483513c575976c..fd039306ffbb20 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h @@ -709,6 +709,7 @@ struct fc_function_template { int (*vport_delete)(struct fc_vport *); /* bsg support */ + u32 max_bsg_segments; int (*bsg_request)(struct bsg_job *); int (*bsg_timeout)(struct bsg_job *);