]> git.baikalelectronics.ru Git - kernel.git/commitdiff
[SCSI] qla4xxx: Support setting of local CHAP index for flash target entry
authorAdheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Tue, 17 Sep 2013 11:54:45 +0000 (07:54 -0400)
committerJames Bottomley <JBottomley@Parallels.com>
Fri, 25 Oct 2013 08:57:59 +0000 (09:57 +0100)
Support setting of CHAP_OUT_IDX param for the target entry in flash.
Setting of valid local CHAP index with enable CHAP AUTH for that
flash target entry and disabling CHAP AUTH will invalidate the CHAP
index for the flash target entry.

Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/qla4xxx/ql4_fw.h
drivers/scsi/qla4xxx/ql4_os.c

index 51d1a70f8b452517f4f5fcfb62d903746d08952f..1243e5942b76dfe3883e38303937f0688f22c199 100644 (file)
@@ -539,6 +539,10 @@ struct qla_flt_region {
 #define ENABLE_INTERNAL_LOOPBACK       0x04
 #define ENABLE_EXTERNAL_LOOPBACK       0x08
 
+/* generic defines to enable/disable params */
+#define QL4_PARAM_DISABLE      0
+#define QL4_PARAM_ENABLE       1
+
 /*************************************************************************/
 
 /* Host Adapter Initialization Control Block (from host) */
index a8847a31273d3fcf5beb8b3045d422967db6ba65..057d06861ad750e0c18a6798dd2af84e462c64f8 100644 (file)
@@ -6684,10 +6684,13 @@ qla4xxx_sysfs_ddb_set_param(struct iscsi_bus_flash_session *fnode_sess,
        struct Scsi_Host *shost = iscsi_flash_session_to_shost(fnode_sess);
        struct scsi_qla_host *ha = to_qla_host(shost);
        struct iscsi_flashnode_param_info *fnode_param;
+       struct ql4_chap_table chap_tbl;
        struct nlattr *attr;
+       uint16_t chap_out_idx = INVALID_ENTRY;
        int rc = QLA_ERROR;
        uint32_t rem = len;
 
+       memset((void *)&chap_tbl, 0, sizeof(chap_tbl));
        nla_for_each_attr(attr, data, len, rem) {
                fnode_param = nla_data(attr);
 
@@ -6729,6 +6732,10 @@ qla4xxx_sysfs_ddb_set_param(struct iscsi_bus_flash_session *fnode_sess,
                        break;
                case ISCSI_FLASHNODE_CHAP_AUTH_EN:
                        fnode_sess->chap_auth_en = fnode_param->value[0];
+                       /* Invalidate chap index if chap auth is disabled */
+                       if (!fnode_sess->chap_auth_en)
+                               fnode_sess->chap_out_idx = INVALID_ENTRY;
+
                        break;
                case ISCSI_FLASHNODE_SNACK_REQ_EN:
                        fnode_conn->snack_req_en = fnode_param->value[0];
@@ -6867,6 +6874,17 @@ qla4xxx_sysfs_ddb_set_param(struct iscsi_bus_flash_session *fnode_sess,
                        fnode_conn->exp_statsn =
                                                *(uint32_t *)fnode_param->value;
                        break;
+               case ISCSI_FLASHNODE_CHAP_OUT_IDX:
+                       chap_out_idx = *(uint16_t *)fnode_param->value;
+                       if (!qla4xxx_get_uni_chap_at_index(ha,
+                                                          chap_tbl.name,
+                                                          chap_tbl.secret,
+                                                          chap_out_idx)) {
+                               fnode_sess->chap_out_idx = chap_out_idx;
+                               /* Enable chap auth if chap index is valid */
+                               fnode_sess->chap_auth_en = QL4_PARAM_ENABLE;
+                       }
+                       break;
                default:
                        ql4_printk(KERN_ERR, ha,
                                   "%s: No such sysfs attribute\n", __func__);