components/open-fabrics/libibverbs/patches/base.patch
changeset 1399 8f4b38fe52ad
parent 1196 cba083182ade
child 1566 d1c87d1ecd13
equal deleted inserted replaced
1398:a5a1adab80b0 1399:8f4b38fe52ad
     1 #
       
     2 # Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
       
     3 #
       
     4 diff -r -u /tmp/846623/libibverbs-1.1.4/Makefile.am libibverbs-1.1.4/Makefile.am
     1 diff -r -u /tmp/846623/libibverbs-1.1.4/Makefile.am libibverbs-1.1.4/Makefile.am
     5 --- /tmp/846623/libibverbs-1.1.4/Makefile.am	Thu Feb  3 01:53:17 2011
     2 --- /tmp/846623/libibverbs-1.1.4/Makefile.am	Thu Feb  3 01:53:17 2011
     6 +++ libibverbs-1.1.4/Makefile.am	Fri Feb 11 04:02:12 2011
     3 +++ libibverbs-1.1.4/Makefile.am	Fri Feb 11 04:02:12 2011
     7 @@ -4,13 +4,13 @@
     4 @@ -4,13 +4,13 @@
     8  
     5  
   895 +		return NULL;
   892 +		return NULL;
   896 +#endif		
   893 +#endif		
   897  
   894  
   898  	/*
   895  	/*
   899  	 * We'll only be doing writes, but we need O_RDWR in case the
   896  	 * We'll only be doing writes, but we need O_RDWR in case the
   900 @@ -163,6 +190,9 @@
   897 @@ -141,6 +168,15 @@
       
   898  	if (cmd_fd < 0)
       
   899  		return NULL;
       
   900  
       
   901 +#if defined(__SVR4) && defined(__sun)
       
   902 +	/* We don't support parent-child sharing of IB resources on Solaris */
       
   903 +	if (fcntl(cmd_fd, F_SETFD, FD_CLOEXEC) < 0) {
       
   904 +		fprintf(stderr, "ibv_open_device: FD_CLOEXEC failed: %s\n",
       
   905 +		    strerror(errno));
       
   906 +		goto err;
       
   907 +	}
       
   908 +#endif
       
   909 +
       
   910  	context = device->ops.alloc_context(device, cmd_fd);
       
   911  	if (!context)
       
   912  		goto err;
       
   913 @@ -163,6 +199,9 @@
   901  	int async_fd = context->async_fd;
   914  	int async_fd = context->async_fd;
   902  	int cmd_fd   = context->cmd_fd;
   915  	int cmd_fd   = context->cmd_fd;
   903  	int cq_fd    = -1;
   916  	int cq_fd    = -1;
   904 +#if defined(__SVR4) && defined(__sun)
   917 +#if defined(__SVR4) && defined(__sun)
   905 +	int mmap_fd   = context->mmap_fd;
   918 +	int mmap_fd   = context->mmap_fd;
   906 +#endif
   919 +#endif
   907  
   920  
   908  	if (abi_ver <= 2) {
   921  	if (abi_ver <= 2) {
   909  		struct ibv_abi_compat_v2 *t = context->abi_compat;
   922  		struct ibv_abi_compat_v2 *t = context->abi_compat;
   910 @@ -172,6 +202,11 @@
   923 @@ -172,6 +211,11 @@
   911  
   924  
   912  	context->device->ops.free_context(context);
   925  	context->device->ops.free_context(context);
   913  
   926  
   914 +#if defined(__SVR4) && defined(__sun)
   927 +#if defined(__SVR4) && defined(__sun)
   915 +	if (mmap_fd > 0) {
   928 +	if (mmap_fd > 0) {
   917 +	}
   930 +	}
   918 +#endif
   931 +#endif
   919  	close(async_fd);
   932  	close(async_fd);
   920  	close(cmd_fd);
   933  	close(cmd_fd);
   921  	if (abi_ver <= 2)
   934  	if (abi_ver <= 2)
   922 @@ -214,6 +249,15 @@
   935 @@ -214,6 +258,15 @@
   923  		case IBV_EVENT_SRQ_LIMIT_REACHED:
   936  		case IBV_EVENT_SRQ_LIMIT_REACHED:
   924  			event->element.srq = (void *) (uintptr_t) ev.element;
   937  			event->element.srq = (void *) (uintptr_t) ev.element;
   925  			break;
   938  			break;
   926 +		case IBV_EVENT_GID_AVAIL:
   939 +		case IBV_EVENT_GID_AVAIL:
   927 +		case IBV_EVENT_GID_UNAVAIL:
   940 +		case IBV_EVENT_GID_UNAVAIL:
  1044 +	struct stat		fstat_buf;
  1057 +	struct stat		fstat_buf;
  1045 +#endif
  1058 +#endif
  1046  
  1059  
  1047  	t = malloc(sizeof *t);
  1060  	t = malloc(sizeof *t);
  1048  	if (!t)
  1061  	if (!t)
  1049 @@ -67,9 +96,20 @@
  1062 @@ -67,12 +96,36 @@
  1050  
  1063  
  1051  	IBV_INIT_CMD_RESP(cmd, cmd_size, GET_CONTEXT, resp, resp_size);
  1064  	IBV_INIT_CMD_RESP(cmd, cmd_size, GET_CONTEXT, resp, resp_size);
  1052  	cmd->cq_fd_tab = (uintptr_t) &cq_fd;
  1065  	cmd->cq_fd_tab = (uintptr_t) &cq_fd;
  1053 +#if defined(__SVR4) && defined(__sun)
  1066 +#if defined(__SVR4) && defined(__sun)
  1054 +	event_fd = open("/dev/infiniband/ofs/uverbs:event", O_RDWR);
  1067 +	event_fd = open("/dev/infiniband/ofs/uverbs:event", O_RDWR);
  1065 +	resp->async_fd = event_fd;
  1078 +	resp->async_fd = event_fd;
  1066 +#endif
  1079 +#endif
  1067  
  1080  
  1068  	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
  1081  	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
  1069  
  1082  
  1070 @@ -87,13 +127,28 @@
  1083 +#if defined(__SVR4) && defined(__sun)
       
  1084 +	/* We don't support parent-child sharing of IB resources on Solaris */
       
  1085 +	if (fcntl(resp->async_fd, F_SETFD, FD_CLOEXEC) < 0) {
       
  1086 +		fprintf(stderr, "ibv_get_context: FD_CLOEXEC failed "
       
  1087 +		    "for async_fd: %s\n", strerror(errno));
       
  1088 +		return errno;
       
  1089 +	}
       
  1090 +	if (fcntl(cq_fd, F_SETFD, FD_CLOEXEC) < 0) {
       
  1091 +		fprintf(stderr, "ibv_get_context: FD_CLOEXEC failed "
       
  1092 +		    "for cq_fd: %s\n", strerror(errno));
       
  1093 +		return errno;
       
  1094 +	}
       
  1095 +#endif
       
  1096  	context->async_fd         = resp->async_fd;
       
  1097  	context->num_comp_vectors = 1;
       
  1098  	t->channel.context        = context;
       
  1099 @@ -87,19 +140,53 @@
  1071  			size_t cmd_size, struct ibv_get_context_resp *resp,
  1100  			size_t cmd_size, struct ibv_get_context_resp *resp,
  1072  			size_t resp_size)
  1101  			size_t resp_size)
  1073  {
  1102  {
  1074 +#if defined(__SVR4) && defined(__sun)
  1103 +#if defined(__SVR4) && defined(__sun)
  1075 +	int			event_fd;
  1104 +	int			event_fd;
  1094 +	resp->async_fd = event_fd;
  1123 +	resp->async_fd = event_fd;
  1095 +#endif
  1124 +#endif
  1096  
  1125  
  1097  	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
  1126  	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
  1098  
  1127  
  1099 @@ -100,6 +155,16 @@
  1128 +#if defined(__SVR4) && defined(__sun)
       
  1129 +	/* We don't support parent-child sharing of IB resources on Solaris */
       
  1130 +	if (fcntl(resp->async_fd, F_SETFD, FD_CLOEXEC) < 0) {
       
  1131 +		fprintf(stderr, "ibv_get_context: FD_CLOEXEC failed: %s\n",
       
  1132 +		    strerror(errno));
       
  1133 +		return errno;
       
  1134 +	}
       
  1135 +#endif
       
  1136 +
  1100  	context->async_fd         = resp->async_fd;
  1137  	context->async_fd         = resp->async_fd;
  1101  	context->num_comp_vectors = resp->num_comp_vectors;
  1138  	context->num_comp_vectors = resp->num_comp_vectors;
  1102  
  1139  
  1103 +#if defined(__SVR4) && defined(__sun)
  1140 +#if defined(__SVR4) && defined(__sun)
  1104 +	/*
  1141 +	/*
  1111 +	}
  1148 +	}
  1112 +#endif
  1149 +#endif
  1113  	return 0;
  1150  	return 0;
  1114  }
  1151  }
  1115  
  1152  
  1116 @@ -120,6 +185,7 @@
  1153 @@ -120,6 +207,7 @@
  1117  	memset(device_attr->fw_ver, 0, sizeof device_attr->fw_ver);
  1154  	memset(device_attr->fw_ver, 0, sizeof device_attr->fw_ver);
  1118  	*raw_fw_ver			       = resp.fw_ver;
  1155  	*raw_fw_ver			       = resp.fw_ver;
  1119  	device_attr->node_guid 		       = resp.node_guid;
  1156  	device_attr->node_guid 		       = resp.node_guid;
  1120 +	device_attr->node_guid_external	       = resp.node_guid_external;
  1157 +	device_attr->node_guid_external	       = resp.node_guid_external;
  1121  	device_attr->sys_image_guid 	       = resp.sys_image_guid;
  1158  	device_attr->sys_image_guid 	       = resp.sys_image_guid;
  1122  	device_attr->max_mr_size 	       = resp.max_mr_size;
  1159  	device_attr->max_mr_size 	       = resp.max_mr_size;
  1123  	device_attr->page_size_cap 	       = resp.page_size_cap;
  1160  	device_attr->page_size_cap 	       = resp.page_size_cap;
  1124 @@ -218,6 +284,45 @@
  1161 @@ -207,6 +295,8 @@
       
  1162  {
       
  1163  	IBV_INIT_CMD_RESP(cmd, cmd_size, ALLOC_PD, resp, resp_size);
       
  1164  
       
  1165 +	cmd->user_handle     = (uintptr_t) pd;
       
  1166 +
       
  1167  	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1168  		return errno;
       
  1169  
       
  1170 @@ -218,6 +308,47 @@
  1125  	return 0;
  1171  	return 0;
  1126  }
  1172  }
  1127  
  1173  
  1128 +int ibv_cmd_alloc_shpd(struct ibv_context *context, struct ibv_pd *pd,
  1174 +int ibv_cmd_alloc_shpd(struct ibv_context *context, struct ibv_pd *pd,
  1129 +         uint64_t share_key, struct ibv_shpd *shpd,
  1175 +         uint64_t share_key, struct ibv_shpd *shpd,
  1130 +		     struct ibv_alloc_shpd *cmd, size_t cmd_size,
  1176 +		     struct ibv_alloc_shpd *cmd, size_t cmd_size,
  1131 +		     struct ibv_alloc_shpd_resp *resp, size_t resp_size)
  1177 +		     struct ibv_alloc_shpd_resp *resp, size_t resp_size)
  1132 +{
  1178 +{
  1133 +	IBV_INIT_CMD_RESP(cmd, cmd_size, ALLOC_SHPD, resp, resp_size);
  1179 +	IBV_INIT_CMD_RESP(cmd, cmd_size, ALLOC_SHPD, resp, resp_size);
  1134 +        cmd->pd_handle = pd->handle;
  1180 +        cmd->pd_handle = pd->handle;
       
  1181 +	cmd->user_handle = (uintptr_t) pd;
  1135 +	cmd->share_key = share_key;
  1182 +	cmd->share_key = share_key;
  1136 +
  1183 +
  1137 +	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
  1184 +	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
  1138 +		return errno;
  1185 +		return errno;
  1139 +
  1186 +
  1150 +		     struct ibv_share_pd_resp *resp, size_t resp_size)
  1197 +		     struct ibv_share_pd_resp *resp, size_t resp_size)
  1151 +{
  1198 +{
  1152 +	IBV_INIT_CMD_RESP(cmd, cmd_size, SHARE_PD, resp, resp_size);
  1199 +	IBV_INIT_CMD_RESP(cmd, cmd_size, SHARE_PD, resp, resp_size);
  1153 +	cmd->shpd_handle = shpd->handle;
  1200 +	cmd->shpd_handle = shpd->handle;
  1154 +	cmd->share_key = share_key;
  1201 +	cmd->share_key = share_key;
       
  1202 +	cmd->user_handle     = (uintptr_t) pd;
  1155 +
  1203 +
  1156 +	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
  1204 +	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
  1157 +		return errno;
  1205 +		return errno;
  1158 +
  1206 +
  1159 +	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
  1207 +	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
  1165 +}
  1213 +}
  1166 +
  1214 +
  1167  int ibv_cmd_dealloc_pd(struct ibv_pd *pd)
  1215  int ibv_cmd_dealloc_pd(struct ibv_pd *pd)
  1168  {
  1216  {
  1169  	struct ibv_dealloc_pd cmd;
  1217  	struct ibv_dealloc_pd cmd;
  1170 @@ -259,6 +364,34 @@
  1218 @@ -224,6 +355,7 @@
       
  1219  
       
  1220  	IBV_INIT_CMD(&cmd, sizeof cmd, DEALLOC_PD);
       
  1221  	cmd.pd_handle = pd->handle;
       
  1222 +	cmd.user_handle = (uintptr_t) pd;
       
  1223  
       
  1224  	if (write(pd->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
  1225  		return errno;
       
  1226 @@ -244,6 +376,7 @@
       
  1227  	cmd->length 	  = length;
       
  1228  	cmd->hca_va 	  = hca_va;
       
  1229  	cmd->pd_handle 	  = pd->handle;
       
  1230 +	cmd->user_handle  = (uintptr_t) mr;
       
  1231  	cmd->access_flags = access;
       
  1232  
       
  1233  	if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1234 @@ -259,6 +392,35 @@
  1171  	return 0;
  1235  	return 0;
  1172  }
  1236  }
  1173  
  1237  
  1174 +int ibv_cmd_reg_mr_relaxed(struct ibv_pd *pd, void *addr, size_t length,
  1238 +int ibv_cmd_reg_mr_relaxed(struct ibv_pd *pd, void *addr, size_t length,
  1175 +		   uint64_t hca_va, int access,
  1239 +		   uint64_t hca_va, int access,
  1182 +
  1246 +
  1183 +	cmd->start 	  = (uintptr_t) addr;
  1247 +	cmd->start 	  = (uintptr_t) addr;
  1184 +	cmd->length 	  = length;
  1248 +	cmd->length 	  = length;
  1185 +	cmd->hca_va 	  = hca_va;
  1249 +	cmd->hca_va 	  = hca_va;
  1186 +	cmd->pd_handle 	  = pd->handle;
  1250 +	cmd->pd_handle 	  = pd->handle;
       
  1251 +	cmd->user_handle  = (uintptr_t) mr;
  1187 +	cmd->access_flags = access;
  1252 +	cmd->access_flags = access;
  1188 +
  1253 +
  1189 +	if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size)
  1254 +	if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size)
  1190 +		return errno;
  1255 +		return errno;
  1191 +
  1256 +
  1200 +}
  1265 +}
  1201 +
  1266 +
  1202  int ibv_cmd_dereg_mr(struct ibv_mr *mr)
  1267  int ibv_cmd_dereg_mr(struct ibv_mr *mr)
  1203  {
  1268  {
  1204  	struct ibv_dereg_mr cmd;
  1269  	struct ibv_dereg_mr cmd;
  1205 @@ -272,6 +405,32 @@
  1270 @@ -265,6 +427,7 @@
       
  1271  
       
  1272  	IBV_INIT_CMD(&cmd, sizeof cmd, DEREG_MR);
       
  1273  	cmd.mr_handle = mr->handle;
       
  1274 +	cmd.user_handle  = (uintptr_t) mr;
       
  1275  
       
  1276  	if (write(mr->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
  1277  		return errno;
       
  1278 @@ -272,6 +435,34 @@
  1206  	return 0;
  1279  	return 0;
  1207  }
  1280  }
  1208  
  1281  
  1209 +int ibv_cmd_dereg_mr_relaxed(struct ibv_mr *mr)
  1282 +int ibv_cmd_dereg_mr_relaxed(struct ibv_mr *mr)
  1210 +{
  1283 +{
  1211 +	struct ibv_dereg_mr cmd;
  1284 +	struct ibv_dereg_mr cmd;
  1212 +
  1285 +
  1213 +	IBV_INIT_CMD(&cmd, sizeof cmd, DEREG_MR_RELAXED);
  1286 +	IBV_INIT_CMD(&cmd, sizeof cmd, DEREG_MR_RELAXED);
  1214 +	cmd.mr_handle = mr->handle;
  1287 +	cmd.mr_handle = mr->handle;
       
  1288 +	cmd.user_handle  = (uintptr_t) mr;
  1215 +
  1289 +
  1216 +	if (write(mr->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
  1290 +	if (write(mr->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
  1217 +		return errno;
  1291 +		return errno;
  1218 +
  1292 +
  1219 +	return 0;
  1293 +	return 0;
  1223 +{
  1297 +{
  1224 +	struct ibv_flush_relaxed_mr cmd;
  1298 +	struct ibv_flush_relaxed_mr cmd;
  1225 +
  1299 +
  1226 +	IBV_INIT_CMD(&cmd, sizeof cmd, FLUSH_RELAXED_MR);
  1300 +	IBV_INIT_CMD(&cmd, sizeof cmd, FLUSH_RELAXED_MR);
  1227 +	cmd.pd_handle = pd->handle;
  1301 +	cmd.pd_handle = pd->handle;
       
  1302 +	cmd.user_handle  = (uintptr_t) pd;
  1228 +
  1303 +
  1229 +	if (write(pd->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
  1304 +	if (write(pd->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
  1230 +		return errno;
  1305 +		return errno;
  1231 +
  1306 +
  1232 +	return 0;
  1307 +	return 0;
  1233 +}
  1308 +}
  1234 +
  1309 +
  1235  static int ibv_cmd_create_cq_v2(struct ibv_context *context, int cqe,
  1310  static int ibv_cmd_create_cq_v2(struct ibv_context *context, int cqe,
  1236  				struct ibv_cq *cq,
  1311  				struct ibv_cq *cq,
  1237  				struct ibv_create_cq *new_cmd, size_t new_cmd_size,
  1312  				struct ibv_create_cq *new_cmd, size_t new_cmd_size,
  1238 @@ -315,7 +474,19 @@
  1313 @@ -315,7 +506,19 @@
  1239  	cmd->user_handle   = (uintptr_t) cq;
  1314  	cmd->user_handle   = (uintptr_t) cq;
  1240  	cmd->cqe           = cqe;
  1315  	cmd->cqe           = cqe;
  1241  	cmd->comp_vector   = comp_vector;
  1316  	cmd->comp_vector   = comp_vector;
  1242 +#if defined(__SVR4) && defined(__sun)
  1317 +#if defined(__SVR4) && defined(__sun)
  1243 +	if (channel) {
  1318 +	if (channel) {
  1253  	cmd->comp_channel  = channel ? channel->fd : -1;
  1328  	cmd->comp_channel  = channel ? channel->fd : -1;
  1254 +#endif
  1329 +#endif
  1255  	cmd->reserved      = 0;
  1330  	cmd->reserved      = 0;
  1256  
  1331  
  1257  	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
  1332  	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
  1258 @@ -637,7 +808,20 @@
  1333 @@ -346,6 +549,7 @@
       
  1334  	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, POLL_CQ, resp, rsize);
       
  1335  	cmd.cq_handle = ibcq->handle;
       
  1336  	cmd.ne        = ne;
       
  1337 +	cmd.user_handle  = (uintptr_t) ibcq;
       
  1338  
       
  1339  	if (write(ibcq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd) {
       
  1340  		ret = -1;
       
  1341 @@ -384,6 +588,7 @@
       
  1342  	IBV_INIT_CMD(&cmd, sizeof cmd, REQ_NOTIFY_CQ);
       
  1343  	cmd.cq_handle = ibcq->handle;
       
  1344  	cmd.solicited = !!solicited_only;
       
  1345 +	cmd.user_handle  = (uintptr_t) ibcq;
       
  1346  
       
  1347  	if (write(ibcq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
  1348  		return errno;
       
  1349 @@ -399,6 +604,7 @@
       
  1350  	IBV_INIT_CMD_RESP(cmd, cmd_size, RESIZE_CQ, resp, resp_size);
       
  1351  	cmd->cq_handle = cq->handle;
       
  1352  	cmd->cqe       = cqe;
       
  1353 +	cmd->user_handle   = (uintptr_t) cq;
       
  1354  
       
  1355  	if (write(cq->context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1356  		return errno;
       
  1357 @@ -434,6 +640,7 @@
       
  1358  	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, DESTROY_CQ, &resp, sizeof resp);
       
  1359  	cmd.cq_handle = cq->handle;
       
  1360  	cmd.reserved  = 0;
       
  1361 +	cmd.user_handle  = (uintptr_t) cq;
       
  1362  
       
  1363  	if (write(cq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
  1364  		return errno;
       
  1365 @@ -555,6 +762,7 @@
       
  1366  	cmd->attr_mask	= srq_attr_mask;
       
  1367  	cmd->max_wr	= srq_attr->max_wr;
       
  1368  	cmd->srq_limit	= srq_attr->srq_limit;
       
  1369 +	cmd->user_handle   = (uintptr_t) srq;
       
  1370  
       
  1371  	if (write(srq->context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1372  		return errno;
       
  1373 @@ -569,6 +777,7 @@
       
  1374  
       
  1375  	IBV_INIT_CMD_RESP(cmd, cmd_size, QUERY_SRQ, &resp, sizeof resp);
       
  1376  	cmd->srq_handle = srq->handle;
       
  1377 +	cmd->user_handle   = (uintptr_t) srq;
       
  1378  	cmd->reserved   = 0;
       
  1379  
       
  1380  	if (write(srq->context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1381 @@ -606,6 +815,7 @@
       
  1382  
       
  1383  	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, DESTROY_SRQ, &resp, sizeof resp);
       
  1384  	cmd.srq_handle = srq->handle;
       
  1385 +	cmd.user_handle  = (uintptr_t) srq;
       
  1386  	cmd.reserved   = 0;
       
  1387  
       
  1388  	if (write(srq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
  1389 @@ -637,7 +847,20 @@
  1259  	cmd->max_send_sge    = attr->cap.max_send_sge;
  1390  	cmd->max_send_sge    = attr->cap.max_send_sge;
  1260  	cmd->max_recv_sge    = attr->cap.max_recv_sge;
  1391  	cmd->max_recv_sge    = attr->cap.max_recv_sge;
  1261  	cmd->max_inline_data = attr->cap.max_inline_data;
  1392  	cmd->max_inline_data = attr->cap.max_inline_data;
  1262 +
  1393 +
  1263 +#if defined(__SVR4) && defined(__sun)
  1394 +#if defined(__SVR4) && defined(__sun)
  1274 +#endif
  1405 +#endif
  1275 +
  1406 +
  1276  	cmd->qp_type 	     = attr->qp_type;
  1407  	cmd->qp_type 	     = attr->qp_type;
  1277  	cmd->is_srq 	     = !!attr->srq;
  1408  	cmd->is_srq 	     = !!attr->srq;
  1278  	cmd->srq_handle      = attr->qp_type == IBV_QPT_XRC ?
  1409  	cmd->srq_handle      = attr->qp_type == IBV_QPT_XRC ?
  1279 @@ -1406,4 +1590,3 @@
  1410 @@ -691,6 +914,7 @@
       
  1411  	IBV_INIT_CMD_RESP(cmd, cmd_size, QUERY_QP, &resp, sizeof resp);
       
  1412  	cmd->qp_handle = qp->handle;
       
  1413  	cmd->attr_mask = attr_mask;
       
  1414 +	cmd->user_handle   = (uintptr_t) qp;
       
  1415  
       
  1416  	if (write(qp->context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1417  		return errno;
       
  1418 @@ -772,6 +996,7 @@
       
  1419  	IBV_INIT_CMD(cmd, cmd_size, MODIFY_QP);
       
  1420  
       
  1421  	cmd->qp_handle 		 = qp->handle;
       
  1422 +	cmd->user_handle   	 = (uintptr_t) qp;
       
  1423  	cmd->attr_mask 		 = attr_mask;
       
  1424  	cmd->qkey 		 = attr->qkey;
       
  1425  	cmd->rq_psn 		 = attr->rq_psn;
       
  1426 @@ -1292,6 +1517,7 @@
       
  1427  	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, DESTROY_QP, &resp, sizeof resp);
       
  1428  	cmd.qp_handle = qp->handle;
       
  1429  	cmd.reserved  = 0;
       
  1430 +	cmd.user_handle  = (uintptr_t) qp;
       
  1431  
       
  1432  	if (write(qp->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
  1433  		return errno;
       
  1434 @@ -1313,6 +1539,7 @@
       
  1435  	IBV_INIT_CMD(&cmd, sizeof cmd, ATTACH_MCAST);
       
  1436  	memcpy(cmd.gid, gid->raw, sizeof cmd.gid);
       
  1437  	cmd.qp_handle = qp->handle;
       
  1438 +	cmd.user_handle  = (uintptr_t) qp;
       
  1439  	cmd.mlid      = lid;
       
  1440  	cmd.reserved  = 0;
       
  1441  
       
  1442 @@ -1329,6 +1556,7 @@
       
  1443  	IBV_INIT_CMD(&cmd, sizeof cmd, DETACH_MCAST);
       
  1444  	memcpy(cmd.gid, gid->raw, sizeof cmd.gid);
       
  1445  	cmd.qp_handle = qp->handle;
       
  1446 +	cmd.user_handle  = (uintptr_t) qp;
       
  1447  	cmd.mlid      = lid;
       
  1448  	cmd.reserved  = 0;
       
  1449  
       
  1450 @@ -1406,4 +1634,3 @@
  1280  		return errno;
  1451  		return errno;
  1281  	return 0;
  1452  	return 0;
  1282  }
  1453  }
  1283 -
  1454 -
  1284 diff -r -u /tmp/846623/libibverbs-1.1.4/src/init.c libibverbs-1.1.4/src/init.c
  1455 diff -r -u /tmp/846623/libibverbs-1.1.4/src/init.c libibverbs-1.1.4/src/init.c
  1603  	__u64 node_guid;
  1774  	__u64 node_guid;
  1604 +	__u64 node_guid_external;
  1775 +	__u64 node_guid_external;
  1605  	__u64 sys_image_guid;
  1776  	__u64 sys_image_guid;
  1606  	__u64 max_mr_size;
  1777  	__u64 max_mr_size;
  1607  	__u64 page_size_cap;
  1778  	__u64 page_size_cap;
  1608 @@ -235,6 +250,34 @@
  1779 @@ -235,23 +250,103 @@
  1609  	__u8  reserved[2];
  1780  	__u8  reserved[2];
  1610  };
  1781  };
  1611  
  1782  
  1612 +struct ibv_reg_sm_event {
  1783 +struct ibv_reg_sm_event {
  1613 +	__u32 command;
  1784 +	__u32 command;
  1638 +};
  1809 +};
  1639 +
  1810 +
  1640  struct ibv_alloc_pd {
  1811  struct ibv_alloc_pd {
  1641  	__u32 command;
  1812  	__u32 command;
  1642  	__u16 in_words;
  1813  	__u16 in_words;
  1643 @@ -243,10 +286,57 @@
  1814  	__u16 out_words;
       
  1815  	__u64 response;
       
  1816 +	__u64 user_handle;
  1644  	__u64 driver_data[0];
  1817  	__u64 driver_data[0];
  1645  };
  1818  };
  1646  
  1819  
  1647 +#if defined(__SVR4) && defined(__sun)
  1820 +#if defined(__SVR4) && defined(__sun)
  1648 +/*
  1821 +/*
  1669 +	__u16 out_words;
  1842 +	__u16 out_words;
  1670 +	__u64 response;
  1843 +	__u64 response;
  1671 +	__u32 pd_handle;
  1844 +	__u32 pd_handle;
  1672 +	__u32 reserved;
  1845 +	__u32 reserved;
  1673 +	__u64 share_key;
  1846 +	__u64 share_key;
       
  1847 +	__u64 user_handle;
  1674 +	__u64 driver_data[0];
  1848 +	__u64 driver_data[0];
  1675 +};
  1849 +};
  1676 +
  1850 +
  1677 +struct ibv_alloc_shpd_resp {
  1851 +struct ibv_alloc_shpd_resp {
  1678 +	__u32 shpd_handle;
  1852 +	__u32 shpd_handle;
  1684 +	__u16 out_words;
  1858 +	__u16 out_words;
  1685 +	__u64 response;
  1859 +	__u64 response;
  1686 +	__u32 shpd_handle;
  1860 +	__u32 shpd_handle;
  1687 +	__u32 reserved;
  1861 +	__u32 reserved;
  1688 +	__u64 share_key;
  1862 +	__u64 share_key;
       
  1863 +	__u64 user_handle;
  1689 +	__u64 driver_data[0];
  1864 +	__u64 driver_data[0];
  1690 +};
  1865 +};
  1691 +
  1866 +
  1692 +struct ibv_share_pd_resp {
  1867 +struct ibv_share_pd_resp {
  1693 +	__u32 pd_handle;
  1868 +	__u32 pd_handle;
  1696 +};
  1871 +};
  1697 +
  1872 +
  1698  struct ibv_dealloc_pd {
  1873  struct ibv_dealloc_pd {
  1699  	__u32 command;
  1874  	__u32 command;
  1700  	__u16 in_words;
  1875  	__u16 in_words;
  1701 @@ -280,6 +370,13 @@
  1876  	__u16 out_words;
       
  1877  	__u32 pd_handle;
       
  1878 +	__u32 reserved;
       
  1879 +	__u64 user_handle;
       
  1880  };
       
  1881  
       
  1882  struct ibv_reg_mr {
       
  1883 @@ -264,6 +359,7 @@
       
  1884  	__u64 hca_va;
       
  1885  	__u32 pd_handle;
       
  1886  	__u32 access_flags;
       
  1887 +	__u64 user_handle;
       
  1888  	__u64 driver_data[0];
       
  1889  };
       
  1890  
       
  1891 @@ -278,8 +374,19 @@
       
  1892  	__u16 in_words;
       
  1893  	__u16 out_words;
  1702  	__u32 mr_handle;
  1894  	__u32 mr_handle;
       
  1895 +	__u32 reserved;
       
  1896 +	__u64 user_handle;
  1703  };
  1897  };
  1704  
  1898  
  1705 +struct ibv_flush_relaxed_mr {
  1899 +struct ibv_flush_relaxed_mr {
  1706 +	__u32 command;
  1900 +	__u32 command;
  1707 +	__u16 in_words;
  1901 +	__u16 in_words;
  1708 +	__u16 out_words;
  1902 +	__u16 out_words;
  1709 +	__u32 pd_handle;
  1903 +	__u32 pd_handle;
       
  1904 +	__u32 reserved;
       
  1905 +	__u64 user_handle;
  1710 +};
  1906 +};
  1711 +
  1907 +
  1712  struct ibv_create_comp_channel {
  1908  struct ibv_create_comp_channel {
  1713  	__u32 command;
  1909  	__u32 command;
  1714  	__u16 in_words;
  1910  	__u16 in_words;
  1715 @@ -304,10 +401,25 @@
  1911 @@ -304,10 +411,25 @@
  1716  	__u64 driver_data[0];
  1912  	__u64 driver_data[0];
  1717  };
  1913  };
  1718  
  1914  
  1719 +#if defined(__SVR4) && defined(__sun)
  1915 +#if defined(__SVR4) && defined(__sun)
  1720 +/*
  1916 +/*
  1736 +};
  1932 +};
  1737 +#endif
  1933 +#endif
  1738  
  1934  
  1739  struct ibv_kern_wc {
  1935  struct ibv_kern_wc {
  1740  	__u64  wr_id;
  1936  	__u64  wr_id;
  1741 @@ -363,7 +475,11 @@
  1937 @@ -334,6 +456,7 @@
       
  1938  	__u64 response;
       
  1939  	__u32 cq_handle;
       
  1940  	__u32 ne;
       
  1941 +	__u64 user_handle;
       
  1942  };
       
  1943  
       
  1944  struct ibv_poll_cq_resp {
       
  1945 @@ -348,6 +471,7 @@
       
  1946  	__u16 out_words;
       
  1947  	__u32 cq_handle;
       
  1948  	__u32 solicited;
       
  1949 +	__u64 user_handle;
       
  1950  };
       
  1951  
       
  1952  struct ibv_resize_cq {
       
  1953 @@ -357,6 +481,7 @@
       
  1954  	__u64 response;
       
  1955  	__u32 cq_handle;
       
  1956  	__u32 cqe;
       
  1957 +	__u64 user_handle;
       
  1958  	__u64 driver_data[0];
       
  1959  };
       
  1960  
       
  1961 @@ -363,7 +488,11 @@
  1742  struct ibv_resize_cq_resp {
  1962  struct ibv_resize_cq_resp {
  1743  	__u32 cqe;
  1963  	__u32 cqe;
  1744  	__u32 reserved;
  1964  	__u32 reserved;
  1745 +#if defined(__SVR4) && defined(__sun)
  1965 +#if defined(__SVR4) && defined(__sun)
  1746 +        ofuv_cq_drv_data_out_t   drv_out;
  1966 +        ofuv_cq_drv_data_out_t   drv_out;
  1748  	__u64 driver_data[0];
  1968  	__u64 driver_data[0];
  1749 +#endif
  1969 +#endif
  1750  };
  1970  };
  1751  
  1971  
  1752  struct ibv_destroy_cq {
  1972  struct ibv_destroy_cq {
  1753 @@ -460,6 +576,14 @@
  1973 @@ -373,6 +502,7 @@
       
  1974  	__u64 response;
       
  1975  	__u32 cq_handle;
       
  1976  	__u32 reserved;
       
  1977 +	__u64 user_handle;
       
  1978  };
       
  1979  
       
  1980  struct ibv_destroy_cq_resp {
       
  1981 @@ -460,6 +590,14 @@
  1754  	__u64 driver_data[0];
  1982  	__u64 driver_data[0];
  1755  };
  1983  };
  1756  
  1984  
  1757 +#if defined(__SVR4) && defined(__sun)
  1985 +#if defined(__SVR4) && defined(__sun)
  1758 +/*
  1986 +/*
  1763 +typedef __u64 ofuv_qp_drv_data_out_t[SOL_UVERBS_QP_DATA_OUT_SIZE];
  1991 +typedef __u64 ofuv_qp_drv_data_out_t[SOL_UVERBS_QP_DATA_OUT_SIZE];
  1764 +
  1992 +
  1765  struct ibv_create_qp_resp {
  1993  struct ibv_create_qp_resp {
  1766  	__u32 qp_handle;
  1994  	__u32 qp_handle;
  1767  	__u32 qpn;
  1995  	__u32 qpn;
  1768 @@ -469,7 +593,20 @@
  1996 @@ -469,7 +607,20 @@
  1769  	__u32 max_recv_sge;
  1997  	__u32 max_recv_sge;
  1770  	__u32 max_inline_data;
  1998  	__u32 max_inline_data;
  1771  	__u32 reserved;
  1999  	__u32 reserved;
  1772 +	ofuv_qp_drv_data_out_t drv_out;
  2000 +	ofuv_qp_drv_data_out_t drv_out;
  1773  };
  2001  };
  1784 +};
  2012 +};
  1785 +#endif
  2013 +#endif
  1786  
  2014  
  1787  struct ibv_qp_dest {
  2015  struct ibv_qp_dest {
  1788  	__u8  dgid[16];
  2016  	__u8  dgid[16];
  1789 @@ -817,12 +954,29 @@
  2017 @@ -493,6 +644,7 @@
       
  2018  	__u64 response;
       
  2019  	__u32 qp_handle;
       
  2020  	__u32 attr_mask;
       
  2021 +	__u64 user_handle;
       
  2022  	__u64 driver_data[0];
       
  2023  };
       
  2024  
       
  2025 @@ -560,6 +712,7 @@
       
  2026  	__u8  alt_port_num;
       
  2027  	__u8  alt_timeout;
       
  2028  	__u8  reserved[2];
       
  2029 +	__u64 user_handle;
       
  2030  	__u64 driver_data[0];
       
  2031  };
       
  2032  
       
  2033 @@ -570,6 +723,7 @@
       
  2034  	__u64 response;
       
  2035  	__u32 qp_handle;
       
  2036  	__u32 reserved;
       
  2037 +	__u64 user_handle;
       
  2038  };
       
  2039  
       
  2040  struct ibv_destroy_qp_resp {
       
  2041 @@ -775,6 +929,7 @@
       
  2042  	__u32 qp_handle;
       
  2043  	__u16 mlid;
       
  2044  	__u16 reserved;
       
  2045 +	__u64 user_handle;
       
  2046  	__u64 driver_data[0];
       
  2047  };
       
  2048  
       
  2049 @@ -786,6 +941,7 @@
       
  2050  	__u32 qp_handle;
       
  2051  	__u16 mlid;
       
  2052  	__u16 reserved;
       
  2053 +	__u64 user_handle;
       
  2054  	__u64 driver_data[0];
       
  2055  };
       
  2056  
       
  2057 @@ -817,12 +973,29 @@
  1790  	__u64 driver_data[0];
  2058  	__u64 driver_data[0];
  1791  };
  2059  };
  1792  
  2060  
  1793 +#if defined(__SVR4) && defined(__sun)
  2061 +#if defined(__SVR4) && defined(__sun)
  1794 +/*
  2062 +/*
  1814 +};
  2082 +};
  1815 +#endif
  2083 +#endif
  1816  
  2084  
  1817  struct ibv_modify_srq {
  2085  struct ibv_modify_srq {
  1818  	__u32 command;
  2086  	__u32 command;
  1819 @@ -946,6 +1100,14 @@
  2087 @@ -832,6 +1005,7 @@
       
  2088  	__u32 attr_mask;
       
  2089  	__u32 max_wr;
       
  2090  	__u32 srq_limit;
       
  2091 +	__u64 user_handle;
       
  2092  	__u64 driver_data[0];
       
  2093  };
       
  2094  
       
  2095 @@ -842,6 +1016,7 @@
       
  2096  	__u64 response;
       
  2097  	__u32 srq_handle;
       
  2098  	__u32 reserved;
       
  2099 +	__u64 user_handle;
       
  2100  	__u64 driver_data[0];
       
  2101  };
       
  2102  
       
  2103 @@ -859,6 +1034,7 @@
       
  2104  	__u64 response;
       
  2105  	__u32 srq_handle;
       
  2106  	__u32 reserved;
       
  2107 +	__u64 user_handle;
       
  2108  };
       
  2109  
       
  2110  struct ibv_destroy_srq_resp {
       
  2111 @@ -946,6 +1122,14 @@
  1820  	IB_USER_VERBS_CMD_QUERY_XRC_RCV_QP_V2 = -1,
  2112  	IB_USER_VERBS_CMD_QUERY_XRC_RCV_QP_V2 = -1,
  1821  	IB_USER_VERBS_CMD_REG_XRC_RCV_QP_V2 = -1,
  2113  	IB_USER_VERBS_CMD_REG_XRC_RCV_QP_V2 = -1,
  1822  	IB_USER_VERBS_CMD_UNREG_XRC_RCV_QP_V2 = -1,
  2114  	IB_USER_VERBS_CMD_UNREG_XRC_RCV_QP_V2 = -1,
  1823 +	IB_USER_VERBS_CMD_REG_MR_RELAXED_V2 = -1,
  2115 +	IB_USER_VERBS_CMD_REG_MR_RELAXED_V2 = -1,
  1824 +	IB_USER_VERBS_CMD_DEREG_MR_RELAXED_V2 = -1,
  2116 +	IB_USER_VERBS_CMD_DEREG_MR_RELAXED_V2 = -1,