Commit 4e5a05d1 authored by Arun Easi's avatar Arun Easi Committed by Martin K. Petersen

scsi: qla2xxx: Make tgt_port_database available in initiator mode

tgt_port_database data is today exported only in target mode, allow it to
be shown in initiator mode as well.

Link: https://lore.kernel.org/r/20200904045128.23631-10-njavali@marvell.comReviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: default avatarArun Easi <aeasi@marvell.com>
Signed-off-by: default avatarNilesh Javali <njavali@marvell.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent a35f87bd
...@@ -138,51 +138,51 @@ qla2x00_dfs_tgt_port_database_show(struct seq_file *s, void *unused) ...@@ -138,51 +138,51 @@ qla2x00_dfs_tgt_port_database_show(struct seq_file *s, void *unused)
{ {
scsi_qla_host_t *vha = s->private; scsi_qla_host_t *vha = s->private;
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
struct gid_list_info *gid_list, *gid; struct gid_list_info *gid_list;
dma_addr_t gid_list_dma; dma_addr_t gid_list_dma;
fc_port_t fc_port; fc_port_t fc_port;
char *id_iter;
int rc, i; int rc, i;
uint16_t entries, loop_id; uint16_t entries, loop_id;
struct qla_tgt *tgt = vha->vha_tgt.qla_tgt;
seq_printf(s, "%s\n", vha->host_str); seq_printf(s, "%s\n", vha->host_str);
if (tgt) { gid_list = dma_alloc_coherent(&ha->pdev->dev,
gid_list = dma_alloc_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha),
qla2x00_gid_list_size(ha), &gid_list_dma, GFP_KERNEL);
&gid_list_dma, GFP_KERNEL); if (!gid_list) {
if (!gid_list) { ql_dbg(ql_dbg_user, vha, 0x7018,
ql_dbg(ql_dbg_user, vha, 0x7018, "DMA allocation failed for %u\n",
"DMA allocation failed for %u\n", qla2x00_gid_list_size(ha));
qla2x00_gid_list_size(ha)); return 0;
return 0; }
}
rc = qla24xx_gidlist_wait(vha, gid_list, gid_list_dma, rc = qla24xx_gidlist_wait(vha, gid_list, gid_list_dma,
&entries); &entries);
if (rc != QLA_SUCCESS) if (rc != QLA_SUCCESS)
goto out_free_id_list; goto out_free_id_list;
gid = gid_list; id_iter = (char *)gid_list;
seq_puts(s, "Port Name Port ID Loop ID\n"); seq_puts(s, "Port Name Port ID Loop ID\n");
for (i = 0; i < entries; i++) { for (i = 0; i < entries; i++) {
loop_id = le16_to_cpu(gid->loop_id); struct gid_list_info *gid =
memset(&fc_port, 0, sizeof(fc_port_t)); (struct gid_list_info *)id_iter;
loop_id = le16_to_cpu(gid->loop_id);
memset(&fc_port, 0, sizeof(fc_port_t));
fc_port.loop_id = loop_id; fc_port.loop_id = loop_id;
rc = qla24xx_gpdb_wait(vha, &fc_port, 0); rc = qla24xx_gpdb_wait(vha, &fc_port, 0);
seq_printf(s, "%8phC %02x%02x%02x %d\n", seq_printf(s, "%8phC %02x%02x%02x %d\n",
fc_port.port_name, fc_port.d_id.b.domain, fc_port.port_name, fc_port.d_id.b.domain,
fc_port.d_id.b.area, fc_port.d_id.b.al_pa, fc_port.d_id.b.area, fc_port.d_id.b.al_pa,
fc_port.loop_id); fc_port.loop_id);
gid = (void *)gid + ha->gid_list_info_size; id_iter += ha->gid_list_info_size;
}
out_free_id_list:
dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha),
gid_list, gid_list_dma);
} }
out_free_id_list:
dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha),
gid_list, gid_list_dma);
return 0; return 0;
} }
......
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