diff options
author | Andrew Vasquez <andrew.vasquez@qlogic.com> | 2005-10-27 19:03:37 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-10-28 20:35:25 -0400 |
commit | 91ca7b01ecc916632202180569a7ddbfccfc3f05 (patch) | |
tree | d26c8af7ba9d06f6b04e85270dbce0dad0624668 /drivers/scsi/lpfc | |
parent | f9a2d2e0c89f73f0203fa796101089c2bce31974 (diff) |
[SCSI] Add an 'Issue LIP' device attribute in fc_transport class
Ok, here's a patch to add such a common API for fc transport users.
Relevant LLD changes (lpfc and qla2xxx) also present.
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_attr.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index acae7c48ef7d..445da1d0cc88 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -200,19 +200,13 @@ lpfc_num_discovered_ports_show(struct class_device *cdev, char *buf) | |||
200 | } | 200 | } |
201 | 201 | ||
202 | 202 | ||
203 | static ssize_t | 203 | static int |
204 | lpfc_issue_lip (struct class_device *cdev, const char *buf, size_t count) | 204 | lpfc_issue_lip(struct Scsi_Host *host) |
205 | { | 205 | { |
206 | struct Scsi_Host *host = class_to_shost(cdev); | ||
207 | struct lpfc_hba *phba = (struct lpfc_hba *) host->hostdata[0]; | 206 | struct lpfc_hba *phba = (struct lpfc_hba *) host->hostdata[0]; |
208 | int val = 0; | ||
209 | LPFC_MBOXQ_t *pmboxq; | 207 | LPFC_MBOXQ_t *pmboxq; |
210 | int mbxstatus = MBXERR_ERROR; | 208 | int mbxstatus = MBXERR_ERROR; |
211 | 209 | ||
212 | if ((sscanf(buf, "%d", &val) != 1) || | ||
213 | (val != 1)) | ||
214 | return -EINVAL; | ||
215 | |||
216 | if ((phba->fc_flag & FC_OFFLINE_MODE) || | 210 | if ((phba->fc_flag & FC_OFFLINE_MODE) || |
217 | (phba->hba_state != LPFC_HBA_READY)) | 211 | (phba->hba_state != LPFC_HBA_READY)) |
218 | return -EPERM; | 212 | return -EPERM; |
@@ -234,7 +228,7 @@ lpfc_issue_lip (struct class_device *cdev, const char *buf, size_t count) | |||
234 | if (mbxstatus == MBXERR_ERROR) | 228 | if (mbxstatus == MBXERR_ERROR) |
235 | return -EIO; | 229 | return -EIO; |
236 | 230 | ||
237 | return strlen(buf); | 231 | return 0; |
238 | } | 232 | } |
239 | 233 | ||
240 | static ssize_t | 234 | static ssize_t |
@@ -364,7 +358,6 @@ static CLASS_DEVICE_ATTR(lpfc_drvr_version, S_IRUGO, lpfc_drvr_version_show, | |||
364 | NULL); | 358 | NULL); |
365 | static CLASS_DEVICE_ATTR(management_version, S_IRUGO, management_version_show, | 359 | static CLASS_DEVICE_ATTR(management_version, S_IRUGO, management_version_show, |
366 | NULL); | 360 | NULL); |
367 | static CLASS_DEVICE_ATTR(issue_lip, S_IWUSR, NULL, lpfc_issue_lip); | ||
368 | static CLASS_DEVICE_ATTR(board_online, S_IRUGO | S_IWUSR, | 361 | static CLASS_DEVICE_ATTR(board_online, S_IRUGO | S_IWUSR, |
369 | lpfc_board_online_show, lpfc_board_online_store); | 362 | lpfc_board_online_show, lpfc_board_online_store); |
370 | 363 | ||
@@ -537,7 +530,6 @@ struct class_device_attribute *lpfc_host_attrs[] = { | |||
537 | &class_device_attr_lpfc_max_luns, | 530 | &class_device_attr_lpfc_max_luns, |
538 | &class_device_attr_nport_evt_cnt, | 531 | &class_device_attr_nport_evt_cnt, |
539 | &class_device_attr_management_version, | 532 | &class_device_attr_management_version, |
540 | &class_device_attr_issue_lip, | ||
541 | &class_device_attr_board_online, | 533 | &class_device_attr_board_online, |
542 | NULL, | 534 | NULL, |
543 | }; | 535 | }; |
@@ -1234,6 +1226,8 @@ struct fc_function_template lpfc_transport_functions = { | |||
1234 | 1226 | ||
1235 | .get_starget_port_name = lpfc_get_starget_port_name, | 1227 | .get_starget_port_name = lpfc_get_starget_port_name, |
1236 | .show_starget_port_name = 1, | 1228 | .show_starget_port_name = 1, |
1229 | |||
1230 | .issue_fc_host_lip = lpfc_issue_lip, | ||
1237 | }; | 1231 | }; |
1238 | 1232 | ||
1239 | void | 1233 | void |