Re: [PATCH 2/4] qla2xxx_nvmet: Added Makefile and Kconfig changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Anil,

I love your patch! Yet something to improve:

[auto build test ERROR on scsi/for-next]
[also build test ERROR on v4.14-rc8 next-20171106]
[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-Add-FC-NVMe-Target-support/20171107-153645
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: i386-randconfig-x001-201745 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

Note: the linux-review/Himanshu-Madhani/qla2xxx-Add-FC-NVMe-Target-support/20171107-153645 HEAD 9c5e24e821aa40552221b3103bc914bc4cd42293 builds fine.
      It only hurts bisectibility.

All error/warnings (new ones prefixed by >>):

   In file included from drivers/scsi/qla2xxx/qla_nvmet.c:14:0:
   drivers/scsi/qla2xxx/qla_nvmet.h:31:25: error: field 'nvme_cmd_iu' has incomplete type
     struct atio7_nvme_cmnd nvme_cmd_iu;
                            ^~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_nvmet.c: In function 'qlt_nvmet_ls_done':
>> drivers/scsi/qla2xxx/qla_nvmet.c:48:46: error: 'struct <anonymous>' has no member named 'cmd'
     struct qla_nvmet_cmd *tgt_cmd = nvme->u.nvme.cmd;
                                                 ^
   drivers/scsi/qla2xxx/qla_nvmet.c:55:47: error: 'struct <anonymous>' has no member named 'cmd'
      sp, sp->vha, nvme->u.nvme.desc, nvme->u.nvme.cmd);
                                                  ^
   drivers/scsi/qla2xxx/qla_nvmet.c: In function 'qla_nvmet_ls_rsp':
>> drivers/scsi/qla2xxx/qla_nvmet.c:92:13: error: 'SRB_NVMET_LS' undeclared (first use in this function)
     sp->type = SRB_NVMET_LS;
                ^~~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_nvmet.c:92:13: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/scsi/qla2xxx/qla_nvmet.c:100:14: error: 'struct <anonymous>' has no member named 'exchange_address'
     nvme->u.nvme.exchange_address = tgt_cmd->atio.u.pt_ls4.exchange_address;
                 ^
>> drivers/scsi/qla2xxx/qla_nvmet.c:100:49: error: 'union <anonymous>' has no member named 'pt_ls4'
     nvme->u.nvme.exchange_address = tgt_cmd->atio.u.pt_ls4.exchange_address;
                                                    ^
>> drivers/scsi/qla2xxx/qla_nvmet.c:101:14: error: 'struct <anonymous>' has no member named 'nport_handle'
     nvme->u.nvme.nport_handle = tgt_cmd->atio.u.pt_ls4.nport_handle;
                 ^
   drivers/scsi/qla2xxx/qla_nvmet.c:101:45: error: 'union <anonymous>' has no member named 'pt_ls4'
     nvme->u.nvme.nport_handle = tgt_cmd->atio.u.pt_ls4.nport_handle;
                                                ^
>> drivers/scsi/qla2xxx/qla_nvmet.c:102:14: error: 'struct <anonymous>' has no member named 'vp_index'
     nvme->u.nvme.vp_index = tgt_cmd->atio.u.pt_ls4.vp_index;
                 ^
   drivers/scsi/qla2xxx/qla_nvmet.c:102:41: error: 'union <anonymous>' has no member named 'pt_ls4'
     nvme->u.nvme.vp_index = tgt_cmd->atio.u.pt_ls4.vp_index;
                                            ^
   drivers/scsi/qla2xxx/qla_nvmet.c:104:14: error: 'struct <anonymous>' has no member named 'cmd'
     nvme->u.nvme.cmd = tgt_cmd; /* To be freed */
                 ^
   drivers/scsi/qla2xxx/qla_nvmet.c: In function 'qla_nvmet_fcp_abort':
>> drivers/scsi/qla2xxx/qla_nvmet.c:168:13: error: 'SRB_NVMET_SEND_ABTS' undeclared (first use in this function)
     sp->type = SRB_NVMET_SEND_ABTS;
                ^~~~~~~~~~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_nvmet.c: In function 'qla_nvmet_create_targetport':
>> drivers/scsi/qla2xxx/qla_nvmet.c:226:9: error: 'ql_dbg_nvme' undeclared (first use in this function)
     ql_dbg(ql_dbg_nvme, vha, 0xe081,
            ^~~~~~~~~~~
>> drivers/scsi/qla2xxx/qla_nvmet.c:236:10: error: 'struct scsi_qla_host' has no member named 'targetport'
         &vha->targetport);
             ^~
   drivers/scsi/qla2xxx/qla_nvmet.c:243:41: error: 'struct scsi_qla_host' has no member named 'targetport'
     tport = (struct qla_nvmet_tgtport *)vha->targetport->private;
                                            ^~
   drivers/scsi/qla2xxx/qla_nvmet.c: In function 'qla_nvmet_delete':
>> drivers/scsi/qla2xxx/qla_nvmet.c:261:17: error: 'volatile struct <anonymous>' has no member named 'nvmet_enabled'; did you mean 'nvme_enabled'?
     if (!vha->flags.nvmet_enabled)
                    ^
   drivers/scsi/qla2xxx/qla_nvmet.c:263:9: error: 'struct scsi_qla_host' has no member named 'targetport'
     if (vha->targetport) {
            ^~
   drivers/scsi/qla2xxx/qla_nvmet.c:264:42: error: 'struct scsi_qla_host' has no member named 'targetport'
      tport = (struct qla_nvmet_tgtport *)vha->targetport->private;
                                             ^~
   drivers/scsi/qla2xxx/qla_nvmet.c:266:10: error: 'ql_dbg_nvme' undeclared (first use in this function)
      ql_dbg(ql_dbg_nvme, vha, 0xe083,
             ^~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_nvmet.c:269:37: error: 'struct scsi_qla_host' has no member named 'targetport'
      nvmet_fc_unregister_targetport(vha->targetport);
                                        ^~
>> drivers/scsi/qla2xxx/qla_nvmet.c:272:3: error: implicit declaration of function 'nvmet_release_sessions' [-Werror=implicit-function-declaration]
      nvmet_release_sessions(vha);
      ^~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_nvmet.c: In function 'qla_nvmet_handle_ls':
>> drivers/scsi/qla2xxx/qla_nvmet.c:300:9: error: implicit declaration of function 'qla_nvmet_find_sess_by_s_id' [-Werror=implicit-function-declaration]
     sess = qla_nvmet_find_sess_by_s_id(vha, look_up_sid);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/scsi/qla2xxx/qla_nvmet.c:300:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     sess = qla_nvmet_find_sess_by_s_id(vha, look_up_sid);
          ^
   drivers/scsi/qla2xxx/qla_nvmet.c:308:10: error: 'ql_dbg_nvme' undeclared (first use in this function)
      ql_dbg(ql_dbg_nvme, vha, 0xe084,
             ^~~~~~~~~~~
   In file included from arch/x86/include/asm/string.h:2:0,
                    from include/linux/string.h:18,
                    from include/linux/scatterlist.h:4,
                    from drivers/scsi/qla2xxx/qla_nvmet.c:8:
   drivers/scsi/qla2xxx/qla_nvmet.c:316:25: error: 'union <anonymous>' has no member named 'pt_ls4'
     memcpy(&tgt_cmd->atio.u.pt_ls4, pt_ls4, sizeof(struct pt_ls4_rx_unsol));
                            ^
   arch/x86/include/asm/string_32.h:184:42: note: in definition of macro 'memcpy'
    #define memcpy(t, f, n) __builtin_memcpy(t, f, n)
                                             ^
   drivers/scsi/qla2xxx/qla_nvmet.c:327:31: error: 'struct scsi_qla_host' has no member named 'targetport'
     ret = nvmet_fc_rcv_ls_req(vha->targetport,
                                  ^~
   drivers/scsi/qla2xxx/qla_nvmet.c: In function 'qla_nvmet_process_cmd':
   drivers/scsi/qla2xxx/qla_nvmet.c:360:32: error: 'struct scsi_qla_host' has no member named 'targetport'
     ret = nvmet_fc_rcv_fcp_req(vha->targetport, &tgt_cmd->cmd.fcp_req,
                                   ^~
   drivers/scsi/qla2xxx/qla_nvmet.c: In function 'qla_nvmet_handle_abts':
   drivers/scsi/qla2xxx/qla_nvmet.c:400:28: error: 'struct scsi_qla_host' has no member named 'targetport'
     nvmet_fc_rcv_fcp_abort(vha->targetport, &cmd->cmd.fcp_req);
                               ^~
   drivers/scsi/qla2xxx/qla_nvmet.c: In function 'qla_nvmet_send_resp_ctio':
>> drivers/scsi/qla2xxx/qla_nvmet.c:456:34: error: 'union <anonymous>' has no member named 'nvme_isp27'
     struct fcp_hdr *fchdr = &atio->u.nvme_isp27.fcp_hdr;
                                     ^
>> drivers/scsi/qla2xxx/qla_nvmet.c:477:13: error: 'SRB_NVMET_FCP' undeclared (first use in this function)
     sp->type = SRB_NVMET_FCP;
                ^~~~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_nvmet.c:481:23: error: 'struct <anonymous>' has no member named 'cmd'
     sp->u.iocb_cmd.u.nvme.cmd = cmd;
                          ^
   drivers/scsi/qla2xxx/qla_nvmet.c:485:10: error: 'ql_dbg_nvme' undeclared (first use in this function)
      ql_dbg(ql_dbg_nvme, vha, 0x3067,
             ^~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_nvmet.c:501:31: error: 'union <anonymous>' has no member named 'nvme_isp27'
     ctio->exchange_addr = atio->u.nvme_isp27.exchange_addr;
                                  ^
   drivers/scsi/qla2xxx/qla_nvmet.c:505:19: error: 'union <anonymous>' has no member named 'nvme_isp27'
     c_flags = atio->u.nvme_isp27.attr << 9;
                      ^
   drivers/scsi/qla2xxx/qla_nvmet.c: In function 'qla_nvmet_send_abts_ctio':
>> drivers/scsi/qla2xxx/qla_nvmet.c:731:13: error: 'SRB_NVMET_ABTS' undeclared (first use in this function)
     sp->type = SRB_NVMET_ABTS;
                ^~~~~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_nvmet.c:737:10: error: 'ql_dbg_nvme' undeclared (first use in this function)
      ql_dbg(ql_dbg_nvme, vha, 0x3067,
             ^~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +48 drivers/scsi/qla2xxx/qla_nvmet.c

3465c5ae Anil Gurumurthy 2017-11-06   12  
3465c5ae Anil Gurumurthy 2017-11-06   13  #include "qla_nvme.h"
3465c5ae Anil Gurumurthy 2017-11-06  @14  #include "qla_nvmet.h"
3465c5ae Anil Gurumurthy 2017-11-06   15  
3465c5ae Anil Gurumurthy 2017-11-06   16  #if	IS_ENABLED(CONFIG_NVME_TARGET_FC)
3465c5ae Anil Gurumurthy 2017-11-06   17  static void qla_nvmet_send_resp_ctio(struct qla_qpair *qpair,
3465c5ae Anil Gurumurthy 2017-11-06   18  	struct qla_nvmet_cmd *cmd, struct nvmefc_tgt_fcp_req *rsp);
3465c5ae Anil Gurumurthy 2017-11-06   19  static void qla_nvmet_send_abts_ctio(struct scsi_qla_host *vha,
3465c5ae Anil Gurumurthy 2017-11-06   20  		struct abts_recv_from_24xx *abts, bool flag);
3465c5ae Anil Gurumurthy 2017-11-06   21  
3465c5ae Anil Gurumurthy 2017-11-06   22  /*
3465c5ae Anil Gurumurthy 2017-11-06   23   * qla_nvmet_targetport_delete -
3465c5ae Anil Gurumurthy 2017-11-06   24   * Invoked by the nvmet to indicate that the target port has
3465c5ae Anil Gurumurthy 2017-11-06   25   * been deleted
3465c5ae Anil Gurumurthy 2017-11-06   26   */
3465c5ae Anil Gurumurthy 2017-11-06   27  static void
3465c5ae Anil Gurumurthy 2017-11-06   28  qla_nvmet_targetport_delete(struct nvmet_fc_target_port *targetport)
3465c5ae Anil Gurumurthy 2017-11-06   29  {
3465c5ae Anil Gurumurthy 2017-11-06   30  	struct qla_nvmet_tgtport *tport = targetport->private;
3465c5ae Anil Gurumurthy 2017-11-06   31  
3465c5ae Anil Gurumurthy 2017-11-06   32  	complete(&tport->tport_del);
3465c5ae Anil Gurumurthy 2017-11-06   33  }
3465c5ae Anil Gurumurthy 2017-11-06   34  #endif
3465c5ae Anil Gurumurthy 2017-11-06   35  
3465c5ae Anil Gurumurthy 2017-11-06   36  #if	IS_ENABLED(CONFIG_NVME_TARGET_FC)
3465c5ae Anil Gurumurthy 2017-11-06   37  /*
3465c5ae Anil Gurumurthy 2017-11-06   38   * qlt_nvmet_ls_done -
3465c5ae Anil Gurumurthy 2017-11-06   39   * Invoked by the firmware interface to indicate the completion
3465c5ae Anil Gurumurthy 2017-11-06   40   * of an LS cmd
3465c5ae Anil Gurumurthy 2017-11-06   41   * Free all associated resources of the LS cmd
3465c5ae Anil Gurumurthy 2017-11-06   42   */
3465c5ae Anil Gurumurthy 2017-11-06   43  static void qlt_nvmet_ls_done(void *ptr, int res)
3465c5ae Anil Gurumurthy 2017-11-06   44  {
3465c5ae Anil Gurumurthy 2017-11-06   45  	struct srb *sp = ptr;
3465c5ae Anil Gurumurthy 2017-11-06   46  	struct srb_iocb   *nvme = &sp->u.iocb_cmd;
3465c5ae Anil Gurumurthy 2017-11-06   47  	struct nvmefc_tgt_ls_req *rsp = nvme->u.nvme.desc;
3465c5ae Anil Gurumurthy 2017-11-06  @48  	struct qla_nvmet_cmd *tgt_cmd = nvme->u.nvme.cmd;
3465c5ae Anil Gurumurthy 2017-11-06   49  
3465c5ae Anil Gurumurthy 2017-11-06   50  	ql_log(ql_log_info, sp->vha, 0x11000,
3465c5ae Anil Gurumurthy 2017-11-06   51  		"Done with NVME LS4 req\n");
3465c5ae Anil Gurumurthy 2017-11-06   52  
3465c5ae Anil Gurumurthy 2017-11-06   53  	ql_log(ql_log_info, sp->vha, 0x11001,
3465c5ae Anil Gurumurthy 2017-11-06   54  		"sp: %p vha: %p, rsp: %p, cmd: %p\n",
3465c5ae Anil Gurumurthy 2017-11-06  @55  		sp, sp->vha, nvme->u.nvme.desc, nvme->u.nvme.cmd);
3465c5ae Anil Gurumurthy 2017-11-06   56  
3465c5ae Anil Gurumurthy 2017-11-06   57  	rsp->done(rsp);
3465c5ae Anil Gurumurthy 2017-11-06   58  	/* Free tgt_cmd */
3465c5ae Anil Gurumurthy 2017-11-06   59  	kfree(tgt_cmd->buf);
3465c5ae Anil Gurumurthy 2017-11-06   60  	kfree(tgt_cmd);
3465c5ae Anil Gurumurthy 2017-11-06   61  	qla2x00_rel_sp(sp);
3465c5ae Anil Gurumurthy 2017-11-06   62  }
3465c5ae Anil Gurumurthy 2017-11-06   63  
3465c5ae Anil Gurumurthy 2017-11-06   64  /*
3465c5ae Anil Gurumurthy 2017-11-06   65   * qla_nvmet_ls_rsp -
3465c5ae Anil Gurumurthy 2017-11-06   66   * Invoked by the nvme-t to complete the LS req.
3465c5ae Anil Gurumurthy 2017-11-06   67   * Prepare and send a response CTIO to the firmware.
3465c5ae Anil Gurumurthy 2017-11-06   68   */
3465c5ae Anil Gurumurthy 2017-11-06   69  static int
3465c5ae Anil Gurumurthy 2017-11-06   70  qla_nvmet_ls_rsp(struct nvmet_fc_target_port *tgtport,
3465c5ae Anil Gurumurthy 2017-11-06   71  			struct nvmefc_tgt_ls_req *rsp)
3465c5ae Anil Gurumurthy 2017-11-06   72  {
3465c5ae Anil Gurumurthy 2017-11-06   73  	struct qla_nvmet_cmd *tgt_cmd =
3465c5ae Anil Gurumurthy 2017-11-06   74  		container_of(rsp, struct qla_nvmet_cmd, cmd.ls_req);
3465c5ae Anil Gurumurthy 2017-11-06   75  	struct scsi_qla_host *vha = tgt_cmd->vha;
3465c5ae Anil Gurumurthy 2017-11-06   76  	struct srb_iocb   *nvme;
3465c5ae Anil Gurumurthy 2017-11-06   77  	int     rval = QLA_FUNCTION_FAILED;
3465c5ae Anil Gurumurthy 2017-11-06   78  	srb_t *sp;
3465c5ae Anil Gurumurthy 2017-11-06   79  
3465c5ae Anil Gurumurthy 2017-11-06   80  	ql_log(ql_log_info, vha, 0x11002,
3465c5ae Anil Gurumurthy 2017-11-06   81  		"Dumping the NVMET-LS response buffer\n");
3465c5ae Anil Gurumurthy 2017-11-06   82  	ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x2075,
3465c5ae Anil Gurumurthy 2017-11-06   83  		(uint8_t *)rsp->rspbuf, rsp->rsplen);
3465c5ae Anil Gurumurthy 2017-11-06   84  
3465c5ae Anil Gurumurthy 2017-11-06   85  	/* Alloc SRB structure */
3465c5ae Anil Gurumurthy 2017-11-06   86  	sp = qla2x00_get_sp(vha, NULL, GFP_ATOMIC);
3465c5ae Anil Gurumurthy 2017-11-06   87  	if (!sp) {
3465c5ae Anil Gurumurthy 2017-11-06   88  		ql_log(ql_log_info, vha, 0x11003, "Failed to allocate SRB\n");
3465c5ae Anil Gurumurthy 2017-11-06   89  		return -ENOMEM;
3465c5ae Anil Gurumurthy 2017-11-06   90  	}
3465c5ae Anil Gurumurthy 2017-11-06   91  
3465c5ae Anil Gurumurthy 2017-11-06  @92  	sp->type = SRB_NVMET_LS;
3465c5ae Anil Gurumurthy 2017-11-06   93  	sp->done = qlt_nvmet_ls_done;
3465c5ae Anil Gurumurthy 2017-11-06   94  	sp->vha = vha;
3465c5ae Anil Gurumurthy 2017-11-06   95  	sp->fcport = tgt_cmd->fcport;
3465c5ae Anil Gurumurthy 2017-11-06   96  
3465c5ae Anil Gurumurthy 2017-11-06   97  	nvme = &sp->u.iocb_cmd;
3465c5ae Anil Gurumurthy 2017-11-06   98  	nvme->u.nvme.rsp_dma = rsp->rspdma;
3465c5ae Anil Gurumurthy 2017-11-06   99  	nvme->u.nvme.rsp_len = rsp->rsplen;
3465c5ae Anil Gurumurthy 2017-11-06 @100  	nvme->u.nvme.exchange_address = tgt_cmd->atio.u.pt_ls4.exchange_address;
3465c5ae Anil Gurumurthy 2017-11-06 @101  	nvme->u.nvme.nport_handle = tgt_cmd->atio.u.pt_ls4.nport_handle;
3465c5ae Anil Gurumurthy 2017-11-06 @102  	nvme->u.nvme.vp_index = tgt_cmd->atio.u.pt_ls4.vp_index;
3465c5ae Anil Gurumurthy 2017-11-06  103  
3465c5ae Anil Gurumurthy 2017-11-06 @104  	nvme->u.nvme.cmd = tgt_cmd; /* To be freed */
3465c5ae Anil Gurumurthy 2017-11-06  105  	nvme->u.nvme.desc = rsp; /* Call back to nvmet */
3465c5ae Anil Gurumurthy 2017-11-06  106  
3465c5ae Anil Gurumurthy 2017-11-06  107  	rval = qla2x00_start_sp(sp);
3465c5ae Anil Gurumurthy 2017-11-06  108  	if (rval != QLA_SUCCESS) {
3465c5ae Anil Gurumurthy 2017-11-06  109  		ql_log(ql_log_warn, vha, 0x11004,
3465c5ae Anil Gurumurthy 2017-11-06  110  			"qla2x00_start_sp failed = %d\n", rval);
3465c5ae Anil Gurumurthy 2017-11-06  111  		return rval;
3465c5ae Anil Gurumurthy 2017-11-06  112  	}
3465c5ae Anil Gurumurthy 2017-11-06  113  
3465c5ae Anil Gurumurthy 2017-11-06  114  	return 0;
3465c5ae Anil Gurumurthy 2017-11-06  115  }
3465c5ae Anil Gurumurthy 2017-11-06  116  
3465c5ae Anil Gurumurthy 2017-11-06  117  /*
3465c5ae Anil Gurumurthy 2017-11-06  118   * qla_nvmet_fcp_op -
3465c5ae Anil Gurumurthy 2017-11-06  119   * Invoked by the nvme-t to complete the IO.
3465c5ae Anil Gurumurthy 2017-11-06  120   * Prepare and send a response CTIO to the firmware.
3465c5ae Anil Gurumurthy 2017-11-06  121   */
3465c5ae Anil Gurumurthy 2017-11-06  122  static int
3465c5ae Anil Gurumurthy 2017-11-06  123  qla_nvmet_fcp_op(struct nvmet_fc_target_port *tgtport,
3465c5ae Anil Gurumurthy 2017-11-06  124  			struct nvmefc_tgt_fcp_req *rsp)
3465c5ae Anil Gurumurthy 2017-11-06  125  {
3465c5ae Anil Gurumurthy 2017-11-06  126  	struct qla_nvmet_cmd *tgt_cmd =
3465c5ae Anil Gurumurthy 2017-11-06  127  		container_of(rsp, struct qla_nvmet_cmd, cmd.fcp_req);
3465c5ae Anil Gurumurthy 2017-11-06  128  	struct scsi_qla_host *vha = tgt_cmd->vha;
3465c5ae Anil Gurumurthy 2017-11-06  129  
3465c5ae Anil Gurumurthy 2017-11-06  130  	/* Prepare and send CTIO 82h */
3465c5ae Anil Gurumurthy 2017-11-06  131  	qla_nvmet_send_resp_ctio(vha->qpair, tgt_cmd, rsp);
3465c5ae Anil Gurumurthy 2017-11-06  132  
3465c5ae Anil Gurumurthy 2017-11-06  133  	return 0;
3465c5ae Anil Gurumurthy 2017-11-06  134  }
3465c5ae Anil Gurumurthy 2017-11-06  135  /*
3465c5ae Anil Gurumurthy 2017-11-06  136   * qla_nvmet_fcp_abort_done
3465c5ae Anil Gurumurthy 2017-11-06  137   * free up the used resources
3465c5ae Anil Gurumurthy 2017-11-06  138   */
3465c5ae Anil Gurumurthy 2017-11-06  139  static void qla_nvmet_fcp_abort_done(void *ptr, int res)
3465c5ae Anil Gurumurthy 2017-11-06  140  {
3465c5ae Anil Gurumurthy 2017-11-06  141  	srb_t *sp = ptr;
3465c5ae Anil Gurumurthy 2017-11-06  142  
3465c5ae Anil Gurumurthy 2017-11-06  143  	qla2x00_rel_sp(sp);
3465c5ae Anil Gurumurthy 2017-11-06  144  }
3465c5ae Anil Gurumurthy 2017-11-06  145  
3465c5ae Anil Gurumurthy 2017-11-06  146  /*
3465c5ae Anil Gurumurthy 2017-11-06  147   * qla_nvmet_fcp_abort -
3465c5ae Anil Gurumurthy 2017-11-06  148   * Invoked by the nvme-t to abort an IO
3465c5ae Anil Gurumurthy 2017-11-06  149   * Send an abort to the firmware
3465c5ae Anil Gurumurthy 2017-11-06  150   */
3465c5ae Anil Gurumurthy 2017-11-06  151  static void
3465c5ae Anil Gurumurthy 2017-11-06  152  qla_nvmet_fcp_abort(struct nvmet_fc_target_port *tgtport,
3465c5ae Anil Gurumurthy 2017-11-06  153  			struct nvmefc_tgt_fcp_req *req)
3465c5ae Anil Gurumurthy 2017-11-06  154  {
3465c5ae Anil Gurumurthy 2017-11-06  155  	struct qla_nvmet_cmd *tgt_cmd =
3465c5ae Anil Gurumurthy 2017-11-06  156  		container_of(req, struct qla_nvmet_cmd, cmd.fcp_req);
3465c5ae Anil Gurumurthy 2017-11-06  157  	struct scsi_qla_host *vha = tgt_cmd->vha;
3465c5ae Anil Gurumurthy 2017-11-06  158  	struct qla_hw_data *ha = vha->hw;
3465c5ae Anil Gurumurthy 2017-11-06  159  	srb_t *sp;
3465c5ae Anil Gurumurthy 2017-11-06  160  
3465c5ae Anil Gurumurthy 2017-11-06  161  	/* Alloc SRB structure */
3465c5ae Anil Gurumurthy 2017-11-06  162  	sp = qla2x00_get_sp(vha, NULL, GFP_KERNEL);
3465c5ae Anil Gurumurthy 2017-11-06  163  	if (!sp) {
3465c5ae Anil Gurumurthy 2017-11-06  164  		ql_log(ql_log_info, vha, 0x11005, "Failed to allocate SRB\n");
3465c5ae Anil Gurumurthy 2017-11-06  165  		return;
3465c5ae Anil Gurumurthy 2017-11-06  166  	}
3465c5ae Anil Gurumurthy 2017-11-06  167  
3465c5ae Anil Gurumurthy 2017-11-06 @168  	sp->type = SRB_NVMET_SEND_ABTS;
3465c5ae Anil Gurumurthy 2017-11-06  169  	sp->done = qla_nvmet_fcp_abort_done;
3465c5ae Anil Gurumurthy 2017-11-06  170  	sp->vha = vha;
3465c5ae Anil Gurumurthy 2017-11-06  171  	sp->fcport = tgt_cmd->fcport;
3465c5ae Anil Gurumurthy 2017-11-06  172  
3465c5ae Anil Gurumurthy 2017-11-06  173  	ha->isp_ops->abort_command(sp);
3465c5ae Anil Gurumurthy 2017-11-06  174  
3465c5ae Anil Gurumurthy 2017-11-06  175  }
3465c5ae Anil Gurumurthy 2017-11-06  176  
3465c5ae Anil Gurumurthy 2017-11-06  177  /*
3465c5ae Anil Gurumurthy 2017-11-06  178   * qla_nvmet_fcp_req_release -
3465c5ae Anil Gurumurthy 2017-11-06  179   * Delete the cmd from the list and free the cmd
3465c5ae Anil Gurumurthy 2017-11-06  180   */
3465c5ae Anil Gurumurthy 2017-11-06  181  
3465c5ae Anil Gurumurthy 2017-11-06  182  static void
3465c5ae Anil Gurumurthy 2017-11-06  183  qla_nvmet_fcp_req_release(struct nvmet_fc_target_port *tgtport,
3465c5ae Anil Gurumurthy 2017-11-06  184  			struct nvmefc_tgt_fcp_req *rsp)
3465c5ae Anil Gurumurthy 2017-11-06  185  {
3465c5ae Anil Gurumurthy 2017-11-06  186  	struct qla_nvmet_cmd *tgt_cmd =
3465c5ae Anil Gurumurthy 2017-11-06  187  		container_of(rsp, struct qla_nvmet_cmd, cmd.fcp_req);
3465c5ae Anil Gurumurthy 2017-11-06  188  	scsi_qla_host_t *vha = tgt_cmd->vha;
3465c5ae Anil Gurumurthy 2017-11-06  189  	unsigned long flags;
3465c5ae Anil Gurumurthy 2017-11-06  190  
3465c5ae Anil Gurumurthy 2017-11-06  191  	spin_lock_irqsave(&vha->cmd_list_lock, flags);
3465c5ae Anil Gurumurthy 2017-11-06  192  	list_del(&tgt_cmd->cmd_list);
3465c5ae Anil Gurumurthy 2017-11-06  193  	spin_unlock_irqrestore(&vha->cmd_list_lock, flags);
3465c5ae Anil Gurumurthy 2017-11-06  194  
3465c5ae Anil Gurumurthy 2017-11-06  195  	kfree(tgt_cmd);
3465c5ae Anil Gurumurthy 2017-11-06  196  }
3465c5ae Anil Gurumurthy 2017-11-06  197  
3465c5ae Anil Gurumurthy 2017-11-06  198  static struct nvmet_fc_target_template qla_nvmet_fc_transport = {
3465c5ae Anil Gurumurthy 2017-11-06  199  	.targetport_delete	= qla_nvmet_targetport_delete,
3465c5ae Anil Gurumurthy 2017-11-06  200  	.xmt_ls_rsp		= qla_nvmet_ls_rsp,
3465c5ae Anil Gurumurthy 2017-11-06  201  	.fcp_op			= qla_nvmet_fcp_op,
3465c5ae Anil Gurumurthy 2017-11-06  202  	.fcp_abort		= qla_nvmet_fcp_abort,
3465c5ae Anil Gurumurthy 2017-11-06  203  	.fcp_req_release	= qla_nvmet_fcp_req_release,
3465c5ae Anil Gurumurthy 2017-11-06  204  	.max_hw_queues		= 8,
3465c5ae Anil Gurumurthy 2017-11-06  205  	.max_sgl_segments	= 128,
3465c5ae Anil Gurumurthy 2017-11-06  206  	.max_dif_sgl_segments	= 64,
3465c5ae Anil Gurumurthy 2017-11-06  207  	.dma_boundary		= 0xFFFFFFFF,
3465c5ae Anil Gurumurthy 2017-11-06  208  	.target_features	= NVMET_FCTGTFEAT_READDATA_RSP |
3465c5ae Anil Gurumurthy 2017-11-06  209  					NVMET_FCTGTFEAT_CMD_IN_ISR |
3465c5ae Anil Gurumurthy 2017-11-06  210  					NVMET_FCTGTFEAT_OPDONE_IN_ISR,
3465c5ae Anil Gurumurthy 2017-11-06  211  	.target_priv_sz	= sizeof(struct nvme_private),
3465c5ae Anil Gurumurthy 2017-11-06  212  };
3465c5ae Anil Gurumurthy 2017-11-06  213  #endif
3465c5ae Anil Gurumurthy 2017-11-06  214  /*
3465c5ae Anil Gurumurthy 2017-11-06  215   * qla_nvmet_create_targetport -
3465c5ae Anil Gurumurthy 2017-11-06  216   * Create a targetport. Registers the template with the nvme-t
3465c5ae Anil Gurumurthy 2017-11-06  217   * layer
3465c5ae Anil Gurumurthy 2017-11-06  218   */
3465c5ae Anil Gurumurthy 2017-11-06  219  int qla_nvmet_create_targetport(struct scsi_qla_host *vha)
3465c5ae Anil Gurumurthy 2017-11-06  220  {
3465c5ae Anil Gurumurthy 2017-11-06  221  #if	IS_ENABLED(CONFIG_NVME_TARGET_FC)
3465c5ae Anil Gurumurthy 2017-11-06  222  	struct nvmet_fc_port_info pinfo;
3465c5ae Anil Gurumurthy 2017-11-06  223  	struct qla_nvmet_tgtport *tport;
3465c5ae Anil Gurumurthy 2017-11-06  224  	int error = 0;
3465c5ae Anil Gurumurthy 2017-11-06  225  
3465c5ae Anil Gurumurthy 2017-11-06 @226  	ql_dbg(ql_dbg_nvme, vha, 0xe081,
3465c5ae Anil Gurumurthy 2017-11-06  227  		"Creating target port for :%p\n", vha);
3465c5ae Anil Gurumurthy 2017-11-06  228  
3465c5ae Anil Gurumurthy 2017-11-06  229  	memset(&pinfo, 0, (sizeof(struct nvmet_fc_port_info)));
3465c5ae Anil Gurumurthy 2017-11-06  230  	pinfo.node_name = wwn_to_u64(vha->node_name);
3465c5ae Anil Gurumurthy 2017-11-06  231  	pinfo.port_name = wwn_to_u64(vha->port_name);
3465c5ae Anil Gurumurthy 2017-11-06  232  	pinfo.port_id	= vha->d_id.b24;
3465c5ae Anil Gurumurthy 2017-11-06  233  
3465c5ae Anil Gurumurthy 2017-11-06  234  	error = nvmet_fc_register_targetport(&pinfo,
3465c5ae Anil Gurumurthy 2017-11-06  235  	    &qla_nvmet_fc_transport, &vha->hw->pdev->dev,
3465c5ae Anil Gurumurthy 2017-11-06 @236  	    &vha->targetport);
3465c5ae Anil Gurumurthy 2017-11-06  237  
3465c5ae Anil Gurumurthy 2017-11-06  238  	if (error) {
3465c5ae Anil Gurumurthy 2017-11-06  239  		ql_dbg(ql_dbg_nvme, vha, 0xe082,
3465c5ae Anil Gurumurthy 2017-11-06  240  			"Cannot register NVME transport:%d\n", error);
3465c5ae Anil Gurumurthy 2017-11-06  241  		return error;
3465c5ae Anil Gurumurthy 2017-11-06  242  	}
3465c5ae Anil Gurumurthy 2017-11-06  243  	tport = (struct qla_nvmet_tgtport *)vha->targetport->private;
3465c5ae Anil Gurumurthy 2017-11-06  244  	tport->vha = vha;
3465c5ae Anil Gurumurthy 2017-11-06  245  	ql_dbg(ql_dbg_nvme, vha, 0xe082,
3465c5ae Anil Gurumurthy 2017-11-06  246  		" Registered NVME transport:%p WWPN:%llx\n",
3465c5ae Anil Gurumurthy 2017-11-06  247  		tport, pinfo.port_name);
3465c5ae Anil Gurumurthy 2017-11-06  248  #endif
3465c5ae Anil Gurumurthy 2017-11-06  249  	return 0;
3465c5ae Anil Gurumurthy 2017-11-06  250  }
3465c5ae Anil Gurumurthy 2017-11-06  251  

:::::: The code at line 48 was first introduced by commit
:::::: 3465c5aeb3161f2f168841ded707571ffe38d136 qla2xxx_nvmet: Add files for FC-NVMe Target support

:::::: TO: Anil Gurumurthy <anil.gurumurthy@xxxxxxxxxx>
:::::: CC: 0day robot <fengguang.wu@xxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux