aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx
diff options
context:
space:
mode:
authorAndrew Vasquez <andrew.vasquez@qlogic.com>2012-02-09 14:15:56 -0500
committerJames Bottomley <JBottomley@Parallels.com>2012-02-19 09:26:45 -0500
commit7a67735b07aa1bf61b8535eec6f6fb6474cf7926 (patch)
tree6f4457b3dad76833c3f71ff98cbf43aca85f54b1 /drivers/scsi/qla2xxx
parent733a95bd39d79c5759c1f7016a94c08e7367076d (diff)
[SCSI] qla2xxx: Cache swl during fabric discovery.
Rather than continuously allocating and freeing swl within the discovery process, simply pre-allocate it the first time that it's needed, cache it through the rest of the lifecycle of the driver and free it at module unload. Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h2
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c12
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c1
3 files changed, 8 insertions, 7 deletions
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 9d353ca4e1c7..649748ffbe79 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2674,6 +2674,8 @@ struct qla_hw_data {
2674 void *async_pd; 2674 void *async_pd;
2675 dma_addr_t async_pd_dma; 2675 dma_addr_t async_pd_dma;
2676 2676
2677 void *swl;
2678
2677 /* These are used by mailbox operations. */ 2679 /* These are used by mailbox operations. */
2678 volatile uint16_t mailbox_out[MAILBOX_REGISTER_COUNT]; 2680 volatile uint16_t mailbox_out[MAILBOX_REGISTER_COUNT];
2679 2681
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index b28eb40d8adf..24b2d1118593 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -3133,20 +3133,21 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha,
3133 rval = QLA_SUCCESS; 3133 rval = QLA_SUCCESS;
3134 3134
3135 /* Try GID_PT to get device list, else GAN. */ 3135 /* Try GID_PT to get device list, else GAN. */
3136 swl = kcalloc(MAX_FIBRE_DEVICES, sizeof(sw_info_t), GFP_KERNEL); 3136 if (!ha->swl)
3137 ha->swl = kcalloc(MAX_FIBRE_DEVICES, sizeof(sw_info_t),
3138 GFP_KERNEL);
3139 swl = ha->swl;
3137 if (!swl) { 3140 if (!swl) {
3138 /*EMPTY*/ 3141 /*EMPTY*/
3139 ql_dbg(ql_dbg_disc, vha, 0x2054, 3142 ql_dbg(ql_dbg_disc, vha, 0x2054,
3140 "GID_PT allocations failed, fallback on GA_NXT.\n"); 3143 "GID_PT allocations failed, fallback on GA_NXT.\n");
3141 } else { 3144 } else {
3145 memset(swl, 0, MAX_FIBRE_DEVICES * sizeof(sw_info_t));
3142 if (qla2x00_gid_pt(vha, swl) != QLA_SUCCESS) { 3146 if (qla2x00_gid_pt(vha, swl) != QLA_SUCCESS) {
3143 kfree(swl);
3144 swl = NULL; 3147 swl = NULL;
3145 } else if (qla2x00_gpn_id(vha, swl) != QLA_SUCCESS) { 3148 } else if (qla2x00_gpn_id(vha, swl) != QLA_SUCCESS) {
3146 kfree(swl);
3147 swl = NULL; 3149 swl = NULL;
3148 } else if (qla2x00_gnn_id(vha, swl) != QLA_SUCCESS) { 3150 } else if (qla2x00_gnn_id(vha, swl) != QLA_SUCCESS) {
3149 kfree(swl);
3150 swl = NULL; 3151 swl = NULL;
3151 } else if (ql2xiidmaenable && 3152 } else if (ql2xiidmaenable &&
3152 qla2x00_gfpn_id(vha, swl) == QLA_SUCCESS) { 3153 qla2x00_gfpn_id(vha, swl) == QLA_SUCCESS) {
@@ -3164,7 +3165,6 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha,
3164 if (new_fcport == NULL) { 3165 if (new_fcport == NULL) {
3165 ql_log(ql_log_warn, vha, 0x205e, 3166 ql_log(ql_log_warn, vha, 0x205e,
3166 "Failed to allocate memory for fcport.\n"); 3167 "Failed to allocate memory for fcport.\n");
3167 kfree(swl);
3168 return (QLA_MEMORY_ALLOC_FAILED); 3168 return (QLA_MEMORY_ALLOC_FAILED);
3169 } 3169 }
3170 new_fcport->flags |= (FCF_FABRIC_DEVICE | FCF_LOGIN_NEEDED); 3170 new_fcport->flags |= (FCF_FABRIC_DEVICE | FCF_LOGIN_NEEDED);
@@ -3341,14 +3341,12 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha,
3341 if (new_fcport == NULL) { 3341 if (new_fcport == NULL) {
3342 ql_log(ql_log_warn, vha, 0x2066, 3342 ql_log(ql_log_warn, vha, 0x2066,
3343 "Memory allocation failed for fcport.\n"); 3343 "Memory allocation failed for fcport.\n");
3344 kfree(swl);
3345 return (QLA_MEMORY_ALLOC_FAILED); 3344 return (QLA_MEMORY_ALLOC_FAILED);
3346 } 3345 }
3347 new_fcport->flags |= (FCF_FABRIC_DEVICE | FCF_LOGIN_NEEDED); 3346 new_fcport->flags |= (FCF_FABRIC_DEVICE | FCF_LOGIN_NEEDED);
3348 new_fcport->d_id.b24 = nxt_d_id.b24; 3347 new_fcport->d_id.b24 = nxt_d_id.b24;
3349 } 3348 }
3350 3349
3351 kfree(swl);
3352 kfree(new_fcport); 3350 kfree(new_fcport);
3353 3351
3354 return (rval); 3352 return (rval);
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index ffa3488eccae..94ff3a591471 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -3280,6 +3280,7 @@ qla2x00_mem_free(struct qla_hw_data *ha)
3280 vfree(ha->optrom_buffer); 3280 vfree(ha->optrom_buffer);
3281 kfree(ha->nvram); 3281 kfree(ha->nvram);
3282 kfree(ha->npiv_info); 3282 kfree(ha->npiv_info);
3283 kfree(ha->swl);
3283 3284
3284 ha->srb_mempool = NULL; 3285 ha->srb_mempool = NULL;
3285 ha->ctx_mempool = NULL; 3286 ha->ctx_mempool = NULL;