diff --git a/fcst/fcst.h b/fcst/fcst.h index 8b3c44406..60c508656 100644 --- a/fcst/fcst.h +++ b/fcst/fcst.h @@ -19,9 +19,15 @@ #ifdef INSIDE_KERNEL_TREE #include +#define NEW_LIBFC_API #else #include #include "scst.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) || \ + defined(CONFIG_SUSE_KERNEL) && \ + LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) +#define NEW_LIBFC_API +#endif #endif #define FT_VERSION "3.3.0-rc" diff --git a/fcst/ft_cmd.c b/fcst/ft_cmd.c index b99880c1a..429e5e33c 100644 --- a/fcst/ft_cmd.c +++ b/fcst/ft_cmd.c @@ -256,12 +256,12 @@ static void ft_cmd_done(struct ft_cmd *fcmd) { struct fc_frame *fp = fcmd->req_frame; struct fc_seq *sp = fcmd->seq; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API struct fc_lport *lport = fr_dev(fp); #endif if (sp) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#ifdef NEW_LIBFC_API fc_exch_done(sp); #else lport->tt.exch_done(sp); @@ -269,7 +269,7 @@ static void ft_cmd_done(struct ft_cmd *fcmd) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) if (fr_seq(fp)) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#ifdef NEW_LIBFC_API fc_seq_release(fr_seq(fp)); #else lport->tt.seq_release(fr_seq(fp)); @@ -395,7 +395,7 @@ int ft_send_response(struct scst_cmd *cmd) /* * Send response. */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#ifdef NEW_LIBFC_API fcmd->seq = fc_seq_start_next(fcmd->seq); #else fcmd->seq = lport->tt.seq_start_next(fcmd->seq); @@ -403,7 +403,7 @@ int ft_send_response(struct scst_cmd *cmd) fc_fill_fc_hdr(fp, FC_RCTL_DD_CMD_STATUS, ep->did, ep->sid, FC_TYPE_FCP, FC_FC_EX_CTX | FC_FC_LAST_SEQ | FC_FC_END_SEQ, 0); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#ifdef NEW_LIBFC_API error = FCST_INJ_SEND_ERR(fc_seq_send(lport, fcmd->seq, fp)); #else error = FCST_INJ_SEND_ERR(lport->tt.seq_send(lport, fcmd->seq, fp)); @@ -505,14 +505,14 @@ int ft_send_xfer_rdy(struct scst_cmd *cmd) txrdy->ft_data_ro = 0; txrdy->ft_burst_len = htonl(scst_cmd_get_bufflen(cmd)); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#ifdef NEW_LIBFC_API fcmd->seq = fc_seq_start_next(fcmd->seq); #else fcmd->seq = lport->tt.seq_start_next(fcmd->seq); #endif fc_fill_fc_hdr(fp, FC_RCTL_DD_DATA_DESC, ep->did, ep->sid, FC_TYPE_FCP, FC_FC_EX_CTX | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#ifdef NEW_LIBFC_API error = FCST_INJ_SEND_ERR(fc_seq_send(lport, fcmd->seq, fp)); #else error = FCST_INJ_SEND_ERR(lport->tt.seq_send(lport, fcmd->seq, fp)); @@ -586,7 +586,7 @@ out: fc_fill_reply_hdr(fp, rx_fp, FC_RCTL_DD_CMD_STATUS, 0); sp = fr_seq(fp); if (sp) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#ifdef NEW_LIBFC_API fc_seq_send(lport, sp, fp); #else lport->tt.seq_send(lport, sp, fp); @@ -718,7 +718,7 @@ static void ft_recv_cmd(struct ft_sess *sess, struct fc_frame *fp) #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36) sp = fr_seq(fp); #else -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#ifdef NEW_LIBFC_API sp = fc_seq_assign(lport, fp); #else sp = lport->tt.seq_assign(lport, fp); @@ -771,7 +771,7 @@ static void ft_recv_cmd(struct ft_sess *sess, struct fc_frame *fp) cmd->state = FT_STATE_NEW; fcmd->seq = sp; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#ifdef NEW_LIBFC_API fc_seq_set_resp(sp, ft_recv_seq, cmd); #else lport->tt.seq_set_resp(sp, ft_recv_seq, cmd); @@ -824,7 +824,7 @@ busy: if (fcmd) ft_cmd_done(fcmd); else if (sp) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#ifdef NEW_LIBFC_API fc_exch_done(sp); #else lport->tt.exch_done(sp); @@ -867,7 +867,7 @@ static void ft_cmd_ls_rjt(struct fc_frame *rx_fp, enum fc_els_rjt_reason reason, lport = fr_dev(rx_fp); rjt_data.reason = reason; rjt_data.explan = explan; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#ifdef NEW_LIBFC_API fc_seq_els_rsp_send(rx_fp, ELS_LS_RJT, &rjt_data); #else lport->tt.seq_els_rsp_send(rx_fp, ELS_LS_RJT, &rjt_data); diff --git a/fcst/ft_io.c b/fcst/ft_io.c index 42639cbc5..a2f0bc2fb 100644 --- a/fcst/ft_io.c +++ b/fcst/ft_io.c @@ -89,7 +89,7 @@ int ft_send_read_data(struct scst_cmd *cmd) mem_len -= tlen; mem_off = tlen; } else -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#ifdef NEW_LIBFC_API fcmd->seq = fc_seq_start_next(fcmd->seq); #else fcmd->seq = lport->tt.seq_start_next(fcmd->seq); @@ -179,7 +179,7 @@ int ft_send_read_data(struct scst_cmd *cmd) remaining ? (FC_FC_EX_CTX | FC_FC_REL_OFF) : (FC_FC_EX_CTX | FC_FC_REL_OFF | FC_FC_END_SEQ), fh_off); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#ifdef NEW_LIBFC_API error = FCST_INJ_SEND_ERR(fc_seq_send(lport, fcmd->seq, fp)); #else error = FCST_INJ_SEND_ERR(lport->tt.seq_send(lport, fcmd->seq, diff --git a/iscsi-scst/Makefile b/iscsi-scst/Makefile index 7b98dd1e1..31007ca6a 100644 --- a/iscsi-scst/Makefile +++ b/iscsi-scst/Makefile @@ -65,23 +65,28 @@ OFED_CFLAGS:= OFED_FLAVOR=$(shell if [ -e /usr/bin/ofed_info ]; then /usr/bin/ofed_info 2>/dev/null | head -n1 | sed -n 's/^\(MLNX_OFED\|OFED-internal\).*/MOFED/p;s/^OFED-.*/OFED/p'; else echo in-tree; fi) ifeq ($(OFED_FLAVOR),MOFED) - # Whether MLNX_OFED for ubuntu has been installed - MLNX_OFED_IB_UBUNTU_INSTALLED:=$(shell if dpkg -s mlnx-ofed-kernel-dkms >/dev/null 2>/dev/null; then echo true; else echo false; fi) - - # Whether MLNX_OFED for RedHat has been installed - MLNX_OFED_IB_RH_INSTALLED:=$(shell if { rpm -q mlnx-ofa_kernel-devel || rpm -q kernel-ib-devel; } >&/dev/null; then echo true; else echo false; fi) - - ifeq ($(MLNX_OFED_IB_UBUNTU_INSTALLED),true) - OFED_VERS=$(shell dpkg -s mlnx-ofed-kernel-dkms | awk -F\- '/Version/ {print $$1}' | awk '{print $$2}') - OFED_DIR:=/var/lib/dkms/mlnx-ofed-kernel/$(OFED_VERS)/build - endif - - ifeq ($(MLNX_OFED_IB_RH_INSTALLED),true) + ifeq ($(shell if dpkg -s mlnx-ofed-kernel-dkms >/dev/null 2>&1; then \ + echo true; \ + else \ + echo false; \ + fi),true) + OFED_VERS=$(shell dpkg-query -W --showformat='${Version}\n' mlnx-ofed-kernel-dkms) + else + ifeq ($(shell if { rpm -q mlnx-ofa_kernel-devel || \ + rpm -q kernel-ib-devel; } >&/dev/null; then \ + echo true; \ + else \ + echo false; \ + fi),true) OFED_VERS=$(shell rpm -q --qf '%{version}\n' mlnx-ofa_kernel-devel \ 2>/dev/null) - OFED_DIR:=/usr/src/ofa_kernel/default + else + echo := $(shell echo "Error: MLNX OFED has not been installed" >&2) + endif endif + echo := $(shell echo "OFED_VERS = $(OFED_VERS)" >&2) + OFED_DIR:=/usr/src/ofa_kernel/default OFED_CFLAGS:= -I$(OFED_DIR)/include \ -I$(OFED_DIR)/include/uapi \ -include $(OFED_DIR)/include/linux/compat-2.6.h \ diff --git a/iscsi-scst/kernel/isert-scst/iser_rdma.c b/iscsi-scst/kernel/isert-scst/iser_rdma.c index 10051f7cd..c97924d01 100644 --- a/iscsi-scst/kernel/isert-scst/iser_rdma.c +++ b/iscsi-scst/kernel/isert-scst/iser_rdma.c @@ -989,7 +989,8 @@ static struct isert_device *isert_device_create(struct ib_device *ib_dev) sizeof(*isert_dev->cq_qps), GFP_KERNEL); if (unlikely(isert_dev->cq_qps == NULL)) { - PRINT_ERROR("Failed to allocate iser cq_qps"); + PRINT_ERROR("Failed to allocate %d iser cq_qps", + isert_dev->num_cqs); err = -ENOMEM; goto free_isert_dev; } diff --git a/nightly/conf/nightly.conf b/nightly/conf/nightly.conf index ca015c27b..dd9629e0f 100644 --- a/nightly/conf/nightly.conf +++ b/nightly/conf/nightly.conf @@ -3,7 +3,8 @@ ABT_DETAILS="x86_64" ABT_JOBS=5 ABT_KERNELS=" \ -4.12.9 \ +4.13.4 \ +4.12.14-nc \ 4.11.12-nc \ 4.10.17-nc \ 4.9.45-nc \ diff --git a/qla2x00t/qla_bsg.c b/qla2x00t/qla_bsg.c index 214552766..587374b1b 100644 --- a/qla2x00t/qla_bsg.c +++ b/qla2x00t/qla_bsg.c @@ -16,14 +16,14 @@ qla2x00_bsg_job_done(void *data, void *ptr, int res) { srb_t *sp = (srb_t*)ptr; struct scsi_qla_host *vha = (scsi_qla_host_t *)data; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API struct fc_bsg_job *bsg_job = sp->u.bsg_job; #else struct bsg_job *bsg_job = sp->u.bsg_job; struct fc_bsg_reply *bsg_reply = bsg_job->reply; #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = res; bsg_job->job_done(bsg_job); #else @@ -39,7 +39,7 @@ qla2x00_bsg_sp_free(void *data, void *ptr) { srb_t *sp = (srb_t*)ptr; struct scsi_qla_host *vha = (scsi_qla_host_t *)data; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API struct fc_bsg_job *bsg_job = sp->u.bsg_job; #else struct bsg_job *bsg_job = sp->u.bsg_job; @@ -114,13 +114,13 @@ qla24xx_fcp_prio_cfg_valid(scsi_qla_host_t *vha, } static int -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job) #else qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job) #endif { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API struct Scsi_Host *host = bsg_job->shost; #else struct Scsi_Host *host = fc_bsg_to_shost(bsg_job); @@ -139,7 +139,7 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job) } /* Get the sub command */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API oper = bsg_job->request->rqst_data.h_vendor.vendor_cmd[1]; #else oper = bsg_request->rqst_data.h_vendor.vendor_cmd[1]; @@ -157,14 +157,14 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job) ha->fcp_prio_cfg->attributes &= ~FCP_PRIO_ATTR_ENABLE; qla24xx_update_all_fcp_prio(vha); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = DID_OK; #else bsg_reply->result = DID_OK; #endif } else { ret = -EINVAL; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = (DID_ERROR << 16); #else bsg_reply->result = (DID_ERROR << 16); @@ -180,14 +180,14 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job) ha->fcp_prio_cfg->attributes |= FCP_PRIO_ATTR_ENABLE; qla24xx_update_all_fcp_prio(vha); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = DID_OK; #else bsg_reply->result = DID_OK; #endif } else { ret = -EINVAL; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = (DID_ERROR << 16); #else bsg_reply->result = (DID_ERROR << 16); @@ -201,7 +201,7 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job) len = bsg_job->reply_payload.payload_len; if (!len || len > FCP_PRIO_CFG_SIZE) { ret = -EINVAL; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = (DID_ERROR << 16); #else bsg_reply->result = (DID_ERROR << 16); @@ -209,7 +209,7 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job) goto exit_fcp_prio_cfg; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = DID_OK; bsg_job->reply->reply_payload_rcv_len = #else @@ -226,7 +226,7 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job) case QLFC_FCP_PRIO_SET_CONFIG: len = bsg_job->request_payload.payload_len; if (!len || len > FCP_PRIO_CFG_SIZE) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = (DID_ERROR << 16); #else bsg_reply->result = (DID_ERROR << 16); @@ -241,7 +241,7 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job) ql_log(ql_log_warn, vha, 0x7050, "Unable to allocate memory for fcp prio " "config data (%x).\n", FCP_PRIO_CFG_SIZE); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = (DID_ERROR << 16); #else bsg_reply->result = (DID_ERROR << 16); @@ -260,7 +260,7 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job) if (!qla24xx_fcp_prio_cfg_valid(vha, (struct qla_fcp_prio_cfg *) ha->fcp_prio_cfg, 1)) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = (DID_ERROR << 16); #else bsg_reply->result = (DID_ERROR << 16); @@ -278,7 +278,7 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job) if (ha->fcp_prio_cfg->attributes & FCP_PRIO_ATTR_ENABLE) ha->flags.fcp_prio_enabled = 1; qla24xx_update_all_fcp_prio(vha); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = DID_OK; #else bsg_reply->result = DID_OK; @@ -289,7 +289,7 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job) break; } exit_fcp_prio_cfg: -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->job_done(bsg_job); #else if (!ret) @@ -300,13 +300,13 @@ exit_fcp_prio_cfg: } static int -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API qla2x00_process_els(struct fc_bsg_job *bsg_job) #else qla2x00_process_els(struct bsg_job *bsg_job) #endif { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#ifdef NEW_LIBFC_API struct fc_bsg_request *bsg_request = bsg_job->request; #endif struct fc_rport *rport; @@ -321,7 +321,7 @@ qla2x00_process_els(struct bsg_job *bsg_job) uint16_t nextlid = 0; #ifdef __COVERITY__ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API BUG_ON(bsg_job->request->msgcode != FC_BSG_RPT_ELS && bsg_job->request->msgcode != FC_BSG_HST_ELS_NOLOGIN); #else @@ -330,7 +330,7 @@ qla2x00_process_els(struct bsg_job *bsg_job) #endif #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API if (bsg_job->request->msgcode == FC_BSG_RPT_ELS) { rport = bsg_job->rport; #else @@ -343,7 +343,7 @@ qla2x00_process_els(struct bsg_job *bsg_job) ha = vha->hw; type = "FC_BSG_RPT_ELS"; } else { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API host = bsg_job->shost; #else host = fc_bsg_to_shost(bsg_job); @@ -374,7 +374,7 @@ qla2x00_process_els(struct bsg_job *bsg_job) } /* ELS request for rport */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API if (bsg_job->request->msgcode == FC_BSG_RPT_ELS) { #else if (bsg_request->msgcode == FC_BSG_RPT_ELS) { @@ -403,7 +403,7 @@ qla2x00_process_els(struct bsg_job *bsg_job) /* Initialize all required fields of fcport */ fcport->vha = vha; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API fcport->d_id.b.al_pa = bsg_job->request->rqst_data.h_els.port_id[0]; fcport->d_id.b.area = @@ -462,7 +462,7 @@ qla2x00_process_els(struct bsg_job *bsg_job) goto done_unmap_sg; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API sp->type = (bsg_job->request->msgcode == FC_BSG_RPT_ELS ? SRB_ELS_CMD_RPT : SRB_ELS_CMD_HST); @@ -484,7 +484,7 @@ qla2x00_process_els(struct bsg_job *bsg_job) ql_dbg(ql_dbg_user, vha, 0x700a, "bsg rqst type: %s els type: %x - loop-id=%x " "portid=%-2x%02x%02x.\n", type, -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->request->rqst_data.h_els.command_code, fcport->loop_id, #else bsg_request->rqst_data.h_els.command_code, fcport->loop_id, @@ -509,7 +509,7 @@ done_unmap_sg: goto done_free_fcport; done_free_fcport: -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API if (bsg_job->request->msgcode == FC_BSG_HST_ELS_NOLOGIN) #else if (bsg_request->msgcode == FC_BSG_HST_ELS_NOLOGIN) @@ -534,14 +534,14 @@ qla24xx_calc_ct_iocbs(uint16_t dsds) } static int -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API qla2x00_process_ct(struct fc_bsg_job *bsg_job) #else qla2x00_process_ct(struct bsg_job *bsg_job) #endif { srb_t *sp; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API struct Scsi_Host *host = bsg_job->shost; #else struct fc_bsg_request *bsg_request = bsg_job->request; @@ -592,7 +592,7 @@ qla2x00_process_ct(struct bsg_job *bsg_job) } loop_id = -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API (bsg_job->request->rqst_data.h_ct.preamble_word1 & 0xFF000000) #else (bsg_request->rqst_data.h_ct.preamble_word1 & 0xFF000000) @@ -627,7 +627,7 @@ qla2x00_process_ct(struct bsg_job *bsg_job) /* Initialize all required fields of fcport */ fcport->vha = vha; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API fcport->d_id.b.al_pa = bsg_job->request->rqst_data.h_ct.port_id[0]; fcport->d_id.b.area = bsg_job->request->rqst_data.h_ct.port_id[1]; fcport->d_id.b.domain = bsg_job->request->rqst_data.h_ct.port_id[2]; @@ -657,7 +657,7 @@ qla2x00_process_ct(struct bsg_job *bsg_job) ql_dbg(ql_dbg_user, vha, 0x7016, "bsg rqst type: %s else type: %x - " "loop-id=%x portid=%02x%02x%02x.\n", type, -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API (bsg_job->request->rqst_data.h_ct.preamble_word2 >> 16), #else (bsg_request->rqst_data.h_ct.preamble_word2 >> 16), @@ -777,13 +777,13 @@ done_reset_internal: } static int -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API qla2x00_process_loopback(struct fc_bsg_job *bsg_job) #else qla2x00_process_loopback(struct bsg_job *bsg_job) #endif { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API struct Scsi_Host *host = bsg_job->shost; #else struct fc_bsg_request *bsg_request = bsg_job->request; @@ -871,7 +871,7 @@ qla2x00_process_loopback(struct bsg_job *bsg_job) elreq.rcv_dma = rsp_data_dma; elreq.transfer_size = req_data_len; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API elreq.options = bsg_job->request->rqst_data.h_vendor.vendor_cmd[1]; #else elreq.options = bsg_request->rqst_data.h_vendor.vendor_cmd[1]; @@ -894,7 +894,7 @@ qla2x00_process_loopback(struct bsg_job *bsg_job) if (qla81xx_get_port_config(vha, config)) { ql_log(ql_log_warn, vha, 0x701f, "Get port config failed.\n"); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = (DID_ERROR << 16); #else bsg_reply->result = (DID_ERROR << 16); @@ -911,7 +911,7 @@ qla2x00_process_loopback(struct bsg_job *bsg_job) new_config)) { ql_log(ql_log_warn, vha, 0x7024, "Internal loopback failed.\n"); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = #else bsg_reply->result = @@ -926,7 +926,7 @@ qla2x00_process_loopback(struct bsg_job *bsg_job) */ if (qla81xx_reset_internal_loopback(vha, config, 1)) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = #else bsg_reply->result = @@ -966,7 +966,7 @@ qla2x00_process_loopback(struct bsg_job *bsg_job) "MPI reset failed.\n"); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = (DID_ERROR << 16); #else bsg_reply->result = (DID_ERROR << 16); @@ -999,7 +999,7 @@ qla2x00_process_loopback(struct bsg_job *bsg_job) fw_sts_ptr += sizeof(response); *fw_sts_ptr = command_sent; rval = 0; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = (DID_ERROR << 16); #else bsg_reply->result = (DID_ERROR << 16); @@ -1010,7 +1010,7 @@ qla2x00_process_loopback(struct bsg_job *bsg_job) bsg_job->reply_len = sizeof(struct fc_bsg_reply) + sizeof(response) + sizeof(uint8_t); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_payload_rcv_len = #else bsg_reply->reply_payload_rcv_len = @@ -1026,7 +1026,7 @@ qla2x00_process_loopback(struct bsg_job *bsg_job) memcpy(fw_sts_ptr, response, sizeof(response)); fw_sts_ptr += sizeof(response); *fw_sts_ptr = command_sent; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = DID_OK; #else bsg_reply->result = DID_OK; @@ -1035,7 +1035,7 @@ qla2x00_process_loopback(struct bsg_job *bsg_job) bsg_job->reply_payload.sg_cnt, rsp_data, rsp_data_len); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->job_done(bsg_job); #else if (!rval) @@ -1060,13 +1060,13 @@ done_unmap_req_sg: } static int -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API qla84xx_reset(struct fc_bsg_job *bsg_job) #else qla84xx_reset(struct bsg_job *bsg_job) #endif { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API struct Scsi_Host *host = bsg_job->shost; #else struct fc_bsg_request *bsg_request = bsg_job->request; @@ -1083,7 +1083,7 @@ qla84xx_reset(struct bsg_job *bsg_job) return -EINVAL; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API flag = bsg_job->request->rqst_data.h_vendor.vendor_cmd[1]; #else flag = bsg_request->rqst_data.h_vendor.vendor_cmd[1]; @@ -1095,7 +1095,7 @@ qla84xx_reset(struct bsg_job *bsg_job) ql_log(ql_log_warn, vha, 0x7030, "Vendor request 84xx reset failed.\n"); rval = 0; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = (DID_ERROR << 16); #else bsg_reply->result = (DID_ERROR << 16); @@ -1103,14 +1103,14 @@ qla84xx_reset(struct bsg_job *bsg_job) } else { ql_dbg(ql_dbg_user, vha, 0x7031, "Vendor request 84xx reset completed.\n"); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = DID_OK; #else bsg_reply->result = DID_OK; #endif } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->job_done(bsg_job); #else if (!rval) @@ -1121,13 +1121,13 @@ qla84xx_reset(struct bsg_job *bsg_job) } static int -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API qla84xx_updatefw(struct fc_bsg_job *bsg_job) #else qla84xx_updatefw(struct bsg_job *bsg_job) #endif { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API struct Scsi_Host *host = bsg_job->shost; #else struct fc_bsg_request *bsg_request = bsg_job->request; @@ -1190,7 +1190,7 @@ qla84xx_updatefw(struct bsg_job *bsg_job) goto done_free_fw_buf; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API flag = bsg_job->request->rqst_data.h_vendor.vendor_cmd[1]; #else flag = bsg_request->rqst_data.h_vendor.vendor_cmd[1]; @@ -1221,7 +1221,7 @@ qla84xx_updatefw(struct bsg_job *bsg_job) "Vendor request 84xx updatefw failed.\n"); rval = 0; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = (DID_ERROR << 16); #else bsg_reply->result = (DID_ERROR << 16); @@ -1231,14 +1231,14 @@ qla84xx_updatefw(struct bsg_job *bsg_job) "Vendor request 84xx updatefw completed.\n"); bsg_job->reply_len = sizeof(struct fc_bsg_reply); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = DID_OK; #else bsg_reply->result = DID_OK; #endif } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->job_done(bsg_job); #else if (!rval) @@ -1258,13 +1258,13 @@ done_unmap_sg: } static int -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) #else qla84xx_mgmt_cmd(struct bsg_job *bsg_job) #endif { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API struct Scsi_Host *host = bsg_job->shost; #else struct fc_bsg_request *bsg_request = bsg_job->request; @@ -1288,7 +1288,7 @@ qla84xx_mgmt_cmd(struct bsg_job *bsg_job) return -EINVAL; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API ql84_mgmt = (struct qla_bsg_a84_mgmt *)((char *)bsg_job->request + sizeof(struct fc_bsg_request)); #else @@ -1431,7 +1431,7 @@ qla84xx_mgmt_cmd(struct bsg_job *bsg_job) "Vendor request 84xx mgmt failed.\n"); rval = 0; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = (DID_ERROR << 16); #else bsg_reply->result = (DID_ERROR << 16); @@ -1441,7 +1441,7 @@ qla84xx_mgmt_cmd(struct bsg_job *bsg_job) "Vendor request 84xx mgmt completed.\n"); bsg_job->reply_len = sizeof(struct fc_bsg_reply); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = DID_OK; #else bsg_reply->result = DID_OK; @@ -1449,7 +1449,7 @@ qla84xx_mgmt_cmd(struct bsg_job *bsg_job) if ((ql84_mgmt->mgmt.cmd == QLA84_MGMT_READ_MEM) || (ql84_mgmt->mgmt.cmd == QLA84_MGMT_GET_INFO)) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_payload_rcv_len = #else bsg_reply->reply_payload_rcv_len = @@ -1462,7 +1462,7 @@ qla84xx_mgmt_cmd(struct bsg_job *bsg_job) } } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->job_done(bsg_job); #else if (!rval) @@ -1488,13 +1488,13 @@ exit_mgmt: } static int -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API qla24xx_iidma(struct fc_bsg_job *bsg_job) #else qla24xx_iidma(struct bsg_job *bsg_job) #endif { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API struct Scsi_Host *host = bsg_job->shost; #else struct fc_bsg_request *bsg_request = bsg_job->request; @@ -1513,7 +1513,7 @@ qla24xx_iidma(struct bsg_job *bsg_job) return -EINVAL; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API port_param = (struct qla_port_param *)((char *)bsg_job->request + sizeof(struct fc_bsg_request)); #else @@ -1569,7 +1569,7 @@ qla24xx_iidma(struct bsg_job *bsg_job) fcport->port_name[5], fcport->port_name[6], fcport->port_name[7], rval, fcport->fp_speed, mb[0], mb[1]); rval = 0; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = (DID_ERROR << 16); #else bsg_reply->result = (DID_ERROR << 16); @@ -1586,14 +1586,14 @@ qla24xx_iidma(struct bsg_job *bsg_job) sizeof(struct qla_port_param)); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = DID_OK; #else bsg_reply->result = DID_OK; #endif } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->job_done(bsg_job); #else if (!rval) @@ -1604,14 +1604,14 @@ qla24xx_iidma(struct bsg_job *bsg_job) } static int -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API qla2x00_optrom_setup(struct fc_bsg_job *bsg_job, scsi_qla_host_t *vha, #else qla2x00_optrom_setup(struct bsg_job *bsg_job, scsi_qla_host_t *vha, #endif uint8_t is_update) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#ifdef NEW_LIBFC_API struct fc_bsg_request *bsg_request = bsg_job->request; #endif uint32_t start = 0; @@ -1621,7 +1621,7 @@ qla2x00_optrom_setup(struct bsg_job *bsg_job, scsi_qla_host_t *vha, if (unlikely(pci_channel_offline(ha->pdev))) return -EINVAL; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API start = bsg_job->request->rqst_data.h_vendor.vendor_cmd[1]; #else start = bsg_request->rqst_data.h_vendor.vendor_cmd[1]; @@ -1684,13 +1684,13 @@ qla2x00_optrom_setup(struct bsg_job *bsg_job, scsi_qla_host_t *vha, } static int -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API qla2x00_read_optrom(struct fc_bsg_job *bsg_job) #else qla2x00_read_optrom(struct bsg_job *bsg_job) #endif { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API struct Scsi_Host *host = bsg_job->shost; #else struct fc_bsg_reply *bsg_reply = bsg_job->reply; @@ -1714,7 +1714,7 @@ qla2x00_read_optrom(struct bsg_job *bsg_job) bsg_job->reply_payload.sg_cnt, ha->optrom_buffer, ha->optrom_region_size); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_payload_rcv_len = ha->optrom_region_size; bsg_job->reply->result = DID_OK; #else @@ -1724,7 +1724,7 @@ qla2x00_read_optrom(struct bsg_job *bsg_job) vfree(ha->optrom_buffer); ha->optrom_buffer = NULL; ha->optrom_state = QLA_SWAITING; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->job_done(bsg_job); #else bsg_job_done(bsg_job, bsg_reply->result, @@ -1734,13 +1734,13 @@ qla2x00_read_optrom(struct bsg_job *bsg_job) } static int -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API qla2x00_update_optrom(struct fc_bsg_job *bsg_job) #else qla2x00_update_optrom(struct bsg_job *bsg_job) #endif { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API struct Scsi_Host *host = bsg_job->shost; #else struct fc_bsg_reply *bsg_reply = bsg_job->reply; @@ -1764,7 +1764,7 @@ qla2x00_update_optrom(struct bsg_job *bsg_job) ha->isp_ops->write_optrom(vha, ha->optrom_buffer, ha->optrom_region_start, ha->optrom_region_size); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = DID_OK; #else bsg_reply->result = DID_OK; @@ -1772,7 +1772,7 @@ qla2x00_update_optrom(struct bsg_job *bsg_job) vfree(ha->optrom_buffer); ha->optrom_buffer = NULL; ha->optrom_state = QLA_SWAITING; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->job_done(bsg_job); #else bsg_job_done(bsg_job, bsg_reply->result, @@ -1782,13 +1782,13 @@ qla2x00_update_optrom(struct bsg_job *bsg_job) } static int -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API qla2x00_update_fru_versions(struct fc_bsg_job *bsg_job) #else qla2x00_update_fru_versions(struct bsg_job *bsg_job) #endif { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API struct Scsi_Host *host = bsg_job->shost; #else struct fc_bsg_reply *bsg_reply = bsg_job->reply; @@ -1804,7 +1804,7 @@ qla2x00_update_fru_versions(struct bsg_job *bsg_job) dma_addr_t sfp_dma; void *sfp = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &sfp_dma); if (!sfp) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = #else bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = @@ -1824,7 +1824,7 @@ qla2x00_update_fru_versions(struct bsg_job *bsg_job) image->field_address.device, image->field_address.offset, sizeof(image->field_info), image->field_address.option); if (rval) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = #else bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = @@ -1835,7 +1835,7 @@ qla2x00_update_fru_versions(struct bsg_job *bsg_job) image++; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = 0; #else bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = 0; @@ -1846,7 +1846,7 @@ dealloc: done: bsg_job->reply_len = sizeof(struct fc_bsg_reply); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = DID_OK << 16; bsg_job->job_done(bsg_job); #else @@ -1859,13 +1859,13 @@ done: } static int -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API qla2x00_read_fru_status(struct fc_bsg_job *bsg_job) #else qla2x00_read_fru_status(struct bsg_job *bsg_job) #endif { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API struct Scsi_Host *host = bsg_job->shost; #else struct fc_bsg_reply *bsg_reply = bsg_job->reply; @@ -1879,7 +1879,7 @@ qla2x00_read_fru_status(struct bsg_job *bsg_job) dma_addr_t sfp_dma; uint8_t *sfp = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &sfp_dma); if (!sfp) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = #else bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = @@ -1897,7 +1897,7 @@ qla2x00_read_fru_status(struct bsg_job *bsg_job) sr->status_reg = *sfp; if (rval) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = #else bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = @@ -1909,7 +1909,7 @@ qla2x00_read_fru_status(struct bsg_job *bsg_job) sg_copy_from_buffer(bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, sr, sizeof(*sr)); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = 0; #else bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = 0; @@ -1920,7 +1920,7 @@ dealloc: done: bsg_job->reply_len = sizeof(struct fc_bsg_reply); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_payload_rcv_len = sizeof(*sr); bsg_job->reply->result = DID_OK << 16; bsg_job->job_done(bsg_job); @@ -1935,13 +1935,13 @@ done: } static int -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API qla2x00_write_fru_status(struct fc_bsg_job *bsg_job) #else qla2x00_write_fru_status(struct bsg_job *bsg_job) #endif { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API struct Scsi_Host *host = bsg_job->shost; #else struct fc_bsg_reply *bsg_reply = bsg_job->reply; @@ -1955,7 +1955,7 @@ qla2x00_write_fru_status(struct bsg_job *bsg_job) dma_addr_t sfp_dma; uint8_t *sfp = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &sfp_dma); if (!sfp) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = #else bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = @@ -1973,7 +1973,7 @@ qla2x00_write_fru_status(struct bsg_job *bsg_job) sizeof(sr->status_reg), sr->field_address.option); if (rval) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = #else bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = @@ -1982,7 +1982,7 @@ qla2x00_write_fru_status(struct bsg_job *bsg_job) goto dealloc; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = 0; #else bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = 0; @@ -1993,7 +1993,7 @@ dealloc: done: bsg_job->reply_len = sizeof(struct fc_bsg_reply); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = DID_OK << 16; bsg_job->job_done(bsg_job); #else @@ -2006,18 +2006,18 @@ done: } static int -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job) #else qla2x00_process_vendor_specific(struct bsg_job *bsg_job) #endif { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#ifdef NEW_LIBFC_API struct fc_bsg_request *bsg_request = bsg_job->request; struct fc_bsg_reply *bsg_reply = bsg_job->reply; #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API switch (bsg_job->request->rqst_data.h_vendor.vendor_cmd[0]) { #else switch (bsg_request->rqst_data.h_vendor.vendor_cmd[0]) { @@ -2056,7 +2056,7 @@ qla2x00_process_vendor_specific(struct bsg_job *bsg_job) return qla2x00_write_fru_status(bsg_job); default: -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = (DID_ERROR << 16); bsg_job->job_done(bsg_job); #else @@ -2067,13 +2067,13 @@ qla2x00_process_vendor_specific(struct bsg_job *bsg_job) } int -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API qla24xx_bsg_request(struct fc_bsg_job *bsg_job) #else qla24xx_bsg_request(struct bsg_job *bsg_job) #endif { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#ifdef NEW_LIBFC_API struct fc_bsg_request *bsg_request = bsg_job->request; struct fc_bsg_reply *bsg_reply = bsg_job->reply; #endif @@ -2084,7 +2084,7 @@ qla24xx_bsg_request(struct bsg_job *bsg_job) scsi_qla_host_t *vha; /* In case no data transferred. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_payload_rcv_len = 0; if (bsg_job->request->msgcode == FC_BSG_RPT_ELS) { @@ -2099,7 +2099,7 @@ qla24xx_bsg_request(struct bsg_job *bsg_job) host = rport_to_shost(rport); vha = shost_priv(host); } else { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API host = bsg_job->shost; #else host = fc_bsg_to_shost(bsg_job); @@ -2110,7 +2110,7 @@ qla24xx_bsg_request(struct bsg_job *bsg_job) if (qla2x00_reset_active(vha)) { ql_dbg(ql_dbg_user, vha, 0x709f, "BSG: ISP abort active/needed -- cmd=%d.\n", -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->request->msgcode); bsg_job->reply->result = (DID_ERROR << 16); bsg_job->job_done(bsg_job); @@ -2122,13 +2122,13 @@ qla24xx_bsg_request(struct bsg_job *bsg_job) } ql_dbg(ql_dbg_user, vha, 0x7000, -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API "Entered %s msgcode=0x%x.\n", __func__, bsg_job->request->msgcode); #else "Entered %s msgcode=0x%x.\n", __func__, bsg_request->msgcode); #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API switch (bsg_job->request->msgcode) { #else switch (bsg_request->msgcode) { @@ -2148,7 +2148,7 @@ qla24xx_bsg_request(struct bsg_job *bsg_job) case FC_BSG_RPT_CT: default: ql_log(ql_log_warn, vha, 0x705a, "Unsupported BSG request.\n"); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = ret; #else bsg_reply->result = ret; @@ -2159,13 +2159,13 @@ qla24xx_bsg_request(struct bsg_job *bsg_job) } int -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API qla24xx_bsg_timeout(struct fc_bsg_job *bsg_job) #else qla24xx_bsg_timeout(struct bsg_job *bsg_job) #endif { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API scsi_qla_host_t *vha = shost_priv(bsg_job->shost); #else struct fc_bsg_request *bsg_request = bsg_job->request; @@ -2197,7 +2197,7 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_job) "mbx abort_command " "failed.\n"); bsg_job->req->errors = -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = -EIO; #else bsg_reply->result = -EIO; @@ -2207,7 +2207,7 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_job) "mbx abort_command " "success.\n"); bsg_job->req->errors = -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->result = 0; #else bsg_reply->result = 0; @@ -2221,7 +2221,7 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_job) } spin_unlock_irqrestore(&ha->hardware_lock, flags); ql_log(ql_log_info, vha, 0x708b, "SRB not found to abort.\n"); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->req->errors = bsg_job->reply->result = -ENXIO; #else bsg_job->req->errors = bsg_reply->result = -ENXIO; @@ -2230,7 +2230,7 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_job) done: spin_unlock_irqrestore(&ha->hardware_lock, flags); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API if (bsg_job->request->msgcode == FC_BSG_HST_CT) #else if (bsg_request->msgcode == FC_BSG_HST_CT) diff --git a/qla2x00t/qla_def.h b/qla2x00t/qla_def.h index 5d8569325..8f5a58331 100644 --- a/qla2x00t/qla_def.h +++ b/qla2x00t/qla_def.h @@ -27,7 +27,13 @@ #include #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) || \ + defined(CONFIG_SUSE_KERNEL) && \ + LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) +#define NEW_LIBFC_API +#endif + +#ifdef NEW_LIBFC_API #include #endif @@ -293,7 +299,7 @@ typedef struct srb { int iocbs; union { struct srb_iocb iocb_cmd; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API struct fc_bsg_job *bsg_job; #else struct bsg_job *bsg_job; diff --git a/qla2x00t/qla_gbl.h b/qla2x00t/qla_gbl.h index 880ee0cf2..14d103ce0 100644 --- a/qla2x00t/qla_gbl.h +++ b/qla2x00t/qla_gbl.h @@ -604,7 +604,7 @@ extern int qla82xx_mbx_beacon_ctl(scsi_qla_host_t *, int); extern void qla82xx_clear_pending_mbx(scsi_qla_host_t *); /* BSG related functions */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#ifdef NEW_LIBFC_API extern int qla24xx_bsg_request(struct bsg_job *); extern int qla24xx_bsg_timeout(struct bsg_job *); #else diff --git a/qla2x00t/qla_iocb.c b/qla2x00t/qla_iocb.c index 918058e69..add8d150f 100644 --- a/qla2x00t/qla_iocb.c +++ b/qla2x00t/qla_iocb.c @@ -2105,7 +2105,7 @@ qla24xx_tm_iocb(srb_t *sp, struct tsk_mgmt_entry *tsk) static void qla24xx_els_iocb(srb_t *sp, struct els_entry_24xx *els_iocb) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API struct fc_bsg_job *bsg_job = sp->u.bsg_job; #else struct bsg_job *bsg_job = sp->u.bsg_job; @@ -2125,7 +2125,7 @@ qla24xx_els_iocb(srb_t *sp, struct els_entry_24xx *els_iocb) els_iocb->opcode = sp->type == SRB_ELS_CMD_RPT ? -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->request->rqst_data.r_els.els_code : bsg_job->request->rqst_data.h_els.command_code; #else @@ -2166,7 +2166,7 @@ qla2x00_ct_iocb(srb_t *sp, ms_iocb_entry_t *ct_iocb) uint16_t tot_dsds; scsi_qla_host_t *vha = sp->fcport->vha; struct qla_hw_data *ha = vha->hw; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API struct fc_bsg_job *bsg_job = sp->u.bsg_job; #else struct bsg_job *bsg_job = sp->u.bsg_job; @@ -2247,7 +2247,7 @@ qla24xx_ct_iocb(srb_t *sp, struct ct_entry_24xx *ct_iocb) uint16_t tot_dsds; scsi_qla_host_t *vha = sp->fcport->vha; struct qla_hw_data *ha = vha->hw; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API struct fc_bsg_job *bsg_job = sp->u.bsg_job; #else struct bsg_job *bsg_job = sp->u.bsg_job; diff --git a/qla2x00t/qla_isr.c b/qla2x00t/qla_isr.c index 55cbde498..880647c61 100644 --- a/qla2x00t/qla_isr.c +++ b/qla2x00t/qla_isr.c @@ -1080,7 +1080,7 @@ qla2x00_ct_entry(scsi_qla_host_t *vha, struct req_que *req, const char func[] = "CT_IOCB"; const char *type; srb_t *sp; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API struct fc_bsg_job *bsg_job; #else struct bsg_job *bsg_job; @@ -1094,7 +1094,7 @@ qla2x00_ct_entry(scsi_qla_host_t *vha, struct req_que *req, return; bsg_job = sp->u.bsg_job; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#ifdef NEW_LIBFC_API bsg_reply = bsg_job->reply; #endif @@ -1105,7 +1105,7 @@ qla2x00_ct_entry(scsi_qla_host_t *vha, struct req_que *req, /* return FC_CTELS_STATUS_OK and leave the decoding of the ELS/CT * fc payload to the caller */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_data.ctels_reply.status = FC_CTELS_STATUS_OK; #else bsg_reply->reply_data.ctels_reply.status = FC_CTELS_STATUS_OK; @@ -1115,7 +1115,7 @@ qla2x00_ct_entry(scsi_qla_host_t *vha, struct req_que *req, if (comp_status != CS_COMPLETE) { if (comp_status == CS_DATA_UNDERRUN) { res = DID_OK << 16; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_payload_rcv_len = #else bsg_reply->reply_payload_rcv_len = @@ -1126,7 +1126,7 @@ qla2x00_ct_entry(scsi_qla_host_t *vha, struct req_que *req, "CT pass-through-%s error " "comp_status-status=0x%x total_byte = 0x%x.\n", type, comp_status, -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_payload_rcv_len); #else bsg_reply->reply_payload_rcv_len); @@ -1136,7 +1136,7 @@ qla2x00_ct_entry(scsi_qla_host_t *vha, struct req_que *req, "CT pass-through-%s error " "comp_status-status=0x%x.\n", type, comp_status); res = DID_ERROR << 16; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_payload_rcv_len = 0; #else bsg_reply->reply_payload_rcv_len = 0; @@ -1146,7 +1146,7 @@ qla2x00_ct_entry(scsi_qla_host_t *vha, struct req_que *req, (uint8_t *)pkt, sizeof(*pkt)); } else { res = DID_OK << 16; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_payload_rcv_len = #else bsg_reply->reply_payload_rcv_len = @@ -1164,7 +1164,7 @@ qla24xx_els_ct_entry(scsi_qla_host_t *vha, struct req_que *req, const char func[] = "ELS_CT_IOCB"; const char *type; srb_t *sp; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API struct fc_bsg_job *bsg_job; #else struct bsg_job *bsg_job; @@ -1179,7 +1179,7 @@ qla24xx_els_ct_entry(scsi_qla_host_t *vha, struct req_que *req, if (!sp) return; bsg_job = sp->u.bsg_job; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#ifdef NEW_LIBFC_API bsg_reply = bsg_job->reply; #endif @@ -1205,7 +1205,7 @@ qla24xx_els_ct_entry(scsi_qla_host_t *vha, struct req_que *req, /* return FC_CTELS_STATUS_OK and leave the decoding of the ELS/CT * fc payload to the caller */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_data.ctels_reply.status = FC_CTELS_STATUS_OK; #else bsg_reply->reply_data.ctels_reply.status = FC_CTELS_STATUS_OK; @@ -1215,7 +1215,7 @@ qla24xx_els_ct_entry(scsi_qla_host_t *vha, struct req_que *req, if (comp_status != CS_COMPLETE) { if (comp_status == CS_DATA_UNDERRUN) { res = DID_OK << 16; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_payload_rcv_len = #else bsg_reply->reply_payload_rcv_len = @@ -1246,7 +1246,7 @@ qla24xx_els_ct_entry(scsi_qla_host_t *vha, struct req_que *req, le16_to_cpu(((struct els_sts_entry_24xx *) pkt)->error_subcode_2)); res = DID_ERROR << 16; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_payload_rcv_len = 0; #else bsg_reply->reply_payload_rcv_len = 0; @@ -1264,7 +1264,7 @@ qla24xx_els_ct_entry(scsi_qla_host_t *vha, struct req_que *req, } else { res = DID_OK << 16; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#ifndef NEW_LIBFC_API bsg_job->reply->reply_payload_rcv_len = bsg_job->reply_payload.payload_len; #else bsg_reply->reply_payload_rcv_len = bsg_job->reply_payload.payload_len; diff --git a/scripts/generate-kernel-patch b/scripts/generate-kernel-patch index 672ea1a2a..c3221eaf0 100755 --- a/scripts/generate-kernel-patch +++ b/scripts/generate-kernel-patch @@ -272,6 +272,9 @@ done # General kernel patches. +scsi_exec_req_fifo_defined=0 +scst_io_context=0 + scst_03_public_headers="scst/include/scst.h scst/include/scst_const.h \ scst/include/scst_event.h scst/include/backport.h" scst_04_main="scst/src/scst_main.c scst/src/scst_module.c scst/src/scst_priv.h \ diff --git a/scripts/specialize-patch b/scripts/specialize-patch index 5cf79b948..942ae35f3 100755 --- a/scripts/specialize-patch +++ b/scripts/specialize-patch @@ -108,6 +108,10 @@ function evaluate(stmnt, pattern, arg, op, result) { gsub("defined\\(HAVE_IB_DMA_MAP_OPS\\)", "(LINUX_VERSION_CODE >= KERNEL_VERSION(0, 0, 0))", stmnt) + gsub("defined(ENABLE_NPIV)", 0, stmnt) + + gsub("defined(FC_VPORT_CREATE_DEFINED)", 0, stmnt) + gsub("LINUX_VERSION_CODE", LINUX_VERSION_CODE, stmnt) pattern="KERNEL_VERSION\\([[:blank:]]*([0-9]+)[[:blank:]]*,[[:blank:]]*([0-9]+)[[:blank:]]*,[[:blank:]]*([0-9]+)[[:blank:]]*\\)" @@ -122,6 +126,8 @@ function evaluate(stmnt, pattern, arg, op, result) { gsub("defined\\(CONFIG_SUSE_KERNEL\\)", "0", stmnt) + gsub("defined\\(CONFIG_SCST_STRICT_SERIALIZING\\)", "0", stmnt) + if (RHEL_MAJOR == "") { gsub("defined\\(RHEL_MAJOR\\)", "0", stmnt) @@ -337,6 +343,8 @@ function handle_if(evaluated) if ($0 ~ "LINUX_VERSION_CODE" \ || $0 ~ "CONFIG_SCST_PROC" \ || $0 ~ "CREATE_SEND_MAD_HAS_BASE_ARG" \ + || $0 ~ "ENABLE_NPIV" \ + || $0 ~ "FC_VPORT_CREATE_DEFINED" \ || $0 ~ "HAVE_IB_DMA_MAP_OPS" \ || $0 ~ "HAVE_IB_QUERY_DEVICE" \ || $0 ~ "HAVE_IB_SET_CPI_RESP_TIME" \ @@ -349,6 +357,7 @@ function handle_if(evaluated) || $0 ~ "IB_QUERY_GID_HAS_ATTR_ARG" \ || $0 ~ "INSIDE_KERNEL_TREE" \ || $0 ~ "MAD_HANDLER_TAKES_SEND_BUF" \ + || $0 ~ "CONFIG_SCST_STRICT_SERIALIZING" \ || $0 ~ "MOFED_MAJOR" \ || $0 ~ "RDMA_CREATE_ID_TAKES_NET_ARG" \ || $0 ~ "REGISTER_MAD_AGENT_HAS_FLAGS_ARG" \ diff --git a/scst/include/backport.h b/scst/include/backport.h index 6f67ec001..3aeb67771 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -20,6 +20,7 @@ * GNU General Public License for more details. */ +#include #include /* struct request_queue */ #include /* struct scatterlist */ #include /* kmalloc() */ @@ -45,6 +46,19 @@ #endif #endif +/* */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) +static inline struct bio_set *bioset_create_backport(unsigned int pool_size, + unsigned int front_pad, + int flags) +{ + WARN_ON_ONCE(flags != 0); + return bioset_create(pool_size, front_pad); +} +#define bioset_create bioset_create_backport +#endif + /* */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31) @@ -224,7 +238,9 @@ static inline struct inode *file_inode(const struct file *f) } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) +#if (!defined(CONFIG_SUSE_KERNEL) && \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)) || \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) static inline ssize_t vfs_readv_backport(struct file *file, const struct iovec __user *vec, unsigned long vlen, loff_t *pos, @@ -416,7 +432,9 @@ static inline bool list_entry_in_list(const struct list_head *entry) /* */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) +#if (!defined(CONFIG_SUSE_KERNEL) && \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)) || \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) static inline long get_user_pages_backport(unsigned long start, unsigned long nr_pages, int write, int force, diff --git a/scst/include/scst.h b/scst/include/scst.h index e41315881..c4f15dfa1 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -5499,6 +5499,7 @@ void scst_dev_inquiry_data_changed(struct scst_device *dev); * allows exclusive wake ups of threads in LIFO order. We need it to let (yet) * unneeded threads sleep and not pollute CPU cache by their stacks. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) static inline void prepare_to_wait_exclusive_head(wait_queue_head_t *q, wait_queue_t *wait, int state) { @@ -5511,6 +5512,20 @@ static inline void prepare_to_wait_exclusive_head(wait_queue_head_t *q, set_current_state(state); spin_unlock_irqrestore(&q->lock, flags); } +#else +static inline void prepare_to_wait_exclusive_head(struct wait_queue_head *wq_head, + struct wait_queue_entry *wq_entry, int state) +{ + unsigned long flags; + + wq_entry->flags |= WQ_FLAG_EXCLUSIVE; + spin_lock_irqsave(&wq_head->lock, flags); + if (list_empty(&wq_entry->entry)) + __add_wait_queue(wq_head, wq_entry); + set_current_state(state); + spin_unlock_irqrestore(&wq_head->lock, flags); +} +#endif /** * wait_event_locked() - Wait until a condition becomes true. diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index 5decbc2da..c2dd44aec 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -1272,7 +1272,9 @@ static int dev_user_map_buf(struct scst_user_cmd *ucmd, unsigned long ubuff, (ucmd->cmd != NULL) ? ucmd->cmd->bufflen : -1); down_read(&tsk->mm->mmap_sem); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) +#if (!defined(CONFIG_SUSE_KERNEL) && \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)) || \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) rc = get_user_pages(ubuff, ucmd->num_data_pages, 1/*writable*/, 0/*don't force*/, ucmd->data_pages, NULL); #else diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 8c3c3b427..c239ebe41 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -6563,7 +6563,11 @@ static void blockio_endio(struct bio *bio, int error) #else static void blockio_endio(struct bio *bio) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) int error = bio->bi_error; +#else + int error = blk_status_to_errno(bio->bi_status); +#endif #endif struct scst_blockio_work *blockio_work = bio->bi_private; @@ -6597,7 +6601,9 @@ static void blockio_endio(struct bio *bio) #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36) if (bio->bi_rw & (1 << BIO_RW)) { -#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0) +#elif (!defined(CONFIG_SUSE_KERNEL) && \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)) || \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) if (bio->bi_rw & REQ_WRITE) { #else if (op_is_write(bio_op(bio))) { @@ -6637,7 +6643,9 @@ static void vdisk_bio_set_failfast(struct bio *bio) bio->bi_rw |= (1 << BIO_RW_FAILFAST_DEV) | (1 << BIO_RW_FAILFAST_TRANSPORT) | (1 << BIO_RW_FAILFAST_DRIVER); -#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0) +#elif (!defined(CONFIG_SUSE_KERNEL) && \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)) || \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) bio->bi_rw |= REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; @@ -6650,7 +6658,8 @@ static void vdisk_bio_set_failfast(struct bio *bio) static void vdisk_bio_set_hoq(struct bio *bio) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) || \ +defined(CONFIG_SUSE_KERNEL) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) bio->bi_opf |= REQ_SYNC; #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) || \ (defined(RHEL_MAJOR) && \ @@ -6661,7 +6670,8 @@ static void vdisk_bio_set_hoq(struct bio *bio) #else bio->bi_rw |= 1 << BIO_RW_SYNC; #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) || \ +defined(CONFIG_SUSE_KERNEL) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) bio->bi_opf |= REQ_META; #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) || \ (defined(RHEL_MAJOR) && \ @@ -6917,7 +6927,9 @@ static void blockio_exec_rw(struct vdisk_cmd_params *p, bool write, bool fua) if (write) #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36) bio->bi_rw |= (1 << BIO_RW); -#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0) +#elif (!defined(CONFIG_SUSE_KERNEL) && \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)) || \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) bio->bi_rw |= REQ_WRITE; #else bio_set_op_attrs(bio, REQ_OP_WRITE, 0); @@ -6932,7 +6944,9 @@ static void blockio_exec_rw(struct vdisk_cmd_params *p, bool write, bool fua) bio->bi_rw |= REQ_SYNC; #endif if (fua) -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0) +#if (!defined(CONFIG_SUSE_KERNEL) && \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)) || \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) bio->bi_rw |= REQ_FUA; #else bio->bi_opf |= REQ_FUA; @@ -6989,7 +7003,9 @@ static void blockio_exec_rw(struct vdisk_cmd_params *p, bool write, bool fua) hbio = hbio->bi_next; bio->bi_next = NULL; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0) +#if (!defined(CONFIG_SUSE_KERNEL) && \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)) || \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) submit_bio(bio->bi_rw, bio); #else submit_bio(bio); @@ -7039,7 +7055,11 @@ static void vdev_flush_end_io(struct bio *bio, int error) #else static void vdev_flush_end_io(struct bio *bio) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) int error = bio->bi_error; +#else + int error = blk_status_to_errno(bio->bi_status); +#endif #endif struct scst_cmd *cmd = bio->bi_private; @@ -7084,7 +7104,9 @@ static int vdisk_blockio_flush(struct block_device *bdev, gfp_t gfp_mask, bio->bi_end_io = vdev_flush_end_io; bio->bi_private = cmd; bio->bi_bdev = bdev; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0) +#if (!defined(CONFIG_SUSE_KERNEL) && \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)) || \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) submit_bio(WRITE_FLUSH, bio); #else bio_set_op_attrs(bio, REQ_OP_FLUSH, 0); @@ -7155,7 +7177,11 @@ static void blockio_end_sync_io(struct bio *bio, int error) #else static void blockio_end_sync_io(struct bio *bio) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) int error = bio->bi_error; +#else + int error = blk_status_to_errno(bio->bi_status); +#endif #endif struct bio_priv_sync *s = bio->bi_private; @@ -7229,7 +7255,9 @@ static ssize_t blockio_read_sync(struct scst_vdisk_dev *virt_dev, void *buf, if (!bio) goto out; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0) +#if (!defined(CONFIG_SUSE_KERNEL) && \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)) || \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) bio->bi_rw = READ_SYNC; #else bio_set_op_attrs(bio, REQ_OP_READ, REQ_SYNC); @@ -7260,7 +7288,9 @@ static ssize_t blockio_read_sync(struct scst_vdisk_dev *virt_dev, void *buf, } } } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0) +#if (!defined(CONFIG_SUSE_KERNEL) && \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)) || \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) submit_bio(bio->bi_rw, bio); #else submit_bio(bio); @@ -7788,7 +7818,7 @@ static int vdisk_create_bioset(struct scst_vdisk_dev *virt_dev) EXTRACHECKS_BUG_ON(virt_dev->vdisk_bioset || !virt_dev->blockio); /* Pool size doesn't really matter */ - virt_dev->vdisk_bioset = bioset_create(2, 0); + virt_dev->vdisk_bioset = bioset_create(2, 0, 0); if (virt_dev->vdisk_bioset == NULL) { PRINT_ERROR("Failed to create bioset (dev %s)", virt_dev->name); res = -ENOMEM; diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 3c28e6aaf..8bf237ef1 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -7705,7 +7705,11 @@ static void blk_bio_map_kern_endio(struct bio *bio, int err) #else static void blk_bio_map_kern_endio(struct bio *bio) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) int err = bio->bi_error; +#else + int err = blk_status_to_errno(bio->bi_status); +#endif #endif struct blk_kern_sg_work *bw = bio->bi_private; @@ -7847,7 +7851,8 @@ static void bio_kmalloc_destructor(struct bio *bio) } #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) || \ +(defined(CONFIG_SUSE_KERNEL) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) static struct request *blk_make_request(struct request_queue *q, struct bio *bio, gfp_t gfp_mask) @@ -7857,22 +7862,33 @@ static struct request *blk_make_request(struct request_queue *q, if (IS_ERR(rq)) return rq; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) + scsi_req_init(scsi_req(rq)); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) scsi_req_init(rq); #else blk_rq_set_block_pc(rq); #endif for_each_bio(bio) { - struct bio *bounce_bio = bio; int ret; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) + struct bio *bounce_bio = bio; + blk_queue_bounce(q, &bounce_bio); ret = blk_rq_append_bio(rq, bounce_bio); if (unlikely(ret)) { blk_put_request(rq); return ERR_PTR(ret); } +#else + ret = blk_rq_append_bio(rq, bio); + if (unlikely(ret)) { + blk_put_request(rq); + return ERR_PTR(ret); + } +#endif } return rq; @@ -7961,7 +7977,9 @@ static struct request *__blk_map_kern_sg(struct request_queue *q, if (!reading) #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36) bio->bi_rw |= 1 << BIO_RW; -#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0) +#elif (!defined(CONFIG_SUSE_KERNEL) && \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)) || \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) bio->bi_rw |= REQ_WRITE; #else bio_set_op_attrs(bio, REQ_OP_WRITE, 0); @@ -8027,7 +8045,9 @@ static struct request *__blk_map_kern_sg(struct request_queue *q, if (bw != NULL) { atomic_set(&bw->bios_inflight, bios); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#if (!defined(CONFIG_SUSE_KERNEL) && \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)) || \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) /* * See also patch "block: split out request-only flags into a * new namespace" (commit e806402130c9). @@ -8071,7 +8091,9 @@ static struct request *blk_map_kern_sg(struct request_queue *q, if (unlikely(!rq)) return ERR_PTR(-ENOMEM); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) + scsi_req_init(scsi_req(rq)); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) scsi_req_init(rq); #else rq->cmd_type = REQ_TYPE_BLOCK_PC; @@ -8257,7 +8279,11 @@ out: #endif /* !defined(SCSI_EXEC_REQ_FIFO_DEFINED) */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) static void scsi_end_async(struct request *req, int error) +#else +static void scsi_end_async(struct request *req, blk_status_t error) +#endif { struct scsi_io_context *sioc = req->end_io_data; @@ -8406,7 +8432,11 @@ out_free_unmap: #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) b->bi_end_io(b, res); #else +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) b->bi_error = res; +#else + b->bi_status = errno_to_blk_status(res); +#endif b->bi_end_io(b); #endif } diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index b5c48a4bb..a936c434a 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -2498,9 +2498,9 @@ static bool srpt_is_target_enabled(struct scst_tgt *scst_tgt) /* * srpt_next_comp_vector() - Next completion vector >= sport->comp_vector */ -static u8 srpt_next_comp_vector(struct srpt_port *sport) +static u16 srpt_next_comp_vector(struct srpt_port *sport) { - u8 comp_vector; + u16 comp_vector; mutex_lock(&sport->mutex); comp_vector = cpumask_next(sport->comp_vector, &sport->comp_v_mask); diff --git a/srpt/src/ib_srpt.h b/srpt/src/ib_srpt.h index e354ba1c2..fed94c307 100644 --- a/srpt/src/ib_srpt.h +++ b/srpt/src/ib_srpt.h @@ -379,7 +379,7 @@ struct srpt_rdma_ch { struct list_head cmd_wait_list; uint16_t pkey; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20) || defined(RHEL_RELEASE_CODE) - u8 comp_vector; + u16 comp_vector; #endif bool using_rdma_cm; bool processing_wait_list; @@ -433,7 +433,7 @@ struct srpt_port { struct list_head nexus_list; struct scst_tgt *scst_tgt; cpumask_t comp_v_mask; - u8 comp_vector; + u16 comp_vector; bool enabled; u8 port_id[64]; };