mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-19 13:46:25 +00:00
qla2x00t: update to kernel 4.10
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7170 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
+523
-3
File diff suppressed because it is too large
Load Diff
@@ -27,6 +27,10 @@
|
||||
#include <linux/aer.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
|
||||
#include <linux/bsg-lib.h>
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
|
||||
#error
|
||||
#error ***This version of qla2xxx does not support distributions based on***
|
||||
@@ -289,7 +293,11 @@ typedef struct srb {
|
||||
int iocbs;
|
||||
union {
|
||||
struct srb_iocb iocb_cmd;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)
|
||||
struct fc_bsg_job *bsg_job;
|
||||
#else
|
||||
struct bsg_job *bsg_job;
|
||||
#endif
|
||||
struct srb_cmd scmd;
|
||||
} u;
|
||||
void (*done)(void *, void *, int);
|
||||
|
||||
@@ -604,8 +604,13 @@ 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, 9, 0)
|
||||
extern int qla24xx_bsg_request(struct bsg_job *);
|
||||
extern int qla24xx_bsg_timeout(struct bsg_job *);
|
||||
#else
|
||||
extern int qla24xx_bsg_request(struct fc_bsg_job *);
|
||||
extern int qla24xx_bsg_timeout(struct fc_bsg_job *);
|
||||
#endif
|
||||
extern int qla84xx_reset_chip(scsi_qla_host_t *, uint16_t);
|
||||
extern int qla2x00_issue_iocb_timeout(scsi_qla_host_t *, void *,
|
||||
dma_addr_t, size_t, uint32_t);
|
||||
|
||||
@@ -2105,7 +2105,12 @@ 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, 9, 0)
|
||||
struct fc_bsg_job *bsg_job = sp->u.bsg_job;
|
||||
#else
|
||||
struct bsg_job *bsg_job = sp->u.bsg_job;
|
||||
struct fc_bsg_request *bsg_request = bsg_job->request;
|
||||
#endif
|
||||
|
||||
els_iocb->entry_type = ELS_IOCB_TYPE;
|
||||
els_iocb->entry_count = 1;
|
||||
@@ -2120,8 +2125,13 @@ 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, 9, 0)
|
||||
bsg_job->request->rqst_data.r_els.els_code :
|
||||
bsg_job->request->rqst_data.h_els.command_code;
|
||||
#else
|
||||
bsg_request->rqst_data.r_els.els_code :
|
||||
bsg_request->rqst_data.h_els.command_code;
|
||||
#endif
|
||||
els_iocb->port_id[0] = sp->fcport->d_id.b.al_pa;
|
||||
els_iocb->port_id[1] = sp->fcport->d_id.b.area;
|
||||
els_iocb->port_id[2] = sp->fcport->d_id.b.domain;
|
||||
@@ -2156,7 +2166,11 @@ 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, 9, 0)
|
||||
struct fc_bsg_job *bsg_job = sp->u.bsg_job;
|
||||
#else
|
||||
struct bsg_job *bsg_job = sp->u.bsg_job;
|
||||
#endif
|
||||
int loop_iterartion = 0;
|
||||
int cont_iocb_prsnt = 0;
|
||||
int entry_count = 1;
|
||||
@@ -2233,7 +2247,11 @@ 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, 9, 0)
|
||||
struct fc_bsg_job *bsg_job = sp->u.bsg_job;
|
||||
#else
|
||||
struct bsg_job *bsg_job = sp->u.bsg_job;
|
||||
#endif
|
||||
int loop_iterartion = 0;
|
||||
int cont_iocb_prsnt = 0;
|
||||
int entry_count = 1;
|
||||
|
||||
@@ -1080,7 +1080,12 @@ 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, 9, 0)
|
||||
struct fc_bsg_job *bsg_job;
|
||||
#else
|
||||
struct bsg_job *bsg_job;
|
||||
struct fc_bsg_reply *bsg_reply;
|
||||
#endif
|
||||
uint16_t comp_status;
|
||||
int res;
|
||||
|
||||
@@ -1089,6 +1094,9 @@ 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, 9, 0)
|
||||
bsg_reply = bsg_job->reply;
|
||||
#endif
|
||||
|
||||
type = "ct pass-through";
|
||||
|
||||
@@ -1097,32 +1105,52 @@ 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, 9, 0)
|
||||
bsg_job->reply->reply_data.ctels_reply.status = FC_CTELS_STATUS_OK;
|
||||
#else
|
||||
bsg_reply->reply_data.ctels_reply.status = FC_CTELS_STATUS_OK;
|
||||
#endif
|
||||
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
|
||||
|
||||
if (comp_status != CS_COMPLETE) {
|
||||
if (comp_status == CS_DATA_UNDERRUN) {
|
||||
res = DID_OK << 16;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)
|
||||
bsg_job->reply->reply_payload_rcv_len =
|
||||
#else
|
||||
bsg_reply->reply_payload_rcv_len =
|
||||
#endif
|
||||
le16_to_cpu(((sts_entry_t *)pkt)->rsp_info_len);
|
||||
|
||||
ql_log(ql_log_warn, vha, 0x5048,
|
||||
"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, 9, 0)
|
||||
bsg_job->reply->reply_payload_rcv_len);
|
||||
#else
|
||||
bsg_reply->reply_payload_rcv_len);
|
||||
#endif
|
||||
} else {
|
||||
ql_log(ql_log_warn, vha, 0x5049,
|
||||
"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, 9, 0)
|
||||
bsg_job->reply->reply_payload_rcv_len = 0;
|
||||
#else
|
||||
bsg_reply->reply_payload_rcv_len = 0;
|
||||
#endif
|
||||
}
|
||||
ql_dump_buffer(ql_dbg_async + ql_dbg_buffer, vha, 0x5035,
|
||||
(uint8_t *)pkt, sizeof(*pkt));
|
||||
} else {
|
||||
res = DID_OK << 16;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)
|
||||
bsg_job->reply->reply_payload_rcv_len =
|
||||
#else
|
||||
bsg_reply->reply_payload_rcv_len =
|
||||
#endif
|
||||
bsg_job->reply_payload.payload_len;
|
||||
bsg_job->reply_len = 0;
|
||||
}
|
||||
@@ -1136,7 +1164,12 @@ 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, 9, 0)
|
||||
struct fc_bsg_job *bsg_job;
|
||||
#else
|
||||
struct bsg_job *bsg_job;
|
||||
struct fc_bsg_reply *bsg_reply;
|
||||
#endif
|
||||
uint16_t comp_status;
|
||||
uint32_t fw_status[3];
|
||||
uint8_t* fw_sts_ptr;
|
||||
@@ -1146,6 +1179,9 @@ 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, 9, 0)
|
||||
bsg_reply = bsg_job->reply;
|
||||
#endif
|
||||
|
||||
type = NULL;
|
||||
switch (sp->type) {
|
||||
@@ -1169,13 +1205,21 @@ 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, 9, 0)
|
||||
bsg_job->reply->reply_data.ctels_reply.status = FC_CTELS_STATUS_OK;
|
||||
#else
|
||||
bsg_reply->reply_data.ctels_reply.status = FC_CTELS_STATUS_OK;
|
||||
#endif
|
||||
bsg_job->reply_len = sizeof(struct fc_bsg_reply) + sizeof(fw_status);
|
||||
|
||||
if (comp_status != CS_COMPLETE) {
|
||||
if (comp_status == CS_DATA_UNDERRUN) {
|
||||
res = DID_OK << 16;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)
|
||||
bsg_job->reply->reply_payload_rcv_len =
|
||||
#else
|
||||
bsg_reply->reply_payload_rcv_len =
|
||||
#endif
|
||||
le16_to_cpu(((struct els_sts_entry_24xx*)pkt)->total_byte_count);
|
||||
|
||||
ql_dbg(ql_dbg_user, vha, 0x503f,
|
||||
@@ -1197,7 +1241,11 @@ 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, 9, 0)
|
||||
bsg_job->reply->reply_payload_rcv_len = 0;
|
||||
#else
|
||||
bsg_reply->reply_payload_rcv_len = 0;
|
||||
#endif
|
||||
fw_sts_ptr = ((uint8_t*)bsg_job->req->sense) + sizeof(struct fc_bsg_reply);
|
||||
memcpy( fw_sts_ptr, fw_status, sizeof(fw_status));
|
||||
}
|
||||
@@ -1206,7 +1254,11 @@ 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, 9, 0)
|
||||
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;
|
||||
#endif
|
||||
bsg_job->reply_len = 0;
|
||||
}
|
||||
sp->done(vha, sp, 0);
|
||||
|
||||
Reference in New Issue
Block a user