mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-17 10:41:26 +00:00
isert-scst: Port to Linux kernel v4.4
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6699 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -98,7 +98,11 @@ struct isert_wr {
|
||||
struct ib_sge *sge_list;
|
||||
union {
|
||||
struct ib_recv_wr recv_wr;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
|
||||
struct ib_send_wr send_wr;
|
||||
#else
|
||||
struct ib_rdma_wr send_wr;
|
||||
#endif
|
||||
};
|
||||
} ____cacheline_aligned;
|
||||
|
||||
|
||||
@@ -238,9 +238,14 @@ int isert_wr_init(struct isert_wr *wr,
|
||||
buff_offset = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
|
||||
wr->send_wr.wr.rdma.remote_addr = pdu->rem_write_va +
|
||||
buff_offset;
|
||||
wr->send_wr.wr.rdma.rkey = pdu->rem_write_stag;
|
||||
#else
|
||||
wr->send_wr.remote_addr = pdu->rem_write_va + buff_offset;
|
||||
wr->send_wr.rkey = pdu->rem_write_stag;
|
||||
#endif
|
||||
break;
|
||||
case ISER_WR_RDMA_WRITE:
|
||||
send_wr_op = IB_WR_RDMA_WRITE;
|
||||
@@ -250,9 +255,14 @@ int isert_wr_init(struct isert_wr *wr,
|
||||
buff_offset = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
|
||||
wr->send_wr.wr.rdma.remote_addr = pdu->rem_read_va +
|
||||
buff_offset;
|
||||
wr->send_wr.wr.rdma.rkey = pdu->rem_read_stag;
|
||||
#else
|
||||
wr->send_wr.remote_addr = pdu->rem_read_va + buff_offset;
|
||||
wr->send_wr.rkey = pdu->rem_read_stag;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
@@ -278,12 +288,21 @@ int isert_wr_init(struct isert_wr *wr,
|
||||
wr->recv_wr.sg_list = wr->sge_list;
|
||||
wr->recv_wr.num_sge = sg_cnt;
|
||||
} else {
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
|
||||
wr->send_wr.next = NULL;
|
||||
wr->send_wr.wr_id = _ptr_to_u64(wr);
|
||||
wr->send_wr.sg_list = wr->sge_list;
|
||||
wr->send_wr.num_sge = sg_cnt;
|
||||
wr->send_wr.opcode = send_wr_op;
|
||||
wr->send_wr.send_flags = send_flags;
|
||||
#else
|
||||
wr->send_wr.wr.next = NULL;
|
||||
wr->send_wr.wr.wr_id = _ptr_to_u64(wr);
|
||||
wr->send_wr.wr.sg_list = wr->sge_list;
|
||||
wr->send_wr.wr.num_sge = sg_cnt;
|
||||
wr->send_wr.wr.opcode = send_wr_op;
|
||||
wr->send_wr.wr.send_flags = send_flags;
|
||||
#endif
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
@@ -214,7 +214,11 @@ out:
|
||||
static inline void isert_link_send_wrs(struct isert_wr *from_wr,
|
||||
struct isert_wr *to_wr)
|
||||
{
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
|
||||
from_wr->send_wr.next = &to_wr->send_wr;
|
||||
#else
|
||||
from_wr->send_wr.wr.next = &to_wr->send_wr.wr;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void isert_link_send_pdu_wrs(struct isert_cmnd *from_pdu,
|
||||
@@ -222,7 +226,11 @@ static inline void isert_link_send_pdu_wrs(struct isert_cmnd *from_pdu,
|
||||
int wr_cnt)
|
||||
{
|
||||
isert_link_send_wrs(&from_pdu->wr[wr_cnt - 1], &to_pdu->wr[0]);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
|
||||
to_pdu->wr[0].send_wr.next = NULL;
|
||||
#else
|
||||
to_pdu->wr[0].send_wr.wr.next = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
int isert_prepare_rdma(struct isert_cmnd *isert_pdu,
|
||||
@@ -281,8 +289,14 @@ int isert_prepare_rdma(struct isert_cmnd *isert_pdu,
|
||||
isert_link_send_wrs(&isert_pdu->wr[i - 1], &isert_pdu->wr[i]);
|
||||
|
||||
if (op == ISER_WR_RDMA_READ) {
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
|
||||
isert_pdu->wr[wr_cnt - 1].send_wr.send_flags = IB_SEND_SIGNALED;
|
||||
isert_pdu->wr[wr_cnt - 1].send_wr.next = NULL;
|
||||
#else
|
||||
isert_pdu->wr[wr_cnt - 1].send_wr.wr.send_flags =
|
||||
IB_SEND_SIGNALED;
|
||||
isert_pdu->wr[wr_cnt - 1].send_wr.wr.next = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
out:
|
||||
@@ -574,7 +588,11 @@ int isert_pdu_send(struct isert_connection *isert_conn,
|
||||
#endif
|
||||
|
||||
wr = &tx_pdu->wr[0];
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
|
||||
wr->send_wr.num_sge = isert_pdu_prepare_send(isert_conn, tx_pdu);
|
||||
#else
|
||||
wr->send_wr.wr.num_sge = isert_pdu_prepare_send(isert_conn, tx_pdu);
|
||||
#endif
|
||||
|
||||
err = isert_post_send(isert_conn, wr, 1);
|
||||
if (unlikely(err)) {
|
||||
@@ -595,8 +613,13 @@ int isert_pdu_post_rdma_write(struct isert_connection *isert_conn,
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
|
||||
isert_rsp->wr[0].send_wr.num_sge = isert_pdu_prepare_send(isert_conn,
|
||||
isert_rsp);
|
||||
#else
|
||||
isert_rsp->wr[0].send_wr.wr.num_sge = isert_pdu_prepare_send(isert_conn,
|
||||
isert_rsp);
|
||||
#endif
|
||||
isert_link_send_pdu_wrs(isert_cmd, isert_rsp, wr_cnt);
|
||||
err = isert_post_send(isert_conn, &isert_cmd->wr[0], wr_cnt + 1);
|
||||
if (unlikely(err)) {
|
||||
|
||||
@@ -103,7 +103,11 @@ int isert_post_send(struct isert_connection *isert_conn,
|
||||
struct isert_wr *first_wr,
|
||||
int num_wr)
|
||||
{
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
|
||||
struct ib_send_wr *first_ib_wr = &first_wr->send_wr;
|
||||
#else
|
||||
struct ib_send_wr *first_ib_wr = &first_wr->send_wr.wr;
|
||||
#endif
|
||||
struct ib_send_wr *bad_wr;
|
||||
int num_posted;
|
||||
int err;
|
||||
@@ -131,9 +135,19 @@ void isert_post_drain(struct isert_connection *isert_conn)
|
||||
|
||||
isert_wr_set_fields(&isert_conn->drain_wr, isert_conn, NULL);
|
||||
isert_conn->drain_wr.wr_op = ISER_WR_SEND;
|
||||
isert_conn->drain_wr.send_wr.wr_id = _ptr_to_u64(&isert_conn->drain_wr);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
|
||||
isert_conn->drain_wr.send_wr.wr_id =
|
||||
_ptr_to_u64(&isert_conn->drain_wr);
|
||||
isert_conn->drain_wr.send_wr.opcode = IB_WR_SEND;
|
||||
err = ib_post_send(isert_conn->qp, &isert_conn->drain_wr.send_wr, &bad_wr);
|
||||
err = ib_post_send(isert_conn->qp,
|
||||
&isert_conn->drain_wr.send_wr, &bad_wr);
|
||||
#else
|
||||
isert_conn->drain_wr.send_wr.wr.wr_id =
|
||||
_ptr_to_u64(&isert_conn->drain_wr);
|
||||
isert_conn->drain_wr.send_wr.wr.opcode = IB_WR_SEND;
|
||||
err = ib_post_send(isert_conn->qp,
|
||||
&isert_conn->drain_wr.send_wr.wr, &bad_wr);
|
||||
#endif
|
||||
if (unlikely(err)) {
|
||||
pr_err("Failed to post drain wr, err:%d\n", err);
|
||||
/*
|
||||
@@ -601,6 +615,7 @@ static void isert_handle_wc_error(struct ib_wc *wc)
|
||||
struct isert_buf *isert_buf = wr->buf;
|
||||
struct isert_device *isert_dev = wr->isert_dev;
|
||||
struct ib_device *ib_dev = isert_dev->ib_dev;
|
||||
u32 num_sge;
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
@@ -615,7 +630,12 @@ static void isert_handle_wc_error(struct ib_wc *wc)
|
||||
|
||||
switch (wr->wr_op) {
|
||||
case ISER_WR_SEND:
|
||||
if (unlikely(wr->send_wr.num_sge == 0)) /* Drain WR */
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
|
||||
num_sge = wr->send_wr.num_sge;
|
||||
#else
|
||||
num_sge = wr->send_wr.wr.num_sge;
|
||||
#endif
|
||||
if (unlikely(num_sge == 0)) /* Drain WR */
|
||||
isert_sched_conn_drained(isert_conn);
|
||||
else
|
||||
isert_pdu_err(&isert_pdu->iscsi);
|
||||
@@ -1648,9 +1668,12 @@ struct isert_portal *isert_portal_create(void)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) && \
|
||||
(!defined(RHEL_MAJOR) || RHEL_MAJOR -0 <= 5)
|
||||
cm_id = rdma_create_id(isert_cm_evt_handler, portal, RDMA_PS_TCP);
|
||||
#else
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
|
||||
cm_id = rdma_create_id(isert_cm_evt_handler, portal, RDMA_PS_TCP,
|
||||
IB_QPT_RC);
|
||||
#else
|
||||
cm_id = rdma_create_id(&init_net, isert_cm_evt_handler, portal,
|
||||
RDMA_PS_TCP, IB_QPT_RC);
|
||||
#endif
|
||||
if (unlikely(IS_ERR(cm_id))) {
|
||||
err = PTR_ERR(cm_id);
|
||||
|
||||
Reference in New Issue
Block a user