]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
msg/async/rdma: define package sequence numbers macro
authorChangcheng Liu <changcheng.liu@aliyun.com>
Wed, 5 Jun 2019 03:13:07 +0000 (11:13 +0800)
committerChangcheng Liu <changcheng.liu@aliyun.com>
Fri, 23 Aug 2019 02:45:05 +0000 (10:45 +0800)
Refer to Doc: InfiniBandTM Architecture Specification Volume 1 Ver1.2.1
Section: 9.2 BASE TRANSPORT HEADER

bits  |31---------24 | 23-----------16 | 15----------8 | 7---------0 |
bytes |______________________________________________________________|
0 - 3 |____OpCode____|__|SE|M|Pad|Tver_|_________ Partition Key______|
4 - 7 |___Reserved___|______________Destination QP___________________|
8 -11 |A|Reserved 7__|________ PSN - Packet Sequence Number _________|

Signed-off-by: Changcheng Liu <changcheng.liu@aliyun.com>
src/msg/async/rdma/Infiniband.cc
src/msg/async/rdma/Infiniband.h

index 17286949c028775c1ac7e1a010be98daf11ced7f..ecca8d7a896e046ab4ffa01d223070d105eaaf39 100644 (file)
@@ -174,7 +174,7 @@ Infiniband::QueuePair::QueuePair(
   q_key(q_key),
   dead(false)
 {
-  initial_psn = lrand48() & 0xffffff;
+  initial_psn = lrand48() & PSN_MSK;
   if (type != IBV_QPT_RC && type != IBV_QPT_UD && type != IBV_QPT_RAW_PACKET) {
     lderr(cct) << __func__ << " invalid queue pair type" << cpp_strerror(errno) << dendl;
     ceph_abort();
index b1aec88400d7e088efb233f71c787b6546b1e3f2..a2d1f4e7c0ae143c9153464d49f692214fc5f530 100644 (file)
@@ -41,6 +41,9 @@
 #define ALIGN_TO_PAGE_SIZE(x) \
   (((x) + HUGE_PAGE_SIZE -1) / HUGE_PAGE_SIZE * HUGE_PAGE_SIZE)
 
+#define PSN_LEN 24
+#define PSN_MSK ((1 << PSN_LEN) - 1)
+
 struct IBSYNMsg {
   uint16_t lid;
   uint32_t qpn;