From patchwork Fri May 8 08:38:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 11535949 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C300B14B4 for ; Fri, 8 May 2020 08:39:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ACB8F208DB for ; Fri, 8 May 2020 08:39:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="HymF7E+h" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727088AbgEHIjH (ORCPT ); Fri, 8 May 2020 04:39:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726616AbgEHIjH (ORCPT ); Fri, 8 May 2020 04:39:07 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDFC1C05BD43 for ; Fri, 8 May 2020 01:39:06 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id e16so870636wra.7 for ; Fri, 08 May 2020 01:39:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VHaRXmUthYzSArh/32QvwMeC/h2ZmXYfHepv5d7Xy+k=; b=HymF7E+hcAE3oDDv9hGCJbm3SgXDOzFUF6+m0K5mGnfr2z86ZFss92Imoq7oznjm3x //Aw+loJRlWQFIqeqW3ow02GWu8WO9fGyl0LLbHx2QBP0uxqizy9SjmQQVYmPVyoVP+k 5lF6kkLOGic2mK5y9Kxv96GbdR6O4lc/qYosM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VHaRXmUthYzSArh/32QvwMeC/h2ZmXYfHepv5d7Xy+k=; b=mAxi1ntcvtmVWle1lQrOQLYUXXm3w6vORb1N/Pvu4ffyvrJnvTwSUt92CepGezKcK0 iRSG7sgg5VTA6zd6YOO5BX6BZy3H2S6R6Uh1BmlEOdSLM5rOTJK/qh5Da9xc1kTqBKJp Gs9XQBScHqaIHkLn6eU2n6+gkEY+7JJOBut/SmBwof0uPDs+QZZG1pr08UOt0ilu8DlE nCP6Z+uEV2ajnOmOado9bWlUV0avpUZkU1pHRA9Yf2eA/OM7T4Ksee12DcSVlu/VTdwY amSltvA6XSbZ8UjaUsJaek6OBcZTeLdKAVbiSEyiDVble4+a1UmKnmOSApu/OuFcqNEb fh4g== X-Gm-Message-State: AGi0PuZWR41fTe4BblC4NvPooKjk6uB3xJkdnRxTo2eMqMRvQ0gW89qO +gJz218XjuTKa20l1lJ788ZFRDc/mKVylq9Yic9qOYd/8OS2tLUJ1SRpLgtQsKBnlJcKIHYQj5N aC235mg550kzKi9XyqXUkgc9qa2XFGBL2VbzErdV4IlHV6LRJEFvz8aQPskvuYfj0NrPv5leuFL oAJbq6c1fd+buu X-Google-Smtp-Source: APiQypIIztdXMxpbVjP+9p3bPRJArlxSkdv7ok2B5NHXXwnBC7qziFO2Tb0flqgBZun7LMxXQ9XUtw== X-Received: by 2002:adf:ffc2:: with SMTP id x2mr1582369wrs.273.1588927145121; Fri, 08 May 2020 01:39:05 -0700 (PDT) Received: from it_dev_server1.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id a8sm1810240wrg.85.2020.05.08.01.39.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 01:39:04 -0700 (PDT) From: Chandrakanth Patil To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, shivasharan.srikanteshwara@broadcom.com, anand.lodnoor@broadcom.com, Chandrakanth Patil Subject: [PATCH 1/5] megaraid_sas: Limit device qd to controller qd when device qd is greater than controller qd Date: Fri, 8 May 2020 14:08:34 +0530 Message-Id: <20200508083838.22778-2-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20200508083838.22778-1-chandrakanth.patil@broadcom.com> References: <20200508083838.22778-1-chandrakanth.patil@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Currently, driver assigns pre-defined qd when firmware provided device qd is greater than the controller queue depth. This change assigns controller queue depth instead of pre-defined qd when firmware provided qd is greater than controller queue depth. Signed-off-by: Kashyap Desai Signed-off-by: Chandrakanth Patil Reviewed-by: Hannes Reinecke --- drivers/scsi/megaraid/megaraid_sas_base.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index fb9c3ce..aeb5952 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -1982,9 +1982,8 @@ static void megasas_set_fw_assisted_qd(struct scsi_device *sdev, if (is_target_prop) { tgt_device_qd = le32_to_cpu(instance->tgt_prop->device_qdepth); - if (tgt_device_qd && - (tgt_device_qd <= instance->host->can_queue)) - device_qd = tgt_device_qd; + if (tgt_device_qd) + device_qd = min(instance->host->can_queue, (int)tgt_device_qd); } if (instance->enable_sdev_max_qd && interface_type != UNKNOWN_DRIVE) From patchwork Fri May 8 08:38:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 11535951 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BBD7C139F for ; Fri, 8 May 2020 08:39:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A43DC208DB for ; Fri, 8 May 2020 08:39:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Cdl5o327" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727095AbgEHIjL (ORCPT ); Fri, 8 May 2020 04:39:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726616AbgEHIjK (ORCPT ); Fri, 8 May 2020 04:39:10 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C718C05BD43 for ; Fri, 8 May 2020 01:39:10 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id k1so876541wrx.4 for ; Fri, 08 May 2020 01:39:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0vya7SWjO5MR/s1q4SIzFUX/OwI+bS7G5Dyr0Qzw240=; b=Cdl5o327B83K5/4QizbL3yUCxmx3kTqStVzXDRHye+ky8iThBvlz0T+SAJeIfay9o+ Rwu4rhe5YfJnzbNo2n/J1Z0jVtbkx7UOik2KwWhG3EFASi3oeSwMTm5wXVEjfw/UBEFo 3duhlh5pHNUWlN0t3uhUJjI1z9LfTYiXk/Pu0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0vya7SWjO5MR/s1q4SIzFUX/OwI+bS7G5Dyr0Qzw240=; b=squco6CW2GGtzBg7V923DAe+Wajnhq1NsMWAthPxTs2mJF1vSsMu2ACkHSIPUBJY2L P9ISNus0423HS9LSWIc0ctRcuaoHTjW7YyfRC5yrNf9u02TEF99VJwRI6fF8f6MOHPuM qledq8g/m5MX+wUnjCxmJo0F3le37FhnYrPk4vKUEzdW4CoStKiNxsC2na+6VZozMbT6 9i5flv1YA8OKqqGQK8Xs6FVKGA8qHyLZcMd7BcYP5JM0+3gSGDC/Dk0Qx9UxP6xOL/hl CB+8mkb2sry2lT0wpZ7zyVJLItlAVlBmLRnR5D4X/dkJOGccqLakWJVSs5VJgmTN/3UQ ADvg== X-Gm-Message-State: AGi0Pua4foFxrlgKv5zkDSXL++/ukuhVvsBPN4yVc9dq9DzPP5toYBJy BhEftX4UCP009tIFqyApoJLgujd7bjnLxJzsK6OdBDlNEvx1rUYYZLzjKAe5Ywr90jvn9aX9VZV msjwrbS/e259bQHmYnda78uWiPmiKKvJEDth62zXtzUHOxZI91rIuKJp8R23aD5cQCwbWN7BLKp HcP7Hu6bXtu6Kb X-Google-Smtp-Source: APiQypJaUY91HH2hjMyYOPnV4CxSkwjfp34DZXaz7vK/xOtMgfEghPjldTO6Af6sQjl5eRYylqHJtw== X-Received: by 2002:a5d:50ce:: with SMTP id f14mr1699554wrt.251.1588927148860; Fri, 08 May 2020 01:39:08 -0700 (PDT) Received: from it_dev_server1.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id a8sm1810240wrg.85.2020.05.08.01.39.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 01:39:08 -0700 (PDT) From: Chandrakanth Patil To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, shivasharan.srikanteshwara@broadcom.com, anand.lodnoor@broadcom.com, Chandrakanth Patil Subject: [PATCH 2/5] megaraid_sas: Remove IO buffer hole detection logic Date: Fri, 8 May 2020 14:08:35 +0530 Message-Id: <20200508083838.22778-3-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20200508083838.22778-1-chandrakanth.patil@broadcom.com> References: <20200508083838.22778-1-chandrakanth.patil@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org As blk_queue_virt_boundary() API in slave_configure ensures that no IOs will come with holes/gaps. Hence, code logic to detect the holes/gaps in IO buffer is not required. Signed-off-by: Sumit Saxena Signed-off-by: Chandrakanth Patil Reviewed-by: Hannes Reinecke --- drivers/scsi/megaraid/megaraid_sas_fusion.c | 58 ----------------------------- 1 file changed, 58 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index e0f923b..87f91a38 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -2070,7 +2070,6 @@ static bool megasas_is_prp_possible(struct megasas_instance *instance, struct scsi_cmnd *scmd, int sge_count) { - int i; u32 data_length = 0; struct scatterlist *sg_scmd; bool build_prp = false; @@ -2099,63 +2098,6 @@ megasas_is_prp_possible(struct megasas_instance *instance, build_prp = true; } -/* - * Below code detects gaps/holes in IO data buffers. - * What does holes/gaps mean? - * Any SGE except first one in a SGL starts at non NVME page size - * aligned address OR Any SGE except last one in a SGL ends at - * non NVME page size boundary. - * - * Driver has already informed block layer by setting boundary rules for - * bio merging done at NVME page size boundary calling kernel API - * blk_queue_virt_boundary inside slave_config. - * Still there is possibility of IO coming with holes to driver because of - * IO merging done by IO scheduler. - * - * With SCSI BLK MQ enabled, there will be no IO with holes as there is no - * IO scheduling so no IO merging. - * - * With SCSI BLK MQ disabled, IO scheduler may attempt to merge IOs and - * then sending IOs with holes. - * - * Though driver can request block layer to disable IO merging by calling- - * blk_queue_flag_set(QUEUE_FLAG_NOMERGES, sdev->request_queue) but - * user may tune sysfs parameter- nomerges again to 0 or 1. - * - * If in future IO scheduling is enabled with SCSI BLK MQ, - * this algorithm to detect holes will be required in driver - * for SCSI BLK MQ enabled case as well. - * - * - */ - scsi_for_each_sg(scmd, sg_scmd, sge_count, i) { - if ((i != 0) && (i != (sge_count - 1))) { - if (mega_mod64(sg_dma_len(sg_scmd), mr_nvme_pg_size) || - mega_mod64(sg_dma_address(sg_scmd), - mr_nvme_pg_size)) { - build_prp = false; - break; - } - } - - if ((sge_count > 1) && (i == 0)) { - if ((mega_mod64((sg_dma_address(sg_scmd) + - sg_dma_len(sg_scmd)), - mr_nvme_pg_size))) { - build_prp = false; - break; - } - } - - if ((sge_count > 1) && (i == (sge_count - 1))) { - if (mega_mod64(sg_dma_address(sg_scmd), - mr_nvme_pg_size)) { - build_prp = false; - break; - } - } - } - return build_prp; }