aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libsas/sas_expander.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-07-11 18:14:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-11 18:14:01 -0400
commitba6d10ab8014ac10d25ca513352b6665e73b5785 (patch)
tree3b7aaa3f2d76d0c0e9612bc87e1da45577465528 /drivers/scsi/libsas/sas_expander.c
parent64b08df460cfdfc2b010263043a057cdd33500ed (diff)
parentbaf23eddbf2a4ba9bf2bdb342686c71a8042e39b (diff)
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI updates from James Bottomley: "This is mostly update of the usual drivers: qla2xxx, hpsa, lpfc, ufs, mpt3sas, ibmvscsi, megaraid_sas, bnx2fc and hisi_sas as well as the removal of the osst driver (I heard from Willem privately that he would like the driver removed because all his test hardware has failed). Plus number of minor changes, spelling fixes and other trivia. The big merge conflict this time around is the SPDX licence tags. Following discussion on linux-next, we believe our version to be more accurate than the one in the tree, so the resolution is to take our version for all the SPDX conflicts" Note on the SPDX license tag conversion conflicts: the SCSI tree had done its own SPDX conversion, which in some cases conflicted with the treewide ones done by Thomas & co. In almost all cases, the conflicts were purely syntactic: the SCSI tree used the old-style SPDX tags ("GPL-2.0" and "GPL-2.0+") while the treewide conversion had used the new-style ones ("GPL-2.0-only" and "GPL-2.0-or-later"). In these cases I picked the new-style one. In a few cases, the SPDX conversion was actually different, though. As explained by James above, and in more detail in a pre-pull-request thread: "The other problem is actually substantive: In the libsas code Luben Tuikov originally specified gpl 2.0 only by dint of stating: * This file is licensed under GPLv2. In all the libsas files, but then muddied the water by quoting GPLv2 verbatim (which includes the or later than language). So for these files Christoph did the conversion to v2 only SPDX tags and Thomas converted to v2 or later tags" So in those cases, where the spdx tag substantially mattered, I took the SCSI tree conversion of it, but then also took the opportunity to turn the old-style "GPL-2.0" into a new-style "GPL-2.0-only" tag. Similarly, when there were whitespace differences or other differences to the comments around the copyright notices, I took the version from the SCSI tree as being the more specific conversion. Finally, in the spdx conversions that had no conflicts (because the treewide ones hadn't been done for those files), I just took the SCSI tree version as-is, even if it was old-style. The old-style conversions are perfectly valid, even if the "-only" and "-or-later" versions are perhaps more descriptive. * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (185 commits) scsi: qla2xxx: move IO flush to the front of NVME rport unregistration scsi: qla2xxx: Fix NVME cmd and LS cmd timeout race condition scsi: qla2xxx: on session delete, return nvme cmd scsi: qla2xxx: Fix kernel crash after disconnecting NVMe devices scsi: megaraid_sas: Update driver version to 07.710.06.00-rc1 scsi: megaraid_sas: Introduce various Aero performance modes scsi: megaraid_sas: Use high IOPS queues based on IO workload scsi: megaraid_sas: Set affinity for high IOPS reply queues scsi: megaraid_sas: Enable coalescing for high IOPS queues scsi: megaraid_sas: Add support for High IOPS queues scsi: megaraid_sas: Add support for MPI toolbox commands scsi: megaraid_sas: Offload Aero RAID5/6 division calculations to driver scsi: megaraid_sas: RAID1 PCI bandwidth limit algorithm is applicable for only Ventura scsi: megaraid_sas: megaraid_sas: Add check for count returned by HOST_DEVICE_LIST DCMD scsi: megaraid_sas: Handle sequence JBOD map failure at driver level scsi: megaraid_sas: Don't send FPIO to RL Bypass queue scsi: megaraid_sas: In probe context, retry IOC INIT once if firmware is in fault scsi: megaraid_sas: Release Mutex lock before OCR in case of DCMD timeout scsi: megaraid_sas: Call disable_irq from process IRQ poll scsi: megaraid_sas: Remove few debug counters from IO path ...
Diffstat (limited to 'drivers/scsi/libsas/sas_expander.c')
-rw-r--r--drivers/scsi/libsas/sas_expander.c71
1 files changed, 15 insertions, 56 deletions
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index 9f7e2457360e..9fdb9c9fbda4 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Serial Attached SCSI (SAS) Expander discovery and configuration 3 * Serial Attached SCSI (SAS) Expander discovery and configuration
3 * 4 *
@@ -5,21 +6,6 @@
5 * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com> 6 * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com>
6 * 7 *
7 * This file is licensed under GPLv2. 8 * This file is licensed under GPLv2.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of the
12 * License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 *
23 */ 9 */
24 10
25#include <linux/scatterlist.h> 11#include <linux/scatterlist.h>
@@ -1106,7 +1092,7 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id)
1106 SAS_ADDR(dev->sas_addr), 1092 SAS_ADDR(dev->sas_addr),
1107 phy_id); 1093 phy_id);
1108 sas_ex_disable_phy(dev, phy_id); 1094 sas_ex_disable_phy(dev, phy_id);
1109 break; 1095 return res;
1110 } else 1096 } else
1111 memcpy(dev->port->disc.fanout_sas_addr, 1097 memcpy(dev->port->disc.fanout_sas_addr,
1112 ex_phy->attached_sas_addr, SAS_ADDR_SIZE); 1098 ex_phy->attached_sas_addr, SAS_ADDR_SIZE);
@@ -1118,27 +1104,9 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id)
1118 break; 1104 break;
1119 } 1105 }
1120 1106
1121 if (child) { 1107 if (!child)
1122 int i; 1108 pr_notice("ex %016llx phy%02d failed to discover\n",
1123 1109 SAS_ADDR(dev->sas_addr), phy_id);
1124 for (i = 0; i < ex->num_phys; i++) {
1125 if (ex->ex_phy[i].phy_state == PHY_VACANT ||
1126 ex->ex_phy[i].phy_state == PHY_NOT_PRESENT)
1127 continue;
1128 /*
1129 * Due to races, the phy might not get added to the
1130 * wide port, so we add the phy to the wide port here.
1131 */
1132 if (SAS_ADDR(ex->ex_phy[i].attached_sas_addr) ==
1133 SAS_ADDR(child->sas_addr)) {
1134 ex->ex_phy[i].phy_state= PHY_DEVICE_DISCOVERED;
1135 if (sas_ex_join_wide_port(dev, i))
1136 pr_debug("Attaching ex phy%02d to wide port %016llx\n",
1137 i, SAS_ADDR(ex->ex_phy[i].attached_sas_addr));
1138 }
1139 }
1140 }
1141
1142 return res; 1110 return res;
1143} 1111}
1144 1112
@@ -1154,8 +1122,7 @@ static int sas_find_sub_addr(struct domain_device *dev, u8 *sub_addr)
1154 phy->phy_state == PHY_NOT_PRESENT) 1122 phy->phy_state == PHY_NOT_PRESENT)
1155 continue; 1123 continue;
1156 1124
1157 if ((phy->attached_dev_type == SAS_EDGE_EXPANDER_DEVICE || 1125 if (dev_is_expander(phy->attached_dev_type) &&
1158 phy->attached_dev_type == SAS_FANOUT_EXPANDER_DEVICE) &&
1159 phy->routing_attr == SUBTRACTIVE_ROUTING) { 1126 phy->routing_attr == SUBTRACTIVE_ROUTING) {
1160 1127
1161 memcpy(sub_addr, phy->attached_sas_addr, SAS_ADDR_SIZE); 1128 memcpy(sub_addr, phy->attached_sas_addr, SAS_ADDR_SIZE);
@@ -1173,8 +1140,7 @@ static int sas_check_level_subtractive_boundary(struct domain_device *dev)
1173 u8 sub_addr[SAS_ADDR_SIZE] = {0, }; 1140 u8 sub_addr[SAS_ADDR_SIZE] = {0, };
1174 1141
1175 list_for_each_entry(child, &ex->children, siblings) { 1142 list_for_each_entry(child, &ex->children, siblings) {
1176 if (child->dev_type != SAS_EDGE_EXPANDER_DEVICE && 1143 if (!dev_is_expander(child->dev_type))
1177 child->dev_type != SAS_FANOUT_EXPANDER_DEVICE)
1178 continue; 1144 continue;
1179 if (sub_addr[0] == 0) { 1145 if (sub_addr[0] == 0) {
1180 sas_find_sub_addr(child, sub_addr); 1146 sas_find_sub_addr(child, sub_addr);
@@ -1259,8 +1225,7 @@ static int sas_check_ex_subtractive_boundary(struct domain_device *dev)
1259 phy->phy_state == PHY_NOT_PRESENT) 1225 phy->phy_state == PHY_NOT_PRESENT)
1260 continue; 1226 continue;
1261 1227
1262 if ((phy->attached_dev_type == SAS_FANOUT_EXPANDER_DEVICE || 1228 if (dev_is_expander(phy->attached_dev_type) &&
1263 phy->attached_dev_type == SAS_EDGE_EXPANDER_DEVICE) &&
1264 phy->routing_attr == SUBTRACTIVE_ROUTING) { 1229 phy->routing_attr == SUBTRACTIVE_ROUTING) {
1265 1230
1266 if (!sub_sas_addr) 1231 if (!sub_sas_addr)
@@ -1356,8 +1321,7 @@ static int sas_check_parent_topology(struct domain_device *child)
1356 if (!child->parent) 1321 if (!child->parent)
1357 return 0; 1322 return 0;
1358 1323
1359 if (child->parent->dev_type != SAS_EDGE_EXPANDER_DEVICE && 1324 if (!dev_is_expander(child->parent->dev_type))
1360 child->parent->dev_type != SAS_FANOUT_EXPANDER_DEVICE)
1361 return 0; 1325 return 0;
1362 1326
1363 parent_ex = &child->parent->ex_dev; 1327 parent_ex = &child->parent->ex_dev;
@@ -1653,8 +1617,7 @@ static int sas_ex_level_discovery(struct asd_sas_port *port, const int level)
1653 struct domain_device *dev; 1617 struct domain_device *dev;
1654 1618
1655 list_for_each_entry(dev, &port->dev_list, dev_list_node) { 1619 list_for_each_entry(dev, &port->dev_list, dev_list_node) {
1656 if (dev->dev_type == SAS_EDGE_EXPANDER_DEVICE || 1620 if (dev_is_expander(dev->dev_type)) {
1657 dev->dev_type == SAS_FANOUT_EXPANDER_DEVICE) {
1658 struct sas_expander_device *ex = 1621 struct sas_expander_device *ex =
1659 rphy_to_expander_device(dev->rphy); 1622 rphy_to_expander_device(dev->rphy);
1660 1623
@@ -1886,7 +1849,7 @@ static int sas_find_bcast_dev(struct domain_device *dev,
1886 SAS_ADDR(dev->sas_addr)); 1849 SAS_ADDR(dev->sas_addr));
1887 } 1850 }
1888 list_for_each_entry(ch, &ex->children, siblings) { 1851 list_for_each_entry(ch, &ex->children, siblings) {
1889 if (ch->dev_type == SAS_EDGE_EXPANDER_DEVICE || ch->dev_type == SAS_FANOUT_EXPANDER_DEVICE) { 1852 if (dev_is_expander(ch->dev_type)) {
1890 res = sas_find_bcast_dev(ch, src_dev); 1853 res = sas_find_bcast_dev(ch, src_dev);
1891 if (*src_dev) 1854 if (*src_dev)
1892 return res; 1855 return res;
@@ -1903,8 +1866,7 @@ static void sas_unregister_ex_tree(struct asd_sas_port *port, struct domain_devi
1903 1866
1904 list_for_each_entry_safe(child, n, &ex->children, siblings) { 1867 list_for_each_entry_safe(child, n, &ex->children, siblings) {
1905 set_bit(SAS_DEV_GONE, &child->state); 1868 set_bit(SAS_DEV_GONE, &child->state);
1906 if (child->dev_type == SAS_EDGE_EXPANDER_DEVICE || 1869 if (dev_is_expander(child->dev_type))
1907 child->dev_type == SAS_FANOUT_EXPANDER_DEVICE)
1908 sas_unregister_ex_tree(port, child); 1870 sas_unregister_ex_tree(port, child);
1909 else 1871 else
1910 sas_unregister_dev(port, child); 1872 sas_unregister_dev(port, child);
@@ -1924,8 +1886,7 @@ static void sas_unregister_devs_sas_addr(struct domain_device *parent,
1924 if (SAS_ADDR(child->sas_addr) == 1886 if (SAS_ADDR(child->sas_addr) ==
1925 SAS_ADDR(phy->attached_sas_addr)) { 1887 SAS_ADDR(phy->attached_sas_addr)) {
1926 set_bit(SAS_DEV_GONE, &child->state); 1888 set_bit(SAS_DEV_GONE, &child->state);
1927 if (child->dev_type == SAS_EDGE_EXPANDER_DEVICE || 1889 if (dev_is_expander(child->dev_type))
1928 child->dev_type == SAS_FANOUT_EXPANDER_DEVICE)
1929 sas_unregister_ex_tree(parent->port, child); 1890 sas_unregister_ex_tree(parent->port, child);
1930 else 1891 else
1931 sas_unregister_dev(parent->port, child); 1892 sas_unregister_dev(parent->port, child);
@@ -1954,8 +1915,7 @@ static int sas_discover_bfs_by_root_level(struct domain_device *root,
1954 int res = 0; 1915 int res = 0;
1955 1916
1956 list_for_each_entry(child, &ex_root->children, siblings) { 1917 list_for_each_entry(child, &ex_root->children, siblings) {
1957 if (child->dev_type == SAS_EDGE_EXPANDER_DEVICE || 1918 if (dev_is_expander(child->dev_type)) {
1958 child->dev_type == SAS_FANOUT_EXPANDER_DEVICE) {
1959 struct sas_expander_device *ex = 1919 struct sas_expander_device *ex =
1960 rphy_to_expander_device(child->rphy); 1920 rphy_to_expander_device(child->rphy);
1961 1921
@@ -2008,8 +1968,7 @@ static int sas_discover_new(struct domain_device *dev, int phy_id)
2008 list_for_each_entry(child, &dev->ex_dev.children, siblings) { 1968 list_for_each_entry(child, &dev->ex_dev.children, siblings) {
2009 if (SAS_ADDR(child->sas_addr) == 1969 if (SAS_ADDR(child->sas_addr) ==
2010 SAS_ADDR(ex_phy->attached_sas_addr)) { 1970 SAS_ADDR(ex_phy->attached_sas_addr)) {
2011 if (child->dev_type == SAS_EDGE_EXPANDER_DEVICE || 1971 if (dev_is_expander(child->dev_type))
2012 child->dev_type == SAS_FANOUT_EXPANDER_DEVICE)
2013 res = sas_discover_bfs_by_root(child); 1972 res = sas_discover_bfs_by_root(child);
2014 break; 1973 break;
2015 } 1974 }