mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 15:43:08 -04:00
scsi: qla2xxx: Relocate/rename vp map
There is no functional change in this patch. VP map resource is renamed and relocated so it is not viewed as just a target mode resource. Signed-off-by: Quinn Tran <qutran@marvell.com> Signed-off-by: Nilesh Javali <njavali@marvell.com> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
committed by
Martin K. Petersen
parent
87f6dafd50
commit
430eef03a7
@@ -3935,7 +3935,6 @@ struct qlt_hw_data {
|
|||||||
__le32 __iomem *atio_q_out;
|
__le32 __iomem *atio_q_out;
|
||||||
|
|
||||||
const struct qla_tgt_func_tmpl *tgt_ops;
|
const struct qla_tgt_func_tmpl *tgt_ops;
|
||||||
struct qla_tgt_vp_map *tgt_vp_map;
|
|
||||||
|
|
||||||
int saved_set;
|
int saved_set;
|
||||||
__le16 saved_exchange_count;
|
__le16 saved_exchange_count;
|
||||||
@@ -4759,6 +4758,7 @@ struct qla_hw_data {
|
|||||||
spinlock_t sadb_lock; /* protects list */
|
spinlock_t sadb_lock; /* protects list */
|
||||||
struct els_reject elsrej;
|
struct els_reject elsrej;
|
||||||
u8 edif_post_stop_cnt_down;
|
u8 edif_post_stop_cnt_down;
|
||||||
|
struct qla_vp_map *vp_map;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define RX_ELS_SIZE (roundup(sizeof(struct enode) + ELS_MAX_PAYLOAD, SMP_CACHE_BYTES))
|
#define RX_ELS_SIZE (roundup(sizeof(struct enode) + ELS_MAX_PAYLOAD, SMP_CACHE_BYTES))
|
||||||
@@ -5059,7 +5059,7 @@ struct qla27xx_image_status {
|
|||||||
#define SET_AL_PA 2
|
#define SET_AL_PA 2
|
||||||
#define RESET_VP_IDX 3
|
#define RESET_VP_IDX 3
|
||||||
#define RESET_AL_PA 4
|
#define RESET_AL_PA 4
|
||||||
struct qla_tgt_vp_map {
|
struct qla_vp_map {
|
||||||
uint8_t idx;
|
uint8_t idx;
|
||||||
scsi_qla_host_t *vha;
|
scsi_qla_host_t *vha;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -145,4 +145,6 @@ struct enode {
|
|||||||
(qla_ini_mode_enabled(_s->vha) && (_s->disc_state == DSC_DELETE_PEND || \
|
(qla_ini_mode_enabled(_s->vha) && (_s->disc_state == DSC_DELETE_PEND || \
|
||||||
_s->disc_state == DSC_DELETED))
|
_s->disc_state == DSC_DELETED))
|
||||||
|
|
||||||
|
#define EDIF_CAP(_ha) (ql2xsecenable && IS_QLA28XX(_ha))
|
||||||
|
|
||||||
#endif /* __QLA_EDIF_H */
|
#endif /* __QLA_EDIF_H */
|
||||||
|
|||||||
@@ -257,6 +257,7 @@ struct edif_sa_ctl *qla_edif_find_sa_ctl_by_index(fc_port_t *fcport,
|
|||||||
/*
|
/*
|
||||||
* Global Functions in qla_mid.c source file.
|
* Global Functions in qla_mid.c source file.
|
||||||
*/
|
*/
|
||||||
|
extern void qla_update_vp_map(struct scsi_qla_host *, int);
|
||||||
extern struct scsi_host_template qla2xxx_driver_template;
|
extern struct scsi_host_template qla2xxx_driver_template;
|
||||||
extern struct scsi_transport_template *qla2xxx_transport_vport_template;
|
extern struct scsi_transport_template *qla2xxx_transport_vport_template;
|
||||||
extern void qla2x00_timer(struct timer_list *);
|
extern void qla2x00_timer(struct timer_list *);
|
||||||
@@ -955,7 +956,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 qla_update_host_map(struct scsi_qla_host *, port_id_t);
|
||||||
void qla_remove_hostmap(struct qla_hw_data *ha);
|
void qla_remove_hostmap(struct qla_hw_data *ha);
|
||||||
void qlt_clr_qp_table(struct scsi_qla_host *vha);
|
void qlt_clr_qp_table(struct scsi_qla_host *vha);
|
||||||
void qlt_set_mode(struct scsi_qla_host *);
|
void qlt_set_mode(struct scsi_qla_host *);
|
||||||
@@ -968,6 +969,8 @@ extern void qla_nvme_abort_set_option
|
|||||||
(struct abort_entry_24xx *abt, srb_t *sp);
|
(struct abort_entry_24xx *abt, srb_t *sp);
|
||||||
extern void qla_nvme_abort_process_comp_status
|
extern void qla_nvme_abort_process_comp_status
|
||||||
(struct abort_entry_24xx *abt, srb_t *sp);
|
(struct abort_entry_24xx *abt, srb_t *sp);
|
||||||
|
struct scsi_qla_host *qla_find_host_by_vp_idx(struct scsi_qla_host *vha,
|
||||||
|
uint16_t vp_idx);
|
||||||
|
|
||||||
/* nvme.c */
|
/* nvme.c */
|
||||||
void qla_nvme_unregister_remote_port(struct fc_port *fcport);
|
void qla_nvme_unregister_remote_port(struct fc_port *fcport);
|
||||||
|
|||||||
@@ -4822,9 +4822,9 @@ qla2x00_configure_hba(scsi_qla_host_t *vha)
|
|||||||
spin_lock_irqsave(&ha->hardware_lock, flags);
|
spin_lock_irqsave(&ha->hardware_lock, flags);
|
||||||
if (vha->hw->flags.edif_enabled) {
|
if (vha->hw->flags.edif_enabled) {
|
||||||
if (topo != 2)
|
if (topo != 2)
|
||||||
qlt_update_host_map(vha, id);
|
qla_update_host_map(vha, id);
|
||||||
} else if (!(topo == 2 && ha->flags.n2n_bigger))
|
} else if (!(topo == 2 && ha->flags.n2n_bigger))
|
||||||
qlt_update_host_map(vha, id);
|
qla_update_host_map(vha, id);
|
||||||
spin_unlock_irqrestore(&ha->hardware_lock, flags);
|
spin_unlock_irqrestore(&ha->hardware_lock, flags);
|
||||||
|
|
||||||
if (!vha->flags.init_done)
|
if (!vha->flags.init_done)
|
||||||
|
|||||||
@@ -4010,7 +4010,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]);
|
||||||
ha->current_topology = ISP_CFG_NL;
|
ha->current_topology = ISP_CFG_NL;
|
||||||
qlt_update_host_map(vha, id);
|
qla_update_host_map(vha, id);
|
||||||
|
|
||||||
} else if (rptid_entry->format == 1) {
|
} else if (rptid_entry->format == 1) {
|
||||||
/* fabric */
|
/* fabric */
|
||||||
@@ -4126,7 +4126,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
|
|||||||
WWN_SIZE);
|
WWN_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
qlt_update_host_map(vha, id);
|
qla_update_host_map(vha, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
set_bit(REGISTER_FC4_NEEDED, &vha->dpc_flags);
|
set_bit(REGISTER_FC4_NEEDED, &vha->dpc_flags);
|
||||||
@@ -4153,7 +4153,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
|
|||||||
if (!found)
|
if (!found)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
qlt_update_host_map(vp, id);
|
qla_update_host_map(vp, id);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cannot configure here as we are still sitting on the
|
* Cannot configure here as we are still sitting on the
|
||||||
@@ -4184,7 +4184,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
|
|||||||
|
|
||||||
ha->flags.n2n_ae = 1;
|
ha->flags.n2n_ae = 1;
|
||||||
spin_lock_irqsave(&ha->vport_slock, flags);
|
spin_lock_irqsave(&ha->vport_slock, flags);
|
||||||
qlt_update_vp_map(vha, SET_AL_PA);
|
qla_update_vp_map(vha, SET_AL_PA);
|
||||||
spin_unlock_irqrestore(&ha->vport_slock, flags);
|
spin_unlock_irqrestore(&ha->vport_slock, flags);
|
||||||
|
|
||||||
list_for_each_entry(fcport, &vha->vp_fcports, list) {
|
list_for_each_entry(fcport, &vha->vp_fcports, list) {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ qla24xx_allocate_vp_id(scsi_qla_host_t *vha)
|
|||||||
spin_unlock_irqrestore(&ha->vport_slock, flags);
|
spin_unlock_irqrestore(&ha->vport_slock, flags);
|
||||||
|
|
||||||
spin_lock_irqsave(&ha->hardware_lock, flags);
|
spin_lock_irqsave(&ha->hardware_lock, flags);
|
||||||
qlt_update_vp_map(vha, SET_VP_IDX);
|
qla_update_vp_map(vha, SET_VP_IDX);
|
||||||
spin_unlock_irqrestore(&ha->hardware_lock, flags);
|
spin_unlock_irqrestore(&ha->hardware_lock, flags);
|
||||||
|
|
||||||
mutex_unlock(&ha->vport_lock);
|
mutex_unlock(&ha->vport_lock);
|
||||||
@@ -80,7 +80,7 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha)
|
|||||||
spin_lock_irqsave(&ha->vport_slock, flags);
|
spin_lock_irqsave(&ha->vport_slock, flags);
|
||||||
if (atomic_read(&vha->vref_count) == 0) {
|
if (atomic_read(&vha->vref_count) == 0) {
|
||||||
list_del(&vha->list);
|
list_del(&vha->list);
|
||||||
qlt_update_vp_map(vha, RESET_VP_IDX);
|
qla_update_vp_map(vha, RESET_VP_IDX);
|
||||||
bailout = 1;
|
bailout = 1;
|
||||||
}
|
}
|
||||||
spin_unlock_irqrestore(&ha->vport_slock, flags);
|
spin_unlock_irqrestore(&ha->vport_slock, flags);
|
||||||
@@ -95,7 +95,7 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha)
|
|||||||
"vha->vref_count=%u timeout\n", vha->vref_count.counter);
|
"vha->vref_count=%u timeout\n", vha->vref_count.counter);
|
||||||
spin_lock_irqsave(&ha->vport_slock, flags);
|
spin_lock_irqsave(&ha->vport_slock, flags);
|
||||||
list_del(&vha->list);
|
list_del(&vha->list);
|
||||||
qlt_update_vp_map(vha, RESET_VP_IDX);
|
qla_update_vp_map(vha, RESET_VP_IDX);
|
||||||
spin_unlock_irqrestore(&ha->vport_slock, flags);
|
spin_unlock_irqrestore(&ha->vport_slock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ qla24xx_disable_vp(scsi_qla_host_t *vha)
|
|||||||
|
|
||||||
/* Remove port id from vp target map */
|
/* Remove port id from vp target map */
|
||||||
spin_lock_irqsave(&vha->hw->hardware_lock, flags);
|
spin_lock_irqsave(&vha->hw->hardware_lock, flags);
|
||||||
qlt_update_vp_map(vha, RESET_AL_PA);
|
qla_update_vp_map(vha, RESET_AL_PA);
|
||||||
spin_unlock_irqrestore(&vha->hw->hardware_lock, flags);
|
spin_unlock_irqrestore(&vha->hw->hardware_lock, flags);
|
||||||
|
|
||||||
qla2x00_mark_vp_devices_dead(vha);
|
qla2x00_mark_vp_devices_dead(vha);
|
||||||
@@ -1005,3 +1005,78 @@ int qla24xx_control_vp(scsi_qla_host_t *vha, int cmd)
|
|||||||
kref_put(&sp->cmd_kref, qla2x00_sp_release);
|
kref_put(&sp->cmd_kref, qla2x00_sp_release);
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct scsi_qla_host *qla_find_host_by_vp_idx(struct scsi_qla_host *vha, uint16_t vp_idx)
|
||||||
|
{
|
||||||
|
struct qla_hw_data *ha = vha->hw;
|
||||||
|
|
||||||
|
if (vha->vp_idx == vp_idx)
|
||||||
|
return vha;
|
||||||
|
|
||||||
|
BUG_ON(ha->vp_map == NULL);
|
||||||
|
if (likely(test_bit(vp_idx, ha->vp_idx_map)))
|
||||||
|
return ha->vp_map[vp_idx].vha;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vport_slock to be held by the caller */
|
||||||
|
void
|
||||||
|
qla_update_vp_map(struct scsi_qla_host *vha, int cmd)
|
||||||
|
{
|
||||||
|
void *slot;
|
||||||
|
u32 key;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
if (!vha->hw->vp_map)
|
||||||
|
return;
|
||||||
|
|
||||||
|
key = vha->d_id.b24;
|
||||||
|
|
||||||
|
switch (cmd) {
|
||||||
|
case SET_VP_IDX:
|
||||||
|
vha->hw->vp_map[vha->vp_idx].vha = vha;
|
||||||
|
break;
|
||||||
|
case SET_AL_PA:
|
||||||
|
slot = btree_lookup32(&vha->hw->host_map, key);
|
||||||
|
if (!slot) {
|
||||||
|
ql_dbg(ql_dbg_disc, vha, 0xf018,
|
||||||
|
"Save vha in host_map %p %06x\n", vha, key);
|
||||||
|
rc = btree_insert32(&vha->hw->host_map,
|
||||||
|
key, vha, GFP_ATOMIC);
|
||||||
|
if (rc)
|
||||||
|
ql_log(ql_log_info, vha, 0xd03e,
|
||||||
|
"Unable to insert s_id into host_map: %06x\n",
|
||||||
|
key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ql_dbg(ql_dbg_disc, vha, 0xf019,
|
||||||
|
"replace existing vha in host_map %p %06x\n", vha, key);
|
||||||
|
btree_update32(&vha->hw->host_map, key, vha);
|
||||||
|
break;
|
||||||
|
case RESET_VP_IDX:
|
||||||
|
vha->hw->vp_map[vha->vp_idx].vha = NULL;
|
||||||
|
break;
|
||||||
|
case RESET_AL_PA:
|
||||||
|
ql_dbg(ql_dbg_disc, vha, 0xf01a,
|
||||||
|
"clear vha in host_map %p %06x\n", vha, key);
|
||||||
|
slot = btree_lookup32(&vha->hw->host_map, key);
|
||||||
|
if (slot)
|
||||||
|
btree_remove32(&vha->hw->host_map, key);
|
||||||
|
vha->d_id.b24 = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void qla_update_host_map(struct scsi_qla_host *vha, port_id_t id)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!vha->d_id.b24) {
|
||||||
|
vha->d_id = id;
|
||||||
|
qla_update_vp_map(vha, SET_AL_PA);
|
||||||
|
} else if (vha->d_id.b24 != id.b24) {
|
||||||
|
qla_update_vp_map(vha, RESET_AL_PA);
|
||||||
|
vha->d_id = id;
|
||||||
|
qla_update_vp_map(vha, SET_AL_PA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4118,10 +4118,16 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
|
|||||||
char name[16];
|
char name[16];
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
if (QLA_TGT_MODE_ENABLED() || EDIF_CAP(ha)) {
|
||||||
|
ha->vp_map = kcalloc(MAX_MULTI_ID_FABRIC, sizeof(struct qla_vp_map), GFP_KERNEL);
|
||||||
|
if (!ha->vp_map)
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
ha->init_cb = dma_alloc_coherent(&ha->pdev->dev, ha->init_cb_size,
|
ha->init_cb = dma_alloc_coherent(&ha->pdev->dev, ha->init_cb_size,
|
||||||
&ha->init_cb_dma, GFP_KERNEL);
|
&ha->init_cb_dma, GFP_KERNEL);
|
||||||
if (!ha->init_cb)
|
if (!ha->init_cb)
|
||||||
goto fail;
|
goto fail_free_vp_map;
|
||||||
|
|
||||||
rc = btree_init32(&ha->host_map);
|
rc = btree_init32(&ha->host_map);
|
||||||
if (rc)
|
if (rc)
|
||||||
@@ -4540,6 +4546,8 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
|
|||||||
ha->init_cb_dma);
|
ha->init_cb_dma);
|
||||||
ha->init_cb = NULL;
|
ha->init_cb = NULL;
|
||||||
ha->init_cb_dma = 0;
|
ha->init_cb_dma = 0;
|
||||||
|
fail_free_vp_map:
|
||||||
|
kfree(ha->vp_map);
|
||||||
fail:
|
fail:
|
||||||
ql_log(ql_log_fatal, NULL, 0x0030,
|
ql_log(ql_log_fatal, NULL, 0x0030,
|
||||||
"Memory allocation failure.\n");
|
"Memory allocation failure.\n");
|
||||||
@@ -4981,6 +4989,9 @@ qla2x00_mem_free(struct qla_hw_data *ha)
|
|||||||
ha->sf_init_cb = NULL;
|
ha->sf_init_cb = NULL;
|
||||||
ha->sf_init_cb_dma = 0;
|
ha->sf_init_cb_dma = 0;
|
||||||
ha->loop_id_map = NULL;
|
ha->loop_id_map = NULL;
|
||||||
|
|
||||||
|
kfree(ha->vp_map);
|
||||||
|
ha->vp_map = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *sht,
|
struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *sht,
|
||||||
|
|||||||
@@ -198,22 +198,6 @@ struct scsi_qla_host *qla_find_host_by_d_id(struct scsi_qla_host *vha,
|
|||||||
return host;
|
return host;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline
|
|
||||||
struct scsi_qla_host *qlt_find_host_by_vp_idx(struct scsi_qla_host *vha,
|
|
||||||
uint16_t vp_idx)
|
|
||||||
{
|
|
||||||
struct qla_hw_data *ha = vha->hw;
|
|
||||||
|
|
||||||
if (vha->vp_idx == vp_idx)
|
|
||||||
return vha;
|
|
||||||
|
|
||||||
BUG_ON(ha->tgt.tgt_vp_map == NULL);
|
|
||||||
if (likely(test_bit(vp_idx, ha->vp_idx_map)))
|
|
||||||
return ha->tgt.tgt_vp_map[vp_idx].vha;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void qlt_incr_num_pend_cmds(struct scsi_qla_host *vha)
|
static inline void qlt_incr_num_pend_cmds(struct scsi_qla_host *vha)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
@@ -371,7 +355,7 @@ static bool qlt_24xx_atio_pkt_all_vps(struct scsi_qla_host *vha,
|
|||||||
|
|
||||||
if ((entry->u.isp24.vp_index != 0xFF) &&
|
if ((entry->u.isp24.vp_index != 0xFF) &&
|
||||||
(entry->u.isp24.nport_handle != cpu_to_le16(0xFFFF))) {
|
(entry->u.isp24.nport_handle != cpu_to_le16(0xFFFF))) {
|
||||||
host = qlt_find_host_by_vp_idx(vha,
|
host = qla_find_host_by_vp_idx(vha,
|
||||||
entry->u.isp24.vp_index);
|
entry->u.isp24.vp_index);
|
||||||
if (unlikely(!host)) {
|
if (unlikely(!host)) {
|
||||||
ql_dbg(ql_dbg_tgt, vha, 0xe03f,
|
ql_dbg(ql_dbg_tgt, vha, 0xe03f,
|
||||||
@@ -395,7 +379,7 @@ static bool qlt_24xx_atio_pkt_all_vps(struct scsi_qla_host *vha,
|
|||||||
{
|
{
|
||||||
struct abts_recv_from_24xx *entry =
|
struct abts_recv_from_24xx *entry =
|
||||||
(struct abts_recv_from_24xx *)atio;
|
(struct abts_recv_from_24xx *)atio;
|
||||||
struct scsi_qla_host *host = qlt_find_host_by_vp_idx(vha,
|
struct scsi_qla_host *host = qla_find_host_by_vp_idx(vha,
|
||||||
entry->vp_index);
|
entry->vp_index);
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
@@ -438,7 +422,7 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha,
|
|||||||
case CTIO_TYPE7:
|
case CTIO_TYPE7:
|
||||||
{
|
{
|
||||||
struct ctio7_from_24xx *entry = (struct ctio7_from_24xx *)pkt;
|
struct ctio7_from_24xx *entry = (struct ctio7_from_24xx *)pkt;
|
||||||
struct scsi_qla_host *host = qlt_find_host_by_vp_idx(vha,
|
struct scsi_qla_host *host = qla_find_host_by_vp_idx(vha,
|
||||||
entry->vp_index);
|
entry->vp_index);
|
||||||
if (unlikely(!host)) {
|
if (unlikely(!host)) {
|
||||||
ql_dbg(ql_dbg_tgt, vha, 0xe041,
|
ql_dbg(ql_dbg_tgt, vha, 0xe041,
|
||||||
@@ -457,7 +441,7 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha,
|
|||||||
struct imm_ntfy_from_isp *entry =
|
struct imm_ntfy_from_isp *entry =
|
||||||
(struct imm_ntfy_from_isp *)pkt;
|
(struct imm_ntfy_from_isp *)pkt;
|
||||||
|
|
||||||
host = qlt_find_host_by_vp_idx(vha, entry->u.isp24.vp_index);
|
host = qla_find_host_by_vp_idx(vha, entry->u.isp24.vp_index);
|
||||||
if (unlikely(!host)) {
|
if (unlikely(!host)) {
|
||||||
ql_dbg(ql_dbg_tgt, vha, 0xe042,
|
ql_dbg(ql_dbg_tgt, vha, 0xe042,
|
||||||
"qla_target(%d): Response pkt (IMMED_NOTIFY_TYPE) "
|
"qla_target(%d): Response pkt (IMMED_NOTIFY_TYPE) "
|
||||||
@@ -475,7 +459,7 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha,
|
|||||||
struct nack_to_isp *entry = (struct nack_to_isp *)pkt;
|
struct nack_to_isp *entry = (struct nack_to_isp *)pkt;
|
||||||
|
|
||||||
if (0xFF != entry->u.isp24.vp_index) {
|
if (0xFF != entry->u.isp24.vp_index) {
|
||||||
host = qlt_find_host_by_vp_idx(vha,
|
host = qla_find_host_by_vp_idx(vha,
|
||||||
entry->u.isp24.vp_index);
|
entry->u.isp24.vp_index);
|
||||||
if (unlikely(!host)) {
|
if (unlikely(!host)) {
|
||||||
ql_dbg(ql_dbg_tgt, vha, 0xe043,
|
ql_dbg(ql_dbg_tgt, vha, 0xe043,
|
||||||
@@ -495,7 +479,7 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha,
|
|||||||
{
|
{
|
||||||
struct abts_recv_from_24xx *entry =
|
struct abts_recv_from_24xx *entry =
|
||||||
(struct abts_recv_from_24xx *)pkt;
|
(struct abts_recv_from_24xx *)pkt;
|
||||||
struct scsi_qla_host *host = qlt_find_host_by_vp_idx(vha,
|
struct scsi_qla_host *host = qla_find_host_by_vp_idx(vha,
|
||||||
entry->vp_index);
|
entry->vp_index);
|
||||||
if (unlikely(!host)) {
|
if (unlikely(!host)) {
|
||||||
ql_dbg(ql_dbg_tgt, vha, 0xe044,
|
ql_dbg(ql_dbg_tgt, vha, 0xe044,
|
||||||
@@ -512,7 +496,7 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha,
|
|||||||
{
|
{
|
||||||
struct abts_resp_to_24xx *entry =
|
struct abts_resp_to_24xx *entry =
|
||||||
(struct abts_resp_to_24xx *)pkt;
|
(struct abts_resp_to_24xx *)pkt;
|
||||||
struct scsi_qla_host *host = qlt_find_host_by_vp_idx(vha,
|
struct scsi_qla_host *host = qla_find_host_by_vp_idx(vha,
|
||||||
entry->vp_index);
|
entry->vp_index);
|
||||||
if (unlikely(!host)) {
|
if (unlikely(!host)) {
|
||||||
ql_dbg(ql_dbg_tgt, vha, 0xe045,
|
ql_dbg(ql_dbg_tgt, vha, 0xe045,
|
||||||
@@ -7145,7 +7129,7 @@ qlt_probe_one_stage1(struct scsi_qla_host *base_vha, struct qla_hw_data *ha)
|
|||||||
|
|
||||||
qlt_clear_mode(base_vha);
|
qlt_clear_mode(base_vha);
|
||||||
|
|
||||||
qlt_update_vp_map(base_vha, SET_VP_IDX);
|
qla_update_vp_map(base_vha, SET_VP_IDX);
|
||||||
}
|
}
|
||||||
|
|
||||||
irqreturn_t
|
irqreturn_t
|
||||||
@@ -7224,17 +7208,10 @@ qlt_mem_alloc(struct qla_hw_data *ha)
|
|||||||
if (!QLA_TGT_MODE_ENABLED())
|
if (!QLA_TGT_MODE_ENABLED())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ha->tgt.tgt_vp_map = kcalloc(MAX_MULTI_ID_FABRIC,
|
|
||||||
sizeof(struct qla_tgt_vp_map),
|
|
||||||
GFP_KERNEL);
|
|
||||||
if (!ha->tgt.tgt_vp_map)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
ha->tgt.atio_ring = dma_alloc_coherent(&ha->pdev->dev,
|
ha->tgt.atio_ring = dma_alloc_coherent(&ha->pdev->dev,
|
||||||
(ha->tgt.atio_q_length + 1) * sizeof(struct atio_from_isp),
|
(ha->tgt.atio_q_length + 1) * sizeof(struct atio_from_isp),
|
||||||
&ha->tgt.atio_dma, GFP_KERNEL);
|
&ha->tgt.atio_dma, GFP_KERNEL);
|
||||||
if (!ha->tgt.atio_ring) {
|
if (!ha->tgt.atio_ring) {
|
||||||
kfree(ha->tgt.tgt_vp_map);
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -7253,70 +7230,6 @@ qlt_mem_free(struct qla_hw_data *ha)
|
|||||||
}
|
}
|
||||||
ha->tgt.atio_ring = NULL;
|
ha->tgt.atio_ring = NULL;
|
||||||
ha->tgt.atio_dma = 0;
|
ha->tgt.atio_dma = 0;
|
||||||
kfree(ha->tgt.tgt_vp_map);
|
|
||||||
ha->tgt.tgt_vp_map = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* vport_slock to be held by the caller */
|
|
||||||
void
|
|
||||||
qlt_update_vp_map(struct scsi_qla_host *vha, int cmd)
|
|
||||||
{
|
|
||||||
void *slot;
|
|
||||||
u32 key;
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
key = vha->d_id.b24;
|
|
||||||
|
|
||||||
switch (cmd) {
|
|
||||||
case SET_VP_IDX:
|
|
||||||
if (!QLA_TGT_MODE_ENABLED())
|
|
||||||
return;
|
|
||||||
vha->hw->tgt.tgt_vp_map[vha->vp_idx].vha = vha;
|
|
||||||
break;
|
|
||||||
case SET_AL_PA:
|
|
||||||
slot = btree_lookup32(&vha->hw->host_map, key);
|
|
||||||
if (!slot) {
|
|
||||||
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf018,
|
|
||||||
"Save vha in host_map %p %06x\n", vha, key);
|
|
||||||
rc = btree_insert32(&vha->hw->host_map,
|
|
||||||
key, vha, GFP_ATOMIC);
|
|
||||||
if (rc)
|
|
||||||
ql_log(ql_log_info, vha, 0xd03e,
|
|
||||||
"Unable to insert s_id into host_map: %06x\n",
|
|
||||||
key);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf019,
|
|
||||||
"replace existing vha in host_map %p %06x\n", vha, key);
|
|
||||||
btree_update32(&vha->hw->host_map, key, vha);
|
|
||||||
break;
|
|
||||||
case RESET_VP_IDX:
|
|
||||||
if (!QLA_TGT_MODE_ENABLED())
|
|
||||||
return;
|
|
||||||
vha->hw->tgt.tgt_vp_map[vha->vp_idx].vha = NULL;
|
|
||||||
break;
|
|
||||||
case RESET_AL_PA:
|
|
||||||
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf01a,
|
|
||||||
"clear vha in host_map %p %06x\n", vha, key);
|
|
||||||
slot = btree_lookup32(&vha->hw->host_map, key);
|
|
||||||
if (slot)
|
|
||||||
btree_remove32(&vha->hw->host_map, key);
|
|
||||||
vha->d_id.b24 = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void qlt_update_host_map(struct scsi_qla_host *vha, port_id_t id)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (!vha->d_id.b24) {
|
|
||||||
vha->d_id = id;
|
|
||||||
qlt_update_vp_map(vha, SET_AL_PA);
|
|
||||||
} else if (vha->d_id.b24 != id.b24) {
|
|
||||||
qlt_update_vp_map(vha, RESET_AL_PA);
|
|
||||||
vha->d_id = id;
|
|
||||||
qlt_update_vp_map(vha, SET_AL_PA);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init qlt_parse_ini_mode(void)
|
static int __init qlt_parse_ini_mode(void)
|
||||||
|
|||||||
@@ -1017,7 +1017,6 @@ extern void qlt_fc_port_added(struct scsi_qla_host *, fc_port_t *);
|
|||||||
extern void qlt_fc_port_deleted(struct scsi_qla_host *, fc_port_t *, int);
|
extern void qlt_fc_port_deleted(struct scsi_qla_host *, fc_port_t *, int);
|
||||||
extern int __init qlt_init(void);
|
extern int __init qlt_init(void);
|
||||||
extern void qlt_exit(void);
|
extern void qlt_exit(void);
|
||||||
extern void qlt_update_vp_map(struct scsi_qla_host *, int);
|
|
||||||
extern void qlt_free_session_done(struct work_struct *);
|
extern void qlt_free_session_done(struct work_struct *);
|
||||||
/*
|
/*
|
||||||
* This macro is used during early initializations when host->active_mode
|
* This macro is used during early initializations when host->active_mode
|
||||||
|
|||||||
Reference in New Issue
Block a user