components/open-fabrics/libibverbs/patches/base.patch
branchs11u1-sru
changeset 2761 91830550729b
parent 2567 333785b27b31
equal deleted inserted replaced
2755:3f8ffd095fee 2761:91830550729b
     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  
   656 +		return NULL;
   653 +		return NULL;
   657 +#endif		
   654 +#endif		
   658  
   655  
   659  	/*
   656  	/*
   660  	 * We'll only be doing writes, but we need O_RDWR in case the
   657  	 * We'll only be doing writes, but we need O_RDWR in case the
   661 @@ -163,6 +190,9 @@
   658 @@ -141,6 +168,15 @@
       
   659  	if (cmd_fd < 0)
       
   660  		return NULL;
       
   661  
       
   662 +#if defined(__SVR4) && defined(__sun)
       
   663 +	/* We don't support parent-child sharing of IB resources on Solaris */
       
   664 +	if (fcntl(cmd_fd, F_SETFD, FD_CLOEXEC) < 0) {
       
   665 +		fprintf(stderr, "ibv_open_device: FD_CLOEXEC failed: %s\n",
       
   666 +		    strerror(errno));
       
   667 +		goto err;
       
   668 +	}
       
   669 +#endif
       
   670 +
       
   671  	context = device->ops.alloc_context(device, cmd_fd);
       
   672  	if (!context)
       
   673  		goto err;
       
   674 @@ -163,6 +199,9 @@
   662  	int async_fd = context->async_fd;
   675  	int async_fd = context->async_fd;
   663  	int cmd_fd   = context->cmd_fd;
   676  	int cmd_fd   = context->cmd_fd;
   664  	int cq_fd    = -1;
   677  	int cq_fd    = -1;
   665 +#if defined(__SVR4) && defined(__sun)
   678 +#if defined(__SVR4) && defined(__sun)
   666 +	int mmap_fd   = context->mmap_fd;
   679 +	int mmap_fd   = context->mmap_fd;
   667 +#endif
   680 +#endif
   668  
   681  
   669  	if (abi_ver <= 2) {
   682  	if (abi_ver <= 2) {
   670  		struct ibv_abi_compat_v2 *t = context->abi_compat;
   683  		struct ibv_abi_compat_v2 *t = context->abi_compat;
   671 @@ -172,6 +202,11 @@
   684 @@ -172,6 +211,11 @@
   672  
   685  
   673  	context->device->ops.free_context(context);
   686  	context->device->ops.free_context(context);
   674  
   687  
   675 +#if defined(__SVR4) && defined(__sun)
   688 +#if defined(__SVR4) && defined(__sun)
   676 +	if (mmap_fd > 0) {
   689 +	if (mmap_fd > 0) {
   785 +	struct stat		fstat_buf;
   798 +	struct stat		fstat_buf;
   786 +#endif
   799 +#endif
   787  
   800  
   788  	t = malloc(sizeof *t);
   801  	t = malloc(sizeof *t);
   789  	if (!t)
   802  	if (!t)
   790 @@ -67,9 +96,20 @@
   803 @@ -67,12 +96,36 @@
   791  
   804  
   792  	IBV_INIT_CMD_RESP(cmd, cmd_size, GET_CONTEXT, resp, resp_size);
   805  	IBV_INIT_CMD_RESP(cmd, cmd_size, GET_CONTEXT, resp, resp_size);
   793  	cmd->cq_fd_tab = (uintptr_t) &cq_fd;
   806  	cmd->cq_fd_tab = (uintptr_t) &cq_fd;
   794 +#if defined(__SVR4) && defined(__sun)
   807 +#if defined(__SVR4) && defined(__sun)
   795 +	event_fd = open("/dev/infiniband/ofs/uverbs:event", O_RDWR);
   808 +	event_fd = open("/dev/infiniband/ofs/uverbs:event", O_RDWR);
   806 +	resp->async_fd = event_fd;
   819 +	resp->async_fd = event_fd;
   807 +#endif
   820 +#endif
   808  
   821  
   809  	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
   822  	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
   810  
   823  
   811 @@ -87,13 +127,28 @@
   824 +#if defined(__SVR4) && defined(__sun)
       
   825 +	/* We don't support parent-child sharing of IB resources on Solaris */
       
   826 +	if (fcntl(resp->async_fd, F_SETFD, FD_CLOEXEC) < 0) {
       
   827 +		fprintf(stderr, "ibv_get_context: FD_CLOEXEC failed "
       
   828 +		    "for async_fd: %s\n", strerror(errno));
       
   829 +		return errno;
       
   830 +	}
       
   831 +	if (fcntl(cq_fd, F_SETFD, FD_CLOEXEC) < 0) {
       
   832 +		fprintf(stderr, "ibv_get_context: FD_CLOEXEC failed "
       
   833 +		    "for cq_fd: %s\n", strerror(errno));
       
   834 +		return errno;
       
   835 +	}
       
   836 +#endif
       
   837  	context->async_fd         = resp->async_fd;
       
   838  	context->num_comp_vectors = 1;
       
   839  	t->channel.context        = context;
       
   840 @@ -87,19 +140,53 @@
   812  			size_t cmd_size, struct ibv_get_context_resp *resp,
   841  			size_t cmd_size, struct ibv_get_context_resp *resp,
   813  			size_t resp_size)
   842  			size_t resp_size)
   814  {
   843  {
   815 +#if defined(__SVR4) && defined(__sun)
   844 +#if defined(__SVR4) && defined(__sun)
   816 +	int			event_fd;
   845 +	int			event_fd;
   835 +	resp->async_fd = event_fd;
   864 +	resp->async_fd = event_fd;
   836 +#endif
   865 +#endif
   837  
   866  
   838  	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
   867  	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
   839  
   868  
   840 @@ -100,6 +155,16 @@
   869 +#if defined(__SVR4) && defined(__sun)
       
   870 +	/* We don't support parent-child sharing of IB resources on Solaris */
       
   871 +	if (fcntl(resp->async_fd, F_SETFD, FD_CLOEXEC) < 0) {
       
   872 +		fprintf(stderr, "ibv_get_context: FD_CLOEXEC failed: %s\n",
       
   873 +		    strerror(errno));
       
   874 +		return errno;
       
   875 +	}
       
   876 +#endif
       
   877 +
   841  	context->async_fd         = resp->async_fd;
   878  	context->async_fd         = resp->async_fd;
   842  	context->num_comp_vectors = resp->num_comp_vectors;
   879  	context->num_comp_vectors = resp->num_comp_vectors;
   843  
   880  
   844 +#if defined(__SVR4) && defined(__sun)
   881 +#if defined(__SVR4) && defined(__sun)
   845 +	/*
   882 +	/*
   852 +	}
   889 +	}
   853 +#endif
   890 +#endif
   854  	return 0;
   891  	return 0;
   855  }
   892  }
   856  
   893  
   857 @@ -120,6 +185,7 @@
   894 @@ -120,6 +207,7 @@
   858  	memset(device_attr->fw_ver, 0, sizeof device_attr->fw_ver);
   895  	memset(device_attr->fw_ver, 0, sizeof device_attr->fw_ver);
   859  	*raw_fw_ver			       = resp.fw_ver;
   896  	*raw_fw_ver			       = resp.fw_ver;
   860  	device_attr->node_guid 		       = resp.node_guid;
   897  	device_attr->node_guid 		       = resp.node_guid;
   861 +	device_attr->node_guid_external	       = resp.node_guid_external;
   898 +	device_attr->node_guid_external	       = resp.node_guid_external;
   862  	device_attr->sys_image_guid 	       = resp.sys_image_guid;
   899  	device_attr->sys_image_guid 	       = resp.sys_image_guid;
   863  	device_attr->max_mr_size 	       = resp.max_mr_size;
   900  	device_attr->max_mr_size 	       = resp.max_mr_size;
   864  	device_attr->page_size_cap 	       = resp.page_size_cap;
   901  	device_attr->page_size_cap 	       = resp.page_size_cap;
   865 @@ -218,6 +284,45 @@
   902 @@ -207,6 +295,8 @@
       
   903  {
       
   904  	IBV_INIT_CMD_RESP(cmd, cmd_size, ALLOC_PD, resp, resp_size);
       
   905  
       
   906 +	cmd->user_handle     = (uintptr_t) pd;
       
   907 +
       
   908  	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
       
   909  		return errno;
       
   910  
       
   911 @@ -218,6 +308,47 @@
   866  	return 0;
   912  	return 0;
   867  }
   913  }
   868  
   914  
   869 +int ibv_cmd_alloc_shpd(struct ibv_context *context, struct ibv_pd *pd,
   915 +int ibv_cmd_alloc_shpd(struct ibv_context *context, struct ibv_pd *pd,
   870 +         uint64_t share_key, struct ibv_shpd *shpd,
   916 +         uint64_t share_key, struct ibv_shpd *shpd,
   871 +		     struct ibv_alloc_shpd *cmd, size_t cmd_size,
   917 +		     struct ibv_alloc_shpd *cmd, size_t cmd_size,
   872 +		     struct ibv_alloc_shpd_resp *resp, size_t resp_size)
   918 +		     struct ibv_alloc_shpd_resp *resp, size_t resp_size)
   873 +{
   919 +{
   874 +	IBV_INIT_CMD_RESP(cmd, cmd_size, ALLOC_SHPD, resp, resp_size);
   920 +	IBV_INIT_CMD_RESP(cmd, cmd_size, ALLOC_SHPD, resp, resp_size);
   875 +        cmd->pd_handle = pd->handle;
   921 +        cmd->pd_handle = pd->handle;
       
   922 +	cmd->user_handle = (uintptr_t) pd;
   876 +	cmd->share_key = share_key;
   923 +	cmd->share_key = share_key;
   877 +
   924 +
   878 +	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
   925 +	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
   879 +		return errno;
   926 +		return errno;
   880 +
   927 +
   891 +		     struct ibv_share_pd_resp *resp, size_t resp_size)
   938 +		     struct ibv_share_pd_resp *resp, size_t resp_size)
   892 +{
   939 +{
   893 +	IBV_INIT_CMD_RESP(cmd, cmd_size, SHARE_PD, resp, resp_size);
   940 +	IBV_INIT_CMD_RESP(cmd, cmd_size, SHARE_PD, resp, resp_size);
   894 +	cmd->shpd_handle = shpd->handle;
   941 +	cmd->shpd_handle = shpd->handle;
   895 +	cmd->share_key = share_key;
   942 +	cmd->share_key = share_key;
       
   943 +	cmd->user_handle     = (uintptr_t) pd;
   896 +
   944 +
   897 +	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
   945 +	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
   898 +		return errno;
   946 +		return errno;
   899 +
   947 +
   900 +	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
   948 +	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
   906 +}
   954 +}
   907 +
   955 +
   908  int ibv_cmd_dealloc_pd(struct ibv_pd *pd)
   956  int ibv_cmd_dealloc_pd(struct ibv_pd *pd)
   909  {
   957  {
   910  	struct ibv_dealloc_pd cmd;
   958  	struct ibv_dealloc_pd cmd;
   911 @@ -259,6 +364,34 @@
   959 @@ -224,6 +355,7 @@
       
   960  
       
   961  	IBV_INIT_CMD(&cmd, sizeof cmd, DEALLOC_PD);
       
   962  	cmd.pd_handle = pd->handle;
       
   963 +	cmd.user_handle = (uintptr_t) pd;
       
   964  
       
   965  	if (write(pd->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
   966  		return errno;
       
   967 @@ -244,6 +376,7 @@
       
   968  	cmd->length 	  = length;
       
   969  	cmd->hca_va 	  = hca_va;
       
   970  	cmd->pd_handle 	  = pd->handle;
       
   971 +	cmd->user_handle  = (uintptr_t) mr;
       
   972  	cmd->access_flags = access;
       
   973  
       
   974  	if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size)
       
   975 @@ -259,6 +392,35 @@
   912  	return 0;
   976  	return 0;
   913  }
   977  }
   914  
   978  
   915 +int ibv_cmd_reg_mr_relaxed(struct ibv_pd *pd, void *addr, size_t length,
   979 +int ibv_cmd_reg_mr_relaxed(struct ibv_pd *pd, void *addr, size_t length,
   916 +		   uint64_t hca_va, int access,
   980 +		   uint64_t hca_va, int access,
   923 +
   987 +
   924 +	cmd->start 	  = (uintptr_t) addr;
   988 +	cmd->start 	  = (uintptr_t) addr;
   925 +	cmd->length 	  = length;
   989 +	cmd->length 	  = length;
   926 +	cmd->hca_va 	  = hca_va;
   990 +	cmd->hca_va 	  = hca_va;
   927 +	cmd->pd_handle 	  = pd->handle;
   991 +	cmd->pd_handle 	  = pd->handle;
       
   992 +	cmd->user_handle  = (uintptr_t) mr;
   928 +	cmd->access_flags = access;
   993 +	cmd->access_flags = access;
   929 +
   994 +
   930 +	if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size)
   995 +	if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size)
   931 +		return errno;
   996 +		return errno;
   932 +
   997 +
   941 +}
  1006 +}
   942 +
  1007 +
   943  int ibv_cmd_dereg_mr(struct ibv_mr *mr)
  1008  int ibv_cmd_dereg_mr(struct ibv_mr *mr)
   944  {
  1009  {
   945  	struct ibv_dereg_mr cmd;
  1010  	struct ibv_dereg_mr cmd;
   946 @@ -272,6 +405,32 @@
  1011 @@ -265,6 +427,7 @@
       
  1012  
       
  1013  	IBV_INIT_CMD(&cmd, sizeof cmd, DEREG_MR);
       
  1014  	cmd.mr_handle = mr->handle;
       
  1015 +	cmd.user_handle  = (uintptr_t) mr;
       
  1016  
       
  1017  	if (write(mr->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
  1018  		return errno;
       
  1019 @@ -272,6 +435,34 @@
   947  	return 0;
  1020  	return 0;
   948  }
  1021  }
   949  
  1022  
   950 +int ibv_cmd_dereg_mr_relaxed(struct ibv_mr *mr)
  1023 +int ibv_cmd_dereg_mr_relaxed(struct ibv_mr *mr)
   951 +{
  1024 +{
   952 +	struct ibv_dereg_mr cmd;
  1025 +	struct ibv_dereg_mr cmd;
   953 +
  1026 +
   954 +	IBV_INIT_CMD(&cmd, sizeof cmd, DEREG_MR_RELAXED);
  1027 +	IBV_INIT_CMD(&cmd, sizeof cmd, DEREG_MR_RELAXED);
   955 +	cmd.mr_handle = mr->handle;
  1028 +	cmd.mr_handle = mr->handle;
       
  1029 +	cmd.user_handle  = (uintptr_t) mr;
   956 +
  1030 +
   957 +	if (write(mr->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
  1031 +	if (write(mr->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
   958 +		return errno;
  1032 +		return errno;
   959 +
  1033 +
   960 +	return 0;
  1034 +	return 0;
   964 +{
  1038 +{
   965 +	struct ibv_flush_relaxed_mr cmd;
  1039 +	struct ibv_flush_relaxed_mr cmd;
   966 +
  1040 +
   967 +	IBV_INIT_CMD(&cmd, sizeof cmd, FLUSH_RELAXED_MR);
  1041 +	IBV_INIT_CMD(&cmd, sizeof cmd, FLUSH_RELAXED_MR);
   968 +	cmd.pd_handle = pd->handle;
  1042 +	cmd.pd_handle = pd->handle;
       
  1043 +	cmd.user_handle  = (uintptr_t) pd;
   969 +
  1044 +
   970 +	if (write(pd->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
  1045 +	if (write(pd->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
   971 +		return errno;
  1046 +		return errno;
   972 +
  1047 +
   973 +	return 0;
  1048 +	return 0;
   974 +}
  1049 +}
   975 +
  1050 +
   976  static int ibv_cmd_create_cq_v2(struct ibv_context *context, int cqe,
  1051  static int ibv_cmd_create_cq_v2(struct ibv_context *context, int cqe,
   977  				struct ibv_cq *cq,
  1052  				struct ibv_cq *cq,
   978  				struct ibv_create_cq *new_cmd, size_t new_cmd_size,
  1053  				struct ibv_create_cq *new_cmd, size_t new_cmd_size,
   979 @@ -315,7 +474,19 @@
  1054 @@ -315,7 +506,19 @@
   980  	cmd->user_handle   = (uintptr_t) cq;
  1055  	cmd->user_handle   = (uintptr_t) cq;
   981  	cmd->cqe           = cqe;
  1056  	cmd->cqe           = cqe;
   982  	cmd->comp_vector   = comp_vector;
  1057  	cmd->comp_vector   = comp_vector;
   983 +#if defined(__SVR4) && defined(__sun)
  1058 +#if defined(__SVR4) && defined(__sun)
   984 +	if (channel) {
  1059 +	if (channel) {
   994  	cmd->comp_channel  = channel ? channel->fd : -1;
  1069  	cmd->comp_channel  = channel ? channel->fd : -1;
   995 +#endif
  1070 +#endif
   996  	cmd->reserved      = 0;
  1071  	cmd->reserved      = 0;
   997  
  1072  
   998  	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
  1073  	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
   999 @@ -637,7 +808,20 @@
  1074 @@ -346,6 +549,7 @@
       
  1075  	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, POLL_CQ, resp, rsize);
       
  1076  	cmd.cq_handle = ibcq->handle;
       
  1077  	cmd.ne        = ne;
       
  1078 +	cmd.user_handle  = (uintptr_t) ibcq;
       
  1079  
       
  1080  	if (write(ibcq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd) {
       
  1081  		ret = -1;
       
  1082 @@ -384,6 +588,7 @@
       
  1083  	IBV_INIT_CMD(&cmd, sizeof cmd, REQ_NOTIFY_CQ);
       
  1084  	cmd.cq_handle = ibcq->handle;
       
  1085  	cmd.solicited = !!solicited_only;
       
  1086 +	cmd.user_handle  = (uintptr_t) ibcq;
       
  1087  
       
  1088  	if (write(ibcq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
  1089  		return errno;
       
  1090 @@ -399,6 +604,7 @@
       
  1091  	IBV_INIT_CMD_RESP(cmd, cmd_size, RESIZE_CQ, resp, resp_size);
       
  1092  	cmd->cq_handle = cq->handle;
       
  1093  	cmd->cqe       = cqe;
       
  1094 +	cmd->user_handle   = (uintptr_t) cq;
       
  1095  
       
  1096  	if (write(cq->context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1097  		return errno;
       
  1098 @@ -434,6 +640,7 @@
       
  1099  	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, DESTROY_CQ, &resp, sizeof resp);
       
  1100  	cmd.cq_handle = cq->handle;
       
  1101  	cmd.reserved  = 0;
       
  1102 +	cmd.user_handle  = (uintptr_t) cq;
       
  1103  
       
  1104  	if (write(cq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
  1105  		return errno;
       
  1106 @@ -555,6 +762,7 @@
       
  1107  	cmd->attr_mask	= srq_attr_mask;
       
  1108  	cmd->max_wr	= srq_attr->max_wr;
       
  1109  	cmd->srq_limit	= srq_attr->srq_limit;
       
  1110 +	cmd->user_handle   = (uintptr_t) srq;
       
  1111  
       
  1112  	if (write(srq->context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1113  		return errno;
       
  1114 @@ -569,6 +777,7 @@
       
  1115  
       
  1116  	IBV_INIT_CMD_RESP(cmd, cmd_size, QUERY_SRQ, &resp, sizeof resp);
       
  1117  	cmd->srq_handle = srq->handle;
       
  1118 +	cmd->user_handle   = (uintptr_t) srq;
       
  1119  	cmd->reserved   = 0;
       
  1120  
       
  1121  	if (write(srq->context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1122 @@ -606,6 +815,7 @@
       
  1123  
       
  1124  	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, DESTROY_SRQ, &resp, sizeof resp);
       
  1125  	cmd.srq_handle = srq->handle;
       
  1126 +	cmd.user_handle  = (uintptr_t) srq;
       
  1127  	cmd.reserved   = 0;
       
  1128  
       
  1129  	if (write(srq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
  1130 @@ -637,7 +847,20 @@
  1000  	cmd->max_send_sge    = attr->cap.max_send_sge;
  1131  	cmd->max_send_sge    = attr->cap.max_send_sge;
  1001  	cmd->max_recv_sge    = attr->cap.max_recv_sge;
  1132  	cmd->max_recv_sge    = attr->cap.max_recv_sge;
  1002  	cmd->max_inline_data = attr->cap.max_inline_data;
  1133  	cmd->max_inline_data = attr->cap.max_inline_data;
  1003 +
  1134 +
  1004 +#if defined(__SVR4) && defined(__sun)
  1135 +#if defined(__SVR4) && defined(__sun)
  1015 +#endif
  1146 +#endif
  1016 +
  1147 +
  1017  	cmd->qp_type 	     = attr->qp_type;
  1148  	cmd->qp_type 	     = attr->qp_type;
  1018  	cmd->is_srq 	     = !!attr->srq;
  1149  	cmd->is_srq 	     = !!attr->srq;
  1019  	cmd->srq_handle      = attr->qp_type == IBV_QPT_XRC ?
  1150  	cmd->srq_handle      = attr->qp_type == IBV_QPT_XRC ?
  1020 @@ -1406,4 +1590,3 @@
  1151 @@ -691,6 +914,7 @@
       
  1152  	IBV_INIT_CMD_RESP(cmd, cmd_size, QUERY_QP, &resp, sizeof resp);
       
  1153  	cmd->qp_handle = qp->handle;
       
  1154  	cmd->attr_mask = attr_mask;
       
  1155 +	cmd->user_handle   = (uintptr_t) qp;
       
  1156  
       
  1157  	if (write(qp->context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1158  		return errno;
       
  1159 @@ -772,6 +996,7 @@
       
  1160  	IBV_INIT_CMD(cmd, cmd_size, MODIFY_QP);
       
  1161  
       
  1162  	cmd->qp_handle 		 = qp->handle;
       
  1163 +	cmd->user_handle   	 = (uintptr_t) qp;
       
  1164  	cmd->attr_mask 		 = attr_mask;
       
  1165  	cmd->qkey 		 = attr->qkey;
       
  1166  	cmd->rq_psn 		 = attr->rq_psn;
       
  1167 @@ -1292,6 +1517,7 @@
       
  1168  	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, DESTROY_QP, &resp, sizeof resp);
       
  1169  	cmd.qp_handle = qp->handle;
       
  1170  	cmd.reserved  = 0;
       
  1171 +	cmd.user_handle  = (uintptr_t) qp;
       
  1172  
       
  1173  	if (write(qp->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
  1174  		return errno;
       
  1175 @@ -1313,6 +1539,7 @@
       
  1176  	IBV_INIT_CMD(&cmd, sizeof cmd, ATTACH_MCAST);
       
  1177  	memcpy(cmd.gid, gid->raw, sizeof cmd.gid);
       
  1178  	cmd.qp_handle = qp->handle;
       
  1179 +	cmd.user_handle  = (uintptr_t) qp;
       
  1180  	cmd.mlid      = lid;
       
  1181  	cmd.reserved  = 0;
       
  1182  
       
  1183 @@ -1329,6 +1556,7 @@
       
  1184  	IBV_INIT_CMD(&cmd, sizeof cmd, DETACH_MCAST);
       
  1185  	memcpy(cmd.gid, gid->raw, sizeof cmd.gid);
       
  1186  	cmd.qp_handle = qp->handle;
       
  1187 +	cmd.user_handle  = (uintptr_t) qp;
       
  1188  	cmd.mlid      = lid;
       
  1189  	cmd.reserved  = 0;
       
  1190  
       
  1191 @@ -1406,4 +1634,3 @@
  1021  		return errno;
  1192  		return errno;
  1022  	return 0;
  1193  	return 0;
  1023  }
  1194  }
  1024 -
  1195 -
  1025 diff -r -u /tmp/846623/libibverbs-1.1.4/src/init.c libibverbs-1.1.4/src/init.c
  1196 diff -r -u /tmp/846623/libibverbs-1.1.4/src/init.c libibverbs-1.1.4/src/init.c
  1324  	__u64 node_guid;
  1495  	__u64 node_guid;
  1325 +	__u64 node_guid_external;
  1496 +	__u64 node_guid_external;
  1326  	__u64 sys_image_guid;
  1497  	__u64 sys_image_guid;
  1327  	__u64 max_mr_size;
  1498  	__u64 max_mr_size;
  1328  	__u64 page_size_cap;
  1499  	__u64 page_size_cap;
  1329 @@ -243,10 +253,57 @@
  1500 @@ -240,18 +250,70 @@
       
  1501  	__u16 in_words;
       
  1502  	__u16 out_words;
       
  1503  	__u64 response;
       
  1504 +	__u64 user_handle;
  1330  	__u64 driver_data[0];
  1505  	__u64 driver_data[0];
  1331  };
  1506  };
  1332  
  1507  
  1333 +#if defined(__SVR4) && defined(__sun)
  1508 +#if defined(__SVR4) && defined(__sun)
  1334 +/*
  1509 +/*
  1355 +	__u16 out_words;
  1530 +	__u16 out_words;
  1356 +	__u64 response;
  1531 +	__u64 response;
  1357 +	__u32 pd_handle;
  1532 +	__u32 pd_handle;
  1358 +	__u32 reserved;
  1533 +	__u32 reserved;
  1359 +	__u64 share_key;
  1534 +	__u64 share_key;
       
  1535 +	__u64 user_handle;
  1360 +	__u64 driver_data[0];
  1536 +	__u64 driver_data[0];
  1361 +};
  1537 +};
  1362 +
  1538 +
  1363 +struct ibv_alloc_shpd_resp {
  1539 +struct ibv_alloc_shpd_resp {
  1364 +	__u32 shpd_handle;
  1540 +	__u32 shpd_handle;
  1370 +	__u16 out_words;
  1546 +	__u16 out_words;
  1371 +	__u64 response;
  1547 +	__u64 response;
  1372 +	__u32 shpd_handle;
  1548 +	__u32 shpd_handle;
  1373 +	__u32 reserved;
  1549 +	__u32 reserved;
  1374 +	__u64 share_key;
  1550 +	__u64 share_key;
       
  1551 +	__u64 user_handle;
  1375 +	__u64 driver_data[0];
  1552 +	__u64 driver_data[0];
  1376 +};
  1553 +};
  1377 +
  1554 +
  1378 +struct ibv_share_pd_resp {
  1555 +struct ibv_share_pd_resp {
  1379 +	__u32 pd_handle;
  1556 +	__u32 pd_handle;
  1382 +};
  1559 +};
  1383 +
  1560 +
  1384  struct ibv_dealloc_pd {
  1561  struct ibv_dealloc_pd {
  1385  	__u32 command;
  1562  	__u32 command;
  1386  	__u16 in_words;
  1563  	__u16 in_words;
  1387 @@ -280,6 +337,13 @@
  1564  	__u16 out_words;
       
  1565  	__u32 pd_handle;
       
  1566 +	__u32 reserved;
       
  1567 +	__u64 user_handle;
       
  1568  };
       
  1569  
       
  1570  struct ibv_reg_mr {
       
  1571 @@ -264,6 +326,7 @@
       
  1572  	__u64 hca_va;
       
  1573  	__u32 pd_handle;
       
  1574  	__u32 access_flags;
       
  1575 +	__u64 user_handle;
       
  1576  	__u64 driver_data[0];
       
  1577  };
       
  1578  
       
  1579 @@ -278,8 +341,19 @@
       
  1580  	__u16 in_words;
       
  1581  	__u16 out_words;
  1388  	__u32 mr_handle;
  1582  	__u32 mr_handle;
       
  1583 +	__u32 reserved;
       
  1584 +	__u64 user_handle;
  1389  };
  1585  };
  1390  
  1586  
  1391 +struct ibv_flush_relaxed_mr {
  1587 +struct ibv_flush_relaxed_mr {
  1392 +	__u32 command;
  1588 +	__u32 command;
  1393 +	__u16 in_words;
  1589 +	__u16 in_words;
  1394 +	__u16 out_words;
  1590 +	__u16 out_words;
  1395 +	__u32 pd_handle;
  1591 +	__u32 pd_handle;
       
  1592 +	__u32 reserved;
       
  1593 +	__u64 user_handle;
  1396 +};
  1594 +};
  1397 +
  1595 +
  1398  struct ibv_create_comp_channel {
  1596  struct ibv_create_comp_channel {
  1399  	__u32 command;
  1597  	__u32 command;
  1400  	__u16 in_words;
  1598  	__u16 in_words;
  1401 @@ -304,10 +368,25 @@
  1599 @@ -304,10 +378,25 @@
  1402  	__u64 driver_data[0];
  1600  	__u64 driver_data[0];
  1403  };
  1601  };
  1404  
  1602  
  1405 +#if defined(__SVR4) && defined(__sun)
  1603 +#if defined(__SVR4) && defined(__sun)
  1406 +/*
  1604 +/*
  1422 +};
  1620 +};
  1423 +#endif
  1621 +#endif
  1424  
  1622  
  1425  struct ibv_kern_wc {
  1623  struct ibv_kern_wc {
  1426  	__u64  wr_id;
  1624  	__u64  wr_id;
  1427 @@ -363,7 +442,11 @@
  1625 @@ -334,6 +423,7 @@
       
  1626  	__u64 response;
       
  1627  	__u32 cq_handle;
       
  1628  	__u32 ne;
       
  1629 +	__u64 user_handle;
       
  1630  };
       
  1631  
       
  1632  struct ibv_poll_cq_resp {
       
  1633 @@ -348,6 +438,7 @@
       
  1634  	__u16 out_words;
       
  1635  	__u32 cq_handle;
       
  1636  	__u32 solicited;
       
  1637 +	__u64 user_handle;
       
  1638  };
       
  1639  
       
  1640  struct ibv_resize_cq {
       
  1641 @@ -357,6 +448,7 @@
       
  1642  	__u64 response;
       
  1643  	__u32 cq_handle;
       
  1644  	__u32 cqe;
       
  1645 +	__u64 user_handle;
       
  1646  	__u64 driver_data[0];
       
  1647  };
       
  1648  
       
  1649 @@ -363,7 +455,11 @@
  1428  struct ibv_resize_cq_resp {
  1650  struct ibv_resize_cq_resp {
  1429  	__u32 cqe;
  1651  	__u32 cqe;
  1430  	__u32 reserved;
  1652  	__u32 reserved;
  1431 +#if defined(__SVR4) && defined(__sun)
  1653 +#if defined(__SVR4) && defined(__sun)
  1432 +        ofuv_cq_drv_data_out_t   drv_out;
  1654 +        ofuv_cq_drv_data_out_t   drv_out;
  1434  	__u64 driver_data[0];
  1656  	__u64 driver_data[0];
  1435 +#endif
  1657 +#endif
  1436  };
  1658  };
  1437  
  1659  
  1438  struct ibv_destroy_cq {
  1660  struct ibv_destroy_cq {
  1439 @@ -460,6 +543,14 @@
  1661 @@ -373,6 +469,7 @@
       
  1662  	__u64 response;
       
  1663  	__u32 cq_handle;
       
  1664  	__u32 reserved;
       
  1665 +	__u64 user_handle;
       
  1666  };
       
  1667  
       
  1668  struct ibv_destroy_cq_resp {
       
  1669 @@ -460,6 +557,14 @@
  1440  	__u64 driver_data[0];
  1670  	__u64 driver_data[0];
  1441  };
  1671  };
  1442  
  1672  
  1443 +#if defined(__SVR4) && defined(__sun)
  1673 +#if defined(__SVR4) && defined(__sun)
  1444 +/*
  1674 +/*
  1449 +typedef __u64 ofuv_qp_drv_data_out_t[SOL_UVERBS_QP_DATA_OUT_SIZE];
  1679 +typedef __u64 ofuv_qp_drv_data_out_t[SOL_UVERBS_QP_DATA_OUT_SIZE];
  1450 +
  1680 +
  1451  struct ibv_create_qp_resp {
  1681  struct ibv_create_qp_resp {
  1452  	__u32 qp_handle;
  1682  	__u32 qp_handle;
  1453  	__u32 qpn;
  1683  	__u32 qpn;
  1454 @@ -469,7 +560,20 @@
  1684 @@ -469,7 +574,20 @@
  1455  	__u32 max_recv_sge;
  1685  	__u32 max_recv_sge;
  1456  	__u32 max_inline_data;
  1686  	__u32 max_inline_data;
  1457  	__u32 reserved;
  1687  	__u32 reserved;
  1458 +	ofuv_qp_drv_data_out_t drv_out;
  1688 +	ofuv_qp_drv_data_out_t drv_out;
  1459  };
  1689  };
  1470 +};
  1700 +};
  1471 +#endif
  1701 +#endif
  1472  
  1702  
  1473  struct ibv_qp_dest {
  1703  struct ibv_qp_dest {
  1474  	__u8  dgid[16];
  1704  	__u8  dgid[16];
  1475 @@ -817,12 +921,29 @@
  1705 @@ -493,6 +611,7 @@
       
  1706  	__u64 response;
       
  1707  	__u32 qp_handle;
       
  1708  	__u32 attr_mask;
       
  1709 +	__u64 user_handle;
       
  1710  	__u64 driver_data[0];
       
  1711  };
       
  1712  
       
  1713 @@ -560,6 +679,7 @@
       
  1714  	__u8  alt_port_num;
       
  1715  	__u8  alt_timeout;
       
  1716  	__u8  reserved[2];
       
  1717 +	__u64 user_handle;
       
  1718  	__u64 driver_data[0];
       
  1719  };
       
  1720  
       
  1721 @@ -570,6 +690,7 @@
       
  1722  	__u64 response;
       
  1723  	__u32 qp_handle;
       
  1724  	__u32 reserved;
       
  1725 +	__u64 user_handle;
       
  1726  };
       
  1727  
       
  1728  struct ibv_destroy_qp_resp {
       
  1729 @@ -775,6 +896,7 @@
       
  1730  	__u32 qp_handle;
       
  1731  	__u16 mlid;
       
  1732  	__u16 reserved;
       
  1733 +	__u64 user_handle;
       
  1734  	__u64 driver_data[0];
       
  1735  };
       
  1736  
       
  1737 @@ -786,6 +908,7 @@
       
  1738  	__u32 qp_handle;
       
  1739  	__u16 mlid;
       
  1740  	__u16 reserved;
       
  1741 +	__u64 user_handle;
       
  1742  	__u64 driver_data[0];
       
  1743  };
       
  1744  
       
  1745 @@ -817,12 +940,29 @@
  1476  	__u64 driver_data[0];
  1746  	__u64 driver_data[0];
  1477  };
  1747  };
  1478  
  1748  
  1479 +#if defined(__SVR4) && defined(__sun)
  1749 +#if defined(__SVR4) && defined(__sun)
  1480 +/*
  1750 +/*
  1500 +};
  1770 +};
  1501 +#endif
  1771 +#endif
  1502  
  1772  
  1503  struct ibv_modify_srq {
  1773  struct ibv_modify_srq {
  1504  	__u32 command;
  1774  	__u32 command;
  1505 @@ -946,6 +1067,11 @@
  1775 @@ -832,6 +972,7 @@
       
  1776  	__u32 attr_mask;
       
  1777  	__u32 max_wr;
       
  1778  	__u32 srq_limit;
       
  1779 +	__u64 user_handle;
       
  1780  	__u64 driver_data[0];
       
  1781  };
       
  1782  
       
  1783 @@ -842,6 +983,7 @@
       
  1784  	__u64 response;
       
  1785  	__u32 srq_handle;
       
  1786  	__u32 reserved;
       
  1787 +	__u64 user_handle;
       
  1788  	__u64 driver_data[0];
       
  1789  };
       
  1790  
       
  1791 @@ -859,6 +1001,7 @@
       
  1792  	__u64 response;
       
  1793  	__u32 srq_handle;
       
  1794  	__u32 reserved;
       
  1795 +	__u64 user_handle;
       
  1796  };
       
  1797  
       
  1798  struct ibv_destroy_srq_resp {
       
  1799 @@ -946,6 +1089,11 @@
  1506  	IB_USER_VERBS_CMD_QUERY_XRC_RCV_QP_V2 = -1,
  1800  	IB_USER_VERBS_CMD_QUERY_XRC_RCV_QP_V2 = -1,
  1507  	IB_USER_VERBS_CMD_REG_XRC_RCV_QP_V2 = -1,
  1801  	IB_USER_VERBS_CMD_REG_XRC_RCV_QP_V2 = -1,
  1508  	IB_USER_VERBS_CMD_UNREG_XRC_RCV_QP_V2 = -1,
  1802  	IB_USER_VERBS_CMD_UNREG_XRC_RCV_QP_V2 = -1,
  1509 +	IB_USER_VERBS_CMD_REG_MR_RELAXED_V2 = -1,
  1803 +	IB_USER_VERBS_CMD_REG_MR_RELAXED_V2 = -1,
  1510 +	IB_USER_VERBS_CMD_DEREG_MR_RELAXED_V2 = -1,
  1804 +	IB_USER_VERBS_CMD_DEREG_MR_RELAXED_V2 = -1,