[rdma-rc,v2,14/48] RDMA/cm: Service ID Resolution Request (SIDR_REQ) definitions
diff mbox series

Message ID 20191212093830.316934-15-leon@kernel.org
State Changes Requested
Delegated to: Jason Gunthorpe
Headers show
Series
  • Organize code according to IBTA layout
Related show

Commit Message

Leon Romanovsky Dec. 12, 2019, 9:37 a.m. UTC
From: Leon Romanovsky <leonro@mellanox.com>

Add SIDR_REQ message definitions as it is written
in IBTA release 1.3 volume 1.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/cm.c      | 4 ++--
 drivers/infiniband/core/cm_msgs.h | 2 +-
 drivers/infiniband/core/cma.c     | 2 +-
 include/rdma/ib_cm.h              | 2 --
 include/rdma/ibta_vol1_c12.h      | 7 +++++++
 5 files changed, 11 insertions(+), 6 deletions(-)

Patch
diff mbox series

diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 275603c56581..db17421beeff 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -3468,7 +3468,7 @@  int ib_send_cm_sidr_req(struct ib_cm_id *cm_id,
 	int ret;
 
 	if (!param->path || (param->private_data &&
-	     param->private_data_len > IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE))
+	     param->private_data_len > CM_SIDR_REQ_PRIVATE_DATA_SIZE))
 		return -EINVAL;
 
 	cm_id_priv = container_of(cm_id, struct cm_id_private, id);
@@ -3527,7 +3527,7 @@  static void cm_format_sidr_req_event(struct cm_work *work,
 	param->port = work->port->port_num;
 	param->sgid_attr = rx_cm_id->av.ah_attr.grh.sgid_attr;
 	work->cm_event.private_data = &sidr_req_msg->private_data;
-	work->cm_event.private_data_len = IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE;
+	work->cm_event.private_data_len = CM_SIDR_REQ_PRIVATE_DATA_SIZE;
 }
 
 static int cm_sidr_req_handler(struct cm_work *work)
diff --git a/drivers/infiniband/core/cm_msgs.h b/drivers/infiniband/core/cm_msgs.h
index 1ca2378bbf0d..47f7ce1ac143 100644
--- a/drivers/infiniband/core/cm_msgs.h
+++ b/drivers/infiniband/core/cm_msgs.h
@@ -764,7 +764,7 @@  struct cm_sidr_req_msg {
 	__be16 rsvd;
 	__be64 service_id;
 
-	u32 private_data[IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE / sizeof(u32)];
+	u32 private_data[CM_SIDR_REQ_PRIVATE_DATA_SIZE / sizeof(u32)];
 } __packed;
 
 struct cm_sidr_rep_msg {
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index ece92889aa88..aeb528b2aa49 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -2137,7 +2137,7 @@  static int cma_ib_req_handler(struct ib_cm_id *cm_id,
 		conn_id = cma_ib_new_udp_id(&listen_id->id, ib_event, net_dev);
 		event.param.ud.private_data = ib_event->private_data + offset;
 		event.param.ud.private_data_len =
-				IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE - offset;
+			CM_SIDR_REQ_PRIVATE_DATA_SIZE - offset;
 	} else {
 		conn_id = cma_ib_new_conn_id(&listen_id->id, ib_event, net_dev);
 		cma_set_req_event_data(&event, &ib_event->param.req_rcvd,
diff --git a/include/rdma/ib_cm.h b/include/rdma/ib_cm.h
index 18a3e2ee0758..8f0c377ad250 100644
--- a/include/rdma/ib_cm.h
+++ b/include/rdma/ib_cm.h
@@ -65,8 +65,6 @@  enum ib_cm_event_type {
 };
 
 enum ib_cm_data_size {
-	IB_CM_APR_INFO_LENGTH		 = 72,
-	IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE = 216,
 	IB_CM_SIDR_REP_PRIVATE_DATA_SIZE = 136,
 	IB_CM_SIDR_REP_INFO_LENGTH	 = 72,
 };
diff --git a/include/rdma/ibta_vol1_c12.h b/include/rdma/ibta_vol1_c12.h
index 6a747067d9c0..36aa3ab25b42 100644
--- a/include/rdma/ibta_vol1_c12.h
+++ b/include/rdma/ibta_vol1_c12.h
@@ -182,4 +182,11 @@ 
 #define CM_APR_PRIVATE_DATA CM_FIELD_MLOC(struct cm_apr_msg, 84, 1184)
 #define CM_APR_PRIVATE_DATA_SIZE 148
 
+/* Table 119 SIDR_REQ Message Contents */
+#define CM_SIDR_REQ_REQUESTID CM_FIELD32_LOC(struct cm_sidr_req_msg, 0, 32)
+#define CM_SIDR_REQ_PARTITION_KEY CM_FIELD16_LOC(struct cm_sidr_req_msg, 4, 16)
+#define CM_SIDR_REQ_SERVICEID CM_FIELD64_LOC(struct cm_sidr_req_msg, 8, 64)
+#define CM_SIDR_REQ_PRIVATE_DATA CM_FIELD_MLOC(struct cm_sidr_req_msg, 16, 1728)
+#define CM_SIDR_REQ_PRIVATE_DATA_SIZE 216
+
 #endif /* _IBTA_VOL1_C12_H_ */