mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-19 03:31:26 +00:00
fcst: Port to Linux kernel v4.10
This commit is contained in:
@@ -256,14 +256,24 @@ 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)
|
||||
struct fc_lport *lport = fr_dev(fp);
|
||||
#endif
|
||||
|
||||
if (sp)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
|
||||
lport->tt.exch_done(sp);
|
||||
#else
|
||||
fc_exch_done(sp);
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
|
||||
if (fr_seq(fp))
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
|
||||
lport->tt.seq_release(fr_seq(fp));
|
||||
#else
|
||||
fc_seq_release(fr_seq(fp));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
fc_frame_free(fp);
|
||||
@@ -385,11 +395,19 @@ int ft_send_response(struct scst_cmd *cmd)
|
||||
/*
|
||||
* Send response.
|
||||
*/
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
|
||||
fcmd->seq = lport->tt.seq_start_next(fcmd->seq);
|
||||
#else
|
||||
fcmd->seq = fc_seq_start_next(fcmd->seq);
|
||||
#endif
|
||||
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)
|
||||
error = FCST_INJ_SEND_ERR(lport->tt.seq_send(lport, fcmd->seq, fp));
|
||||
#else
|
||||
error = FCST_INJ_SEND_ERR(fc_seq_send(lport, fcmd->seq, fp));
|
||||
#endif
|
||||
if (error < 0) {
|
||||
pr_err("Sending response for exchange with OX_ID %#x and RX_ID"
|
||||
" %#x failed: %d\n", ep->oxid, ep->rxid, error);
|
||||
@@ -487,10 +505,18 @@ 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)
|
||||
fcmd->seq = lport->tt.seq_start_next(fcmd->seq);
|
||||
#else
|
||||
fcmd->seq = fc_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)
|
||||
error = FCST_INJ_SEND_ERR(lport->tt.seq_send(lport, fcmd->seq, fp));
|
||||
#else
|
||||
error = FCST_INJ_SEND_ERR(fc_seq_send(lport, fcmd->seq, fp));
|
||||
#endif
|
||||
switch (error) {
|
||||
case 0:
|
||||
return SCST_TGT_RES_SUCCESS;
|
||||
@@ -548,19 +574,31 @@ static void ft_send_resp_status(struct fc_frame *rx_fp, u32 status,
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
|
||||
sp = fr_seq(rx_fp);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
|
||||
sp = lport->tt.seq_start_next(sp);
|
||||
#else
|
||||
sp = fc_seq_start_next(sp);
|
||||
#endif
|
||||
ep = fc_seq_exch(sp);
|
||||
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)
|
||||
lport->tt.seq_send(lport, sp, fp);
|
||||
#else
|
||||
fc_seq_send(lport, sp, fp);
|
||||
#endif
|
||||
out:
|
||||
;
|
||||
#else
|
||||
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)
|
||||
lport->tt.seq_send(lport, sp, fp);
|
||||
#else
|
||||
fc_seq_send(lport, sp, fp);
|
||||
#endif
|
||||
else
|
||||
lport->tt.frame_send(lport, fp);
|
||||
#endif
|
||||
@@ -688,7 +726,11 @@ 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)
|
||||
sp = lport->tt.seq_assign(lport, fp);
|
||||
#else
|
||||
sp = fc_seq_assign(lport, fp);
|
||||
#endif
|
||||
if (!sp)
|
||||
goto busy;
|
||||
#endif
|
||||
@@ -737,7 +779,11 @@ 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)
|
||||
lport->tt.seq_set_resp(sp, ft_recv_seq, cmd);
|
||||
#else
|
||||
fc_seq_set_resp(sp, ft_recv_seq, cmd);
|
||||
#endif
|
||||
|
||||
switch (fcp->fc_flags & (FCP_CFL_RDDATA | FCP_CFL_WRDATA)) {
|
||||
case 0:
|
||||
@@ -786,7 +832,11 @@ busy:
|
||||
if (fcmd)
|
||||
ft_cmd_done(fcmd);
|
||||
else if (sp)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
|
||||
lport->tt.exch_done(sp);
|
||||
#else
|
||||
fc_exch_done(sp);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -814,18 +864,28 @@ static void ft_cmd_ls_rjt(struct fc_frame *rx_fp, enum fc_els_rjt_reason reason,
|
||||
rjt->er_reason = reason;
|
||||
rjt->er_explan = explan;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
|
||||
sp = lport->tt.seq_start_next(sp);
|
||||
#else
|
||||
sp = fc_seq_start_next(sp);
|
||||
#endif
|
||||
fc_fill_fc_hdr(fp, FC_RCTL_ELS_REP, ep->did, ep->sid, FC_TYPE_FCP,
|
||||
FC_FC_EX_CTX | FC_FC_END_SEQ | FC_FC_LAST_SEQ, 0);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
|
||||
lport->tt.seq_send(lport, sp, fp);
|
||||
#else
|
||||
fc_seq_send(lport, sp, fp);
|
||||
#endif
|
||||
#else
|
||||
struct fc_seq_els_data rjt_data;
|
||||
struct fc_lport *lport;
|
||||
|
||||
lport = fr_dev(rx_fp);
|
||||
rjt_data.reason = reason;
|
||||
rjt_data.explan = explan;
|
||||
lport->tt.seq_els_rsp_send(rx_fp, ELS_LS_RJT, &rjt_data);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
|
||||
fr_dev(rx_fp)->tt.seq_els_rsp_send(rx_fp, ELS_LS_RJT, &rjt_data);
|
||||
#else
|
||||
fc_seq_els_rsp_send(rx_fp, ELS_LS_RJT, &rjt_data);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,11 @@ 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)
|
||||
fcmd->seq = lport->tt.seq_start_next(fcmd->seq);
|
||||
#else
|
||||
fcmd->seq = fc_seq_start_next(fcmd->seq);
|
||||
#endif
|
||||
|
||||
/* no scatter/gather in skb for odd word length due to fc_seq_send() */
|
||||
use_sg = !(remaining % 4) && lport->sg_supp;
|
||||
@@ -175,8 +179,12 @@ 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)
|
||||
error = FCST_INJ_SEND_ERR(lport->tt.seq_send(lport, fcmd->seq,
|
||||
fp));
|
||||
#else
|
||||
error = FCST_INJ_SEND_ERR(fc_seq_send(lport, fcmd->seq, fp));
|
||||
#endif
|
||||
if (error) {
|
||||
pr_warn("Sending frame with oid %#x oxid %#x resp_len"
|
||||
" %d failed at frame_off %u / remaining %zu"
|
||||
|
||||
Reference in New Issue
Block a user