[openib-general] [PATCH][4/4] ULP QP API

Roland Dreier roland at topspin.com
Fri Aug 13 10:49:25 PDT 2004


Index: src/linux-kernel/infiniband/ulp/ipoib/ipoib_verbs.c
===================================================================
--- src/linux-kernel/infiniband/ulp/ipoib/ipoib_verbs.c	(revision 621)
+++ src/linux-kernel/infiniband/ulp/ipoib/ipoib_verbs.c	(working copy)
@@ -30,7 +30,7 @@
 void ipoib_pkey_dev_check_presence(struct net_device *dev)
 {
 	struct ipoib_dev_priv *priv = dev->priv;
-	int pkey_index = 0;
+	u16 pkey_index = 0;
 
 	if (ib_cached_pkey_find(priv->ca, priv->port, priv->pkey, &pkey_index))
 		clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags);
@@ -41,8 +41,11 @@
 int ipoib_mcast_attach(struct net_device *dev, u16 mlid, union ib_gid *mgid)
 {
 	struct ipoib_dev_priv *priv = dev->priv;
-	struct ib_qp_attribute *qp_attr;
-	int ret, pkey_index;
+	struct ib_qp_attr *qp_attr;
+	struct ib_qp_cap qp_cap;
+	int attr_mask;
+	int ret;
+	u16 pkey_index;
 
 	ret = -ENOMEM;
 	qp_attr = kmalloc(sizeof(*qp_attr), GFP_ATOMIC);
@@ -58,8 +61,8 @@
 
 	/* set correct QKey for QP */
 	qp_attr->qkey = priv->qkey;
-	qp_attr->valid_fields = IB_QP_ATTRIBUTE_QKEY;
-	ret = ib_qp_modify(priv->qp, qp_attr);
+	attr_mask = IB_QP_QKEY;
+	ret = ib_modify_qp(priv->qp, qp_attr, attr_mask, &qp_cap);
 	if (ret) {
 		TS_REPORT_FATAL(MOD_IB_NET, "%s: failed to modify QP, ret = %d",
 				dev->name, ret);
@@ -99,21 +102,27 @@
 int ipoib_qp_create(struct net_device *dev)
 {
 	struct ipoib_dev_priv *priv = dev->priv;
-	int ret, pkey_index;
-	struct ib_qp_create_param qp_create = {
-		.limit = {
-			  .max_outstanding_send_request = IPOIB_TX_RING_SIZE,
-			  .max_outstanding_receive_request = IPOIB_RX_RING_SIZE,
-			  .max_send_gather_element = 1,
-			  .max_receive_scatter_element = 1,
-			  },
-		.pd = priv->pd,
-		.send_queue = priv->cq,
-		.receive_queue = priv->cq,
-		.transport = IB_TRANSPORT_UD,
+	int ret;
+	u16 pkey_index;
+
+	struct ib_qp_init_attr init_attr = {
+		.send_cq = priv->cq,
+		.recv_cq = priv->cq,
+		.cap = {
+			.max_send_wr  = IPOIB_TX_RING_SIZE,
+			.max_recv_wr  = IPOIB_RX_RING_SIZE,
+			.max_send_sge = 1,
+			.max_recv_sge = 1
+		},
+		.sq_sig_type = IB_SIGNAL_ALL_WR,
+		.rq_sig_type = IB_SIGNAL_ALL_WR,
+		.qp_type     = IB_QPT_UD
 	};
-	struct ib_qp_attribute qp_attr;
+	struct ib_qp_cap qp_cap;
 
+	struct ib_qp_attr qp_attr;
+	int attr_mask;
+
 	/*
 	 * Search through the port P_Key table for the requested pkey value.
 	 * The port has to be assigned to the respective IB partition in
@@ -126,23 +135,24 @@
 	}
 	set_bit(IPOIB_PKEY_ASSIGNED, &priv->flags);
 
-	ret = ib_qp_create(&qp_create, &priv->qp, &priv->local_qpn);
-	if (ret) {
+	priv->qp = ib_create_qp(priv->pd, &init_attr, &qp_cap);
+	if (IS_ERR(priv->qp)) {
 		TS_REPORT_FATAL(MOD_IB_NET, "%s: failed to create QP",
 				dev->name);
-		return ret;
+		return PTR_ERR(priv->qp);
 	}
+	priv->local_qpn = priv->qp->qp_num;
 
-	qp_attr.state = IB_QP_STATE_INIT;
+	qp_attr.qp_state = IB_QPS_INIT;
 	qp_attr.qkey = 0;
 	qp_attr.port = priv->port;
 	qp_attr.pkey_index = pkey_index;
-	qp_attr.valid_fields =
-	    IB_QP_ATTRIBUTE_QKEY |
-	    IB_QP_ATTRIBUTE_PORT |
-	    IB_QP_ATTRIBUTE_PKEY_INDEX |
-	    IB_QP_ATTRIBUTE_STATE;
-	ret = ib_qp_modify(priv->qp, &qp_attr);
+	attr_mask =
+	    IB_QP_QKEY |
+	    IB_QP_PORT |
+	    IB_QP_PKEY_INDEX |
+	    IB_QP_STATE;
+	ret = ib_modify_qp(priv->qp, &qp_attr, attr_mask, &qp_cap);
 	if (ret) {
 		TS_REPORT_FATAL(MOD_IB_NET,
 				"%s: failed to modify QP to init, ret = %d",
@@ -150,10 +160,10 @@
 		goto out_fail;
 	}
 
-	qp_attr.state = IB_QP_STATE_RTR;
+	qp_attr.qp_state = IB_QPS_RTR;
 	/* Can't set this in a INIT->RTR transition */
-	qp_attr.valid_fields &= ~IB_QP_ATTRIBUTE_PORT;
-	ret = ib_qp_modify(priv->qp, &qp_attr);
+	attr_mask &= ~IB_QP_PORT;
+	ret = ib_modify_qp(priv->qp, &qp_attr, attr_mask, &qp_cap);
 	if (ret) {
 		TS_REPORT_FATAL(MOD_IB_NET,
 				"%s: failed to modify QP to RTR, ret = %d",
@@ -161,11 +171,11 @@
 		goto out_fail;
 	}
 
-	qp_attr.state = IB_QP_STATE_RTS;
-	qp_attr.send_psn = 0;
-	qp_attr.valid_fields |= IB_QP_ATTRIBUTE_SEND_PSN;
-	qp_attr.valid_fields &= ~IB_QP_ATTRIBUTE_PKEY_INDEX;
-	ret = ib_qp_modify(priv->qp, &qp_attr);
+	qp_attr.qp_state = IB_QPS_RTS;
+	qp_attr.sq_psn = 0;
+	attr_mask |= IB_QP_SQ_PSN;
+	attr_mask &= ~IB_QP_PKEY_INDEX;
+	ret = ib_modify_qp(priv->qp, &qp_attr, attr_mask, &qp_cap);
 	if (ret) {
 		TS_REPORT_FATAL(MOD_IB_NET,
 				"%s: failed to modify QP to RTS, ret = %d",
@@ -176,7 +186,7 @@
 	return 0;
 
 out_fail:
-	ib_qp_destroy(priv->qp);
+	ib_destroy_qp(priv->qp);
 	priv->qp = NULL;
 
 	return -EINVAL;
@@ -186,7 +196,7 @@
 {
 	struct ipoib_dev_priv *priv = dev->priv;
 
-	if (ib_qp_destroy(priv->qp))
+	if (ib_destroy_qp(priv->qp))
 		TS_REPORT_WARN(MOD_IB_NET,
 			       "%s: ib_qp_destroy failed", dev->name);
 
@@ -227,7 +237,7 @@
 
 		priv->mr = ib_reg_phys_mr(priv->pd, &buffer_list,
 					  1,	/* list_len */
-					  IB_MR_LOCAL_WRITE,
+					  IB_ACCESS_LOCAL_WRITE,
 					  &dummy_iova);
 		if (IS_ERR(priv->mr)) {
 			TS_REPORT_FATAL(MOD_IB_NET,
@@ -255,7 +265,7 @@
 	struct ipoib_dev_priv *priv = dev->priv;
 
 	if (priv->qp != NULL) {
-		if (ib_qp_destroy(priv->qp))
+		if (ib_destroy_qp(priv->qp))
 			TS_REPORT_WARN(MOD_IB_NET,
 				       "%s: ib_qp_destroy failed", dev->name);
 
Index: src/linux-kernel/infiniband/ulp/ipoib/ipoib_ib.c
===================================================================
--- src/linux-kernel/infiniband/ulp/ipoib/ipoib_ib.c	(revision 621)
+++ src/linux-kernel/infiniband/ulp/ipoib/ipoib_ib.c	(working copy)
@@ -33,20 +33,20 @@
 			     u64 work_request_id,
 			     dma_addr_t addr)
 {
-	struct ib_gather_scatter list = {
-		.address = addr,
+	struct ib_sge list = {
+		.addr    = addr,
 		.length  = IPOIB_BUF_SIZE,
-		.key     = priv->lkey,
+		.lkey    = priv->lkey,
 	};
-	struct ib_receive_param param = {
-		.work_request_id = work_request_id,
-		.scatter_list = &list,
-		.num_scatter_entries = 1,
-		.device_specific = NULL,
-		.signaled = 1,
+	struct ib_recv_wr param = {
+		.wr_id 	    = work_request_id,
+		.sg_list    = &list,
+		.num_sge    = 1,
+		.recv_flags = IB_RECV_SIGNALED
 	};
+	struct ib_recv_wr *bad_wr;
 
-	return ib_receive(priv->qp, &param, 1);
+	return ib_post_recv(priv->qp, &param, &bad_wr);
 }
 
 /* =============================================================== */
@@ -286,23 +286,24 @@
 			  struct ib_ah *address, u32 qpn,
 			  dma_addr_t addr, int len)
 {
-	struct ib_gather_scatter list = {
-		.address = addr,
+	struct ib_sge list = {
+		.addr    = addr,
 		.length  = len,
-		.key     = priv->lkey,
+		.lkey    = priv->lkey,
 	};
-	struct ib_send_param param = {
-		.work_request_id = work_request_id,
-		.op = IB_OP_SEND,
-		.gather_list = &list,
-		.num_gather_entries = 1,
-		.dest_qpn = qpn,
-		.dest_qkey = priv->qkey,
-		.dest_address = address,
-		.signaled = 1,
+	struct ib_send_wr param = {
+		.wr_id = work_request_id,
+		.opcode = IB_WR_SEND,
+		.sg_list = &list,
+		.num_sge = 1,
+		.wr.ud.remote_qpn = qpn,
+		.wr.ud.remote_qkey = priv->qkey,
+		.wr.ud.ah = address,
+		.send_flags = IB_SEND_SIGNALED,
 	};
+	struct ib_send_wr *bad_wr;
 
-	return ib_send(priv->qp, &param, 1);
+	return ib_post_send(priv->qp, &param, &bad_wr);
 }
 
 /* =============================================================== */
Index: src/linux-kernel/infiniband/ulp/srp/srp_host.c
===================================================================
--- src/linux-kernel/infiniband/ulp/srp/srp_host.c	(revision 620)
+++ src/linux-kernel/infiniband/ulp/srp/srp_host.c	(working copy)
@@ -405,7 +405,7 @@
 
 		} else if (srp_pkt->in_use) {
 
-			srp_pkt->scatter_gather_list.address =
+			srp_pkt->scatter_gather_list.addr =
 			    (u64) (unsigned long)srp_pkt->data;
 			srp_pkt->scatter_gather_list.length = srp_cmd_pkt_size;
 			srp_pkt->in_use = 0;
@@ -436,7 +436,7 @@
 
 		} else if (srp_pkt->in_use) {
 
-			srp_pkt->scatter_gather_list.address =
+			srp_pkt->scatter_gather_list.addr =
 			    (u64) (unsigned long)srp_pkt->data;
 			srp_pkt->scatter_gather_list.length = srp_cmd_pkt_size;
 			srp_pkt->in_use = 0;
@@ -501,7 +501,7 @@
 
 		if (recv_pkt) {
 			recv_pkt->conn = s;
-			recv_pkt->scatter_gather_list.key =
+			recv_pkt->scatter_gather_list.lkey =
 			    target->l_key[s->port->hca->hca_index];
 			recv_pkt->scatter_gather_list.length = srp_cmd_pkt_size;
 
@@ -606,8 +606,8 @@
 		target->srp_pkt_data_mhndl[hca_index] =
 			ib_reg_phys_mr(hca->pd_hndl, &buffer_list,
 				       1, /*list_len */
-				       IB_MR_LOCAL_WRITE |
-				       IB_MR_REMOTE_READ,
+				       IB_ACCESS_LOCAL_WRITE |
+				       IB_ACCESS_REMOTE_READ,
 				       &iova);
 
 		if (IS_ERR(target->srp_pkt_data_mhndl[hca_index])) {
@@ -631,7 +631,7 @@
 		srp_pkt->conn = INVALID_CONN_HANDLE;
 		srp_pkt->target = target;
 		srp_pkt->data = srp_pkt_data;
-		srp_pkt->scatter_gather_list.address =
+		srp_pkt->scatter_gather_list.addr =
 		    (u64) (unsigned long) srp_pkt_data;
 		srp_pkt->scatter_gather_list.length = srp_cmd_pkt_size;
 
@@ -2361,11 +2361,11 @@
 		ioq->recv_pkt = recv_pkt;
 
 		send_pkt->conn = s;
-		send_pkt->scatter_gather_list.key =
+		send_pkt->scatter_gather_list.lkey =
 		    target->l_key[s->port->hca->hca_index];
 
 		recv_pkt->conn = s;
-		recv_pkt->scatter_gather_list.key =
+		recv_pkt->scatter_gather_list.lkey =
 		    target->l_key[s->port->hca->hca_index];
 
 	} else {
Index: src/linux-kernel/infiniband/ulp/srp/srp_host.h
===================================================================
--- src/linux-kernel/infiniband/ulp/srp/srp_host.h	(revision 620)
+++ src/linux-kernel/infiniband/ulp/srp/srp_host.h	(working copy)
@@ -244,7 +244,7 @@
 	int pkt_index;
 	int in_use;
 	char *data;
-	struct ib_gather_scatter scatter_gather_list;
+	struct ib_sge scatter_gather_list;
 	u32 r_key;
 } srp_pkt_t;
 
Index: src/linux-kernel/infiniband/ulp/srp/srptp.c
===================================================================
--- src/linux-kernel/infiniband/ulp/srp/srptp.c	(revision 620)
+++ src/linux-kernel/infiniband/ulp/srp/srptp.c	(working copy)
@@ -148,16 +148,17 @@
 int srptp_post_recv(srp_pkt_t * srp_pkt)
 {
 	int status;
-	struct ib_receive_param rcv_param;
+	struct ib_recv_wr rcv_param;
+	struct ib_recv_wr *bad_wr;
 
-	memset(&rcv_param, 0x00, sizeof(struct ib_receive_param));
-	rcv_param.work_request_id = srp_pkt->pkt_index;
-	rcv_param.scatter_list = &srp_pkt->scatter_gather_list;
-	rcv_param.num_scatter_entries = 1;
-	rcv_param.device_specific = NULL;
-	rcv_param.signaled = 1;
+	memset(&rcv_param, 0x00, sizeof rcv_param);
+	rcv_param.next = NULL;
+	rcv_param.wr_id = srp_pkt->pkt_index;
+	rcv_param.sg_list = &srp_pkt->scatter_gather_list;
+	rcv_param.num_sge = 1;
+	rcv_param.recv_flags = IB_RECV_SIGNALED;
 
-	status = ib_receive(srp_pkt->conn->qp_hndl, &rcv_param, 1);
+	status = ib_post_recv(srp_pkt->conn->qp_hndl, &rcv_param, &bad_wr);
 
 	if (status) {
 		TS_REPORT_FATAL(MOD_SRPTP, "Post Recv Failed failed");
@@ -173,17 +174,19 @@
  */
 int srptp_post_send(srp_pkt_t * srp_pkt)
 {
-	struct ib_send_param send_param;
+	struct ib_send_wr send_param;
+	struct ib_send_wr *bad_wr;
 	int status;
 
-	memset(&send_param, 0x00, sizeof(struct ib_send_param));
-	send_param.work_request_id = srp_pkt->pkt_index;
-	send_param.op = IB_OP_SEND;
-	send_param.gather_list = &srp_pkt->scatter_gather_list;
-	send_param.num_gather_entries = 1;
-	send_param.signaled = 1;
+	memset(&send_param, 0x00, sizeof send_param);
+	send_param.next = NULL;
+	send_param.wr_id = srp_pkt->pkt_index;
+	send_param.opcode = IB_WR_SEND;
+	send_param.sg_list = &srp_pkt->scatter_gather_list;
+	send_param.num_sge = 1;
+	send_param.send_flags = IB_SEND_SIGNALED;
 
-	status = ib_send(srp_pkt->conn->qp_hndl, &send_param, 1);
+	status = ib_post_send(srp_pkt->conn->qp_hndl, &send_param, &bad_wr);
 
 	if (status) {
 		TS_REPORT_FATAL(MOD_SRPTP, "ib_send failed: %d", status);
@@ -460,7 +463,7 @@
 			}
 		}
 
-		status = ib_qp_destroy(qp_hndl);
+		status = ib_destroy_qp(qp_hndl);
 		if (status)
 			TS_REPORT_WARN(MOD_SRPTP, "QP destroy failed");
 
@@ -489,7 +492,7 @@
 			srptp_reason = SRPTP_FAILURE;
 		}
 
-		status = ib_qp_destroy(qp_hndl);
+		status = ib_destroy_qp(qp_hndl);
 		if (status)
 			TS_REPORT_WARN(MOD_SRPTP, "QP destroy failed");
 
@@ -506,7 +509,7 @@
 		 */
 		srptp_reason = SRPTP_FAILURE;
 
-		status = ib_qp_destroy(qp_hndl);
+		status = ib_destroy_qp(qp_hndl);
 		if (status)
 			TS_REPORT_WARN(MOD_SRPTP, "QP destroy failed");
 
@@ -652,8 +655,10 @@
 	      struct ib_path_record *path_record,
 	      char *srp_login_req, int srp_login_req_len)
 {
-	struct ib_qp_create_param qp_param;
-	struct ib_qp_attribute *qp_attr;
+	struct ib_qp_init_attr init_attr;
+	struct ib_qp_cap qp_cap;
+	struct ib_qp_attr *qp_attr;
+	int    attr_mask;
 	struct ib_cm_active_param active_param;
 	srp_host_hca_params_t *hca;
 	int status;
@@ -665,52 +670,52 @@
 	 * connection
 	 */
 
-	qp_param.limit.max_outstanding_send_request = MAX_SEND_WQES;
-	qp_param.limit.max_outstanding_receive_request = MAX_RECV_WQES;
-	qp_param.limit.max_send_gather_element = 1;
-	qp_param.limit.max_receive_scatter_element = 1;
+	init_attr.cap.max_send_wr = MAX_SEND_WQES;
+	init_attr.cap.max_recv_wr = MAX_RECV_WQES;
+	init_attr.cap.max_send_sge = 1;
+	init_attr.cap.max_recv_sge = 1;
 
-	qp_param.pd = hca->pd_hndl;
-	qp_param.send_queue = conn->cqs_hndl;
-	qp_param.receive_queue = conn->cqr_hndl;
-	qp_param.send_policy = IB_WQ_SIGNAL_ALL;
-	qp_param.receive_policy = IB_WQ_SIGNAL_ALL;
-	qp_param.transport = IB_TRANSPORT_RC;
-	qp_param.device_specific = NULL;
+	init_attr.send_cq = conn->cqs_hndl;
+	init_attr.recv_cq = conn->cqr_hndl;
+	init_attr.sq_sig_type = IB_SIGNAL_ALL_WR;
+	init_attr.rq_sig_type = IB_SIGNAL_ALL_WR;
+	init_attr.qp_type = IB_QPT_RC;
 
-	status = ib_qp_create(&qp_param, &conn->qp_hndl, &conn->qpn);
-	if (status) {
-		TS_REPORT_FATAL(MOD_SRPTP, "QP Create failed %d", status);
-		return (status);
+	conn->qp_hndl = ib_create_qp(hca->pd_hndl, &init_attr, &qp_cap);
+	if (IS_ERR(conn->qp_hndl)) {
+		TS_REPORT_FATAL(MOD_SRPTP, "QP Create failed %d",
+				PTR_ERR(conn->qp_hndl));
+		return PTR_ERR(conn->qp_hndl);
 	}
+	conn->qpn = conn->qp_hndl->qp_num;
 	/*
 	 * Modify QP to init state
 	 */
-	qp_attr = kmalloc(sizeof(struct ib_qp_attribute), GFP_ATOMIC);
+	qp_attr = kmalloc(sizeof *qp_attr, GFP_ATOMIC);
 	if (qp_attr == NULL) {
 		return (ENOMEM);
 	}
 
-	memset(qp_attr, 0x00, sizeof(struct ib_qp_attribute));
+	memset(qp_attr, 0x00, sizeof *qp_attr);
 
-	qp_attr->valid_fields |= IB_QP_ATTRIBUTE_STATE;
-	qp_attr->state = IB_QP_STATE_INIT;
+	attr_mask = IB_QP_STATE;
+	qp_attr->qp_state = IB_QPS_INIT;
 
-	qp_attr->valid_fields |= IB_QP_ATTRIBUTE_RDMA_ATOMIC_ENABLE;
-	qp_attr->enable_rdma_read = 1;
-	qp_attr->enable_rdma_write = 1;
+	attr_mask |= IB_QP_ACCESS_FLAGS;
+	qp_attr->qp_access_flags =
+		IB_ACCESS_REMOTE_READ | IB_ACCESS_REMOTE_WRITE;
 
-	qp_attr->valid_fields |= IB_QP_ATTRIBUTE_PORT;
+	attr_mask |= IB_QP_PORT;
 	qp_attr->port = conn->port->local_port;
 
-	qp_attr->valid_fields |= IB_QP_ATTRIBUTE_PKEY_INDEX;
+	attr_mask |= IB_QP_PKEY_INDEX;
 	qp_attr->pkey_index = 0;
 
-	status = ib_qp_modify(conn->qp_hndl, qp_attr);
+	status = ib_modify_qp(conn->qp_hndl, qp_attr, attr_mask, &qp_cap);
 	kfree(qp_attr);
 
 	if (status) {
-		ib_qp_destroy(conn->qp_hndl);
+		ib_destroy_qp(conn->qp_hndl);
 		return (status);
 	}
 	/*
@@ -743,7 +748,7 @@
 		TS_REPORT_FATAL(MOD_SRPTP, "tsIbConnect failed: %d", status);
 
 		conn->comm_id = (tTS_IB_CM_COMM_ID) - 1;
-		ib_qp_destroy(conn->qp_hndl);
+		ib_destroy_qp(conn->qp_hndl);
 		srp_host_close_conn(conn);
 
 		return (status);
Index: src/linux-kernel/infiniband/ulp/sdp/sdp_send.c
===================================================================
--- src/linux-kernel/infiniband/ulp/sdp/sdp_send.c	(revision 620)
+++ src/linux-kernel/infiniband/ulp/sdp/sdp_send.c	(working copy)
@@ -243,7 +243,8 @@
 /*.._sdp_send_buff_post -- Post a buffer send on a SDP connection. */
 static s32 _sdp_send_buff_post(struct sdp_opt *conn, struct sdpc_buff *buff)
 {
-	struct ib_send_param send_param = { 0 };
+	struct ib_send_wr send_param = { 0 };
+	struct ib_send_wr *bad_wr;
 	s32 result;
 
 	TS_CHECK_NULL(conn, -EINVAL);
@@ -270,7 +271,7 @@
 	result = _sdp_msg_cpu_to_net_bsdh(buff->bsdh_hdr);
 	TS_EXPECT(MOD_LNX_SDP, !(0 > result));
 
-	send_param.op = IB_OP_SEND;
+	send_param.opcode = IB_WR_SEND;
 	/*
 	 * OOB processing. If there is a single OOB byte in flight then the
 	 * pending flag is set as early as possible. IF a second OOB byte
@@ -319,7 +320,7 @@
 	 */
 	if (0 < TS_SDP_BUFF_F_GET_SE(buff)) {
 
-		send_param.solicited_event = 1;
+		send_param.send_flags |= IB_SEND_SOLICITED;
 	}
 	/*
 	 * unsignalled event
@@ -333,7 +334,7 @@
 	else {
 
 		TS_SDP_BUFF_F_CLR_UNSIG(buff);
-		send_param.signaled = 1;
+		send_param.send_flags |= IB_SEND_SIGNALED;
 		conn->send_cons = 0;
 	}
 	/*
@@ -357,11 +358,12 @@
 	/*
 	 * post send
 	 */
-	send_param.work_request_id = buff->ib_wrid;
-	send_param.gather_list = TS_SDP_BUFF_GAT_SCAT(buff);
-	send_param.num_gather_entries = 1;
+	send_param.next = NULL;
+	send_param.wr_id = buff->ib_wrid;
+	send_param.sg_list = TS_SDP_BUFF_GAT_SCAT(buff);
+	send_param.num_sge = 1;
 
-	result = ib_send(conn->qp, &send_param, 1);
+	result = ib_post_send(conn->qp, &send_param, &bad_wr);
 	if (0 != result) {
 
 		TS_TRACE(MOD_LNX_SDP, T_VERBOSE, TRACE_FLOW_WARN,
@@ -529,7 +531,8 @@
 /*.._sdp_send_data_buff_snk -- Post data for buffered transmission */
 static s32 _sdp_send_data_buff_snk(struct sdp_opt *conn, struct sdpc_buff *buff)
 {
-	struct ib_send_param send_param = { 0 };
+	struct ib_send_wr send_param = { 0 };
+	struct ib_send_wr *bad_wr;
 	struct sdpc_advt *advt;
 	s32 result;
 	s32 zcopy;
@@ -586,10 +589,10 @@
 	/*
 	 * setup RDMA write
 	 */
-	send_param.op = IB_OP_RDMA_WRITE;
-	send_param.remote_address = advt->addr;
-	send_param.rkey = advt->rkey;
-	send_param.signaled = 1;
+	send_param.opcode = IB_WR_RDMA_WRITE;
+	send_param.wr.rdma.remote_addr = advt->addr;
+	send_param.wr.rdma.rkey = advt->rkey;
+	send_param.send_flags = IB_SEND_SIGNALED;
 
 	buff->ib_wrid = conn->send_wrid++;
 	buff->lkey = conn->l_key;
@@ -630,11 +633,12 @@
 	/*
 	 * post RDMA
 	 */
-	send_param.work_request_id = buff->ib_wrid;
-	send_param.gather_list = TS_SDP_BUFF_GAT_SCAT(buff);
-	send_param.num_gather_entries = 1;
+	send_param.next = NULL;
+	send_param.wr_id = buff->ib_wrid;
+	send_param.sg_list = TS_SDP_BUFF_GAT_SCAT(buff);
+	send_param.num_sge = 1;
 
-	result = ib_send(conn->qp, &send_param, 1);
+	result = ib_post_send(conn->qp, &send_param, &bad_wr);
 	if (0 != result) {
 
 		TS_TRACE(MOD_LNX_SDP, T_VERBOSE, TRACE_FLOW_WARN,
@@ -681,8 +685,9 @@
 /*.._sdp_send_data_iocb_snk -- process a zcopy write advert in the data path */
 s32 _sdp_send_data_iocb_snk(struct sdp_opt *conn, struct sdpc_iocb *iocb)
 {
-	struct ib_send_param send_param = { 0 };
-	struct ib_gather_scatter sg_val;
+	struct ib_send_wr send_param = { 0 };
+	struct ib_send_wr *bad_wr;
+	struct ib_sge sg_val;
 	struct sdpc_advt *advt;
 	s32 result;
 	s32 zcopy;
@@ -722,14 +727,14 @@
 		 */
 		zcopy = min(advt->size, iocb->len);
 
-		sg_val.address = iocb->io_addr;
-		sg_val.key = iocb->l_key;
+		sg_val.addr = iocb->io_addr;
+		sg_val.lkey = iocb->l_key;
 		sg_val.length = zcopy;
 
-		send_param.op = IB_OP_RDMA_WRITE;
-		send_param.remote_address = advt->addr;
-		send_param.rkey = advt->rkey;
-		send_param.signaled = 1;
+		send_param.opcode = IB_WR_RDMA_WRITE;
+		send_param.wr.rdma.remote_addr = advt->addr;
+		send_param.wr.rdma.rkey = advt->rkey;
+		send_param.send_flags = IB_SEND_SIGNALED;
 
 		iocb->wrid = conn->send_wrid++;
 		iocb->len -= zcopy;
@@ -757,11 +762,12 @@
 		/*
 		 * post RDMA
 		 */
-		send_param.work_request_id = iocb->wrid;
-		send_param.gather_list = &sg_val;
-		send_param.num_gather_entries = 1;
+		send_param.next = NULL;
+		send_param.wr_id = iocb->wrid;
+		send_param.sg_list = &sg_val;
+		send_param.num_sge = 1;
 
-		result = ib_send(conn->qp, &send_param, 1);
+		result = ib_post_send(conn->qp, &send_param, &bad_wr);
 		if (0 != result) {
 
 			TS_TRACE(MOD_LNX_SDP, T_VERBOSE, TRACE_FLOW_WARN,
Index: src/linux-kernel/infiniband/ulp/sdp/sdp_conn.c
===================================================================
--- src/linux-kernel/infiniband/ulp/sdp/sdp_conn.c	(revision 619)
+++ src/linux-kernel/infiniband/ulp/sdp/sdp_conn.c	(working copy)
@@ -697,7 +697,7 @@
 	 */
 	if (conn->qp) {
 
-		result = ib_qp_destroy(conn->qp);
+		result = ib_destroy_qp(conn->qp);
 		if (0 > result && -EINVAL != result) {
 
 			TS_TRACE(MOD_LNX_SDP, T_TERSE, TRACE_FLOW_WARN,
@@ -997,10 +997,12 @@
 		      struct ib_device *device,
 		      tTS_IB_PORT hw_port)
 {
-	struct ib_qp_create_param *qp_param;
-	struct ib_qp_attribute    *qp_attr;
+	struct ib_qp_init_attr *init_attr;
+	struct ib_qp_attr     *qp_attr;
 	struct sdev_hca_port  *port = NULL;
 	struct sdev_hca       *hca = NULL;
+	struct ib_qp_cap       qp_cap;
+	int                    attr_mask;
 	int                    result;
 
 	TS_CHECK_NULL(conn, -EINVAL);
@@ -1031,22 +1033,22 @@
 	/*
 	 * allocate creation parameters
 	 */
-	qp_attr = kmalloc(sizeof(struct ib_qp_attribute),  GFP_KERNEL);
+	qp_attr = kmalloc(sizeof *qp_attr,  GFP_KERNEL);
 	if (NULL == qp_attr) {
 		
 		result = -ENOMEM;
 		goto error_attr;
 	} /* if */
   
-	qp_param = kmalloc(sizeof(struct ib_qp_create_param),  GFP_KERNEL);
-	if (NULL == qp_param) {
+	init_attr = kmalloc(sizeof *init_attr, GFP_KERNEL);
+	if (NULL == init_attr) {
 		
 		result = -ENOMEM;
 		goto error_param;
 	} /* if */
 	
-	memset(qp_attr, 0, sizeof(struct ib_qp_attribute));
-	memset(qp_param, 0, sizeof(struct ib_qp_create_param));
+	memset(qp_attr,   0, sizeof *qp_attr);
+	memset(init_attr, 0, sizeof *init_attr);
 	/*
 	 * set port specific connection parameters.
 	 */
@@ -1115,49 +1117,47 @@
 
 	if (!conn->qp) {
 
-		qp_param->limit.max_outstanding_send_request = 
-			conn->send_cq_size;
-		qp_param->limit.max_outstanding_receive_request = 
-			conn->recv_cq_size;
-		qp_param->limit.max_send_gather_element =
-		    TS_SDP_QP_LIMIT_SG_SEND;
-		qp_param->limit.max_receive_scatter_element =
-		    TS_SDP_QP_LIMIT_SG_RECV;
+		init_attr->cap.max_send_wr = conn->send_cq_size;
+		init_attr->cap.max_recv_wr = conn->recv_cq_size;
+		init_attr->cap.max_send_sge = TS_SDP_QP_LIMIT_SG_SEND;
+		init_attr->cap.max_recv_sge = TS_SDP_QP_LIMIT_SG_RECV;
 
-		qp_param->pd             = conn->pd;
-		qp_param->send_queue     = conn->send_cq;
-		qp_param->receive_queue  = conn->recv_cq;
-		qp_param->send_policy    = IB_WQ_SIGNAL_SELECTABLE;
-		qp_param->receive_policy = IB_WQ_SIGNAL_ALL;
-		qp_param->transport      = IB_TRANSPORT_RC;
+		init_attr->send_cq        = conn->send_cq;
+		init_attr->recv_cq        = conn->recv_cq;
+		init_attr->sq_sig_type    = IB_SIGNAL_REQ_WR;
+		init_attr->rq_sig_type    = IB_SIGNAL_ALL_WR;
+		init_attr->qp_type        = IB_QPT_RC;
 
-		result = ib_qp_create(qp_param, &conn->qp, &conn->s_qpn);
-		if (0 != result) {
+		conn->qp = ib_create_qp(conn->pd, init_attr, &qp_cap);
+		if (IS_ERR(conn->qp)) {
 
+			result = PTR_ERR(conn->qp);
 			TS_TRACE(MOD_LNX_SDP, T_TERSE, TRACE_FLOW_FATAL,
 				 "INIT: Error <%d> creating queue pair.",
 				 result);
 			goto error_qp;
 		}
+		conn->s_qpn = conn->qp->qp_num;
+
 		/*
 		 * modify QP to INIT
 		 */
-		memset(qp_attr, 0, sizeof(struct ib_qp_attribute));
+		memset(qp_attr, 0, sizeof(struct ib_qp_attr));
 
-		qp_attr->valid_fields |= IB_QP_ATTRIBUTE_STATE;
-		qp_attr->state = IB_QP_STATE_INIT;
+		attr_mask = IB_QP_STATE;
+		qp_attr->qp_state = IB_QPS_INIT;
 
-		qp_attr->valid_fields |= IB_QP_ATTRIBUTE_RDMA_ATOMIC_ENABLE;
-		qp_attr->enable_rdma_read = 1;
-		qp_attr->enable_rdma_write = 1;
+		attr_mask |= IB_QP_ACCESS_FLAGS;
+		qp_attr->qp_access_flags =
+			IB_ACCESS_REMOTE_READ | IB_ACCESS_REMOTE_WRITE;
 
-		qp_attr->valid_fields |= IB_QP_ATTRIBUTE_PORT;
+		attr_mask |= IB_QP_PORT;
 		qp_attr->port = conn->hw_port;
 
-		qp_attr->valid_fields |= IB_QP_ATTRIBUTE_PKEY_INDEX;
+		attr_mask |= IB_QP_PKEY_INDEX;
 		qp_attr->pkey_index = 0;
 
-		result = ib_qp_modify(conn->qp, qp_attr);
+		result = ib_modify_qp(conn->qp, qp_attr, attr_mask, &qp_cap);
 
 		if (0 != result) {
 
@@ -1172,7 +1172,7 @@
 	goto done;
 
 error_mod:
-	(void)ib_qp_destroy(conn->qp);
+	(void)ib_destroy_qp(conn->qp);
 error_qp:
 	(void)ib_destroy_cq(conn->recv_cq);
 error_rcq:
@@ -1182,7 +1182,7 @@
 	conn->recv_cq = NULL;
 	conn->qp      = NULL;
 done:
-	kfree(qp_param);
+	kfree(init_attr);
 error_param:
 	kfree(qp_attr);
 error_attr:
Index: src/linux-kernel/infiniband/ulp/sdp/sdp_recv.c
===================================================================
--- src/linux-kernel/infiniband/ulp/sdp/sdp_recv.c	(revision 619)
+++ src/linux-kernel/infiniband/ulp/sdp/sdp_recv.c	(working copy)
@@ -40,7 +40,8 @@
 /*.._sdp_post_recv_buff -- post a single buffers for data recv */
 static s32 _sdp_post_recv_buff(struct sdp_opt *conn)
 {
-	struct ib_receive_param receive_param = { 0 };
+	struct ib_recv_wr receive_param = { 0 };
+	struct ib_recv_wr *bad_wr;
 	s32 result;
 	struct sdpc_buff *buff;
 
@@ -88,12 +89,13 @@
 	/*
 	 * post recv
 	 */
-	receive_param.work_request_id = buff->ib_wrid;
-	receive_param.scatter_list = TS_SDP_BUFF_GAT_SCAT(buff);
-	receive_param.num_scatter_entries = 1;
-	receive_param.signaled = 1;
+	receive_param.next = NULL;
+	receive_param.wr_id = buff->ib_wrid;
+	receive_param.sg_list = TS_SDP_BUFF_GAT_SCAT(buff);
+	receive_param.num_sge = 1;
+	receive_param.recv_flags = IB_RECV_SIGNALED;
 
-	result = ib_receive(conn->qp, &receive_param, 1);
+	result = ib_post_recv(conn->qp, &receive_param, &bad_wr);
 	if (0 != result) {
 
 		TS_TRACE(MOD_LNX_SDP, T_VERBOSE, TRACE_FLOW_WARN,
@@ -115,7 +117,8 @@
 /*.._sdp_post_rdma_buff -- post a single buffers for rdma read on a conn */
 static s32 _sdp_post_rdma_buff(struct sdp_opt *conn)
 {
-	struct ib_send_param send_param = { 0 };
+	struct ib_send_wr send_param = { 0 };
+	struct ib_send_wr *bad_wr;
 	struct sdpc_advt *advt;
 	s32 result;
 	struct sdpc_buff *buff;
@@ -162,10 +165,10 @@
 
 	buff->ib_wrid = TS_SDP_WRID_READ_FLAG | conn->recv_wrid++;
 
-	send_param.op = IB_OP_RDMA_READ;
-	send_param.remote_address = advt->addr;
-	send_param.rkey = advt->rkey;
-	send_param.signaled = 1;
+	send_param.opcode = IB_WR_RDMA_READ;
+	send_param.wr.rdma.remote_addr = advt->addr;
+	send_param.wr.rdma.rkey = advt->rkey;
+	send_param.send_flags = IB_SEND_SIGNALED;
 
 	advt->wrid = buff->ib_wrid;
 	advt->size -= (buff->tail - buff->data);
@@ -222,11 +225,12 @@
 	/*
 	 * post rdma
 	 */
-	send_param.work_request_id = buff->ib_wrid;
-	send_param.gather_list = TS_SDP_BUFF_GAT_SCAT(buff);
-	send_param.num_gather_entries = 1;
+	send_param.next = NULL;
+	send_param.wr_id = buff->ib_wrid;
+	send_param.sg_list = TS_SDP_BUFF_GAT_SCAT(buff);
+	send_param.num_sge = 1;
 
-	result = ib_send(conn->qp, &send_param, 1);
+	result = ib_post_send(conn->qp, &send_param, &bad_wr);
 	if (0 != result) {
 
 		TS_TRACE(MOD_LNX_SDP, T_VERBOSE, TRACE_FLOW_WARN,
@@ -250,8 +254,9 @@
 /*.._sdp_post_rdma_iocb_src -- post a iocb for rdma read on a conn */
 static s32 _sdp_post_rdma_iocb_src(struct sdp_opt *conn)
 {
-	struct ib_send_param send_param = { 0 };
-	struct ib_gather_scatter sg_val;
+	struct ib_send_wr send_param = { 0 };
+	struct ib_send_wr *bad_wr;
+	struct ib_sge sg_val;
 	struct sdpc_iocb *iocb;
 	struct sdpc_advt *advt;
 	s32 result;
@@ -307,14 +312,14 @@
 	 */
 	zcopy = min(advt->size, iocb->len);
 
-	sg_val.address = iocb->io_addr;
-	sg_val.key = iocb->l_key;
+	sg_val.addr = iocb->io_addr;
+	sg_val.lkey = iocb->l_key;
 	sg_val.length = zcopy;
 
-	send_param.op = IB_OP_RDMA_READ;
-	send_param.remote_address = advt->addr;
-	send_param.rkey = advt->rkey;
-	send_param.signaled = 1;
+	send_param.opcode = IB_WR_RDMA_READ;
+	send_param.wr.rdma.remote_addr = advt->addr;
+	send_param.wr.rdma.rkey = advt->rkey;
+	send_param.send_flags = IB_SEND_SIGNALED;
 
 	iocb->wrid = TS_SDP_WRID_READ_FLAG | conn->recv_wrid++;
 	iocb->len -= zcopy;
@@ -392,11 +397,12 @@
 	/*
 	 * post RDMA
 	 */
-	send_param.work_request_id = iocb->wrid;
-	send_param.gather_list = &sg_val;
-	send_param.num_gather_entries = 1;
+	send_param.next = NULL;
+	send_param.wr_id = iocb->wrid;
+	send_param.sg_list = &sg_val;
+	send_param.num_sge = 1;
 
-	result = ib_send(conn->qp, &send_param, 1);
+	result = ib_post_send(conn->qp, &send_param, &bad_wr);
 	if (0 != result) {
 
 		TS_TRACE(MOD_LNX_SDP, T_VERBOSE, TRACE_FLOW_WARN,
Index: src/linux-kernel/infiniband/ulp/sdp/sdp_buff.h
===================================================================
--- src/linux-kernel/infiniband/ulp/sdp/sdp_buff.h	(revision 619)
+++ src/linux-kernel/infiniband/ulp/sdp/sdp_buff.h	(working copy)
@@ -93,7 +93,7 @@
 #define TS_SDP_BUFF_GAT_SCAT(buff)                \
    ({ (buff)->real = virt_to_phys((buff)->data);  \
       (buff)->size = (buff)->tail - (buff)->data; \
-      (struct ib_gather_scatter *)(&(buff)->real); })
+      (struct ib_sge *)(&(buff)->real); })
 /*
  * function prototypes used in certain functions.
  */




More information about the general mailing list