[SCSI] qla4xxx: Export CHAP index as sysfs attribute
[pandora-kernel.git] / drivers / scsi / qla4xxx / ql4_mbx.c
index c259378..71331e3 100644 (file)
@@ -219,6 +219,13 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,
                ha->mailbox_timeout_count++;
                mbx_sts[0] = (-1);
                set_bit(DPC_RESET_HA, &ha->dpc_flags);
+               if (is_qla8022(ha)) {
+                       ql4_printk(KERN_INFO, ha,
+                                  "disabling pause transmit on port 0 & 1.\n");
+                       qla4_8xxx_wr_32(ha, QLA82XX_CRB_NIU + 0x98,
+                                       CRB_NIU_XG_PAUSE_CTL_P0 |
+                                       CRB_NIU_XG_PAUSE_CTL_P1);
+               }
                goto mbox_exit;
        }
 
@@ -654,6 +661,8 @@ int qla4xxx_get_fwddb_entry(struct scsi_qla_host *ha,
        }
        memset(&mbox_cmd, 0, sizeof(mbox_cmd));
        memset(&mbox_sts, 0, sizeof(mbox_sts));
+       if (fw_ddb_entry)
+               memset(fw_ddb_entry, 0, sizeof(struct dev_db_entry));
 
        mbox_cmd[0] = MBOX_CMD_GET_DATABASE_ENTRY;
        mbox_cmd[1] = (uint32_t) fw_ddb_index;
@@ -1417,8 +1426,8 @@ exit_set_chap:
  * match is found. If a match is not found then add the entry in FLASH and
  * return the index at which entry is written in the FLASH.
  **/
-static int qla4xxx_get_chap_index(struct scsi_qla_host *ha, char *username,
-                           char *password, int bidi, uint16_t *chap_index)
+int qla4xxx_get_chap_index(struct scsi_qla_host *ha, char *username,
+                          char *password, int bidi, uint16_t *chap_index)
 {
        int i, rval;
        int free_index = -1;
@@ -1437,6 +1446,11 @@ static int qla4xxx_get_chap_index(struct scsi_qla_host *ha, char *username,
                return QLA_ERROR;
        }
 
+       if (!username || !password) {
+               ql4_printk(KERN_ERR, ha, "Do not have username and psw\n");
+               return QLA_ERROR;
+       }
+
        mutex_lock(&ha->chap_sem);
        for (i = 0; i < max_chap_entries; i++) {
                chap_table = (struct ql4_chap_table *)ha->chap_list + i;