diff mbox

[v3,01/13] qla2xxx: Remove unneeded message and minor cleanup for FC-NVMe

Message ID 20180320055837.5246-2-himanshu.madhani@cavium.com (mailing list archive)
State Superseded
Headers show

Commit Message

Madhani, Himanshu March 20, 2018, 5:58 a.m. UTC
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 drivers/scsi/qla2xxx/qla_nvme.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

Comments

kernel test robot March 21, 2018, 1:13 a.m. UTC | #1
Hi Himanshu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v4.16-rc4]
[also build test ERROR on next-20180320]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Himanshu-Madhani/qla2xxx-Remove-unneeded-message-and-minor-cleanup-for-FC-NVMe/20180320-215409
config: x86_64-lkp (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

Note: the linux-review/Himanshu-Madhani/qla2xxx-Remove-unneeded-message-and-minor-cleanup-for-FC-NVMe/20180320-215409 HEAD 50dbc1dc7fc60496f8e073be2dd0fc1a0347e95d builds fine.
      It only hurts bisectibility.

All errors (new ones prefixed by >>):

   drivers/scsi/qla2xxx/qla_nvme.c: In function 'qla2x00_start_nvme_mq':
>> drivers/scsi/qla2xxx/qla_nvme.c:478:6: error: 'rsp' undeclared (first use in this function); did you mean 'sp'?
         rsp->ring_ptr->signature != RESPONSE_PROCESSED)
         ^~~
         sp
   drivers/scsi/qla2xxx/qla_nvme.c:478:6: note: each undeclared identifier is reported only once for each function it appears in

vim +478 drivers/scsi/qla2xxx/qla_nvme.c

e84067d7 Duane Grigsby    2017-06-21  300  
e84067d7 Duane Grigsby    2017-06-21  301  static int qla2x00_start_nvme_mq(srb_t *sp)
e84067d7 Duane Grigsby    2017-06-21  302  {
e84067d7 Duane Grigsby    2017-06-21  303  	unsigned long   flags;
e84067d7 Duane Grigsby    2017-06-21  304  	uint32_t        *clr_ptr;
e84067d7 Duane Grigsby    2017-06-21  305  	uint32_t        index;
e84067d7 Duane Grigsby    2017-06-21  306  	uint32_t        handle;
e84067d7 Duane Grigsby    2017-06-21  307  	struct cmd_nvme *cmd_pkt;
e84067d7 Duane Grigsby    2017-06-21  308  	uint16_t        cnt, i;
e84067d7 Duane Grigsby    2017-06-21  309  	uint16_t        req_cnt;
e84067d7 Duane Grigsby    2017-06-21  310  	uint16_t        tot_dsds;
e84067d7 Duane Grigsby    2017-06-21  311  	uint16_t	avail_dsds;
e84067d7 Duane Grigsby    2017-06-21  312  	uint32_t	*cur_dsd;
e84067d7 Duane Grigsby    2017-06-21  313  	struct req_que *req = NULL;
e84067d7 Duane Grigsby    2017-06-21  314  	struct scsi_qla_host *vha = sp->fcport->vha;
e84067d7 Duane Grigsby    2017-06-21  315  	struct qla_hw_data *ha = vha->hw;
e84067d7 Duane Grigsby    2017-06-21  316  	struct qla_qpair *qpair = sp->qpair;
e84067d7 Duane Grigsby    2017-06-21  317  	struct srb_iocb *nvme = &sp->u.iocb_cmd;
e84067d7 Duane Grigsby    2017-06-21  318  	struct scatterlist *sgl, *sg;
e84067d7 Duane Grigsby    2017-06-21  319  	struct nvmefc_fcp_req *fd = nvme->u.nvme.desc;
e84067d7 Duane Grigsby    2017-06-21  320  	uint32_t        rval = QLA_SUCCESS;
e84067d7 Duane Grigsby    2017-06-21  321  
ee6b1136 Himanshu Madhani 2018-03-19  322  	/* Setup qpair pointers */
ee6b1136 Himanshu Madhani 2018-03-19  323  	req = qpair->req;
e84067d7 Duane Grigsby    2017-06-21  324  	tot_dsds = fd->sg_cnt;
e84067d7 Duane Grigsby    2017-06-21  325  
e84067d7 Duane Grigsby    2017-06-21  326  	/* Acquire qpair specific lock */
e84067d7 Duane Grigsby    2017-06-21  327  	spin_lock_irqsave(&qpair->qp_lock, flags);
e84067d7 Duane Grigsby    2017-06-21  328  
e84067d7 Duane Grigsby    2017-06-21  329  	/* Check for room in outstanding command list. */
e84067d7 Duane Grigsby    2017-06-21  330  	handle = req->current_outstanding_cmd;
e84067d7 Duane Grigsby    2017-06-21  331  	for (index = 1; index < req->num_outstanding_cmds; index++) {
e84067d7 Duane Grigsby    2017-06-21  332  		handle++;
e84067d7 Duane Grigsby    2017-06-21  333  		if (handle == req->num_outstanding_cmds)
e84067d7 Duane Grigsby    2017-06-21  334  			handle = 1;
e84067d7 Duane Grigsby    2017-06-21  335  		if (!req->outstanding_cmds[handle])
e84067d7 Duane Grigsby    2017-06-21  336  			break;
e84067d7 Duane Grigsby    2017-06-21  337  	}
e84067d7 Duane Grigsby    2017-06-21  338  
e84067d7 Duane Grigsby    2017-06-21  339  	if (index == req->num_outstanding_cmds) {
e84067d7 Duane Grigsby    2017-06-21  340  		rval = -1;
e84067d7 Duane Grigsby    2017-06-21  341  		goto queuing_error;
e84067d7 Duane Grigsby    2017-06-21  342  	}
e84067d7 Duane Grigsby    2017-06-21  343  	req_cnt = qla24xx_calc_iocbs(vha, tot_dsds);
e84067d7 Duane Grigsby    2017-06-21  344  	if (req->cnt < (req_cnt + 2)) {
e84067d7 Duane Grigsby    2017-06-21  345  		cnt = IS_SHADOW_REG_CAPABLE(ha) ? *req->out_ptr :
e84067d7 Duane Grigsby    2017-06-21  346  		    RD_REG_DWORD_RELAXED(req->req_q_out);
e84067d7 Duane Grigsby    2017-06-21  347  
e84067d7 Duane Grigsby    2017-06-21  348  		if (req->ring_index < cnt)
e84067d7 Duane Grigsby    2017-06-21  349  			req->cnt = cnt - req->ring_index;
e84067d7 Duane Grigsby    2017-06-21  350  		else
e84067d7 Duane Grigsby    2017-06-21  351  			req->cnt = req->length - (req->ring_index - cnt);
e84067d7 Duane Grigsby    2017-06-21  352  
e84067d7 Duane Grigsby    2017-06-21  353  		if (req->cnt < (req_cnt + 2)){
e84067d7 Duane Grigsby    2017-06-21  354  			rval = -1;
e84067d7 Duane Grigsby    2017-06-21  355  			goto queuing_error;
e84067d7 Duane Grigsby    2017-06-21  356  		}
e84067d7 Duane Grigsby    2017-06-21  357  	}
e84067d7 Duane Grigsby    2017-06-21  358  
e84067d7 Duane Grigsby    2017-06-21  359  	if (unlikely(!fd->sqid)) {
e84067d7 Duane Grigsby    2017-06-21  360  		struct nvme_fc_cmd_iu *cmd = fd->cmdaddr;
e84067d7 Duane Grigsby    2017-06-21  361  		if (cmd->sqe.common.opcode == nvme_admin_async_event) {
e84067d7 Duane Grigsby    2017-06-21  362  			nvme->u.nvme.aen_op = 1;
ee6b1136 Himanshu Madhani 2018-03-19  363  			atomic_inc(&ha->nvme_active_aen_cnt);
e84067d7 Duane Grigsby    2017-06-21  364  		}
e84067d7 Duane Grigsby    2017-06-21  365  	}
e84067d7 Duane Grigsby    2017-06-21  366  
e84067d7 Duane Grigsby    2017-06-21  367  	/* Build command packet. */
e84067d7 Duane Grigsby    2017-06-21  368  	req->current_outstanding_cmd = handle;
e84067d7 Duane Grigsby    2017-06-21  369  	req->outstanding_cmds[handle] = sp;
e84067d7 Duane Grigsby    2017-06-21  370  	sp->handle = handle;
e84067d7 Duane Grigsby    2017-06-21  371  	req->cnt -= req_cnt;
e84067d7 Duane Grigsby    2017-06-21  372  
e84067d7 Duane Grigsby    2017-06-21  373  	cmd_pkt = (struct cmd_nvme *)req->ring_ptr;
e84067d7 Duane Grigsby    2017-06-21  374  	cmd_pkt->handle = MAKE_HANDLE(req->id, handle);
e84067d7 Duane Grigsby    2017-06-21  375  
e84067d7 Duane Grigsby    2017-06-21  376  	/* Zero out remaining portion of packet. */
e84067d7 Duane Grigsby    2017-06-21  377  	clr_ptr = (uint32_t *)cmd_pkt + 2;
e84067d7 Duane Grigsby    2017-06-21  378  	memset(clr_ptr, 0, REQUEST_ENTRY_SIZE - 8);
e84067d7 Duane Grigsby    2017-06-21  379  
e84067d7 Duane Grigsby    2017-06-21  380  	cmd_pkt->entry_status = 0;
e84067d7 Duane Grigsby    2017-06-21  381  
e84067d7 Duane Grigsby    2017-06-21  382  	/* Update entry type to indicate Command NVME IOCB */
e84067d7 Duane Grigsby    2017-06-21  383  	cmd_pkt->entry_type = COMMAND_NVME;
e84067d7 Duane Grigsby    2017-06-21  384  
e84067d7 Duane Grigsby    2017-06-21  385  	/* No data transfer how do we check buffer len == 0?? */
e84067d7 Duane Grigsby    2017-06-21  386  	if (fd->io_dir == NVMEFC_FCP_READ) {
e84067d7 Duane Grigsby    2017-06-21  387  		cmd_pkt->control_flags =
e84067d7 Duane Grigsby    2017-06-21  388  		    cpu_to_le16(CF_READ_DATA | CF_NVME_ENABLE);
e84067d7 Duane Grigsby    2017-06-21  389  		vha->qla_stats.input_bytes += fd->payload_length;
e84067d7 Duane Grigsby    2017-06-21  390  		vha->qla_stats.input_requests++;
e84067d7 Duane Grigsby    2017-06-21  391  	} else if (fd->io_dir == NVMEFC_FCP_WRITE) {
e84067d7 Duane Grigsby    2017-06-21  392  		cmd_pkt->control_flags =
e84067d7 Duane Grigsby    2017-06-21  393  		    cpu_to_le16(CF_WRITE_DATA | CF_NVME_ENABLE);
e84067d7 Duane Grigsby    2017-06-21  394  		vha->qla_stats.output_bytes += fd->payload_length;
e84067d7 Duane Grigsby    2017-06-21  395  		vha->qla_stats.output_requests++;
e84067d7 Duane Grigsby    2017-06-21  396  	} else if (fd->io_dir == 0) {
e84067d7 Duane Grigsby    2017-06-21  397  		cmd_pkt->control_flags = cpu_to_le16(CF_NVME_ENABLE);
e84067d7 Duane Grigsby    2017-06-21  398  	}
e84067d7 Duane Grigsby    2017-06-21  399  
e84067d7 Duane Grigsby    2017-06-21  400  	/* Set NPORT-ID */
e84067d7 Duane Grigsby    2017-06-21  401  	cmd_pkt->nport_handle = cpu_to_le16(sp->fcport->loop_id);
e84067d7 Duane Grigsby    2017-06-21  402  	cmd_pkt->port_id[0] = sp->fcport->d_id.b.al_pa;
e84067d7 Duane Grigsby    2017-06-21  403  	cmd_pkt->port_id[1] = sp->fcport->d_id.b.area;
e84067d7 Duane Grigsby    2017-06-21  404  	cmd_pkt->port_id[2] = sp->fcport->d_id.b.domain;
e84067d7 Duane Grigsby    2017-06-21  405  	cmd_pkt->vp_index = sp->fcport->vha->vp_idx;
e84067d7 Duane Grigsby    2017-06-21  406  
e84067d7 Duane Grigsby    2017-06-21  407  	/* NVME RSP IU */
e84067d7 Duane Grigsby    2017-06-21  408  	cmd_pkt->nvme_rsp_dsd_len = cpu_to_le16(fd->rsplen);
e84067d7 Duane Grigsby    2017-06-21  409  	cmd_pkt->nvme_rsp_dseg_address[0] = cpu_to_le32(LSD(fd->rspdma));
e84067d7 Duane Grigsby    2017-06-21  410  	cmd_pkt->nvme_rsp_dseg_address[1] = cpu_to_le32(MSD(fd->rspdma));
e84067d7 Duane Grigsby    2017-06-21  411  
e84067d7 Duane Grigsby    2017-06-21  412  	/* NVME CNMD IU */
e84067d7 Duane Grigsby    2017-06-21  413  	cmd_pkt->nvme_cmnd_dseg_len = cpu_to_le16(fd->cmdlen);
e84067d7 Duane Grigsby    2017-06-21  414  	cmd_pkt->nvme_cmnd_dseg_address[0] = cpu_to_le32(LSD(fd->cmddma));
e84067d7 Duane Grigsby    2017-06-21  415  	cmd_pkt->nvme_cmnd_dseg_address[1] = cpu_to_le32(MSD(fd->cmddma));
e84067d7 Duane Grigsby    2017-06-21  416  
e84067d7 Duane Grigsby    2017-06-21  417  	cmd_pkt->dseg_count = cpu_to_le16(tot_dsds);
e84067d7 Duane Grigsby    2017-06-21  418  	cmd_pkt->byte_count = cpu_to_le32(fd->payload_length);
e84067d7 Duane Grigsby    2017-06-21  419  
e84067d7 Duane Grigsby    2017-06-21  420  	/* One DSD is available in the Command Type NVME IOCB */
e84067d7 Duane Grigsby    2017-06-21  421  	avail_dsds = 1;
e84067d7 Duane Grigsby    2017-06-21  422  	cur_dsd = (uint32_t *)&cmd_pkt->nvme_data_dseg_address[0];
e84067d7 Duane Grigsby    2017-06-21  423  	sgl = fd->first_sgl;
e84067d7 Duane Grigsby    2017-06-21  424  
e84067d7 Duane Grigsby    2017-06-21  425  	/* Load data segments */
e84067d7 Duane Grigsby    2017-06-21  426  	for_each_sg(sgl, sg, tot_dsds, i) {
e84067d7 Duane Grigsby    2017-06-21  427  		dma_addr_t      sle_dma;
e84067d7 Duane Grigsby    2017-06-21  428  		cont_a64_entry_t *cont_pkt;
e84067d7 Duane Grigsby    2017-06-21  429  
e84067d7 Duane Grigsby    2017-06-21  430  		/* Allocate additional continuation packets? */
e84067d7 Duane Grigsby    2017-06-21  431  		if (avail_dsds == 0) {
e84067d7 Duane Grigsby    2017-06-21  432  			/*
e84067d7 Duane Grigsby    2017-06-21  433  			 * Five DSDs are available in the Continuation
e84067d7 Duane Grigsby    2017-06-21  434  			 * Type 1 IOCB.
e84067d7 Duane Grigsby    2017-06-21  435  			 */
e84067d7 Duane Grigsby    2017-06-21  436  
e84067d7 Duane Grigsby    2017-06-21  437  			/* Adjust ring index */
e84067d7 Duane Grigsby    2017-06-21  438  			req->ring_index++;
e84067d7 Duane Grigsby    2017-06-21  439  			if (req->ring_index == req->length) {
e84067d7 Duane Grigsby    2017-06-21  440  				req->ring_index = 0;
e84067d7 Duane Grigsby    2017-06-21  441  				req->ring_ptr = req->ring;
e84067d7 Duane Grigsby    2017-06-21  442  			} else {
e84067d7 Duane Grigsby    2017-06-21  443  				req->ring_ptr++;
e84067d7 Duane Grigsby    2017-06-21  444  			}
e84067d7 Duane Grigsby    2017-06-21  445  			cont_pkt = (cont_a64_entry_t *)req->ring_ptr;
c345c6ca Himanshu Madhani 2017-06-30  446  			*((uint32_t *)(&cont_pkt->entry_type)) =
c345c6ca Himanshu Madhani 2017-06-30  447  			    cpu_to_le32(CONTINUE_A64_TYPE);
e84067d7 Duane Grigsby    2017-06-21  448  
e84067d7 Duane Grigsby    2017-06-21  449  			cur_dsd = (uint32_t *)cont_pkt->dseg_0_address;
e84067d7 Duane Grigsby    2017-06-21  450  			avail_dsds = 5;
e84067d7 Duane Grigsby    2017-06-21  451  		}
e84067d7 Duane Grigsby    2017-06-21  452  
e84067d7 Duane Grigsby    2017-06-21  453  		sle_dma = sg_dma_address(sg);
e84067d7 Duane Grigsby    2017-06-21  454  		*cur_dsd++ = cpu_to_le32(LSD(sle_dma));
e84067d7 Duane Grigsby    2017-06-21  455  		*cur_dsd++ = cpu_to_le32(MSD(sle_dma));
e84067d7 Duane Grigsby    2017-06-21  456  		*cur_dsd++ = cpu_to_le32(sg_dma_len(sg));
e84067d7 Duane Grigsby    2017-06-21  457  		avail_dsds--;
e84067d7 Duane Grigsby    2017-06-21  458  	}
e84067d7 Duane Grigsby    2017-06-21  459  
e84067d7 Duane Grigsby    2017-06-21  460  	/* Set total entry count. */
e84067d7 Duane Grigsby    2017-06-21  461  	cmd_pkt->entry_count = (uint8_t)req_cnt;
e84067d7 Duane Grigsby    2017-06-21  462  	wmb();
e84067d7 Duane Grigsby    2017-06-21  463  
e84067d7 Duane Grigsby    2017-06-21  464  	/* Adjust ring index. */
e84067d7 Duane Grigsby    2017-06-21  465  	req->ring_index++;
e84067d7 Duane Grigsby    2017-06-21  466  	if (req->ring_index == req->length) {
e84067d7 Duane Grigsby    2017-06-21  467  		req->ring_index = 0;
e84067d7 Duane Grigsby    2017-06-21  468  		req->ring_ptr = req->ring;
e84067d7 Duane Grigsby    2017-06-21  469  	} else {
e84067d7 Duane Grigsby    2017-06-21  470  		req->ring_ptr++;
e84067d7 Duane Grigsby    2017-06-21  471  	}
e84067d7 Duane Grigsby    2017-06-21  472  
e84067d7 Duane Grigsby    2017-06-21  473  	/* Set chip new ring index. */
e84067d7 Duane Grigsby    2017-06-21  474  	WRT_REG_DWORD(req->req_q_in, req->ring_index);
e84067d7 Duane Grigsby    2017-06-21  475  
deeae7a6 Duane Grigsby    2017-07-21  476  	/* Manage unprocessed RIO/ZIO commands in response queue. */
deeae7a6 Duane Grigsby    2017-07-21  477  	if (vha->flags.process_response_queue &&
deeae7a6 Duane Grigsby    2017-07-21 @478  	    rsp->ring_ptr->signature != RESPONSE_PROCESSED)
deeae7a6 Duane Grigsby    2017-07-21  479  		qla24xx_process_response_queue(vha, rsp);
deeae7a6 Duane Grigsby    2017-07-21  480  
e84067d7 Duane Grigsby    2017-06-21  481  queuing_error:
e84067d7 Duane Grigsby    2017-06-21  482  	spin_unlock_irqrestore(&qpair->qp_lock, flags);
e84067d7 Duane Grigsby    2017-06-21  483  	return rval;
e84067d7 Duane Grigsby    2017-06-21  484  }
e84067d7 Duane Grigsby    2017-06-21  485  

:::::: The code at line 478 was first introduced by commit
:::::: deeae7a69f755c53a68a907f336c5cee54932025 scsi: qla2xxx: Added change to enable ZIO for FC-NVMe devices

:::::: TO: Duane Grigsby <duane.grigsby@cavium.com>
:::::: CC: Martin K. Petersen <martin.petersen@oracle.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
index 6b33a1f24f56..162a523b985e 100644
--- a/drivers/scsi/qla2xxx/qla_nvme.c
+++ b/drivers/scsi/qla2xxx/qla_nvme.c
@@ -113,8 +113,6 @@  static int qla_nvme_alloc_queue(struct nvme_fc_local_port *lport,
 		return 0;
 	}
 
-	ql_log(ql_log_warn, vha, 0xffff,
-	    "allocating q for idx=%x w/o cpu mask\n", qidx);
 	qpair = qla2xxx_create_qpair(vha, 5, vha->vp_idx, true);
 	if (qpair == NULL) {
 		ql_log(ql_log_warn, vha, 0x2122,
@@ -313,7 +311,6 @@  static int qla2x00_start_nvme_mq(srb_t *sp)
 	uint16_t	avail_dsds;
 	uint32_t	*cur_dsd;
 	struct req_que *req = NULL;
-	struct rsp_que *rsp = NULL;
 	struct scsi_qla_host *vha = sp->fcport->vha;
 	struct qla_hw_data *ha = vha->hw;
 	struct qla_qpair *qpair = sp->qpair;
@@ -322,15 +319,13 @@  static int qla2x00_start_nvme_mq(srb_t *sp)
 	struct nvmefc_fcp_req *fd = nvme->u.nvme.desc;
 	uint32_t        rval = QLA_SUCCESS;
 
+	/* Setup qpair pointers */
+	req = qpair->req;
 	tot_dsds = fd->sg_cnt;
 
 	/* Acquire qpair specific lock */
 	spin_lock_irqsave(&qpair->qp_lock, flags);
 
-	/* Setup qpair pointers */
-	req = qpair->req;
-	rsp = qpair->rsp;
-
 	/* Check for room in outstanding command list. */
 	handle = req->current_outstanding_cmd;
 	for (index = 1; index < req->num_outstanding_cmds; index++) {
@@ -365,7 +360,7 @@  static int qla2x00_start_nvme_mq(srb_t *sp)
 		struct nvme_fc_cmd_iu *cmd = fd->cmdaddr;
 		if (cmd->sqe.common.opcode == nvme_admin_async_event) {
 			nvme->u.nvme.aen_op = 1;
-			atomic_inc(&vha->hw->nvme_active_aen_cnt);
+			atomic_inc(&ha->nvme_active_aen_cnt);
 		}
 	}