mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 07:04:24 +00:00
[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>
This commit is contained in:
parent
605c6cd201
commit
2177199d51
5 changed files with 92 additions and 0 deletions
|
@ -15,6 +15,8 @@
|
||||||
* Costa Mesa, CA 92626
|
* Costa Mesa, CA 92626
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <scsi/iscsi_proto.h>
|
||||||
|
|
||||||
#include "be.h"
|
#include "be.h"
|
||||||
#include "be_mgmt.h"
|
#include "be_mgmt.h"
|
||||||
#include "be_main.h"
|
#include "be_main.h"
|
||||||
|
|
|
@ -513,6 +513,17 @@ struct be_cmd_resp_get_mac_addr {
|
||||||
u32 rsvd[23];
|
u32 rsvd[23];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define BEISCSI_ALIAS_LEN 32
|
||||||
|
|
||||||
|
struct be_cmd_hba_name {
|
||||||
|
struct be_cmd_req_hdr hdr;
|
||||||
|
u16 flags;
|
||||||
|
u16 rsvd0;
|
||||||
|
u8 initiator_name[ISCSI_NAME_LEN];
|
||||||
|
u8 initiator_alias[BEISCSI_ALIAS_LEN];
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
|
||||||
int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl,
|
int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl,
|
||||||
struct be_queue_info *eq, int eq_delay);
|
struct be_queue_info *eq, int eq_delay);
|
||||||
|
|
||||||
|
@ -531,6 +542,7 @@ int be_poll_mcc(struct be_ctrl_info *ctrl);
|
||||||
int mgmt_check_supported_fw(struct be_ctrl_info *ctrl,
|
int mgmt_check_supported_fw(struct be_ctrl_info *ctrl,
|
||||||
struct beiscsi_hba *phba);
|
struct beiscsi_hba *phba);
|
||||||
unsigned int be_cmd_get_mac_addr(struct beiscsi_hba *phba);
|
unsigned int be_cmd_get_mac_addr(struct beiscsi_hba *phba);
|
||||||
|
unsigned int be_cmd_get_initname(struct beiscsi_hba *phba);
|
||||||
unsigned int beiscsi_get_boot_target(struct beiscsi_hba *phba);
|
unsigned int beiscsi_get_boot_target(struct beiscsi_hba *phba);
|
||||||
unsigned int beiscsi_get_session_info(struct beiscsi_hba *phba,
|
unsigned int beiscsi_get_session_info(struct beiscsi_hba *phba,
|
||||||
u32 boot_session_handle,
|
u32 boot_session_handle,
|
||||||
|
|
|
@ -278,6 +278,48 @@ int beiscsi_set_param(struct iscsi_cls_conn *cls_conn,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* beiscsi_get_initname - Read Initiator Name from flash
|
||||||
|
* @buf: buffer bointer
|
||||||
|
* @phba: The device priv structure instance
|
||||||
|
*
|
||||||
|
* returns number of bytes
|
||||||
|
*/
|
||||||
|
static int beiscsi_get_initname(char *buf, struct beiscsi_hba *phba)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
unsigned int tag, wrb_num;
|
||||||
|
unsigned short status, extd_status;
|
||||||
|
struct be_mcc_wrb *wrb;
|
||||||
|
struct be_cmd_hba_name *resp;
|
||||||
|
struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
|
||||||
|
|
||||||
|
tag = be_cmd_get_initname(phba);
|
||||||
|
if (!tag) {
|
||||||
|
SE_DEBUG(DBG_LVL_1, "Getting Initiator Name Failed\n");
|
||||||
|
return -EBUSY;
|
||||||
|
} else
|
||||||
|
wait_event_interruptible(phba->ctrl.mcc_wait[tag],
|
||||||
|
phba->ctrl.mcc_numtag[tag]);
|
||||||
|
|
||||||
|
wrb_num = (phba->ctrl.mcc_numtag[tag] & 0x00FF0000) >> 16;
|
||||||
|
extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8;
|
||||||
|
status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
|
||||||
|
|
||||||
|
if (status || extd_status) {
|
||||||
|
SE_DEBUG(DBG_LVL_1, "MailBox Command Failed with "
|
||||||
|
"status = %d extd_status = %d\n",
|
||||||
|
status, extd_status);
|
||||||
|
free_mcc_tag(&phba->ctrl, tag);
|
||||||
|
return -EAGAIN;
|
||||||
|
}
|
||||||
|
wrb = queue_get_wrb(mccq, wrb_num);
|
||||||
|
free_mcc_tag(&phba->ctrl, tag);
|
||||||
|
resp = embedded_payload(wrb);
|
||||||
|
rc = sprintf(buf, "%s\n", resp->initiator_name);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* beiscsi_get_host_param - get the iscsi parameter
|
* beiscsi_get_host_param - get the iscsi parameter
|
||||||
* @shost: pointer to scsi_host structure
|
* @shost: pointer to scsi_host structure
|
||||||
|
@ -301,6 +343,14 @@ int beiscsi_get_host_param(struct Scsi_Host *shost,
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ISCSI_HOST_PARAM_INITIATOR_NAME:
|
||||||
|
status = beiscsi_get_initname(buf, phba);
|
||||||
|
if (status < 0) {
|
||||||
|
SE_DEBUG(DBG_LVL_1,
|
||||||
|
"Retreiving Initiator Name Failed\n");
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return iscsi_host_get_param(shost, param, buf);
|
return iscsi_host_get_param(shost, param, buf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -447,3 +447,29 @@ unsigned int be_cmd_get_mac_addr(struct beiscsi_hba *phba)
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int be_cmd_get_initname(struct beiscsi_hba *phba)
|
||||||
|
{
|
||||||
|
unsigned int tag = 0;
|
||||||
|
struct be_mcc_wrb *wrb;
|
||||||
|
struct be_cmd_hba_name *req;
|
||||||
|
struct be_ctrl_info *ctrl = &phba->ctrl;
|
||||||
|
|
||||||
|
spin_lock(&ctrl->mbox_lock);
|
||||||
|
tag = alloc_mcc_tag(phba);
|
||||||
|
if (!tag) {
|
||||||
|
spin_unlock(&ctrl->mbox_lock);
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
wrb = wrb_from_mccq(phba);
|
||||||
|
req = embedded_payload(wrb);
|
||||||
|
wrb->tag0 |= tag;
|
||||||
|
be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
|
||||||
|
be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI_INI,
|
||||||
|
OPCODE_ISCSI_INI_CFG_GET_HBA_NAME,
|
||||||
|
sizeof(*req));
|
||||||
|
|
||||||
|
be_mcc_notify(phba);
|
||||||
|
spin_unlock(&ctrl->mbox_lock);
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
|
@ -661,6 +661,8 @@ struct iscsi_reject {
|
||||||
|
|
||||||
#define ISCSI_DEF_TIME2WAIT 2
|
#define ISCSI_DEF_TIME2WAIT 2
|
||||||
|
|
||||||
|
#define ISCSI_NAME_LEN 224
|
||||||
|
|
||||||
/************************* RFC 3720 End *****************************/
|
/************************* RFC 3720 End *****************************/
|
||||||
|
|
||||||
#endif /* ISCSI_PROTO_H */
|
#endif /* ISCSI_PROTO_H */
|
||||||
|
|
Loading…
Reference in a new issue