aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ipr.c
diff options
context:
space:
mode:
authorBrian King <brking@linux.vnet.ibm.com>2013-01-11 18:43:49 -0500
committerJames Bottomley <JBottomley@Parallels.com>2013-01-29 18:48:51 -0500
commitb3b3b4070dc01f6b11cae6d5632cd0f428a81aab (patch)
treecfaba402ec332b5b6f587682628f80e3f53b29ed /drivers/scsi/ipr.c
parenta2e49cb262208a4c3adec7788ecc1179e07dc912 (diff)
[SCSI] ipr: Resource path error logging cleanup
The resource path as displayed by the ipr driver is the location string identifying a location on the SAS fabric. This patch adds the SCSI host number such that error logs can be more easily correlated in multiple adapter configurations. Signed-off-by: Brian King <brking@linux.vnet.ibm.com> Signed-off-by: Wen Xiong <wenxiong@linux.vnet.ibm.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/ipr.c')
-rw-r--r--drivers/scsi/ipr.c78
1 files changed, 53 insertions, 25 deletions
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 0a152ef8b741..bd20639ec66c 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -1166,14 +1166,15 @@ static int ipr_is_same_device(struct ipr_resource_entry *res,
1166} 1166}
1167 1167
1168/** 1168/**
1169 * ipr_format_res_path - Format the resource path for printing. 1169 * __ipr_format_res_path - Format the resource path for printing.
1170 * @res_path: resource path 1170 * @res_path: resource path
1171 * @buf: buffer 1171 * @buf: buffer
1172 * @len: length of buffer provided
1172 * 1173 *
1173 * Return value: 1174 * Return value:
1174 * pointer to buffer 1175 * pointer to buffer
1175 **/ 1176 **/
1176static char *ipr_format_res_path(u8 *res_path, char *buffer, int len) 1177static char *__ipr_format_res_path(u8 *res_path, char *buffer, int len)
1177{ 1178{
1178 int i; 1179 int i;
1179 char *p = buffer; 1180 char *p = buffer;
@@ -1187,6 +1188,27 @@ static char *ipr_format_res_path(u8 *res_path, char *buffer, int len)
1187} 1188}
1188 1189
1189/** 1190/**
1191 * ipr_format_res_path - Format the resource path for printing.
1192 * @ioa_cfg: ioa config struct
1193 * @res_path: resource path
1194 * @buf: buffer
1195 * @len: length of buffer provided
1196 *
1197 * Return value:
1198 * pointer to buffer
1199 **/
1200static char *ipr_format_res_path(struct ipr_ioa_cfg *ioa_cfg,
1201 u8 *res_path, char *buffer, int len)
1202{
1203 char *p = buffer;
1204
1205 *p = '\0';
1206 p += snprintf(p, buffer + len - p, "%d/", ioa_cfg->host->host_no);
1207 __ipr_format_res_path(res_path, p, len - (buffer - p));
1208 return buffer;
1209}
1210
1211/**
1190 * ipr_update_res_entry - Update the resource entry. 1212 * ipr_update_res_entry - Update the resource entry.
1191 * @res: resource entry struct 1213 * @res: resource entry struct
1192 * @cfgtew: config table entry wrapper struct 1214 * @cfgtew: config table entry wrapper struct
@@ -1226,8 +1248,8 @@ static void ipr_update_res_entry(struct ipr_resource_entry *res,
1226 1248
1227 if (res->sdev && new_path) 1249 if (res->sdev && new_path)
1228 sdev_printk(KERN_INFO, res->sdev, "Resource path: %s\n", 1250 sdev_printk(KERN_INFO, res->sdev, "Resource path: %s\n",
1229 ipr_format_res_path(res->res_path, buffer, 1251 ipr_format_res_path(res->ioa_cfg,
1230 sizeof(buffer))); 1252 res->res_path, buffer, sizeof(buffer)));
1231 } else { 1253 } else {
1232 res->flags = cfgtew->u.cfgte->flags; 1254 res->flags = cfgtew->u.cfgte->flags;
1233 if (res->flags & IPR_IS_IOA_RESOURCE) 1255 if (res->flags & IPR_IS_IOA_RESOURCE)
@@ -1613,8 +1635,8 @@ static void ipr_log_sis64_config_error(struct ipr_ioa_cfg *ioa_cfg,
1613 ipr_err_separator; 1635 ipr_err_separator;
1614 1636
1615 ipr_err("Device %d : %s", i + 1, 1637 ipr_err("Device %d : %s", i + 1,
1616 ipr_format_res_path(dev_entry->res_path, buffer, 1638 __ipr_format_res_path(dev_entry->res_path,
1617 sizeof(buffer))); 1639 buffer, sizeof(buffer)));
1618 ipr_log_ext_vpd(&dev_entry->vpd); 1640 ipr_log_ext_vpd(&dev_entry->vpd);
1619 1641
1620 ipr_err("-----New Device Information-----\n"); 1642 ipr_err("-----New Device Information-----\n");
@@ -1960,14 +1982,16 @@ static void ipr_log64_fabric_path(struct ipr_hostrcb *hostrcb,
1960 1982
1961 ipr_hcam_err(hostrcb, "%s %s: Resource Path=%s\n", 1983 ipr_hcam_err(hostrcb, "%s %s: Resource Path=%s\n",
1962 path_active_desc[i].desc, path_state_desc[j].desc, 1984 path_active_desc[i].desc, path_state_desc[j].desc,
1963 ipr_format_res_path(fabric->res_path, buffer, 1985 ipr_format_res_path(hostrcb->ioa_cfg,
1964 sizeof(buffer))); 1986 fabric->res_path,
1987 buffer, sizeof(buffer)));
1965 return; 1988 return;
1966 } 1989 }
1967 } 1990 }
1968 1991
1969 ipr_err("Path state=%02X Resource Path=%s\n", path_state, 1992 ipr_err("Path state=%02X Resource Path=%s\n", path_state,
1970 ipr_format_res_path(fabric->res_path, buffer, sizeof(buffer))); 1993 ipr_format_res_path(hostrcb->ioa_cfg, fabric->res_path,
1994 buffer, sizeof(buffer)));
1971} 1995}
1972 1996
1973static const struct { 1997static const struct {
@@ -2108,18 +2132,20 @@ static void ipr_log64_path_elem(struct ipr_hostrcb *hostrcb,
2108 2132
2109 ipr_hcam_err(hostrcb, "%s %s: Resource Path=%s, Link rate=%s, WWN=%08X%08X\n", 2133 ipr_hcam_err(hostrcb, "%s %s: Resource Path=%s, Link rate=%s, WWN=%08X%08X\n",
2110 path_status_desc[j].desc, path_type_desc[i].desc, 2134 path_status_desc[j].desc, path_type_desc[i].desc,
2111 ipr_format_res_path(cfg->res_path, buffer, 2135 ipr_format_res_path(hostrcb->ioa_cfg,
2112 sizeof(buffer)), 2136 cfg->res_path, buffer, sizeof(buffer)),
2113 link_rate[cfg->link_rate & IPR_PHY_LINK_RATE_MASK], 2137 link_rate[cfg->link_rate & IPR_PHY_LINK_RATE_MASK],
2114 be32_to_cpu(cfg->wwid[0]), be32_to_cpu(cfg->wwid[1])); 2138 be32_to_cpu(cfg->wwid[0]),
2139 be32_to_cpu(cfg->wwid[1]));
2115 return; 2140 return;
2116 } 2141 }
2117 } 2142 }
2118 ipr_hcam_err(hostrcb, "Path element=%02X: Resource Path=%s, Link rate=%s " 2143 ipr_hcam_err(hostrcb, "Path element=%02X: Resource Path=%s, Link rate=%s "
2119 "WWN=%08X%08X\n", cfg->type_status, 2144 "WWN=%08X%08X\n", cfg->type_status,
2120 ipr_format_res_path(cfg->res_path, buffer, sizeof(buffer)), 2145 ipr_format_res_path(hostrcb->ioa_cfg,
2121 link_rate[cfg->link_rate & IPR_PHY_LINK_RATE_MASK], 2146 cfg->res_path, buffer, sizeof(buffer)),
2122 be32_to_cpu(cfg->wwid[0]), be32_to_cpu(cfg->wwid[1])); 2147 link_rate[cfg->link_rate & IPR_PHY_LINK_RATE_MASK],
2148 be32_to_cpu(cfg->wwid[0]), be32_to_cpu(cfg->wwid[1]));
2123} 2149}
2124 2150
2125/** 2151/**
@@ -2182,7 +2208,8 @@ static void ipr_log_sis64_array_error(struct ipr_ioa_cfg *ioa_cfg,
2182 2208
2183 ipr_err("RAID %s Array Configuration: %s\n", 2209 ipr_err("RAID %s Array Configuration: %s\n",
2184 error->protection_level, 2210 error->protection_level,
2185 ipr_format_res_path(error->last_res_path, buffer, sizeof(buffer))); 2211 ipr_format_res_path(ioa_cfg, error->last_res_path,
2212 buffer, sizeof(buffer)));
2186 2213
2187 ipr_err_separator; 2214 ipr_err_separator;
2188 2215
@@ -2203,11 +2230,12 @@ static void ipr_log_sis64_array_error(struct ipr_ioa_cfg *ioa_cfg,
2203 ipr_err("Array Member %d:\n", i); 2230 ipr_err("Array Member %d:\n", i);
2204 ipr_log_ext_vpd(&array_entry->vpd); 2231 ipr_log_ext_vpd(&array_entry->vpd);
2205 ipr_err("Current Location: %s\n", 2232 ipr_err("Current Location: %s\n",
2206 ipr_format_res_path(array_entry->res_path, buffer, 2233 ipr_format_res_path(ioa_cfg, array_entry->res_path,
2207 sizeof(buffer))); 2234 buffer, sizeof(buffer)));
2208 ipr_err("Expected Location: %s\n", 2235 ipr_err("Expected Location: %s\n",
2209 ipr_format_res_path(array_entry->expected_res_path, 2236 ipr_format_res_path(ioa_cfg,
2210 buffer, sizeof(buffer))); 2237 array_entry->expected_res_path,
2238 buffer, sizeof(buffer)));
2211 2239
2212 ipr_err_separator; 2240 ipr_err_separator;
2213 } 2241 }
@@ -4227,8 +4255,8 @@ static ssize_t ipr_show_resource_path(struct device *dev, struct device_attribut
4227 res = (struct ipr_resource_entry *)sdev->hostdata; 4255 res = (struct ipr_resource_entry *)sdev->hostdata;
4228 if (res && ioa_cfg->sis64) 4256 if (res && ioa_cfg->sis64)
4229 len = snprintf(buf, PAGE_SIZE, "%s\n", 4257 len = snprintf(buf, PAGE_SIZE, "%s\n",
4230 ipr_format_res_path(res->res_path, buffer, 4258 __ipr_format_res_path(res->res_path, buffer,
4231 sizeof(buffer))); 4259 sizeof(buffer)));
4232 else if (res) 4260 else if (res)
4233 len = snprintf(buf, PAGE_SIZE, "%d:%d:%d:%d\n", ioa_cfg->host->host_no, 4261 len = snprintf(buf, PAGE_SIZE, "%d:%d:%d:%d\n", ioa_cfg->host->host_no,
4234 res->bus, res->target, res->lun); 4262 res->bus, res->target, res->lun);
@@ -4556,8 +4584,8 @@ static int ipr_slave_configure(struct scsi_device *sdev)
4556 scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun); 4584 scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
4557 if (ioa_cfg->sis64) 4585 if (ioa_cfg->sis64)
4558 sdev_printk(KERN_INFO, sdev, "Resource path: %s\n", 4586 sdev_printk(KERN_INFO, sdev, "Resource path: %s\n",
4559 ipr_format_res_path(res->res_path, buffer, 4587 ipr_format_res_path(ioa_cfg,
4560 sizeof(buffer))); 4588 res->res_path, buffer, sizeof(buffer)));
4561 return 0; 4589 return 0;
4562 } 4590 }
4563 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); 4591 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);