@@ -1056,7 +1056,7 @@ lpfc_nvme_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn,
* Catch race where our node has transitioned, but the
* transport is still transitioning.
*/
- ndlp = lpfc_ncmd->ndlp;
+ ndlp = lpfc_ncmd->nvme.rport->ndlp;
if (!ndlp || !NLP_CHK_NODE_ACT(ndlp)) {
lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_IOERR,
"6062 Ignoring NVME cmpl. No ndlp\n");
@@ -1695,7 +1695,7 @@ lpfc_nvme_fcp_io_submit(struct nvme_fc_local_port *pnvme_lport,
*/
freqpriv->nvme_buf = lpfc_ncmd;
lpfc_ncmd->nvme.nvmeCmd = pnvme_fcreq;
- lpfc_ncmd->ndlp = ndlp;
+ lpfc_ncmd->nvme.rport = rport;
lpfc_ncmd->nvme.qidx = lpfc_queue_info->qidx;
/*
@@ -2085,11 +2085,13 @@ lpfc_release_nvme_buf(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_ncmd)
{
struct lpfc_sli4_hdw_queue *qp;
unsigned long iflag = 0;
+ struct lpfc_nodelist *ndlp =
+ lpfc_ncmd->nvme.rport ? lpfc_ncmd->nvme.rport->ndlp : NULL;
- if ((lpfc_ncmd->flags & LPFC_SBUF_BUMP_QDEPTH) && lpfc_ncmd->ndlp)
- atomic_dec(&lpfc_ncmd->ndlp->cmd_pending);
+ if ((lpfc_ncmd->flags & LPFC_SBUF_BUMP_QDEPTH) && ndlp)
+ atomic_dec(&ndlp->cmd_pending);
- lpfc_ncmd->ndlp = NULL;
+ lpfc_ncmd->nvme.rport = NULL;
lpfc_ncmd->flags &= ~LPFC_SBUF_BUMP_QDEPTH;
qp = lpfc_ncmd->hdwq;
@@ -2646,7 +2648,7 @@ lpfc_sli4_nvme_xri_aborted(struct lpfc_hba *phba,
{
uint16_t xri = bf_get(lpfc_wcqe_xa_xri, axri);
struct nvmefc_fcp_req *nvme_cmd = NULL;
- struct lpfc_nodelist *ndlp = lpfc_ncmd->ndlp;
+ struct lpfc_nodelist *ndlp = lpfc_ncmd->nvme.rport->ndlp;
if (ndlp)
@@ -382,7 +382,6 @@ struct lpfc_io_buf {
uint16_t hdwq_no;
uint16_t cpu;
- struct lpfc_nodelist *ndlp;
uint32_t timeout;
uint16_t flags; /* TBD convert exch_busy to flags */
#define LPFC_SBUF_XBUSY 0x1 /* SLI4 hba reported XB on WCQE cmpl */
@@ -439,6 +438,7 @@ struct lpfc_io_buf {
/* NVME specific fields */
struct {
struct nvmefc_fcp_req *nvmeCmd;
+ struct lpfc_nvme_rport *rport;
uint16_t qidx;
} nvme;
};
Instead of referencing the nodelist directly via a point in the I/O buffer we should be storing the nvme rport pointer in the protocol-specific section and access the nodelist through that. With this we reduce the size of the I/O buffer, eliminate a possible race and align the protoco-specific sections. Signed-off-by: Hannes Reinecke <hare@suse.com> --- drivers/scsi/lpfc/lpfc_nvme.c | 14 ++++++++------ drivers/scsi/lpfc/lpfc_sli.h | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-)