From patchwork Thu Jul 1 06:51:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 1499365 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GFpng57MYz9sWX; Thu, 1 Jul 2021 16:53:11 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1lyqZO-0002j0-N1; Thu, 01 Jul 2021 06:53:06 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lyqYB-0001gB-DM for kernel-team@lists.ubuntu.com; Thu, 01 Jul 2021 06:51:51 +0000 Received: from mail-ed1-f69.google.com ([209.85.208.69]) by youngberry.canonical.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lyqYB-0007If-06 for kernel-team@lists.ubuntu.com; Thu, 01 Jul 2021 06:51:51 +0000 Received: by mail-ed1-f69.google.com with SMTP id m4-20020a0564024304b0290394d27742e4so2500125edc.10 for ; Wed, 30 Jun 2021 23:51:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qQZTPHeaAedvQOk9II12IyyL7VQuiyxk0HXqGFsO/LA=; b=YXryd9r2H2pO5ogXjBIOI6MkWX14xj6v3Jf9yB4RJBofuTV/JKeXRDd1vwd+CPHUjg 0vyLXr8o4muuzLrfGJmmpf/MJ40Y9mf83wRMBTlt2534jTfUaRkzrWJ9TB8Co+2cSMXq Vs1nSDxum5qKGqi2paudbCelHgAtOlujoc8kuzGvf0c6iNPPwWguPIb+riVF45sD+cHF z0golsPTYUiroqavrMJGrbRN0PVVZ13KBsAR2SkHOH6jziX+PcPQYbMBHAPWjKScWFHN Y+WjW+DLcVAbzknJ4sWcp1PRWYuOU24Trcf69mMdmO0V+xZ3U3TlJx1yLoccBg1eST4V 6Rzw== X-Gm-Message-State: AOAM533IF+wal41tFvgVPYl+h6vpiGfv7/q4RfzgXOuiut0KXlrFkfNW p4LQsOIzyUP5W2ZR6FWLOkUEVFjT+XKHCOLSK/A1wqTy0jo77oCjmoIhxGT5isdbYKpjXDiIhRp reuh+2z4QzfBKh19+MGRoxVETcvtMl/dHYBRW0wu8cg== X-Received: by 2002:a17:906:2bc6:: with SMTP id n6mr40004468ejg.256.1625122310456; Wed, 30 Jun 2021 23:51:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtV9fG9C+AUvjLXiuVjvKGLctkAy/0irnomHf5DXbcG297oGb6VK/G5jOjU/d5QAquzmXpWw== X-Received: by 2002:a17:906:2bc6:: with SMTP id n6mr40004457ejg.256.1625122310278; Wed, 30 Jun 2021 23:51:50 -0700 (PDT) Received: from localhost.localdomain (xdsl-188-155-177-222.adslplus.ch. [188.155.177.222]) by smtp.gmail.com with ESMTPSA id t15sm10394144ejf.119.2021.06.30.23.51.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Jun 2021 23:51:49 -0700 (PDT) From: Krzysztof Kozlowski To: kernel-team@lists.ubuntu.com Subject: [PATCH][SRU][F-hwe-5.11 09/30] scsi: smartpqi: Add host level stream detection enable Date: Thu, 1 Jul 2021 08:51:20 +0200 Message-Id: <20210701065141.6018-10-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210701065141.6018-1-krzysztof.kozlowski@canonical.com> References: <20210701065141.6018-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Don Brace BugLink: https://bugs.launchpad.net/bugs/1933518 Allow R5/R6 stream detection to be disabled/enabled using sysfs entry enable_stream_detection. Example usage: lsscsi [2:2:0:0] storage Adaptec 3258P-32i /e 0010 ^ | +---- NOTE: here host is host2 find /sys -name \*enable_stream\* /sys/devices/pci0000:36/0000:36:00.0/0000:37:00.0/0000:38:00.0/0000:39:00.0/host2/scsi_host/host2/enable_stream_detection /sys/devices/pci0000:5b/0000:5b:00.0/0000:5c:00.0/host3/scsi_host/host3/enable_stream_detection Current stream detection: cat /sys/devices/pci0000:36/0000:36:00.0/0000:37:00.0/0000:38:00.0/0000:39:00.0/host2/scsi_host/host2/enable_stream_detection 1 Turn off stream detection: echo 0 > /sys/devices/pci0000:36/0000:36:00.0/0000:37:00.0/0000:38:00.0/0000:39:00.0/host2/scsi_host/host2/enable_stream_detection Turn on stream detection: echo 1 > /sys/devices/pci0000:36/0000:36:00.0/0000:37:00.0/0000:38:00.0/0000:39:00.0/host2/scsi_host/host2/enable_stream_detection Link: https://lore.kernel.org/r/161549376281.25025.1132304698441513738.stgit@brunhilda Reviewed-by: Scott Benesh Reviewed-by: Mike McGowen Reviewed-by: Scott Teel Reviewed-by: Kevin Barnett Reviewed-by: Martin Wilck Signed-off-by: Don Brace Signed-off-by: Martin K. Petersen (cherry picked from commit 5be746d7d74b0f40128ac6f1d1ba30bc05770beb) Signed-off-by: Krzysztof Kozlowski --- drivers/scsi/smartpqi/smartpqi_init.c | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index fabf3f51ae5e..e6b10aca4398 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -6696,6 +6696,34 @@ static ssize_t pqi_lockup_action_store(struct device *dev, return -EINVAL; } +static ssize_t pqi_host_enable_stream_detection_show(struct device *dev, + struct device_attribute *attr, char *buffer) +{ + struct Scsi_Host *shost = class_to_shost(dev); + struct pqi_ctrl_info *ctrl_info = shost_to_hba(shost); + + return scnprintf(buffer, 10, "%x\n", + ctrl_info->enable_stream_detection); +} + +static ssize_t pqi_host_enable_stream_detection_store(struct device *dev, + struct device_attribute *attr, const char *buffer, size_t count) +{ + struct Scsi_Host *shost = class_to_shost(dev); + struct pqi_ctrl_info *ctrl_info = shost_to_hba(shost); + u8 set_stream_detection = 0; + + if (kstrtou8(buffer, 0, &set_stream_detection)) + return -EINVAL; + + if (set_stream_detection > 0) + set_stream_detection = 1; + + ctrl_info->enable_stream_detection = set_stream_detection; + + return count; +} + static ssize_t pqi_host_enable_r5_writes_show(struct device *dev, struct device_attribute *attr, char *buffer) { @@ -6758,6 +6786,9 @@ static DEVICE_ATTR(vendor, 0444, pqi_vendor_show, NULL); static DEVICE_ATTR(rescan, 0200, NULL, pqi_host_rescan_store); static DEVICE_ATTR(lockup_action, 0644, pqi_lockup_action_show, pqi_lockup_action_store); +static DEVICE_ATTR(enable_stream_detection, 0644, + pqi_host_enable_stream_detection_show, + pqi_host_enable_stream_detection_store); static DEVICE_ATTR(enable_r5_writes, 0644, pqi_host_enable_r5_writes_show, pqi_host_enable_r5_writes_store); static DEVICE_ATTR(enable_r6_writes, 0644, @@ -6771,6 +6802,7 @@ static struct device_attribute *pqi_shost_attrs[] = { &dev_attr_vendor, &dev_attr_rescan, &dev_attr_lockup_action, + &dev_attr_enable_stream_detection, &dev_attr_enable_r5_writes, &dev_attr_enable_r6_writes, NULL