mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-16 12:16:17 +00:00
fcst: Remove support for kernel versions before 3.10
The SCST has dropped support for kernels older than 3.10.0 (RHEL 7 / Centos 7) since SCST v3.6.
This commit is contained in:
committed by
Gleb Chesnokov
parent
165285b64b
commit
0a05b57009
+1
-66
@@ -129,13 +129,11 @@ static void ft_cmd_done(struct ft_cmd *fcmd)
|
||||
lport->tt.exch_done(sp);
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
|
||||
if (fr_seq(fp))
|
||||
#ifdef NEW_LIBFC_API
|
||||
fc_seq_release(fr_seq(fp));
|
||||
#else
|
||||
lport->tt.seq_release(fr_seq(fp));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
fc_frame_free(fp);
|
||||
@@ -405,9 +403,6 @@ static void ft_send_resp_status(struct fc_frame *rx_fp, u32 status,
|
||||
struct fcp_resp_with_ext *fcp;
|
||||
struct fcp_resp_rsp_info *info;
|
||||
struct fc_lport *lport;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
|
||||
struct fc_exch *ep;
|
||||
#endif
|
||||
|
||||
fh = fc_frame_header_get(rx_fp);
|
||||
FT_IO_DBG("FCP error response: did %x oxid %x status %x code %x\n",
|
||||
@@ -418,11 +413,8 @@ static void ft_send_resp_status(struct fc_frame *rx_fp, u32 status,
|
||||
len += sizeof(*info);
|
||||
fp = fc_frame_alloc(lport, len);
|
||||
if (!fp)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
|
||||
goto out;
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
|
||||
fcp = fc_frame_payload_get(fp, len);
|
||||
memset(fcp, 0, len);
|
||||
fcp->resp.fr_status = status;
|
||||
@@ -433,17 +425,6 @@ static void ft_send_resp_status(struct fc_frame *rx_fp, u32 status,
|
||||
info->rsp_code = code;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
|
||||
sp = fr_seq(rx_fp);
|
||||
sp = lport->tt.seq_start_next(sp);
|
||||
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);
|
||||
|
||||
lport->tt.seq_send(lport, sp, fp);
|
||||
out:
|
||||
;
|
||||
#else
|
||||
fc_fill_reply_hdr(fp, rx_fp, FC_RCTL_DD_CMD_STATUS, 0);
|
||||
sp = fr_seq(fp);
|
||||
if (sp)
|
||||
@@ -454,7 +435,6 @@ out:
|
||||
#endif
|
||||
else
|
||||
lport->tt.frame_send(lport, fp);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -513,13 +493,7 @@ static void ft_recv_tm(struct scst_session *scst_sess,
|
||||
|
||||
scst_rx_mgmt_params_init(¶ms);
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) || \
|
||||
defined(CONFIG_SUSE_KERNEL) && \
|
||||
LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 101)
|
||||
params.lun = fcp->fc_lun.scsi_lun;
|
||||
#else
|
||||
params.lun = fcp->fc_lun;
|
||||
#endif
|
||||
params.lun_len = sizeof(fcp->fc_lun);
|
||||
params.lun_set = 1;
|
||||
params.atomic = SCST_ATOMIC;
|
||||
@@ -575,9 +549,6 @@ static void ft_recv_cmd(struct ft_sess *sess, struct fc_frame *fp)
|
||||
|
||||
lport = sess->tport->lport;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
|
||||
sp = fr_seq(fp);
|
||||
#else
|
||||
#ifdef NEW_LIBFC_API
|
||||
sp = fc_seq_assign(lport, fp);
|
||||
#else
|
||||
@@ -585,7 +556,6 @@ static void ft_recv_cmd(struct ft_sess *sess, struct fc_frame *fp)
|
||||
#endif
|
||||
if (!sp)
|
||||
goto busy;
|
||||
#endif
|
||||
|
||||
fcmd = kzalloc(sizeof(*fcmd), GFP_ATOMIC);
|
||||
if (!fcmd)
|
||||
@@ -614,16 +584,9 @@ static void ft_recv_cmd(struct ft_sess *sess, struct fc_frame *fp)
|
||||
cdb_len += sizeof(fcp->fc_cdb);
|
||||
data_len = ntohl(*(__be32 *)(fcp->fc_cdb + cdb_len));
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) || \
|
||||
defined(CONFIG_SUSE_KERNEL) && \
|
||||
LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 101)
|
||||
cmd = scst_rx_cmd(sess->scst_sess, fcp->fc_lun.scsi_lun,
|
||||
sizeof(fcp->fc_lun), fcp->fc_cdb, cdb_len,
|
||||
SCST_ATOMIC);
|
||||
#else
|
||||
cmd = scst_rx_cmd(sess->scst_sess, fcp->fc_lun, sizeof(fcp->fc_lun),
|
||||
fcp->fc_cdb, cdb_len, SCST_ATOMIC);
|
||||
#endif
|
||||
if (!cmd)
|
||||
goto busy;
|
||||
fcmd->scst_cmd = cmd;
|
||||
@@ -697,30 +660,6 @@ busy:
|
||||
static void ft_cmd_ls_rjt(struct fc_frame *rx_fp, enum fc_els_rjt_reason reason,
|
||||
enum fc_els_rjt_explan explan)
|
||||
{
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
|
||||
struct fc_seq *sp = fr_seq(rx_fp);
|
||||
struct fc_frame *fp;
|
||||
struct fc_els_ls_rjt *rjt;
|
||||
struct fc_lport *lport;
|
||||
struct fc_exch *ep;
|
||||
|
||||
ep = fc_seq_exch(sp);
|
||||
lport = ep->lp;
|
||||
fp = fc_frame_alloc(lport, sizeof(*rjt));
|
||||
if (!fp)
|
||||
return;
|
||||
|
||||
rjt = fc_frame_payload_get(fp, sizeof(*rjt));
|
||||
memset(rjt, 0, sizeof(*rjt));
|
||||
rjt->er_cmd = ELS_LS_RJT;
|
||||
rjt->er_reason = reason;
|
||||
rjt->er_explan = explan;
|
||||
|
||||
sp = lport->tt.seq_start_next(sp);
|
||||
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);
|
||||
lport->tt.seq_send(lport, sp, fp);
|
||||
#else
|
||||
struct fc_seq_els_data rjt_data;
|
||||
|
||||
rjt_data.reason = reason;
|
||||
@@ -730,7 +669,6 @@ static void ft_cmd_ls_rjt(struct fc_frame *rx_fp, enum fc_els_rjt_reason reason,
|
||||
#else
|
||||
fr_dev(rx_fp)->tt.seq_els_rsp_send(rx_fp, ELS_LS_RJT, &rjt_data);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -769,9 +707,6 @@ void ft_recv_req(struct ft_sess *sess, struct fc_frame *fp)
|
||||
default:
|
||||
pr_info("%s: unhandled frame r_ctl %x\n", __func__,
|
||||
fh->fh_r_ctl);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
|
||||
sess->tport->lport->tt.exch_done(fr_seq(fp));
|
||||
#endif
|
||||
fc_frame_free(fp);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -81,18 +81,6 @@ static struct ft_tport *ft_tport_create(struct fc_lport *lport)
|
||||
return tport;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
|
||||
/*
|
||||
* Free tport via RCU.
|
||||
*/
|
||||
static void ft_tport_rcu_free(struct rcu_head *rcu)
|
||||
{
|
||||
struct ft_tport *tport = container_of(rcu, struct ft_tport, rcu);
|
||||
|
||||
kfree(tport);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Delete target local port, if any, associated with the local port.
|
||||
* Caller holds ft_lport_lock.
|
||||
@@ -111,11 +99,7 @@ static void ft_tport_delete(struct ft_tport *tport)
|
||||
rcu_assign_pointer(*(void __force __rcu **)&lport->prov[FC_TYPE_FCP],
|
||||
NULL);
|
||||
tport->lport = NULL;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
|
||||
kfree_rcu(tport, rcu);
|
||||
#else
|
||||
call_rcu(&tport->rcu, ft_tport_rcu_free);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -180,9 +164,6 @@ static struct ft_sess *ft_sess_get(struct fc_lport *lport, u32 port_id)
|
||||
{
|
||||
struct ft_tport *tport;
|
||||
struct hlist_head *head;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
|
||||
struct hlist_node *pos;
|
||||
#endif
|
||||
struct ft_sess *sess;
|
||||
|
||||
rcu_read_lock();
|
||||
@@ -192,11 +173,7 @@ static struct ft_sess *ft_sess_get(struct fc_lport *lport, u32 port_id)
|
||||
goto out;
|
||||
|
||||
head = &tport->hash[ft_sess_hash(port_id)];
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
|
||||
hlist_for_each_entry_rcu(sess, pos, head, hash) {
|
||||
#else
|
||||
hlist_for_each_entry_rcu(sess, head, hash) {
|
||||
#endif
|
||||
if (sess->port_id == port_id) {
|
||||
if (!kref_get_unless_zero(&sess->kref))
|
||||
sess = NULL;
|
||||
@@ -221,9 +198,6 @@ static int ft_sess_create(struct ft_tport *tport, struct fc_rport_priv *rdata,
|
||||
struct ft_sess *sess;
|
||||
struct scst_session *scst_sess;
|
||||
struct hlist_head *head;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
|
||||
struct hlist_node *pos;
|
||||
#endif
|
||||
u32 port_id;
|
||||
char name[FT_NAMELEN];
|
||||
|
||||
@@ -234,11 +208,7 @@ static int ft_sess_create(struct ft_tport *tport, struct fc_rport_priv *rdata,
|
||||
}
|
||||
|
||||
head = &tport->hash[ft_sess_hash(port_id)];
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
|
||||
hlist_for_each_entry_rcu(sess, pos, head, hash) {
|
||||
#else
|
||||
hlist_for_each_entry_rcu(sess, head, hash) {
|
||||
#endif
|
||||
if (sess->port_id == port_id) {
|
||||
sess->params = fcp_parm;
|
||||
return 0;
|
||||
@@ -299,17 +269,10 @@ static void ft_sess_unhash(struct ft_sess *sess)
|
||||
static struct ft_sess *ft_sess_delete(struct ft_tport *tport, u32 port_id)
|
||||
{
|
||||
struct hlist_head *head;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
|
||||
struct hlist_node *pos;
|
||||
#endif
|
||||
struct ft_sess *sess;
|
||||
|
||||
head = &tport->hash[ft_sess_hash(port_id)];
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
|
||||
hlist_for_each_entry_rcu(sess, pos, head, hash) {
|
||||
#else
|
||||
hlist_for_each_entry_rcu(sess, head, hash) {
|
||||
#endif
|
||||
if (sess->port_id == port_id) {
|
||||
ft_sess_unhash(sess);
|
||||
return sess;
|
||||
@@ -504,25 +467,12 @@ static void ft_prlo(struct fc_rport_priv *rdata)
|
||||
rdata->prli_count--;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36) && !defined(RHEL_MAJOR)
|
||||
static inline u32 fc_frame_sid(const struct fc_frame *fp)
|
||||
{
|
||||
return ntoh24(fc_frame_header_get(fp)->fh_s_id);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Handle incoming FCP request.
|
||||
* Caller has verified that the frame is type FCP.
|
||||
* Note that this may be called directly from the softirq context.
|
||||
*/
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36) \
|
||||
&& (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 <= 5)
|
||||
static void ft_recv(struct fc_lport *lport, struct fc_seq *sp,
|
||||
struct fc_frame *fp)
|
||||
#else
|
||||
static void ft_recv(struct fc_lport *lport, struct fc_frame *fp)
|
||||
#endif
|
||||
{
|
||||
struct ft_sess *sess;
|
||||
u32 sid = fc_frame_sid(fp);
|
||||
@@ -532,10 +482,6 @@ static void ft_recv(struct fc_lport *lport, struct fc_frame *fp)
|
||||
sess = ft_sess_get(lport, sid);
|
||||
if (!sess) {
|
||||
FT_SESS_DBG("sid %x sess lookup failed\n", sid);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36) \
|
||||
&& (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 <= 5)
|
||||
lport->tt.exch_done(sp);
|
||||
#endif
|
||||
/* TBD XXX - if FCP_CMND, send LOGO */
|
||||
fc_frame_free(fp);
|
||||
return;
|
||||
@@ -555,9 +501,6 @@ int ft_tgt_release(struct scst_tgt *tgt)
|
||||
{
|
||||
struct ft_tport *tport;
|
||||
struct hlist_head *head;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
|
||||
struct hlist_node *pos;
|
||||
#endif
|
||||
struct ft_sess *sess;
|
||||
|
||||
tport = scst_tgt_get_tgt_priv(tgt);
|
||||
@@ -565,11 +508,7 @@ int ft_tgt_release(struct scst_tgt *tgt)
|
||||
tport->lport->service_params &= ~FCP_SPPF_TARG_FCN;
|
||||
|
||||
for (head = tport->hash; head < &tport->hash[FT_SESS_HASH_SIZE]; head++)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
|
||||
hlist_for_each_entry_rcu(sess, pos, head, hash)
|
||||
#else
|
||||
hlist_for_each_entry_rcu(sess, head, hash)
|
||||
#endif
|
||||
ft_sess_close(sess);
|
||||
|
||||
synchronize_rcu();
|
||||
|
||||
Reference in New Issue
Block a user