Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 482c9dc7 authored by Quinn Tran's avatar Quinn Tran Committed by Nicholas Bellinger
Browse files

qla2xxx: Change scsi host lookup method.



For target mode, when new scsi command arrive, driver first performs
a look up of the SCSI Host. The current look up method is based on
the ALPA portion of the NPort ID. For Cisco switch, the ALPA can
not be used as the index. Instead, the new search method is based
on the full value of the Nport_ID via btree lib.

Signed-off-by: default avatarQuinn Tran <quinn.tran@cavium.com>
Signed-off-by: default avatarHimanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent c423437e
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -3,6 +3,7 @@ config SCSI_QLA_FC
	depends on PCI && SCSI
	depends on PCI && SCSI
	depends on SCSI_FC_ATTRS
	depends on SCSI_FC_ATTRS
	select FW_LOADER
	select FW_LOADER
	select BTREE
	---help---
	---help---
	This qla2xxx driver supports all QLogic Fibre Channel
	This qla2xxx driver supports all QLogic Fibre Channel
	PCI and PCIe host adapters.
	PCI and PCIe host adapters.
+2 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@
#include <linux/firmware.h>
#include <linux/firmware.h>
#include <linux/aer.h>
#include <linux/aer.h>
#include <linux/mutex.h>
#include <linux/mutex.h>
#include <linux/btree.h>


#include <scsi/scsi.h>
#include <scsi/scsi.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_host.h>
@@ -3311,6 +3312,7 @@ struct qlt_hw_data {
	spinlock_t sess_lock;
	spinlock_t sess_lock;
	int rspq_vector_cpuid;
	int rspq_vector_cpuid;
	spinlock_t atio_lock ____cacheline_aligned;
	spinlock_t atio_lock ____cacheline_aligned;
	struct btree_head32 host_map;
};
};


#define MAX_QFULL_CMDS_ALLOC	8192
#define MAX_QFULL_CMDS_ALLOC	8192
+2 −0
Original line number Original line Diff line number Diff line
@@ -854,5 +854,7 @@ extern struct fc_port *qlt_find_sess_invalidate_other(scsi_qla_host_t *,
	uint64_t wwn, port_id_t port_id, uint16_t loop_id, struct fc_port **);
	uint64_t wwn, port_id_t port_id, uint16_t loop_id, struct fc_port **);
void qla24xx_delete_sess_fn(struct work_struct *);
void qla24xx_delete_sess_fn(struct work_struct *);
void qlt_unknown_atio_work_fn(struct work_struct *);
void qlt_unknown_atio_work_fn(struct work_struct *);
void qlt_update_host_map(struct scsi_qla_host *, port_id_t);
void qlt_remove_target_resources(struct qla_hw_data *);


#endif /* _QLA_GBL_H */
#endif /* _QLA_GBL_H */
+6 −8
Original line number Original line Diff line number Diff line
@@ -3340,8 +3340,8 @@ qla2x00_configure_hba(scsi_qla_host_t *vha)
	uint8_t       domain;
	uint8_t       domain;
	char		connect_type[22];
	char		connect_type[22];
	struct qla_hw_data *ha = vha->hw;
	struct qla_hw_data *ha = vha->hw;
	unsigned long flags;
	scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
	scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
	port_id_t id;


	/* Get host addresses. */
	/* Get host addresses. */
	rval = qla2x00_get_adapter_id(vha,
	rval = qla2x00_get_adapter_id(vha,
@@ -3419,13 +3419,11 @@ qla2x00_configure_hba(scsi_qla_host_t *vha)


	/* Save Host port and loop ID. */
	/* Save Host port and loop ID. */
	/* byte order - Big Endian */
	/* byte order - Big Endian */
	vha->d_id.b.domain = domain;
	id.b.domain = domain;
	vha->d_id.b.area = area;
	id.b.area = area;
	vha->d_id.b.al_pa = al_pa;
	id.b.al_pa = al_pa;

	id.b.rsvd_1 = 0;
	spin_lock_irqsave(&ha->vport_slock, flags);
	qlt_update_host_map(vha, id);
	qlt_update_vp_map(vha, SET_AL_PA);
	spin_unlock_irqrestore(&ha->vport_slock, flags);


	if (!vha->flags.init_done)
	if (!vha->flags.init_done)
		ql_log(ql_log_info, vha, 0x2010,
		ql_log(ql_log_info, vha, 0x2010,
+9 −19
Original line number Original line Diff line number Diff line
@@ -3623,6 +3623,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
	scsi_qla_host_t *vp = NULL;
	scsi_qla_host_t *vp = NULL;
	unsigned long   flags;
	unsigned long   flags;
	int found;
	int found;
	port_id_t id;


	ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x10b6,
	ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x10b6,
	    "Entered %s.\n", __func__);
	    "Entered %s.\n", __func__);
@@ -3630,6 +3631,11 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
	if (rptid_entry->entry_status != 0)
	if (rptid_entry->entry_status != 0)
		return;
		return;


	id.b.domain = rptid_entry->port_id[2];
	id.b.area   = rptid_entry->port_id[1];
	id.b.al_pa  = rptid_entry->port_id[0];
	id.b.rsvd_1 = 0;

	if (rptid_entry->format == 0) {
	if (rptid_entry->format == 0) {
		/* loop */
		/* loop */
		ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x10b7,
		ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x10b7,
@@ -3641,13 +3647,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
		    rptid_entry->port_id[2], rptid_entry->port_id[1],
		    rptid_entry->port_id[2], rptid_entry->port_id[1],
		    rptid_entry->port_id[0]);
		    rptid_entry->port_id[0]);


		vha->d_id.b.domain = rptid_entry->port_id[2];
		qlt_update_host_map(vha, id);
		vha->d_id.b.area = rptid_entry->port_id[1];
		vha->d_id.b.al_pa = rptid_entry->port_id[0];

		spin_lock_irqsave(&ha->vport_slock, flags);
		qlt_update_vp_map(vha, SET_AL_PA);
		spin_unlock_irqrestore(&ha->vport_slock, flags);


	} else if (rptid_entry->format == 1) {
	} else if (rptid_entry->format == 1) {
		/* fabric */
		/* fabric */
@@ -3673,12 +3673,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
					    WWN_SIZE);
					    WWN_SIZE);
				}
				}


				vha->d_id.b.domain = rptid_entry->port_id[2];
				qlt_update_host_map(vha, id);
				vha->d_id.b.area = rptid_entry->port_id[1];
				vha->d_id.b.al_pa = rptid_entry->port_id[0];
				spin_lock_irqsave(&ha->vport_slock, flags);
				qlt_update_vp_map(vha, SET_AL_PA);
				spin_unlock_irqrestore(&ha->vport_slock, flags);
			}
			}


			fc_host_port_name(vha->host) =
			fc_host_port_name(vha->host) =
@@ -3714,12 +3709,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
			if (!found)
			if (!found)
				return;
				return;


			vp->d_id.b.domain = rptid_entry->port_id[2];
			qlt_update_host_map(vp, id);
			vp->d_id.b.area =  rptid_entry->port_id[1];
			vp->d_id.b.al_pa = rptid_entry->port_id[0];
			spin_lock_irqsave(&ha->vport_slock, flags);
			qlt_update_vp_map(vp, SET_AL_PA);
			spin_unlock_irqrestore(&ha->vport_slock, flags);


			/*
			/*
			 * Cannot configure here as we are still sitting on the
			 * Cannot configure here as we are still sitting on the
Loading