diff options
author | Lalit Chandivade <lalit.chandivade@qlogic.com> | 2011-10-07 19:55:45 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-10-16 12:09:49 -0400 |
commit | 166dd20d794e7885b23c8d5fc533949ed82cc337 (patch) | |
tree | 821795655f9a153261eabfec9374d1acee88be61 /drivers/scsi/qla4xxx | |
parent | 28deb45cea848e8389530b17c987339b62fea459 (diff) |
[SCSI] qla4xxx: Free Device Database (DDB) reserved by FW
Firmware reserves DDBs if there are entries in the FLASH.
So there are no free DDBs left when a iSCSI login is initiated
by user space tool like iscsiadm.
Since now login is not controlled by firmware, LLD need to free
up the DDBs after firmware init. This will ensure free DDBs are
available for iSCSI logins using iscsiadm.
JIRA Key: UPSISCSI-151
Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
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_init.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c index b0bffe15c287..064a3a311e77 100644 --- a/drivers/scsi/qla4xxx/ql4_init.c +++ b/drivers/scsi/qla4xxx/ql4_init.c | |||
@@ -765,6 +765,44 @@ int qla4xxx_start_firmware(struct scsi_qla_host *ha) | |||
765 | } | 765 | } |
766 | return status; | 766 | return status; |
767 | } | 767 | } |
768 | /** | ||
769 | * qla4xxx_free_ddb_index - Free DDBs reserved by firmware | ||
770 | * @ha: pointer to adapter structure | ||
771 | * | ||
772 | * Since firmware is not running in autoconnect mode the DDB indices should | ||
773 | * be freed so that when login happens from user space there are free DDB | ||
774 | * indices available. | ||
775 | **/ | ||
776 | static void qla4xxx_free_ddb_index(struct scsi_qla_host *ha) | ||
777 | { | ||
778 | int max_ddbs; | ||
779 | int ret; | ||
780 | uint32_t idx = 0, next_idx = 0; | ||
781 | uint32_t state = 0, conn_err = 0; | ||
782 | |||
783 | max_ddbs = is_qla40XX(ha) ? MAX_PRST_DEV_DB_ENTRIES : | ||
784 | MAX_DEV_DB_ENTRIES; | ||
785 | |||
786 | for (idx = 0; idx < max_ddbs; idx = next_idx) { | ||
787 | ret = qla4xxx_get_fwddb_entry(ha, idx, NULL, 0, NULL, | ||
788 | &next_idx, &state, &conn_err, | ||
789 | NULL, NULL); | ||
790 | if (ret == QLA_ERROR) | ||
791 | continue; | ||
792 | if (state == DDB_DS_NO_CONNECTION_ACTIVE || | ||
793 | state == DDB_DS_SESSION_FAILED) { | ||
794 | DEBUG2(ql4_printk(KERN_INFO, ha, | ||
795 | "Freeing DDB index = 0x%x\n", idx)); | ||
796 | ret = qla4xxx_clear_ddb_entry(ha, idx); | ||
797 | if (ret == QLA_ERROR) | ||
798 | ql4_printk(KERN_ERR, ha, | ||
799 | "Unable to clear DDB index = " | ||
800 | "0x%x\n", idx); | ||
801 | } | ||
802 | if (next_idx == 0) | ||
803 | break; | ||
804 | } | ||
805 | } | ||
768 | 806 | ||
769 | 807 | ||
770 | /** | 808 | /** |
@@ -802,6 +840,8 @@ int qla4xxx_initialize_adapter(struct scsi_qla_host *ha) | |||
802 | if (status == QLA_ERROR) | 840 | if (status == QLA_ERROR) |
803 | goto exit_init_hba; | 841 | goto exit_init_hba; |
804 | 842 | ||
843 | qla4xxx_free_ddb_index(ha); | ||
844 | |||
805 | set_bit(AF_ONLINE, &ha->flags); | 845 | set_bit(AF_ONLINE, &ha->flags); |
806 | exit_init_hba: | 846 | exit_init_hba: |
807 | if (is_qla8022(ha) && (status == QLA_ERROR)) { | 847 | if (is_qla8022(ha) && (status == QLA_ERROR)) { |