diff mbox series

[01/14] scsi: mpt3sas: Use cached ATA Information VPD page

Message ID 20220302053559.32147-2-martin.petersen@oracle.com
State New
Headers show
Series [01/14] scsi: mpt3sas: Use cached ATA Information VPD page | expand

Commit Message

Martin K. Petersen March 2, 2022, 5:35 a.m. UTC
We now cache VPD page 0x89 so there is no need to request it from the
hardware. Make mpt3sas use the cached page.

Cc: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

Comments

Hannes Reinecke April 20, 2022, 12:06 p.m. UTC | #1
On 3/2/22 06:35, Martin K. Petersen wrote:
> We now cache VPD page 0x89 so there is no need to request it from the
> hardware. Make mpt3sas use the cached page.
> 
> Cc: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
> ---
>   drivers/scsi/mpt3sas/mpt3sas_scsih.c | 18 ++++++++----------
>   1 file changed, 8 insertions(+), 10 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
Martin K. Petersen May 3, 2022, 12:51 a.m. UTC | #2
On Wed, 2 Mar 2022 00:35:46 -0500, Martin K. Petersen wrote:

> We now cache VPD page 0x89 so there is no need to request it from the
> hardware. Make mpt3sas use the cached page.
> 
> 

Applied to 5.19/scsi-queue, thanks!

[01/14] scsi: mpt3sas: Use cached ATA Information VPD page
        https://git.kernel.org/mkp/scsi/c/dc1178767cba
[02/14] scsi: core: Query VPD size before getting full page
        https://git.kernel.org/mkp/scsi/c/c92a6b5d6335
[03/14] scsi: core: Do not truncate INQUIRY data on modern devices
        https://git.kernel.org/mkp/scsi/c/d657700ccac7
[04/14] scsi: core: Pick suitable allocation length in scsi_report_opcode()
        https://git.kernel.org/mkp/scsi/c/e17d63403076
[05/14] scsi: core: Cache VPD pages b0, b1, b2
        https://git.kernel.org/mkp/scsi/c/e60ac0b9e445
[06/14] scsi: sd: Use cached ATA Information VPD page
        https://git.kernel.org/mkp/scsi/c/e38d9e83a376
[07/14] scsi: sd: Switch to using scsi_device VPD pages
        https://git.kernel.org/mkp/scsi/c/7fb019c46eee
[08/14] scsi: sd: Optimal I/O size should be a multiple of reported granularity
        https://git.kernel.org/mkp/scsi/c/631669a256f9
[13/14] scsi: sd: Reorganize DIF/DIX code to avoid calling revalidate twice
        https://git.kernel.org/mkp/scsi/c/1e029397d12f
diff mbox series

Patch

diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 00792767c620..69cd64a26141 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -12585,20 +12585,18 @@  scsih_pci_mmio_enabled(struct pci_dev *pdev)
  */
 bool scsih_ncq_prio_supp(struct scsi_device *sdev)
 {
-	unsigned char *buf;
+	struct scsi_vpd *vpd;
 	bool ncq_prio_supp = false;
 
-	if (!scsi_device_supports_vpd(sdev))
-		return ncq_prio_supp;
-
-	buf = kmalloc(SCSI_VPD_PG_LEN, GFP_KERNEL);
-	if (!buf)
-		return ncq_prio_supp;
+	rcu_read_lock();
+	vpd = rcu_dereference(sdev->vpd_pg89);
+	if (!vpd || vpd->len < 214)
+		goto out;
 
-	if (!scsi_get_vpd_page(sdev, 0x89, buf, SCSI_VPD_PG_LEN))
-		ncq_prio_supp = (buf[213] >> 4) & 1;
+	ncq_prio_supp = (vpd->data[213] >> 4) & 1;
+out:
+	rcu_read_unlock();
 
-	kfree(buf);
 	return ncq_prio_supp;
 }
 /*