2020-09-08 12:34:48 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
2005-10-27 18:10:08 +00:00
|
|
|
* QLogic Fibre Channel HBA Driver
|
2014-04-11 20:54:24 +00:00
|
|
|
* Copyright (c) 2003-2014 QLogic Corporation
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
|
|
|
#include "qla_def.h"
|
2012-05-15 18:34:28 +00:00
|
|
|
#include "qla_target.h"
|
2014-09-25 09:16:46 +00:00
|
|
|
#include <linux/utsname.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
static int qla2x00_sns_ga_nxt(scsi_qla_host_t *, fc_port_t *);
|
|
|
|
static int qla2x00_sns_gid_pt(scsi_qla_host_t *, sw_info_t *);
|
|
|
|
static int qla2x00_sns_gpn_id(scsi_qla_host_t *, sw_info_t *);
|
|
|
|
static int qla2x00_sns_gnn_id(scsi_qla_host_t *, sw_info_t *);
|
|
|
|
static int qla2x00_sns_rft_id(scsi_qla_host_t *);
|
|
|
|
static int qla2x00_sns_rnn_id(scsi_qla_host_t *);
|
2017-12-28 20:33:31 +00:00
|
|
|
static int qla_async_rftid(scsi_qla_host_t *, port_id_t *);
|
|
|
|
static int qla_async_rffid(scsi_qla_host_t *, port_id_t *, u8, u8);
|
|
|
|
static int qla_async_rnnid(scsi_qla_host_t *, port_id_t *, u8*);
|
|
|
|
static int qla_async_rsnn_nn(scsi_qla_host_t *);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/**
|
2005-07-06 17:30:47 +00:00
|
|
|
* qla2x00_prep_ms_iocb() - Prepare common MS/CT IOCB fields for SNS CT query.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
|
|
|
* @arg: CT arguments
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
2018-01-24 00:33:51 +00:00
|
|
|
* Returns a pointer to the @vha's ms_iocb.
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
2005-07-06 17:30:47 +00:00
|
|
|
void *
|
2017-01-20 06:28:00 +00:00
|
|
|
qla2x00_prep_ms_iocb(scsi_qla_host_t *vha, struct ct_arg *arg)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2005-04-16 22:20:36 +00:00
|
|
|
ms_iocb_entry_t *ms_pkt;
|
|
|
|
|
2017-01-20 06:28:00 +00:00
|
|
|
ms_pkt = (ms_iocb_entry_t *)arg->iocb;
|
2005-04-16 22:20:36 +00:00
|
|
|
memset(ms_pkt, 0, sizeof(ms_iocb_entry_t));
|
|
|
|
|
|
|
|
ms_pkt->entry_type = MS_IOCB_TYPE;
|
|
|
|
ms_pkt->entry_count = 1;
|
|
|
|
SET_TARGET_ID(ha, ms_pkt->loop_id, SIMPLE_NAME_SERVER);
|
2015-07-09 14:24:08 +00:00
|
|
|
ms_pkt->control_flags = cpu_to_le16(CF_READ | CF_HEAD_TAG);
|
2008-02-28 22:06:11 +00:00
|
|
|
ms_pkt->timeout = cpu_to_le16(ha->r_a_tov / 10 * 2);
|
2015-07-09 14:24:08 +00:00
|
|
|
ms_pkt->cmd_dsd_count = cpu_to_le16(1);
|
|
|
|
ms_pkt->total_dsd_count = cpu_to_le16(2);
|
2017-01-20 06:28:00 +00:00
|
|
|
ms_pkt->rsp_bytecount = cpu_to_le32(arg->rsp_size);
|
|
|
|
ms_pkt->req_bytecount = cpu_to_le32(arg->req_size);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2019-04-17 21:44:38 +00:00
|
|
|
put_unaligned_le64(arg->req_dma, &ms_pkt->req_dsd.address);
|
|
|
|
ms_pkt->req_dsd.length = ms_pkt->req_bytecount;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2019-04-17 21:44:38 +00:00
|
|
|
put_unaligned_le64(arg->rsp_dma, &ms_pkt->rsp_dsd.address);
|
|
|
|
ms_pkt->rsp_dsd.length = ms_pkt->rsp_bytecount;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2013-08-27 05:37:40 +00:00
|
|
|
vha->qla_stats.control_requests++;
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
return (ms_pkt);
|
|
|
|
}
|
|
|
|
|
2005-07-06 17:30:47 +00:00
|
|
|
/**
|
|
|
|
* qla24xx_prep_ms_iocb() - Prepare common CT IOCB fields for SNS CT query.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
|
|
|
* @arg: CT arguments
|
2005-07-06 17:30:47 +00:00
|
|
|
*
|
|
|
|
* Returns a pointer to the @ha's ms_iocb.
|
|
|
|
*/
|
|
|
|
void *
|
2017-01-20 06:28:00 +00:00
|
|
|
qla24xx_prep_ms_iocb(scsi_qla_host_t *vha, struct ct_arg *arg)
|
2005-07-06 17:30:47 +00:00
|
|
|
{
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2005-07-06 17:30:47 +00:00
|
|
|
struct ct_entry_24xx *ct_pkt;
|
|
|
|
|
2017-01-20 06:28:00 +00:00
|
|
|
ct_pkt = (struct ct_entry_24xx *)arg->iocb;
|
2005-07-06 17:30:47 +00:00
|
|
|
memset(ct_pkt, 0, sizeof(struct ct_entry_24xx));
|
|
|
|
|
|
|
|
ct_pkt->entry_type = CT_IOCB_TYPE;
|
|
|
|
ct_pkt->entry_count = 1;
|
2017-01-20 06:28:00 +00:00
|
|
|
ct_pkt->nport_handle = cpu_to_le16(arg->nport_handle);
|
2008-02-28 22:06:11 +00:00
|
|
|
ct_pkt->timeout = cpu_to_le16(ha->r_a_tov / 10 * 2);
|
2015-07-09 14:24:08 +00:00
|
|
|
ct_pkt->cmd_dsd_count = cpu_to_le16(1);
|
|
|
|
ct_pkt->rsp_dsd_count = cpu_to_le16(1);
|
2017-01-20 06:28:00 +00:00
|
|
|
ct_pkt->rsp_byte_count = cpu_to_le32(arg->rsp_size);
|
|
|
|
ct_pkt->cmd_byte_count = cpu_to_le32(arg->req_size);
|
2005-07-06 17:30:47 +00:00
|
|
|
|
2019-04-17 21:44:38 +00:00
|
|
|
put_unaligned_le64(arg->req_dma, &ct_pkt->dsd[0].address);
|
|
|
|
ct_pkt->dsd[0].length = ct_pkt->cmd_byte_count;
|
2005-07-06 17:30:47 +00:00
|
|
|
|
2019-04-17 21:44:38 +00:00
|
|
|
put_unaligned_le64(arg->rsp_dma, &ct_pkt->dsd[1].address);
|
|
|
|
ct_pkt->dsd[1].length = ct_pkt->rsp_byte_count;
|
2008-11-06 18:40:19 +00:00
|
|
|
ct_pkt->vp_index = vha->vp_idx;
|
2005-07-06 17:30:47 +00:00
|
|
|
|
2013-08-27 05:37:40 +00:00
|
|
|
vha->qla_stats.control_requests++;
|
|
|
|
|
2005-07-06 17:30:47 +00:00
|
|
|
return (ct_pkt);
|
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/**
|
|
|
|
* qla2x00_prep_ct_req() - Prepare common CT request fields for SNS query.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @p: CT request buffer
|
2005-04-16 22:20:36 +00:00
|
|
|
* @cmd: GS command
|
|
|
|
* @rsp_size: response size in bytes
|
|
|
|
*
|
|
|
|
* Returns a pointer to the intitialized @ct_req.
|
|
|
|
*/
|
|
|
|
static inline struct ct_sns_req *
|
2013-06-25 15:27:28 +00:00
|
|
|
qla2x00_prep_ct_req(struct ct_sns_pkt *p, uint16_t cmd, uint16_t rsp_size)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2013-06-25 15:27:28 +00:00
|
|
|
memset(p, 0, sizeof(struct ct_sns_pkt));
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2013-06-25 15:27:28 +00:00
|
|
|
p->p.req.header.revision = 0x01;
|
|
|
|
p->p.req.header.gs_type = 0xFC;
|
|
|
|
p->p.req.header.gs_subtype = 0x02;
|
|
|
|
p->p.req.command = cpu_to_be16(cmd);
|
|
|
|
p->p.req.max_rsp_size = cpu_to_be16((rsp_size - 16) / 4);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2013-06-25 15:27:28 +00:00
|
|
|
return &p->p.req;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2017-01-20 06:28:00 +00:00
|
|
|
int
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_chk_ms_status(scsi_qla_host_t *vha, ms_iocb_entry_t *ms_pkt,
|
2005-07-06 17:30:47 +00:00
|
|
|
struct ct_sns_rsp *ct_rsp, const char *routine)
|
|
|
|
{
|
|
|
|
int rval;
|
|
|
|
uint16_t comp_status;
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2017-06-02 16:12:00 +00:00
|
|
|
bool lid_is_sns = false;
|
2005-07-06 17:30:47 +00:00
|
|
|
|
|
|
|
rval = QLA_FUNCTION_FAILED;
|
|
|
|
if (ms_pkt->entry_status != 0) {
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2031,
|
|
|
|
"%s failed, error status (%x) on port_id: %02x%02x%02x.\n",
|
|
|
|
routine, ms_pkt->entry_status, vha->d_id.b.domain,
|
|
|
|
vha->d_id.b.area, vha->d_id.b.al_pa);
|
2005-07-06 17:30:47 +00:00
|
|
|
} else {
|
2007-07-19 22:05:56 +00:00
|
|
|
if (IS_FWI2_CAPABLE(ha))
|
2006-12-14 03:20:26 +00:00
|
|
|
comp_status = le16_to_cpu(
|
|
|
|
((struct ct_entry_24xx *)ms_pkt)->comp_status);
|
2005-07-06 17:30:47 +00:00
|
|
|
else
|
|
|
|
comp_status = le16_to_cpu(ms_pkt->status);
|
|
|
|
switch (comp_status) {
|
|
|
|
case CS_COMPLETE:
|
|
|
|
case CS_DATA_UNDERRUN:
|
|
|
|
case CS_DATA_OVERRUN: /* Overrun? */
|
|
|
|
if (ct_rsp->header.response !=
|
2015-07-09 14:24:08 +00:00
|
|
|
cpu_to_be16(CT_ACCEPT_RESPONSE)) {
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc + ql_dbg_buffer, vha, 0x2077,
|
2017-03-31 21:37:04 +00:00
|
|
|
"%s failed rejected request on port_id: %02x%02x%02x Completion status 0x%x, response 0x%x\n",
|
2014-09-25 09:16:46 +00:00
|
|
|
routine, vha->d_id.b.domain,
|
|
|
|
vha->d_id.b.area, vha->d_id.b.al_pa,
|
|
|
|
comp_status, ct_rsp->header.response);
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha,
|
2019-03-12 18:08:16 +00:00
|
|
|
0x2078, ct_rsp,
|
|
|
|
offsetof(typeof(*ct_rsp), rsp));
|
2006-12-14 03:20:28 +00:00
|
|
|
rval = QLA_INVALID_COMMAND;
|
2005-07-06 17:30:47 +00:00
|
|
|
} else
|
|
|
|
rval = QLA_SUCCESS;
|
|
|
|
break;
|
2017-06-02 16:12:00 +00:00
|
|
|
case CS_PORT_LOGGED_OUT:
|
|
|
|
if (IS_FWI2_CAPABLE(ha)) {
|
|
|
|
if (le16_to_cpu(ms_pkt->loop_id.extended) ==
|
|
|
|
NPH_SNS)
|
|
|
|
lid_is_sns = true;
|
|
|
|
} else {
|
|
|
|
if (le16_to_cpu(ms_pkt->loop_id.extended) ==
|
|
|
|
SIMPLE_NAME_SERVER)
|
|
|
|
lid_is_sns = true;
|
|
|
|
}
|
|
|
|
if (lid_is_sns) {
|
|
|
|
ql_dbg(ql_dbg_async, vha, 0x502b,
|
|
|
|
"%s failed, Name server has logged out",
|
|
|
|
routine);
|
|
|
|
rval = QLA_NOT_LOGGED_IN;
|
|
|
|
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
|
|
|
|
set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
|
|
|
|
}
|
|
|
|
break;
|
2017-12-04 22:45:01 +00:00
|
|
|
case CS_TIMEOUT:
|
|
|
|
rval = QLA_FUNCTION_TIMEOUT;
|
2020-08-23 22:36:59 +00:00
|
|
|
fallthrough;
|
2005-07-06 17:30:47 +00:00
|
|
|
default:
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2033,
|
|
|
|
"%s failed, completion status (%x) on port_id: "
|
|
|
|
"%02x%02x%02x.\n", routine, comp_status,
|
2011-02-23 23:27:09 +00:00
|
|
|
vha->d_id.b.domain, vha->d_id.b.area,
|
2011-07-14 19:00:13 +00:00
|
|
|
vha->d_id.b.al_pa);
|
2005-07-06 17:30:47 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return rval;
|
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* qla2x00_ga_nxt() - SNS scan for fabric devices via GA_NXT command.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2005-04-16 22:20:36 +00:00
|
|
|
* @fcport: fcport entry to updated
|
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
|
|
|
int
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_ga_nxt(scsi_qla_host_t *vha, fc_port_t *fcport)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
int rval;
|
|
|
|
|
|
|
|
ms_iocb_entry_t *ms_pkt;
|
|
|
|
struct ct_sns_req *ct_req;
|
|
|
|
struct ct_sns_rsp *ct_rsp;
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2017-01-20 06:28:00 +00:00
|
|
|
struct ct_arg arg;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-11-06 18:40:19 +00:00
|
|
|
if (IS_QLA2100(ha) || IS_QLA2200(ha))
|
|
|
|
return qla2x00_sns_ga_nxt(vha, fcport);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2017-01-20 06:28:00 +00:00
|
|
|
arg.iocb = ha->ms_iocb;
|
|
|
|
arg.req_dma = ha->ct_sns_dma;
|
|
|
|
arg.rsp_dma = ha->ct_sns_dma;
|
|
|
|
arg.req_size = GA_NXT_REQ_SIZE;
|
|
|
|
arg.rsp_size = GA_NXT_RSP_SIZE;
|
|
|
|
arg.nport_handle = NPH_SNS;
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Issue GA_NXT */
|
|
|
|
/* Prepare common MS IOCB */
|
2017-01-20 06:28:00 +00:00
|
|
|
ms_pkt = ha->isp_ops->prep_ms_iocb(vha, &arg);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Prepare CT request */
|
2013-06-25 15:27:28 +00:00
|
|
|
ct_req = qla2x00_prep_ct_req(ha->ct_sns, GA_NXT_CMD,
|
2005-04-16 22:20:36 +00:00
|
|
|
GA_NXT_RSP_SIZE);
|
|
|
|
ct_rsp = &ha->ct_sns->p.rsp;
|
|
|
|
|
|
|
|
/* Prepare CT arguments -- port_id */
|
2019-08-09 03:01:58 +00:00
|
|
|
ct_req->req.port_id.port_id = port_id_to_be_id(fcport->d_id);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Execute MS IOCB */
|
2008-11-06 18:40:19 +00:00
|
|
|
rval = qla2x00_issue_iocb(vha, ha->ms_iocb, ha->ms_iocb_dma,
|
2005-04-16 22:20:36 +00:00
|
|
|
sizeof(ms_iocb_entry_t));
|
|
|
|
if (rval != QLA_SUCCESS) {
|
|
|
|
/*EMPTY*/
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2062,
|
|
|
|
"GA_NXT issue IOCB failed (%d).\n", rval);
|
2008-11-06 18:40:19 +00:00
|
|
|
} else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp, "GA_NXT") !=
|
2005-07-06 17:30:47 +00:00
|
|
|
QLA_SUCCESS) {
|
2005-04-16 22:20:36 +00:00
|
|
|
rval = QLA_FUNCTION_FAILED;
|
|
|
|
} else {
|
|
|
|
/* Populate fc_port_t entry. */
|
2019-08-09 03:01:58 +00:00
|
|
|
fcport->d_id = be_to_port_id(ct_rsp->rsp.ga_nxt.port_id);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
memcpy(fcport->node_name, ct_rsp->rsp.ga_nxt.node_name,
|
|
|
|
WWN_SIZE);
|
|
|
|
memcpy(fcport->port_name, ct_rsp->rsp.ga_nxt.port_name,
|
|
|
|
WWN_SIZE);
|
|
|
|
|
2012-11-21 07:40:30 +00:00
|
|
|
fcport->fc4_type = (ct_rsp->rsp.ga_nxt.fc4_types[2] & BIT_0) ?
|
2019-09-12 18:09:12 +00:00
|
|
|
FS_FC4TYPE_FCP : FC4_TYPE_OTHER;
|
2012-11-21 07:40:30 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
if (ct_rsp->rsp.ga_nxt.port_type != NS_N_PORT_TYPE &&
|
|
|
|
ct_rsp->rsp.ga_nxt.port_type != NS_NL_PORT_TYPE)
|
|
|
|
fcport->d_id.b.domain = 0xf0;
|
|
|
|
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2063,
|
2013-08-27 05:37:27 +00:00
|
|
|
"GA_NXT entry - nn %8phN pn %8phN "
|
2011-07-14 19:00:13 +00:00
|
|
|
"port_id=%02x%02x%02x.\n",
|
2013-08-27 05:37:27 +00:00
|
|
|
fcport->node_name, fcport->port_name,
|
2005-04-16 22:20:36 +00:00
|
|
|
fcport->d_id.b.domain, fcport->d_id.b.area,
|
2011-07-14 19:00:13 +00:00
|
|
|
fcport->d_id.b.al_pa);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return (rval);
|
|
|
|
}
|
|
|
|
|
2012-02-09 19:15:57 +00:00
|
|
|
static inline int
|
|
|
|
qla2x00_gid_pt_rsp_size(scsi_qla_host_t *vha)
|
|
|
|
{
|
|
|
|
return vha->hw->max_fibre_devices * 4 + 16;
|
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/**
|
|
|
|
* qla2x00_gid_pt() - SNS scan for fabric devices via GID_PT command.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2005-04-16 22:20:36 +00:00
|
|
|
* @list: switch info entries to populate
|
|
|
|
*
|
|
|
|
* NOTE: Non-Nx_Ports are not requested.
|
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
|
|
|
int
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_gid_pt(scsi_qla_host_t *vha, sw_info_t *list)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
int rval;
|
|
|
|
uint16_t i;
|
|
|
|
|
|
|
|
ms_iocb_entry_t *ms_pkt;
|
|
|
|
struct ct_sns_req *ct_req;
|
|
|
|
struct ct_sns_rsp *ct_rsp;
|
|
|
|
|
|
|
|
struct ct_sns_gid_pt_data *gid_data;
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2012-02-09 19:15:57 +00:00
|
|
|
uint16_t gid_pt_rsp_size;
|
2017-01-20 06:28:00 +00:00
|
|
|
struct ct_arg arg;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-11-06 18:40:19 +00:00
|
|
|
if (IS_QLA2100(ha) || IS_QLA2200(ha))
|
|
|
|
return qla2x00_sns_gid_pt(vha, list);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
gid_data = NULL;
|
2012-02-09 19:15:57 +00:00
|
|
|
gid_pt_rsp_size = qla2x00_gid_pt_rsp_size(vha);
|
2017-01-20 06:28:00 +00:00
|
|
|
|
|
|
|
arg.iocb = ha->ms_iocb;
|
|
|
|
arg.req_dma = ha->ct_sns_dma;
|
|
|
|
arg.rsp_dma = ha->ct_sns_dma;
|
|
|
|
arg.req_size = GID_PT_REQ_SIZE;
|
|
|
|
arg.rsp_size = gid_pt_rsp_size;
|
|
|
|
arg.nport_handle = NPH_SNS;
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Issue GID_PT */
|
|
|
|
/* Prepare common MS IOCB */
|
2017-01-20 06:28:00 +00:00
|
|
|
ms_pkt = ha->isp_ops->prep_ms_iocb(vha, &arg);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Prepare CT request */
|
2013-06-25 15:27:28 +00:00
|
|
|
ct_req = qla2x00_prep_ct_req(ha->ct_sns, GID_PT_CMD, gid_pt_rsp_size);
|
2005-04-16 22:20:36 +00:00
|
|
|
ct_rsp = &ha->ct_sns->p.rsp;
|
|
|
|
|
|
|
|
/* Prepare CT arguments -- port_type */
|
|
|
|
ct_req->req.gid_pt.port_type = NS_NX_PORT_TYPE;
|
|
|
|
|
|
|
|
/* Execute MS IOCB */
|
2008-11-06 18:40:19 +00:00
|
|
|
rval = qla2x00_issue_iocb(vha, ha->ms_iocb, ha->ms_iocb_dma,
|
2005-04-16 22:20:36 +00:00
|
|
|
sizeof(ms_iocb_entry_t));
|
|
|
|
if (rval != QLA_SUCCESS) {
|
|
|
|
/*EMPTY*/
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2055,
|
|
|
|
"GID_PT issue IOCB failed (%d).\n", rval);
|
2008-11-06 18:40:19 +00:00
|
|
|
} else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp, "GID_PT") !=
|
2005-07-06 17:30:47 +00:00
|
|
|
QLA_SUCCESS) {
|
2005-04-16 22:20:36 +00:00
|
|
|
rval = QLA_FUNCTION_FAILED;
|
|
|
|
} else {
|
|
|
|
/* Set port IDs in switch info list. */
|
2012-02-09 19:15:57 +00:00
|
|
|
for (i = 0; i < ha->max_fibre_devices; i++) {
|
2005-04-16 22:20:36 +00:00
|
|
|
gid_data = &ct_rsp->rsp.gid_pt.entries[i];
|
2019-08-09 03:01:58 +00:00
|
|
|
list[i].d_id = be_to_port_id(gid_data->port_id);
|
2007-08-13 17:13:18 +00:00
|
|
|
memset(list[i].fabric_port_name, 0, WWN_SIZE);
|
|
|
|
list[i].fp_speed = PORT_SPEED_UNKNOWN;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Last one exit. */
|
|
|
|
if (gid_data->control_byte & BIT_7) {
|
|
|
|
list[i].d_id.b.rsvd_1 = gid_data->control_byte;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If we've used all available slots, then the switch is
|
|
|
|
* reporting back more devices than we can handle with this
|
|
|
|
* single call. Return a failed status, and let GA_NXT handle
|
|
|
|
* the overload.
|
|
|
|
*/
|
2012-02-09 19:15:57 +00:00
|
|
|
if (i == ha->max_fibre_devices)
|
2005-04-16 22:20:36 +00:00
|
|
|
rval = QLA_FUNCTION_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (rval);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qla2x00_gpn_id() - SNS Get Port Name (GPN_ID) query.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2005-04-16 22:20:36 +00:00
|
|
|
* @list: switch info entries to populate
|
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
|
|
|
int
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_gpn_id(scsi_qla_host_t *vha, sw_info_t *list)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2012-02-09 19:15:57 +00:00
|
|
|
int rval = QLA_SUCCESS;
|
2005-04-16 22:20:36 +00:00
|
|
|
uint16_t i;
|
|
|
|
|
|
|
|
ms_iocb_entry_t *ms_pkt;
|
|
|
|
struct ct_sns_req *ct_req;
|
|
|
|
struct ct_sns_rsp *ct_rsp;
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2017-01-20 06:28:00 +00:00
|
|
|
struct ct_arg arg;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-11-06 18:40:19 +00:00
|
|
|
if (IS_QLA2100(ha) || IS_QLA2200(ha))
|
|
|
|
return qla2x00_sns_gpn_id(vha, list);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2017-01-20 06:28:00 +00:00
|
|
|
arg.iocb = ha->ms_iocb;
|
|
|
|
arg.req_dma = ha->ct_sns_dma;
|
|
|
|
arg.rsp_dma = ha->ct_sns_dma;
|
|
|
|
arg.req_size = GPN_ID_REQ_SIZE;
|
|
|
|
arg.rsp_size = GPN_ID_RSP_SIZE;
|
|
|
|
arg.nport_handle = NPH_SNS;
|
|
|
|
|
2012-02-09 19:15:57 +00:00
|
|
|
for (i = 0; i < ha->max_fibre_devices; i++) {
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Issue GPN_ID */
|
|
|
|
/* Prepare common MS IOCB */
|
2017-01-20 06:28:00 +00:00
|
|
|
ms_pkt = ha->isp_ops->prep_ms_iocb(vha, &arg);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Prepare CT request */
|
2013-06-25 15:27:28 +00:00
|
|
|
ct_req = qla2x00_prep_ct_req(ha->ct_sns, GPN_ID_CMD,
|
2005-04-16 22:20:36 +00:00
|
|
|
GPN_ID_RSP_SIZE);
|
|
|
|
ct_rsp = &ha->ct_sns->p.rsp;
|
|
|
|
|
|
|
|
/* Prepare CT arguments -- port_id */
|
2019-08-09 03:01:58 +00:00
|
|
|
ct_req->req.port_id.port_id = port_id_to_be_id(list[i].d_id);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Execute MS IOCB */
|
2008-11-06 18:40:19 +00:00
|
|
|
rval = qla2x00_issue_iocb(vha, ha->ms_iocb, ha->ms_iocb_dma,
|
2005-04-16 22:20:36 +00:00
|
|
|
sizeof(ms_iocb_entry_t));
|
|
|
|
if (rval != QLA_SUCCESS) {
|
|
|
|
/*EMPTY*/
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2056,
|
|
|
|
"GPN_ID issue IOCB failed (%d).\n", rval);
|
2012-02-09 19:16:00 +00:00
|
|
|
break;
|
2008-11-06 18:40:19 +00:00
|
|
|
} else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp,
|
2005-07-06 17:30:47 +00:00
|
|
|
"GPN_ID") != QLA_SUCCESS) {
|
2005-04-16 22:20:36 +00:00
|
|
|
rval = QLA_FUNCTION_FAILED;
|
2012-02-09 19:16:00 +00:00
|
|
|
break;
|
2005-04-16 22:20:36 +00:00
|
|
|
} else {
|
|
|
|
/* Save portname */
|
|
|
|
memcpy(list[i].port_name,
|
|
|
|
ct_rsp->rsp.gpn_id.port_name, WWN_SIZE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Last device exit. */
|
|
|
|
if (list[i].d_id.b.rsvd_1 != 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (rval);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qla2x00_gnn_id() - SNS Get Node Name (GNN_ID) query.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2005-04-16 22:20:36 +00:00
|
|
|
* @list: switch info entries to populate
|
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
|
|
|
int
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_gnn_id(scsi_qla_host_t *vha, sw_info_t *list)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2012-02-09 19:15:57 +00:00
|
|
|
int rval = QLA_SUCCESS;
|
2005-04-16 22:20:36 +00:00
|
|
|
uint16_t i;
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2005-04-16 22:20:36 +00:00
|
|
|
ms_iocb_entry_t *ms_pkt;
|
|
|
|
struct ct_sns_req *ct_req;
|
|
|
|
struct ct_sns_rsp *ct_rsp;
|
2017-01-20 06:28:00 +00:00
|
|
|
struct ct_arg arg;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-11-06 18:40:19 +00:00
|
|
|
if (IS_QLA2100(ha) || IS_QLA2200(ha))
|
|
|
|
return qla2x00_sns_gnn_id(vha, list);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2017-01-20 06:28:00 +00:00
|
|
|
arg.iocb = ha->ms_iocb;
|
|
|
|
arg.req_dma = ha->ct_sns_dma;
|
|
|
|
arg.rsp_dma = ha->ct_sns_dma;
|
|
|
|
arg.req_size = GNN_ID_REQ_SIZE;
|
|
|
|
arg.rsp_size = GNN_ID_RSP_SIZE;
|
|
|
|
arg.nport_handle = NPH_SNS;
|
|
|
|
|
2012-02-09 19:15:57 +00:00
|
|
|
for (i = 0; i < ha->max_fibre_devices; i++) {
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Issue GNN_ID */
|
|
|
|
/* Prepare common MS IOCB */
|
2017-01-20 06:28:00 +00:00
|
|
|
ms_pkt = ha->isp_ops->prep_ms_iocb(vha, &arg);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Prepare CT request */
|
2013-06-25 15:27:28 +00:00
|
|
|
ct_req = qla2x00_prep_ct_req(ha->ct_sns, GNN_ID_CMD,
|
2005-04-16 22:20:36 +00:00
|
|
|
GNN_ID_RSP_SIZE);
|
|
|
|
ct_rsp = &ha->ct_sns->p.rsp;
|
|
|
|
|
|
|
|
/* Prepare CT arguments -- port_id */
|
2019-08-09 03:01:58 +00:00
|
|
|
ct_req->req.port_id.port_id = port_id_to_be_id(list[i].d_id);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Execute MS IOCB */
|
2008-11-06 18:40:19 +00:00
|
|
|
rval = qla2x00_issue_iocb(vha, ha->ms_iocb, ha->ms_iocb_dma,
|
2005-04-16 22:20:36 +00:00
|
|
|
sizeof(ms_iocb_entry_t));
|
|
|
|
if (rval != QLA_SUCCESS) {
|
|
|
|
/*EMPTY*/
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2057,
|
|
|
|
"GNN_ID issue IOCB failed (%d).\n", rval);
|
2012-02-09 19:16:00 +00:00
|
|
|
break;
|
2008-11-06 18:40:19 +00:00
|
|
|
} else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp,
|
2005-07-06 17:30:47 +00:00
|
|
|
"GNN_ID") != QLA_SUCCESS) {
|
2005-04-16 22:20:36 +00:00
|
|
|
rval = QLA_FUNCTION_FAILED;
|
2012-02-09 19:16:00 +00:00
|
|
|
break;
|
2005-04-16 22:20:36 +00:00
|
|
|
} else {
|
|
|
|
/* Save nodename */
|
|
|
|
memcpy(list[i].node_name,
|
|
|
|
ct_rsp->rsp.gnn_id.node_name, WWN_SIZE);
|
|
|
|
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2058,
|
2013-08-27 05:37:27 +00:00
|
|
|
"GID_PT entry - nn %8phN pn %8phN "
|
2005-04-16 22:20:36 +00:00
|
|
|
"portid=%02x%02x%02x.\n",
|
2013-08-27 05:37:27 +00:00
|
|
|
list[i].node_name, list[i].port_name,
|
2005-04-16 22:20:36 +00:00
|
|
|
list[i].d_id.b.domain, list[i].d_id.b.area,
|
2011-07-14 19:00:13 +00:00
|
|
|
list[i].d_id.b.al_pa);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Last device exit. */
|
|
|
|
if (list[i].d_id.b.rsvd_1 != 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (rval);
|
|
|
|
}
|
|
|
|
|
2019-08-09 03:02:04 +00:00
|
|
|
static void qla2x00_async_sns_sp_done(srb_t *sp, int rc)
|
2017-12-28 20:33:31 +00:00
|
|
|
{
|
|
|
|
struct scsi_qla_host *vha = sp->vha;
|
|
|
|
struct ct_sns_pkt *ct_sns;
|
|
|
|
struct qla_work_evt *e;
|
|
|
|
|
|
|
|
sp->rc = rc;
|
|
|
|
if (rc == QLA_SUCCESS) {
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x204f,
|
|
|
|
"Async done-%s exiting normally.\n",
|
|
|
|
sp->name);
|
|
|
|
} else if (rc == QLA_FUNCTION_TIMEOUT) {
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x204f,
|
|
|
|
"Async done-%s timeout\n", sp->name);
|
|
|
|
} else {
|
|
|
|
ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.rsp;
|
|
|
|
memset(ct_sns, 0, sizeof(*ct_sns));
|
|
|
|
sp->retry_count++;
|
|
|
|
if (sp->retry_count > 3)
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x204f,
|
|
|
|
"Async done-%s fail rc %x. Retry count %d\n",
|
|
|
|
sp->name, rc, sp->retry_count);
|
|
|
|
|
|
|
|
e = qla2x00_alloc_work(vha, QLA_EVT_SP_RETRY);
|
|
|
|
if (!e)
|
|
|
|
goto err2;
|
|
|
|
|
|
|
|
del_timer(&sp->u.iocb_cmd.timer);
|
|
|
|
e->u.iosb.sp = sp;
|
|
|
|
qla2x00_post_work(vha, e);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
err:
|
|
|
|
e = qla2x00_alloc_work(vha, QLA_EVT_UNMAP);
|
|
|
|
err2:
|
|
|
|
if (!e) {
|
|
|
|
/* please ignore kernel warning. otherwise, we have mem leak. */
|
|
|
|
if (sp->u.iocb_cmd.u.ctarg.req) {
|
|
|
|
dma_free_coherent(&vha->hw->pdev->dev,
|
2018-07-02 20:01:58 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.req_allocated_size,
|
2017-12-28 20:33:31 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.req,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_dma);
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sp->u.iocb_cmd.u.ctarg.rsp) {
|
|
|
|
dma_free_coherent(&vha->hw->pdev->dev,
|
2018-07-02 20:01:58 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_allocated_size,
|
2017-12-28 20:33:31 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_dma);
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
sp->free(sp);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
e->u.iosb.sp = sp;
|
|
|
|
qla2x00_post_work(vha, e);
|
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/**
|
|
|
|
* qla2x00_rft_id() - SNS Register FC-4 TYPEs (RFT_ID) supported by the HBA.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
|
|
|
int
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_rft_id(scsi_qla_host_t *vha)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-11-06 18:40:19 +00:00
|
|
|
if (IS_QLA2100(ha) || IS_QLA2200(ha))
|
|
|
|
return qla2x00_sns_rft_id(vha);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
return qla_async_rftid(vha, &vha->d_id);
|
|
|
|
}
|
2017-01-20 06:28:00 +00:00
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
static int qla_async_rftid(scsi_qla_host_t *vha, port_id_t *d_id)
|
|
|
|
{
|
|
|
|
int rval = QLA_MEMORY_ALLOC_FAILED;
|
|
|
|
struct ct_sns_req *ct_req;
|
|
|
|
srb_t *sp;
|
|
|
|
struct ct_sns_pkt *ct_sns;
|
|
|
|
|
|
|
|
if (!vha->flags.online)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
sp = qla2x00_get_sp(vha, NULL, GFP_KERNEL);
|
|
|
|
if (!sp)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
sp->type = SRB_CT_PTHRU_CMD;
|
|
|
|
sp->name = "rft_id";
|
|
|
|
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2);
|
|
|
|
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev,
|
|
|
|
sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.req_dma,
|
|
|
|
GFP_KERNEL);
|
2018-07-02 20:01:58 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.req_allocated_size = sizeof(struct ct_sns_pkt);
|
2017-12-28 20:33:31 +00:00
|
|
|
if (!sp->u.iocb_cmd.u.ctarg.req) {
|
|
|
|
ql_log(ql_log_warn, vha, 0xd041,
|
|
|
|
"%s: Failed to allocate ct_sns request.\n",
|
|
|
|
__func__);
|
|
|
|
goto done_free_sp;
|
|
|
|
}
|
|
|
|
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev,
|
|
|
|
sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.rsp_dma,
|
|
|
|
GFP_KERNEL);
|
2018-07-02 20:01:58 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_allocated_size = sizeof(struct ct_sns_pkt);
|
2017-12-28 20:33:31 +00:00
|
|
|
if (!sp->u.iocb_cmd.u.ctarg.rsp) {
|
|
|
|
ql_log(ql_log_warn, vha, 0xd042,
|
|
|
|
"%s: Failed to allocate ct_sns request.\n",
|
|
|
|
__func__);
|
|
|
|
goto done_free_sp;
|
|
|
|
}
|
|
|
|
ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.rsp;
|
|
|
|
memset(ct_sns, 0, sizeof(*ct_sns));
|
|
|
|
ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.req;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Prepare CT request */
|
2017-12-28 20:33:31 +00:00
|
|
|
ct_req = qla2x00_prep_ct_req(ct_sns, RFT_ID_CMD, RFT_ID_RSP_SIZE);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Prepare CT arguments -- port_id, FC-4 types */
|
2019-08-09 03:01:58 +00:00
|
|
|
ct_req->req.rft_id.port_id = port_id_to_be_id(vha->d_id);
|
2005-04-16 22:20:36 +00:00
|
|
|
ct_req->req.rft_id.fc4_types[2] = 0x01; /* FCP-3 */
|
|
|
|
|
2017-06-21 20:48:44 +00:00
|
|
|
if (vha->flags.nvme_enabled)
|
|
|
|
ct_req->req.rft_id.fc4_types[6] = 1; /* NVMe type 28h */
|
2017-12-28 20:33:31 +00:00
|
|
|
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_size = RFT_ID_REQ_SIZE;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_size = RFT_ID_RSP_SIZE;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.nport_handle = NPH_SNS;
|
|
|
|
sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout;
|
|
|
|
sp->done = qla2x00_async_sns_sp_done;
|
|
|
|
|
2019-02-14 15:52:29 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xffff,
|
|
|
|
"Async-%s - hdl=%x portid %06x.\n",
|
|
|
|
sp->name, sp->handle, d_id->b24);
|
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
rval = qla2x00_start_sp(sp);
|
2005-04-16 22:20:36 +00:00
|
|
|
if (rval != QLA_SUCCESS) {
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2043,
|
|
|
|
"RFT_ID issue IOCB failed (%d).\n", rval);
|
2017-12-28 20:33:31 +00:00
|
|
|
goto done_free_sp;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
2017-12-28 20:33:31 +00:00
|
|
|
return rval;
|
|
|
|
done_free_sp:
|
|
|
|
sp->free(sp);
|
|
|
|
done:
|
|
|
|
return rval;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qla2x00_rff_id() - SNS Register FC-4 Features (RFF_ID) supported by the HBA.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
|
|
|
* @type: not used
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
|
|
|
int
|
2017-06-21 20:48:44 +00:00
|
|
|
qla2x00_rff_id(scsi_qla_host_t *vha, u8 type)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2046,
|
|
|
|
"RFF_ID call not supported on ISP2100/ISP2200.\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
return (QLA_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
return qla_async_rffid(vha, &vha->d_id, qlt_rff_id(vha),
|
|
|
|
FC4_TYPE_FCP_SCSI);
|
|
|
|
}
|
2017-01-20 06:28:00 +00:00
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
static int qla_async_rffid(scsi_qla_host_t *vha, port_id_t *d_id,
|
|
|
|
u8 fc4feature, u8 fc4type)
|
|
|
|
{
|
|
|
|
int rval = QLA_MEMORY_ALLOC_FAILED;
|
|
|
|
struct ct_sns_req *ct_req;
|
|
|
|
srb_t *sp;
|
|
|
|
struct ct_sns_pkt *ct_sns;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
sp = qla2x00_get_sp(vha, NULL, GFP_KERNEL);
|
|
|
|
if (!sp)
|
|
|
|
goto done;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
sp->type = SRB_CT_PTHRU_CMD;
|
|
|
|
sp->name = "rff_id";
|
|
|
|
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2);
|
|
|
|
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev,
|
|
|
|
sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.req_dma,
|
|
|
|
GFP_KERNEL);
|
2018-07-02 20:01:58 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.req_allocated_size = sizeof(struct ct_sns_pkt);
|
2017-12-28 20:33:31 +00:00
|
|
|
if (!sp->u.iocb_cmd.u.ctarg.req) {
|
|
|
|
ql_log(ql_log_warn, vha, 0xd041,
|
|
|
|
"%s: Failed to allocate ct_sns request.\n",
|
|
|
|
__func__);
|
|
|
|
goto done_free_sp;
|
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev,
|
|
|
|
sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.rsp_dma,
|
|
|
|
GFP_KERNEL);
|
2018-07-02 20:01:58 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_allocated_size = sizeof(struct ct_sns_pkt);
|
2017-12-28 20:33:31 +00:00
|
|
|
if (!sp->u.iocb_cmd.u.ctarg.rsp) {
|
|
|
|
ql_log(ql_log_warn, vha, 0xd042,
|
|
|
|
"%s: Failed to allocate ct_sns request.\n",
|
|
|
|
__func__);
|
|
|
|
goto done_free_sp;
|
|
|
|
}
|
|
|
|
ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.rsp;
|
|
|
|
memset(ct_sns, 0, sizeof(*ct_sns));
|
|
|
|
ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.req;
|
2012-05-15 18:34:28 +00:00
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
/* Prepare CT request */
|
|
|
|
ct_req = qla2x00_prep_ct_req(ct_sns, RFF_ID_CMD, RFF_ID_RSP_SIZE);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
/* Prepare CT arguments -- port_id, FC-4 feature, FC-4 type */
|
2019-08-09 03:01:58 +00:00
|
|
|
ct_req->req.rff_id.port_id = port_id_to_be_id(*d_id);
|
2017-12-28 20:33:31 +00:00
|
|
|
ct_req->req.rff_id.fc4_feature = fc4feature;
|
|
|
|
ct_req->req.rff_id.fc4_type = fc4type; /* SCSI - FCP */
|
|
|
|
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_size = RFF_ID_REQ_SIZE;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_size = RFF_ID_RSP_SIZE;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.nport_handle = NPH_SNS;
|
|
|
|
sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout;
|
|
|
|
sp->done = qla2x00_async_sns_sp_done;
|
|
|
|
|
2019-02-14 15:52:29 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xffff,
|
|
|
|
"Async-%s - hdl=%x portid %06x feature %x type %x.\n",
|
|
|
|
sp->name, sp->handle, d_id->b24, fc4feature, fc4type);
|
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
rval = qla2x00_start_sp(sp);
|
2005-04-16 22:20:36 +00:00
|
|
|
if (rval != QLA_SUCCESS) {
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2047,
|
|
|
|
"RFF_ID issue IOCB failed (%d).\n", rval);
|
2017-12-28 20:33:31 +00:00
|
|
|
goto done_free_sp;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
return rval;
|
|
|
|
|
|
|
|
done_free_sp:
|
|
|
|
sp->free(sp);
|
|
|
|
done:
|
|
|
|
return rval;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qla2x00_rnn_id() - SNS Register Node Name (RNN_ID) of the HBA.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
|
|
|
int
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_rnn_id(scsi_qla_host_t *vha)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-11-06 18:40:19 +00:00
|
|
|
if (IS_QLA2100(ha) || IS_QLA2200(ha))
|
|
|
|
return qla2x00_sns_rnn_id(vha);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
return qla_async_rnnid(vha, &vha->d_id, vha->node_name);
|
|
|
|
}
|
2017-01-20 06:28:00 +00:00
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
static int qla_async_rnnid(scsi_qla_host_t *vha, port_id_t *d_id,
|
|
|
|
u8 *node_name)
|
|
|
|
{
|
|
|
|
int rval = QLA_MEMORY_ALLOC_FAILED;
|
|
|
|
struct ct_sns_req *ct_req;
|
|
|
|
srb_t *sp;
|
|
|
|
struct ct_sns_pkt *ct_sns;
|
|
|
|
|
|
|
|
sp = qla2x00_get_sp(vha, NULL, GFP_KERNEL);
|
|
|
|
if (!sp)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
sp->type = SRB_CT_PTHRU_CMD;
|
|
|
|
sp->name = "rnid";
|
|
|
|
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2);
|
|
|
|
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev,
|
|
|
|
sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.req_dma,
|
|
|
|
GFP_KERNEL);
|
2018-07-02 20:01:58 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.req_allocated_size = sizeof(struct ct_sns_pkt);
|
2017-12-28 20:33:31 +00:00
|
|
|
if (!sp->u.iocb_cmd.u.ctarg.req) {
|
|
|
|
ql_log(ql_log_warn, vha, 0xd041,
|
|
|
|
"%s: Failed to allocate ct_sns request.\n",
|
|
|
|
__func__);
|
|
|
|
goto done_free_sp;
|
|
|
|
}
|
|
|
|
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev,
|
|
|
|
sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.rsp_dma,
|
|
|
|
GFP_KERNEL);
|
2018-07-02 20:01:58 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_allocated_size = sizeof(struct ct_sns_pkt);
|
2017-12-28 20:33:31 +00:00
|
|
|
if (!sp->u.iocb_cmd.u.ctarg.rsp) {
|
|
|
|
ql_log(ql_log_warn, vha, 0xd042,
|
|
|
|
"%s: Failed to allocate ct_sns request.\n",
|
|
|
|
__func__);
|
|
|
|
goto done_free_sp;
|
|
|
|
}
|
|
|
|
ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.rsp;
|
|
|
|
memset(ct_sns, 0, sizeof(*ct_sns));
|
|
|
|
ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.req;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Prepare CT request */
|
2017-12-28 20:33:31 +00:00
|
|
|
ct_req = qla2x00_prep_ct_req(ct_sns, RNN_ID_CMD, RNN_ID_RSP_SIZE);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Prepare CT arguments -- port_id, node_name */
|
2019-08-09 03:01:58 +00:00
|
|
|
ct_req->req.rnn_id.port_id = port_id_to_be_id(vha->d_id);
|
2008-11-06 18:40:19 +00:00
|
|
|
memcpy(ct_req->req.rnn_id.node_name, vha->node_name, WWN_SIZE);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.req_size = RNN_ID_REQ_SIZE;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_size = RNN_ID_RSP_SIZE;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.nport_handle = NPH_SNS;
|
|
|
|
|
|
|
|
sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout;
|
|
|
|
sp->done = qla2x00_async_sns_sp_done;
|
|
|
|
|
2019-02-14 15:52:29 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xffff,
|
|
|
|
"Async-%s - hdl=%x portid %06x\n",
|
|
|
|
sp->name, sp->handle, d_id->b24);
|
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
rval = qla2x00_start_sp(sp);
|
2005-04-16 22:20:36 +00:00
|
|
|
if (rval != QLA_SUCCESS) {
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x204d,
|
|
|
|
"RNN_ID issue IOCB failed (%d).\n", rval);
|
2017-12-28 20:33:31 +00:00
|
|
|
goto done_free_sp;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
return rval;
|
|
|
|
|
|
|
|
done_free_sp:
|
|
|
|
sp->free(sp);
|
|
|
|
done:
|
|
|
|
return rval;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2020-02-12 21:44:17 +00:00
|
|
|
size_t
|
2014-09-25 09:16:46 +00:00
|
|
|
qla2x00_get_sym_node_name(scsi_qla_host_t *vha, uint8_t *snn, size_t size)
|
2006-10-02 19:00:44 +00:00
|
|
|
{
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2013-03-28 12:21:23 +00:00
|
|
|
|
|
|
|
if (IS_QLAFX00(ha))
|
2020-02-12 21:44:17 +00:00
|
|
|
return scnprintf(snn, size, "%s FW:v%s DVR:v%s",
|
|
|
|
ha->model_number, ha->mr.fw_version, qla2x00_version_str);
|
|
|
|
|
|
|
|
return scnprintf(snn, size, "%s FW:v%d.%02d.%02d DVR:v%s",
|
|
|
|
ha->model_number, ha->fw_major_version, ha->fw_minor_version,
|
|
|
|
ha->fw_subminor_version, qla2x00_version_str);
|
2006-10-02 19:00:44 +00:00
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/**
|
|
|
|
* qla2x00_rsnn_nn() - SNS Register Symbolic Node Name (RSNN_NN) of the HBA.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
|
|
|
int
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_rsnn_nn(scsi_qla_host_t *vha)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2050,
|
|
|
|
"RSNN_ID call unsupported on ISP2100/ISP2200.\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
return (QLA_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
return qla_async_rsnn_nn(vha);
|
|
|
|
}
|
2017-01-20 06:28:00 +00:00
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
static int qla_async_rsnn_nn(scsi_qla_host_t *vha)
|
|
|
|
{
|
|
|
|
int rval = QLA_MEMORY_ALLOC_FAILED;
|
|
|
|
struct ct_sns_req *ct_req;
|
|
|
|
srb_t *sp;
|
|
|
|
struct ct_sns_pkt *ct_sns;
|
|
|
|
|
|
|
|
sp = qla2x00_get_sp(vha, NULL, GFP_KERNEL);
|
|
|
|
if (!sp)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
sp->type = SRB_CT_PTHRU_CMD;
|
|
|
|
sp->name = "rsnn_nn";
|
|
|
|
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2);
|
|
|
|
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev,
|
|
|
|
sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.req_dma,
|
|
|
|
GFP_KERNEL);
|
2018-07-02 20:01:58 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.req_allocated_size = sizeof(struct ct_sns_pkt);
|
2017-12-28 20:33:31 +00:00
|
|
|
if (!sp->u.iocb_cmd.u.ctarg.req) {
|
|
|
|
ql_log(ql_log_warn, vha, 0xd041,
|
|
|
|
"%s: Failed to allocate ct_sns request.\n",
|
|
|
|
__func__);
|
|
|
|
goto done_free_sp;
|
|
|
|
}
|
|
|
|
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev,
|
|
|
|
sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.rsp_dma,
|
|
|
|
GFP_KERNEL);
|
2018-07-02 20:01:58 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_allocated_size = sizeof(struct ct_sns_pkt);
|
2017-12-28 20:33:31 +00:00
|
|
|
if (!sp->u.iocb_cmd.u.ctarg.rsp) {
|
|
|
|
ql_log(ql_log_warn, vha, 0xd042,
|
|
|
|
"%s: Failed to allocate ct_sns request.\n",
|
|
|
|
__func__);
|
|
|
|
goto done_free_sp;
|
|
|
|
}
|
|
|
|
ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.rsp;
|
|
|
|
memset(ct_sns, 0, sizeof(*ct_sns));
|
|
|
|
ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.req;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Prepare CT request */
|
2017-12-28 20:33:31 +00:00
|
|
|
ct_req = qla2x00_prep_ct_req(ct_sns, RSNN_NN_CMD, RSNN_NN_RSP_SIZE);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Prepare CT arguments -- node_name, symbolic node_name, size */
|
2008-11-06 18:40:19 +00:00
|
|
|
memcpy(ct_req->req.rsnn_nn.node_name, vha->node_name, WWN_SIZE);
|
2005-07-06 17:32:07 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Prepare the Symbolic Node Name */
|
2014-09-25 09:16:46 +00:00
|
|
|
qla2x00_get_sym_node_name(vha, ct_req->req.rsnn_nn.sym_node_name,
|
|
|
|
sizeof(ct_req->req.rsnn_nn.sym_node_name));
|
2006-10-02 19:00:44 +00:00
|
|
|
ct_req->req.rsnn_nn.name_len =
|
|
|
|
(uint8_t)strlen(ct_req->req.rsnn_nn.sym_node_name);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.req_size = 24 + 1 + ct_req->req.rsnn_nn.name_len;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_size = RSNN_NN_RSP_SIZE;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.nport_handle = NPH_SNS;
|
|
|
|
|
|
|
|
sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout;
|
|
|
|
sp->done = qla2x00_async_sns_sp_done;
|
|
|
|
|
2019-02-14 15:52:29 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xffff,
|
|
|
|
"Async-%s - hdl=%x.\n",
|
|
|
|
sp->name, sp->handle);
|
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
rval = qla2x00_start_sp(sp);
|
2005-04-16 22:20:36 +00:00
|
|
|
if (rval != QLA_SUCCESS) {
|
2017-12-28 20:33:31 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2043,
|
|
|
|
"RFT_ID issue IOCB failed (%d).\n", rval);
|
|
|
|
goto done_free_sp;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
return rval;
|
|
|
|
|
|
|
|
done_free_sp:
|
|
|
|
sp->free(sp);
|
|
|
|
done:
|
|
|
|
return rval;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qla2x00_prep_sns_cmd() - Prepare common SNS command request fields for query.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2005-04-16 22:20:36 +00:00
|
|
|
* @cmd: GS command
|
|
|
|
* @scmd_len: Subcommand length
|
|
|
|
* @data_size: response size in bytes
|
|
|
|
*
|
|
|
|
* Returns a pointer to the @ha's sns_cmd.
|
|
|
|
*/
|
|
|
|
static inline struct sns_cmd_pkt *
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_prep_sns_cmd(scsi_qla_host_t *vha, uint16_t cmd, uint16_t scmd_len,
|
2005-04-16 22:20:36 +00:00
|
|
|
uint16_t data_size)
|
|
|
|
{
|
|
|
|
uint16_t wc;
|
|
|
|
struct sns_cmd_pkt *sns_cmd;
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
sns_cmd = ha->sns_cmd;
|
|
|
|
memset(sns_cmd, 0, sizeof(struct sns_cmd_pkt));
|
|
|
|
wc = data_size / 2; /* Size in 16bit words. */
|
|
|
|
sns_cmd->p.cmd.buffer_length = cpu_to_le16(wc);
|
2019-04-17 21:44:39 +00:00
|
|
|
put_unaligned_le64(ha->sns_cmd_dma, &sns_cmd->p.cmd.buffer_address);
|
2005-04-16 22:20:36 +00:00
|
|
|
sns_cmd->p.cmd.subcommand_length = cpu_to_le16(scmd_len);
|
|
|
|
sns_cmd->p.cmd.subcommand = cpu_to_le16(cmd);
|
|
|
|
wc = (data_size - 16) / 4; /* Size in 32bit words. */
|
|
|
|
sns_cmd->p.cmd.size = cpu_to_le16(wc);
|
|
|
|
|
2013-08-27 05:37:40 +00:00
|
|
|
vha->qla_stats.control_requests++;
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
return (sns_cmd);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qla2x00_sns_ga_nxt() - SNS scan for fabric devices via GA_NXT command.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2005-04-16 22:20:36 +00:00
|
|
|
* @fcport: fcport entry to updated
|
|
|
|
*
|
|
|
|
* This command uses the old Exectute SNS Command mailbox routine.
|
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
|
|
|
static int
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_sns_ga_nxt(scsi_qla_host_t *vha, fc_port_t *fcport)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2012-02-09 19:15:57 +00:00
|
|
|
int rval = QLA_SUCCESS;
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2005-04-16 22:20:36 +00:00
|
|
|
struct sns_cmd_pkt *sns_cmd;
|
|
|
|
|
|
|
|
/* Issue GA_NXT. */
|
|
|
|
/* Prepare SNS command request. */
|
2008-11-06 18:40:19 +00:00
|
|
|
sns_cmd = qla2x00_prep_sns_cmd(vha, GA_NXT_CMD, GA_NXT_SNS_SCMD_LEN,
|
2005-04-16 22:20:36 +00:00
|
|
|
GA_NXT_SNS_DATA_SIZE);
|
|
|
|
|
|
|
|
/* Prepare SNS command arguments -- port_id. */
|
|
|
|
sns_cmd->p.cmd.param[0] = fcport->d_id.b.al_pa;
|
|
|
|
sns_cmd->p.cmd.param[1] = fcport->d_id.b.area;
|
|
|
|
sns_cmd->p.cmd.param[2] = fcport->d_id.b.domain;
|
|
|
|
|
|
|
|
/* Execute SNS command. */
|
2008-11-06 18:40:19 +00:00
|
|
|
rval = qla2x00_send_sns(vha, ha->sns_cmd_dma, GA_NXT_SNS_CMD_SIZE / 2,
|
2005-04-16 22:20:36 +00:00
|
|
|
sizeof(struct sns_cmd_pkt));
|
|
|
|
if (rval != QLA_SUCCESS) {
|
|
|
|
/*EMPTY*/
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x205f,
|
|
|
|
"GA_NXT Send SNS failed (%d).\n", rval);
|
2005-04-16 22:20:36 +00:00
|
|
|
} else if (sns_cmd->p.gan_data[8] != 0x80 ||
|
|
|
|
sns_cmd->p.gan_data[9] != 0x02) {
|
2011-11-18 17:03:07 +00:00
|
|
|
ql_dbg(ql_dbg_disc + ql_dbg_buffer, vha, 0x2084,
|
2011-07-14 19:00:13 +00:00
|
|
|
"GA_NXT failed, rejected request ga_nxt_rsp:\n");
|
|
|
|
ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x2074,
|
|
|
|
sns_cmd->p.gan_data, 16);
|
2005-04-16 22:20:36 +00:00
|
|
|
rval = QLA_FUNCTION_FAILED;
|
|
|
|
} else {
|
|
|
|
/* Populate fc_port_t entry. */
|
|
|
|
fcport->d_id.b.domain = sns_cmd->p.gan_data[17];
|
|
|
|
fcport->d_id.b.area = sns_cmd->p.gan_data[18];
|
|
|
|
fcport->d_id.b.al_pa = sns_cmd->p.gan_data[19];
|
|
|
|
|
|
|
|
memcpy(fcport->node_name, &sns_cmd->p.gan_data[284], WWN_SIZE);
|
|
|
|
memcpy(fcport->port_name, &sns_cmd->p.gan_data[20], WWN_SIZE);
|
|
|
|
|
|
|
|
if (sns_cmd->p.gan_data[16] != NS_N_PORT_TYPE &&
|
|
|
|
sns_cmd->p.gan_data[16] != NS_NL_PORT_TYPE)
|
|
|
|
fcport->d_id.b.domain = 0xf0;
|
|
|
|
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2061,
|
2013-08-27 05:37:27 +00:00
|
|
|
"GA_NXT entry - nn %8phN pn %8phN "
|
2011-07-14 19:00:13 +00:00
|
|
|
"port_id=%02x%02x%02x.\n",
|
2013-08-27 05:37:27 +00:00
|
|
|
fcport->node_name, fcport->port_name,
|
2005-04-16 22:20:36 +00:00
|
|
|
fcport->d_id.b.domain, fcport->d_id.b.area,
|
2011-07-14 19:00:13 +00:00
|
|
|
fcport->d_id.b.al_pa);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return (rval);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qla2x00_sns_gid_pt() - SNS scan for fabric devices via GID_PT command.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2005-04-16 22:20:36 +00:00
|
|
|
* @list: switch info entries to populate
|
|
|
|
*
|
|
|
|
* This command uses the old Exectute SNS Command mailbox routine.
|
|
|
|
*
|
|
|
|
* NOTE: Non-Nx_Ports are not requested.
|
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
|
|
|
static int
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_sns_gid_pt(scsi_qla_host_t *vha, sw_info_t *list)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
int rval;
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2005-04-16 22:20:36 +00:00
|
|
|
uint16_t i;
|
|
|
|
uint8_t *entry;
|
|
|
|
struct sns_cmd_pkt *sns_cmd;
|
2012-02-09 19:15:57 +00:00
|
|
|
uint16_t gid_pt_sns_data_size;
|
|
|
|
|
|
|
|
gid_pt_sns_data_size = qla2x00_gid_pt_rsp_size(vha);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Issue GID_PT. */
|
|
|
|
/* Prepare SNS command request. */
|
2008-11-06 18:40:19 +00:00
|
|
|
sns_cmd = qla2x00_prep_sns_cmd(vha, GID_PT_CMD, GID_PT_SNS_SCMD_LEN,
|
2012-02-09 19:15:57 +00:00
|
|
|
gid_pt_sns_data_size);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Prepare SNS command arguments -- port_type. */
|
|
|
|
sns_cmd->p.cmd.param[0] = NS_NX_PORT_TYPE;
|
|
|
|
|
|
|
|
/* Execute SNS command. */
|
2008-11-06 18:40:19 +00:00
|
|
|
rval = qla2x00_send_sns(vha, ha->sns_cmd_dma, GID_PT_SNS_CMD_SIZE / 2,
|
2005-04-16 22:20:36 +00:00
|
|
|
sizeof(struct sns_cmd_pkt));
|
|
|
|
if (rval != QLA_SUCCESS) {
|
|
|
|
/*EMPTY*/
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x206d,
|
|
|
|
"GID_PT Send SNS failed (%d).\n", rval);
|
2005-04-16 22:20:36 +00:00
|
|
|
} else if (sns_cmd->p.gid_data[8] != 0x80 ||
|
|
|
|
sns_cmd->p.gid_data[9] != 0x02) {
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x202f,
|
|
|
|
"GID_PT failed, rejected request, gid_rsp:\n");
|
|
|
|
ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x2081,
|
|
|
|
sns_cmd->p.gid_data, 16);
|
2005-04-16 22:20:36 +00:00
|
|
|
rval = QLA_FUNCTION_FAILED;
|
|
|
|
} else {
|
|
|
|
/* Set port IDs in switch info list. */
|
2012-02-09 19:15:57 +00:00
|
|
|
for (i = 0; i < ha->max_fibre_devices; i++) {
|
2005-04-16 22:20:36 +00:00
|
|
|
entry = &sns_cmd->p.gid_data[(i * 4) + 16];
|
|
|
|
list[i].d_id.b.domain = entry[1];
|
|
|
|
list[i].d_id.b.area = entry[2];
|
|
|
|
list[i].d_id.b.al_pa = entry[3];
|
|
|
|
|
|
|
|
/* Last one exit. */
|
|
|
|
if (entry[0] & BIT_7) {
|
|
|
|
list[i].d_id.b.rsvd_1 = entry[0];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If we've used all available slots, then the switch is
|
|
|
|
* reporting back more devices that we can handle with this
|
|
|
|
* single call. Return a failed status, and let GA_NXT handle
|
|
|
|
* the overload.
|
|
|
|
*/
|
2012-02-09 19:15:57 +00:00
|
|
|
if (i == ha->max_fibre_devices)
|
2005-04-16 22:20:36 +00:00
|
|
|
rval = QLA_FUNCTION_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (rval);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qla2x00_sns_gpn_id() - SNS Get Port Name (GPN_ID) query.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2005-04-16 22:20:36 +00:00
|
|
|
* @list: switch info entries to populate
|
|
|
|
*
|
|
|
|
* This command uses the old Exectute SNS Command mailbox routine.
|
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
|
|
|
static int
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_sns_gpn_id(scsi_qla_host_t *vha, sw_info_t *list)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2012-02-09 19:15:57 +00:00
|
|
|
int rval = QLA_SUCCESS;
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2005-04-16 22:20:36 +00:00
|
|
|
uint16_t i;
|
|
|
|
struct sns_cmd_pkt *sns_cmd;
|
|
|
|
|
2012-02-09 19:15:57 +00:00
|
|
|
for (i = 0; i < ha->max_fibre_devices; i++) {
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Issue GPN_ID */
|
|
|
|
/* Prepare SNS command request. */
|
2008-11-06 18:40:19 +00:00
|
|
|
sns_cmd = qla2x00_prep_sns_cmd(vha, GPN_ID_CMD,
|
2005-04-16 22:20:36 +00:00
|
|
|
GPN_ID_SNS_SCMD_LEN, GPN_ID_SNS_DATA_SIZE);
|
|
|
|
|
|
|
|
/* Prepare SNS command arguments -- port_id. */
|
|
|
|
sns_cmd->p.cmd.param[0] = list[i].d_id.b.al_pa;
|
|
|
|
sns_cmd->p.cmd.param[1] = list[i].d_id.b.area;
|
|
|
|
sns_cmd->p.cmd.param[2] = list[i].d_id.b.domain;
|
|
|
|
|
|
|
|
/* Execute SNS command. */
|
2008-11-06 18:40:19 +00:00
|
|
|
rval = qla2x00_send_sns(vha, ha->sns_cmd_dma,
|
2005-04-16 22:20:36 +00:00
|
|
|
GPN_ID_SNS_CMD_SIZE / 2, sizeof(struct sns_cmd_pkt));
|
|
|
|
if (rval != QLA_SUCCESS) {
|
|
|
|
/*EMPTY*/
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2032,
|
|
|
|
"GPN_ID Send SNS failed (%d).\n", rval);
|
2005-04-16 22:20:36 +00:00
|
|
|
} else if (sns_cmd->p.gpn_data[8] != 0x80 ||
|
|
|
|
sns_cmd->p.gpn_data[9] != 0x02) {
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc + ql_dbg_buffer, vha, 0x207e,
|
|
|
|
"GPN_ID failed, rejected request, gpn_rsp:\n");
|
2013-03-28 12:21:23 +00:00
|
|
|
ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x207f,
|
2011-07-14 19:00:13 +00:00
|
|
|
sns_cmd->p.gpn_data, 16);
|
2005-04-16 22:20:36 +00:00
|
|
|
rval = QLA_FUNCTION_FAILED;
|
|
|
|
} else {
|
|
|
|
/* Save portname */
|
|
|
|
memcpy(list[i].port_name, &sns_cmd->p.gpn_data[16],
|
|
|
|
WWN_SIZE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Last device exit. */
|
|
|
|
if (list[i].d_id.b.rsvd_1 != 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (rval);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qla2x00_sns_gnn_id() - SNS Get Node Name (GNN_ID) query.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2005-04-16 22:20:36 +00:00
|
|
|
* @list: switch info entries to populate
|
|
|
|
*
|
|
|
|
* This command uses the old Exectute SNS Command mailbox routine.
|
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
|
|
|
static int
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_sns_gnn_id(scsi_qla_host_t *vha, sw_info_t *list)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2012-02-09 19:15:57 +00:00
|
|
|
int rval = QLA_SUCCESS;
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2005-04-16 22:20:36 +00:00
|
|
|
uint16_t i;
|
|
|
|
struct sns_cmd_pkt *sns_cmd;
|
|
|
|
|
2012-02-09 19:15:57 +00:00
|
|
|
for (i = 0; i < ha->max_fibre_devices; i++) {
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Issue GNN_ID */
|
|
|
|
/* Prepare SNS command request. */
|
2008-11-06 18:40:19 +00:00
|
|
|
sns_cmd = qla2x00_prep_sns_cmd(vha, GNN_ID_CMD,
|
2005-04-16 22:20:36 +00:00
|
|
|
GNN_ID_SNS_SCMD_LEN, GNN_ID_SNS_DATA_SIZE);
|
|
|
|
|
|
|
|
/* Prepare SNS command arguments -- port_id. */
|
|
|
|
sns_cmd->p.cmd.param[0] = list[i].d_id.b.al_pa;
|
|
|
|
sns_cmd->p.cmd.param[1] = list[i].d_id.b.area;
|
|
|
|
sns_cmd->p.cmd.param[2] = list[i].d_id.b.domain;
|
|
|
|
|
|
|
|
/* Execute SNS command. */
|
2008-11-06 18:40:19 +00:00
|
|
|
rval = qla2x00_send_sns(vha, ha->sns_cmd_dma,
|
2005-04-16 22:20:36 +00:00
|
|
|
GNN_ID_SNS_CMD_SIZE / 2, sizeof(struct sns_cmd_pkt));
|
|
|
|
if (rval != QLA_SUCCESS) {
|
|
|
|
/*EMPTY*/
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x203f,
|
|
|
|
"GNN_ID Send SNS failed (%d).\n", rval);
|
2005-04-16 22:20:36 +00:00
|
|
|
} else if (sns_cmd->p.gnn_data[8] != 0x80 ||
|
|
|
|
sns_cmd->p.gnn_data[9] != 0x02) {
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc + ql_dbg_buffer, vha, 0x2082,
|
|
|
|
"GNN_ID failed, rejected request, gnn_rsp:\n");
|
|
|
|
ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x207a,
|
|
|
|
sns_cmd->p.gnn_data, 16);
|
2005-04-16 22:20:36 +00:00
|
|
|
rval = QLA_FUNCTION_FAILED;
|
|
|
|
} else {
|
|
|
|
/* Save nodename */
|
|
|
|
memcpy(list[i].node_name, &sns_cmd->p.gnn_data[16],
|
|
|
|
WWN_SIZE);
|
|
|
|
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x206e,
|
2013-08-27 05:37:27 +00:00
|
|
|
"GID_PT entry - nn %8phN pn %8phN "
|
2011-07-14 19:00:13 +00:00
|
|
|
"port_id=%02x%02x%02x.\n",
|
2013-08-27 05:37:27 +00:00
|
|
|
list[i].node_name, list[i].port_name,
|
2005-04-16 22:20:36 +00:00
|
|
|
list[i].d_id.b.domain, list[i].d_id.b.area,
|
2011-07-14 19:00:13 +00:00
|
|
|
list[i].d_id.b.al_pa);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Last device exit. */
|
|
|
|
if (list[i].d_id.b.rsvd_1 != 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (rval);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qla2x00_snd_rft_id() - SNS Register FC-4 TYPEs (RFT_ID) supported by the HBA.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* This command uses the old Exectute SNS Command mailbox routine.
|
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
|
|
|
static int
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_sns_rft_id(scsi_qla_host_t *vha)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
int rval;
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2005-04-16 22:20:36 +00:00
|
|
|
struct sns_cmd_pkt *sns_cmd;
|
|
|
|
|
|
|
|
/* Issue RFT_ID. */
|
|
|
|
/* Prepare SNS command request. */
|
2008-11-06 18:40:19 +00:00
|
|
|
sns_cmd = qla2x00_prep_sns_cmd(vha, RFT_ID_CMD, RFT_ID_SNS_SCMD_LEN,
|
2005-04-16 22:20:36 +00:00
|
|
|
RFT_ID_SNS_DATA_SIZE);
|
|
|
|
|
|
|
|
/* Prepare SNS command arguments -- port_id, FC-4 types */
|
2008-11-06 18:40:19 +00:00
|
|
|
sns_cmd->p.cmd.param[0] = vha->d_id.b.al_pa;
|
|
|
|
sns_cmd->p.cmd.param[1] = vha->d_id.b.area;
|
|
|
|
sns_cmd->p.cmd.param[2] = vha->d_id.b.domain;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
sns_cmd->p.cmd.param[5] = 0x01; /* FCP-3 */
|
|
|
|
|
|
|
|
/* Execute SNS command. */
|
2008-11-06 18:40:19 +00:00
|
|
|
rval = qla2x00_send_sns(vha, ha->sns_cmd_dma, RFT_ID_SNS_CMD_SIZE / 2,
|
2005-04-16 22:20:36 +00:00
|
|
|
sizeof(struct sns_cmd_pkt));
|
|
|
|
if (rval != QLA_SUCCESS) {
|
|
|
|
/*EMPTY*/
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2060,
|
|
|
|
"RFT_ID Send SNS failed (%d).\n", rval);
|
2005-04-16 22:20:36 +00:00
|
|
|
} else if (sns_cmd->p.rft_data[8] != 0x80 ||
|
|
|
|
sns_cmd->p.rft_data[9] != 0x02) {
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc + ql_dbg_buffer, vha, 0x2083,
|
|
|
|
"RFT_ID failed, rejected request rft_rsp:\n");
|
|
|
|
ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x2080,
|
|
|
|
sns_cmd->p.rft_data, 16);
|
2005-04-16 22:20:36 +00:00
|
|
|
rval = QLA_FUNCTION_FAILED;
|
|
|
|
} else {
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2073,
|
|
|
|
"RFT_ID exiting normally.\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return (rval);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qla2x00_sns_rnn_id() - SNS Register Node Name (RNN_ID) of the HBA.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* This command uses the old Exectute SNS Command mailbox routine.
|
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
|
|
|
static int
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_sns_rnn_id(scsi_qla_host_t *vha)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
int rval;
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2005-04-16 22:20:36 +00:00
|
|
|
struct sns_cmd_pkt *sns_cmd;
|
|
|
|
|
|
|
|
/* Issue RNN_ID. */
|
|
|
|
/* Prepare SNS command request. */
|
2008-11-06 18:40:19 +00:00
|
|
|
sns_cmd = qla2x00_prep_sns_cmd(vha, RNN_ID_CMD, RNN_ID_SNS_SCMD_LEN,
|
2005-04-16 22:20:36 +00:00
|
|
|
RNN_ID_SNS_DATA_SIZE);
|
|
|
|
|
|
|
|
/* Prepare SNS command arguments -- port_id, nodename. */
|
2008-11-06 18:40:19 +00:00
|
|
|
sns_cmd->p.cmd.param[0] = vha->d_id.b.al_pa;
|
|
|
|
sns_cmd->p.cmd.param[1] = vha->d_id.b.area;
|
|
|
|
sns_cmd->p.cmd.param[2] = vha->d_id.b.domain;
|
|
|
|
|
|
|
|
sns_cmd->p.cmd.param[4] = vha->node_name[7];
|
|
|
|
sns_cmd->p.cmd.param[5] = vha->node_name[6];
|
|
|
|
sns_cmd->p.cmd.param[6] = vha->node_name[5];
|
|
|
|
sns_cmd->p.cmd.param[7] = vha->node_name[4];
|
|
|
|
sns_cmd->p.cmd.param[8] = vha->node_name[3];
|
|
|
|
sns_cmd->p.cmd.param[9] = vha->node_name[2];
|
|
|
|
sns_cmd->p.cmd.param[10] = vha->node_name[1];
|
|
|
|
sns_cmd->p.cmd.param[11] = vha->node_name[0];
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Execute SNS command. */
|
2008-11-06 18:40:19 +00:00
|
|
|
rval = qla2x00_send_sns(vha, ha->sns_cmd_dma, RNN_ID_SNS_CMD_SIZE / 2,
|
2005-04-16 22:20:36 +00:00
|
|
|
sizeof(struct sns_cmd_pkt));
|
|
|
|
if (rval != QLA_SUCCESS) {
|
|
|
|
/*EMPTY*/
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x204a,
|
|
|
|
"RNN_ID Send SNS failed (%d).\n", rval);
|
2005-04-16 22:20:36 +00:00
|
|
|
} else if (sns_cmd->p.rnn_data[8] != 0x80 ||
|
|
|
|
sns_cmd->p.rnn_data[9] != 0x02) {
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc + ql_dbg_buffer, vha, 0x207b,
|
|
|
|
"RNN_ID failed, rejected request, rnn_rsp:\n");
|
|
|
|
ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x207c,
|
|
|
|
sns_cmd->p.rnn_data, 16);
|
2005-04-16 22:20:36 +00:00
|
|
|
rval = QLA_FUNCTION_FAILED;
|
|
|
|
} else {
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x204c,
|
|
|
|
"RNN_ID exiting normally.\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return (rval);
|
|
|
|
}
|
2005-08-27 02:08:30 +00:00
|
|
|
|
|
|
|
/**
|
2008-02-03 15:28:22 +00:00
|
|
|
* qla2x00_mgmt_svr_login() - Login to fabric Management Service.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2005-08-27 02:08:30 +00:00
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
2017-01-20 06:28:00 +00:00
|
|
|
int
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_mgmt_svr_login(scsi_qla_host_t *vha)
|
2005-08-27 02:08:30 +00:00
|
|
|
{
|
2012-02-09 19:15:42 +00:00
|
|
|
int ret, rval;
|
2005-08-27 02:08:30 +00:00
|
|
|
uint16_t mb[MAILBOX_REGISTER_COUNT];
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2019-04-11 21:53:17 +00:00
|
|
|
|
2005-08-27 02:08:30 +00:00
|
|
|
ret = QLA_SUCCESS;
|
2008-11-06 18:40:19 +00:00
|
|
|
if (vha->flags.management_server_logged_in)
|
2005-08-27 02:08:30 +00:00
|
|
|
return ret;
|
|
|
|
|
2012-02-09 19:15:42 +00:00
|
|
|
rval = ha->isp_ops->fabric_login(vha, vha->mgmt_svr_loop_id, 0xff, 0xff,
|
2012-08-22 18:21:18 +00:00
|
|
|
0xfa, mb, BIT_1);
|
2012-02-09 19:15:42 +00:00
|
|
|
if (rval != QLA_SUCCESS || mb[0] != MBS_COMMAND_COMPLETE) {
|
|
|
|
if (rval == QLA_MEMORY_ALLOC_FAILED)
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2085,
|
|
|
|
"Failed management_server login: loopid=%x "
|
|
|
|
"rval=%d\n", vha->mgmt_svr_loop_id, rval);
|
|
|
|
else
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2024,
|
|
|
|
"Failed management_server login: loopid=%x "
|
|
|
|
"mb[0]=%x mb[1]=%x mb[2]=%x mb[6]=%x mb[7]=%x.\n",
|
|
|
|
vha->mgmt_svr_loop_id, mb[0], mb[1], mb[2], mb[6],
|
|
|
|
mb[7]);
|
2005-08-27 02:08:30 +00:00
|
|
|
ret = QLA_FUNCTION_FAILED;
|
|
|
|
} else
|
2008-11-06 18:40:19 +00:00
|
|
|
vha->flags.management_server_logged_in = 1;
|
2005-08-27 02:08:30 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qla2x00_prep_ms_fdmi_iocb() - Prepare common MS IOCB fields for FDMI query.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2005-08-27 02:08:30 +00:00
|
|
|
* @req_size: request size in bytes
|
|
|
|
* @rsp_size: response size in bytes
|
|
|
|
*
|
|
|
|
* Returns a pointer to the @ha's ms_iocb.
|
|
|
|
*/
|
|
|
|
void *
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_prep_ms_fdmi_iocb(scsi_qla_host_t *vha, uint32_t req_size,
|
2005-08-27 02:08:30 +00:00
|
|
|
uint32_t rsp_size)
|
|
|
|
{
|
|
|
|
ms_iocb_entry_t *ms_pkt;
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2019-04-11 21:53:17 +00:00
|
|
|
|
2005-08-27 02:08:30 +00:00
|
|
|
ms_pkt = ha->ms_iocb;
|
|
|
|
memset(ms_pkt, 0, sizeof(ms_iocb_entry_t));
|
|
|
|
|
|
|
|
ms_pkt->entry_type = MS_IOCB_TYPE;
|
|
|
|
ms_pkt->entry_count = 1;
|
2008-11-06 18:40:19 +00:00
|
|
|
SET_TARGET_ID(ha, ms_pkt->loop_id, vha->mgmt_svr_loop_id);
|
2015-07-09 14:24:08 +00:00
|
|
|
ms_pkt->control_flags = cpu_to_le16(CF_READ | CF_HEAD_TAG);
|
2008-02-28 22:06:11 +00:00
|
|
|
ms_pkt->timeout = cpu_to_le16(ha->r_a_tov / 10 * 2);
|
2015-07-09 14:24:08 +00:00
|
|
|
ms_pkt->cmd_dsd_count = cpu_to_le16(1);
|
|
|
|
ms_pkt->total_dsd_count = cpu_to_le16(2);
|
2005-08-27 02:08:30 +00:00
|
|
|
ms_pkt->rsp_bytecount = cpu_to_le32(rsp_size);
|
|
|
|
ms_pkt->req_bytecount = cpu_to_le32(req_size);
|
|
|
|
|
2019-04-17 21:44:38 +00:00
|
|
|
put_unaligned_le64(ha->ct_sns_dma, &ms_pkt->req_dsd.address);
|
|
|
|
ms_pkt->req_dsd.length = ms_pkt->req_bytecount;
|
2005-08-27 02:08:30 +00:00
|
|
|
|
2019-04-17 21:44:38 +00:00
|
|
|
put_unaligned_le64(ha->ct_sns_dma, &ms_pkt->rsp_dsd.address);
|
|
|
|
ms_pkt->rsp_dsd.length = ms_pkt->rsp_bytecount;
|
2005-08-27 02:08:30 +00:00
|
|
|
|
|
|
|
return ms_pkt;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qla24xx_prep_ms_fdmi_iocb() - Prepare common MS IOCB fields for FDMI query.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2005-08-27 02:08:30 +00:00
|
|
|
* @req_size: request size in bytes
|
|
|
|
* @rsp_size: response size in bytes
|
|
|
|
*
|
|
|
|
* Returns a pointer to the @ha's ms_iocb.
|
|
|
|
*/
|
|
|
|
void *
|
2008-11-06 18:40:19 +00:00
|
|
|
qla24xx_prep_ms_fdmi_iocb(scsi_qla_host_t *vha, uint32_t req_size,
|
2005-08-27 02:08:30 +00:00
|
|
|
uint32_t rsp_size)
|
|
|
|
{
|
|
|
|
struct ct_entry_24xx *ct_pkt;
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2005-08-27 02:08:30 +00:00
|
|
|
|
|
|
|
ct_pkt = (struct ct_entry_24xx *)ha->ms_iocb;
|
|
|
|
memset(ct_pkt, 0, sizeof(struct ct_entry_24xx));
|
|
|
|
|
|
|
|
ct_pkt->entry_type = CT_IOCB_TYPE;
|
|
|
|
ct_pkt->entry_count = 1;
|
2008-11-06 18:40:19 +00:00
|
|
|
ct_pkt->nport_handle = cpu_to_le16(vha->mgmt_svr_loop_id);
|
2008-02-28 22:06:11 +00:00
|
|
|
ct_pkt->timeout = cpu_to_le16(ha->r_a_tov / 10 * 2);
|
2015-07-09 14:24:08 +00:00
|
|
|
ct_pkt->cmd_dsd_count = cpu_to_le16(1);
|
|
|
|
ct_pkt->rsp_dsd_count = cpu_to_le16(1);
|
2005-08-27 02:08:30 +00:00
|
|
|
ct_pkt->rsp_byte_count = cpu_to_le32(rsp_size);
|
|
|
|
ct_pkt->cmd_byte_count = cpu_to_le32(req_size);
|
|
|
|
|
2019-04-17 21:44:38 +00:00
|
|
|
put_unaligned_le64(ha->ct_sns_dma, &ct_pkt->dsd[0].address);
|
|
|
|
ct_pkt->dsd[0].length = ct_pkt->cmd_byte_count;
|
2005-08-27 02:08:30 +00:00
|
|
|
|
2019-04-17 21:44:38 +00:00
|
|
|
put_unaligned_le64(ha->ct_sns_dma, &ct_pkt->dsd[1].address);
|
|
|
|
ct_pkt->dsd[1].length = ct_pkt->rsp_byte_count;
|
2008-11-06 18:40:19 +00:00
|
|
|
ct_pkt->vp_index = vha->vp_idx;
|
2005-08-27 02:08:30 +00:00
|
|
|
|
|
|
|
return ct_pkt;
|
|
|
|
}
|
|
|
|
|
2019-08-09 03:01:30 +00:00
|
|
|
static void
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_update_ms_fdmi_iocb(scsi_qla_host_t *vha, uint32_t req_size)
|
2005-08-27 02:08:30 +00:00
|
|
|
{
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2005-08-27 02:08:30 +00:00
|
|
|
ms_iocb_entry_t *ms_pkt = ha->ms_iocb;
|
|
|
|
struct ct_entry_24xx *ct_pkt = (struct ct_entry_24xx *)ha->ms_iocb;
|
|
|
|
|
2007-07-19 22:05:56 +00:00
|
|
|
if (IS_FWI2_CAPABLE(ha)) {
|
2005-08-27 02:08:30 +00:00
|
|
|
ct_pkt->cmd_byte_count = cpu_to_le32(req_size);
|
2019-04-17 21:44:38 +00:00
|
|
|
ct_pkt->dsd[0].length = ct_pkt->cmd_byte_count;
|
2005-08-27 02:08:30 +00:00
|
|
|
} else {
|
|
|
|
ms_pkt->req_bytecount = cpu_to_le32(req_size);
|
2019-04-17 21:44:38 +00:00
|
|
|
ms_pkt->req_dsd.length = ms_pkt->req_bytecount;
|
2005-08-27 02:08:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qla2x00_prep_ct_req() - Prepare common CT request fields for SNS query.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @p: CT request buffer
|
2005-08-27 02:08:30 +00:00
|
|
|
* @cmd: GS command
|
|
|
|
* @rsp_size: response size in bytes
|
|
|
|
*
|
|
|
|
* Returns a pointer to the intitialized @ct_req.
|
|
|
|
*/
|
|
|
|
static inline struct ct_sns_req *
|
2013-06-25 15:27:28 +00:00
|
|
|
qla2x00_prep_ct_fdmi_req(struct ct_sns_pkt *p, uint16_t cmd,
|
2005-08-27 02:08:30 +00:00
|
|
|
uint16_t rsp_size)
|
|
|
|
{
|
2013-06-25 15:27:28 +00:00
|
|
|
memset(p, 0, sizeof(struct ct_sns_pkt));
|
2005-08-27 02:08:30 +00:00
|
|
|
|
2013-06-25 15:27:28 +00:00
|
|
|
p->p.req.header.revision = 0x01;
|
|
|
|
p->p.req.header.gs_type = 0xFA;
|
|
|
|
p->p.req.header.gs_subtype = 0x10;
|
|
|
|
p->p.req.command = cpu_to_be16(cmd);
|
|
|
|
p->p.req.max_rsp_size = cpu_to_be16((rsp_size - 16) / 4);
|
2005-08-27 02:08:30 +00:00
|
|
|
|
2013-06-25 15:27:28 +00:00
|
|
|
return &p->p.req;
|
2005-08-27 02:08:30 +00:00
|
|
|
}
|
|
|
|
|
2020-09-04 04:51:20 +00:00
|
|
|
uint
|
2020-02-12 21:44:20 +00:00
|
|
|
qla25xx_fdmi_port_speed_capability(struct qla_hw_data *ha)
|
|
|
|
{
|
2020-08-06 11:10:06 +00:00
|
|
|
uint speeds = 0;
|
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
if (IS_CNA_CAPABLE(ha))
|
|
|
|
return FDMI_PORT_SPEED_10GB;
|
|
|
|
if (IS_QLA28XX(ha) || IS_QLA27XX(ha)) {
|
|
|
|
if (ha->max_supported_speed == 2) {
|
|
|
|
if (ha->min_supported_speed <= 6)
|
|
|
|
speeds |= FDMI_PORT_SPEED_64GB;
|
|
|
|
}
|
|
|
|
if (ha->max_supported_speed == 2 ||
|
|
|
|
ha->max_supported_speed == 1) {
|
|
|
|
if (ha->min_supported_speed <= 5)
|
|
|
|
speeds |= FDMI_PORT_SPEED_32GB;
|
|
|
|
}
|
|
|
|
if (ha->max_supported_speed == 2 ||
|
|
|
|
ha->max_supported_speed == 1 ||
|
|
|
|
ha->max_supported_speed == 0) {
|
|
|
|
if (ha->min_supported_speed <= 4)
|
|
|
|
speeds |= FDMI_PORT_SPEED_16GB;
|
|
|
|
}
|
|
|
|
if (ha->max_supported_speed == 1 ||
|
|
|
|
ha->max_supported_speed == 0) {
|
|
|
|
if (ha->min_supported_speed <= 3)
|
|
|
|
speeds |= FDMI_PORT_SPEED_8GB;
|
|
|
|
}
|
|
|
|
if (ha->max_supported_speed == 0) {
|
|
|
|
if (ha->min_supported_speed <= 2)
|
|
|
|
speeds |= FDMI_PORT_SPEED_4GB;
|
|
|
|
}
|
|
|
|
return speeds;
|
|
|
|
}
|
2020-08-06 11:10:06 +00:00
|
|
|
if (IS_QLA2031(ha)) {
|
|
|
|
if ((ha->pdev->subsystem_vendor == 0x103C) &&
|
|
|
|
(ha->pdev->subsystem_device == 0x8002)) {
|
|
|
|
speeds = FDMI_PORT_SPEED_16GB;
|
|
|
|
} else {
|
|
|
|
speeds = FDMI_PORT_SPEED_16GB|FDMI_PORT_SPEED_8GB|
|
|
|
|
FDMI_PORT_SPEED_4GB;
|
|
|
|
}
|
|
|
|
return speeds;
|
|
|
|
}
|
2020-09-04 04:51:20 +00:00
|
|
|
if (IS_QLA25XX(ha) || IS_QLAFX00(ha))
|
2020-02-12 21:44:20 +00:00
|
|
|
return FDMI_PORT_SPEED_8GB|FDMI_PORT_SPEED_4GB|
|
|
|
|
FDMI_PORT_SPEED_2GB|FDMI_PORT_SPEED_1GB;
|
|
|
|
if (IS_QLA24XX_TYPE(ha))
|
|
|
|
return FDMI_PORT_SPEED_4GB|FDMI_PORT_SPEED_2GB|
|
|
|
|
FDMI_PORT_SPEED_1GB;
|
|
|
|
if (IS_QLA23XX(ha))
|
|
|
|
return FDMI_PORT_SPEED_2GB|FDMI_PORT_SPEED_1GB;
|
|
|
|
return FDMI_PORT_SPEED_1GB;
|
|
|
|
}
|
2020-09-04 04:51:20 +00:00
|
|
|
|
|
|
|
uint
|
2020-02-12 21:44:20 +00:00
|
|
|
qla25xx_fdmi_port_speed_currently(struct qla_hw_data *ha)
|
|
|
|
{
|
|
|
|
switch (ha->link_data_rate) {
|
|
|
|
case PORT_SPEED_1GB:
|
|
|
|
return FDMI_PORT_SPEED_1GB;
|
|
|
|
case PORT_SPEED_2GB:
|
|
|
|
return FDMI_PORT_SPEED_2GB;
|
|
|
|
case PORT_SPEED_4GB:
|
|
|
|
return FDMI_PORT_SPEED_4GB;
|
|
|
|
case PORT_SPEED_8GB:
|
|
|
|
return FDMI_PORT_SPEED_8GB;
|
|
|
|
case PORT_SPEED_10GB:
|
|
|
|
return FDMI_PORT_SPEED_10GB;
|
|
|
|
case PORT_SPEED_16GB:
|
|
|
|
return FDMI_PORT_SPEED_16GB;
|
|
|
|
case PORT_SPEED_32GB:
|
|
|
|
return FDMI_PORT_SPEED_32GB;
|
|
|
|
case PORT_SPEED_64GB:
|
|
|
|
return FDMI_PORT_SPEED_64GB;
|
|
|
|
default:
|
|
|
|
return FDMI_PORT_SPEED_UNKNOWN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-27 02:08:30 +00:00
|
|
|
/**
|
2020-02-12 21:44:20 +00:00
|
|
|
* qla2x00_hba_attributes() perform HBA attributes registration
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2020-02-12 21:44:20 +00:00
|
|
|
* @entries: number of entries to use
|
|
|
|
* @callopt: Option to issue extended or standard FDMI
|
|
|
|
* command parameter
|
2005-08-27 02:08:30 +00:00
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
2020-02-12 21:44:20 +00:00
|
|
|
static unsigned long
|
|
|
|
qla2x00_hba_attributes(scsi_qla_host_t *vha, void *entries,
|
|
|
|
unsigned int callopt)
|
2005-08-27 02:08:30 +00:00
|
|
|
{
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2020-02-12 21:44:20 +00:00
|
|
|
struct init_cb_24xx *icb24 = (void *)ha->init_cb;
|
|
|
|
struct new_utsname *p_sysid = utsname();
|
|
|
|
struct ct_fdmi_hba_attr *eiter;
|
|
|
|
uint16_t alen;
|
|
|
|
unsigned long size = 0;
|
2005-08-27 02:08:30 +00:00
|
|
|
|
|
|
|
/* Nodename. */
|
2014-09-25 09:16:46 +00:00
|
|
|
eiter = entries + size;
|
2015-07-09 14:24:08 +00:00
|
|
|
eiter->type = cpu_to_be16(FDMI_HBA_NODE_NAME);
|
2020-02-12 21:44:20 +00:00
|
|
|
memcpy(eiter->a.node_name, vha->node_name, sizeof(eiter->a.node_name));
|
|
|
|
alen = sizeof(eiter->a.node_name);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20a0,
|
|
|
|
"NODENAME = %016llx.\n", wwn_to_u64(eiter->a.node_name));
|
2005-08-27 02:08:30 +00:00
|
|
|
/* Manufacturer. */
|
2014-09-25 09:16:46 +00:00
|
|
|
eiter = entries + size;
|
2015-07-09 14:24:08 +00:00
|
|
|
eiter->type = cpu_to_be16(FDMI_HBA_MANUFACTURER);
|
2020-02-12 21:44:20 +00:00
|
|
|
alen = scnprintf(
|
|
|
|
eiter->a.manufacturer, sizeof(eiter->a.manufacturer),
|
|
|
|
"%s", "QLogic Corporation");
|
|
|
|
alen += FDMI_ATTR_ALIGNMENT(alen);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20a1,
|
|
|
|
"MANUFACTURER = %s.\n", eiter->a.manufacturer);
|
2005-08-27 02:08:30 +00:00
|
|
|
/* Serial number. */
|
2014-09-25 09:16:46 +00:00
|
|
|
eiter = entries + size;
|
2015-07-09 14:24:08 +00:00
|
|
|
eiter->type = cpu_to_be16(FDMI_HBA_SERIAL_NUMBER);
|
2020-02-12 21:44:20 +00:00
|
|
|
alen = 0;
|
|
|
|
if (IS_FWI2_CAPABLE(ha)) {
|
|
|
|
alen = qla2xxx_get_vpd_field(vha, "SN",
|
|
|
|
eiter->a.serial_num, sizeof(eiter->a.serial_num));
|
|
|
|
}
|
|
|
|
if (!alen) {
|
|
|
|
uint32_t sn = ((ha->serial0 & 0x1f) << 16) |
|
2014-09-25 09:16:46 +00:00
|
|
|
(ha->serial2 << 8) | ha->serial1;
|
2020-02-12 21:44:20 +00:00
|
|
|
alen = scnprintf(
|
|
|
|
eiter->a.serial_num, sizeof(eiter->a.serial_num),
|
|
|
|
"%c%05d", 'A' + sn / 100000, sn % 100000);
|
2014-09-25 09:16:46 +00:00
|
|
|
}
|
2020-02-12 21:44:20 +00:00
|
|
|
alen += FDMI_ATTR_ALIGNMENT(alen);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20a2,
|
|
|
|
"SERIAL NUMBER = %s.\n", eiter->a.serial_num);
|
2005-08-27 02:08:30 +00:00
|
|
|
/* Model name. */
|
2014-09-25 09:16:46 +00:00
|
|
|
eiter = entries + size;
|
2015-07-09 14:24:08 +00:00
|
|
|
eiter->type = cpu_to_be16(FDMI_HBA_MODEL);
|
2020-02-12 21:44:20 +00:00
|
|
|
alen = scnprintf(
|
|
|
|
eiter->a.model, sizeof(eiter->a.model),
|
|
|
|
"%s", ha->model_number);
|
|
|
|
alen += FDMI_ATTR_ALIGNMENT(alen);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20a3,
|
|
|
|
"MODEL NAME = %s.\n", eiter->a.model);
|
2005-08-27 02:08:30 +00:00
|
|
|
/* Model description. */
|
2014-09-25 09:16:46 +00:00
|
|
|
eiter = entries + size;
|
2015-07-09 14:24:08 +00:00
|
|
|
eiter->type = cpu_to_be16(FDMI_HBA_MODEL_DESCRIPTION);
|
2020-02-12 21:44:20 +00:00
|
|
|
alen = scnprintf(
|
|
|
|
eiter->a.model_desc, sizeof(eiter->a.model_desc),
|
|
|
|
"%s", ha->model_desc);
|
|
|
|
alen += FDMI_ATTR_ALIGNMENT(alen);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20a4,
|
|
|
|
"MODEL DESCRIPTION = %s.\n", eiter->a.model_desc);
|
2005-08-27 02:08:30 +00:00
|
|
|
/* Hardware version. */
|
2014-09-25 09:16:46 +00:00
|
|
|
eiter = entries + size;
|
2015-07-09 14:24:08 +00:00
|
|
|
eiter->type = cpu_to_be16(FDMI_HBA_HARDWARE_VERSION);
|
2020-02-12 21:44:20 +00:00
|
|
|
alen = 0;
|
|
|
|
if (IS_FWI2_CAPABLE(ha)) {
|
|
|
|
if (!alen) {
|
|
|
|
alen = qla2xxx_get_vpd_field(vha, "MN",
|
|
|
|
eiter->a.hw_version, sizeof(eiter->a.hw_version));
|
|
|
|
}
|
|
|
|
if (!alen) {
|
|
|
|
alen = qla2xxx_get_vpd_field(vha, "EC",
|
|
|
|
eiter->a.hw_version, sizeof(eiter->a.hw_version));
|
|
|
|
}
|
2014-09-25 09:16:46 +00:00
|
|
|
}
|
2020-02-12 21:44:20 +00:00
|
|
|
if (!alen) {
|
|
|
|
alen = scnprintf(
|
|
|
|
eiter->a.hw_version, sizeof(eiter->a.hw_version),
|
|
|
|
"HW:%s", ha->adapter_id);
|
|
|
|
}
|
|
|
|
alen += FDMI_ATTR_ALIGNMENT(alen);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20a5,
|
|
|
|
"HARDWARE VERSION = %s.\n", eiter->a.hw_version);
|
2005-08-27 02:08:30 +00:00
|
|
|
/* Driver version. */
|
2014-09-25 09:16:46 +00:00
|
|
|
eiter = entries + size;
|
2015-07-09 14:24:08 +00:00
|
|
|
eiter->type = cpu_to_be16(FDMI_HBA_DRIVER_VERSION);
|
2020-02-12 21:44:20 +00:00
|
|
|
alen = scnprintf(
|
|
|
|
eiter->a.driver_version, sizeof(eiter->a.driver_version),
|
|
|
|
"%s", qla2x00_version_str);
|
|
|
|
alen += FDMI_ATTR_ALIGNMENT(alen);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20a6,
|
|
|
|
"DRIVER VERSION = %s.\n", eiter->a.driver_version);
|
2005-08-27 02:08:30 +00:00
|
|
|
/* Option ROM version. */
|
2014-09-25 09:16:46 +00:00
|
|
|
eiter = entries + size;
|
2015-07-09 14:24:08 +00:00
|
|
|
eiter->type = cpu_to_be16(FDMI_HBA_OPTION_ROM_VERSION);
|
2020-02-12 21:44:20 +00:00
|
|
|
alen = scnprintf(
|
|
|
|
eiter->a.orom_version, sizeof(eiter->a.orom_version),
|
|
|
|
"%d.%02d", ha->bios_revision[1], ha->bios_revision[0]);
|
|
|
|
alen += FDMI_ATTR_ALIGNMENT(alen);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
2005-08-27 02:08:30 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20a7,
|
|
|
|
"OPTROM VERSION = %d.%02d.\n",
|
|
|
|
eiter->a.orom_version[1], eiter->a.orom_version[0]);
|
2005-08-27 02:08:30 +00:00
|
|
|
/* Firmware version */
|
2014-09-25 09:16:46 +00:00
|
|
|
eiter = entries + size;
|
2015-07-09 14:24:08 +00:00
|
|
|
eiter->type = cpu_to_be16(FDMI_HBA_FIRMWARE_VERSION);
|
2014-09-25 09:16:46 +00:00
|
|
|
ha->isp_ops->fw_version_str(vha, eiter->a.fw_version,
|
|
|
|
sizeof(eiter->a.fw_version));
|
2020-02-12 21:44:20 +00:00
|
|
|
alen += FDMI_ATTR_ALIGNMENT(alen);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20a8,
|
|
|
|
"FIRMWARE VERSION = %s.\n", eiter->a.fw_version);
|
|
|
|
if (callopt == CALLOPT_FDMI1)
|
|
|
|
goto done;
|
|
|
|
/* OS Name and Version */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_HBA_OS_NAME_AND_VERSION);
|
|
|
|
alen = 0;
|
|
|
|
if (p_sysid) {
|
|
|
|
alen = scnprintf(
|
|
|
|
eiter->a.os_version, sizeof(eiter->a.os_version),
|
|
|
|
"%s %s %s",
|
|
|
|
p_sysid->sysname, p_sysid->release, p_sysid->machine);
|
2005-08-27 02:08:30 +00:00
|
|
|
}
|
2020-02-12 21:44:20 +00:00
|
|
|
if (!alen) {
|
|
|
|
alen = scnprintf(
|
|
|
|
eiter->a.os_version, sizeof(eiter->a.os_version),
|
|
|
|
"%s %s",
|
|
|
|
"Linux", fc_host_system_hostname(vha->host));
|
|
|
|
}
|
|
|
|
alen += FDMI_ATTR_ALIGNMENT(alen);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20a9,
|
|
|
|
"OS VERSION = %s.\n", eiter->a.os_version);
|
|
|
|
/* MAX CT Payload Length */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_HBA_MAXIMUM_CT_PAYLOAD_LENGTH);
|
|
|
|
eiter->a.max_ct_len = cpu_to_be32(le16_to_cpu(IS_FWI2_CAPABLE(ha) ?
|
|
|
|
icb24->frame_payload_size : ha->init_cb->frame_payload_size));
|
|
|
|
alen = sizeof(eiter->a.max_ct_len);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20aa,
|
|
|
|
"CT PAYLOAD LENGTH = 0x%x.\n", be32_to_cpu(eiter->a.max_ct_len));
|
|
|
|
/* Node Sybolic Name */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_HBA_NODE_SYMBOLIC_NAME);
|
|
|
|
alen = qla2x00_get_sym_node_name(vha, eiter->a.sym_name,
|
|
|
|
sizeof(eiter->a.sym_name));
|
|
|
|
alen += FDMI_ATTR_ALIGNMENT(alen);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20ab,
|
|
|
|
"SYMBOLIC NAME = %s.\n", eiter->a.sym_name);
|
|
|
|
/* Vendor Specific information */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_HBA_VENDOR_SPECIFIC_INFO);
|
|
|
|
eiter->a.vendor_specific_info = cpu_to_be32(PCI_VENDOR_ID_QLOGIC);
|
|
|
|
alen = sizeof(eiter->a.vendor_specific_info);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20ac,
|
|
|
|
"VENDOR SPECIFIC INFO = 0x%x.\n",
|
|
|
|
be32_to_cpu(eiter->a.vendor_specific_info));
|
|
|
|
/* Num Ports */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_HBA_NUM_PORTS);
|
|
|
|
eiter->a.num_ports = cpu_to_be32(1);
|
|
|
|
alen = sizeof(eiter->a.num_ports);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20ad,
|
|
|
|
"PORT COUNT = %x.\n", be32_to_cpu(eiter->a.num_ports));
|
|
|
|
/* Fabric Name */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_HBA_FABRIC_NAME);
|
|
|
|
memcpy(eiter->a.fabric_name, vha->fabric_node_name,
|
|
|
|
sizeof(eiter->a.fabric_name));
|
|
|
|
alen = sizeof(eiter->a.fabric_name);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20ae,
|
|
|
|
"FABRIC NAME = %016llx.\n", wwn_to_u64(eiter->a.fabric_name));
|
|
|
|
/* BIOS Version */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_HBA_BOOT_BIOS_NAME);
|
|
|
|
alen = scnprintf(
|
|
|
|
eiter->a.bios_name, sizeof(eiter->a.bios_name),
|
|
|
|
"BIOS %d.%02d", ha->bios_revision[1], ha->bios_revision[0]);
|
|
|
|
alen += FDMI_ATTR_ALIGNMENT(alen);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20af,
|
|
|
|
"BIOS NAME = %s\n", eiter->a.bios_name);
|
|
|
|
/* Vendor Identifier */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_HBA_VENDOR_IDENTIFIER);
|
|
|
|
alen = scnprintf(
|
|
|
|
eiter->a.vendor_identifier, sizeof(eiter->a.vendor_identifier),
|
|
|
|
"%s", "QLGC");
|
|
|
|
alen += FDMI_ATTR_ALIGNMENT(alen);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20b0,
|
|
|
|
"VENDOR IDENTIFIER = %s.\n", eiter->a.vendor_identifier);
|
|
|
|
done:
|
|
|
|
return size;
|
2005-08-27 02:08:30 +00:00
|
|
|
}
|
|
|
|
|
2014-09-25 09:16:46 +00:00
|
|
|
/**
|
2020-02-12 21:44:20 +00:00
|
|
|
* qla2x00_port_attributes() perform Port attributes registration
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2020-02-12 21:44:20 +00:00
|
|
|
* @entries: number of entries to use
|
|
|
|
* @callopt: Option to issue extended or standard FDMI
|
|
|
|
* command parameter
|
2014-09-25 09:16:46 +00:00
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
2020-02-12 21:44:20 +00:00
|
|
|
static unsigned long
|
|
|
|
qla2x00_port_attributes(scsi_qla_host_t *vha, void *entries,
|
|
|
|
unsigned int callopt)
|
2014-09-25 09:16:46 +00:00
|
|
|
{
|
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2020-02-12 21:44:20 +00:00
|
|
|
struct init_cb_24xx *icb24 = (void *)ha->init_cb;
|
|
|
|
struct new_utsname *p_sysid = utsname();
|
|
|
|
char *hostname = p_sysid ?
|
|
|
|
p_sysid->nodename : fc_host_system_hostname(vha->host);
|
2014-09-25 09:16:46 +00:00
|
|
|
struct ct_fdmi_port_attr *eiter;
|
2020-02-12 21:44:20 +00:00
|
|
|
uint16_t alen;
|
|
|
|
unsigned long size = 0;
|
2014-09-25 09:16:46 +00:00
|
|
|
|
|
|
|
/* FC4 types. */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_PORT_FC4_TYPES);
|
2020-02-12 21:44:20 +00:00
|
|
|
eiter->a.fc4_types[0] = 0x00;
|
|
|
|
eiter->a.fc4_types[1] = 0x00;
|
2014-09-25 09:16:46 +00:00
|
|
|
eiter->a.fc4_types[2] = 0x01;
|
2020-02-12 21:44:20 +00:00
|
|
|
eiter->a.fc4_types[3] = 0x00;
|
|
|
|
alen = sizeof(eiter->a.fc4_types);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20c0,
|
|
|
|
"FC4 TYPES = %016llx.\n", *(uint64_t *)eiter->a.fc4_types);
|
|
|
|
if (vha->flags.nvme_enabled) {
|
|
|
|
eiter->a.fc4_types[6] = 1; /* NVMe type 28h */
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x211f,
|
|
|
|
"NVME FC4 Type = %02x 0x0 0x0 0x0 0x0 0x0.\n",
|
|
|
|
eiter->a.fc4_types[6]);
|
|
|
|
}
|
2014-09-25 09:16:46 +00:00
|
|
|
/* Supported speed. */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_PORT_SUPPORT_SPEED);
|
2020-02-12 21:44:20 +00:00
|
|
|
eiter->a.sup_speed = cpu_to_be32(
|
|
|
|
qla25xx_fdmi_port_speed_capability(ha));
|
|
|
|
alen = sizeof(eiter->a.sup_speed);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20c1,
|
|
|
|
"SUPPORTED SPEED = %x.\n", be32_to_cpu(eiter->a.sup_speed));
|
2014-09-25 09:16:46 +00:00
|
|
|
/* Current speed. */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_PORT_CURRENT_SPEED);
|
2020-02-12 21:44:20 +00:00
|
|
|
eiter->a.cur_speed = cpu_to_be32(
|
|
|
|
qla25xx_fdmi_port_speed_currently(ha));
|
|
|
|
alen = sizeof(eiter->a.cur_speed);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20c2,
|
|
|
|
"CURRENT SPEED = %x.\n", be32_to_cpu(eiter->a.cur_speed));
|
2014-09-25 09:16:46 +00:00
|
|
|
/* Max frame size. */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_PORT_MAX_FRAME_SIZE);
|
2020-02-12 21:44:20 +00:00
|
|
|
eiter->a.max_frame_size = cpu_to_be32(le16_to_cpu(IS_FWI2_CAPABLE(ha) ?
|
|
|
|
icb24->frame_payload_size : ha->init_cb->frame_payload_size));
|
|
|
|
alen = sizeof(eiter->a.max_frame_size);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20c3,
|
|
|
|
"MAX FRAME SIZE = %x.\n", be32_to_cpu(eiter->a.max_frame_size));
|
2014-09-25 09:16:46 +00:00
|
|
|
/* OS device name. */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_PORT_OS_DEVICE_NAME);
|
2020-02-12 21:44:20 +00:00
|
|
|
alen = scnprintf(
|
|
|
|
eiter->a.os_dev_name, sizeof(eiter->a.os_dev_name),
|
|
|
|
"%s:host%lu", QLA2XXX_DRIVER_NAME, vha->host_no);
|
|
|
|
alen += FDMI_ATTR_ALIGNMENT(alen);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20c4,
|
|
|
|
"OS DEVICE NAME = %s.\n", eiter->a.os_dev_name);
|
2014-09-25 09:16:46 +00:00
|
|
|
/* Hostname. */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_PORT_HOST_NAME);
|
2020-02-12 21:44:20 +00:00
|
|
|
if (!*hostname || !strncmp(hostname, "(none)", 6))
|
|
|
|
hostname = "Linux-default";
|
|
|
|
alen = scnprintf(
|
|
|
|
eiter->a.host_name, sizeof(eiter->a.host_name),
|
|
|
|
"%s", hostname);
|
|
|
|
alen += FDMI_ATTR_ALIGNMENT(alen);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20c5,
|
|
|
|
"HOSTNAME = %s.\n", eiter->a.host_name);
|
2014-09-25 09:16:46 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
if (callopt == CALLOPT_FDMI1)
|
|
|
|
goto done;
|
2014-09-25 09:16:46 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
/* Node Name */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_PORT_NODE_NAME);
|
|
|
|
memcpy(eiter->a.node_name, vha->node_name, sizeof(eiter->a.node_name));
|
|
|
|
alen = sizeof(eiter->a.node_name);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20c6,
|
|
|
|
"NODENAME = %016llx.\n", wwn_to_u64(eiter->a.node_name));
|
2014-09-25 09:16:46 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
/* Port Name */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_PORT_NAME);
|
|
|
|
memcpy(eiter->a.port_name, vha->port_name, sizeof(eiter->a.port_name));
|
|
|
|
alen = sizeof(eiter->a.port_name);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20c7,
|
|
|
|
"PORTNAME = %016llx.\n", wwn_to_u64(eiter->a.port_name));
|
2014-09-25 09:16:46 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
/* Port Symbolic Name */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_PORT_SYM_NAME);
|
|
|
|
alen = qla2x00_get_sym_node_name(vha, eiter->a.port_sym_name,
|
|
|
|
sizeof(eiter->a.port_sym_name));
|
|
|
|
alen += FDMI_ATTR_ALIGNMENT(alen);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20c8,
|
|
|
|
"PORT SYMBOLIC NAME = %s\n", eiter->a.port_sym_name);
|
2014-09-25 09:16:46 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
/* Port Type */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_PORT_TYPE);
|
|
|
|
eiter->a.port_type = cpu_to_be32(NS_NX_PORT_TYPE);
|
|
|
|
alen = sizeof(eiter->a.port_type);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20c9,
|
|
|
|
"PORT TYPE = %x.\n", be32_to_cpu(eiter->a.port_type));
|
|
|
|
|
|
|
|
/* Supported Class of Service */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_PORT_SUPP_COS);
|
|
|
|
eiter->a.port_supported_cos = cpu_to_be32(FC_CLASS_3);
|
|
|
|
alen = sizeof(eiter->a.port_supported_cos);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20ca,
|
|
|
|
"SUPPORTED COS = %08x\n", be32_to_cpu(eiter->a.port_supported_cos));
|
2014-09-25 09:16:46 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
/* Port Fabric Name */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_PORT_FABRIC_NAME);
|
|
|
|
memcpy(eiter->a.fabric_name, vha->fabric_node_name,
|
|
|
|
sizeof(eiter->a.fabric_name));
|
|
|
|
alen = sizeof(eiter->a.fabric_name);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20cb,
|
|
|
|
"FABRIC NAME = %016llx.\n", wwn_to_u64(eiter->a.fabric_name));
|
|
|
|
|
|
|
|
/* FC4_type */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_PORT_FC4_TYPE);
|
|
|
|
eiter->a.port_fc4_type[0] = 0x00;
|
|
|
|
eiter->a.port_fc4_type[1] = 0x00;
|
|
|
|
eiter->a.port_fc4_type[2] = 0x01;
|
|
|
|
eiter->a.port_fc4_type[3] = 0x00;
|
|
|
|
alen = sizeof(eiter->a.port_fc4_type);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20cc,
|
|
|
|
"PORT ACTIVE FC4 TYPE = %016llx.\n",
|
|
|
|
*(uint64_t *)eiter->a.port_fc4_type);
|
|
|
|
|
|
|
|
/* Port State */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_PORT_STATE);
|
|
|
|
eiter->a.port_state = cpu_to_be32(2);
|
|
|
|
alen = sizeof(eiter->a.port_state);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20cd,
|
|
|
|
"PORT_STATE = %x.\n", be32_to_cpu(eiter->a.port_state));
|
|
|
|
|
|
|
|
/* Number of Ports */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_PORT_COUNT);
|
|
|
|
eiter->a.num_ports = cpu_to_be32(1);
|
|
|
|
alen = sizeof(eiter->a.num_ports);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20ce,
|
|
|
|
"PORT COUNT = %x.\n", be32_to_cpu(eiter->a.num_ports));
|
|
|
|
|
|
|
|
/* Port Identifier */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_PORT_IDENTIFIER);
|
|
|
|
eiter->a.port_id = cpu_to_be32(vha->d_id.b24);
|
|
|
|
alen = sizeof(eiter->a.port_id);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20cf,
|
|
|
|
"PORT ID = %x.\n", be32_to_cpu(eiter->a.port_id));
|
|
|
|
|
|
|
|
if (callopt == CALLOPT_FDMI2 || !ql2xsmartsan)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
/* Smart SAN Service Category (Populate Smart SAN Initiator)*/
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_SMARTSAN_SERVICE);
|
|
|
|
alen = scnprintf(
|
|
|
|
eiter->a.smartsan_service, sizeof(eiter->a.smartsan_service),
|
|
|
|
"%s", "Smart SAN Initiator");
|
|
|
|
alen += FDMI_ATTR_ALIGNMENT(alen);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20d0,
|
|
|
|
"SMARTSAN SERVICE CATEGORY = %s.\n", eiter->a.smartsan_service);
|
|
|
|
|
|
|
|
/* Smart SAN GUID (NWWN+PWWN) */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_SMARTSAN_GUID);
|
|
|
|
memcpy(eiter->a.smartsan_guid, vha->node_name, WWN_SIZE);
|
|
|
|
memcpy(eiter->a.smartsan_guid + WWN_SIZE, vha->port_name, WWN_SIZE);
|
|
|
|
alen = sizeof(eiter->a.smartsan_guid);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20d1,
|
|
|
|
"Smart SAN GUID = %016llx-%016llx\n",
|
|
|
|
wwn_to_u64(eiter->a.smartsan_guid),
|
|
|
|
wwn_to_u64(eiter->a.smartsan_guid + WWN_SIZE));
|
|
|
|
|
|
|
|
/* Smart SAN Version (populate "Smart SAN Version 1.0") */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_SMARTSAN_VERSION);
|
|
|
|
alen = scnprintf(
|
|
|
|
eiter->a.smartsan_version, sizeof(eiter->a.smartsan_version),
|
|
|
|
"%s", "Smart SAN Version 2.0");
|
|
|
|
alen += FDMI_ATTR_ALIGNMENT(alen);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20d2,
|
|
|
|
"SMARTSAN VERSION = %s\n", eiter->a.smartsan_version);
|
|
|
|
|
|
|
|
/* Smart SAN Product Name (Specify Adapter Model No) */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_SMARTSAN_PROD_NAME);
|
|
|
|
alen = scnprintf(eiter->a.smartsan_prod_name,
|
|
|
|
sizeof(eiter->a.smartsan_prod_name),
|
|
|
|
"ISP%04x", ha->pdev->device);
|
|
|
|
alen += FDMI_ATTR_ALIGNMENT(alen);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20d3,
|
|
|
|
"SMARTSAN PRODUCT NAME = %s\n", eiter->a.smartsan_prod_name);
|
|
|
|
|
|
|
|
/* Smart SAN Port Info (specify: 1=Physical, 2=NPIV, 3=SRIOV) */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_SMARTSAN_PORT_INFO);
|
|
|
|
eiter->a.smartsan_port_info = cpu_to_be32(vha->vp_idx ? 2 : 1);
|
|
|
|
alen = sizeof(eiter->a.smartsan_port_info);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20d4,
|
|
|
|
"SMARTSAN PORT INFO = %x\n", eiter->a.smartsan_port_info);
|
|
|
|
|
|
|
|
/* Smart SAN Security Support */
|
|
|
|
eiter = entries + size;
|
|
|
|
eiter->type = cpu_to_be16(FDMI_SMARTSAN_SECURITY_SUPPORT);
|
|
|
|
eiter->a.smartsan_security_support = cpu_to_be32(1);
|
|
|
|
alen = sizeof(eiter->a.smartsan_security_support);
|
|
|
|
alen += FDMI_ATTR_TYPELEN(eiter);
|
|
|
|
eiter->len = cpu_to_be16(alen);
|
|
|
|
size += alen;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20d6,
|
|
|
|
"SMARTSAN SECURITY SUPPORT = %d\n",
|
|
|
|
be32_to_cpu(eiter->a.smartsan_security_support));
|
|
|
|
|
|
|
|
done:
|
|
|
|
return size;
|
2014-09-25 09:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-02-12 21:44:20 +00:00
|
|
|
* qla2x00_fdmi_rhba() - perform RHBA FDMI registration
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2020-02-12 21:44:20 +00:00
|
|
|
* @callopt: Option to issue FDMI registration
|
2014-09-25 09:16:46 +00:00
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
|
|
|
static int
|
2020-02-12 21:44:20 +00:00
|
|
|
qla2x00_fdmi_rhba(scsi_qla_host_t *vha, unsigned int callopt)
|
2014-09-25 09:16:46 +00:00
|
|
|
{
|
2020-02-12 21:44:20 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
|
|
|
unsigned long size = 0;
|
|
|
|
unsigned int rval, count;
|
2014-09-25 09:16:46 +00:00
|
|
|
ms_iocb_entry_t *ms_pkt;
|
|
|
|
struct ct_sns_req *ct_req;
|
|
|
|
struct ct_sns_rsp *ct_rsp;
|
|
|
|
void *entries;
|
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
count = callopt != CALLOPT_FDMI1 ?
|
|
|
|
FDMI2_HBA_ATTR_COUNT : FDMI1_HBA_ATTR_COUNT;
|
|
|
|
|
|
|
|
size = RHBA_RSP_SIZE;
|
|
|
|
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20e0,
|
|
|
|
"RHBA (callopt=%x count=%u size=%lu).\n", callopt, count, size);
|
|
|
|
|
2014-09-25 09:16:46 +00:00
|
|
|
/* Request size adjusted after CT preparation */
|
2020-02-12 21:44:20 +00:00
|
|
|
ms_pkt = ha->isp_ops->prep_ms_fdmi_iocb(vha, 0, size);
|
2014-09-25 09:16:46 +00:00
|
|
|
|
|
|
|
/* Prepare CT request */
|
2020-02-12 21:44:20 +00:00
|
|
|
ct_req = qla2x00_prep_ct_fdmi_req(ha->ct_sns, RHBA_CMD, size);
|
2014-09-25 09:16:46 +00:00
|
|
|
ct_rsp = &ha->ct_sns->p.rsp;
|
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
/* Prepare FDMI command entries */
|
|
|
|
memcpy(ct_req->req.rhba.hba_identifier, vha->port_name,
|
|
|
|
sizeof(ct_req->req.rhba.hba_identifier));
|
|
|
|
size += sizeof(ct_req->req.rhba.hba_identifier);
|
2014-09-25 09:16:46 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
ct_req->req.rhba.entry_count = cpu_to_be32(1);
|
|
|
|
size += sizeof(ct_req->req.rhba.entry_count);
|
2014-09-25 09:16:46 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
memcpy(ct_req->req.rhba.port_name, vha->port_name,
|
|
|
|
sizeof(ct_req->req.rhba.port_name));
|
|
|
|
size += sizeof(ct_req->req.rhba.port_name);
|
2014-09-25 09:16:46 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
/* Attribute count */
|
|
|
|
ct_req->req.rhba.attrs.count = cpu_to_be32(count);
|
|
|
|
size += sizeof(ct_req->req.rhba.attrs.count);
|
2014-09-25 09:16:46 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
/* Attribute block */
|
|
|
|
entries = &ct_req->req.rhba.attrs.entry;
|
2014-09-25 09:16:46 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
size += qla2x00_hba_attributes(vha, entries, callopt);
|
2014-09-25 09:16:46 +00:00
|
|
|
|
|
|
|
/* Update MS request size. */
|
|
|
|
qla2x00_update_ms_fdmi_iocb(vha, size + 16);
|
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20e1,
|
|
|
|
"RHBA %016llx %016llx.\n",
|
|
|
|
wwn_to_u64(ct_req->req.rhba.hba_identifier),
|
|
|
|
wwn_to_u64(ct_req->req.rhba.port_name));
|
|
|
|
|
|
|
|
ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x20e2,
|
2014-09-25 09:16:46 +00:00
|
|
|
entries, size);
|
|
|
|
|
|
|
|
/* Execute MS IOCB */
|
|
|
|
rval = qla2x00_issue_iocb(vha, ha->ms_iocb, ha->ms_iocb_dma,
|
2020-02-12 21:44:20 +00:00
|
|
|
sizeof(*ha->ms_iocb));
|
|
|
|
if (rval) {
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20e3,
|
|
|
|
"RHBA iocb failed (%d).\n", rval);
|
|
|
|
return rval;
|
|
|
|
}
|
2014-09-25 09:16:46 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
rval = qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp, "RHBA");
|
|
|
|
if (rval) {
|
2014-09-25 09:16:46 +00:00
|
|
|
if (ct_rsp->header.reason_code == CT_REASON_CANNOT_PERFORM &&
|
|
|
|
ct_rsp->header.explanation_code ==
|
|
|
|
CT_EXPL_ALREADY_REGISTERED) {
|
2020-02-12 21:44:20 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20e4,
|
|
|
|
"RHBA already registered.\n");
|
|
|
|
return QLA_ALREADY_REGISTERED;
|
2014-09-25 09:16:46 +00:00
|
|
|
}
|
2020-02-12 21:44:20 +00:00
|
|
|
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20e5,
|
|
|
|
"RHBA failed, CT Reason %#x, CT Explanation %#x\n",
|
|
|
|
ct_rsp->header.reason_code,
|
|
|
|
ct_rsp->header.explanation_code);
|
|
|
|
return rval;
|
2014-09-25 09:16:46 +00:00
|
|
|
}
|
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20e6, "RHBA exiting normally.\n");
|
2014-09-25 09:16:46 +00:00
|
|
|
return rval;
|
|
|
|
}
|
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
|
2005-08-27 02:08:30 +00:00
|
|
|
static int
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_fdmi_dhba(scsi_qla_host_t *vha)
|
2005-08-27 02:08:30 +00:00
|
|
|
{
|
|
|
|
int rval;
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2005-08-27 02:08:30 +00:00
|
|
|
ms_iocb_entry_t *ms_pkt;
|
|
|
|
struct ct_sns_req *ct_req;
|
|
|
|
struct ct_sns_rsp *ct_rsp;
|
|
|
|
/* Issue RPA */
|
|
|
|
/* Prepare common MS IOCB */
|
2008-11-06 18:40:19 +00:00
|
|
|
ms_pkt = ha->isp_ops->prep_ms_fdmi_iocb(vha, DHBA_REQ_SIZE,
|
2005-08-27 02:08:30 +00:00
|
|
|
DHBA_RSP_SIZE);
|
|
|
|
/* Prepare CT request */
|
2013-06-25 15:27:28 +00:00
|
|
|
ct_req = qla2x00_prep_ct_fdmi_req(ha->ct_sns, DHBA_CMD, DHBA_RSP_SIZE);
|
2005-08-27 02:08:30 +00:00
|
|
|
ct_rsp = &ha->ct_sns->p.rsp;
|
|
|
|
/* Prepare FDMI command arguments -- portname. */
|
2008-11-06 18:40:19 +00:00
|
|
|
memcpy(ct_req->req.dhba.port_name, vha->port_name, WWN_SIZE);
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2036,
|
2013-08-27 05:37:27 +00:00
|
|
|
"DHBA portname = %8phN.\n", ct_req->req.dhba.port_name);
|
2005-08-27 02:08:30 +00:00
|
|
|
/* Execute MS IOCB */
|
2008-11-06 18:40:19 +00:00
|
|
|
rval = qla2x00_issue_iocb(vha, ha->ms_iocb, ha->ms_iocb_dma,
|
2005-08-27 02:08:30 +00:00
|
|
|
sizeof(ms_iocb_entry_t));
|
|
|
|
if (rval != QLA_SUCCESS) {
|
|
|
|
/*EMPTY*/
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2037,
|
|
|
|
"DHBA issue IOCB failed (%d).\n", rval);
|
2008-11-06 18:40:19 +00:00
|
|
|
} else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp, "DHBA") !=
|
2005-08-27 02:08:30 +00:00
|
|
|
QLA_SUCCESS) {
|
|
|
|
rval = QLA_FUNCTION_FAILED;
|
|
|
|
} else {
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2038,
|
|
|
|
"DHBA exiting normally.\n");
|
2005-08-27 02:08:30 +00:00
|
|
|
}
|
|
|
|
return rval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-02-12 21:44:20 +00:00
|
|
|
* qla2x00_fdmi_rprt() perform RPRT registration
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2020-02-12 21:44:20 +00:00
|
|
|
* @callopt: Option to issue extended or standard FDMI
|
|
|
|
* command parameter
|
2005-08-27 02:08:30 +00:00
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
|
|
|
static int
|
2020-02-12 21:44:20 +00:00
|
|
|
qla2x00_fdmi_rprt(scsi_qla_host_t *vha, int callopt)
|
2005-08-27 02:08:30 +00:00
|
|
|
{
|
2020-02-12 21:44:20 +00:00
|
|
|
struct scsi_qla_host *base_vha = pci_get_drvdata(vha->hw->pdev);
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2020-02-12 21:44:20 +00:00
|
|
|
ulong size = 0;
|
|
|
|
uint rval, count;
|
2005-08-27 02:08:30 +00:00
|
|
|
ms_iocb_entry_t *ms_pkt;
|
|
|
|
struct ct_sns_req *ct_req;
|
|
|
|
struct ct_sns_rsp *ct_rsp;
|
2014-09-25 09:16:46 +00:00
|
|
|
void *entries;
|
2020-02-12 21:44:20 +00:00
|
|
|
count = callopt == CALLOPT_FDMI2_SMARTSAN && ql2xsmartsan ?
|
|
|
|
FDMI2_SMARTSAN_PORT_ATTR_COUNT :
|
|
|
|
callopt != CALLOPT_FDMI1 ?
|
|
|
|
FDMI2_PORT_ATTR_COUNT : FDMI1_PORT_ATTR_COUNT;
|
|
|
|
|
|
|
|
size = RPRT_RSP_SIZE;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20e8,
|
|
|
|
"RPRT (callopt=%x count=%u size=%lu).\n", callopt, count, size);
|
|
|
|
/* Request size adjusted after CT preparation */
|
|
|
|
ms_pkt = ha->isp_ops->prep_ms_fdmi_iocb(vha, 0, size);
|
2005-08-27 02:08:30 +00:00
|
|
|
/* Prepare CT request */
|
2020-02-12 21:44:20 +00:00
|
|
|
ct_req = qla2x00_prep_ct_fdmi_req(ha->ct_sns, RPRT_CMD, size);
|
2005-08-27 02:08:30 +00:00
|
|
|
ct_rsp = &ha->ct_sns->p.rsp;
|
2020-02-12 21:44:20 +00:00
|
|
|
/* Prepare FDMI command entries */
|
|
|
|
memcpy(ct_req->req.rprt.hba_identifier, base_vha->port_name,
|
|
|
|
sizeof(ct_req->req.rprt.hba_identifier));
|
|
|
|
size += sizeof(ct_req->req.rprt.hba_identifier);
|
|
|
|
memcpy(ct_req->req.rprt.port_name, vha->port_name,
|
|
|
|
sizeof(ct_req->req.rprt.port_name));
|
|
|
|
size += sizeof(ct_req->req.rprt.port_name);
|
|
|
|
/* Attribute count */
|
|
|
|
ct_req->req.rprt.attrs.count = cpu_to_be32(count);
|
|
|
|
size += sizeof(ct_req->req.rprt.attrs.count);
|
|
|
|
/* Attribute block */
|
|
|
|
entries = ct_req->req.rprt.attrs.entry;
|
|
|
|
size += qla2x00_port_attributes(vha, entries, callopt);
|
|
|
|
/* Update MS request size. */
|
|
|
|
qla2x00_update_ms_fdmi_iocb(vha, size + 16);
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20e9,
|
|
|
|
"RPRT %016llx %016llx.\n",
|
|
|
|
wwn_to_u64(ct_req->req.rprt.port_name),
|
|
|
|
wwn_to_u64(ct_req->req.rprt.port_name));
|
|
|
|
ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x20ea,
|
|
|
|
entries, size);
|
|
|
|
/* Execute MS IOCB */
|
|
|
|
rval = qla2x00_issue_iocb(vha, ha->ms_iocb, ha->ms_iocb_dma,
|
|
|
|
sizeof(*ha->ms_iocb));
|
|
|
|
if (rval) {
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20eb,
|
|
|
|
"RPRT iocb failed (%d).\n", rval);
|
|
|
|
return rval;
|
2005-08-27 02:08:30 +00:00
|
|
|
}
|
2020-02-12 21:44:20 +00:00
|
|
|
rval = qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp, "RPRT");
|
|
|
|
if (rval) {
|
|
|
|
if (ct_rsp->header.reason_code == CT_REASON_CANNOT_PERFORM &&
|
|
|
|
ct_rsp->header.explanation_code ==
|
|
|
|
CT_EXPL_ALREADY_REGISTERED) {
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20ec,
|
|
|
|
"RPRT already registered.\n");
|
|
|
|
return QLA_ALREADY_REGISTERED;
|
|
|
|
}
|
2005-08-27 02:08:30 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20ed,
|
|
|
|
"RPRT failed, CT Reason code: %#x, CT Explanation %#x\n",
|
|
|
|
ct_rsp->header.reason_code,
|
|
|
|
ct_rsp->header.explanation_code);
|
|
|
|
return rval;
|
2006-10-02 19:00:45 +00:00
|
|
|
}
|
2020-02-12 21:44:20 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20ee, "RPRT exiting normally.\n");
|
|
|
|
return rval;
|
|
|
|
}
|
2014-09-25 09:16:46 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
/**
|
|
|
|
* qla2x00_fdmi_rpa() - perform RPA registration
|
|
|
|
* @vha: HA context
|
|
|
|
* @callopt: Option to issue FDMI registration
|
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
qla2x00_fdmi_rpa(scsi_qla_host_t *vha, uint callopt)
|
|
|
|
{
|
|
|
|
struct qla_hw_data *ha = vha->hw;
|
|
|
|
ulong size = 0;
|
|
|
|
uint rval, count;
|
|
|
|
ms_iocb_entry_t *ms_pkt;
|
|
|
|
struct ct_sns_req *ct_req;
|
|
|
|
struct ct_sns_rsp *ct_rsp;
|
|
|
|
void *entries;
|
2014-09-25 09:16:46 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
count =
|
|
|
|
callopt == CALLOPT_FDMI2_SMARTSAN && ql2xsmartsan ?
|
|
|
|
FDMI2_SMARTSAN_PORT_ATTR_COUNT :
|
|
|
|
callopt != CALLOPT_FDMI1 ?
|
|
|
|
FDMI2_PORT_ATTR_COUNT : FDMI1_PORT_ATTR_COUNT;
|
2014-09-25 09:16:46 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
size =
|
|
|
|
callopt != CALLOPT_FDMI1 ?
|
|
|
|
SMARTSAN_RPA_RSP_SIZE : RPA_RSP_SIZE;
|
2014-09-25 09:16:46 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20f0,
|
|
|
|
"RPA (callopt=%x count=%u size=%lu).\n", callopt, count, size);
|
2017-06-21 20:48:45 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
/* Request size adjusted after CT preparation */
|
|
|
|
ms_pkt = ha->isp_ops->prep_ms_fdmi_iocb(vha, 0, size);
|
2014-09-25 09:16:46 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
/* Prepare CT request */
|
|
|
|
ct_req = qla2x00_prep_ct_fdmi_req(ha->ct_sns, RPA_CMD, size);
|
|
|
|
ct_rsp = &ha->ct_sns->p.rsp;
|
2014-09-25 09:16:46 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
/* Prepare FDMI command entries. */
|
|
|
|
memcpy(ct_req->req.rpa.port_name, vha->port_name,
|
|
|
|
sizeof(ct_req->req.rpa.port_name));
|
|
|
|
size += sizeof(ct_req->req.rpa.port_name);
|
2014-09-25 09:16:46 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
/* Attribute count */
|
|
|
|
ct_req->req.rpa.attrs.count = cpu_to_be32(count);
|
|
|
|
size += sizeof(ct_req->req.rpa.attrs.count);
|
2014-09-25 09:16:46 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
/* Attribute block */
|
|
|
|
entries = ct_req->req.rpa.attrs.entry;
|
2014-09-25 09:16:46 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
size += qla2x00_port_attributes(vha, entries, callopt);
|
2006-10-02 19:00:45 +00:00
|
|
|
|
2005-08-27 02:08:30 +00:00
|
|
|
/* Update MS request size. */
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_update_ms_fdmi_iocb(vha, size + 16);
|
2005-08-27 02:08:30 +00:00
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20f1,
|
|
|
|
"RPA %016llx.\n", wwn_to_u64(ct_req->req.rpa.port_name));
|
|
|
|
|
|
|
|
ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x20f2,
|
2011-07-14 19:00:13 +00:00
|
|
|
entries, size);
|
2005-08-27 02:08:30 +00:00
|
|
|
|
|
|
|
/* Execute MS IOCB */
|
2008-11-06 18:40:19 +00:00
|
|
|
rval = qla2x00_issue_iocb(vha, ha->ms_iocb, ha->ms_iocb_dma,
|
2020-02-12 21:44:20 +00:00
|
|
|
sizeof(*ha->ms_iocb));
|
|
|
|
if (rval) {
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20f3,
|
|
|
|
"RPA iocb failed (%d).\n", rval);
|
|
|
|
return rval;
|
|
|
|
}
|
|
|
|
|
|
|
|
rval = qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp, "RPA");
|
|
|
|
if (rval) {
|
2014-09-25 09:16:46 +00:00
|
|
|
if (ct_rsp->header.reason_code == CT_REASON_CANNOT_PERFORM &&
|
|
|
|
ct_rsp->header.explanation_code ==
|
|
|
|
CT_EXPL_ALREADY_REGISTERED) {
|
2020-02-12 21:44:20 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20f4,
|
|
|
|
"RPA already registered.\n");
|
|
|
|
return QLA_ALREADY_REGISTERED;
|
2014-09-25 09:16:46 +00:00
|
|
|
}
|
2020-02-12 21:44:20 +00:00
|
|
|
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20f5,
|
|
|
|
"RPA failed, CT Reason code: %#x, CT Explanation %#x\n",
|
|
|
|
ct_rsp->header.reason_code,
|
|
|
|
ct_rsp->header.explanation_code);
|
|
|
|
return rval;
|
2005-08-27 02:08:30 +00:00
|
|
|
}
|
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20f6, "RPA exiting normally.\n");
|
2005-08-27 02:08:30 +00:00
|
|
|
return rval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qla2x00_fdmi_register() -
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2005-08-27 02:08:30 +00:00
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
|
|
|
int
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_fdmi_register(scsi_qla_host_t *vha)
|
2005-08-27 02:08:30 +00:00
|
|
|
{
|
2020-02-12 21:44:20 +00:00
|
|
|
int rval = QLA_SUCCESS;
|
2014-09-25 09:16:46 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2009-07-31 22:09:33 +00:00
|
|
|
|
2013-03-28 12:21:23 +00:00
|
|
|
if (IS_QLA2100(ha) || IS_QLA2200(ha) ||
|
|
|
|
IS_QLAFX00(ha))
|
2020-02-12 21:44:20 +00:00
|
|
|
return rval;
|
2005-08-27 02:08:30 +00:00
|
|
|
|
2008-11-06 18:40:19 +00:00
|
|
|
rval = qla2x00_mgmt_svr_login(vha);
|
2005-08-27 02:08:30 +00:00
|
|
|
if (rval)
|
|
|
|
return rval;
|
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
/* For npiv/vport send rprt only */
|
|
|
|
if (vha->vp_idx) {
|
|
|
|
if (ql2xsmartsan)
|
|
|
|
rval = qla2x00_fdmi_rprt(vha, CALLOPT_FDMI2_SMARTSAN);
|
|
|
|
if (rval || !ql2xsmartsan)
|
|
|
|
rval = qla2x00_fdmi_rprt(vha, CALLOPT_FDMI2);
|
|
|
|
if (rval)
|
|
|
|
rval = qla2x00_fdmi_rprt(vha, CALLOPT_FDMI1);
|
|
|
|
|
|
|
|
return rval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Try fdmi2 first, if fails then try fdmi1 */
|
|
|
|
rval = qla2x00_fdmi_rhba(vha, CALLOPT_FDMI2);
|
2014-09-25 09:16:46 +00:00
|
|
|
if (rval) {
|
|
|
|
if (rval != QLA_ALREADY_REGISTERED)
|
|
|
|
goto try_fdmi;
|
|
|
|
|
|
|
|
rval = qla2x00_fdmi_dhba(vha);
|
|
|
|
if (rval)
|
|
|
|
goto try_fdmi;
|
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
rval = qla2x00_fdmi_rhba(vha, CALLOPT_FDMI2);
|
2014-09-25 09:16:46 +00:00
|
|
|
if (rval)
|
|
|
|
goto try_fdmi;
|
|
|
|
}
|
2020-02-12 21:44:20 +00:00
|
|
|
|
|
|
|
if (ql2xsmartsan)
|
|
|
|
rval = qla2x00_fdmi_rpa(vha, CALLOPT_FDMI2_SMARTSAN);
|
|
|
|
if (rval || !ql2xsmartsan)
|
|
|
|
rval = qla2x00_fdmi_rpa(vha, CALLOPT_FDMI2);
|
2014-09-25 09:16:46 +00:00
|
|
|
if (rval)
|
|
|
|
goto try_fdmi;
|
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
return rval;
|
2014-09-25 09:16:46 +00:00
|
|
|
|
|
|
|
try_fdmi:
|
2020-02-12 21:44:20 +00:00
|
|
|
rval = qla2x00_fdmi_rhba(vha, CALLOPT_FDMI1);
|
2005-08-27 02:08:30 +00:00
|
|
|
if (rval) {
|
|
|
|
if (rval != QLA_ALREADY_REGISTERED)
|
|
|
|
return rval;
|
|
|
|
|
2008-11-06 18:40:19 +00:00
|
|
|
rval = qla2x00_fdmi_dhba(vha);
|
2005-08-27 02:08:30 +00:00
|
|
|
if (rval)
|
|
|
|
return rval;
|
|
|
|
|
2020-02-12 21:44:20 +00:00
|
|
|
rval = qla2x00_fdmi_rhba(vha, CALLOPT_FDMI1);
|
2005-08-27 02:08:30 +00:00
|
|
|
if (rval)
|
|
|
|
return rval;
|
|
|
|
}
|
2020-02-12 21:44:20 +00:00
|
|
|
|
|
|
|
rval = qla2x00_fdmi_rpa(vha, CALLOPT_FDMI1);
|
|
|
|
|
2005-08-27 02:08:30 +00:00
|
|
|
return rval;
|
|
|
|
}
|
2006-10-02 19:00:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* qla2x00_gfpn_id() - SNS Get Fabric Port Name (GFPN_ID) query.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2006-10-02 19:00:43 +00:00
|
|
|
* @list: switch info entries to populate
|
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
|
|
|
int
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_gfpn_id(scsi_qla_host_t *vha, sw_info_t *list)
|
2006-10-02 19:00:43 +00:00
|
|
|
{
|
2012-02-09 19:15:57 +00:00
|
|
|
int rval = QLA_SUCCESS;
|
2006-10-02 19:00:43 +00:00
|
|
|
uint16_t i;
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2006-10-02 19:00:43 +00:00
|
|
|
ms_iocb_entry_t *ms_pkt;
|
|
|
|
struct ct_sns_req *ct_req;
|
|
|
|
struct ct_sns_rsp *ct_rsp;
|
2017-01-20 06:28:00 +00:00
|
|
|
struct ct_arg arg;
|
2006-10-02 19:00:43 +00:00
|
|
|
|
2007-07-19 22:05:57 +00:00
|
|
|
if (!IS_IIDMA_CAPABLE(ha))
|
2006-10-02 19:00:43 +00:00
|
|
|
return QLA_FUNCTION_FAILED;
|
|
|
|
|
2017-01-20 06:28:00 +00:00
|
|
|
arg.iocb = ha->ms_iocb;
|
|
|
|
arg.req_dma = ha->ct_sns_dma;
|
|
|
|
arg.rsp_dma = ha->ct_sns_dma;
|
|
|
|
arg.req_size = GFPN_ID_REQ_SIZE;
|
|
|
|
arg.rsp_size = GFPN_ID_RSP_SIZE;
|
|
|
|
arg.nport_handle = NPH_SNS;
|
|
|
|
|
2012-02-09 19:15:57 +00:00
|
|
|
for (i = 0; i < ha->max_fibre_devices; i++) {
|
2006-10-02 19:00:43 +00:00
|
|
|
/* Issue GFPN_ID */
|
|
|
|
/* Prepare common MS IOCB */
|
2017-01-20 06:28:00 +00:00
|
|
|
ms_pkt = ha->isp_ops->prep_ms_iocb(vha, &arg);
|
2006-10-02 19:00:43 +00:00
|
|
|
|
|
|
|
/* Prepare CT request */
|
2013-06-25 15:27:28 +00:00
|
|
|
ct_req = qla2x00_prep_ct_req(ha->ct_sns, GFPN_ID_CMD,
|
2006-10-02 19:00:43 +00:00
|
|
|
GFPN_ID_RSP_SIZE);
|
|
|
|
ct_rsp = &ha->ct_sns->p.rsp;
|
|
|
|
|
|
|
|
/* Prepare CT arguments -- port_id */
|
2019-08-09 03:01:58 +00:00
|
|
|
ct_req->req.port_id.port_id = port_id_to_be_id(list[i].d_id);
|
2006-10-02 19:00:43 +00:00
|
|
|
|
|
|
|
/* Execute MS IOCB */
|
2008-11-06 18:40:19 +00:00
|
|
|
rval = qla2x00_issue_iocb(vha, ha->ms_iocb, ha->ms_iocb_dma,
|
2006-10-02 19:00:43 +00:00
|
|
|
sizeof(ms_iocb_entry_t));
|
|
|
|
if (rval != QLA_SUCCESS) {
|
|
|
|
/*EMPTY*/
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2023,
|
|
|
|
"GFPN_ID issue IOCB failed (%d).\n", rval);
|
2012-02-09 19:16:00 +00:00
|
|
|
break;
|
2008-11-06 18:40:19 +00:00
|
|
|
} else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp,
|
2006-10-02 19:00:43 +00:00
|
|
|
"GFPN_ID") != QLA_SUCCESS) {
|
|
|
|
rval = QLA_FUNCTION_FAILED;
|
2012-02-09 19:16:00 +00:00
|
|
|
break;
|
2006-10-02 19:00:43 +00:00
|
|
|
} else {
|
|
|
|
/* Save fabric portname */
|
|
|
|
memcpy(list[i].fabric_port_name,
|
|
|
|
ct_rsp->rsp.gfpn_id.port_name, WWN_SIZE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Last device exit. */
|
|
|
|
if (list[i].d_id.b.rsvd_1 != 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (rval);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline struct ct_sns_req *
|
2013-06-25 15:27:28 +00:00
|
|
|
qla24xx_prep_ct_fm_req(struct ct_sns_pkt *p, uint16_t cmd,
|
2006-10-02 19:00:43 +00:00
|
|
|
uint16_t rsp_size)
|
|
|
|
{
|
2013-06-25 15:27:28 +00:00
|
|
|
memset(p, 0, sizeof(struct ct_sns_pkt));
|
2006-10-02 19:00:43 +00:00
|
|
|
|
2013-06-25 15:27:28 +00:00
|
|
|
p->p.req.header.revision = 0x01;
|
|
|
|
p->p.req.header.gs_type = 0xFA;
|
|
|
|
p->p.req.header.gs_subtype = 0x01;
|
|
|
|
p->p.req.command = cpu_to_be16(cmd);
|
|
|
|
p->p.req.max_rsp_size = cpu_to_be16((rsp_size - 16) / 4);
|
2006-10-02 19:00:43 +00:00
|
|
|
|
2013-06-25 15:27:28 +00:00
|
|
|
return &p->p.req;
|
2006-10-02 19:00:43 +00:00
|
|
|
}
|
|
|
|
|
2019-03-12 18:08:14 +00:00
|
|
|
static uint16_t
|
|
|
|
qla2x00_port_speed_capability(uint16_t speed)
|
|
|
|
{
|
|
|
|
switch (speed) {
|
|
|
|
case BIT_15:
|
|
|
|
return PORT_SPEED_1GB;
|
|
|
|
case BIT_14:
|
|
|
|
return PORT_SPEED_2GB;
|
|
|
|
case BIT_13:
|
|
|
|
return PORT_SPEED_4GB;
|
|
|
|
case BIT_12:
|
|
|
|
return PORT_SPEED_10GB;
|
|
|
|
case BIT_11:
|
|
|
|
return PORT_SPEED_8GB;
|
|
|
|
case BIT_10:
|
|
|
|
return PORT_SPEED_16GB;
|
|
|
|
case BIT_8:
|
|
|
|
return PORT_SPEED_32GB;
|
|
|
|
case BIT_7:
|
|
|
|
return PORT_SPEED_64GB;
|
|
|
|
default:
|
|
|
|
return PORT_SPEED_UNKNOWN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-02 19:00:43 +00:00
|
|
|
/**
|
|
|
|
* qla2x00_gpsc() - FCS Get Port Speed Capabilities (GPSC) query.
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2006-10-02 19:00:43 +00:00
|
|
|
* @list: switch info entries to populate
|
|
|
|
*
|
|
|
|
* Returns 0 on success.
|
|
|
|
*/
|
|
|
|
int
|
2008-11-06 18:40:19 +00:00
|
|
|
qla2x00_gpsc(scsi_qla_host_t *vha, sw_info_t *list)
|
2006-10-02 19:00:43 +00:00
|
|
|
{
|
|
|
|
int rval;
|
|
|
|
uint16_t i;
|
2008-11-06 18:40:19 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2017-01-20 06:28:00 +00:00
|
|
|
ms_iocb_entry_t *ms_pkt;
|
2006-10-02 19:00:43 +00:00
|
|
|
struct ct_sns_req *ct_req;
|
|
|
|
struct ct_sns_rsp *ct_rsp;
|
2017-01-20 06:28:00 +00:00
|
|
|
struct ct_arg arg;
|
2006-10-02 19:00:43 +00:00
|
|
|
|
2007-07-19 22:05:57 +00:00
|
|
|
if (!IS_IIDMA_CAPABLE(ha))
|
2006-10-02 19:00:43 +00:00
|
|
|
return QLA_FUNCTION_FAILED;
|
2006-12-14 03:20:28 +00:00
|
|
|
if (!ha->flags.gpsc_supported)
|
|
|
|
return QLA_FUNCTION_FAILED;
|
2006-10-02 19:00:43 +00:00
|
|
|
|
2008-11-06 18:40:19 +00:00
|
|
|
rval = qla2x00_mgmt_svr_login(vha);
|
2006-10-02 19:00:43 +00:00
|
|
|
if (rval)
|
|
|
|
return rval;
|
|
|
|
|
2017-01-20 06:28:00 +00:00
|
|
|
arg.iocb = ha->ms_iocb;
|
|
|
|
arg.req_dma = ha->ct_sns_dma;
|
|
|
|
arg.rsp_dma = ha->ct_sns_dma;
|
|
|
|
arg.req_size = GPSC_REQ_SIZE;
|
|
|
|
arg.rsp_size = GPSC_RSP_SIZE;
|
|
|
|
arg.nport_handle = vha->mgmt_svr_loop_id;
|
|
|
|
|
2012-02-09 19:15:57 +00:00
|
|
|
for (i = 0; i < ha->max_fibre_devices; i++) {
|
2006-10-02 19:00:43 +00:00
|
|
|
/* Issue GFPN_ID */
|
|
|
|
/* Prepare common MS IOCB */
|
2017-01-20 06:28:00 +00:00
|
|
|
ms_pkt = qla24xx_prep_ms_iocb(vha, &arg);
|
2006-10-02 19:00:43 +00:00
|
|
|
|
|
|
|
/* Prepare CT request */
|
2013-06-25 15:27:28 +00:00
|
|
|
ct_req = qla24xx_prep_ct_fm_req(ha->ct_sns, GPSC_CMD,
|
|
|
|
GPSC_RSP_SIZE);
|
2006-10-02 19:00:43 +00:00
|
|
|
ct_rsp = &ha->ct_sns->p.rsp;
|
|
|
|
|
|
|
|
/* Prepare CT arguments -- port_name */
|
|
|
|
memcpy(ct_req->req.gpsc.port_name, list[i].fabric_port_name,
|
|
|
|
WWN_SIZE);
|
|
|
|
|
|
|
|
/* Execute MS IOCB */
|
2008-11-06 18:40:19 +00:00
|
|
|
rval = qla2x00_issue_iocb(vha, ha->ms_iocb, ha->ms_iocb_dma,
|
2006-10-02 19:00:43 +00:00
|
|
|
sizeof(ms_iocb_entry_t));
|
|
|
|
if (rval != QLA_SUCCESS) {
|
|
|
|
/*EMPTY*/
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2059,
|
|
|
|
"GPSC issue IOCB failed (%d).\n", rval);
|
2008-11-06 18:40:19 +00:00
|
|
|
} else if ((rval = qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp,
|
2006-12-14 03:20:28 +00:00
|
|
|
"GPSC")) != QLA_SUCCESS) {
|
|
|
|
/* FM command unsupported? */
|
|
|
|
if (rval == QLA_INVALID_COMMAND &&
|
2008-04-03 20:13:23 +00:00
|
|
|
(ct_rsp->header.reason_code ==
|
|
|
|
CT_REASON_INVALID_COMMAND_CODE ||
|
|
|
|
ct_rsp->header.reason_code ==
|
|
|
|
CT_REASON_COMMAND_UNSUPPORTED)) {
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x205a,
|
|
|
|
"GPSC command unsupported, disabling "
|
|
|
|
"query.\n");
|
2006-12-14 03:20:28 +00:00
|
|
|
ha->flags.gpsc_supported = 0;
|
|
|
|
rval = QLA_FUNCTION_FAILED;
|
|
|
|
break;
|
|
|
|
}
|
2006-10-02 19:00:43 +00:00
|
|
|
rval = QLA_FUNCTION_FAILED;
|
|
|
|
} else {
|
2019-03-12 18:08:14 +00:00
|
|
|
list->fp_speed = qla2x00_port_speed_capability(
|
|
|
|
be16_to_cpu(ct_rsp->rsp.gpsc.speed));
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x205b,
|
|
|
|
"GPSC ext entry - fpn "
|
2013-08-27 05:37:27 +00:00
|
|
|
"%8phN speeds=%04x speed=%04x.\n",
|
|
|
|
list[i].fabric_port_name,
|
2007-08-13 17:13:18 +00:00
|
|
|
be16_to_cpu(ct_rsp->rsp.gpsc.speeds),
|
2011-07-14 19:00:13 +00:00
|
|
|
be16_to_cpu(ct_rsp->rsp.gpsc.speed));
|
2006-10-02 19:00:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Last device exit. */
|
|
|
|
if (list[i].d_id.b.rsvd_1 != 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (rval);
|
|
|
|
}
|
2010-07-23 10:28:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* qla2x00_gff_id() - SNS Get FC-4 Features (GFF_ID) query.
|
|
|
|
*
|
2018-01-24 00:33:51 +00:00
|
|
|
* @vha: HA context
|
2010-07-23 10:28:25 +00:00
|
|
|
* @list: switch info entries to populate
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
qla2x00_gff_id(scsi_qla_host_t *vha, sw_info_t *list)
|
|
|
|
{
|
|
|
|
int rval;
|
|
|
|
uint16_t i;
|
|
|
|
|
|
|
|
ms_iocb_entry_t *ms_pkt;
|
|
|
|
struct ct_sns_req *ct_req;
|
|
|
|
struct ct_sns_rsp *ct_rsp;
|
|
|
|
struct qla_hw_data *ha = vha->hw;
|
2019-09-12 18:09:12 +00:00
|
|
|
uint8_t fcp_scsi_features = 0, nvme_features = 0;
|
2017-01-20 06:28:00 +00:00
|
|
|
struct ct_arg arg;
|
2010-07-23 10:28:25 +00:00
|
|
|
|
2012-02-09 19:15:57 +00:00
|
|
|
for (i = 0; i < ha->max_fibre_devices; i++) {
|
2010-07-23 10:28:25 +00:00
|
|
|
/* Set default FC4 Type as UNKNOWN so the default is to
|
|
|
|
* Process this port */
|
2020-02-26 22:40:08 +00:00
|
|
|
list[i].fc4_type = 0;
|
2010-07-23 10:28:25 +00:00
|
|
|
|
|
|
|
/* Do not attempt GFF_ID if we are not FWI_2 capable */
|
|
|
|
if (!IS_FWI2_CAPABLE(ha))
|
|
|
|
continue;
|
|
|
|
|
2017-01-20 06:28:00 +00:00
|
|
|
arg.iocb = ha->ms_iocb;
|
|
|
|
arg.req_dma = ha->ct_sns_dma;
|
|
|
|
arg.rsp_dma = ha->ct_sns_dma;
|
|
|
|
arg.req_size = GFF_ID_REQ_SIZE;
|
|
|
|
arg.rsp_size = GFF_ID_RSP_SIZE;
|
|
|
|
arg.nport_handle = NPH_SNS;
|
|
|
|
|
2010-07-23 10:28:25 +00:00
|
|
|
/* Prepare common MS IOCB */
|
2017-01-20 06:28:00 +00:00
|
|
|
ms_pkt = ha->isp_ops->prep_ms_iocb(vha, &arg);
|
2010-07-23 10:28:25 +00:00
|
|
|
|
|
|
|
/* Prepare CT request */
|
2013-06-25 15:27:28 +00:00
|
|
|
ct_req = qla2x00_prep_ct_req(ha->ct_sns, GFF_ID_CMD,
|
2010-07-23 10:28:25 +00:00
|
|
|
GFF_ID_RSP_SIZE);
|
|
|
|
ct_rsp = &ha->ct_sns->p.rsp;
|
|
|
|
|
|
|
|
/* Prepare CT arguments -- port_id */
|
2019-08-09 03:01:58 +00:00
|
|
|
ct_req->req.port_id.port_id = port_id_to_be_id(list[i].d_id);
|
2010-07-23 10:28:25 +00:00
|
|
|
|
|
|
|
/* Execute MS IOCB */
|
|
|
|
rval = qla2x00_issue_iocb(vha, ha->ms_iocb, ha->ms_iocb_dma,
|
|
|
|
sizeof(ms_iocb_entry_t));
|
|
|
|
|
|
|
|
if (rval != QLA_SUCCESS) {
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x205c,
|
|
|
|
"GFF_ID issue IOCB failed (%d).\n", rval);
|
2010-07-23 10:28:25 +00:00
|
|
|
} else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp,
|
2011-02-23 23:27:12 +00:00
|
|
|
"GFF_ID") != QLA_SUCCESS) {
|
2011-07-14 19:00:13 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x205d,
|
|
|
|
"GFF_ID IOCB status had a failure status code.\n");
|
2010-07-23 10:28:25 +00:00
|
|
|
} else {
|
|
|
|
fcp_scsi_features =
|
|
|
|
ct_rsp->rsp.gff_id.fc4_features[GFF_FCP_SCSI_OFFSET];
|
|
|
|
fcp_scsi_features &= 0x0f;
|
|
|
|
|
2019-09-12 18:09:12 +00:00
|
|
|
if (fcp_scsi_features) {
|
|
|
|
list[i].fc4_type = FS_FC4TYPE_FCP;
|
|
|
|
list[i].fc4_features = fcp_scsi_features;
|
|
|
|
}
|
2017-06-21 20:48:44 +00:00
|
|
|
|
2019-09-12 18:09:12 +00:00
|
|
|
nvme_features =
|
2017-06-21 20:48:44 +00:00
|
|
|
ct_rsp->rsp.gff_id.fc4_features[GFF_NVME_OFFSET];
|
2019-09-12 18:09:12 +00:00
|
|
|
nvme_features &= 0xf;
|
|
|
|
|
|
|
|
if (nvme_features) {
|
|
|
|
list[i].fc4_type |= FS_FC4TYPE_NVME;
|
|
|
|
list[i].fc4_features = nvme_features;
|
|
|
|
}
|
2010-07-23 10:28:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Last device exit. */
|
|
|
|
if (list[i].d_id.b.rsvd_1 != 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2017-01-20 06:28:00 +00:00
|
|
|
|
|
|
|
int qla24xx_post_gpsc_work(struct scsi_qla_host *vha, fc_port_t *fcport)
|
|
|
|
{
|
|
|
|
struct qla_work_evt *e;
|
|
|
|
|
|
|
|
e = qla2x00_alloc_work(vha, QLA_EVT_GPSC);
|
|
|
|
if (!e)
|
|
|
|
return QLA_FUNCTION_FAILED;
|
|
|
|
|
|
|
|
e->u.fcport.fcport = fcport;
|
|
|
|
return qla2x00_post_work(vha, e);
|
|
|
|
}
|
|
|
|
|
2017-12-28 20:33:26 +00:00
|
|
|
void qla24xx_handle_gpsc_event(scsi_qla_host_t *vha, struct event_arg *ea)
|
|
|
|
{
|
|
|
|
struct fc_port *fcport = ea->fcport;
|
|
|
|
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20d8,
|
2017-12-28 20:33:35 +00:00
|
|
|
"%s %8phC DS %d LS %d rc %d login %d|%d rscn %d|%d lid %d\n",
|
2017-12-28 20:33:26 +00:00
|
|
|
__func__, fcport->port_name, fcport->disc_state,
|
2017-12-28 20:33:35 +00:00
|
|
|
fcport->fw_login_state, ea->rc, ea->sp->gen2, fcport->login_gen,
|
|
|
|
ea->sp->gen2, fcport->rscn_gen|ea->sp->gen1, fcport->loop_id);
|
2017-12-28 20:33:26 +00:00
|
|
|
|
|
|
|
if (fcport->disc_state == DSC_DELETE_PEND)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (ea->sp->gen2 != fcport->login_gen) {
|
|
|
|
/* target side must have changed it. */
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20d3,
|
2017-12-28 20:33:35 +00:00
|
|
|
"%s %8phC generation changed\n",
|
|
|
|
__func__, fcport->port_name);
|
2017-12-28 20:33:26 +00:00
|
|
|
return;
|
|
|
|
} else if (ea->sp->gen1 != fcport->rscn_gen) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-05-01 16:01:48 +00:00
|
|
|
qla_post_iidma_work(vha, fcport);
|
2017-12-28 20:33:26 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 03:02:04 +00:00
|
|
|
static void qla24xx_async_gpsc_sp_done(srb_t *sp, int res)
|
2017-01-20 06:28:00 +00:00
|
|
|
{
|
2017-01-20 06:28:04 +00:00
|
|
|
struct scsi_qla_host *vha = sp->vha;
|
2017-01-20 06:28:00 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
|
|
|
fc_port_t *fcport = sp->fcport;
|
|
|
|
struct ct_sns_rsp *ct_rsp;
|
|
|
|
struct event_arg ea;
|
|
|
|
|
|
|
|
ct_rsp = &fcport->ct_desc.ct_sns->p.rsp;
|
|
|
|
|
2017-06-02 16:12:01 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2053,
|
2017-01-20 06:28:00 +00:00
|
|
|
"Async done-%s res %x, WWPN %8phC \n",
|
|
|
|
sp->name, res, fcport->port_name);
|
|
|
|
|
2019-04-02 21:24:22 +00:00
|
|
|
fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE);
|
|
|
|
|
2018-09-27 05:05:17 +00:00
|
|
|
if (res == QLA_FUNCTION_TIMEOUT)
|
2019-11-05 15:06:52 +00:00
|
|
|
goto done;
|
2018-09-27 05:05:17 +00:00
|
|
|
|
2017-01-20 06:28:00 +00:00
|
|
|
if (res == (DID_ERROR << 16)) {
|
|
|
|
/* entry status error */
|
|
|
|
goto done;
|
|
|
|
} else if (res) {
|
|
|
|
if ((ct_rsp->header.reason_code ==
|
|
|
|
CT_REASON_INVALID_COMMAND_CODE) ||
|
|
|
|
(ct_rsp->header.reason_code ==
|
2017-06-02 16:12:01 +00:00
|
|
|
CT_REASON_COMMAND_UNSUPPORTED)) {
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2019,
|
|
|
|
"GPSC command unsupported, disabling query.\n");
|
2017-01-20 06:28:00 +00:00
|
|
|
ha->flags.gpsc_supported = 0;
|
2018-08-31 18:24:36 +00:00
|
|
|
goto done;
|
2017-01-20 06:28:00 +00:00
|
|
|
}
|
|
|
|
} else {
|
2019-03-12 18:08:14 +00:00
|
|
|
fcport->fp_speed = qla2x00_port_speed_capability(
|
|
|
|
be16_to_cpu(ct_rsp->rsp.gpsc.speed));
|
2017-01-20 06:28:00 +00:00
|
|
|
|
2017-06-02 16:12:01 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2054,
|
|
|
|
"Async-%s OUT WWPN %8phC speeds=%04x speed=%04x.\n",
|
|
|
|
sp->name, fcport->fabric_port_name,
|
|
|
|
be16_to_cpu(ct_rsp->rsp.gpsc.speeds),
|
|
|
|
be16_to_cpu(ct_rsp->rsp.gpsc.speed));
|
2017-01-20 06:28:00 +00:00
|
|
|
}
|
|
|
|
memset(&ea, 0, sizeof(ea));
|
|
|
|
ea.rc = res;
|
|
|
|
ea.fcport = fcport;
|
2017-12-28 20:33:26 +00:00
|
|
|
ea.sp = sp;
|
2019-08-09 03:02:15 +00:00
|
|
|
qla24xx_handle_gpsc_event(vha, &ea);
|
2017-01-20 06:28:00 +00:00
|
|
|
|
2018-08-31 18:24:36 +00:00
|
|
|
done:
|
2017-01-20 06:28:04 +00:00
|
|
|
sp->free(sp);
|
2017-01-20 06:28:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int qla24xx_async_gpsc(scsi_qla_host_t *vha, fc_port_t *fcport)
|
|
|
|
{
|
|
|
|
int rval = QLA_FUNCTION_FAILED;
|
|
|
|
struct ct_sns_req *ct_req;
|
|
|
|
srb_t *sp;
|
|
|
|
|
2017-12-28 20:33:40 +00:00
|
|
|
if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT))
|
|
|
|
return rval;
|
2017-01-20 06:28:00 +00:00
|
|
|
|
|
|
|
sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL);
|
|
|
|
if (!sp)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
sp->type = SRB_CT_PTHRU_CMD;
|
|
|
|
sp->name = "gpsc";
|
|
|
|
sp->gen1 = fcport->rscn_gen;
|
|
|
|
sp->gen2 = fcport->login_gen;
|
|
|
|
|
|
|
|
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2);
|
|
|
|
|
|
|
|
/* CT_IU preamble */
|
|
|
|
ct_req = qla24xx_prep_ct_fm_req(fcport->ct_desc.ct_sns, GPSC_CMD,
|
|
|
|
GPSC_RSP_SIZE);
|
|
|
|
|
|
|
|
/* GPSC req */
|
2017-08-23 22:05:06 +00:00
|
|
|
memcpy(ct_req->req.gpsc.port_name, fcport->fabric_port_name,
|
2017-01-20 06:28:00 +00:00
|
|
|
WWN_SIZE);
|
|
|
|
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req = fcport->ct_desc.ct_sns;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_dma = fcport->ct_desc.ct_sns_dma;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp = fcport->ct_desc.ct_sns;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_dma = fcport->ct_desc.ct_sns_dma;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_size = GPSC_REQ_SIZE;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_size = GPSC_RSP_SIZE;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.nport_handle = vha->mgmt_svr_loop_id;
|
|
|
|
|
|
|
|
sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout;
|
|
|
|
sp->done = qla24xx_async_gpsc_sp_done;
|
|
|
|
|
2017-06-02 16:12:01 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x205e,
|
|
|
|
"Async-%s %8phC hdl=%x loopid=%x portid=%02x%02x%02x.\n",
|
|
|
|
sp->name, fcport->port_name, sp->handle,
|
|
|
|
fcport->loop_id, fcport->d_id.b.domain,
|
|
|
|
fcport->d_id.b.area, fcport->d_id.b.al_pa);
|
2018-09-27 05:05:18 +00:00
|
|
|
|
|
|
|
rval = qla2x00_start_sp(sp);
|
|
|
|
if (rval != QLA_SUCCESS)
|
|
|
|
goto done_free_sp;
|
2017-01-20 06:28:00 +00:00
|
|
|
return rval;
|
|
|
|
|
|
|
|
done_free_sp:
|
2017-01-20 06:28:04 +00:00
|
|
|
sp->free(sp);
|
2017-12-28 20:33:40 +00:00
|
|
|
done:
|
2017-01-20 06:28:00 +00:00
|
|
|
return rval;
|
|
|
|
}
|
|
|
|
|
|
|
|
int qla24xx_post_gpnid_work(struct scsi_qla_host *vha, port_id_t *id)
|
|
|
|
{
|
|
|
|
struct qla_work_evt *e;
|
|
|
|
|
2019-09-12 18:09:08 +00:00
|
|
|
if (test_bit(UNLOADING, &vha->dpc_flags) ||
|
|
|
|
(vha->vp_idx && test_bit(VPORT_DELETE, &vha->dpc_flags)))
|
2017-01-20 06:28:00 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
e = qla2x00_alloc_work(vha, QLA_EVT_GPNID);
|
|
|
|
if (!e)
|
|
|
|
return QLA_FUNCTION_FAILED;
|
|
|
|
|
|
|
|
e->u.gpnid.id = *id;
|
|
|
|
return qla2x00_post_work(vha, e);
|
|
|
|
}
|
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
void qla24xx_sp_unmap(scsi_qla_host_t *vha, srb_t *sp)
|
2017-01-20 06:28:00 +00:00
|
|
|
{
|
2018-08-02 20:16:57 +00:00
|
|
|
struct srb_iocb *c = &sp->u.iocb_cmd;
|
|
|
|
|
|
|
|
switch (sp->type) {
|
|
|
|
case SRB_ELS_DCMD:
|
2019-08-09 03:02:16 +00:00
|
|
|
qla2x00_els_dcmd2_free(vha, &c->u.els_plogi);
|
2018-08-02 20:16:57 +00:00
|
|
|
break;
|
|
|
|
case SRB_CT_PTHRU_CMD:
|
|
|
|
default:
|
|
|
|
if (sp->u.iocb_cmd.u.ctarg.req) {
|
|
|
|
dma_free_coherent(&vha->hw->pdev->dev,
|
SCSI misc on 20180815
This is mostly updates to the usual drivers: mpt3sas, lpfc, qla2xxx,
hisi_sas, smartpqi, megaraid_sas, arcmsr. In addition, with the
continuing absence of Nic we have target updates for tcmu and target
core (all with reviews and acks). The biggest observable change is
going to be that we're (again) trying to switch to mulitqueue as the
default (a user can still override the setting on the kernel command
line). Other major core stuff is the removal of the remaining
Microchannel drivers, an update of the internal timers and some
reworks of completion and result handling.
Signed-off-by: James E.J. Bottomley <jejb@linux.vnet.ibm.com>
-----BEGIN PGP SIGNATURE-----
iJwEABMIAEQWIQTnYEDbdso9F2cI+arnQslM7pishQUCW3R3niYcamFtZXMuYm90
dG9tbGV5QGhhbnNlbnBhcnRuZXJzaGlwLmNvbQAKCRDnQslM7pishauRAP4yfBKK
dbxF81c/Bxi/Stk16FWkOOrjs4CizwmnMcpM5wD/UmM9o6ebDzaYpZgA8wIl7X/N
o/JckEZZpIp+5NySZNc=
=ggLB
-----END PGP SIGNATURE-----
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI updates from James Bottomley:
"This is mostly updates to the usual drivers: mpt3sas, lpfc, qla2xxx,
hisi_sas, smartpqi, megaraid_sas, arcmsr.
In addition, with the continuing absence of Nic we have target updates
for tcmu and target core (all with reviews and acks).
The biggest observable change is going to be that we're (again) trying
to switch to mulitqueue as the default (a user can still override the
setting on the kernel command line).
Other major core stuff is the removal of the remaining Microchannel
drivers, an update of the internal timers and some reworks of
completion and result handling"
* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (203 commits)
scsi: core: use blk_mq_run_hw_queues in scsi_kick_queue
scsi: ufs: remove unnecessary query(DM) UPIU trace
scsi: qla2xxx: Fix issue reported by static checker for qla2x00_els_dcmd2_sp_done()
scsi: aacraid: Spelling fix in comment
scsi: mpt3sas: Fix calltrace observed while running IO & reset
scsi: aic94xx: fix an error code in aic94xx_init()
scsi: st: remove redundant pointer STbuffer
scsi: qla2xxx: Update driver version to 10.00.00.08-k
scsi: qla2xxx: Migrate NVME N2N handling into state machine
scsi: qla2xxx: Save frame payload size from ICB
scsi: qla2xxx: Fix stalled relogin
scsi: qla2xxx: Fix race between switch cmd completion and timeout
scsi: qla2xxx: Fix Management Server NPort handle reservation logic
scsi: qla2xxx: Flush mailbox commands on chip reset
scsi: qla2xxx: Fix unintended Logout
scsi: qla2xxx: Fix session state stuck in Get Port DB
scsi: qla2xxx: Fix redundant fc_rport registration
scsi: qla2xxx: Silent erroneous message
scsi: qla2xxx: Prevent sysfs access when chip is down
scsi: qla2xxx: Add longer window for chip reset
...
2018-08-16 05:06:26 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.req_allocated_size,
|
2018-08-02 20:16:57 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.req,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_dma);
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sp->u.iocb_cmd.u.ctarg.rsp) {
|
|
|
|
dma_free_coherent(&vha->hw->pdev->dev,
|
SCSI misc on 20180815
This is mostly updates to the usual drivers: mpt3sas, lpfc, qla2xxx,
hisi_sas, smartpqi, megaraid_sas, arcmsr. In addition, with the
continuing absence of Nic we have target updates for tcmu and target
core (all with reviews and acks). The biggest observable change is
going to be that we're (again) trying to switch to mulitqueue as the
default (a user can still override the setting on the kernel command
line). Other major core stuff is the removal of the remaining
Microchannel drivers, an update of the internal timers and some
reworks of completion and result handling.
Signed-off-by: James E.J. Bottomley <jejb@linux.vnet.ibm.com>
-----BEGIN PGP SIGNATURE-----
iJwEABMIAEQWIQTnYEDbdso9F2cI+arnQslM7pishQUCW3R3niYcamFtZXMuYm90
dG9tbGV5QGhhbnNlbnBhcnRuZXJzaGlwLmNvbQAKCRDnQslM7pishauRAP4yfBKK
dbxF81c/Bxi/Stk16FWkOOrjs4CizwmnMcpM5wD/UmM9o6ebDzaYpZgA8wIl7X/N
o/JckEZZpIp+5NySZNc=
=ggLB
-----END PGP SIGNATURE-----
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI updates from James Bottomley:
"This is mostly updates to the usual drivers: mpt3sas, lpfc, qla2xxx,
hisi_sas, smartpqi, megaraid_sas, arcmsr.
In addition, with the continuing absence of Nic we have target updates
for tcmu and target core (all with reviews and acks).
The biggest observable change is going to be that we're (again) trying
to switch to mulitqueue as the default (a user can still override the
setting on the kernel command line).
Other major core stuff is the removal of the remaining Microchannel
drivers, an update of the internal timers and some reworks of
completion and result handling"
* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (203 commits)
scsi: core: use blk_mq_run_hw_queues in scsi_kick_queue
scsi: ufs: remove unnecessary query(DM) UPIU trace
scsi: qla2xxx: Fix issue reported by static checker for qla2x00_els_dcmd2_sp_done()
scsi: aacraid: Spelling fix in comment
scsi: mpt3sas: Fix calltrace observed while running IO & reset
scsi: aic94xx: fix an error code in aic94xx_init()
scsi: st: remove redundant pointer STbuffer
scsi: qla2xxx: Update driver version to 10.00.00.08-k
scsi: qla2xxx: Migrate NVME N2N handling into state machine
scsi: qla2xxx: Save frame payload size from ICB
scsi: qla2xxx: Fix stalled relogin
scsi: qla2xxx: Fix race between switch cmd completion and timeout
scsi: qla2xxx: Fix Management Server NPort handle reservation logic
scsi: qla2xxx: Flush mailbox commands on chip reset
scsi: qla2xxx: Fix unintended Logout
scsi: qla2xxx: Fix session state stuck in Get Port DB
scsi: qla2xxx: Fix redundant fc_rport registration
scsi: qla2xxx: Silent erroneous message
scsi: qla2xxx: Prevent sysfs access when chip is down
scsi: qla2xxx: Add longer window for chip reset
...
2018-08-16 05:06:26 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_allocated_size,
|
2018-08-02 20:16:57 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_dma);
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp = NULL;
|
|
|
|
}
|
|
|
|
break;
|
2017-01-20 06:28:00 +00:00
|
|
|
}
|
|
|
|
|
2017-01-20 06:28:04 +00:00
|
|
|
sp->free(sp);
|
2017-01-20 06:28:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void qla24xx_handle_gpnid_event(scsi_qla_host_t *vha, struct event_arg *ea)
|
|
|
|
{
|
2017-12-04 22:45:05 +00:00
|
|
|
fc_port_t *fcport, *conflict, *t;
|
2017-12-28 20:33:15 +00:00
|
|
|
u16 data[2];
|
2017-01-20 06:28:00 +00:00
|
|
|
|
2017-12-04 22:45:05 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xffff,
|
|
|
|
"%s %d port_id: %06x\n",
|
|
|
|
__func__, __LINE__, ea->id.b24);
|
2017-01-20 06:28:00 +00:00
|
|
|
|
2017-12-04 22:45:05 +00:00
|
|
|
if (ea->rc) {
|
|
|
|
/* cable is disconnected */
|
|
|
|
list_for_each_entry_safe(fcport, t, &vha->vp_fcports, list) {
|
2018-08-31 18:24:30 +00:00
|
|
|
if (fcport->d_id.b24 == ea->id.b24)
|
2017-12-04 22:45:05 +00:00
|
|
|
fcport->scan_state = QLA_FCPORT_SCAN;
|
2018-08-31 18:24:30 +00:00
|
|
|
|
|
|
|
qlt_schedule_sess_for_deletion(fcport);
|
2017-06-02 16:11:56 +00:00
|
|
|
}
|
2017-01-20 06:28:00 +00:00
|
|
|
} else {
|
2017-12-04 22:45:05 +00:00
|
|
|
/* cable is connected */
|
|
|
|
fcport = qla2x00_find_fcport_by_wwpn(vha, ea->port_name, 1);
|
|
|
|
if (fcport) {
|
|
|
|
list_for_each_entry_safe(conflict, t, &vha->vp_fcports,
|
|
|
|
list) {
|
|
|
|
if ((conflict->d_id.b24 == ea->id.b24) &&
|
2018-08-31 18:24:30 +00:00
|
|
|
(fcport != conflict))
|
|
|
|
/*
|
|
|
|
* 2 fcports with conflict Nport ID or
|
2017-12-04 22:45:05 +00:00
|
|
|
* an existing fcport is having nport ID
|
|
|
|
* conflict with new fcport.
|
|
|
|
*/
|
|
|
|
|
|
|
|
conflict->scan_state = QLA_FCPORT_SCAN;
|
2018-08-31 18:24:30 +00:00
|
|
|
|
|
|
|
qlt_schedule_sess_for_deletion(conflict);
|
2017-12-04 22:45:05 +00:00
|
|
|
}
|
2017-01-20 06:28:00 +00:00
|
|
|
|
2018-09-04 21:19:17 +00:00
|
|
|
fcport->scan_needed = 0;
|
2017-12-04 22:45:05 +00:00
|
|
|
fcport->rscn_gen++;
|
|
|
|
fcport->scan_state = QLA_FCPORT_FOUND;
|
|
|
|
fcport->flags |= FCF_FABRIC_DEVICE;
|
2018-08-02 20:16:45 +00:00
|
|
|
if (fcport->login_retry == 0) {
|
|
|
|
fcport->login_retry =
|
|
|
|
vha->hw->login_retry_count;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xffff,
|
|
|
|
"Port login retry %8phN, lid 0x%04x cnt=%d.\n",
|
|
|
|
fcport->port_name, fcport->loop_id,
|
|
|
|
fcport->login_retry);
|
|
|
|
}
|
2017-12-04 22:45:05 +00:00
|
|
|
switch (fcport->disc_state) {
|
|
|
|
case DSC_LOGIN_COMPLETE:
|
|
|
|
/* recheck session is still intact. */
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x210d,
|
|
|
|
"%s %d %8phC revalidate session with ADISC\n",
|
|
|
|
__func__, __LINE__, fcport->port_name);
|
2017-12-28 20:33:15 +00:00
|
|
|
data[0] = data[1] = 0;
|
|
|
|
qla2x00_post_async_adisc_work(vha, fcport,
|
|
|
|
data);
|
2017-12-04 22:45:05 +00:00
|
|
|
break;
|
|
|
|
case DSC_DELETED:
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x210d,
|
|
|
|
"%s %d %8phC login\n", __func__, __LINE__,
|
|
|
|
fcport->port_name);
|
|
|
|
fcport->d_id = ea->id;
|
|
|
|
qla24xx_fcport_handle_login(vha, fcport);
|
|
|
|
break;
|
|
|
|
case DSC_DELETE_PEND:
|
|
|
|
fcport->d_id = ea->id;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
fcport->d_id = ea->id;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
list_for_each_entry_safe(conflict, t, &vha->vp_fcports,
|
|
|
|
list) {
|
|
|
|
if (conflict->d_id.b24 == ea->id.b24) {
|
|
|
|
/* 2 fcports with conflict Nport ID or
|
|
|
|
* an existing fcport is having nport ID
|
|
|
|
* conflict with new fcport.
|
|
|
|
*/
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xffff,
|
|
|
|
"%s %d %8phC DS %d\n",
|
|
|
|
__func__, __LINE__,
|
|
|
|
conflict->port_name,
|
|
|
|
conflict->disc_state);
|
|
|
|
|
|
|
|
conflict->scan_state = QLA_FCPORT_SCAN;
|
2018-08-31 18:24:30 +00:00
|
|
|
qlt_schedule_sess_for_deletion(conflict);
|
2017-12-04 22:45:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* create new fcport */
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2065,
|
|
|
|
"%s %d %8phC post new sess\n",
|
|
|
|
__func__, __LINE__, ea->port_name);
|
|
|
|
qla24xx_post_newsess_work(vha, &ea->id,
|
2020-02-26 22:40:08 +00:00
|
|
|
ea->port_name, NULL, NULL, 0);
|
2017-12-04 22:45:05 +00:00
|
|
|
}
|
2017-01-20 06:28:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-09 03:02:04 +00:00
|
|
|
static void qla2x00_async_gpnid_sp_done(srb_t *sp, int res)
|
2017-01-20 06:28:00 +00:00
|
|
|
{
|
2017-01-20 06:28:04 +00:00
|
|
|
struct scsi_qla_host *vha = sp->vha;
|
2017-01-20 06:28:00 +00:00
|
|
|
struct ct_sns_req *ct_req =
|
|
|
|
(struct ct_sns_req *)sp->u.iocb_cmd.u.ctarg.req;
|
|
|
|
struct ct_sns_rsp *ct_rsp =
|
|
|
|
(struct ct_sns_rsp *)sp->u.iocb_cmd.u.ctarg.rsp;
|
|
|
|
struct event_arg ea;
|
|
|
|
struct qla_work_evt *e;
|
2017-12-04 22:45:02 +00:00
|
|
|
unsigned long flags;
|
2017-01-20 06:28:00 +00:00
|
|
|
|
2017-12-04 22:45:00 +00:00
|
|
|
if (res)
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2066,
|
2017-12-04 22:45:02 +00:00
|
|
|
"Async done-%s fail res %x rscn gen %d ID %3phC. %8phC\n",
|
2019-08-09 03:01:58 +00:00
|
|
|
sp->name, res, sp->gen1, &ct_req->req.port_id.port_id,
|
2017-12-04 22:45:00 +00:00
|
|
|
ct_rsp->rsp.gpn_id.port_name);
|
|
|
|
else
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2066,
|
2017-12-04 22:45:02 +00:00
|
|
|
"Async done-%s good rscn gen %d ID %3phC. %8phC\n",
|
2019-08-09 03:01:58 +00:00
|
|
|
sp->name, sp->gen1, &ct_req->req.port_id.port_id,
|
2017-12-04 22:45:00 +00:00
|
|
|
ct_rsp->rsp.gpn_id.port_name);
|
2017-01-20 06:28:00 +00:00
|
|
|
|
|
|
|
memset(&ea, 0, sizeof(ea));
|
|
|
|
memcpy(ea.port_name, ct_rsp->rsp.gpn_id.port_name, WWN_SIZE);
|
|
|
|
ea.sp = sp;
|
2019-08-09 03:01:58 +00:00
|
|
|
ea.id = be_to_port_id(ct_req->req.port_id.port_id);
|
2017-01-20 06:28:00 +00:00
|
|
|
ea.rc = res;
|
|
|
|
|
2017-12-04 22:45:02 +00:00
|
|
|
spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags);
|
|
|
|
list_del(&sp->elem);
|
|
|
|
spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags);
|
|
|
|
|
2017-12-04 22:45:01 +00:00
|
|
|
if (res) {
|
2017-12-04 22:45:05 +00:00
|
|
|
if (res == QLA_FUNCTION_TIMEOUT) {
|
2017-12-04 22:45:01 +00:00
|
|
|
qla24xx_post_gpnid_work(sp->vha, &ea.id);
|
2017-12-04 22:45:05 +00:00
|
|
|
sp->free(sp);
|
|
|
|
return;
|
|
|
|
}
|
2017-12-04 22:45:02 +00:00
|
|
|
} else if (sp->gen1) {
|
2017-12-04 22:45:05 +00:00
|
|
|
/* There was another RSCN for this Nport ID */
|
2017-12-04 22:45:02 +00:00
|
|
|
qla24xx_post_gpnid_work(sp->vha, &ea.id);
|
|
|
|
sp->free(sp);
|
|
|
|
return;
|
2017-12-04 22:45:01 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 03:02:15 +00:00
|
|
|
qla24xx_handle_gpnid_event(vha, &ea);
|
2017-01-20 06:28:00 +00:00
|
|
|
|
2017-12-28 20:33:31 +00:00
|
|
|
e = qla2x00_alloc_work(vha, QLA_EVT_UNMAP);
|
2017-01-20 06:28:00 +00:00
|
|
|
if (!e) {
|
|
|
|
/* please ignore kernel warning. otherwise, we have mem leak. */
|
2019-08-09 03:02:17 +00:00
|
|
|
dma_free_coherent(&vha->hw->pdev->dev,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_allocated_size,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_dma);
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req = NULL;
|
|
|
|
|
|
|
|
dma_free_coherent(&vha->hw->pdev->dev,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_allocated_size,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_dma);
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp = NULL;
|
2017-01-20 06:28:00 +00:00
|
|
|
|
2017-01-20 06:28:04 +00:00
|
|
|
sp->free(sp);
|
2017-01-20 06:28:00 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
e->u.iosb.sp = sp;
|
|
|
|
qla2x00_post_work(vha, e);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get WWPN with Nport ID. */
|
|
|
|
int qla24xx_async_gpnid(scsi_qla_host_t *vha, port_id_t *id)
|
|
|
|
{
|
|
|
|
int rval = QLA_FUNCTION_FAILED;
|
|
|
|
struct ct_sns_req *ct_req;
|
2017-12-04 22:45:02 +00:00
|
|
|
srb_t *sp, *tsp;
|
2017-01-20 06:28:00 +00:00
|
|
|
struct ct_sns_pkt *ct_sns;
|
2017-12-04 22:45:02 +00:00
|
|
|
unsigned long flags;
|
2017-01-20 06:28:00 +00:00
|
|
|
|
|
|
|
if (!vha->flags.online)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
sp = qla2x00_get_sp(vha, NULL, GFP_KERNEL);
|
|
|
|
if (!sp)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
sp->type = SRB_CT_PTHRU_CMD;
|
|
|
|
sp->name = "gpnid";
|
2017-12-04 22:45:02 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.id = *id;
|
|
|
|
sp->gen1 = 0;
|
2017-01-20 06:28:00 +00:00
|
|
|
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2);
|
|
|
|
|
2017-12-04 22:45:02 +00:00
|
|
|
spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags);
|
|
|
|
list_for_each_entry(tsp, &vha->gpnid_list, elem) {
|
|
|
|
if (tsp->u.iocb_cmd.u.ctarg.id.b24 == id->b24) {
|
|
|
|
tsp->gen1++;
|
|
|
|
spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags);
|
|
|
|
sp->free(sp);
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
list_add_tail(&sp->elem, &vha->gpnid_list);
|
|
|
|
spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags);
|
|
|
|
|
2017-01-20 06:28:00 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev,
|
|
|
|
sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.req_dma,
|
|
|
|
GFP_KERNEL);
|
2018-07-02 20:01:58 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.req_allocated_size = sizeof(struct ct_sns_pkt);
|
2017-01-20 06:28:00 +00:00
|
|
|
if (!sp->u.iocb_cmd.u.ctarg.req) {
|
2017-06-02 16:12:01 +00:00
|
|
|
ql_log(ql_log_warn, vha, 0xd041,
|
|
|
|
"Failed to allocate ct_sns request.\n");
|
2017-01-20 06:28:00 +00:00
|
|
|
goto done_free_sp;
|
|
|
|
}
|
|
|
|
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev,
|
|
|
|
sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.rsp_dma,
|
|
|
|
GFP_KERNEL);
|
2018-07-02 20:01:58 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_allocated_size = sizeof(struct ct_sns_pkt);
|
2017-01-20 06:28:00 +00:00
|
|
|
if (!sp->u.iocb_cmd.u.ctarg.rsp) {
|
2017-06-02 16:12:01 +00:00
|
|
|
ql_log(ql_log_warn, vha, 0xd042,
|
|
|
|
"Failed to allocate ct_sns request.\n");
|
2017-01-20 06:28:00 +00:00
|
|
|
goto done_free_sp;
|
|
|
|
}
|
|
|
|
|
|
|
|
ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.rsp;
|
|
|
|
memset(ct_sns, 0, sizeof(*ct_sns));
|
|
|
|
|
|
|
|
ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.req;
|
|
|
|
/* CT_IU preamble */
|
|
|
|
ct_req = qla2x00_prep_ct_req(ct_sns, GPN_ID_CMD, GPN_ID_RSP_SIZE);
|
|
|
|
|
|
|
|
/* GPN_ID req */
|
2019-08-09 03:01:58 +00:00
|
|
|
ct_req->req.port_id.port_id = port_id_to_be_id(*id);
|
2017-01-20 06:28:00 +00:00
|
|
|
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_size = GPN_ID_REQ_SIZE;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_size = GPN_ID_RSP_SIZE;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.nport_handle = NPH_SNS;
|
|
|
|
|
|
|
|
sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout;
|
|
|
|
sp->done = qla2x00_async_gpnid_sp_done;
|
|
|
|
|
2018-09-27 05:05:18 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2067,
|
|
|
|
"Async-%s hdl=%x ID %3phC.\n", sp->name,
|
2019-08-09 03:01:58 +00:00
|
|
|
sp->handle, &ct_req->req.port_id.port_id);
|
2018-09-27 05:05:18 +00:00
|
|
|
|
2017-01-20 06:28:00 +00:00
|
|
|
rval = qla2x00_start_sp(sp);
|
|
|
|
if (rval != QLA_SUCCESS)
|
|
|
|
goto done_free_sp;
|
|
|
|
|
|
|
|
return rval;
|
|
|
|
|
|
|
|
done_free_sp:
|
2018-07-18 21:29:51 +00:00
|
|
|
spin_lock_irqsave(&vha->hw->vport_slock, flags);
|
|
|
|
list_del(&sp->elem);
|
|
|
|
spin_unlock_irqrestore(&vha->hw->vport_slock, flags);
|
|
|
|
|
2017-01-20 06:28:00 +00:00
|
|
|
if (sp->u.iocb_cmd.u.ctarg.req) {
|
|
|
|
dma_free_coherent(&vha->hw->pdev->dev,
|
|
|
|
sizeof(struct ct_sns_pkt),
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_dma);
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req = NULL;
|
|
|
|
}
|
|
|
|
if (sp->u.iocb_cmd.u.ctarg.rsp) {
|
|
|
|
dma_free_coherent(&vha->hw->pdev->dev,
|
|
|
|
sizeof(struct ct_sns_pkt),
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_dma);
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp = NULL;
|
|
|
|
}
|
|
|
|
|
2017-01-20 06:28:04 +00:00
|
|
|
sp->free(sp);
|
2017-01-20 06:28:00 +00:00
|
|
|
done:
|
|
|
|
return rval;
|
|
|
|
}
|
2017-06-21 20:48:44 +00:00
|
|
|
|
|
|
|
void qla24xx_handle_gffid_event(scsi_qla_host_t *vha, struct event_arg *ea)
|
|
|
|
{
|
2019-08-09 03:01:25 +00:00
|
|
|
fc_port_t *fcport = ea->fcport;
|
2017-06-21 20:48:44 +00:00
|
|
|
|
2019-08-09 03:01:25 +00:00
|
|
|
qla24xx_post_gnl_work(vha, fcport);
|
2017-06-21 20:48:44 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 03:02:04 +00:00
|
|
|
void qla24xx_async_gffid_sp_done(srb_t *sp, int res)
|
2017-06-21 20:48:44 +00:00
|
|
|
{
|
2019-08-09 03:01:25 +00:00
|
|
|
struct scsi_qla_host *vha = sp->vha;
|
|
|
|
fc_port_t *fcport = sp->fcport;
|
|
|
|
struct ct_sns_rsp *ct_rsp;
|
|
|
|
struct event_arg ea;
|
2019-09-12 18:09:12 +00:00
|
|
|
uint8_t fc4_scsi_feat;
|
|
|
|
uint8_t fc4_nvme_feat;
|
2019-08-09 03:01:25 +00:00
|
|
|
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2133,
|
|
|
|
"Async done-%s res %x ID %x. %8phC\n",
|
|
|
|
sp->name, res, fcport->d_id.b24, fcport->port_name);
|
2017-06-21 20:48:44 +00:00
|
|
|
|
2019-08-09 03:01:25 +00:00
|
|
|
fcport->flags &= ~FCF_ASYNC_SENT;
|
|
|
|
ct_rsp = &fcport->ct_desc.ct_sns->p.rsp;
|
2019-09-12 18:09:12 +00:00
|
|
|
fc4_scsi_feat = ct_rsp->rsp.gff_id.fc4_features[GFF_FCP_SCSI_OFFSET];
|
|
|
|
fc4_nvme_feat = ct_rsp->rsp.gff_id.fc4_features[GFF_NVME_OFFSET];
|
|
|
|
|
2019-08-09 03:01:25 +00:00
|
|
|
/*
|
|
|
|
* FC-GS-7, 5.2.3.12 FC-4 Features - format
|
|
|
|
* The format of the FC-4 Features object, as defined by the FC-4,
|
|
|
|
* Shall be an array of 4-bit values, one for each type code value
|
|
|
|
*/
|
|
|
|
if (!res) {
|
2019-09-12 18:09:12 +00:00
|
|
|
if (fc4_scsi_feat & 0xf) {
|
2019-08-09 03:01:25 +00:00
|
|
|
/* w1 b00:03 */
|
2019-09-12 18:09:12 +00:00
|
|
|
fcport->fc4_type = FS_FC4TYPE_FCP;
|
|
|
|
fcport->fc4_features = fc4_scsi_feat & 0xf;
|
|
|
|
}
|
2017-06-21 20:48:44 +00:00
|
|
|
|
2019-09-12 18:09:12 +00:00
|
|
|
if (fc4_nvme_feat & 0xf) {
|
2019-08-09 03:01:25 +00:00
|
|
|
/* w5 [00:03]/28h */
|
2019-09-12 18:09:12 +00:00
|
|
|
fcport->fc4_type |= FS_FC4TYPE_NVME;
|
|
|
|
fcport->fc4_features = fc4_nvme_feat & 0xf;
|
2019-08-09 03:01:25 +00:00
|
|
|
}
|
|
|
|
}
|
2017-06-21 20:48:44 +00:00
|
|
|
|
2019-08-09 03:01:25 +00:00
|
|
|
memset(&ea, 0, sizeof(ea));
|
|
|
|
ea.sp = sp;
|
|
|
|
ea.fcport = sp->fcport;
|
|
|
|
ea.rc = res;
|
|
|
|
|
2019-08-09 03:02:15 +00:00
|
|
|
qla24xx_handle_gffid_event(vha, &ea);
|
2019-08-09 03:01:25 +00:00
|
|
|
sp->free(sp);
|
2017-06-21 20:48:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Get FC4 Feature with Nport ID. */
|
|
|
|
int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport)
|
|
|
|
{
|
|
|
|
int rval = QLA_FUNCTION_FAILED;
|
|
|
|
struct ct_sns_req *ct_req;
|
|
|
|
srb_t *sp;
|
|
|
|
|
2017-12-28 20:33:40 +00:00
|
|
|
if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT))
|
2017-06-21 20:48:44 +00:00
|
|
|
return rval;
|
|
|
|
|
|
|
|
sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL);
|
|
|
|
if (!sp)
|
|
|
|
return rval;
|
|
|
|
|
|
|
|
fcport->flags |= FCF_ASYNC_SENT;
|
|
|
|
sp->type = SRB_CT_PTHRU_CMD;
|
|
|
|
sp->name = "gffid";
|
|
|
|
sp->gen1 = fcport->rscn_gen;
|
|
|
|
sp->gen2 = fcport->login_gen;
|
|
|
|
|
2018-03-20 21:36:14 +00:00
|
|
|
sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout;
|
2017-06-21 20:48:44 +00:00
|
|
|
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2);
|
|
|
|
|
|
|
|
/* CT_IU preamble */
|
|
|
|
ct_req = qla2x00_prep_ct_req(fcport->ct_desc.ct_sns, GFF_ID_CMD,
|
|
|
|
GFF_ID_RSP_SIZE);
|
|
|
|
|
|
|
|
ct_req->req.gff_id.port_id[0] = fcport->d_id.b.domain;
|
|
|
|
ct_req->req.gff_id.port_id[1] = fcport->d_id.b.area;
|
|
|
|
ct_req->req.gff_id.port_id[2] = fcport->d_id.b.al_pa;
|
|
|
|
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req = fcport->ct_desc.ct_sns;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_dma = fcport->ct_desc.ct_sns_dma;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp = fcport->ct_desc.ct_sns;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_dma = fcport->ct_desc.ct_sns_dma;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_size = GFF_ID_REQ_SIZE;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_size = GFF_ID_RSP_SIZE;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.nport_handle = NPH_SNS;
|
|
|
|
|
|
|
|
sp->done = qla24xx_async_gffid_sp_done;
|
|
|
|
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x2132,
|
|
|
|
"Async-%s hdl=%x %8phC.\n", sp->name,
|
|
|
|
sp->handle, fcport->port_name);
|
|
|
|
|
2019-02-14 15:52:29 +00:00
|
|
|
rval = qla2x00_start_sp(sp);
|
|
|
|
if (rval != QLA_SUCCESS)
|
|
|
|
goto done_free_sp;
|
|
|
|
|
2017-06-21 20:48:44 +00:00
|
|
|
return rval;
|
|
|
|
done_free_sp:
|
|
|
|
sp->free(sp);
|
|
|
|
fcport->flags &= ~FCF_ASYNC_SENT;
|
|
|
|
return rval;
|
|
|
|
}
|
2017-12-28 20:33:26 +00:00
|
|
|
|
|
|
|
/* GPN_FT + GNN_FT*/
|
|
|
|
static int qla2x00_is_a_vp(scsi_qla_host_t *vha, u64 wwn)
|
|
|
|
{
|
|
|
|
struct qla_hw_data *ha = vha->hw;
|
|
|
|
scsi_qla_host_t *vp;
|
|
|
|
unsigned long flags;
|
|
|
|
u64 twwn;
|
|
|
|
int rc = 0;
|
|
|
|
|
|
|
|
if (!ha->num_vhosts)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
spin_lock_irqsave(&ha->vport_slock, flags);
|
|
|
|
list_for_each_entry(vp, &ha->vp_list, list) {
|
|
|
|
twwn = wwn_to_u64(vp->port_name);
|
|
|
|
if (wwn == twwn) {
|
|
|
|
rc = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
spin_unlock_irqrestore(&ha->vport_slock, flags);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp)
|
|
|
|
{
|
|
|
|
fc_port_t *fcport;
|
|
|
|
u32 i, rc;
|
|
|
|
bool found;
|
2018-09-11 17:18:25 +00:00
|
|
|
struct fab_scan_rp *rp, *trp;
|
2017-12-28 20:33:35 +00:00
|
|
|
unsigned long flags;
|
2018-05-01 16:01:47 +00:00
|
|
|
u8 recheck = 0;
|
2018-09-11 17:18:25 +00:00
|
|
|
u16 dup = 0, dup_cnt = 0;
|
2017-12-28 20:33:26 +00:00
|
|
|
|
2019-09-12 18:09:17 +00:00
|
|
|
ql_dbg(ql_dbg_disc + ql_dbg_verbose, vha, 0xffff,
|
2017-12-28 20:33:26 +00:00
|
|
|
"%s enter\n", __func__);
|
|
|
|
|
|
|
|
if (sp->gen1 != vha->hw->base_qpair->chip_reset) {
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xffff,
|
|
|
|
"%s scan stop due to chip reset %x/%x\n",
|
|
|
|
sp->name, sp->gen1, vha->hw->base_qpair->chip_reset);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = sp->rc;
|
|
|
|
if (rc) {
|
2017-12-28 20:33:39 +00:00
|
|
|
vha->scan.scan_retry++;
|
|
|
|
if (vha->scan.scan_retry < MAX_SCAN_RETRIES) {
|
|
|
|
set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
|
|
|
|
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
|
2019-11-22 22:19:24 +00:00
|
|
|
goto out;
|
2017-12-28 20:33:39 +00:00
|
|
|
} else {
|
2019-11-22 22:19:24 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xffff,
|
2019-09-12 18:09:17 +00:00
|
|
|
"%s: Fabric scan failed for %d retries.\n",
|
|
|
|
__func__, vha->scan.scan_retry);
|
2019-11-22 22:19:24 +00:00
|
|
|
/*
|
|
|
|
* Unable to scan any rports. logout loop below
|
|
|
|
* will unregister all sessions.
|
|
|
|
*/
|
|
|
|
list_for_each_entry(fcport, &vha->vp_fcports, list) {
|
|
|
|
if ((fcport->flags & FCF_FABRIC_DEVICE) != 0) {
|
|
|
|
fcport->scan_state = QLA_FCPORT_SCAN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
goto login_logout;
|
2017-12-28 20:33:39 +00:00
|
|
|
}
|
2017-12-28 20:33:26 +00:00
|
|
|
}
|
2017-12-28 20:33:39 +00:00
|
|
|
vha->scan.scan_retry = 0;
|
2017-12-28 20:33:26 +00:00
|
|
|
|
|
|
|
list_for_each_entry(fcport, &vha->vp_fcports, list)
|
|
|
|
fcport->scan_state = QLA_FCPORT_SCAN;
|
|
|
|
|
|
|
|
for (i = 0; i < vha->hw->max_fibre_devices; i++) {
|
|
|
|
u64 wwn;
|
2018-09-11 17:18:25 +00:00
|
|
|
int k;
|
2017-12-28 20:33:26 +00:00
|
|
|
|
|
|
|
rp = &vha->scan.l[i];
|
|
|
|
found = false;
|
|
|
|
|
|
|
|
wwn = wwn_to_u64(rp->port_name);
|
|
|
|
if (wwn == 0)
|
|
|
|
continue;
|
|
|
|
|
2018-09-11 17:18:25 +00:00
|
|
|
/* Remove duplicate NPORT ID entries from switch data base */
|
|
|
|
for (k = i + 1; k < vha->hw->max_fibre_devices; k++) {
|
|
|
|
trp = &vha->scan.l[k];
|
|
|
|
if (rp->id.b24 == trp->id.b24) {
|
|
|
|
dup = 1;
|
|
|
|
dup_cnt++;
|
|
|
|
ql_dbg(ql_dbg_disc + ql_dbg_verbose,
|
|
|
|
vha, 0xffff,
|
|
|
|
"Detected duplicate NPORT ID from switch data base: ID %06x WWN %8phN WWN %8phN\n",
|
|
|
|
rp->id.b24, rp->port_name, trp->port_name);
|
|
|
|
memset(trp, 0, sizeof(*trp));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-28 20:33:26 +00:00
|
|
|
if (!memcmp(rp->port_name, vha->port_name, WWN_SIZE))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* Bypass reserved domain fields. */
|
|
|
|
if ((rp->id.b.domain & 0xf0) == 0xf0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* Bypass virtual ports of the same host. */
|
|
|
|
if (qla2x00_is_a_vp(vha, wwn))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
list_for_each_entry(fcport, &vha->vp_fcports, list) {
|
|
|
|
if (memcmp(rp->port_name, fcport->port_name, WWN_SIZE))
|
|
|
|
continue;
|
|
|
|
fcport->scan_state = QLA_FCPORT_FOUND;
|
2020-02-12 21:44:32 +00:00
|
|
|
fcport->last_rscn_gen = fcport->rscn_gen;
|
2017-12-28 20:33:26 +00:00
|
|
|
found = true;
|
|
|
|
/*
|
|
|
|
* If device was not a fabric device before.
|
|
|
|
*/
|
|
|
|
if ((fcport->flags & FCF_FABRIC_DEVICE) == 0) {
|
|
|
|
qla2x00_clear_loop_id(fcport);
|
|
|
|
fcport->flags |= FCF_FABRIC_DEVICE;
|
2019-08-30 22:24:01 +00:00
|
|
|
} else if (fcport->d_id.b24 != rp->id.b24 ||
|
scsi: qla2xxx: Keep initiator ports after RSCN
The driver performs SCR (state change registration) in all modes including
pure target mode.
For each RSCN, scan_needed flag is set in qla2x00_handle_rscn() for the
port mentioned in the RSCN and fabric rescan is scheduled. During the
rescan, GNN_FT handler, qla24xx_async_gnnft_done() deletes session of the
port that caused the RSCN.
In target mode, the session deletion has an impact on ATIO handler,
qlt_24xx_atio_pkt(). Target responds with SAM STATUS BUSY to I/O incoming
from the deleted session. qlt_handle_cmd_for_atio() and
qlt_handle_task_mgmt() return -EFAULT if they are not able to find session
of the command/TMF, and that results in invocation of qlt_send_busy():
qlt_24xx_atio_pkt_all_vps: qla_target(0): type 6 ox_id 0014
qla_target(0): Unable to send command to target, sending BUSY status
Such response causes command timeout on the initiator. Error handler thread
on the initiator will be spawned to abort the commands:
scsi 23:0:0:0: tag#0 abort scheduled
scsi 23:0:0:0: tag#0 aborting command
qla2xxx [0000:af:00.0]-188c:23: Entered qla24xx_abort_command.
qla2xxx [0000:af:00.0]-801c:23: Abort command issued nexus=23:0:0 -- 0 2003.
Command abort is rejected by target and fails (2003), error handler then
tries to perform DEVICE RESET and TARGET RESET but they're also doomed to
fail because TMFs are ignored for the deleted sessions.
Then initiator makes BUS RESET that resets the link via
qla2x00_full_login_lip(). BUS RESET succeeds and brings initiator port up,
SAN switch detects that and sends RSCN to the target port and it fails
again the same way as described above. It never goes out of the loop.
The change breaks the RSCN loop by keeping initiator sessions mentioned in
RSCN payload in all modes, including dual and pure target mode.
Link: https://lore.kernel.org/r/20200605144435.27023-1-r.bolshakov@yadro.com
Fixes: 2037ce49d30a ("scsi: qla2xxx: Fix stale session")
Cc: Quinn Tran <qutran@marvell.com>
Cc: Arun Easi <aeasi@marvell.com>
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Daniel Wagner <dwagner@suse.de>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: stable@vger.kernel.org # v5.4+
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Shyam Sundar <ssundar@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-05 14:44:37 +00:00
|
|
|
(fcport->scan_needed &&
|
|
|
|
fcport->port_type != FCT_INITIATOR &&
|
|
|
|
fcport->port_type != FCT_NVME_INITIATOR)) {
|
2018-05-01 16:01:46 +00:00
|
|
|
qlt_schedule_sess_for_deletion(fcport);
|
2017-12-28 20:33:26 +00:00
|
|
|
}
|
2018-05-01 16:01:46 +00:00
|
|
|
fcport->d_id.b24 = rp->id.b24;
|
2019-08-30 22:24:01 +00:00
|
|
|
fcport->scan_needed = 0;
|
2017-12-28 20:33:26 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!found) {
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xffff,
|
|
|
|
"%s %d %8phC post new sess\n",
|
|
|
|
__func__, __LINE__, rp->port_name);
|
|
|
|
qla24xx_post_newsess_work(vha, &rp->id, rp->port_name,
|
2018-03-21 06:09:40 +00:00
|
|
|
rp->node_name, NULL, rp->fc4type);
|
2017-12-28 20:33:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-11 17:18:25 +00:00
|
|
|
if (dup) {
|
|
|
|
ql_log(ql_log_warn, vha, 0xffff,
|
|
|
|
"Detected %d duplicate NPORT ID(s) from switch data base\n",
|
|
|
|
dup_cnt);
|
|
|
|
}
|
|
|
|
|
2019-11-22 22:19:24 +00:00
|
|
|
login_logout:
|
2017-12-28 20:33:26 +00:00
|
|
|
/*
|
|
|
|
* Logout all previous fabric dev marked lost, except FCP2 devices.
|
|
|
|
*/
|
|
|
|
list_for_each_entry(fcport, &vha->vp_fcports, list) {
|
2018-05-01 16:01:47 +00:00
|
|
|
if ((fcport->flags & FCF_FABRIC_DEVICE) == 0) {
|
2018-08-31 18:24:29 +00:00
|
|
|
fcport->scan_needed = 0;
|
2017-12-28 20:33:26 +00:00
|
|
|
continue;
|
2018-05-01 16:01:47 +00:00
|
|
|
}
|
2017-12-28 20:33:26 +00:00
|
|
|
|
2017-12-28 20:33:35 +00:00
|
|
|
if (fcport->scan_state != QLA_FCPORT_FOUND) {
|
2020-08-06 11:10:07 +00:00
|
|
|
bool do_delete = false;
|
|
|
|
|
|
|
|
if (fcport->scan_needed &&
|
|
|
|
fcport->disc_state == DSC_LOGIN_PEND) {
|
|
|
|
/* Cable got disconnected after we sent
|
|
|
|
* a login. Do delete to prevent timeout.
|
|
|
|
*/
|
|
|
|
fcport->logout_on_delete = 1;
|
|
|
|
do_delete = true;
|
|
|
|
}
|
|
|
|
|
2018-08-31 18:24:29 +00:00
|
|
|
fcport->scan_needed = 0;
|
2020-08-06 11:10:07 +00:00
|
|
|
if (((qla_dual_mode_enabled(vha) ||
|
|
|
|
qla_ini_mode_enabled(vha)) &&
|
|
|
|
atomic_read(&fcport->state) == FCS_ONLINE) ||
|
|
|
|
do_delete) {
|
2018-09-04 21:19:16 +00:00
|
|
|
if (fcport->loop_id != FC_NO_LOOP_ID) {
|
|
|
|
if (fcport->flags & FCF_FCP2_DEVICE)
|
|
|
|
fcport->logout_on_delete = 0;
|
2017-12-28 20:33:35 +00:00
|
|
|
|
2017-12-28 20:33:26 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20f0,
|
|
|
|
"%s %d %8phC post del sess\n",
|
|
|
|
__func__, __LINE__,
|
|
|
|
fcport->port_name);
|
|
|
|
|
2017-12-28 20:33:43 +00:00
|
|
|
qlt_schedule_sess_for_deletion(fcport);
|
2017-12-28 20:33:26 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2018-05-01 16:01:47 +00:00
|
|
|
} else {
|
2018-08-31 18:24:29 +00:00
|
|
|
if (fcport->scan_needed ||
|
2018-05-01 16:01:47 +00:00
|
|
|
fcport->disc_state != DSC_LOGIN_COMPLETE) {
|
2018-08-02 20:16:45 +00:00
|
|
|
if (fcport->login_retry == 0) {
|
|
|
|
fcport->login_retry =
|
|
|
|
vha->hw->login_retry_count;
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20a3,
|
|
|
|
"Port login retry %8phN, lid 0x%04x retry cnt=%d.\n",
|
|
|
|
fcport->port_name, fcport->loop_id,
|
|
|
|
fcport->login_retry);
|
|
|
|
}
|
2018-08-31 18:24:29 +00:00
|
|
|
fcport->scan_needed = 0;
|
2018-05-01 16:01:47 +00:00
|
|
|
qla24xx_fcport_handle_login(vha, fcport);
|
|
|
|
}
|
|
|
|
}
|
2017-12-28 20:33:26 +00:00
|
|
|
}
|
|
|
|
|
2018-05-01 16:01:47 +00:00
|
|
|
recheck = 1;
|
2017-12-28 20:33:26 +00:00
|
|
|
out:
|
2017-12-28 20:33:31 +00:00
|
|
|
qla24xx_sp_unmap(vha, sp);
|
2017-12-28 20:33:35 +00:00
|
|
|
spin_lock_irqsave(&vha->work_lock, flags);
|
|
|
|
vha->scan.scan_flags &= ~SF_SCANNING;
|
|
|
|
spin_unlock_irqrestore(&vha->work_lock, flags);
|
2018-05-01 16:01:47 +00:00
|
|
|
|
|
|
|
if (recheck) {
|
|
|
|
list_for_each_entry(fcport, &vha->vp_fcports, list) {
|
2018-08-31 18:24:29 +00:00
|
|
|
if (fcport->scan_needed) {
|
2018-05-01 16:01:47 +00:00
|
|
|
set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
|
|
|
|
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-12-28 20:33:26 +00:00
|
|
|
}
|
|
|
|
|
2018-08-31 18:24:35 +00:00
|
|
|
static int qla2x00_post_gnnft_gpnft_done_work(struct scsi_qla_host *vha,
|
|
|
|
srb_t *sp, int cmd)
|
|
|
|
{
|
|
|
|
struct qla_work_evt *e;
|
|
|
|
|
|
|
|
if (cmd != QLA_EVT_GPNFT_DONE && cmd != QLA_EVT_GNNFT_DONE)
|
|
|
|
return QLA_PARAMETER_ERROR;
|
|
|
|
|
|
|
|
e = qla2x00_alloc_work(vha, cmd);
|
|
|
|
if (!e)
|
|
|
|
return QLA_FUNCTION_FAILED;
|
|
|
|
|
|
|
|
e->u.iosb.sp = sp;
|
|
|
|
|
|
|
|
return qla2x00_post_work(vha, e);
|
|
|
|
}
|
|
|
|
|
2018-09-11 17:18:26 +00:00
|
|
|
static int qla2x00_post_nvme_gpnft_work(struct scsi_qla_host *vha,
|
2018-08-31 18:24:35 +00:00
|
|
|
srb_t *sp, int cmd)
|
|
|
|
{
|
|
|
|
struct qla_work_evt *e;
|
|
|
|
|
|
|
|
if (cmd != QLA_EVT_GPNFT)
|
|
|
|
return QLA_PARAMETER_ERROR;
|
|
|
|
|
|
|
|
e = qla2x00_alloc_work(vha, cmd);
|
|
|
|
if (!e)
|
|
|
|
return QLA_FUNCTION_FAILED;
|
|
|
|
|
|
|
|
e->u.gpnft.fc4_type = FC4_TYPE_NVME;
|
|
|
|
e->u.gpnft.sp = sp;
|
|
|
|
|
|
|
|
return qla2x00_post_work(vha, e);
|
|
|
|
}
|
|
|
|
|
2018-03-21 06:09:40 +00:00
|
|
|
static void qla2x00_find_free_fcp_nvme_slot(struct scsi_qla_host *vha,
|
|
|
|
struct srb *sp)
|
2017-12-28 20:33:26 +00:00
|
|
|
{
|
2018-03-21 06:09:40 +00:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
|
|
|
int num_fibre_dev = ha->max_fibre_devices;
|
2017-12-28 20:33:26 +00:00
|
|
|
struct ct_sns_req *ct_req =
|
|
|
|
(struct ct_sns_req *)sp->u.iocb_cmd.u.ctarg.req;
|
|
|
|
struct ct_sns_gpnft_rsp *ct_rsp =
|
|
|
|
(struct ct_sns_gpnft_rsp *)sp->u.iocb_cmd.u.ctarg.rsp;
|
2018-01-05 15:50:37 +00:00
|
|
|
struct ct_sns_gpn_ft_data *d;
|
2017-12-28 20:33:26 +00:00
|
|
|
struct fab_scan_rp *rp;
|
2018-03-21 06:09:40 +00:00
|
|
|
u16 cmd = be16_to_cpu(ct_req->command);
|
|
|
|
u8 fc4_type = sp->gen2;
|
2017-12-28 20:33:26 +00:00
|
|
|
int i, j, k;
|
2018-03-21 06:09:40 +00:00
|
|
|
port_id_t id;
|
|
|
|
u8 found;
|
|
|
|
u64 wwn;
|
|
|
|
|
|
|
|
j = 0;
|
|
|
|
for (i = 0; i < num_fibre_dev; i++) {
|
|
|
|
d = &ct_rsp->entries[i];
|
|
|
|
|
|
|
|
id.b.rsvd_1 = 0;
|
|
|
|
id.b.domain = d->port_id[0];
|
|
|
|
id.b.area = d->port_id[1];
|
|
|
|
id.b.al_pa = d->port_id[2];
|
|
|
|
wwn = wwn_to_u64(d->port_name);
|
|
|
|
|
|
|
|
if (id.b24 == 0 || wwn == 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (fc4_type == FC4_TYPE_FCP_SCSI) {
|
|
|
|
if (cmd == GPN_FT_CMD) {
|
|
|
|
rp = &vha->scan.l[j];
|
|
|
|
rp->id = id;
|
|
|
|
memcpy(rp->port_name, d->port_name, 8);
|
|
|
|
j++;
|
|
|
|
rp->fc4type = FS_FC4TYPE_FCP;
|
|
|
|
} else {
|
|
|
|
for (k = 0; k < num_fibre_dev; k++) {
|
|
|
|
rp = &vha->scan.l[k];
|
|
|
|
if (id.b24 == rp->id.b24) {
|
|
|
|
memcpy(rp->node_name,
|
|
|
|
d->port_name, 8);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Search if the fibre device supports FC4_TYPE_NVME */
|
|
|
|
if (cmd == GPN_FT_CMD) {
|
|
|
|
found = 0;
|
|
|
|
|
|
|
|
for (k = 0; k < num_fibre_dev; k++) {
|
|
|
|
rp = &vha->scan.l[k];
|
|
|
|
if (!memcmp(rp->port_name,
|
|
|
|
d->port_name, 8)) {
|
|
|
|
/*
|
|
|
|
* Supports FC-NVMe & FCP
|
|
|
|
*/
|
|
|
|
rp->fc4type |= FS_FC4TYPE_NVME;
|
|
|
|
found = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We found new FC-NVMe only port */
|
|
|
|
if (!found) {
|
|
|
|
for (k = 0; k < num_fibre_dev; k++) {
|
|
|
|
rp = &vha->scan.l[k];
|
|
|
|
if (wwn_to_u64(rp->port_name)) {
|
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
rp->id = id;
|
|
|
|
memcpy(rp->port_name,
|
|
|
|
d->port_name, 8);
|
|
|
|
rp->fc4type =
|
|
|
|
FS_FC4TYPE_NVME;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (k = 0; k < num_fibre_dev; k++) {
|
|
|
|
rp = &vha->scan.l[k];
|
|
|
|
if (id.b24 == rp->id.b24) {
|
|
|
|
memcpy(rp->node_name,
|
|
|
|
d->port_name, 8);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-09 03:02:04 +00:00
|
|
|
static void qla2x00_async_gpnft_gnnft_sp_done(srb_t *sp, int res)
|
2018-03-21 06:09:40 +00:00
|
|
|
{
|
|
|
|
struct scsi_qla_host *vha = sp->vha;
|
|
|
|
struct ct_sns_req *ct_req =
|
|
|
|
(struct ct_sns_req *)sp->u.iocb_cmd.u.ctarg.req;
|
2017-12-28 20:33:26 +00:00
|
|
|
u16 cmd = be16_to_cpu(ct_req->command);
|
2018-03-21 06:09:40 +00:00
|
|
|
u8 fc4_type = sp->gen2;
|
|
|
|
unsigned long flags;
|
2018-08-31 18:24:35 +00:00
|
|
|
int rc;
|
2017-12-28 20:33:26 +00:00
|
|
|
|
|
|
|
/* gen2 field is holding the fc4type */
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xffff,
|
|
|
|
"Async done-%s res %x FC4Type %x\n",
|
|
|
|
sp->name, res, sp->gen2);
|
|
|
|
|
2018-09-11 17:18:26 +00:00
|
|
|
del_timer(&sp->u.iocb_cmd.timer);
|
2018-08-31 18:24:35 +00:00
|
|
|
sp->rc = res;
|
2017-12-28 20:33:33 +00:00
|
|
|
if (res) {
|
|
|
|
unsigned long flags;
|
2018-08-31 18:24:35 +00:00
|
|
|
const char *name = sp->name;
|
|
|
|
|
2020-08-06 11:10:04 +00:00
|
|
|
if (res == QLA_OS_TIMER_EXPIRED) {
|
|
|
|
/* switch is ignoring all commands.
|
|
|
|
* This might be a zone disable behavior.
|
|
|
|
* This means we hit 64s timeout.
|
|
|
|
* 22s GPNFT + 44s Abort = 64s
|
|
|
|
*/
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xffff,
|
|
|
|
"%s: Switch Zone check please .\n",
|
|
|
|
name);
|
|
|
|
qla2x00_mark_all_devices_lost(vha);
|
|
|
|
}
|
|
|
|
|
2018-08-31 18:24:35 +00:00
|
|
|
/*
|
|
|
|
* We are in an Interrupt context, queue up this
|
|
|
|
* sp for GNNFT_DONE work. This will allow all
|
|
|
|
* the resource to get freed up.
|
|
|
|
*/
|
|
|
|
rc = qla2x00_post_gnnft_gpnft_done_work(vha, sp,
|
|
|
|
QLA_EVT_GNNFT_DONE);
|
|
|
|
if (rc) {
|
|
|
|
/* Cleanup here to prevent memory leak */
|
|
|
|
qla24xx_sp_unmap(vha, sp);
|
2017-12-28 20:33:33 +00:00
|
|
|
|
2018-09-11 17:18:26 +00:00
|
|
|
spin_lock_irqsave(&vha->work_lock, flags);
|
|
|
|
vha->scan.scan_flags &= ~SF_SCANNING;
|
|
|
|
vha->scan.scan_retry++;
|
|
|
|
spin_unlock_irqrestore(&vha->work_lock, flags);
|
2017-12-28 20:33:39 +00:00
|
|
|
|
2018-09-11 17:18:26 +00:00
|
|
|
if (vha->scan.scan_retry < MAX_SCAN_RETRIES) {
|
|
|
|
set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
|
|
|
|
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
|
|
|
|
qla2xxx_wake_dpc(vha);
|
|
|
|
} else {
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xffff,
|
|
|
|
"Async done-%s rescan failed on all retries.\n",
|
|
|
|
name);
|
|
|
|
}
|
2017-12-28 20:33:39 +00:00
|
|
|
}
|
2017-12-28 20:33:33 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-09-11 17:18:26 +00:00
|
|
|
qla2x00_find_free_fcp_nvme_slot(vha, sp);
|
2017-12-28 20:33:26 +00:00
|
|
|
|
2018-03-21 06:09:40 +00:00
|
|
|
if ((fc4_type == FC4_TYPE_FCP_SCSI) && vha->flags.nvme_enabled &&
|
|
|
|
cmd == GNN_FT_CMD) {
|
|
|
|
spin_lock_irqsave(&vha->work_lock, flags);
|
|
|
|
vha->scan.scan_flags &= ~SF_SCANNING;
|
|
|
|
spin_unlock_irqrestore(&vha->work_lock, flags);
|
2017-12-28 20:33:26 +00:00
|
|
|
|
2018-08-31 18:24:35 +00:00
|
|
|
sp->rc = res;
|
2018-09-11 17:18:26 +00:00
|
|
|
rc = qla2x00_post_nvme_gpnft_work(vha, sp, QLA_EVT_GPNFT);
|
2018-09-04 21:19:16 +00:00
|
|
|
if (rc) {
|
2018-08-31 18:24:35 +00:00
|
|
|
qla24xx_sp_unmap(vha, sp);
|
2018-03-21 06:09:40 +00:00
|
|
|
set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
|
|
|
|
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
|
2017-12-28 20:33:26 +00:00
|
|
|
}
|
2018-09-04 21:19:16 +00:00
|
|
|
return;
|
2017-12-28 20:33:26 +00:00
|
|
|
}
|
|
|
|
|
2018-08-31 18:24:33 +00:00
|
|
|
if (cmd == GPN_FT_CMD) {
|
2018-08-31 18:24:35 +00:00
|
|
|
rc = qla2x00_post_gnnft_gpnft_done_work(vha, sp,
|
|
|
|
QLA_EVT_GPNFT_DONE);
|
2018-08-31 18:24:33 +00:00
|
|
|
} else {
|
2018-08-31 18:24:35 +00:00
|
|
|
rc = qla2x00_post_gnnft_gpnft_done_work(vha, sp,
|
|
|
|
QLA_EVT_GNNFT_DONE);
|
2018-08-31 18:24:33 +00:00
|
|
|
}
|
|
|
|
|
2018-08-31 18:24:35 +00:00
|
|
|
if (rc) {
|
|
|
|
qla24xx_sp_unmap(vha, sp);
|
2017-12-28 20:33:33 +00:00
|
|
|
set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
|
2017-12-28 20:33:26 +00:00
|
|
|
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get WWNN list for fc4_type
|
|
|
|
*
|
|
|
|
* It is assumed the same SRB is re-used from GPNFT to avoid
|
|
|
|
* mem free & re-alloc
|
|
|
|
*/
|
|
|
|
static int qla24xx_async_gnnft(scsi_qla_host_t *vha, struct srb *sp,
|
|
|
|
u8 fc4_type)
|
|
|
|
{
|
|
|
|
int rval = QLA_FUNCTION_FAILED;
|
|
|
|
struct ct_sns_req *ct_req;
|
|
|
|
struct ct_sns_pkt *ct_sns;
|
2018-03-21 06:09:40 +00:00
|
|
|
unsigned long flags;
|
2017-12-28 20:33:26 +00:00
|
|
|
|
2017-12-28 20:33:35 +00:00
|
|
|
if (!vha->flags.online) {
|
2018-03-21 06:09:40 +00:00
|
|
|
spin_lock_irqsave(&vha->work_lock, flags);
|
2017-12-28 20:33:35 +00:00
|
|
|
vha->scan.scan_flags &= ~SF_SCANNING;
|
2018-03-21 06:09:40 +00:00
|
|
|
spin_unlock_irqrestore(&vha->work_lock, flags);
|
2017-12-28 20:33:26 +00:00
|
|
|
goto done_free_sp;
|
2017-12-28 20:33:35 +00:00
|
|
|
}
|
2017-12-28 20:33:26 +00:00
|
|
|
|
|
|
|
if (!sp->u.iocb_cmd.u.ctarg.req || !sp->u.iocb_cmd.u.ctarg.rsp) {
|
|
|
|
ql_log(ql_log_warn, vha, 0xffff,
|
|
|
|
"%s: req %p rsp %p are not setup\n",
|
|
|
|
__func__, sp->u.iocb_cmd.u.ctarg.req,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp);
|
2018-03-21 06:09:40 +00:00
|
|
|
spin_lock_irqsave(&vha->work_lock, flags);
|
2017-12-28 20:33:35 +00:00
|
|
|
vha->scan.scan_flags &= ~SF_SCANNING;
|
2018-03-21 06:09:40 +00:00
|
|
|
spin_unlock_irqrestore(&vha->work_lock, flags);
|
2017-12-28 20:33:26 +00:00
|
|
|
WARN_ON(1);
|
2018-09-04 21:19:16 +00:00
|
|
|
set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
|
|
|
|
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
|
2017-12-28 20:33:26 +00:00
|
|
|
goto done_free_sp;
|
|
|
|
}
|
2018-03-21 06:09:40 +00:00
|
|
|
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xfffff,
|
2018-09-09 22:25:03 +00:00
|
|
|
"%s: FC4Type %x, CT-PASSTHRU %s command ctarg rsp size %d, ctarg req size %d\n",
|
2018-03-21 06:09:40 +00:00
|
|
|
__func__, fc4_type, sp->name, sp->u.iocb_cmd.u.ctarg.rsp_size,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_size);
|
|
|
|
|
2017-12-28 20:33:26 +00:00
|
|
|
sp->type = SRB_CT_PTHRU_CMD;
|
|
|
|
sp->name = "gnnft";
|
|
|
|
sp->gen1 = vha->hw->base_qpair->chip_reset;
|
|
|
|
sp->gen2 = fc4_type;
|
2018-03-20 21:36:14 +00:00
|
|
|
|
|
|
|
sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout;
|
2017-12-28 20:33:26 +00:00
|
|
|
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2);
|
|
|
|
|
|
|
|
memset(sp->u.iocb_cmd.u.ctarg.rsp, 0, sp->u.iocb_cmd.u.ctarg.rsp_size);
|
|
|
|
memset(sp->u.iocb_cmd.u.ctarg.req, 0, sp->u.iocb_cmd.u.ctarg.req_size);
|
|
|
|
|
|
|
|
ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.req;
|
|
|
|
/* CT_IU preamble */
|
|
|
|
ct_req = qla2x00_prep_ct_req(ct_sns, GNN_FT_CMD,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_size);
|
|
|
|
|
|
|
|
/* GPN_FT req */
|
|
|
|
ct_req->req.gpn_ft.port_type = fc4_type;
|
|
|
|
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_size = GNN_FT_REQ_SIZE;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.nport_handle = NPH_SNS;
|
|
|
|
|
|
|
|
sp->done = qla2x00_async_gpnft_gnnft_sp_done;
|
|
|
|
|
2019-02-14 15:52:29 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xffff,
|
|
|
|
"Async-%s hdl=%x FC4Type %x.\n", sp->name,
|
|
|
|
sp->handle, ct_req->req.gpn_ft.port_type);
|
|
|
|
|
2017-12-28 20:33:26 +00:00
|
|
|
rval = qla2x00_start_sp(sp);
|
2018-09-04 21:19:16 +00:00
|
|
|
if (rval != QLA_SUCCESS) {
|
2017-12-28 20:33:26 +00:00
|
|
|
goto done_free_sp;
|
2018-09-04 21:19:16 +00:00
|
|
|
}
|
2017-12-28 20:33:26 +00:00
|
|
|
|
|
|
|
return rval;
|
|
|
|
|
|
|
|
done_free_sp:
|
|
|
|
if (sp->u.iocb_cmd.u.ctarg.req) {
|
|
|
|
dma_free_coherent(&vha->hw->pdev->dev,
|
2018-07-02 20:01:58 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.req_allocated_size,
|
2017-12-28 20:33:26 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.req,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_dma);
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req = NULL;
|
|
|
|
}
|
|
|
|
if (sp->u.iocb_cmd.u.ctarg.rsp) {
|
|
|
|
dma_free_coherent(&vha->hw->pdev->dev,
|
2018-07-02 20:01:58 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_allocated_size,
|
2017-12-28 20:33:26 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_dma);
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
sp->free(sp);
|
|
|
|
|
2019-07-26 16:07:34 +00:00
|
|
|
spin_lock_irqsave(&vha->work_lock, flags);
|
|
|
|
vha->scan.scan_flags &= ~SF_SCANNING;
|
|
|
|
if (vha->scan.scan_flags == 0) {
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xffff,
|
|
|
|
"%s: schedule\n", __func__);
|
|
|
|
vha->scan.scan_flags |= SF_QUEUED;
|
|
|
|
schedule_delayed_work(&vha->scan.scan_work, 5);
|
|
|
|
}
|
|
|
|
spin_unlock_irqrestore(&vha->work_lock, flags);
|
|
|
|
|
|
|
|
|
2017-12-28 20:33:26 +00:00
|
|
|
return rval;
|
|
|
|
} /* GNNFT */
|
|
|
|
|
|
|
|
void qla24xx_async_gpnft_done(scsi_qla_host_t *vha, srb_t *sp)
|
|
|
|
{
|
2019-09-12 18:09:17 +00:00
|
|
|
ql_dbg(ql_dbg_disc + ql_dbg_verbose, vha, 0xffff,
|
2017-12-28 20:33:26 +00:00
|
|
|
"%s enter\n", __func__);
|
|
|
|
qla24xx_async_gnnft(vha, sp, sp->gen2);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get WWPN list for certain fc4_type */
|
2018-03-21 06:09:40 +00:00
|
|
|
int qla24xx_async_gpnft(scsi_qla_host_t *vha, u8 fc4_type, srb_t *sp)
|
2017-12-28 20:33:26 +00:00
|
|
|
{
|
|
|
|
int rval = QLA_FUNCTION_FAILED;
|
|
|
|
struct ct_sns_req *ct_req;
|
|
|
|
struct ct_sns_pkt *ct_sns;
|
|
|
|
u32 rspsz;
|
2017-12-28 20:33:35 +00:00
|
|
|
unsigned long flags;
|
2017-12-28 20:33:26 +00:00
|
|
|
|
2019-09-12 18:09:17 +00:00
|
|
|
ql_dbg(ql_dbg_disc + ql_dbg_verbose, vha, 0xffff,
|
2018-03-21 06:09:40 +00:00
|
|
|
"%s enter\n", __func__);
|
|
|
|
|
2017-12-28 20:33:26 +00:00
|
|
|
if (!vha->flags.online)
|
|
|
|
return rval;
|
|
|
|
|
2017-12-28 20:33:35 +00:00
|
|
|
spin_lock_irqsave(&vha->work_lock, flags);
|
|
|
|
if (vha->scan.scan_flags & SF_SCANNING) {
|
|
|
|
spin_unlock_irqrestore(&vha->work_lock, flags);
|
2019-09-12 18:09:17 +00:00
|
|
|
ql_dbg(ql_dbg_disc + ql_dbg_verbose, vha, 0xffff,
|
|
|
|
"%s: scan active\n", __func__);
|
2017-12-28 20:33:26 +00:00
|
|
|
return rval;
|
2017-12-28 20:33:35 +00:00
|
|
|
}
|
|
|
|
vha->scan.scan_flags |= SF_SCANNING;
|
|
|
|
spin_unlock_irqrestore(&vha->work_lock, flags);
|
2017-12-28 20:33:26 +00:00
|
|
|
|
2018-03-21 06:09:40 +00:00
|
|
|
if (fc4_type == FC4_TYPE_FCP_SCSI) {
|
2019-09-12 18:09:17 +00:00
|
|
|
ql_dbg(ql_dbg_disc + ql_dbg_verbose, vha, 0xffff,
|
2018-03-21 06:09:40 +00:00
|
|
|
"%s: Performing FCP Scan\n", __func__);
|
|
|
|
|
|
|
|
if (sp)
|
|
|
|
sp->free(sp); /* should not happen */
|
|
|
|
|
|
|
|
sp = qla2x00_get_sp(vha, NULL, GFP_KERNEL);
|
|
|
|
if (!sp) {
|
|
|
|
spin_lock_irqsave(&vha->work_lock, flags);
|
|
|
|
vha->scan.scan_flags &= ~SF_SCANNING;
|
|
|
|
spin_unlock_irqrestore(&vha->work_lock, flags);
|
|
|
|
return rval;
|
|
|
|
}
|
|
|
|
|
cross-tree: phase out dma_zalloc_coherent()
We already need to zero out memory for dma_alloc_coherent(), as such
using dma_zalloc_coherent() is superflous. Phase it out.
This change was generated with the following Coccinelle SmPL patch:
@ replace_dma_zalloc_coherent @
expression dev, size, data, handle, flags;
@@
-dma_zalloc_coherent(dev, size, handle, flags)
+dma_alloc_coherent(dev, size, handle, flags)
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
[hch: re-ran the script on the latest tree]
Signed-off-by: Christoph Hellwig <hch@lst.de>
2019-01-04 08:23:09 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev,
|
|
|
|
sizeof(struct ct_sns_pkt),
|
|
|
|
&sp->u.iocb_cmd.u.ctarg.req_dma,
|
|
|
|
GFP_KERNEL);
|
2018-07-02 20:01:58 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.req_allocated_size = sizeof(struct ct_sns_pkt);
|
2018-03-21 06:09:40 +00:00
|
|
|
if (!sp->u.iocb_cmd.u.ctarg.req) {
|
|
|
|
ql_log(ql_log_warn, vha, 0xffff,
|
|
|
|
"Failed to allocate ct_sns request.\n");
|
|
|
|
spin_lock_irqsave(&vha->work_lock, flags);
|
|
|
|
vha->scan.scan_flags &= ~SF_SCANNING;
|
|
|
|
spin_unlock_irqrestore(&vha->work_lock, flags);
|
2019-01-25 07:23:47 +00:00
|
|
|
qla2x00_rel_sp(sp);
|
|
|
|
return rval;
|
2018-03-21 06:09:40 +00:00
|
|
|
}
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_size = GPN_FT_REQ_SIZE;
|
|
|
|
|
|
|
|
rspsz = sizeof(struct ct_sns_gpnft_rsp) +
|
|
|
|
((vha->hw->max_fibre_devices - 1) *
|
|
|
|
sizeof(struct ct_sns_gpn_ft_data));
|
|
|
|
|
cross-tree: phase out dma_zalloc_coherent()
We already need to zero out memory for dma_alloc_coherent(), as such
using dma_zalloc_coherent() is superflous. Phase it out.
This change was generated with the following Coccinelle SmPL patch:
@ replace_dma_zalloc_coherent @
expression dev, size, data, handle, flags;
@@
-dma_zalloc_coherent(dev, size, handle, flags)
+dma_alloc_coherent(dev, size, handle, flags)
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
[hch: re-ran the script on the latest tree]
Signed-off-by: Christoph Hellwig <hch@lst.de>
2019-01-04 08:23:09 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev,
|
|
|
|
rspsz,
|
|
|
|
&sp->u.iocb_cmd.u.ctarg.rsp_dma,
|
|
|
|
GFP_KERNEL);
|
2019-07-26 16:07:27 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_allocated_size = rspsz;
|
2018-03-21 06:09:40 +00:00
|
|
|
if (!sp->u.iocb_cmd.u.ctarg.rsp) {
|
|
|
|
ql_log(ql_log_warn, vha, 0xffff,
|
|
|
|
"Failed to allocate ct_sns request.\n");
|
|
|
|
spin_lock_irqsave(&vha->work_lock, flags);
|
|
|
|
vha->scan.scan_flags &= ~SF_SCANNING;
|
|
|
|
spin_unlock_irqrestore(&vha->work_lock, flags);
|
2019-01-25 07:23:47 +00:00
|
|
|
dma_free_coherent(&vha->hw->pdev->dev,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_allocated_size,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_dma);
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req = NULL;
|
|
|
|
qla2x00_rel_sp(sp);
|
|
|
|
return rval;
|
2018-03-21 06:09:40 +00:00
|
|
|
}
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_size = rspsz;
|
|
|
|
|
2019-09-12 18:09:17 +00:00
|
|
|
ql_dbg(ql_dbg_disc + ql_dbg_verbose, vha, 0xffff,
|
2018-03-21 06:09:40 +00:00
|
|
|
"%s scan list size %d\n", __func__, vha->scan.size);
|
|
|
|
|
|
|
|
memset(vha->scan.l, 0, vha->scan.size);
|
|
|
|
} else if (!sp) {
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xffff,
|
|
|
|
"NVME scan did not provide SP\n");
|
2017-12-28 20:33:35 +00:00
|
|
|
return rval;
|
|
|
|
}
|
2017-12-28 20:33:26 +00:00
|
|
|
|
|
|
|
sp->type = SRB_CT_PTHRU_CMD;
|
|
|
|
sp->name = "gpnft";
|
|
|
|
sp->gen1 = vha->hw->base_qpair->chip_reset;
|
|
|
|
sp->gen2 = fc4_type;
|
2018-03-20 21:36:14 +00:00
|
|
|
|
|
|
|
sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout;
|
2017-12-28 20:33:26 +00:00
|
|
|
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2);
|
|
|
|
|
2018-09-27 05:05:13 +00:00
|
|
|
rspsz = sp->u.iocb_cmd.u.ctarg.rsp_size;
|
|
|
|
memset(sp->u.iocb_cmd.u.ctarg.rsp, 0, sp->u.iocb_cmd.u.ctarg.rsp_size);
|
|
|
|
memset(sp->u.iocb_cmd.u.ctarg.req, 0, sp->u.iocb_cmd.u.ctarg.req_size);
|
2017-12-28 20:33:26 +00:00
|
|
|
|
|
|
|
ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.req;
|
|
|
|
/* CT_IU preamble */
|
|
|
|
ct_req = qla2x00_prep_ct_req(ct_sns, GPN_FT_CMD, rspsz);
|
|
|
|
|
|
|
|
/* GPN_FT req */
|
|
|
|
ct_req->req.gpn_ft.port_type = fc4_type;
|
|
|
|
|
|
|
|
sp->u.iocb_cmd.u.ctarg.nport_handle = NPH_SNS;
|
|
|
|
|
|
|
|
sp->done = qla2x00_async_gpnft_gnnft_sp_done;
|
|
|
|
|
2019-02-14 15:52:29 +00:00
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xffff,
|
|
|
|
"Async-%s hdl=%x FC4Type %x.\n", sp->name,
|
|
|
|
sp->handle, ct_req->req.gpn_ft.port_type);
|
|
|
|
|
2017-12-28 20:33:26 +00:00
|
|
|
rval = qla2x00_start_sp(sp);
|
2017-12-28 20:33:35 +00:00
|
|
|
if (rval != QLA_SUCCESS) {
|
2017-12-28 20:33:26 +00:00
|
|
|
goto done_free_sp;
|
2017-12-28 20:33:35 +00:00
|
|
|
}
|
2017-12-28 20:33:26 +00:00
|
|
|
|
|
|
|
return rval;
|
|
|
|
|
|
|
|
done_free_sp:
|
|
|
|
if (sp->u.iocb_cmd.u.ctarg.req) {
|
|
|
|
dma_free_coherent(&vha->hw->pdev->dev,
|
2018-07-02 20:01:58 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.req_allocated_size,
|
2017-12-28 20:33:26 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.req,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_dma);
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req = NULL;
|
|
|
|
}
|
|
|
|
if (sp->u.iocb_cmd.u.ctarg.rsp) {
|
|
|
|
dma_free_coherent(&vha->hw->pdev->dev,
|
2018-07-02 20:01:58 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_allocated_size,
|
2017-12-28 20:33:26 +00:00
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp,
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_dma);
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
sp->free(sp);
|
|
|
|
|
2019-07-26 16:07:34 +00:00
|
|
|
spin_lock_irqsave(&vha->work_lock, flags);
|
|
|
|
vha->scan.scan_flags &= ~SF_SCANNING;
|
|
|
|
if (vha->scan.scan_flags == 0) {
|
2019-09-12 18:09:17 +00:00
|
|
|
ql_dbg(ql_dbg_disc + ql_dbg_verbose, vha, 0xffff,
|
|
|
|
"%s: Scan scheduled.\n", __func__);
|
2019-07-26 16:07:34 +00:00
|
|
|
vha->scan.scan_flags |= SF_QUEUED;
|
|
|
|
schedule_delayed_work(&vha->scan.scan_work, 5);
|
|
|
|
}
|
|
|
|
spin_unlock_irqrestore(&vha->work_lock, flags);
|
|
|
|
|
|
|
|
|
2017-12-28 20:33:26 +00:00
|
|
|
return rval;
|
|
|
|
}
|
|
|
|
|
2017-12-28 20:33:35 +00:00
|
|
|
void qla_scan_work_fn(struct work_struct *work)
|
|
|
|
{
|
|
|
|
struct fab_scan *s = container_of(to_delayed_work(work),
|
|
|
|
struct fab_scan, scan_work);
|
|
|
|
struct scsi_qla_host *vha = container_of(s, struct scsi_qla_host,
|
|
|
|
scan);
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xffff,
|
|
|
|
"%s: schedule loop resync\n", __func__);
|
|
|
|
set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
|
|
|
|
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
|
|
|
|
qla2xxx_wake_dpc(vha);
|
|
|
|
spin_lock_irqsave(&vha->work_lock, flags);
|
|
|
|
vha->scan.scan_flags &= ~SF_QUEUED;
|
|
|
|
spin_unlock_irqrestore(&vha->work_lock, flags);
|
|
|
|
}
|
|
|
|
|
2017-12-28 20:33:26 +00:00
|
|
|
/* GNN_ID */
|
|
|
|
void qla24xx_handle_gnnid_event(scsi_qla_host_t *vha, struct event_arg *ea)
|
|
|
|
{
|
|
|
|
qla24xx_post_gnl_work(vha, ea->fcport);
|
|
|
|
}
|
|
|
|
|
2019-08-09 03:02:04 +00:00
|
|
|
static void qla2x00_async_gnnid_sp_done(srb_t *sp, int res)
|
2017-12-28 20:33:26 +00:00
|
|
|
{
|
|
|
|
struct scsi_qla_host *vha = sp->vha;
|
|
|
|
fc_port_t *fcport = sp->fcport;
|
|
|
|
u8 *node_name = fcport->ct_desc.ct_sns->p.rsp.rsp.gnn_id.node_name;
|
|
|
|
struct event_arg ea;
|
|
|
|
u64 wwnn;
|
|
|
|
|
|
|
|
fcport->flags &= ~FCF_ASYNC_SENT;
|
|
|
|
wwnn = wwn_to_u64(node_name);
|
|
|
|
if (wwnn)
|
|
|
|
memcpy(fcport->node_name, node_name, WWN_SIZE);
|
|
|
|
|
|
|
|
memset(&ea, 0, sizeof(ea));
|
|
|
|
ea.fcport = fcport;
|
|
|
|
ea.sp = sp;
|
|
|
|
ea.rc = res;
|
|
|
|
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x204f,
|
|
|
|
"Async done-%s res %x, WWPN %8phC %8phC\n",
|
|
|
|
sp->name, res, fcport->port_name, fcport->node_name);
|
|
|
|
|
2019-08-09 03:02:15 +00:00
|
|
|
qla24xx_handle_gnnid_event(vha, &ea);
|
2017-12-28 20:33:26 +00:00
|
|
|
|
|
|
|
sp->free(sp);
|
|
|
|
}
|
|
|
|
|
|
|
|
int qla24xx_async_gnnid(scsi_qla_host_t *vha, fc_port_t *fcport)
|
|
|
|
{
|
|
|
|
int rval = QLA_FUNCTION_FAILED;
|
|
|
|
struct ct_sns_req *ct_req;
|
|
|
|
srb_t *sp;
|
|
|
|
|
2017-12-28 20:33:40 +00:00
|
|
|
if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT))
|
|
|
|
return rval;
|
2017-12-28 20:33:26 +00:00
|
|
|
|
2019-12-17 22:06:06 +00:00
|
|
|
qla2x00_set_fcport_disc_state(fcport, DSC_GNN_ID);
|
2017-12-28 20:33:26 +00:00
|
|
|
sp = qla2x00_get_sp(vha, fcport, GFP_ATOMIC);
|
|
|
|
if (!sp)
|
|
|
|
goto done;
|
|
|
|
|
2017-12-28 20:33:40 +00:00
|
|
|
fcport->flags |= FCF_ASYNC_SENT;
|
2017-12-28 20:33:26 +00:00
|
|
|
sp->type = SRB_CT_PTHRU_CMD;
|
|
|
|
sp->name = "gnnid";
|
|
|
|
sp->gen1 = fcport->rscn_gen;
|
|
|
|
sp->gen2 = fcport->login_gen;
|
|
|
|
|
2018-03-20 21:36:14 +00:00
|
|
|
sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout;
|
2017-12-28 20:33:26 +00:00
|
|
|
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2);
|
|
|
|
|
|
|
|
/* CT_IU preamble */
|
|
|
|
ct_req = qla2x00_prep_ct_req(fcport->ct_desc.ct_sns, GNN_ID_CMD,
|
|
|
|
GNN_ID_RSP_SIZE);
|
|
|
|
|
|
|
|
/* GNN_ID req */
|
2019-08-09 03:01:58 +00:00
|
|
|
ct_req->req.port_id.port_id = port_id_to_be_id(fcport->d_id);
|
2017-12-28 20:33:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* req & rsp use the same buffer */
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req = fcport->ct_desc.ct_sns;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_dma = fcport->ct_desc.ct_sns_dma;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp = fcport->ct_desc.ct_sns;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_dma = fcport->ct_desc.ct_sns_dma;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_size = GNN_ID_REQ_SIZE;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_size = GNN_ID_RSP_SIZE;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.nport_handle = NPH_SNS;
|
|
|
|
|
|
|
|
sp->done = qla2x00_async_gnnid_sp_done;
|
|
|
|
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xffff,
|
|
|
|
"Async-%s - %8phC hdl=%x loopid=%x portid %06x.\n",
|
|
|
|
sp->name, fcport->port_name,
|
|
|
|
sp->handle, fcport->loop_id, fcport->d_id.b24);
|
2019-02-14 15:52:29 +00:00
|
|
|
|
|
|
|
rval = qla2x00_start_sp(sp);
|
|
|
|
if (rval != QLA_SUCCESS)
|
|
|
|
goto done_free_sp;
|
2017-12-28 20:33:26 +00:00
|
|
|
return rval;
|
|
|
|
|
|
|
|
done_free_sp:
|
|
|
|
sp->free(sp);
|
2019-04-02 21:24:22 +00:00
|
|
|
fcport->flags &= ~FCF_ASYNC_SENT;
|
2017-12-28 20:33:40 +00:00
|
|
|
done:
|
2017-12-28 20:33:26 +00:00
|
|
|
return rval;
|
|
|
|
}
|
|
|
|
|
|
|
|
int qla24xx_post_gnnid_work(struct scsi_qla_host *vha, fc_port_t *fcport)
|
|
|
|
{
|
|
|
|
struct qla_work_evt *e;
|
|
|
|
int ls;
|
|
|
|
|
|
|
|
ls = atomic_read(&vha->loop_state);
|
|
|
|
if (((ls != LOOP_READY) && (ls != LOOP_UP)) ||
|
|
|
|
test_bit(UNLOADING, &vha->dpc_flags))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
e = qla2x00_alloc_work(vha, QLA_EVT_GNNID);
|
|
|
|
if (!e)
|
|
|
|
return QLA_FUNCTION_FAILED;
|
|
|
|
|
|
|
|
e->u.fcport.fcport = fcport;
|
|
|
|
return qla2x00_post_work(vha, e);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* GPFN_ID */
|
|
|
|
void qla24xx_handle_gfpnid_event(scsi_qla_host_t *vha, struct event_arg *ea)
|
|
|
|
{
|
|
|
|
fc_port_t *fcport = ea->fcport;
|
|
|
|
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xffff,
|
2017-12-28 20:33:35 +00:00
|
|
|
"%s %8phC DS %d LS %d rc %d login %d|%d rscn %d|%d fcpcnt %d\n",
|
|
|
|
__func__, fcport->port_name, fcport->disc_state,
|
|
|
|
fcport->fw_login_state, ea->rc, fcport->login_gen, ea->sp->gen2,
|
|
|
|
fcport->rscn_gen, ea->sp->gen1, vha->fcport_count);
|
2017-12-28 20:33:26 +00:00
|
|
|
|
|
|
|
if (fcport->disc_state == DSC_DELETE_PEND)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (ea->sp->gen2 != fcport->login_gen) {
|
|
|
|
/* target side must have changed it. */
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x20d3,
|
2017-12-28 20:33:35 +00:00
|
|
|
"%s %8phC generation changed\n",
|
|
|
|
__func__, fcport->port_name);
|
2017-12-28 20:33:26 +00:00
|
|
|
return;
|
|
|
|
} else if (ea->sp->gen1 != fcport->rscn_gen) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
qla24xx_post_gpsc_work(vha, fcport);
|
|
|
|
}
|
|
|
|
|
2019-08-09 03:02:04 +00:00
|
|
|
static void qla2x00_async_gfpnid_sp_done(srb_t *sp, int res)
|
2017-12-28 20:33:26 +00:00
|
|
|
{
|
|
|
|
struct scsi_qla_host *vha = sp->vha;
|
|
|
|
fc_port_t *fcport = sp->fcport;
|
|
|
|
u8 *fpn = fcport->ct_desc.ct_sns->p.rsp.rsp.gfpn_id.port_name;
|
|
|
|
struct event_arg ea;
|
|
|
|
u64 wwn;
|
|
|
|
|
|
|
|
wwn = wwn_to_u64(fpn);
|
|
|
|
if (wwn)
|
|
|
|
memcpy(fcport->fabric_port_name, fpn, WWN_SIZE);
|
|
|
|
|
|
|
|
memset(&ea, 0, sizeof(ea));
|
|
|
|
ea.fcport = fcport;
|
|
|
|
ea.sp = sp;
|
|
|
|
ea.rc = res;
|
|
|
|
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0x204f,
|
|
|
|
"Async done-%s res %x, WWPN %8phC %8phC\n",
|
|
|
|
sp->name, res, fcport->port_name, fcport->fabric_port_name);
|
|
|
|
|
2019-08-09 03:02:15 +00:00
|
|
|
qla24xx_handle_gfpnid_event(vha, &ea);
|
2017-12-28 20:33:26 +00:00
|
|
|
|
|
|
|
sp->free(sp);
|
|
|
|
}
|
|
|
|
|
|
|
|
int qla24xx_async_gfpnid(scsi_qla_host_t *vha, fc_port_t *fcport)
|
|
|
|
{
|
|
|
|
int rval = QLA_FUNCTION_FAILED;
|
|
|
|
struct ct_sns_req *ct_req;
|
|
|
|
srb_t *sp;
|
|
|
|
|
2017-12-28 20:33:40 +00:00
|
|
|
if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT))
|
|
|
|
return rval;
|
2017-12-28 20:33:26 +00:00
|
|
|
|
|
|
|
sp = qla2x00_get_sp(vha, fcport, GFP_ATOMIC);
|
|
|
|
if (!sp)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
sp->type = SRB_CT_PTHRU_CMD;
|
|
|
|
sp->name = "gfpnid";
|
|
|
|
sp->gen1 = fcport->rscn_gen;
|
|
|
|
sp->gen2 = fcport->login_gen;
|
|
|
|
|
2018-03-20 21:36:14 +00:00
|
|
|
sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout;
|
2017-12-28 20:33:26 +00:00
|
|
|
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2);
|
|
|
|
|
|
|
|
/* CT_IU preamble */
|
|
|
|
ct_req = qla2x00_prep_ct_req(fcport->ct_desc.ct_sns, GFPN_ID_CMD,
|
|
|
|
GFPN_ID_RSP_SIZE);
|
|
|
|
|
|
|
|
/* GFPN_ID req */
|
2019-08-09 03:01:58 +00:00
|
|
|
ct_req->req.port_id.port_id = port_id_to_be_id(fcport->d_id);
|
2017-12-28 20:33:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* req & rsp use the same buffer */
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req = fcport->ct_desc.ct_sns;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_dma = fcport->ct_desc.ct_sns_dma;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp = fcport->ct_desc.ct_sns;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_dma = fcport->ct_desc.ct_sns_dma;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.req_size = GFPN_ID_REQ_SIZE;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.rsp_size = GFPN_ID_RSP_SIZE;
|
|
|
|
sp->u.iocb_cmd.u.ctarg.nport_handle = NPH_SNS;
|
|
|
|
|
|
|
|
sp->done = qla2x00_async_gfpnid_sp_done;
|
|
|
|
|
|
|
|
ql_dbg(ql_dbg_disc, vha, 0xffff,
|
|
|
|
"Async-%s - %8phC hdl=%x loopid=%x portid %06x.\n",
|
|
|
|
sp->name, fcport->port_name,
|
|
|
|
sp->handle, fcport->loop_id, fcport->d_id.b24);
|
2019-02-14 15:52:29 +00:00
|
|
|
|
|
|
|
rval = qla2x00_start_sp(sp);
|
|
|
|
if (rval != QLA_SUCCESS)
|
|
|
|
goto done_free_sp;
|
|
|
|
|
2017-12-28 20:33:26 +00:00
|
|
|
return rval;
|
|
|
|
|
|
|
|
done_free_sp:
|
|
|
|
sp->free(sp);
|
2017-12-28 20:33:40 +00:00
|
|
|
done:
|
2017-12-28 20:33:26 +00:00
|
|
|
return rval;
|
|
|
|
}
|
|
|
|
|
|
|
|
int qla24xx_post_gfpnid_work(struct scsi_qla_host *vha, fc_port_t *fcport)
|
|
|
|
{
|
|
|
|
struct qla_work_evt *e;
|
|
|
|
int ls;
|
|
|
|
|
|
|
|
ls = atomic_read(&vha->loop_state);
|
|
|
|
if (((ls != LOOP_READY) && (ls != LOOP_UP)) ||
|
|
|
|
test_bit(UNLOADING, &vha->dpc_flags))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
e = qla2x00_alloc_work(vha, QLA_EVT_GFPNID);
|
|
|
|
if (!e)
|
|
|
|
return QLA_FUNCTION_FAILED;
|
|
|
|
|
|
|
|
e->u.fcport.fcport = fcport;
|
|
|
|
return qla2x00_post_work(vha, e);
|
|
|
|
}
|