components/open-fabrics/libmlx4/patches/002-libmlx4-shpd_fmr.patch
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Thu, 26 Jan 2017 16:44:14 -0800
changeset 7617 14b1a4293086
parent 5708 49b43e37ce26
permissions -rw-r--r--
Close of build 117.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5708
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
     1
#This patch was developed both in-house and from outside. We plan to submit it
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
     2
#upstream, but do not yet have a target date for doing so
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
     3
#
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
     4
# HG changeset patch
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
     5
# Parent  cb9a51f3fdf99efd32b1dbadb44a974593c50163
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
     6
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
     7
diff -r cb9a51f3fdf9 src/mlx4-abi.h
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
     8
--- a/src/mlx4-abi.h	Fri Nov 13 00:56:50 2015 -0800
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
     9
+++ b/src/mlx4-abi.h	Fri Nov 13 00:58:16 2015 -0800
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    10
@@ -78,6 +78,12 @@
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    11
 	__u32				reserved;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    12
 };
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    13
 
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    14
+struct mlx4_share_pd_resp {
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    15
+	struct ibv_share_pd_resp	ibv_resp;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    16
+	__u32				pdn;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    17
+	__u32				reserved;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    18
+};
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    19
+
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    20
 struct mlx4_create_cq {
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    21
 	struct ibv_create_cq		ibv_cmd;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    22
 #if !(defined(__SVR4) && defined(__sun))
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    23
diff -r cb9a51f3fdf9 src/mlx4.c
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    24
--- a/src/mlx4.c	Fri Nov 13 00:56:50 2015 -0800
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    25
+++ b/src/mlx4.c	Fri Nov 13 00:58:16 2015 -0800
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    26
@@ -91,8 +91,13 @@
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    27
 	.query_port    = mlx4_query_port,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    28
 	.alloc_pd      = mlx4_alloc_pd,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    29
 	.dealloc_pd    = mlx4_free_pd,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    30
+	.alloc_shpd    = mlx4_alloc_shpd,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    31
+	.share_pd      = mlx4_share_pd,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    32
 	.reg_mr	       = mlx4_reg_mr,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    33
+	.reg_mr_relaxed	       = mlx4_reg_mr_relaxed,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    34
 	.dereg_mr      = mlx4_dereg_mr,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    35
+	.dereg_mr_relaxed      = mlx4_dereg_mr_relaxed,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    36
+	.flush_relaxed_mr      = mlx4_flush_relaxed_mr,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    37
 	.create_cq     = mlx4_create_cq,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    38
 	.poll_cq       = mlx4_poll_cq,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    39
 	.req_notify_cq = mlx4_arm_cq,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    40
diff -r cb9a51f3fdf9 src/mlx4.h
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    41
--- a/src/mlx4.h	Fri Nov 13 00:56:50 2015 -0800
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    42
+++ b/src/mlx4.h	Fri Nov 13 00:58:16 2015 -0800
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    43
@@ -366,6 +366,8 @@
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    44
 		     struct ibv_port_attr *attr);
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    45
 
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    46
 struct ibv_pd *mlx4_alloc_pd(struct ibv_context *context);
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    47
+struct ibv_shpd *mlx4_alloc_shpd(struct ibv_pd *pd, uint64_t share_key, struct ibv_shpd *shpd);
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    48
+struct ibv_pd *mlx4_share_pd(struct ibv_context *context, struct ibv_shpd *shpd, uint64_t share_key);
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    49
 int mlx4_free_pd(struct ibv_pd *pd);
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    50
 struct ibv_xrcd *mlx4_open_xrcd(struct ibv_context *context,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    51
 				struct ibv_xrcd_init_attr *attr);
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    52
@@ -373,7 +375,11 @@
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    53
 
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    54
 struct ibv_mr *mlx4_reg_mr(struct ibv_pd *pd, void *addr,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    55
 			    size_t length, int access);
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    56
+struct ibv_mr *mlx4_reg_mr_relaxed(struct ibv_pd *pd, void *addr,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    57
+			    size_t length, int access);
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    58
 int mlx4_dereg_mr(struct ibv_mr *mr);
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    59
+int mlx4_dereg_mr_relaxed(struct ibv_mr *mr);
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    60
+int mlx4_flush_relaxed_mr(struct ibv_pd *pd);
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    61
 
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    62
 struct ibv_cq *mlx4_create_cq(struct ibv_context *context, int cqe,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    63
 			       struct ibv_comp_channel *channel,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    64
diff -r cb9a51f3fdf9 src/verbs.c
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    65
--- a/src/verbs.c	Fri Nov 13 00:56:50 2015 -0800
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    66
+++ b/src/verbs.c	Fri Nov 13 00:58:16 2015 -0800
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    67
@@ -103,6 +103,39 @@
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    68
 	return &pd->ibv_pd;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    69
 }
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    70
 
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    71
+struct ibv_shpd *mlx4_alloc_shpd(struct ibv_pd *pd, uint64_t share_key, struct ibv_shpd *shpd)
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    72
+{
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    73
+	struct ibv_alloc_shpd cmd;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    74
+	struct ibv_alloc_shpd_resp resp;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    75
+
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    76
+	if (ibv_cmd_alloc_shpd(pd->context, pd, share_key, shpd, &cmd, sizeof cmd,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    77
+			     &resp, sizeof resp)) {
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    78
+		return NULL;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    79
+	}
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    80
+
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    81
+	return shpd;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    82
+}
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    83
+
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    84
+
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    85
+struct ibv_pd *mlx4_share_pd(struct ibv_context *context, struct ibv_shpd *shpd, uint64_t share_key)
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    86
+{
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    87
+	struct ibv_share_pd       cmd;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    88
+	struct mlx4_share_pd_resp resp;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    89
+	struct mlx4_pd		 *pd;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    90
+
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    91
+	pd = malloc(sizeof *pd);
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    92
+	if (!pd)
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    93
+		return NULL;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    94
+
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    95
+	if (ibv_cmd_share_pd(context, shpd, share_key, &pd->ibv_pd, &cmd, sizeof cmd,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    96
+			     &resp.ibv_resp, sizeof resp)) {
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    97
+		free(pd);
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    98
+		return NULL;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    99
+	}
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   100
+	pd->pdn = resp.pdn;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   101
+	return &pd->ibv_pd;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   102
+}
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   103
+
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   104
 int mlx4_free_pd(struct ibv_pd *pd)
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   105
 {
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   106
 	int ret;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   107
@@ -174,6 +207,37 @@
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   108
 	return mr;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   109
 }
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   110
 
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   111
+struct ibv_mr *mlx4_reg_mr_relaxed(struct ibv_pd *pd, void *addr, size_t length,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   112
+			   int access)
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   113
+{
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   114
+	struct ibv_mr *mr;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   115
+	struct ibv_reg_mr cmd;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   116
+	int ret;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   117
+
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   118
+	mr = malloc(sizeof *mr);
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   119
+	if (!mr)
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   120
+		return NULL;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   121
+
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   122
+#ifdef IBV_CMD_REG_MR_RELAXED_HAS_RESP_PARAMS
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   123
+	{
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   124
+		struct ibv_reg_mr_resp resp;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   125
+
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   126
+		ret = ibv_cmd_reg_mr_relaxed(pd, addr, length, (uintptr_t) addr,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   127
+				     access, mr, &cmd, sizeof cmd,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   128
+				     &resp, sizeof resp);
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   129
+	}
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   130
+#else
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   131
+	ret = ibv_cmd_reg_mr_relaxed(pd, addr, length, (uintptr_t) addr, access, mr,
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   132
+			     &cmd, sizeof cmd);
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   133
+#endif
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   134
+	if (ret) {
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   135
+		free(mr);
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   136
+		return NULL;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   137
+	}
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   138
+
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   139
+	return mr;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   140
+}
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   141
+
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   142
 int mlx4_dereg_mr(struct ibv_mr *mr)
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   143
 {
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   144
 	int ret;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   145
@@ -186,6 +250,29 @@
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   146
 	return 0;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   147
 }
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   148
 
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   149
+int mlx4_dereg_mr_relaxed(struct ibv_mr *mr)
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   150
+{
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   151
+	int ret;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   152
+
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   153
+	ret = ibv_cmd_dereg_mr_relaxed(mr);
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   154
+	if (ret)
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   155
+		return ret;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   156
+
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   157
+	free(mr);
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   158
+	return 0;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   159
+}
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   160
+
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   161
+int mlx4_flush_relaxed_mr(struct ibv_pd *pd)
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   162
+{
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   163
+	int ret;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   164
+
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   165
+	ret = ibv_cmd_flush_relaxed_mr(pd);
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   166
+	if (ret)
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   167
+		return ret;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   168
+
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   169
+	return 0;
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   170
+}
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   171
+
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   172
 int align_queue_size(int req)
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   173
 {
49b43e37ce26 PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
   174
 	int nent;