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 | |
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')
-rw-r--r-- | drivers/scsi/be2iscsi/be_cmds.c | 2 | ||||
-rw-r--r-- | drivers/scsi/be2iscsi/be_cmds.h | 12 | ||||
-rw-r--r-- | drivers/scsi/be2iscsi/be_iscsi.c | 50 | ||||
-rw-r--r-- | drivers/scsi/be2iscsi/be_mgmt.c | 26 |
4 files changed, 90 insertions, 0 deletions
diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c index cdb15364bc69..d2e9e933f7a3 100644 --- a/drivers/scsi/be2iscsi/be_cmds.c +++ b/drivers/scsi/be2iscsi/be_cmds.c | |||
@@ -15,6 +15,8 @@ | |||
15 | * Costa Mesa, CA 92626 | 15 | * Costa Mesa, CA 92626 |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <scsi/iscsi_proto.h> | ||
19 | |||
18 | #include "be.h" | 20 | #include "be.h" |
19 | #include "be_mgmt.h" | 21 | #include "be_mgmt.h" |
20 | #include "be_main.h" | 22 | #include "be_main.h" |
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h index c85d73cfc79c..f343ed6a9e54 100644 --- a/drivers/scsi/be2iscsi/be_cmds.h +++ b/drivers/scsi/be2iscsi/be_cmds.h | |||
@@ -513,6 +513,17 @@ struct be_cmd_resp_get_mac_addr { | |||
513 | u32 rsvd[23]; | 513 | u32 rsvd[23]; |
514 | }; | 514 | }; |
515 | 515 | ||
516 | #define BEISCSI_ALIAS_LEN 32 | ||
517 | |||
518 | struct be_cmd_hba_name { | ||
519 | struct be_cmd_req_hdr hdr; | ||
520 | u16 flags; | ||
521 | u16 rsvd0; | ||
522 | u8 initiator_name[ISCSI_NAME_LEN]; | ||
523 | u8 initiator_alias[BEISCSI_ALIAS_LEN]; | ||
524 | } __packed; | ||
525 | |||
526 | |||
516 | int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl, | 527 | int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl, |
517 | struct be_queue_info *eq, int eq_delay); | 528 | struct be_queue_info *eq, int eq_delay); |
518 | 529 | ||
@@ -531,6 +542,7 @@ int be_poll_mcc(struct be_ctrl_info *ctrl); | |||
531 | int mgmt_check_supported_fw(struct be_ctrl_info *ctrl, | 542 | int mgmt_check_supported_fw(struct be_ctrl_info *ctrl, |
532 | struct beiscsi_hba *phba); | 543 | struct beiscsi_hba *phba); |
533 | unsigned int be_cmd_get_mac_addr(struct beiscsi_hba *phba); | 544 | unsigned int be_cmd_get_mac_addr(struct beiscsi_hba *phba); |
545 | unsigned int be_cmd_get_initname(struct beiscsi_hba *phba); | ||
534 | unsigned int beiscsi_get_boot_target(struct beiscsi_hba *phba); | 546 | unsigned int beiscsi_get_boot_target(struct beiscsi_hba *phba); |
535 | unsigned int beiscsi_get_session_info(struct beiscsi_hba *phba, | 547 | unsigned int beiscsi_get_session_info(struct beiscsi_hba *phba, |
536 | u32 boot_session_handle, | 548 | u32 boot_session_handle, |
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 | } |
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c index 44762cfa3e12..f7d27e9014c6 100644 --- a/drivers/scsi/be2iscsi/be_mgmt.c +++ b/drivers/scsi/be2iscsi/be_mgmt.c | |||
@@ -447,3 +447,29 @@ unsigned int be_cmd_get_mac_addr(struct beiscsi_hba *phba) | |||
447 | return tag; | 447 | return tag; |
448 | } | 448 | } |
449 | 449 | ||
450 | unsigned int be_cmd_get_initname(struct beiscsi_hba *phba) | ||
451 | { | ||
452 | unsigned int tag = 0; | ||
453 | struct be_mcc_wrb *wrb; | ||
454 | struct be_cmd_hba_name *req; | ||
455 | struct be_ctrl_info *ctrl = &phba->ctrl; | ||
456 | |||
457 | spin_lock(&ctrl->mbox_lock); | ||
458 | tag = alloc_mcc_tag(phba); | ||
459 | if (!tag) { | ||
460 | spin_unlock(&ctrl->mbox_lock); | ||
461 | return tag; | ||
462 | } | ||
463 | |||
464 | wrb = wrb_from_mccq(phba); | ||
465 | req = embedded_payload(wrb); | ||
466 | wrb->tag0 |= tag; | ||
467 | be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); | ||
468 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI_INI, | ||
469 | OPCODE_ISCSI_INI_CFG_GET_HBA_NAME, | ||
470 | sizeof(*req)); | ||
471 | |||
472 | be_mcc_notify(phba); | ||
473 | spin_unlock(&ctrl->mbox_lock); | ||
474 | return tag; | ||
475 | } | ||