aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2006-07-06 15:50:22 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-07-09 11:44:08 -0400
commit40496f073ffe75c59414a7236f95ecbc49562596 (patch)
tree7f29d920f041be13f78e63186f9e5196b6f36f1e /drivers/scsi
parent420b630d6e9ff41dc3e2a2a2808b67907951e094 (diff)
[SCSI] lpfc 8.1.7: Adding new issue_reset sysfs attribute
Adding new issue_reset sysfs attribute Signed-off-by: James Smart <James.Smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 511de17a1f83..cdae011b2813 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -243,6 +243,47 @@ lpfc_issue_lip(struct Scsi_Host *host)
243 return 0; 243 return 0;
244} 244}
245 245
246static int
247lpfc_selective_reset(struct lpfc_hba *phba)
248{
249 struct completion online_compl;
250 int status = 0;
251
252 init_completion(&online_compl);
253 lpfc_workq_post_event(phba, &status, &online_compl,
254 LPFC_EVT_OFFLINE);
255 wait_for_completion(&online_compl);
256
257 if (status != 0)
258 return -EIO;
259
260 init_completion(&online_compl);
261 lpfc_workq_post_event(phba, &status, &online_compl,
262 LPFC_EVT_ONLINE);
263 wait_for_completion(&online_compl);
264
265 if (status != 0)
266 return -EIO;
267
268 return 0;
269}
270
271static ssize_t
272lpfc_issue_reset(struct class_device *cdev, const char *buf, size_t count)
273{
274 struct Scsi_Host *host = class_to_shost(cdev);
275 struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata;
276 int status = -EINVAL;
277
278 if (strncmp(buf, "selective", sizeof("selective") - 1) == 0)
279 status = lpfc_selective_reset(phba);
280
281 if (status == 0)
282 return strlen(buf);
283 else
284 return status;
285}
286
246static ssize_t 287static ssize_t
247lpfc_nport_evt_cnt_show(struct class_device *cdev, char *buf) 288lpfc_nport_evt_cnt_show(struct class_device *cdev, char *buf)
248{ 289{
@@ -546,6 +587,7 @@ static CLASS_DEVICE_ATTR(board_online, S_IRUGO | S_IWUSR,
546 lpfc_board_online_show, lpfc_board_online_store); 587 lpfc_board_online_show, lpfc_board_online_store);
547static CLASS_DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR, 588static CLASS_DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR,
548 lpfc_board_mode_show, lpfc_board_mode_store); 589 lpfc_board_mode_show, lpfc_board_mode_store);
590static CLASS_DEVICE_ATTR(issue_reset, S_IWUSR, NULL, lpfc_issue_reset);
549 591
550static int lpfc_poll = 0; 592static int lpfc_poll = 0;
551module_param(lpfc_poll, int, 0); 593module_param(lpfc_poll, int, 0);
@@ -751,6 +793,7 @@ struct class_device_attribute *lpfc_host_attrs[] = {
751 &class_device_attr_management_version, 793 &class_device_attr_management_version,
752 &class_device_attr_board_online, 794 &class_device_attr_board_online,
753 &class_device_attr_board_mode, 795 &class_device_attr_board_mode,
796 &class_device_attr_issue_reset,
754 &class_device_attr_lpfc_poll, 797 &class_device_attr_lpfc_poll,
755 &class_device_attr_lpfc_poll_tmo, 798 &class_device_attr_lpfc_poll_tmo,
756 NULL, 799 NULL,