mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-19 13:46:25 +00:00
ib_srpt: More MOFED 3.3 fixes for kernel versions >= 4.6.0
This is a slightly modified version of a patch from Israel Rukshin <israelr@mellanox.com>. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6978 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
+10
-11
@@ -599,7 +599,7 @@ static void srpt_mad_send_handler(struct ib_mad_agent *mad_agent,
|
||||
* srpt_mad_recv_handler() - MAD reception callback function.
|
||||
*/
|
||||
static void srpt_mad_recv_handler(struct ib_mad_agent *mad_agent,
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) && !defined(MOFED_MAJOR)
|
||||
struct ib_mad_send_buf *send_buf,
|
||||
#endif
|
||||
struct ib_mad_recv_wc *mad_wc)
|
||||
@@ -626,9 +626,8 @@ static void srpt_mad_recv_handler(struct ib_mad_agent *mad_agent,
|
||||
#endif
|
||||
0, IB_MGMT_DEVICE_HDR, IB_MGMT_DEVICE_DATA,
|
||||
GFP_KERNEL
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) || \
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) && !defined(MOFED_MAJOR) || \
|
||||
defined(CREATE_SEND_MAD_HAS_BASE_ARG)
|
||||
|
||||
, 0
|
||||
#endif
|
||||
);
|
||||
@@ -3383,7 +3382,7 @@ static int srpt_perform_rdmas(struct srpt_rdma_ch *ch,
|
||||
struct srpt_send_ioctx *ioctx,
|
||||
scst_data_direction dir)
|
||||
{
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR)
|
||||
struct ib_send_wr wr;
|
||||
#else
|
||||
struct ib_rdma_wr wr;
|
||||
@@ -3408,7 +3407,7 @@ static int srpt_perform_rdmas(struct srpt_rdma_ch *ch,
|
||||
memset(&wr, 0, sizeof(wr));
|
||||
|
||||
for (i = 0; i < n_rdma; ++i, ++riu) {
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR)
|
||||
if (dir == SCST_DATA_READ) {
|
||||
wr.opcode = IB_WR_RDMA_WRITE;
|
||||
wr.wr_id = encode_wr_id(i == n_rdma - 1 ?
|
||||
@@ -3467,7 +3466,7 @@ static int srpt_perform_rdmas(struct srpt_rdma_ch *ch,
|
||||
pr_err("%s: ib_post_send() returned %d for %d/%d\n", __func__,
|
||||
ret, i, n_rdma);
|
||||
if (ret && i > 0) {
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR)
|
||||
wr.num_sge = 0;
|
||||
wr.wr_id = encode_wr_id(SRPT_RDMA_ABORT, ioctx->ioctx.index);
|
||||
wr.send_flags = IB_SEND_SIGNALED;
|
||||
@@ -3494,7 +3493,7 @@ static int srpt_perform_rdmas(struct srpt_rdma_ch *ch,
|
||||
#endif
|
||||
pr_info("Waiting until RDMA abort finished [%d]\n",
|
||||
ioctx->ioctx.index);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR)
|
||||
while (ch->state < CH_DISCONNECTED && !ioctx->rdma_aborted) {
|
||||
pr_info("Waiting until RDMA abort finished [%d]\n",
|
||||
ioctx->ioctx.index);
|
||||
@@ -4330,7 +4329,7 @@ static void srpt_add_one(struct ib_device *device)
|
||||
|
||||
sdev->device = device;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) || defined(MOFED_MAJOR)
|
||||
ret = ib_query_device(device, &sdev->dev_attr);
|
||||
if (ret) {
|
||||
pr_err("ib_query_device() failed: %d\n", ret);
|
||||
@@ -4418,7 +4417,7 @@ static void srpt_add_one(struct ib_device *device)
|
||||
* if this HCA is gone bad and replaced by different HCA
|
||||
*/
|
||||
ret = ib_cm_listen(sdev->cm_id, cpu_to_be64(srpt_service_guid), 0
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) || defined(MOFED_MAJOR)
|
||||
, NULL
|
||||
#endif
|
||||
);
|
||||
@@ -4490,7 +4489,7 @@ err:
|
||||
/**
|
||||
* srpt_remove_one() - InfiniBand device removal callback function.
|
||||
*/
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) || defined(MOFED_MAJOR)
|
||||
static void srpt_remove_one(struct ib_device *device)
|
||||
{
|
||||
void *client_data = ib_get_client_data(device, &srpt_client);
|
||||
@@ -4672,7 +4671,7 @@ static int __init srpt_init_module(void)
|
||||
(!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 6)
|
||||
rdma_cm_id = rdma_create_id(srpt_rdma_cm_handler, NULL,
|
||||
RDMA_PS_TCP);
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR)
|
||||
rdma_cm_id = rdma_create_id(srpt_rdma_cm_handler, NULL,
|
||||
RDMA_PS_TCP, IB_QPT_RC);
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user