diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2012-02-27 06:08:54 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-02-29 17:59:19 -0500 |
commit | fca9f04d460bf7c6af397dd994f1d81a3037f9dc (patch) | |
tree | 5daa8c66f56c49d189e698511e067df795b915b2 /drivers/scsi/qla4xxx | |
parent | 30534952743f73f1de3c6c056400d7249f5c7f75 (diff) |
[SCSI] qla4xxx: Export CHAP index as sysfs attribute
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/qla4xxx')
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_glbl.h | 2 | ||||
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_mbx.c | 9 | ||||
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_os.c | 45 |
3 files changed, 53 insertions, 3 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_glbl.h b/drivers/scsi/qla4xxx/ql4_glbl.h index 954ba9188256..910536667cf5 100644 --- a/drivers/scsi/qla4xxx/ql4_glbl.h +++ b/drivers/scsi/qla4xxx/ql4_glbl.h | |||
@@ -81,6 +81,8 @@ int qla4xxx_set_flash(struct scsi_qla_host *ha, dma_addr_t dma_addr, | |||
81 | uint32_t offset, uint32_t length, uint32_t options); | 81 | uint32_t offset, uint32_t length, uint32_t options); |
82 | int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount, | 82 | int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount, |
83 | uint8_t outCount, uint32_t *mbx_cmd, uint32_t *mbx_sts); | 83 | uint8_t outCount, uint32_t *mbx_cmd, uint32_t *mbx_sts); |
84 | int qla4xxx_get_chap_index(struct scsi_qla_host *ha, char *username, | ||
85 | char *password, int bidi, uint16_t *chap_index); | ||
84 | 86 | ||
85 | void qla4xxx_queue_iocb(struct scsi_qla_host *ha); | 87 | void qla4xxx_queue_iocb(struct scsi_qla_host *ha); |
86 | void qla4xxx_complete_iocb(struct scsi_qla_host *ha); | 88 | void qla4xxx_complete_iocb(struct scsi_qla_host *ha); |
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c index eaf21852887c..71331e3b4404 100644 --- a/drivers/scsi/qla4xxx/ql4_mbx.c +++ b/drivers/scsi/qla4xxx/ql4_mbx.c | |||
@@ -1426,8 +1426,8 @@ exit_set_chap: | |||
1426 | * match is found. If a match is not found then add the entry in FLASH and | 1426 | * match is found. If a match is not found then add the entry in FLASH and |
1427 | * return the index at which entry is written in the FLASH. | 1427 | * return the index at which entry is written in the FLASH. |
1428 | **/ | 1428 | **/ |
1429 | static int qla4xxx_get_chap_index(struct scsi_qla_host *ha, char *username, | 1429 | int qla4xxx_get_chap_index(struct scsi_qla_host *ha, char *username, |
1430 | char *password, int bidi, uint16_t *chap_index) | 1430 | char *password, int bidi, uint16_t *chap_index) |
1431 | { | 1431 | { |
1432 | int i, rval; | 1432 | int i, rval; |
1433 | int free_index = -1; | 1433 | int free_index = -1; |
@@ -1446,6 +1446,11 @@ static int qla4xxx_get_chap_index(struct scsi_qla_host *ha, char *username, | |||
1446 | return QLA_ERROR; | 1446 | return QLA_ERROR; |
1447 | } | 1447 | } |
1448 | 1448 | ||
1449 | if (!username || !password) { | ||
1450 | ql4_printk(KERN_ERR, ha, "Do not have username and psw\n"); | ||
1451 | return QLA_ERROR; | ||
1452 | } | ||
1453 | |||
1449 | mutex_lock(&ha->chap_sem); | 1454 | mutex_lock(&ha->chap_sem); |
1450 | for (i = 0; i < max_chap_entries; i++) { | 1455 | for (i = 0; i < max_chap_entries; i++) { |
1451 | chap_table = (struct ql4_chap_table *)ha->chap_list + i; | 1456 | chap_table = (struct ql4_chap_table *)ha->chap_list + i; |
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index c6cfe324ab2f..cbaf2b33e485 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c | |||
@@ -83,6 +83,8 @@ static void qla4xxx_config_dma_addressing(struct scsi_qla_host *ha); | |||
83 | /* | 83 | /* |
84 | * iSCSI template entry points | 84 | * iSCSI template entry points |
85 | */ | 85 | */ |
86 | static int qla4xxx_session_get_param(struct iscsi_cls_session *cls_sess, | ||
87 | enum iscsi_param param, char *buf); | ||
86 | static int qla4xxx_conn_get_param(struct iscsi_cls_conn *conn, | 88 | static int qla4xxx_conn_get_param(struct iscsi_cls_conn *conn, |
87 | enum iscsi_param param, char *buf); | 89 | enum iscsi_param param, char *buf); |
88 | static int qla4xxx_host_get_param(struct Scsi_Host *shost, | 90 | static int qla4xxx_host_get_param(struct Scsi_Host *shost, |
@@ -186,7 +188,7 @@ static struct iscsi_transport qla4xxx_iscsi_transport = { | |||
186 | .destroy_conn = qla4xxx_conn_destroy, | 188 | .destroy_conn = qla4xxx_conn_destroy, |
187 | .set_param = iscsi_set_param, | 189 | .set_param = iscsi_set_param, |
188 | .get_conn_param = qla4xxx_conn_get_param, | 190 | .get_conn_param = qla4xxx_conn_get_param, |
189 | .get_session_param = iscsi_session_get_param, | 191 | .get_session_param = qla4xxx_session_get_param, |
190 | .get_ep_param = qla4xxx_get_ep_param, | 192 | .get_ep_param = qla4xxx_get_ep_param, |
191 | .ep_connect = qla4xxx_ep_connect, | 193 | .ep_connect = qla4xxx_ep_connect, |
192 | .ep_poll = qla4xxx_ep_poll, | 194 | .ep_poll = qla4xxx_ep_poll, |
@@ -317,6 +319,12 @@ static umode_t ql4_attr_is_visible(int param_type, int param) | |||
317 | case ISCSI_PARAM_MAX_RECV_DLENGTH: | 319 | case ISCSI_PARAM_MAX_RECV_DLENGTH: |
318 | case ISCSI_PARAM_MAX_XMIT_DLENGTH: | 320 | case ISCSI_PARAM_MAX_XMIT_DLENGTH: |
319 | case ISCSI_PARAM_IFACE_NAME: | 321 | case ISCSI_PARAM_IFACE_NAME: |
322 | case ISCSI_PARAM_CHAP_OUT_IDX: | ||
323 | case ISCSI_PARAM_CHAP_IN_IDX: | ||
324 | case ISCSI_PARAM_USERNAME: | ||
325 | case ISCSI_PARAM_PASSWORD: | ||
326 | case ISCSI_PARAM_USERNAME_IN: | ||
327 | case ISCSI_PARAM_PASSWORD_IN: | ||
320 | return S_IRUGO; | 328 | return S_IRUGO; |
321 | default: | 329 | default: |
322 | return 0; | 330 | return 0; |
@@ -1288,6 +1296,41 @@ exit_init_fw_cb: | |||
1288 | return rval; | 1296 | return rval; |
1289 | } | 1297 | } |
1290 | 1298 | ||
1299 | static int qla4xxx_session_get_param(struct iscsi_cls_session *cls_sess, | ||
1300 | enum iscsi_param param, char *buf) | ||
1301 | { | ||
1302 | struct iscsi_session *sess = cls_sess->dd_data; | ||
1303 | struct ddb_entry *ddb_entry = sess->dd_data; | ||
1304 | struct scsi_qla_host *ha = ddb_entry->ha; | ||
1305 | int rval, len; | ||
1306 | uint16_t idx; | ||
1307 | |||
1308 | switch (param) { | ||
1309 | case ISCSI_PARAM_CHAP_IN_IDX: | ||
1310 | rval = qla4xxx_get_chap_index(ha, sess->username_in, | ||
1311 | sess->password_in, BIDI_CHAP, | ||
1312 | &idx); | ||
1313 | if (rval) | ||
1314 | return -EINVAL; | ||
1315 | |||
1316 | len = sprintf(buf, "%hu\n", idx); | ||
1317 | break; | ||
1318 | case ISCSI_PARAM_CHAP_OUT_IDX: | ||
1319 | rval = qla4xxx_get_chap_index(ha, sess->username, | ||
1320 | sess->password, LOCAL_CHAP, | ||
1321 | &idx); | ||
1322 | if (rval) | ||
1323 | return -EINVAL; | ||
1324 | |||
1325 | len = sprintf(buf, "%hu\n", idx); | ||
1326 | break; | ||
1327 | default: | ||
1328 | return iscsi_session_get_param(cls_sess, param, buf); | ||
1329 | } | ||
1330 | |||
1331 | return len; | ||
1332 | } | ||
1333 | |||
1291 | static int qla4xxx_conn_get_param(struct iscsi_cls_conn *cls_conn, | 1334 | static int qla4xxx_conn_get_param(struct iscsi_cls_conn *cls_conn, |
1292 | enum iscsi_param param, char *buf) | 1335 | enum iscsi_param param, char *buf) |
1293 | { | 1336 | { |