aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-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,