diff options
author | John Soni Jose <sony.john-n@emulex.com> | 2012-04-04 00:41:49 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-04-25 04:29:35 -0400 |
commit | 2177199d5150cf61bf26badcb6901176cc13787b (patch) | |
tree | d6fc1da211354f6601959ecb6fc7d2a704b1b039 /drivers/scsi/be2iscsi/be_iscsi.c | |
parent | 605c6cd201714535e2723a60197228050f863a8f (diff) |
[SCSI] be2iscsi: Get Initiator Name for the iSCSI_Host
Implement the ISCSI_HOST_PARAM_INITIATOR_NAME for .get_host_param
Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/be2iscsi/be_iscsi.c')
-rw-r--r-- | drivers/scsi/be2iscsi/be_iscsi.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c index 2bb681ef19ef..1af777474e42 100644 --- a/drivers/scsi/be2iscsi/be_iscsi.c +++ b/drivers/scsi/be2iscsi/be_iscsi.c | |||
@@ -279,6 +279,48 @@ int beiscsi_set_param(struct iscsi_cls_conn *cls_conn, | |||
279 | } | 279 | } |
280 | 280 | ||
281 | /** | 281 | /** |
282 | * beiscsi_get_initname - Read Initiator Name from flash | ||
283 | * @buf: buffer bointer | ||
284 | * @phba: The device priv structure instance | ||
285 | * | ||
286 | * returns number of bytes | ||
287 | */ | ||
288 | static int beiscsi_get_initname(char *buf, struct beiscsi_hba *phba) | ||
289 | { | ||
290 | int rc; | ||
291 | unsigned int tag, wrb_num; | ||
292 | unsigned short status, extd_status; | ||
293 | struct be_mcc_wrb *wrb; | ||
294 | struct be_cmd_hba_name *resp; | ||
295 | struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q; | ||
296 | |||
297 | tag = be_cmd_get_initname(phba); | ||
298 | if (!tag) { | ||
299 | SE_DEBUG(DBG_LVL_1, "Getting Initiator Name Failed\n"); | ||
300 | return -EBUSY; | ||
301 | } else | ||
302 | wait_event_interruptible(phba->ctrl.mcc_wait[tag], | ||
303 | phba->ctrl.mcc_numtag[tag]); | ||
304 | |||
305 | wrb_num = (phba->ctrl.mcc_numtag[tag] & 0x00FF0000) >> 16; | ||
306 | extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8; | ||
307 | status = phba->ctrl.mcc_numtag[tag] & 0x000000FF; | ||
308 | |||
309 | if (status || extd_status) { | ||
310 | SE_DEBUG(DBG_LVL_1, "MailBox Command Failed with " | ||
311 | "status = %d extd_status = %d\n", | ||
312 | status, extd_status); | ||
313 | free_mcc_tag(&phba->ctrl, tag); | ||
314 | return -EAGAIN; | ||
315 | } | ||
316 | wrb = queue_get_wrb(mccq, wrb_num); | ||
317 | free_mcc_tag(&phba->ctrl, tag); | ||
318 | resp = embedded_payload(wrb); | ||
319 | rc = sprintf(buf, "%s\n", resp->initiator_name); | ||
320 | return rc; | ||
321 | } | ||
322 | |||
323 | /** | ||
282 | * beiscsi_get_host_param - get the iscsi parameter | 324 | * beiscsi_get_host_param - get the iscsi parameter |
283 | * @shost: pointer to scsi_host structure | 325 | * @shost: pointer to scsi_host structure |
284 | * @param: parameter type identifier | 326 | * @param: parameter type identifier |
@@ -301,6 +343,14 @@ int beiscsi_get_host_param(struct Scsi_Host *shost, | |||
301 | return status; | 343 | return status; |
302 | } | 344 | } |
303 | break; | 345 | break; |
346 | case ISCSI_HOST_PARAM_INITIATOR_NAME: | ||
347 | status = beiscsi_get_initname(buf, phba); | ||
348 | if (status < 0) { | ||
349 | SE_DEBUG(DBG_LVL_1, | ||
350 | "Retreiving Initiator Name Failed\n"); | ||
351 | return status; | ||
352 | } | ||
353 | break; | ||
304 | default: | 354 | default: |
305 | return iscsi_host_get_param(shost, param, buf); | 355 | return iscsi_host_get_param(shost, param, buf); |
306 | } | 356 | } |