Commit 21e855cd authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen

scsi: qla2xxx: Split qla2x00_configure_local_loop()

The size of the function qla2x00_configure_local_loop() hurts its
readability. Hence split that function. This patch does not change any
functionality.

Link: https://lore.kernel.org/r/20200405225905.17171-1-bvanassche@acm.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Himanshu Madhani <hmadhani@marvell.com>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Daniel Wagner <dwagner@suse.de>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: default avatarRoman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: default avatarDaniel Wagner <dwagner@suse.de>
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent b9b97e69
...@@ -5081,34 +5081,13 @@ qla2x00_configure_loop(scsi_qla_host_t *vha) ...@@ -5081,34 +5081,13 @@ qla2x00_configure_loop(scsi_qla_host_t *vha)
return (rval); return (rval);
} }
/* static int qla2x00_configure_n2n_loop(scsi_qla_host_t *vha)
* qla2x00_configure_local_loop
* Updates Fibre Channel Device Database with local loop devices.
*
* Input:
* ha = adapter block pointer.
*
* Returns:
* 0 = success.
*/
static int
qla2x00_configure_local_loop(scsi_qla_host_t *vha)
{ {
int rval, rval2;
int found_devs;
int found;
fc_port_t *fcport, *new_fcport;
uint16_t index;
uint16_t entries;
struct gid_list_info *gid;
uint16_t loop_id;
uint8_t domain, area, al_pa;
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
unsigned long flags; unsigned long flags;
fc_port_t *fcport;
int rval;
/* Inititae N2N login. */
if (N2N_TOPO(ha)) {
if (test_and_clear_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags)) { if (test_and_clear_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags)) {
/* borrowing */ /* borrowing */
u32 *bp, sz; u32 *bp, sz;
...@@ -5116,14 +5095,13 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha) ...@@ -5116,14 +5095,13 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)
memset(ha->init_cb, 0, ha->init_cb_size); memset(ha->init_cb, 0, ha->init_cb_size);
sz = min_t(int, sizeof(struct els_plogi_payload), sz = min_t(int, sizeof(struct els_plogi_payload),
ha->init_cb_size); ha->init_cb_size);
rval = qla24xx_get_port_login_templ(vha, rval = qla24xx_get_port_login_templ(vha, ha->init_cb_dma,
ha->init_cb_dma, (void *)ha->init_cb, sz); ha->init_cb, sz);
if (rval == QLA_SUCCESS) { if (rval == QLA_SUCCESS) {
__be32 *q = &ha->plogi_els_payld.data[0]; __be32 *q = &ha->plogi_els_payld.data[0];
bp = (uint32_t *)ha->init_cb; bp = (uint32_t *)ha->init_cb;
cpu_to_be32_array(q, bp, sz / 4); cpu_to_be32_array(q, bp, sz / 4);
memcpy(bp, q, sizeof(ha->plogi_els_payld.data)); memcpy(bp, q, sizeof(ha->plogi_els_payld.data));
} else { } else {
ql_dbg(ql_dbg_init, vha, 0x00d1, ql_dbg(ql_dbg_init, vha, 0x00d1,
...@@ -5138,6 +5116,7 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha) ...@@ -5138,6 +5116,7 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)
return QLA_SUCCESS; return QLA_SUCCESS;
} }
} }
skip_login: skip_login:
spin_lock_irqsave(&vha->work_lock, flags); spin_lock_irqsave(&vha->work_lock, flags);
vha->scan.scan_retry++; vha->scan.scan_retry++;
...@@ -5148,7 +5127,36 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha) ...@@ -5148,7 +5127,36 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
} }
return QLA_FUNCTION_FAILED; return QLA_FUNCTION_FAILED;
} }
/*
* qla2x00_configure_local_loop
* Updates Fibre Channel Device Database with local loop devices.
*
* Input:
* ha = adapter block pointer.
*
* Returns:
* 0 = success.
*/
static int
qla2x00_configure_local_loop(scsi_qla_host_t *vha)
{
int rval, rval2;
int found_devs;
int found;
fc_port_t *fcport, *new_fcport;
uint16_t index;
uint16_t entries;
struct gid_list_info *gid;
uint16_t loop_id;
uint8_t domain, area, al_pa;
struct qla_hw_data *ha = vha->hw;
unsigned long flags;
/* Inititae N2N login. */
if (N2N_TOPO(ha))
return qla2x00_configure_n2n_loop(vha);
found_devs = 0; found_devs = 0;
new_fcport = NULL; new_fcport = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment