linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: <jejb@linux.vnet.ibm.com>, <martin.petersen@oracle.com>
Cc: <linuxarm@huawei.com>, <linux-kernel@vger.kernel.org>,
	<linux-scsi@vger.kernel.org>, <yanaijie@huawei.com>,
	<chenxiang66@hisilicon.com>, <luojiaxing@huawei.com>,
	John Garry <john.garry@huawei.com>
Subject: [PATCH 2/6] scsi: libsas: Try to retain programmed min linkrate for SATA min pathway unmatch fixing
Date: Fri, 12 Apr 2019 16:57:53 +0800	[thread overview]
Message-ID: <1555059478-36224-3-git-send-email-john.garry@huawei.com> (raw)
In-Reply-To: <1555059478-36224-1-git-send-email-john.garry@huawei.com>

Currently for fixing the linkrate matching during discovery such that
the linkrate of a SATA PHY does not exceed min pathway to initiator,
we set the SATA PHY programmed min linkrate to the same value as the
programmed max linkrate.

This is unnecessary, and we should be able to keep the same programmed
min linkrate if it is already lower than this new max programmed linkrate.

This patch makes that change.

In effect, this will not make much difference since we generally will
negotiate a linkrate at the programmed max linkrate, and the programmed
min linkrate will have no impact.

Signed-off-by: John Garry <john.garry@huawei.com>
---
 drivers/scsi/libsas/sas_expander.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index 93f297199d4c..dfdf3c94d326 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -826,9 +826,14 @@ static struct domain_device *sas_ex_discover_end_dev(
 #ifdef CONFIG_SCSI_SAS_ATA
 	if ((phy->attached_tproto & SAS_PROTOCOL_STP) || phy->attached_sata_dev) {
 		if (child->linkrate > parent->min_linkrate) {
+			struct sas_phy *cphy = child->phy;
+			enum sas_linkrate min_prate = cphy->minimum_linkrate,
+				parent_min_lrate = parent->min_linkrate,
+				min_linkrate = (min_prate > parent_min_lrate) ?
+					       parent_min_lrate : 0;
 			struct sas_phy_linkrates rates = {
 				.maximum_linkrate = parent->min_linkrate,
-				.minimum_linkrate = parent->min_linkrate,
+				.minimum_linkrate = min_linkrate,
 			};
 			int ret;
 
-- 
2.17.1


  parent reply	other threads:[~2019-04-12  8:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-12  8:57 [PATCH 0/6] libsas: Some minor improvements and tidy-up John Garry
2019-04-12  8:57 ` [PATCH 1/6] scsi: libsas: Stop hardcoding SAS address length John Garry
2019-04-12  8:57 ` John Garry [this message]
2019-04-12  8:57 ` [PATCH 3/6] scsi: libsas: Improve vague log in SAS rediscovery John Garry
2019-04-12  8:57 ` [PATCH 4/6] scsi: libsas: Inject revalidate event for root port event John Garry
2019-04-12  8:57 ` [PATCH 5/6] scsi: libsas: Do discovery on empty PHY to update PHY info John Garry
2019-04-12  8:57 ` [PATCH 6/6] scsi: libsas: Print expander PHY indexes in decimal John Garry
2019-04-15 23:33 ` [PATCH 0/6] libsas: Some minor improvements and tidy-up Martin K. Petersen
2019-04-24 20:00   ` John Garry

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=1555059478-36224-3-git-send-email-john.garry@huawei.com \
    --to=john.garry@huawei.com \
    --cc=chenxiang66@hisilicon.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=luojiaxing@huawei.com \
    --cc=martin.petersen@oracle.com \
    --cc=yanaijie@huawei.com \
    /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).