From: James Smart <james.smart@avagotech.com>
To: Sebastian Herbszt <herbszt@gmx.de>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH 06/14] lpfc: Add support for RDP ELS command.
Date: Wed, 20 May 2015 11:02:00 -0400 [thread overview]
Message-ID: <555CA1E8.8090005@avagotech.com> (raw)
In-Reply-To: <20150421143833.00004b43@localhost>
Sebastian,
Agree with the statement on not returning right reject
reasons/explanations. Patches will be reposted shortly with itcorrected
as well as the spacing changes for this patch and patch 3.
-- james s
On 4/21/2015 8:38 AM, Sebastian Herbszt wrote:
> James Smart wrote:
>> Add support for RDP ELS command.
>>
>> ...
>> +/*
>> + * lpfc_els_rcv_rdp - Process an unsolicited RDP ELS.
>> + * @vport: pointer to a host virtual N_Port data structure.
>> + * @cmdiocb: pointer to lpfc command iocb data structure.
>> + * @ndlp: pointer to a node-list data structure.
>> + *
>> + * This routine processes an unsolicited RDP(Read Diagnostic Parameters)
>> + * IOCB. First, the payload of the unsolicited RDP is checked.
>> + * Then it will (1) send MBX_DUMP_MEMORY, Embedded DMP_LMSD sub command TYPE-3
>> + * for Page A0, (2) send MBX_DUMP_MEMORY, DMP_LMSD for Page A2,
>> + * (3) send MBX_READ_LNK_STAT to get link stat, (4) Call lpfc_els_rdp_cmpl
>> + * gather all data and send RDP response.
>> + *
>> + * Return code
>> + * 0 - Sent the acc response
>> + * 1 - Sent the reject response.
>> + */
>> +static int
>> +lpfc_els_rcv_rdp(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
>> + struct lpfc_nodelist *ndlp)
>> +{
>> + struct lpfc_hba *phba = vport->phba;
> here too
>
>> + struct lpfc_dmabuf *pcmd;
>> + uint8_t rjt_err;
>> + struct fc_rdp_req_frame *rdp_req;
>> + struct lpfc_rdp_context *rdp_context;
>> + IOCB_t *cmd = NULL;
>> + struct ls_rjt stat;
>> +
>> + if (phba->sli_rev < LPFC_SLI_REV4 ||
>> + (bf_get(lpfc_sli_intf_if_type,
>> + &phba->sli4_hba.sli_intf) !=
>> + LPFC_SLI_INTF_IF_TYPE_2)) {
>> + rjt_err = LSRJT_CMD_UNSUPPORTED;
>> + goto rjt;
>> + }
>> +
>> + if (phba->sli_rev < LPFC_SLI_REV4 || (phba->hba_flag & HBA_FCOE_MODE)) {
>> + rjt_err = LSRJT_CMD_UNSUPPORTED;
>> + goto rjt;
>> + }
>> +
> Code at rjt label also sets rjt_err to LSRJT_CMD_UNSUPPORTED.
>
> Should the command not get rejected with LSRJT_UNABLE_TPC and
> LSEXP_REQ_UNSUPPORTED?
>
>> + pcmd = (struct lpfc_dmabuf *) cmdiocb->context2;
>> + rdp_req = (struct fc_rdp_req_frame *) pcmd->virt;
>> +
>> +
>> + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
>> + "2422 ELS RDP Request "
>> + "dec len %d tag x%x port_id %d len %d\n",
>> + be32_to_cpu(rdp_req->rdp_des_length),
>> + be32_to_cpu(rdp_req->nport_id_desc.tag),
>> + be32_to_cpu(rdp_req->nport_id_desc.nport_id),
>> + be32_to_cpu(rdp_req->nport_id_desc.length));
>> +
>> + if (sizeof(struct fc_rdp_nport_desc) !=
>> + be32_to_cpu(rdp_req->rdp_des_length))
>> + goto rjt;
>> + if (RDP_N_PORT_DESC_TAG != be32_to_cpu(rdp_req->nport_id_desc.tag))
>> + goto rjt;
>> + if (RDP_NPORT_ID_SIZE !=
>> + be32_to_cpu(rdp_req->nport_id_desc.length))
>> + goto rjt;
>> + rdp_context = kmalloc(sizeof(struct lpfc_rdp_context), GFP_KERNEL);
>> + if (!rdp_context) {
>> + rjt_err = LSRJT_UNABLE_TPC;
>> + goto error;
>> + }
>> +
>> + memset(rdp_context, 0, sizeof(struct lpfc_rdp_context));
>> + cmd = &cmdiocb->iocb;
>> + rdp_context->ndlp = lpfc_nlp_get(ndlp);
>> + rdp_context->ox_id = cmd->unsli3.rcvsli3.ox_id;
>> + rdp_context->rx_id = cmd->ulpContext;
>> + rdp_context->cmpl = lpfc_els_rdp_cmpl;
>> + if (lpfc_get_rdp_info(phba, rdp_context)) {
>> + lpfc_printf_vlog(ndlp->vport, KERN_WARNING, LOG_ELS,
>> + "2423 Unable to send mailbox");
>> + kfree(rdp_context);
>> + rjt_err = LSRJT_UNABLE_TPC;
>> + lpfc_nlp_put(ndlp);
>> + goto error;
>> + }
>> +
>> + return 0;
>> +rjt:
>> + rjt_err = LSRJT_CMD_UNSUPPORTED;
>> +error:
>> + memset(&stat, 0, sizeof(stat));
>> + stat.un.b.lsRjtRsnCode = rjt_err;
>> + lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp, NULL);
>> + return 1;
>> +}
> Sebastian
>
>
prev parent reply other threads:[~2015-05-20 15:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-20 13:56 [PATCH 06/14] lpfc: Add support for RDP ELS command James Smart
2015-04-21 10:05 ` Hannes Reinecke
2015-04-21 12:38 ` Sebastian Herbszt
2015-05-20 15:02 ` James Smart [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=555CA1E8.8090005@avagotech.com \
--to=james.smart@avagotech.com \
--cc=herbszt@gmx.de \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.