components/open-fabrics/libibverbs/patches/base.patch
branchs11u3-sru
changeset 6322 c8b38df3868d
parent 6300 bce0b6e91f80
child 6323 9beb4b346649
equal deleted inserted replaced
6300:bce0b6e91f80 6322:c8b38df3868d
     1 #This patch was developed in-house. We plan to submit it upstream, but do
       
     2 # not yet have a target date for doing so
       
     3 #
       
     4 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
       
     6 +++ libibverbs-1.1.4/Makefile.am	Fri Feb 11 04:02:12 2011
       
     7 @@ -4,13 +4,13 @@
       
     8  
       
     9  AM_CFLAGS = -g -Wall -D_GNU_SOURCE
       
    10  
       
    11 -src_libibverbs_la_CFLAGS = $(AM_CFLAGS) -DIBV_CONFIG_DIR=\"$(sysconfdir)/libibverbs.d\"
       
    12 +src_libibverbs_la_CFLAGS = $(AM_CFLAGS) -DIBV_CONFIG_DIR=\"$(datadir)/libibverbs.d\"
       
    13  
       
    14  libibverbs_version_script = @LIBIBVERBS_VERSION_SCRIPT@
       
    15  
       
    16  src_libibverbs_la_SOURCES = src/cmd.c src/compat-1_0.c src/device.c src/init.c \
       
    17  			    src/marshall.c src/memory.c src/sysfs.c src/verbs.c \
       
    18 -			    src/enum_strs.c
       
    19 +			    src/enum_strs.c src/solaris_compatibility.c
       
    20  src_libibverbs_la_LDFLAGS = -version-info 1 -export-dynamic \
       
    21      $(libibverbs_version_script)
       
    22  src_libibverbs_la_DEPENDENCIES = $(srcdir)/src/libibverbs.map
       
    23 @@ -37,7 +37,7 @@
       
    24  
       
    25  libibverbsinclude_HEADERS = include/infiniband/arch.h include/infiniband/driver.h \
       
    26      include/infiniband/kern-abi.h include/infiniband/opcode.h include/infiniband/verbs.h \
       
    27 -    include/infiniband/sa-kern-abi.h include/infiniband/sa.h include/infiniband/marshall.h
       
    28 +    include/infiniband/sa-kern-abi.h include/infiniband/sa.h include/infiniband/marshall.h include/infiniband/ofa_solaris.h
       
    29  
       
    30  man_MANS = man/ibv_asyncwatch.1 man/ibv_devices.1 man/ibv_devinfo.1	\
       
    31      man/ibv_rc_pingpong.1 man/ibv_uc_pingpong.1 man/ibv_ud_pingpong.1	\
       
    32 @@ -65,6 +65,7 @@
       
    33  
       
    34  EXTRA_DIST = include/infiniband/driver.h include/infiniband/kern-abi.h \
       
    35      include/infiniband/opcode.h include/infiniband/verbs.h include/infiniband/marshall.h \
       
    36 +	 include/infiniband/ofa_solaris.h \
       
    37      include/infiniband/sa-kern-abi.h include/infiniband/sa.h \
       
    38      src/ibverbs.h examples/pingpong.h \
       
    39      src/libibverbs.map libibverbs.spec.in $(man_MANS)
       
    40 diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_get_device_name.3 libibverbs-1.1.4/man/ibv_get_device_name.3
       
    41 --- /tmp/846623/libibverbs-1.1.4/man/ibv_get_device_name.3	Thu Mar 10 04:51:46 2011
       
    42 +++ libibverbs-1.1.4/man/ibv_get_device_name.3	Mon Mar 28 03:11:46 2011
       
    43 @@ -2,7 +2,7 @@
       
    44  .\"
       
    45  .TH IBV_GET_DEVICE_NAME 3  2006-10-31 libibverbs "Libibverbs Programmer's Manual"
       
    46  .SH "NAME"
       
    47 -ibv_get_device_name \- get an RDMA device's name
       
    48 +ibv_get_device_name \- get an InfiniBand device's name
       
    49  .SH "SYNOPSIS"
       
    50  .nf
       
    51  .B #include <infiniband/verbs.h>
       
    52 @@ -11,7 +11,7 @@
       
    53  .fi
       
    54  .SH "DESCRIPTION"
       
    55  .B ibv_get_device_name()
       
    56 -returns a human-readable name associated with the RDMA device
       
    57 +returns a human-readable name associated with the InfiniBand device
       
    58  .I device\fR.
       
    59  .SH "RETURN VALUE"
       
    60  .B ibv_get_device_name()
       
    61 diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_attach_mcast.3 libibverbs-1.1.4/man/ibv_attach_mcast.3
       
    62 --- /tmp/846623/libibverbs-1.1.4/man/ibv_attach_mcast.3	Thu Mar 10 06:58:21 2011
       
    63 +++ libibverbs-1.1.4/man/ibv_attach_mcast.3	Tue May  3 13:50:06 2011
       
    64 @@ -38,9 +38,6 @@
       
    65  .SH "NOTES"
       
    66  Only QPs of Transport Service Type
       
    67  .BR IBV_QPT_UD
       
    68 -or
       
    69 -.BR IBV_QPT_RAW_PACKET
       
    70 -may be attached to multicast groups.
       
    71  .PP
       
    72  If a QP is attached to the same multicast group multiple times, the QP will still receive a single copy of a multicast message.
       
    73  .PP
       
    74 @@ -48,22 +45,6 @@
       
    75  multicast group must be sent to the subnet administrator (SA), so that
       
    76  the fabric's multicast routing is configured to deliver messages to
       
    77  the local port.
       
    78 -.SH EXAMPLE
       
    79 -	An example of the use of ibv_attach_mcast with RAW ETH QP:
       
    80 -.nf
       
    81 -
       
    82 -	union ibv_gid mgid;
       
    83 -
       
    84 -	memset(&mgid, 0, sizeof(union ibv_gid));
       
    85 -
       
    86 -	memcpy(&mgid.raw[10], mmac, 6);
       
    87 -
       
    88 -	if (ibv_attach_mcast(qp, &mgid, 0)) {
       
    89 -		printf ("Failed to attach qp to mcast. Errno: %d\\n",errno);
       
    90 -		return 1;
       
    91 -	}
       
    92 -.fi
       
    93 -
       
    94  .SH "SEE ALSO"
       
    95  .BR ibv_create_qp (3)
       
    96  .SH "AUTHORS"
       
    97 diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_modify_qp.3 libibverbs-1.1.4/man/ibv_modify_qp.3
       
    98 --- /tmp/846623/libibverbs-1.1.4/man/ibv_modify_qp.3	Thu Mar 10 06:58:21 2011
       
    99 +++ libibverbs-1.1.4/man/ibv_modify_qp.3	Tue May  3 13:50:06 2011
       
   100 @@ -161,7 +161,7 @@
       
   101  .fi
       
   102  .PP
       
   103  .nf
       
   104 -For QP Transport Service Type \fB IBV_QPT_RAW_PACKET\fR:
       
   105 +For QP Transport Service Type:
       
   106  .sp
       
   107  Next state     Required attributes
       
   108  \-\-\-\-\-\-\-\-\-\-     \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
       
   109 diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_devinfo.1 libibverbs-1.1.4/man/ibv_devinfo.1
       
   110 --- /tmp/846623/libibverbs-1.1.4/man/ibv_devinfo.1	Thu Mar 10 04:51:46 2011
       
   111 +++ libibverbs-1.1.4/man/ibv_devinfo.1	Mon Mar 28 03:11:46 2011
       
   112 @@ -1,7 +1,7 @@
       
   113  .TH IBV_DEVINFO 1 "August 30, 2005" "libibverbs" "USER COMMANDS"
       
   114  
       
   115  .SH NAME
       
   116 -ibv_devinfo \- query RDMA devices
       
   117 +ibv_devinfo \- query InfiniBand devices
       
   118  
       
   119  .SH SYNOPSIS
       
   120  .B ibv_devinfo
       
   121 @@ -9,7 +9,7 @@
       
   122  
       
   123  .SH DESCRIPTION
       
   124  .PP
       
   125 -Print information about RDMA devices available for use from userspace.
       
   126 +Print information about InfiniBand devices available for use from userspace.
       
   127  
       
   128  .SH OPTIONS
       
   129  
       
   130 @@ -22,10 +22,10 @@
       
   131  query port \fIPORT\fR (default all ports)
       
   132  
       
   133  \fB\-l\fR, \fB\-\-list\fR
       
   134 -only list names of RDMA devices
       
   135 +only list names of InfiniBand devices
       
   136  
       
   137  \fB\-v\fR, \fB\-\-verbose\fR
       
   138 -print all available information about RDMA devices
       
   139 +print all available information about InfiniBand devices
       
   140  
       
   141  .SH SEE ALSO
       
   142  .BR ibv_devices (1)
       
   143 diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_query_qp.3 libibverbs-1.1.4/man/ibv_query_qp.3
       
   144 --- /tmp/846623/libibverbs-1.1.4/man/ibv_query_qp.3	Thu Mar 10 04:51:46 2011
       
   145 +++ libibverbs-1.1.4/man/ibv_query_qp.3	Mon Mar 28 03:11:47 2011
       
   146 @@ -68,7 +68,7 @@
       
   147  The argument
       
   148  .I attr_mask
       
   149  is a hint that specifies the minimum list of attributes to retrieve.
       
   150 -Some RDMA devices may return extra attributes not requested, for
       
   151 +Some InfiniBand devices may return extra attributes not requested, for
       
   152  example if the value can be returned cheaply. This has the same
       
   153  form as in
       
   154  .B ibv_modify_qp()\fR.
       
   155 diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_get_device_guid.3 libibverbs-1.1.4/man/ibv_get_device_guid.3
       
   156 --- /tmp/846623/libibverbs-1.1.4/man/ibv_get_device_guid.3	Thu Mar 10 04:51:46 2011
       
   157 +++ libibverbs-1.1.4/man/ibv_get_device_guid.3	Mon Mar 28 03:11:46 2011
       
   158 @@ -2,7 +2,7 @@
       
   159  .\"
       
   160  .TH IBV_GET_DEVICE_GUID 3 2006-10-31 libibverbs "Libibverbs Programmer's Manual"
       
   161  .SH "NAME"
       
   162 -ibv_get_device_guid \- get an RDMA device's GUID
       
   163 +ibv_get_device_guid \- get an InfiniBand device's GUID
       
   164  .SH "SYNOPSIS"
       
   165  .nf
       
   166  .B #include <infiniband/verbs.h>
       
   167 @@ -11,7 +11,7 @@
       
   168  .fi
       
   169  .SH "DESCRIPTION"
       
   170  .B ibv_get_device_name()
       
   171 -returns the Global Unique IDentifier (GUID) of the RDMA device
       
   172 +returns the Global Unique IDentifier (GUID) of the InfiniBand device
       
   173  .I device\fR.
       
   174  .SH "RETURN VALUE"
       
   175  .B ibv_get_device_guid()
       
   176 diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_post_send.3 libibverbs-1.1.4/man/ibv_post_send.3
       
   177 --- /tmp/846623/libibverbs-1.1.4/man/ibv_post_send.3	Thu Mar 10 06:58:20 2011
       
   178 +++ libibverbs-1.1.4/man/ibv_post_send.3	Wed Mar 13 07:28:54 2013
       
   179 @@ -91,14 +91,17 @@
       
   180  The attribute send_flags describes the properties of the \s-1WR\s0. It is either 0 or the bitwise \s-1OR\s0 of one or more of the following flags:
       
   181  .PP
       
   182  .TP
       
   183 -.B IBV_SEND_FENCE \fR Set the fence indicator.  Valid only for QPs with Transport Service Type \fBIBV_QPT_RC
       
   184 +.B IBV_SEND_FENCE \fR
       
   185 +Set the fence indicator.  Valid only for QPs with Transport Service Type \fBIBV_QPT_RC
       
   186  .TP
       
   187 -.B IBV_SEND_SIGNALED \fR Set the completion notification indicator.  Relevant only if QP was created with sq_sig_all=0
       
   188 +.B IBV_SEND_SIGNALED \fR
       
   189 +Set the completion notification indicator.  Relevant only if QP was created with sq_sig_all=0
       
   190  .TP
       
   191 -.B IBV_SEND_SOLICITED \fR Set the solicited event indicator.  Valid only for Send and RDMA Write with immediate
       
   192 +.B IBV_SEND_SOLICITED \fR
       
   193 +Set the solicited event indicator.  Valid only for Send and RDMA Write with immediate
       
   194  .TP
       
   195 -.B IBV_SEND_INLINE \fR Send data in given gather list as inline data
       
   196 -in a send WQE.  Valid only for Send and RDMA Write.  The L_Key will not be checked.
       
   197 +.B IBV_SEND_INLINE \fR
       
   198 +Send data in given gather list as inline data in a send WQE.  Valid only for Send and RDMA Write.  The L_Key will not be checked.
       
   199  .SH "RETURN VALUE"
       
   200  .B ibv_post_send()
       
   201  returns 0 on success, or the value of errno on failure (which indicates the failure reason).
       
   202 diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_alloc_pd.3 libibverbs-1.1.4/man/ibv_alloc_pd.3
       
   203 --- /tmp/846623/libibverbs-1.1.4/man/ibv_alloc_pd.3	Thu Mar 10 04:51:46 2011
       
   204 +++ libibverbs-1.1.4/man/ibv_alloc_pd.3	Mon Mar 28 03:11:45 2011
       
   205 @@ -13,7 +13,7 @@
       
   206  .fi
       
   207  .SH "DESCRIPTION"
       
   208  .B ibv_alloc_pd()
       
   209 -allocates a PD for the RDMA device context 
       
   210 +allocates a PD for the InfiniBand device context 
       
   211  .I context\fR.
       
   212  .PP
       
   213  .B ibv_dealloc_pd()
       
   214 diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_get_async_event.3 libibverbs-1.1.4/man/ibv_get_async_event.3
       
   215 --- /tmp/846623/libibverbs-1.1.4/man/ibv_get_async_event.3	Thu Mar 10 04:51:46 2011
       
   216 +++ libibverbs-1.1.4/man/ibv_get_async_event.3	Mon Mar 28 03:11:46 2011
       
   217 @@ -14,7 +14,7 @@
       
   218  .fi
       
   219  .SH "DESCRIPTION"
       
   220  .B ibv_get_async_event()
       
   221 -waits for the next async event of the RDMA device context
       
   222 +waits for the next async event of the InfiniBand device context
       
   223  .I context
       
   224  and returns it through the pointer
       
   225  .I event\fR,
       
   226 @@ -29,6 +29,8 @@
       
   227  struct ibv_qp  *qp;             /* QP that got the event */
       
   228  struct ibv_srq *srq;            /* SRQ that got the event */
       
   229  int             port_num;       /* port number that got the event */
       
   230 +uint32_t        xrc_qp_num;     /* XRC QP that got the event */
       
   231 +union ibv_gid   gid;            /* list of guids that got the event */
       
   232  .in -8
       
   233  } element;
       
   234  enum ibv_event_type     event_type;     /* type of the event */
       
   235 @@ -86,6 +88,16 @@
       
   236  .TP
       
   237  .B IBV_EVENT_DEVICE_FATAL \fR CA is in FATAL state
       
   238  .PP
       
   239 +.I Subnet events:
       
   240 +.TP
       
   241 +.B IBV_SM_EVENT_MCG_CREATED \fR notification of MCG creation
       
   242 +.TP
       
   243 +.B IBV_SM_EVENT_MCG_DELETED \fR notification of MCG deletion
       
   244 +.TP
       
   245 +.B IBV_SM_EVENT_GID_AVAIL \fR notification of GID available events
       
   246 +.TP
       
   247 +.B IBV_SM_EVENT_GID_UNAVAIL \fR notification of GID unavailable events
       
   248 +.PP
       
   249  .B ibv_ack_async_event()
       
   250  acknowledge the async event
       
   251  .I event\fR.
       
   252 diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_get_device_list.3 libibverbs-1.1.4/man/ibv_get_device_list.3
       
   253 --- /tmp/846623/libibverbs-1.1.4/man/ibv_get_device_list.3	Thu Mar 10 04:51:46 2011
       
   254 +++ libibverbs-1.1.4/man/ibv_get_device_list.3	Mon Mar 28 03:11:46 2011
       
   255 @@ -2,7 +2,7 @@
       
   256  .\"
       
   257  .TH IBV_GET_DEVICE_LIST 3 2006-10-31 libibverbs "Libibverbs Programmer's Manual"
       
   258  .SH "NAME"
       
   259 -ibv_get_device_list, ibv_free_device_list \- get and release list of available RDMA devices
       
   260 +ibv_get_device_list, ibv_free_device_list \- get and release list of available InfiniBand devices
       
   261  .SH "SYNOPSIS"
       
   262  .nf
       
   263  .B #include <infiniband/verbs.h>
       
   264 @@ -13,7 +13,7 @@
       
   265  .fi
       
   266  .SH "DESCRIPTION"
       
   267  .B ibv_get_device_list()
       
   268 -returns a NULL-terminated array of RDMA devices currently available.
       
   269 +returns a NULL-terminated array of InfiniBand devices currently available.
       
   270  The argument
       
   271  .I num_devices
       
   272  is optional; if not NULL, it is set to the number of devices returned in the array.
       
   273 @@ -25,7 +25,7 @@
       
   274  .B ibv_get_device_list()\fR.
       
   275  .SH "RETURN VALUE"
       
   276  .B ibv_get_device_list()
       
   277 -returns the array of available RDMA devices, or sets
       
   278 +returns the array of available InfiniBand devices, or sets
       
   279  .I errno
       
   280  and returns NULL if the request fails. If no devices are found then
       
   281  .I num_devices
       
   282 diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_query_device.3 libibverbs-1.1.4/man/ibv_query_device.3
       
   283 --- /tmp/846623/libibverbs-1.1.4/man/ibv_query_device.3	Thu Mar 10 04:51:46 2011
       
   284 +++ libibverbs-1.1.4/man/ibv_query_device.3	Mon Mar 28 03:11:47 2011
       
   285 @@ -2,7 +2,7 @@
       
   286  .\"
       
   287  .TH IBV_QUERY_DEVICE 3 2006-10-31 libibverbs "Libibverbs Programmer's Manual"
       
   288  .SH "NAME"
       
   289 -ibv_query_device \- query an RDMA device's attributes
       
   290 +ibv_query_device \- query an InfiniBand device's attributes
       
   291  .SH "SYNOPSIS"
       
   292  .nf
       
   293  .B #include <infiniband/verbs.h>
       
   294 diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_query_port.3 libibverbs-1.1.4/man/ibv_query_port.3
       
   295 --- /tmp/846623/libibverbs-1.1.4/man/ibv_query_port.3	Thu Mar 10 06:58:21 2011
       
   296 +++ libibverbs-1.1.4/man/ibv_query_port.3	Mon Mar 28 03:11:47 2011
       
   297 @@ -2,7 +2,7 @@
       
   298  .\"
       
   299  .TH IBV_QUERY_PORT 3 2006-10-31 libibverbs "Libibverbs Programmer's Manual"
       
   300  .SH "NAME"
       
   301 -ibv_query_port \- query an RDMA port's attributes
       
   302 +ibv_query_port \- query an InfiniBand port's attributes
       
   303  .SH "SYNOPSIS"
       
   304  .nf
       
   305  .B #include <infiniband/verbs.h>
       
   306 diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_asyncwatch.1 libibverbs-1.1.4/man/ibv_asyncwatch.1
       
   307 --- /tmp/846623/libibverbs-1.1.4/man/ibv_asyncwatch.1	Thu Mar 10 04:51:46 2011
       
   308 +++ libibverbs-1.1.4/man/ibv_asyncwatch.1	Mon Mar 28 03:11:45 2011
       
   309 @@ -1,16 +1,78 @@
       
   310 -.TH IBV_ASYNCWATCH 1 "August 30, 2005" "libibverbs" "USER COMMANDS"
       
   311 +'\" te
       
   312 +.TH IBV_ASYNCWATCH 1 "August 8, 2012" "libibverbs" "USER COMMANDS"
       
   313  
       
   314  .SH NAME
       
   315  ibv_asyncwatch \- display asynchronous events
       
   316  
       
   317  .SH SYNOPSIS
       
   318 -.B ibv_asyncwatch
       
   319 -
       
   320 +.sp
       
   321 +.nf
       
   322 +\fIibv_asyncwatch\fR [\-G | \-M] [\-s[<guid>]] [\-p port]
       
   323 +\fIibv_asyncwactch\fR \-s
       
   324 +\fIibv_asyncwatch\fR \-G \-s
       
   325 +\fIibv_asyncwatch\fR \-M \-s
       
   326 +\fIibv_asyncwatch\fR \-G [\-p port] \-s<guid1>,<guid2>,...
       
   327 +\fIibv_asyncwatch\fR \-M [\-p port] \-s<mgid1>,<mgid2>,...
       
   328 +.fi
       
   329 +.sp
       
   330  .SH DESCRIPTION
       
   331  .PP
       
   332 -Display asynchronous events forwarded to userspace for an RDMA device.
       
   333 +Display asynchronous events forwarded to userspace for an InfiniBand device.
       
   334 +SM events can be monitored using the '-s' option, which optionally
       
   335 +takes a remote port GUID, or list of remote port GUIDS separated by ','.
       
   336 +If '-s' is specified with no argument then all remote nodes reachable
       
   337 +form device 0 are monitored, otherwise only the specified remote
       
   338 +nodes are monitored. The following SM events are monitored using
       
   339 +the '-s' option: 
       
   340  
       
   341 -.SH AUTHORS
       
   342 -.TP
       
   343 -Roland Dreier
       
   344 -.RI < [email protected] >
       
   345 +    IBV_SM_EVENT_MCG_CREATED
       
   346 +         An MCG specified by the "mgid" has been created
       
   347 +         on this subnet.
       
   348 +
       
   349 +    IBV_SM_EVENT_MCG_DELETED
       
   350 +         The MCG specified by the "mgid" has been deleted
       
   351 +         on this subnet.
       
   352 +
       
   353 +    IBV_SM_EVENT_GID_AVAIL
       
   354 +         The GID specified by the "guid" is available
       
   355 +         on this subnet.
       
   356 +
       
   357 +    IBV_SM_EVENT_GID_UNAVAIL
       
   358 +         The GID specified by the "guid" is no longer
       
   359 +         available on this subnet.
       
   360 +
       
   361 +.SH OPTIONS
       
   362 +.pp
       
   363 +\-G               Monitor SM event for Unicast GIDs
       
   364 +.sp
       
   365 +.pp
       
   366 +\-M               Monitor SM event for Multicast GIDs
       
   367 +.pp
       
   368 +\-s<GUID>         Takes as an optional argument a comma separated list of remote port GUIDs if \-G is specified or Multicast GIDs if \-M is specified.
       
   369 +.sp
       
   370 +.PP
       
   371 +\-p <port>        use the specified ca_port.
       
   372 +.sp
       
   373 +.pp
       
   374 +.SH EXAMPLES
       
   375 +.PP
       
   376 +To monitor event=IBV_SM_EVENT_ALL
       
   377 +.sp
       
   378 +ibv_asyncwatch -s
       
   379 +.sp
       
   380 +To monitor event=IBV_SM_EVENT_UGID_ALL
       
   381 +.sp
       
   382 +ibv_asyncwatch -G -s
       
   383 +.sp
       
   384 +To monitor event=IBV_SM_EVENT_MGID_ALL
       
   385 +.sp
       
   386 +ibv_asyncwatch -M -s
       
   387 +.sp
       
   388 +To monitor event=IBV_SM_EVENT_UGID
       
   389 +.sp
       
   390 +ibv_asyncwatch -G -s0x0021280001a0e4d9,0x0021280001a0e4da
       
   391 +.sp
       
   392 +To monitor event=IBV_SM_EVENT_MGID
       
   393 +.sp
       
   394 +ibv_asyncwatch -M -s0xff12:4001:ffff::c:2238
       
   395 +.sp
       
   396 diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_open_device.3 libibverbs-1.1.4/man/ibv_open_device.3
       
   397 --- /tmp/846623/libibverbs-1.1.4/man/ibv_open_device.3	Thu Mar 10 04:51:46 2011
       
   398 +++ libibverbs-1.1.4/man/ibv_open_device.3	Mon Mar 28 03:11:46 2011
       
   399 @@ -2,7 +2,7 @@
       
   400  .\"
       
   401  .TH IBV_OPEN_DEVICE 3 2006-10-31 libibverbs "Libibverbs Programmer's Manual"
       
   402  .SH "NAME"
       
   403 -ibv_open_device, ibv_close_device \- open and close an RDMA device context
       
   404 +ibv_open_device, ibv_close_device \- open and close an InfiniBand device context
       
   405  .SH "SYNOPSIS"
       
   406  .nf
       
   407  .B #include <infiniband/verbs.h>
       
   408 diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_create_comp_channel.3 libibverbs-1.1.4/man/ibv_create_comp_channel.3
       
   409 --- /tmp/846623/libibverbs-1.1.4/man/ibv_create_comp_channel.3	Thu Mar 10 04:51:46 2011
       
   410 +++ libibverbs-1.1.4/man/ibv_create_comp_channel.3	Mon Mar 28 03:11:45 2011
       
   411 @@ -15,7 +15,7 @@
       
   412  .fi
       
   413  .SH "DESCRIPTION"
       
   414  .B ibv_create_comp_channel()
       
   415 -creates a completion event channel for the RDMA device context
       
   416 +creates a completion event channel for the InfiniBand device context
       
   417  .I context\fR.
       
   418  .PP
       
   419  .B ibv_destroy_comp_channel()
       
   420 diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_create_cq.3 libibverbs-1.1.4/man/ibv_create_cq.3
       
   421 --- /tmp/846623/libibverbs-1.1.4/man/ibv_create_cq.3	Thu Mar 10 04:51:46 2011
       
   422 +++ libibverbs-1.1.4/man/ibv_create_cq.3	Mon Mar 28 03:11:45 2011
       
   423 @@ -18,7 +18,7 @@
       
   424  .B ibv_create_cq()
       
   425  creates a completion queue (CQ) with at least
       
   426  .I cqe
       
   427 -entries for the RDMA device context
       
   428 +entries for the InfiniBand device context
       
   429  .I context\fR.
       
   430  The pointer
       
   431  .I cq_context
       
   432 diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_devices.1 libibverbs-1.1.4/man/ibv_devices.1
       
   433 --- /tmp/846623/libibverbs-1.1.4/man/ibv_devices.1	Thu Mar 10 04:51:46 2011
       
   434 +++ libibverbs-1.1.4/man/ibv_devices.1	Mon Mar 28 03:11:45 2011
       
   435 @@ -1,7 +1,7 @@
       
   436  .TH IBV_DEVICES 1 "August 30, 2005" "libibverbs" "USER COMMANDS"
       
   437  
       
   438  .SH NAME
       
   439 -ibv_devices \- list RDMA devices
       
   440 +ibv_devices \- list InfiniBand devices
       
   441  
       
   442  .SH SYNOPSIS
       
   443  .B ibv_devices
       
   444 @@ -8,8 +8,37 @@
       
   445  
       
   446  .SH DESCRIPTION
       
   447  .PP
       
   448 -List RDMA devices available for use from userspace.
       
   449 +List InfiniBand devices available for use from userspace.
       
   450  
       
   451 +On SR-IOV capable systems, if a domain is configured with
       
   452 +VFs (Virtual Function), ibv_devices lists for each IB device
       
   453 +the node GUID and the type (PF or VF).  In this case, the PF
       
   454 +devices are displayed before the VF devices.  The following
       
   455 +shows the results of running ibv_devices on a domain with
       
   456 +one PF and two VFs:
       
   457 +
       
   458 +    device                 node GUID            type
       
   459 +    ------              ----------------        ----
       
   460 +    mlx4_2              00212800013f3126         PF
       
   461 +    mlx4_0              00212d00013f3126         VF
       
   462 +    mlx4_1              00212900013f3126         VF
       
   463 +
       
   464 +If all of the IB devices are PFs, only node GUIDs are
       
   465 +listed.  The following shows the results of running
       
   466 +ibv_devices on a domain with one PF and no VFs:
       
   467 +
       
   468 +    device                 node GUID
       
   469 +    ------              ----------------
       
   470 +    mlx4_0              00212800013f3126
       
   471 +
       
   472 +On systems which are not SR-IOV capable only node GUIDs are
       
   473 +listed.
       
   474 +
       
   475 +    device                 node GUID
       
   476 +    ------              ----------------
       
   477 +    mlx4_0              0021280001a0e4d8
       
   478 +    mlx4_1              0021280001a0e754
       
   479 +
       
   480  .SH SEE ALSO
       
   481  .BR ibv_devinfo (1)
       
   482  
       
   483 diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_create_qp.3 libibverbs-1.1.4/man/ibv_create_qp.3
       
   484 --- /tmp/846623/libibverbs-1.1.4/man/ibv_create_qp.3	Thu Mar 10 06:58:21 2011
       
   485 +++ libibverbs-1.1.4/man/ibv_create_qp.3	Tue May  3 13:50:06 2011
       
   486 @@ -28,7 +28,7 @@
       
   487  struct ibv_cq          *recv_cq;        /* CQ to be associated with the Receive Queue (RQ) */
       
   488  struct ibv_srq         *srq;            /* SRQ handle if QP is to be associated with an SRQ, otherwise NULL */
       
   489  struct ibv_qp_cap       cap;            /* QP capabilities */
       
   490 -enum ibv_qp_type        qp_type;        /* QP Transport Service Type: IBV_QPT_RC, IBV_QPT_UC, IBV_QPT_UD, IBV_QPT_XRC or IBV_QPT_RAW_PACKET */
       
   491 +enum ibv_qp_type        qp_type;        /* QP Transport Service Type: IBV_QPT_RC, IBV_QPT_UC, IBV_QPT_UD, IBV_QPT_XRC */
       
   492  int                     sq_sig_all;     /* If set, each Work Request (WR) submitted to the SQ generates a completion entry */
       
   493  struct ibv_xrc_domain  *xrc_domain;     /* XRC domain the QP will be associated with (valid only for IBV_QPT_XRC QP), otherwise NULL */
       
   494  .in -8
       
   495 diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_create_ah_from_wc.3 libibverbs-1.1.4/man/ibv_create_ah_from_wc.3
       
   496 --- /tmp/846623/libibverbs-1.1.4/man/ibv_create_ah_from_wc.3	Thu Mar 10 04:51:46 2011
       
   497 +++ libibverbs-1.1.4/man/ibv_create_ah_from_wc.3	Mon Mar 28 03:11:45 2011
       
   498 @@ -21,7 +21,7 @@
       
   499  .B ibv_init_ah_from_wc()
       
   500  initializes the address handle (AH) attribute structure
       
   501  .I ah_attr
       
   502 -for the RDMA device context
       
   503 +for the InfiniBand device context
       
   504  .I context
       
   505  using the port number
       
   506  .I port_num\fR,
       
   507 diff -r -u /tmp/846623/libibverbs-1.1.4/src/kern_abi.h libibverbs-1.1.4/src/kern_abi.h
       
   508 --- /tmp/846623/libibverbs-1.1.4/src/kern_abi.h	Wed Sep 16 04:27:22 2009
       
   509 +++ libibverbs-1.1.4/src/kern_abi.h	Fri Feb 11 04:02:32 2011
       
   510 @@ -33,7 +33,11 @@
       
   511  #ifndef KERN_ABI_H
       
   512  #define KERN_ABI_H
       
   513  
       
   514 +#if !(defined(__SVR4) && defined(__sun))
       
   515  #include <linux/types.h>
       
   516 +#else
       
   517 +#include <infiniband/ofa_solaris.h>
       
   518 +#endif
       
   519  
       
   520  /*
       
   521   * Increment this value if any changes that break userspace ABI
       
   522 @@ -47,7 +51,10 @@
       
   523  	IB_USER_VERBS_CMD_ALLOC_PD,
       
   524  	IB_USER_VERBS_CMD_DEALLOC_PD,
       
   525  	IB_USER_VERBS_CMD_REG_MR,
       
   526 -	IB_USER_VERBS_CMD_DEREG_MR
       
   527 +	IB_USER_VERBS_CMD_DEREG_MR,
       
   528 +	IB_USER_VERBS_CMD_REG_MR_RELAXED,
       
   529 +	IB_USER_VERBS_CMD_DEREG_MR_RELAXED,
       
   530 +	IB_USER_VERBS_CMD_FLUSH_RELAXED_MR
       
   531  };
       
   532  
       
   533  /*
       
   534 diff -r -u /tmp/846623/libibverbs-1.1.4/src/verbs.c libibverbs-1.1.4/src/verbs.c
       
   535 --- /tmp/846623/libibverbs-1.1.4/src/verbs.c	Thu Feb  3 01:53:17 2011
       
   536 +++ libibverbs-1.1.4/src/verbs.c	Fri Feb 11 04:02:33 2011
       
   537 @@ -41,9 +41,24 @@
       
   538  #include <stdlib.h>
       
   539  #include <errno.h>
       
   540  #include <string.h>
       
   541 +#if defined(__SVR4) && defined(__sun)
       
   542 +#include <fcntl.h>
       
   543 +#include <sys/stat.h>
       
   544 +#include <sys/mkdev.h>
       
   545 +#endif
       
   546  
       
   547  #include "ibverbs.h"
       
   548  
       
   549 +#define	IBV_IS_VALID_UGID(gid)	\
       
   550 +	(gid->raw[0] != 0xff)
       
   551 +
       
   552 +#define	IBV_IS_VALID_MGID(gid)					\
       
   553 +	((gids->raw[0] == 0xff) &&				\
       
   554 +	((gids->raw[1] == 0x0e) || (gids->raw[1] == 0x02) ||	\
       
   555 +	(gids->raw[1] == 0x05)  || (gids->raw[1] == 0x08) ||	\
       
   556 +	(gids->raw[1] == 0x1e)  || (gids->raw[1] == 0x12) ||	\
       
   557 +	(gids->raw[1] == 0x15)  || (gids->raw[1] == 0x18)))
       
   558 +
       
   559  int ibv_rate_to_mult(enum ibv_rate rate)
       
   560  {
       
   561  	switch (rate) {
       
   562 @@ -76,6 +91,54 @@
       
   563  	}
       
   564  }
       
   565  
       
   566 +int ibv_rate_to_mbps(enum ibv_rate rate)
       
   567 +{
       
   568 +	switch (rate) {
       
   569 +	case IBV_RATE_2_5_GBPS: return 2500;
       
   570 +	case IBV_RATE_5_GBPS:   return 5000;
       
   571 +	case IBV_RATE_10_GBPS:  return 10000;
       
   572 +	case IBV_RATE_20_GBPS:  return 20000;
       
   573 +	case IBV_RATE_30_GBPS:  return 30000;
       
   574 +	case IBV_RATE_40_GBPS:  return 40000;
       
   575 +	case IBV_RATE_60_GBPS:  return 60000;
       
   576 +	case IBV_RATE_80_GBPS:  return 80000;
       
   577 +	case IBV_RATE_120_GBPS: return 120000;
       
   578 +	case IBV_RATE_14_GBPS:  return 14062;
       
   579 +	case IBV_RATE_56_GBPS:  return 56250;
       
   580 +	case IBV_RATE_112_GBPS: return 112500;
       
   581 +	case IBV_RATE_168_GBPS: return 168750;
       
   582 +	case IBV_RATE_25_GBPS:  return 25781;
       
   583 +	case IBV_RATE_100_GBPS: return 103125;
       
   584 +	case IBV_RATE_200_GBPS: return 206250;
       
   585 +	case IBV_RATE_300_GBPS: return 309375;
       
   586 +	default:               return -1;
       
   587 +	}
       
   588 +}
       
   589 +
       
   590 +enum ibv_rate mbps_to_ibv_rate(int mbps)
       
   591 +{
       
   592 +	switch (mbps) {
       
   593 +	case 2500:   return IBV_RATE_2_5_GBPS;
       
   594 +	case 5000:   return IBV_RATE_5_GBPS;
       
   595 +	case 10000:  return IBV_RATE_10_GBPS;
       
   596 +	case 20000:  return IBV_RATE_20_GBPS;
       
   597 +	case 30000:  return IBV_RATE_30_GBPS;
       
   598 +	case 40000:  return IBV_RATE_40_GBPS;
       
   599 +	case 60000:  return IBV_RATE_60_GBPS;
       
   600 +	case 80000:  return IBV_RATE_80_GBPS;
       
   601 +	case 120000: return IBV_RATE_120_GBPS;
       
   602 +	case 14062:  return IBV_RATE_14_GBPS;
       
   603 +	case 56250:  return IBV_RATE_56_GBPS;
       
   604 +	case 112500: return IBV_RATE_112_GBPS;
       
   605 +	case 168750: return IBV_RATE_168_GBPS;
       
   606 +	case 25781:  return IBV_RATE_25_GBPS;
       
   607 +	case 103125: return IBV_RATE_100_GBPS;
       
   608 +	case 206250: return IBV_RATE_200_GBPS;
       
   609 +	case 309375: return IBV_RATE_300_GBPS;
       
   610 +	default:     return IBV_RATE_MAX;
       
   611 +	}
       
   612 +}
       
   613 +
       
   614  int __ibv_query_device(struct ibv_context *context,
       
   615  		       struct ibv_device_attr *device_attr)
       
   616  {
       
   617 @@ -93,6 +156,12 @@
       
   618  int __ibv_query_gid(struct ibv_context *context, uint8_t port_num,
       
   619  		    int index, union ibv_gid *gid)
       
   620  {
       
   621 +#if defined(__SVR4) && defined(__sun)
       
   622 +	extern int sol_ibv_query_gid();
       
   623 +
       
   624 +	return sol_ibv_query_gid(context, port_num, index, gid);
       
   625 +
       
   626 +#else
       
   627  	char name[24];
       
   628  	char attr[41];
       
   629  	uint16_t val;
       
   630 @@ -112,6 +181,7 @@
       
   631  	}
       
   632  
       
   633  	return 0;
       
   634 +#endif
       
   635  }
       
   636  default_symver(__ibv_query_gid, ibv_query_gid);
       
   637  
       
   638 @@ -118,6 +188,12 @@
       
   639  int __ibv_query_pkey(struct ibv_context *context, uint8_t port_num,
       
   640  		     int index, uint16_t *pkey)
       
   641  {
       
   642 +#if defined(__SVR4) && defined(__sun)
       
   643 +	extern int sol_ibv_query_pkey();
       
   644 +
       
   645 +	return sol_ibv_query_pkey(context, port_num, index, pkey);
       
   646 +
       
   647 +#else
       
   648  	char name[24];
       
   649  	char attr[8];
       
   650  	uint16_t val;
       
   651 @@ -133,9 +209,159 @@
       
   652  
       
   653  	*pkey = htons(val);
       
   654  	return 0;
       
   655 +#endif
       
   656  }
       
   657  default_symver(__ibv_query_pkey, ibv_query_pkey);
       
   658  
       
   659 +int ibv_register_sm_events(struct ibv_context *context,
       
   660 +    ibv_sm_event_type_t event, uint_t gid_num, union ibv_gid *gids)
       
   661 +{
       
   662 +	struct ibv_reg_sm_event		*cmd;
       
   663 +	int				cmd_size, data_size;
       
   664 +	void				*data_p;
       
   665 +
       
   666 +	if (((gid_num > 0) && (gids == NULL)) ||
       
   667 +	   ((gid_num == 0) && (gids != NULL))) {
       
   668 +		errno = EINVAL;
       
   669 +		return (-1);
       
   670 +	}
       
   671 +
       
   672 +	if ((event != IBV_SM_EVENT_UGID) && (event != IBV_SM_EVENT_UGID_ALL) &&
       
   673 +	    (event != IBV_SM_EVENT_MGID) && (event != IBV_SM_EVENT_MGID_ALL) &&
       
   674 +	    (event != IBV_SM_EVENT_ALL)) {
       
   675 +		errno = EINVAL;
       
   676 +		return (-1);
       
   677 +	}
       
   678 +
       
   679 +	if (((event == IBV_SM_EVENT_UGID) || (event == IBV_SM_EVENT_MGID)) &&
       
   680 +	    (gid_num == 0)) {
       
   681 +		errno = EINVAL;
       
   682 +		return (-1);
       
   683 +	}
       
   684 +
       
   685 +	if (((event == IBV_SM_EVENT_UGID_ALL) ||
       
   686 +	    (event == IBV_SM_EVENT_MGID_ALL) || (event == IBV_SM_EVENT_ALL)) &&
       
   687 +	    (gid_num != 0)) {
       
   688 +		errno = EINVAL;
       
   689 +		return (-1);
       
   690 +	}
       
   691 +
       
   692 +	data_size = gid_num * (sizeof (union ibv_gid));
       
   693 +	cmd_size = (sizeof (struct ibv_reg_sm_event)) + data_size;
       
   694 +	data_p = (void *)gids;
       
   695 +	cmd  = alloca(cmd_size);
       
   696 +	cmd->data_num = gid_num;
       
   697 +
       
   698 +	if ((event == IBV_SM_EVENT_UGID) && (!IBV_IS_VALID_UGID(gids))) { 
       
   699 +		errno = EINVAL;
       
   700 +		return (-1);
       
   701 +	}
       
   702 +
       
   703 +	if ((event == IBV_SM_EVENT_MGID) && (!IBV_IS_VALID_MGID(gids))) { 
       
   704 +		errno = EINVAL;
       
   705 +		return (-1);
       
   706 +	}
       
   707 +
       
   708 +	IBV_INIT_CMD(cmd, cmd_size, REG_SM_EVENT);
       
   709 +
       
   710 +	cmd->events = event;
       
   711 +	if (gid_num > 0)
       
   712 +		memcpy(cmd->driver_data, data_p, data_size);
       
   713 +
       
   714 +	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size) {
       
   715 +		errno = EINVAL;
       
   716 +		return (-1);
       
   717 +	}
       
   718 +
       
   719 +	return (0);
       
   720 +}
       
   721 +
       
   722 +int ibv_unregister_sm_events(struct ibv_context *context,
       
   723 +    ibv_sm_event_type_t event, uint_t gid_num, union ibv_gid *gids)
       
   724 +{
       
   725 +	struct ibv_unreg_sm_event	*cmd;
       
   726 +	int				cmd_size, data_size;
       
   727 +	void				*data_p;
       
   728 +
       
   729 +	if (((gid_num > 0) && (gids == NULL)) ||
       
   730 +	   ((gid_num == 0) && (gids != NULL))) {
       
   731 +		errno = EINVAL;
       
   732 +		return (-1);
       
   733 +	}
       
   734 +
       
   735 +	if ((event != IBV_SM_EVENT_UGID) && (event != IBV_SM_EVENT_UGID_ALL) &&
       
   736 +	    (event != IBV_SM_EVENT_MGID) && (event != IBV_SM_EVENT_MGID_ALL) &&
       
   737 +	    (event != IBV_SM_EVENT_ALL)) {
       
   738 +		errno = EINVAL;
       
   739 +		return (-1);
       
   740 +	}
       
   741 +
       
   742 +	if (((event == IBV_SM_EVENT_UGID) || (event == IBV_SM_EVENT_MGID)) &&
       
   743 +	    (gid_num == 0)) {
       
   744 +		errno = EINVAL;
       
   745 +		return (-1);
       
   746 +	}
       
   747 +
       
   748 +	if (((event == IBV_SM_EVENT_UGID_ALL) ||
       
   749 +	    (event == IBV_SM_EVENT_MGID_ALL) || (event == IBV_SM_EVENT_ALL)) &&
       
   750 +	    (gid_num != 0)) {
       
   751 +		errno = EINVAL;
       
   752 +		return (-1);
       
   753 +	}
       
   754 +
       
   755 +	data_size = gid_num*(sizeof (union ibv_gid));
       
   756 +	cmd_size = (sizeof (struct ibv_unreg_sm_event)) + data_size;
       
   757 +	data_p = (void *)gids;
       
   758 +	cmd  = alloca(cmd_size);
       
   759 +	cmd->data_num = gid_num;
       
   760 +
       
   761 +	if ((event == IBV_SM_EVENT_UGID) && (!IBV_IS_VALID_UGID(gids))) { 
       
   762 +		errno = EINVAL;
       
   763 +		return (-1);
       
   764 +	}
       
   765 +
       
   766 +	if ((event == IBV_SM_EVENT_MGID) && (!IBV_IS_VALID_MGID(gids))) { 
       
   767 +		errno = EINVAL;
       
   768 +		return (-1);
       
   769 +	}
       
   770 +
       
   771 +	IBV_INIT_CMD(cmd, cmd_size, UNREG_SM_EVENT);
       
   772 +
       
   773 +	cmd->events = event;
       
   774 +	if (gid_num > 0)
       
   775 +		memcpy(cmd->driver_data, data_p, data_size);
       
   776 +
       
   777 +	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size) {
       
   778 +		errno = EINVAL;
       
   779 +		return (-1);
       
   780 +	}
       
   781 +
       
   782 +	return (0);
       
   783 +}
       
   784 +
       
   785 +int ibv_gid_reachable(struct ibv_context *context,
       
   786 +    uint_t port, union ibv_gid *gid_p, int timeout)
       
   787 +{
       
   788 +	struct ibv_gid_reachable	*cmd;
       
   789 +	int				rc;
       
   790 +
       
   791 +	cmd = alloca((sizeof (struct ibv_gid_reachable)));
       
   792 +	cmd->port_num = port;
       
   793 +	cmd->timeout = timeout;
       
   794 +
       
   795 +	IBV_INIT_CMD(cmd, sizeof (struct ibv_gid_reachable),
       
   796 +	    GID_REACHABLE);
       
   797 +
       
   798 +	memcpy(cmd->gid, gid_p, sizeof (*gid_p));
       
   799 +
       
   800 +	rc = write(context->cmd_fd, cmd, sizeof(struct ibv_gid_reachable));
       
   801 +	if (rc < 0) {
       
   802 +		return (-1);
       
   803 +	}
       
   804 +
       
   805 +	return (0);
       
   806 +}
       
   807 +
       
   808  struct ibv_pd *__ibv_alloc_pd(struct ibv_context *context)
       
   809  {
       
   810  	struct ibv_pd *pd;
       
   811 @@ -148,6 +374,27 @@
       
   812  }
       
   813  default_symver(__ibv_alloc_pd, ibv_alloc_pd);
       
   814  
       
   815 +struct ibv_shpd *__ibv_alloc_shpd(struct ibv_pd *pd, uint64_t share_key, struct ibv_shpd *shpd)
       
   816 +{
       
   817 +
       
   818 +	shpd = pd->context->ops.alloc_shpd(pd, share_key, shpd);
       
   819 +
       
   820 +	return shpd;
       
   821 +}
       
   822 +default_symver(__ibv_alloc_shpd, ibv_alloc_shpd);
       
   823 +
       
   824 +struct ibv_pd *__ibv_share_pd(struct ibv_context *context, struct ibv_shpd *shpd, uint64_t share_key)
       
   825 +{
       
   826 +	struct ibv_pd *pd;
       
   827 +
       
   828 +	pd = context->ops.share_pd(context, shpd, share_key);
       
   829 +	if (pd)
       
   830 +		pd->context = context;
       
   831 +
       
   832 +	return pd;
       
   833 +}
       
   834 +default_symver(__ibv_share_pd, ibv_share_pd);
       
   835 +
       
   836  int __ibv_dealloc_pd(struct ibv_pd *pd)
       
   837  {
       
   838  	return pd->context->ops.dealloc_pd(pd);
       
   839 @@ -175,6 +422,27 @@
       
   840  }
       
   841  default_symver(__ibv_reg_mr, ibv_reg_mr);
       
   842  
       
   843 +struct ibv_mr *__ibv_reg_mr_relaxed(struct ibv_pd *pd, void *addr,
       
   844 +			    size_t length, int access)
       
   845 +{
       
   846 +	struct ibv_mr *mr;
       
   847 +
       
   848 +	if (ibv_dontfork_range(addr, length))
       
   849 +		return NULL;
       
   850 +
       
   851 +	mr = pd->context->ops.reg_mr_relaxed(pd, addr, length, access);
       
   852 +	if (mr) {
       
   853 +		mr->context = pd->context;
       
   854 +		mr->pd      = pd;
       
   855 +		mr->addr    = addr;
       
   856 +		mr->length  = length;
       
   857 +	} else
       
   858 +		ibv_dofork_range(addr, length);
       
   859 +
       
   860 +	return mr;
       
   861 +}
       
   862 +default_symver(__ibv_reg_mr_relaxed, ibv_reg_mr_relaxed);
       
   863 +
       
   864  int __ibv_dereg_mr(struct ibv_mr *mr)
       
   865  {
       
   866  	int ret;
       
   867 @@ -189,6 +457,26 @@
       
   868  }
       
   869  default_symver(__ibv_dereg_mr, ibv_dereg_mr);
       
   870  
       
   871 +int __ibv_dereg_mr_relaxed(struct ibv_mr *mr)
       
   872 +{
       
   873 +	int ret;
       
   874 +	void *addr	= mr->addr;
       
   875 +	size_t length	= mr->length;
       
   876 +
       
   877 +	ret = mr->context->ops.dereg_mr_relaxed(mr);
       
   878 +	if (!ret)
       
   879 +		ibv_dofork_range(addr, length);
       
   880 +
       
   881 +	return ret;
       
   882 +}
       
   883 +default_symver(__ibv_dereg_mr_relaxed, ibv_dereg_mr_relaxed);
       
   884 +
       
   885 +int __ibv_flush_relaxed_mr(struct ibv_pd *pd)
       
   886 +{
       
   887 +	return pd->context->ops.flush_relaxed_mr(pd);
       
   888 +}
       
   889 +default_symver(__ibv_flush_relaxed_mr, ibv_flush_relaxed_mr);
       
   890 +
       
   891  static struct ibv_comp_channel *ibv_create_comp_channel_v2(struct ibv_context *context)
       
   892  {
       
   893  	struct ibv_abi_compat_v2 *t = context->abi_compat;
       
   894 @@ -212,6 +500,10 @@
       
   895  	struct ibv_comp_channel            *channel;
       
   896  	struct ibv_create_comp_channel      cmd;
       
   897  	struct ibv_create_comp_channel_resp resp;
       
   898 +#if defined(__SVR4) && defined(__sun)
       
   899 +	int		event_fd;
       
   900 +	struct stat	fstat_buf;
       
   901 +#endif
       
   902  
       
   903  	if (abi_ver <= 2)
       
   904  		return ibv_create_comp_channel_v2(context);
       
   905 @@ -221,7 +513,23 @@
       
   906  		return NULL;
       
   907  
       
   908  	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, CREATE_COMP_CHANNEL, &resp, sizeof resp);
       
   909 +#if defined(__SVR4) && defined(__sun)
       
   910 +	event_fd = open("/dev/infiniband/ofs/uverbs:event", O_RDWR);
       
   911 +	if (event_fd < 0) {
       
   912 +		free(channel);
       
   913 +		return NULL;
       
   914 +	}
       
   915 +
       
   916 +	if (fstat(event_fd, &fstat_buf)) {
       
   917 +		free(channel);
       
   918 +		return NULL;
       
   919 +	}
       
   920 +	resp.fd = minor(fstat_buf.st_rdev);
       
   921 +#endif
       
   922  	if (write(context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd) {
       
   923 +#if defined(__SVR4) && defined(__sun)
       
   924 +		close(event_fd);
       
   925 +#endif
       
   926  		free(channel);
       
   927  		return NULL;
       
   928  	}
       
   929 @@ -228,6 +536,9 @@
       
   930  
       
   931  	VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
       
   932  
       
   933 +#if defined(__SVR4) && defined(__sun)
       
   934 +	resp.fd = event_fd;
       
   935 +#endif
       
   936  	channel->context = context;
       
   937  	channel->fd      = resp.fd;
       
   938  	channel->refcnt  = 0;
       
   939 diff -r -u /tmp/846623/libibverbs-1.1.4/src/device.c libibverbs-1.1.4/src/device.c
       
   940 --- /tmp/846623/libibverbs-1.1.4/src/device.c	Thu Feb  3 01:53:17 2011
       
   941 +++ libibverbs-1.1.4/src/device.c	Fri Feb 11 04:02:31 2011
       
   942 @@ -122,6 +122,28 @@
       
   943  }
       
   944  default_symver(__ibv_get_device_guid, ibv_get_device_guid);
       
   945  
       
   946 +uint64_t __ibv_get_device_guid_external(struct ibv_device *device)
       
   947 +{
       
   948 +	char attr[24];
       
   949 +	uint64_t guid = 0;
       
   950 +	uint16_t parts[4];
       
   951 +	int i;
       
   952 +
       
   953 +	if (ibv_read_sysfs_file(device->ibdev_path, "node_guid_external",
       
   954 +				attr, sizeof attr) < 0)
       
   955 +		return 0;
       
   956 +
       
   957 +	if (sscanf(attr, "%hx:%hx:%hx:%hx",
       
   958 +		   parts, parts + 1, parts + 2, parts + 3) != 4)
       
   959 +		return 0;
       
   960 +
       
   961 +	for (i = 0; i < 4; ++i)
       
   962 +		guid = (guid << 16) | parts[i];
       
   963 +
       
   964 +	return htonll(guid);
       
   965 +}
       
   966 +default_symver(__ibv_get_device_guid_external, ibv_get_device_guid_external);
       
   967 +
       
   968  struct ibv_context *__ibv_open_device(struct ibv_device *device)
       
   969  {
       
   970  	char *devpath;
       
   971 @@ -128,8 +150,13 @@
       
   972  	int cmd_fd;
       
   973  	struct ibv_context *context;
       
   974  
       
   975 +#if !(defined(__SVR4) && defined(__sun))
       
   976  	if (asprintf(&devpath, "/dev/infiniband/%s", device->dev_name) < 0)
       
   977  		return NULL;
       
   978 +#else
       
   979 +	if (asprintf(&devpath, "/dev/infiniband/ofs/%s", device->dev_name) < 0)
       
   980 +		return NULL;
       
   981 +#endif		
       
   982  
       
   983  	/*
       
   984  	 * We'll only be doing writes, but we need O_RDWR in case the
       
   985 @@ -141,6 +168,15 @@
       
   986  	if (cmd_fd < 0)
       
   987  		return NULL;
       
   988  
       
   989 +#if defined(__SVR4) && defined(__sun)
       
   990 +	/* We don't support parent-child sharing of IB resources on Solaris */
       
   991 +	if (fcntl(cmd_fd, F_SETFD, FD_CLOEXEC) < 0) {
       
   992 +		fprintf(stderr, "ibv_open_device: FD_CLOEXEC failed: %s\n",
       
   993 +		    strerror(errno));
       
   994 +		goto err;
       
   995 +	}
       
   996 +#endif
       
   997 +
       
   998  	context = device->ops.alloc_context(device, cmd_fd);
       
   999  	if (!context)
       
  1000  		goto err;
       
  1001 @@ -163,6 +199,9 @@
       
  1002  	int async_fd = context->async_fd;
       
  1003  	int cmd_fd   = context->cmd_fd;
       
  1004  	int cq_fd    = -1;
       
  1005 +#if defined(__SVR4) && defined(__sun)
       
  1006 +	int mmap_fd   = context->mmap_fd;
       
  1007 +#endif
       
  1008  
       
  1009  	if (abi_ver <= 2) {
       
  1010  		struct ibv_abi_compat_v2 *t = context->abi_compat;
       
  1011 @@ -172,6 +211,11 @@
       
  1012  
       
  1013  	context->device->ops.free_context(context);
       
  1014  
       
  1015 +#if defined(__SVR4) && defined(__sun)
       
  1016 +	if (mmap_fd > 0) {
       
  1017 +		close(mmap_fd);
       
  1018 +	}
       
  1019 +#endif
       
  1020  	close(async_fd);
       
  1021  	close(cmd_fd);
       
  1022  	if (abi_ver <= 2)
       
  1023 @@ -214,6 +258,15 @@
       
  1024  		case IBV_EVENT_SRQ_LIMIT_REACHED:
       
  1025  			event->element.srq = (void *) (uintptr_t) ev.element;
       
  1026  			break;
       
  1027 +		case IBV_EVENT_GID_AVAIL:
       
  1028 +		case IBV_EVENT_GID_UNAVAIL:
       
  1029 +		case IBV_EVENT_MCG_CREATED:
       
  1030 +		case IBV_EVENT_MCG_DELETED:
       
  1031 +			event->element.gid.global.subnet_prefix
       
  1032 +			    = ev.subnet_prefix;
       
  1033 +                        event->element.gid.global.interface_id
       
  1034 +			    = ev.interface_id;
       
  1035 +			break;
       
  1036  		default:
       
  1037  			event->element.port_num = ev.element;
       
  1038  			break;
       
  1039 diff -r -u /tmp/846623/libibverbs-1.1.4/src/ibverbs.h libibverbs-1.1.4/src/ibverbs.h
       
  1040 --- /tmp/846623/libibverbs-1.1.4/src/ibverbs.h	Wed Sep 16 04:27:22 2009
       
  1041 +++ libibverbs-1.1.4/src/ibverbs.h	Fri Feb 11 04:02:31 2011
       
  1042 @@ -52,7 +52,12 @@
       
  1043  #  define VALGRIND_MAKE_MEM_DEFINED(addr, len)
       
  1044  #endif
       
  1045  
       
  1046 -#define HIDDEN		__attribute__((visibility ("hidden")))
       
  1047 +#if defined(__SVR4) && defined(__sun)
       
  1048 +#define	HIDDEN
       
  1049 +#undef HAVE_SYMVER_SUPPORT
       
  1050 +#else
       
  1051 +#define	HIDDEN		__attribute__((visibility ("hidden")))
       
  1052 +#endif
       
  1053  
       
  1054  #define INIT		__attribute__((constructor))
       
  1055  #define FINI		__attribute__((destructor))
       
  1056 diff -r -u /tmp/846623/libibverbs-1.1.4/src/libibverbs.map libibverbs-1.1.4/src/libibverbs.map
       
  1057 --- /tmp/846623/libibverbs-1.1.4/src/libibverbs.map	Thu Mar 10 06:58:21 2011
       
  1058 +++ libibverbs-1.1.4/src/libibverbs.map	Mon Mar 28 13:44:44 2011
       
  1059 @@ -12,10 +12,18 @@
       
  1060  		ibv_query_port;
       
  1061  		ibv_query_gid;
       
  1062  		ibv_query_pkey;
       
  1063 +		ibv_register_sm_events;
       
  1064 +		ibv_unregister_sm_events;
       
  1065 +		ibv__gid_reachable;
       
  1066  		ibv_alloc_pd;
       
  1067 +		ibv_alloc_shpd;
       
  1068 +		ibv_share_pd;
       
  1069  		ibv_dealloc_pd;
       
  1070  		ibv_reg_mr;
       
  1071 +		ibv_reg_mr_relaxed;
       
  1072  		ibv_dereg_mr;
       
  1073 +		ibv_dereg_mr_relaxed;
       
  1074 +		ibv_flush_relaxed_mr;
       
  1075  		ibv_create_comp_channel;
       
  1076  		ibv_destroy_comp_channel;
       
  1077  		ibv_create_cq;
       
  1078 @@ -41,9 +49,14 @@
       
  1079  		ibv_cmd_query_gid;
       
  1080  		ibv_cmd_query_pkey;
       
  1081  		ibv_cmd_alloc_pd;
       
  1082 +		ibv_cmd_alloc_shpd;
       
  1083 +		ibv_cmd_share_pd;
       
  1084  		ibv_cmd_dealloc_pd;
       
  1085  		ibv_cmd_reg_mr;
       
  1086 +		ibv_cmd_reg_mr_relaxed;
       
  1087  		ibv_cmd_dereg_mr;
       
  1088 +		ibv_cmd_dereg_mr_relaxed;
       
  1089 +		ibv_cmd_flush_relaxed_mr;
       
  1090  		ibv_cmd_create_cq;
       
  1091  		ibv_cmd_poll_cq;
       
  1092  		ibv_cmd_req_notify_cq;
       
  1093 @@ -71,6 +84,7 @@
       
  1094  		mult_to_ibv_rate;
       
  1095  		ibv_get_sysfs_path;
       
  1096  		ibv_read_sysfs_file;
       
  1097 +		sol_get_cpu_info;
       
  1098  
       
  1099  	local: *;
       
  1100  };
       
  1101 diff -r -u /tmp/846623/libibverbs-1.1.4/src/cmd.c libibverbs-1.1.4/src/cmd.c
       
  1102 --- /tmp/846623/libibverbs-1.1.4/src/cmd.c	Thu Feb  3 01:53:17 2011
       
  1103 +++ libibverbs-1.1.4/src/cmd.c	Fri Feb 11 04:02:31 2011
       
  1104 @@ -42,9 +42,34 @@
       
  1105  #include <errno.h>
       
  1106  #include <alloca.h>
       
  1107  #include <string.h>
       
  1108 +#if defined(__SVR4) && defined(__sun)
       
  1109 +#include <fcntl.h>
       
  1110 +#include <sys/stat.h>
       
  1111 +#include <sys/mkdev.h>
       
  1112 +#endif
       
  1113  
       
  1114  #include "ibverbs.h"
       
  1115  
       
  1116 +#if defined(__SVR4) && defined(__sun)
       
  1117 +extern int ibv_open_mmap_driver(char *dev_name);
       
  1118 +
       
  1119 +/*
       
  1120 + * Event file creation for GET_CONTEXT & CREATE_COMP_CHANNEL :
       
  1121 + * 	Solaris Uverbs driver supports creation of event file
       
  1122 + * 	from the open(2) system call only. Event file will not
       
  1123 + * 	be created by the write(2) syscall, for the above commands
       
  1124 + *	as in Linux OFED.
       
  1125 + *
       
  1126 + * Sequence of operations for GET_CONTEXT &  CREATE_COMP_CHANNEL :
       
  1127 + *	event_fd = open(UVERBS_EVENT_FILE, O_RDWR);
       
  1128 + *	fstat(event_fd, &fstat_buf);
       
  1129 + *	NOTE : Minor number of event file passed to driver 
       
  1130 + *	cmd.resp.fd = minor(fstat_buf.st_rdev);
       
  1131 + *	write(verbs_fd);
       
  1132 + *	NOTE : Initialize the fd to one got by opening event file
       
  1133 + *	cmd.resp.fd = event_fd;
       
  1134 + */
       
  1135 +#endif
       
  1136  static int ibv_cmd_get_context_v2(struct ibv_context *context,
       
  1137  				  struct ibv_get_context *new_cmd,
       
  1138  				  size_t new_cmd_size,
       
  1139 @@ -55,6 +80,10 @@
       
  1140  	struct ibv_get_context_v2 *cmd;
       
  1141  	size_t cmd_size;
       
  1142  	uint32_t cq_fd;
       
  1143 +#if defined(__SVR4) && defined(__sun)
       
  1144 +	int			event_fd;
       
  1145 +	struct stat		fstat_buf;
       
  1146 +#endif
       
  1147  
       
  1148  	t = malloc(sizeof *t);
       
  1149  	if (!t)
       
  1150 @@ -67,12 +96,45 @@
       
  1151  
       
  1152  	IBV_INIT_CMD_RESP(cmd, cmd_size, GET_CONTEXT, resp, resp_size);
       
  1153  	cmd->cq_fd_tab = (uintptr_t) &cq_fd;
       
  1154 +#if defined(__SVR4) && defined(__sun)
       
  1155 +	event_fd = open("/dev/infiniband/ofs/uverbs:event", O_RDWR);
       
  1156 +	if (event_fd < 0)
       
  1157 +		return (errno);	
       
  1158 +	if (fstat(event_fd, &fstat_buf))
       
  1159 +		return (errno);
       
  1160 +	resp->async_fd = minor(fstat_buf.st_rdev);
       
  1161  
       
  1162 +	/*
       
  1163 +	 * Open the underlying kernel hardware driver that will
       
  1164 +	 * provide the mmap function for this context.
       
  1165 +	 */
       
  1166 +	context->mmap_fd = ibv_open_mmap_driver(context->device->dev_name);
       
  1167 +	if (context->mmap_fd < 0) {
       
  1168 +		fprintf(stderr, PFX "ibv_cmd_get_context: Mmap open failed\n");
       
  1169 +	}
       
  1170 +#endif
       
  1171 +
       
  1172  	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1173  		return errno;
       
  1174 +#if defined(__SVR4) && defined(__sun)
       
  1175 +	resp->async_fd = event_fd;
       
  1176 +#endif
       
  1177  
       
  1178  	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
       
  1179  
       
  1180 +#if defined(__SVR4) && defined(__sun)
       
  1181 +	/* We don't support parent-child sharing of IB resources on Solaris */
       
  1182 +	if (fcntl(resp->async_fd, F_SETFD, FD_CLOEXEC) < 0) {
       
  1183 +		fprintf(stderr, "ibv_get_context: FD_CLOEXEC failed "
       
  1184 +		    "for async_fd: %s\n", strerror(errno));
       
  1185 +		return errno;
       
  1186 +	}
       
  1187 +	if (fcntl(cq_fd, F_SETFD, FD_CLOEXEC) < 0) {
       
  1188 +		fprintf(stderr, "ibv_get_context: FD_CLOEXEC failed "
       
  1189 +		    "for cq_fd: %s\n", strerror(errno));
       
  1190 +		return errno;
       
  1191 +	}
       
  1192 +#endif
       
  1193  	context->async_fd         = resp->async_fd;
       
  1194  	context->num_comp_vectors = 1;
       
  1195  	t->channel.context        = context;
       
  1196 @@ -87,19 +149,50 @@
       
  1197  			size_t cmd_size, struct ibv_get_context_resp *resp,
       
  1198  			size_t resp_size)
       
  1199  {
       
  1200 +#if defined(__SVR4) && defined(__sun)
       
  1201 +	int			event_fd;
       
  1202 +	struct stat		fstat_buf;
       
  1203 +#endif
       
  1204  	if (abi_ver <= 2)
       
  1205  		return ibv_cmd_get_context_v2(context, cmd, cmd_size, resp, resp_size);
       
  1206  
       
  1207  	IBV_INIT_CMD_RESP(cmd, cmd_size, GET_CONTEXT, resp, resp_size);
       
  1208 +#if defined(__SVR4) && defined(__sun)
       
  1209 +	event_fd = open("/dev/infiniband/ofs/uverbs:event", O_RDWR);
       
  1210 +	if (event_fd < 0)
       
  1211 +		return (errno);	
       
  1212 +	if (fstat(event_fd, &fstat_buf))
       
  1213 +		return (errno);
       
  1214 +	resp->async_fd = minor(fstat_buf.st_rdev);
       
  1215  
       
  1216 +	/*
       
  1217 +	 * Open the underlying kernel hardware driver that will
       
  1218 +	 * provide the mmap function for this context.
       
  1219 +	 */
       
  1220 +	context->mmap_fd = ibv_open_mmap_driver(context->device->dev_name);
       
  1221 +	if (context->mmap_fd < 0) {
       
  1222 +		fprintf(stderr, PFX "ibv_cmd_get_context: Mmap open failed\n");
       
  1223 +	}
       
  1224 +#endif
       
  1225  	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1226  		return errno;
       
  1227 +#if defined(__SVR4) && defined(__sun)
       
  1228 +	resp->async_fd = event_fd;
       
  1229 +#endif
       
  1230  
       
  1231  	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
       
  1232  
       
  1233 +#if defined(__SVR4) && defined(__sun)
       
  1234 +	/* We don't support parent-child sharing of IB resources on Solaris */
       
  1235 +	if (fcntl(resp->async_fd, F_SETFD, FD_CLOEXEC) < 0) {
       
  1236 +		fprintf(stderr, "ibv_get_context: FD_CLOEXEC failed: %s\n",
       
  1237 +		    strerror(errno));
       
  1238 +		return errno;
       
  1239 +	}
       
  1240 +#endif
       
  1241 +
       
  1242  	context->async_fd         = resp->async_fd;
       
  1243  	context->num_comp_vectors = resp->num_comp_vectors;
       
  1244 -
       
  1245  	return 0;
       
  1246  }
       
  1247  
       
  1248 @@ -120,6 +213,7 @@
       
  1249  	memset(device_attr->fw_ver, 0, sizeof device_attr->fw_ver);
       
  1250  	*raw_fw_ver			       = resp.fw_ver;
       
  1251  	device_attr->node_guid 		       = resp.node_guid;
       
  1252 +	device_attr->node_guid_external	       = resp.node_guid_external;
       
  1253  	device_attr->sys_image_guid 	       = resp.sys_image_guid;
       
  1254  	device_attr->max_mr_size 	       = resp.max_mr_size;
       
  1255  	device_attr->page_size_cap 	       = resp.page_size_cap;
       
  1256 @@ -207,6 +301,8 @@
       
  1257  {
       
  1258  	IBV_INIT_CMD_RESP(cmd, cmd_size, ALLOC_PD, resp, resp_size);
       
  1259  
       
  1260 +	cmd->user_handle     = (uintptr_t) pd;
       
  1261 +
       
  1262  	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1263  		return errno;
       
  1264  
       
  1265 @@ -218,6 +314,47 @@
       
  1266  	return 0;
       
  1267  }
       
  1268  
       
  1269 +int ibv_cmd_alloc_shpd(struct ibv_context *context, struct ibv_pd *pd,
       
  1270 +         uint64_t share_key, struct ibv_shpd *shpd,
       
  1271 +		     struct ibv_alloc_shpd *cmd, size_t cmd_size,
       
  1272 +		     struct ibv_alloc_shpd_resp *resp, size_t resp_size)
       
  1273 +{
       
  1274 +	IBV_INIT_CMD_RESP(cmd, cmd_size, ALLOC_SHPD, resp, resp_size);
       
  1275 +        cmd->pd_handle = pd->handle;
       
  1276 +	cmd->user_handle = (uintptr_t) pd;
       
  1277 +	cmd->share_key = share_key;
       
  1278 +
       
  1279 +	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1280 +		return errno;
       
  1281 +
       
  1282 +	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
       
  1283 +
       
  1284 +	shpd->handle  = resp->shpd_handle;
       
  1285 +
       
  1286 +	return 0;
       
  1287 +}
       
  1288 +
       
  1289 +int ibv_cmd_share_pd(struct ibv_context *context, struct ibv_shpd *shpd,
       
  1290 +         uint64_t share_key, struct ibv_pd *pd,
       
  1291 +		     struct ibv_share_pd *cmd, size_t cmd_size,
       
  1292 +		     struct ibv_share_pd_resp *resp, size_t resp_size)
       
  1293 +{
       
  1294 +	IBV_INIT_CMD_RESP(cmd, cmd_size, SHARE_PD, resp, resp_size);
       
  1295 +	cmd->shpd_handle = shpd->handle;
       
  1296 +	cmd->share_key = share_key;
       
  1297 +	cmd->user_handle     = (uintptr_t) pd;
       
  1298 +
       
  1299 +	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1300 +		return errno;
       
  1301 +
       
  1302 +	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
       
  1303 +
       
  1304 +	pd->handle  = resp->pd_handle;
       
  1305 +	pd->context = context;
       
  1306 +
       
  1307 +	return 0;
       
  1308 +}
       
  1309 +
       
  1310  int ibv_cmd_dealloc_pd(struct ibv_pd *pd)
       
  1311  {
       
  1312  	struct ibv_dealloc_pd cmd;
       
  1313 @@ -224,6 +361,7 @@
       
  1314  
       
  1315  	IBV_INIT_CMD(&cmd, sizeof cmd, DEALLOC_PD);
       
  1316  	cmd.pd_handle = pd->handle;
       
  1317 +	cmd.user_handle = (uintptr_t) pd;
       
  1318  
       
  1319  	if (write(pd->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
  1320  		return errno;
       
  1321 @@ -244,6 +382,7 @@
       
  1322  	cmd->length 	  = length;
       
  1323  	cmd->hca_va 	  = hca_va;
       
  1324  	cmd->pd_handle 	  = pd->handle;
       
  1325 +	cmd->user_handle  = (uintptr_t) mr;
       
  1326  	cmd->access_flags = access;
       
  1327  
       
  1328  	if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1329 @@ -259,6 +398,35 @@
       
  1330  	return 0;
       
  1331  }
       
  1332  
       
  1333 +int ibv_cmd_reg_mr_relaxed(struct ibv_pd *pd, void *addr, size_t length,
       
  1334 +		   uint64_t hca_va, int access,
       
  1335 +		   struct ibv_mr *mr, struct ibv_reg_mr *cmd,
       
  1336 +		   size_t cmd_size,
       
  1337 +		   struct ibv_reg_mr_resp *resp, size_t resp_size)
       
  1338 +{
       
  1339 +
       
  1340 +	IBV_INIT_CMD_RESP(cmd, cmd_size, REG_MR_RELAXED, resp, resp_size);
       
  1341 +
       
  1342 +	cmd->start 	  = (uintptr_t) addr;
       
  1343 +	cmd->length 	  = length;
       
  1344 +	cmd->hca_va 	  = hca_va;
       
  1345 +	cmd->pd_handle 	  = pd->handle;
       
  1346 +	cmd->user_handle  = (uintptr_t) mr;
       
  1347 +	cmd->access_flags = access;
       
  1348 +
       
  1349 +	if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1350 +		return errno;
       
  1351 +
       
  1352 +	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
       
  1353 +
       
  1354 +	mr->handle  = resp->mr_handle;
       
  1355 +	mr->lkey    = resp->lkey;
       
  1356 +	mr->rkey    = resp->rkey;
       
  1357 +	mr->context = pd->context;
       
  1358 +
       
  1359 +	return 0;
       
  1360 +}
       
  1361 +
       
  1362  int ibv_cmd_dereg_mr(struct ibv_mr *mr)
       
  1363  {
       
  1364  	struct ibv_dereg_mr cmd;
       
  1365 @@ -265,6 +433,7 @@
       
  1366  
       
  1367  	IBV_INIT_CMD(&cmd, sizeof cmd, DEREG_MR);
       
  1368  	cmd.mr_handle = mr->handle;
       
  1369 +	cmd.user_handle  = (uintptr_t) mr;
       
  1370  
       
  1371  	if (write(mr->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
  1372  		return errno;
       
  1373 @@ -272,6 +441,34 @@
       
  1374  	return 0;
       
  1375  }
       
  1376  
       
  1377 +int ibv_cmd_dereg_mr_relaxed(struct ibv_mr *mr)
       
  1378 +{
       
  1379 +	struct ibv_dereg_mr cmd;
       
  1380 +
       
  1381 +	IBV_INIT_CMD(&cmd, sizeof cmd, DEREG_MR_RELAXED);
       
  1382 +	cmd.mr_handle = mr->handle;
       
  1383 +	cmd.user_handle  = (uintptr_t) mr;
       
  1384 +
       
  1385 +	if (write(mr->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
  1386 +		return errno;
       
  1387 +
       
  1388 +	return 0;
       
  1389 +}
       
  1390 +
       
  1391 +int ibv_cmd_flush_relaxed_mr(struct ibv_pd *pd)
       
  1392 +{
       
  1393 +	struct ibv_flush_relaxed_mr cmd;
       
  1394 +
       
  1395 +	IBV_INIT_CMD(&cmd, sizeof cmd, FLUSH_RELAXED_MR);
       
  1396 +	cmd.pd_handle = pd->handle;
       
  1397 +	cmd.user_handle  = (uintptr_t) pd;
       
  1398 +
       
  1399 +	if (write(pd->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
  1400 +		return errno;
       
  1401 +
       
  1402 +	return 0;
       
  1403 +}
       
  1404 +
       
  1405  static int ibv_cmd_create_cq_v2(struct ibv_context *context, int cqe,
       
  1406  				struct ibv_cq *cq,
       
  1407  				struct ibv_create_cq *new_cmd, size_t new_cmd_size,
       
  1408 @@ -315,7 +512,19 @@
       
  1409  	cmd->user_handle   = (uintptr_t) cq;
       
  1410  	cmd->cqe           = cqe;
       
  1411  	cmd->comp_vector   = comp_vector;
       
  1412 +#if defined(__SVR4) && defined(__sun)
       
  1413 +	if (channel) {
       
  1414 +		struct stat	fstat_buf;
       
  1415 +
       
  1416 +		if (fstat(channel->fd, &fstat_buf))
       
  1417 +			return (errno);
       
  1418 +		else
       
  1419 +			cmd->comp_channel = minor(fstat_buf.st_rdev);
       
  1420 +	} else 
       
  1421 +		cmd->comp_channel = 0;
       
  1422 +#else
       
  1423  	cmd->comp_channel  = channel ? channel->fd : -1;
       
  1424 +#endif
       
  1425  	cmd->reserved      = 0;
       
  1426  
       
  1427  	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1428 @@ -346,6 +555,7 @@
       
  1429  	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, POLL_CQ, resp, rsize);
       
  1430  	cmd.cq_handle = ibcq->handle;
       
  1431  	cmd.ne        = ne;
       
  1432 +	cmd.user_handle  = (uintptr_t) ibcq;
       
  1433  
       
  1434  	if (write(ibcq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd) {
       
  1435  		ret = -1;
       
  1436 @@ -384,6 +594,7 @@
       
  1437  	IBV_INIT_CMD(&cmd, sizeof cmd, REQ_NOTIFY_CQ);
       
  1438  	cmd.cq_handle = ibcq->handle;
       
  1439  	cmd.solicited = !!solicited_only;
       
  1440 +	cmd.user_handle  = (uintptr_t) ibcq;
       
  1441  
       
  1442  	if (write(ibcq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
  1443  		return errno;
       
  1444 @@ -399,6 +610,7 @@
       
  1445  	IBV_INIT_CMD_RESP(cmd, cmd_size, RESIZE_CQ, resp, resp_size);
       
  1446  	cmd->cq_handle = cq->handle;
       
  1447  	cmd->cqe       = cqe;
       
  1448 +	cmd->user_handle   = (uintptr_t) cq;
       
  1449  
       
  1450  	if (write(cq->context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1451  		return errno;
       
  1452 @@ -434,6 +646,7 @@
       
  1453  	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, DESTROY_CQ, &resp, sizeof resp);
       
  1454  	cmd.cq_handle = cq->handle;
       
  1455  	cmd.reserved  = 0;
       
  1456 +	cmd.user_handle  = (uintptr_t) cq;
       
  1457  
       
  1458  	if (write(cq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
  1459  		return errno;
       
  1460 @@ -555,6 +768,7 @@
       
  1461  	cmd->attr_mask	= srq_attr_mask;
       
  1462  	cmd->max_wr	= srq_attr->max_wr;
       
  1463  	cmd->srq_limit	= srq_attr->srq_limit;
       
  1464 +	cmd->user_handle   = (uintptr_t) srq;
       
  1465  
       
  1466  	if (write(srq->context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1467  		return errno;
       
  1468 @@ -569,6 +783,7 @@
       
  1469  
       
  1470  	IBV_INIT_CMD_RESP(cmd, cmd_size, QUERY_SRQ, &resp, sizeof resp);
       
  1471  	cmd->srq_handle = srq->handle;
       
  1472 +	cmd->user_handle   = (uintptr_t) srq;
       
  1473  	cmd->reserved   = 0;
       
  1474  
       
  1475  	if (write(srq->context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1476 @@ -606,6 +821,7 @@
       
  1477  
       
  1478  	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, DESTROY_SRQ, &resp, sizeof resp);
       
  1479  	cmd.srq_handle = srq->handle;
       
  1480 +	cmd.user_handle  = (uintptr_t) srq;
       
  1481  	cmd.reserved   = 0;
       
  1482  
       
  1483  	if (write(srq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
  1484 @@ -637,7 +853,20 @@
       
  1485  	cmd->max_send_sge    = attr->cap.max_send_sge;
       
  1486  	cmd->max_recv_sge    = attr->cap.max_recv_sge;
       
  1487  	cmd->max_inline_data = attr->cap.max_inline_data;
       
  1488 +
       
  1489 +#if defined(__SVR4) && defined(__sun)
       
  1490 +	if (attr->sq_sig_all & LIB_RDMACM_QP_BIT) {
       
  1491 +		cmd->sq_sig_all =
       
  1492 +		    (uint8_t)(attr->sq_sig_all & ~LIB_RDMACM_QP_BIT);
       
  1493 +		cmd->sq_sig_all |= 0x80;
       
  1494 +		attr->sq_sig_all &= ~LIB_RDMACM_QP_BIT;
       
  1495 +	} else {
       
  1496 +		cmd->sq_sig_all = (uint8_t)attr->sq_sig_all;
       
  1497 +	}
       
  1498 +#else
       
  1499  	cmd->sq_sig_all	     = attr->sq_sig_all;
       
  1500 +#endif
       
  1501 +
       
  1502  	cmd->qp_type 	     = attr->qp_type;
       
  1503  	cmd->is_srq 	     = !!attr->srq;
       
  1504  	cmd->srq_handle      = attr->qp_type == IBV_QPT_XRC ?
       
  1505 @@ -691,6 +920,7 @@
       
  1506  	IBV_INIT_CMD_RESP(cmd, cmd_size, QUERY_QP, &resp, sizeof resp);
       
  1507  	cmd->qp_handle = qp->handle;
       
  1508  	cmd->attr_mask = attr_mask;
       
  1509 +	cmd->user_handle   = (uintptr_t) qp;
       
  1510  
       
  1511  	if (write(qp->context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1512  		return errno;
       
  1513 @@ -772,6 +1002,7 @@
       
  1514  	IBV_INIT_CMD(cmd, cmd_size, MODIFY_QP);
       
  1515  
       
  1516  	cmd->qp_handle 		 = qp->handle;
       
  1517 +	cmd->user_handle   	 = (uintptr_t) qp;
       
  1518  	cmd->attr_mask 		 = attr_mask;
       
  1519  	cmd->qkey 		 = attr->qkey;
       
  1520  	cmd->rq_psn 		 = attr->rq_psn;
       
  1521 @@ -1236,38 +1467,47 @@
       
  1522  	return ret;
       
  1523  }
       
  1524  
       
  1525 -int ibv_cmd_create_ah(struct ibv_pd *pd, struct ibv_ah *ah,
       
  1526 -		      struct ibv_ah_attr *attr)
       
  1527 +int ibv_cmd_create_ah_ex(struct ibv_pd *pd, struct ibv_ah *ah, struct ibv_ah_attr *attr,
       
  1528 +			 struct ibv_create_ah *cmd, size_t cmd_size,
       
  1529 +			 struct ibv_create_ah_resp *resp, size_t resp_size)
       
  1530  {
       
  1531 -	struct ibv_create_ah      cmd;
       
  1532 -	struct ibv_create_ah_resp resp;
       
  1533 +	IBV_INIT_CMD_RESP(cmd, cmd_size, CREATE_AH, resp, resp_size);
       
  1534 +	cmd->user_handle            = (uintptr_t) ah;
       
  1535 +	cmd->pd_handle              = pd->handle;
       
  1536 +	cmd->reserved               = 0;
       
  1537 +	cmd->attr.dlid              = attr->dlid;
       
  1538 +	cmd->attr.sl                = attr->sl;
       
  1539 +	cmd->attr.src_path_bits     = attr->src_path_bits;
       
  1540 +	cmd->attr.static_rate       = attr->static_rate;
       
  1541 +	cmd->attr.is_global         = attr->is_global;
       
  1542 +	cmd->attr.port_num          = attr->port_num;
       
  1543 +	cmd->attr.grh.flow_label    = attr->grh.flow_label;
       
  1544 +	cmd->attr.grh.sgid_index    = attr->grh.sgid_index;
       
  1545 +	cmd->attr.grh.hop_limit     = attr->grh.hop_limit;
       
  1546 +	cmd->attr.grh.traffic_class = attr->grh.traffic_class;
       
  1547 +	cmd->attr.grh.reserved      = 0;
       
  1548 +	cmd->attr.reserved          = 0;
       
  1549 +	memcpy(cmd->attr.grh.dgid, attr->grh.dgid.raw, 16);
       
  1550  
       
  1551 -	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, CREATE_AH, &resp, sizeof resp);
       
  1552 -	cmd.user_handle            = (uintptr_t) ah;
       
  1553 -	cmd.pd_handle              = pd->handle;
       
  1554 -	cmd.attr.dlid              = attr->dlid;
       
  1555 -	cmd.attr.sl                = attr->sl;
       
  1556 -	cmd.attr.src_path_bits     = attr->src_path_bits;
       
  1557 -	cmd.attr.static_rate       = attr->static_rate;
       
  1558 -	cmd.attr.is_global         = attr->is_global;
       
  1559 -	cmd.attr.port_num          = attr->port_num;
       
  1560 -	cmd.attr.grh.flow_label    = attr->grh.flow_label;
       
  1561 -	cmd.attr.grh.sgid_index    = attr->grh.sgid_index;
       
  1562 -	cmd.attr.grh.hop_limit     = attr->grh.hop_limit;
       
  1563 -	cmd.attr.grh.traffic_class = attr->grh.traffic_class;
       
  1564 -	memcpy(cmd.attr.grh.dgid, attr->grh.dgid.raw, 16);
       
  1565 -
       
  1566 -	if (write(pd->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
  1567 +	if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size)
       
  1568  		return errno;
       
  1569  
       
  1570 -	VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
       
  1571 +	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
       
  1572  
       
  1573 -	ah->handle  = resp.handle;
       
  1574 +	ah->handle  = resp->handle;
       
  1575  	ah->context = pd->context;
       
  1576  
       
  1577  	return 0;
       
  1578  }
       
  1579  
       
  1580 +int ibv_cmd_create_ah(struct ibv_pd *pd, struct ibv_ah *ah,
       
  1581 +		      struct ibv_ah_attr *attr)
       
  1582 +{
       
  1583 +	struct ibv_create_ah      cmd;
       
  1584 +	struct ibv_create_ah_resp resp;
       
  1585 +	return ibv_cmd_create_ah_ex(pd, ah, attr, &cmd, sizeof(cmd), &resp, sizeof(resp));
       
  1586 +}
       
  1587 +
       
  1588  int ibv_cmd_destroy_ah(struct ibv_ah *ah)
       
  1589  {
       
  1590  	struct ibv_destroy_ah cmd;
       
  1591 @@ -1274,6 +1514,7 @@
       
  1592  
       
  1593  	IBV_INIT_CMD(&cmd, sizeof cmd, DESTROY_AH);
       
  1594  	cmd.ah_handle = ah->handle;
       
  1595 +	cmd.user_handle            = (uintptr_t) ah;
       
  1596  
       
  1597  	if (write(ah->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
  1598  		return errno;
       
  1599 @@ -1292,6 +1533,7 @@
       
  1600  	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, DESTROY_QP, &resp, sizeof resp);
       
  1601  	cmd.qp_handle = qp->handle;
       
  1602  	cmd.reserved  = 0;
       
  1603 +	cmd.user_handle  = (uintptr_t) qp;
       
  1604  
       
  1605  	if (write(qp->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
       
  1606  		return errno;
       
  1607 @@ -1313,6 +1555,7 @@
       
  1608  	IBV_INIT_CMD(&cmd, sizeof cmd, ATTACH_MCAST);
       
  1609  	memcpy(cmd.gid, gid->raw, sizeof cmd.gid);
       
  1610  	cmd.qp_handle = qp->handle;
       
  1611 +	cmd.user_handle  = (uintptr_t) qp;
       
  1612  	cmd.mlid      = lid;
       
  1613  	cmd.reserved  = 0;
       
  1614  
       
  1615 @@ -1329,6 +1572,7 @@
       
  1616  	IBV_INIT_CMD(&cmd, sizeof cmd, DETACH_MCAST);
       
  1617  	memcpy(cmd.gid, gid->raw, sizeof cmd.gid);
       
  1618  	cmd.qp_handle = qp->handle;
       
  1619 +	cmd.user_handle  = (uintptr_t) qp;
       
  1620  	cmd.mlid      = lid;
       
  1621  	cmd.reserved  = 0;
       
  1622  
       
  1623 @@ -1406,4 +1650,3 @@
       
  1624  		return errno;
       
  1625  	return 0;
       
  1626  }
       
  1627 -
       
  1628 diff -r -u /tmp/846623/libibverbs-1.1.4/src/init.c libibverbs-1.1.4/src/init.c
       
  1629 --- /tmp/846623/libibverbs-1.1.4/src/init.c	Sun Nov  1 06:47:19 2009
       
  1630 +++ libibverbs-1.1.4/src/init.c	Fri Feb 11 04:02:32 2011
       
  1631 @@ -77,8 +77,13 @@
       
  1632  static struct ibv_driver_name *driver_name_list;
       
  1633  static struct ibv_driver *head_driver, *tail_driver;
       
  1634  
       
  1635 +static uint blueflame_enabled = 0;
       
  1636 +
       
  1637  static int find_sysfs_devs(void)
       
  1638  {
       
  1639 +#if defined(__SVR4) && defined(__sun)
       
  1640 +	char device_path[IBV_SYSFS_PATH_MAX];
       
  1641 +#endif
       
  1642  	char class_path[IBV_SYSFS_PATH_MAX];
       
  1643  	DIR *class_dir;
       
  1644  	struct dirent *dent;
       
  1645 @@ -86,19 +91,35 @@
       
  1646  	char value[8];
       
  1647  	int ret = 0;
       
  1648  
       
  1649 +#if defined(__SVR4) && defined(__sun)
       
  1650 +	snprintf(device_path, sizeof device_path, "/dev/infiniband/ofs");
       
  1651 +#endif
       
  1652  	snprintf(class_path, sizeof class_path, "%s/class/infiniband_verbs",
       
  1653  		 ibv_get_sysfs_path());
       
  1654  
       
  1655 +#if defined(__SVR4) && defined(__sun)
       
  1656 +	class_dir = opendir(device_path);
       
  1657 +#else
       
  1658  	class_dir = opendir(class_path);
       
  1659 +#endif
       
  1660  	if (!class_dir)
       
  1661  		return ENOSYS;
       
  1662  
       
  1663  	while ((dent = readdir(class_dir))) {
       
  1664 +#if defined(__SVR4) && defined(__sun)
       
  1665 +		int adapter_num;
       
  1666 +#else
       
  1667  		struct stat buf;
       
  1668 +#endif
       
  1669  
       
  1670  		if (dent->d_name[0] == '.')
       
  1671  			continue;
       
  1672  
       
  1673 +#if defined(__SVR4) && defined(__sun)
       
  1674 +		if (sscanf(dent->d_name, "uverbs%d",
       
  1675 +		    &adapter_num) != 1)
       
  1676 +			continue;
       
  1677 +#endif
       
  1678  		if (!sysfs_dev)
       
  1679  			sysfs_dev = malloc(sizeof *sysfs_dev);
       
  1680  		if (!sysfs_dev) {
       
  1681 @@ -109,6 +130,7 @@
       
  1682  		snprintf(sysfs_dev->sysfs_path, sizeof sysfs_dev->sysfs_path,
       
  1683  			 "%s/%s", class_path, dent->d_name);
       
  1684  
       
  1685 +#if !(defined(__SVR4) && defined(__sun))
       
  1686  		if (stat(sysfs_dev->sysfs_path, &buf)) {
       
  1687  			fprintf(stderr, PFX "Warning: couldn't stat '%s'.\n",
       
  1688  				sysfs_dev->sysfs_path);
       
  1689 @@ -117,6 +139,7 @@
       
  1690  
       
  1691  		if (!S_ISDIR(buf.st_mode))
       
  1692  			continue;
       
  1693 +#endif
       
  1694  
       
  1695  		snprintf(sysfs_dev->sysfs_name, sizeof sysfs_dev->sysfs_name,
       
  1696  			"%s", dent->d_name);
       
  1697 @@ -280,6 +303,13 @@
       
  1698  
       
  1699  			driver_name->next = driver_name_list;
       
  1700  			driver_name_list  = driver_name;
       
  1701 +		} else if (strcmp(field, "blueflame") == 0) {
       
  1702 +			config += strspn(config, "\t ");
       
  1703 +			field = strsep(&config, "\n\t ");
       
  1704 +			if (strcmp(field, "enable") == 0)
       
  1705 +				blueflame_enabled = 1;
       
  1706 +			if (strcmp(field, "disable") == 0)
       
  1707 +				blueflame_enabled = 0;
       
  1708  		} else
       
  1709  			fprintf(stderr, PFX "Warning: ignoring bad config directive "
       
  1710  				"'%s' in file '%s'.\n", field, path);
       
  1711 @@ -367,6 +397,7 @@
       
  1712  	strcpy(dev->dev_path,   sysfs_dev->sysfs_path);
       
  1713  	strcpy(dev->name,       sysfs_dev->ibdev_name);
       
  1714  	strcpy(dev->ibdev_path, sysfs_dev->ibdev_path);
       
  1715 +	dev->blueflame_enabled = blueflame_enabled;
       
  1716  
       
  1717  	return dev;
       
  1718  }
       
  1719 @@ -409,6 +440,7 @@
       
  1720  
       
  1721  static void check_memlock_limit(void)
       
  1722  {
       
  1723 +#if !(defined(__SVR4) && defined(__sun))
       
  1724  	struct rlimit rlim;
       
  1725  
       
  1726  	if (!geteuid())
       
  1727 @@ -423,6 +455,7 @@
       
  1728  		fprintf(stderr, PFX "Warning: RLIMIT_MEMLOCK is %lu bytes.\n"
       
  1729  			"    This will severely limit memory registrations.\n",
       
  1730  			rlim.rlim_cur);
       
  1731 +#endif
       
  1732  }
       
  1733  
       
  1734  static void add_device(struct ibv_device *dev,
       
  1735 diff -r -u /tmp/846623/libibverbs-1.1.4/src/enum_strs.c libibverbs-1.1.4/src/enum_strs.c
       
  1736 --- /tmp/846623/libibverbs-1.1.4/src/enum_strs.c	Wed Sep 16 04:27:22 2009
       
  1737 +++ libibverbs-1.1.4/src/enum_strs.c	Tue Mar 20 16:27:45 2012
       
  1738 @@ -85,9 +85,14 @@
       
  1739  		[IBV_EVENT_SRQ_LIMIT_REACHED]	= "SRQ limit reached",
       
  1740  		[IBV_EVENT_QP_LAST_WQE_REACHED]	= "last WQE reached",
       
  1741  		[IBV_EVENT_CLIENT_REREGISTER]	= "client reregistration",
       
  1742 +		[IBV_EVENT_GID_CHANGE]		= "GID change",
       
  1743 +		[IBV_EVENT_MCG_CREATED]		= "MCG created",
       
  1744 +		[IBV_EVENT_MCG_DELETED]		= "MCG deleted",
       
  1745 +		[IBV_EVENT_GID_AVAIL]		= "GID available",
       
  1746 +		[IBV_EVENT_GID_UNAVAIL]		= "GID unavailable",
       
  1747  	};
       
  1748  
       
  1749 -	if (event < IBV_EVENT_CQ_ERR || event > IBV_EVENT_CLIENT_REREGISTER)
       
  1750 +	if (event < IBV_EVENT_CQ_ERR || event > IBV_EVENT_GID_UNAVAIL)
       
  1751  		return "unknown";
       
  1752  
       
  1753  	return event_type_str[event];
       
  1754 diff -r -u /tmp/846623/libibverbs-1.1.4/src/sysfs.c libibverbs-1.1.4/src/sysfs.c
       
  1755 --- /tmp/846623/libibverbs-1.1.4/src/sysfs.c	Wed Sep 16 04:27:22 2009
       
  1756 +++ libibverbs-1.1.4/src/sysfs.c	Fri Feb 11 04:02:33 2011
       
  1757 @@ -44,6 +44,10 @@
       
  1758  
       
  1759  #include "ibverbs.h"
       
  1760  
       
  1761 +#if defined(__SVR4) && defined(__sun)
       
  1762 +int sol_read_sysfs_file(char *path, char *buf, size_t size);
       
  1763 +#endif
       
  1764 +
       
  1765  static char *sysfs_path;
       
  1766  
       
  1767  const char *ibv_get_sysfs_path(void)
       
  1768 @@ -79,12 +83,18 @@
       
  1769  			char *buf, size_t size)
       
  1770  {
       
  1771  	char *path;
       
  1772 +#if !(defined(__SVR4) && defined(__sun))
       
  1773  	int fd;
       
  1774 +#endif
       
  1775  	int len;
       
  1776  
       
  1777  	if (asprintf(&path, "%s/%s", dir, file) < 0)
       
  1778  		return -1;
       
  1779  
       
  1780 +#if defined(__SVR4) && defined(__sun)
       
  1781 +	len = sol_read_sysfs_file(path, buf, size);
       
  1782 +	free(path);
       
  1783 +#else
       
  1784  	fd = open(path, O_RDONLY);
       
  1785  	if (fd < 0) {
       
  1786  		free(path);
       
  1787 @@ -98,6 +108,7 @@
       
  1788  
       
  1789  	if (len > 0 && buf[len - 1] == '\n')
       
  1790  		buf[--len] = '\0';
       
  1791 +#endif
       
  1792  
       
  1793  	return len;
       
  1794  }
       
  1795 diff -r -u /tmp/846623/libibverbs-1.1.4/configure libibverbs-1.1.4/configure
       
  1796 --- /tmp/846623/libibverbs-1.1.4/configure	Thu Feb  3 01:53:23 2011
       
  1797 +++ libibverbs-1.1.4/configure	Fri Feb 11 04:02:14 2011
       
  1798 @@ -3173,6 +3173,7 @@
       
  1799  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
       
  1800  $as_echo_n "checking whether the C compiler works... " >&6; }
       
  1801  ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
       
  1802 +ac_link_default=`$as_echo "$ac_link" | sed 's/ \$LIBS//'`
       
  1803  
       
  1804  # The possible output files:
       
  1805  ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
       
  1806 @@ -3258,6 +3259,7 @@
       
  1807  ac_clean_files=$ac_clean_files_save
       
  1808  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
       
  1809  $as_echo_n "checking for suffix of executables... " >&6; }
       
  1810 +ac_link_nolibs=`$as_echo "$ac_link" | sed 's/ \$LIBS//'`
       
  1811  if { { ac_try="$ac_link"
       
  1812  case "(($ac_try" in
       
  1813    *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
       
  1814 @@ -3265,7 +3267,7 @@
       
  1815  esac
       
  1816  eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
       
  1817  $as_echo "$ac_try_echo"; } >&5
       
  1818 -  (eval "$ac_link") 2>&5
       
  1819 +  (eval "$ac_link_nolibs") 2>&5
       
  1820    ac_status=$?
       
  1821    $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
       
  1822    test $ac_status = 0; }; then :
       
  1823 @@ -3321,7 +3323,7 @@
       
  1824  esac
       
  1825  eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
       
  1826  $as_echo "$ac_try_echo"; } >&5
       
  1827 -  (eval "$ac_link") 2>&5
       
  1828 +  (eval "$ac_link_nolibs") 2>&5
       
  1829    ac_status=$?
       
  1830    $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
       
  1831    test $ac_status = 0; }
       
  1832 @@ -3509,13 +3511,13 @@
       
  1833    CFLAGS=$ac_save_CFLAGS
       
  1834  elif test $ac_cv_prog_cc_g = yes; then
       
  1835    if test "$GCC" = yes; then
       
  1836 -    CFLAGS="-g -O2"
       
  1837 +    CFLAGS="-g -O3"
       
  1838    else
       
  1839      CFLAGS="-g"
       
  1840    fi
       
  1841  else
       
  1842    if test "$GCC" = yes; then
       
  1843 -    CFLAGS="-O2"
       
  1844 +    CFLAGS="-O3"
       
  1845    else
       
  1846      CFLAGS=
       
  1847    fi
       
  1848 @@ -8721,6 +8723,7 @@
       
  1849  	;;
       
  1850        esac
       
  1851        link_all_deplibs=yes
       
  1852 +	 hardcode_libdir_flag_spec=
       
  1853        ;;
       
  1854  
       
  1855      sunos4*)
       
  1856 @@ -10945,13 +10948,13 @@
       
  1857    CFLAGS=$ac_save_CFLAGS
       
  1858  elif test $ac_cv_prog_cc_g = yes; then
       
  1859    if test "$GCC" = yes; then
       
  1860 -    CFLAGS="-g -O2"
       
  1861 +    CFLAGS="-g -O3"
       
  1862    else
       
  1863      CFLAGS="-g"
       
  1864    fi
       
  1865  else
       
  1866    if test "$GCC" = yes; then
       
  1867 -    CFLAGS="-O2"
       
  1868 +    CFLAGS="-O3"
       
  1869    else
       
  1870      CFLAGS=
       
  1871    fi
       
  1872 @@ -11198,7 +11201,7 @@
       
  1873    $as_echo_n "(cached) " >&6
       
  1874  else
       
  1875    ac_check_lib_save_LIBS=$LIBS
       
  1876 -LIBS="-ldl  $LIBS"
       
  1877 +LIBS="-ldl"
       
  1878  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
       
  1879  /* end confdefs.h.  */
       
  1880  
       
  1881 @@ -11245,7 +11248,7 @@
       
  1882    $as_echo_n "(cached) " >&6
       
  1883  else
       
  1884    ac_check_lib_save_LIBS=$LIBS
       
  1885 -LIBS="-lpthread  $LIBS"
       
  1886 +LIBS="-lpthread"
       
  1887  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
       
  1888  /* end confdefs.h.  */
       
  1889  
       
  1890 diff -r -u /tmp/846623/libibverbs-1.1.4/include/infiniband/sa-kern-abi.h libibverbs-1.1.4/include/infiniband/sa-kern-abi.h
       
  1891 --- /tmp/846623/libibverbs-1.1.4/include/infiniband/sa-kern-abi.h	Wed Sep 16 04:27:22 2009
       
  1892 +++ libibverbs-1.1.4/include/infiniband/sa-kern-abi.h	Fri Feb 11 04:02:21 2011
       
  1893 @@ -33,7 +33,11 @@
       
  1894  #ifndef INFINIBAND_SA_KERN_ABI_H
       
  1895  #define INFINIBAND_SA_KERN_ABI_H
       
  1896  
       
  1897 +#if !(defined(__SVR4) && defined(__sun))
       
  1898  #include <linux/types.h>
       
  1899 +#else
       
  1900 +#include <infiniband/ofa_solaris.h>
       
  1901 +#endif
       
  1902  
       
  1903  /*
       
  1904   * Obsolete, deprecated names.  Will be removed in libibverbs 1.1.
       
  1905 diff -r -u /tmp/846623/libibverbs-1.1.4/include/infiniband/kern-abi.h libibverbs-1.1.4/include/infiniband/kern-abi.h
       
  1906 --- /tmp/846623/libibverbs-1.1.4/include/infiniband/kern-abi.h	Thu Feb  3 01:53:17 2011
       
  1907 +++ libibverbs-1.1.4/include/infiniband/kern-abi.h	Fri Feb 11 04:02:20 2011
       
  1908 @@ -35,7 +35,11 @@
       
  1909  #ifndef KERN_ABI_H
       
  1910  #define KERN_ABI_H
       
  1911  
       
  1912 +#if !(defined(__SVR4) && defined(__sun))
       
  1913  #include <linux/types.h>
       
  1914 +#else
       
  1915 +#include <infiniband/ofa_solaris.h>
       
  1916 +#endif
       
  1917  
       
  1918  /*
       
  1919   * This file must be kept in sync with the kernel's version of
       
  1920 @@ -94,6 +98,14 @@
       
  1921  	IB_USER_VERBS_CMD_QUERY_XRC_RCV_QP,
       
  1922  	IB_USER_VERBS_CMD_REG_XRC_RCV_QP,
       
  1923  	IB_USER_VERBS_CMD_UNREG_XRC_RCV_QP,
       
  1924 +	IB_USER_VERBS_CMD_REG_MR_RELAXED,
       
  1925 +	IB_USER_VERBS_CMD_DEREG_MR_RELAXED,
       
  1926 +	IB_USER_VERBS_CMD_FLUSH_RELAXED_MR,
       
  1927 +	IB_USER_VERBS_CMD_ALLOC_SHPD,
       
  1928 +	IB_USER_VERBS_CMD_SHARE_PD,
       
  1929 +	IB_USER_VERBS_CMD_REG_SM_EVENT,
       
  1930 +	IB_USER_VERBS_CMD_UNREG_SM_EVENT,
       
  1931 +	IB_USER_VERBS_CMD_GID_REACHABLE
       
  1932  };
       
  1933  
       
  1934  /*
       
  1935 @@ -111,6 +123,8 @@
       
  1936  	__u64 element;
       
  1937  	__u32 event_type;
       
  1938  	__u32 reserved;
       
  1939 +	__u64 subnet_prefix;
       
  1940 +	__u64 interface_id;
       
  1941  };
       
  1942  
       
  1943  struct ibv_comp_event {
       
  1944 @@ -160,6 +174,7 @@
       
  1945  struct ibv_query_device_resp {
       
  1946  	__u64 fw_ver;
       
  1947  	__u64 node_guid;
       
  1948 +	__u64 node_guid_external;
       
  1949  	__u64 sys_image_guid;
       
  1950  	__u64 max_mr_size;
       
  1951  	__u64 page_size_cap;
       
  1952 @@ -235,23 +250,89 @@
       
  1953  	__u8  reserved[2];
       
  1954  };
       
  1955  
       
  1956 +struct ibv_reg_sm_event {
       
  1957 +	__u32 command;
       
  1958 +	__u16 in_words;
       
  1959 +	__u16 out_words;
       
  1960 +	__u32 events;
       
  1961 +	__u32 data_num;
       
  1962 +	__u64 driver_data[0];
       
  1963 +};
       
  1964 +
       
  1965 +struct ibv_unreg_sm_event {
       
  1966 +	__u32 command;
       
  1967 +	__u16 in_words;
       
  1968 +	__u16 out_words;
       
  1969 +	__u32 events;
       
  1970 +	__u32 data_num;
       
  1971 +	__u64 driver_data[0];
       
  1972 +};
       
  1973 +
       
  1974 +struct ibv_gid_reachable {
       
  1975 +	__u32 command;
       
  1976 +	__u16 in_words;
       
  1977 +	__u16 out_words;
       
  1978 +	__u32 timeout;
       
  1979 +	__u8  port_num;
       
  1980 +	__u8  reserved[3];
       
  1981 +	__u8  gid[16];
       
  1982 +};
       
  1983 +
       
  1984  struct ibv_alloc_pd {
       
  1985  	__u32 command;
       
  1986  	__u16 in_words;
       
  1987  	__u16 out_words;
       
  1988  	__u64 response;
       
  1989 +	__u64 user_handle;
       
  1990  	__u64 driver_data[0];
       
  1991  };
       
  1992  
       
  1993  struct ibv_alloc_pd_resp {
       
  1994  	__u32 pd_handle;
       
  1995 +	__u32 reserved;
       
  1996  };
       
  1997  
       
  1998 +struct ibv_alloc_shpd {
       
  1999 +	__u32 command;
       
  2000 +	__u16 in_words;
       
  2001 +	__u16 out_words;
       
  2002 +	__u64 response;
       
  2003 +	__u32 pd_handle;
       
  2004 +	__u32 reserved;
       
  2005 +	__u64 share_key;
       
  2006 +	__u64 user_handle;
       
  2007 +	__u64 driver_data[0];
       
  2008 +};
       
  2009 +
       
  2010 +struct ibv_alloc_shpd_resp {
       
  2011 +	__u32 shpd_handle;
       
  2012 +	__u32 reserved;
       
  2013 +};
       
  2014 +
       
  2015 +struct ibv_share_pd {
       
  2016 +	__u32 command;
       
  2017 +	__u16 in_words;
       
  2018 +	__u16 out_words;
       
  2019 +	__u64 response;
       
  2020 +	__u32 shpd_handle;
       
  2021 +	__u32 reserved;
       
  2022 +	__u64 share_key;
       
  2023 +	__u64 user_handle;
       
  2024 +	__u64 driver_data[0];
       
  2025 +};
       
  2026 +
       
  2027 +struct ibv_share_pd_resp {
       
  2028 +	__u32 pd_handle;
       
  2029 +        __u32 reserved;
       
  2030 +};
       
  2031 +
       
  2032  struct ibv_dealloc_pd {
       
  2033  	__u32 command;
       
  2034  	__u16 in_words;
       
  2035  	__u16 out_words;
       
  2036  	__u32 pd_handle;
       
  2037 +	__u32 reserved;
       
  2038 +	__u64 user_handle;
       
  2039  };
       
  2040  
       
  2041  struct ibv_reg_mr {
       
  2042 @@ -264,6 +345,7 @@
       
  2043  	__u64 hca_va;
       
  2044  	__u32 pd_handle;
       
  2045  	__u32 access_flags;
       
  2046 +	__u64 user_handle;
       
  2047  	__u64 driver_data[0];
       
  2048  };
       
  2049  
       
  2050 @@ -271,6 +353,7 @@
       
  2051  	__u32 mr_handle;
       
  2052  	__u32 lkey;
       
  2053  	__u32 rkey;
       
  2054 +	__u32 reserved;
       
  2055  };
       
  2056  
       
  2057  struct ibv_dereg_mr {
       
  2058 @@ -278,8 +361,19 @@
       
  2059  	__u16 in_words;
       
  2060  	__u16 out_words;
       
  2061  	__u32 mr_handle;
       
  2062 +	__u32 reserved;
       
  2063 +	__u64 user_handle;
       
  2064  };
       
  2065  
       
  2066 +struct ibv_flush_relaxed_mr {
       
  2067 +	__u32 command;
       
  2068 +	__u16 in_words;
       
  2069 +	__u16 out_words;
       
  2070 +	__u32 pd_handle;
       
  2071 +	__u32 reserved;
       
  2072 +	__u64 user_handle;
       
  2073 +};
       
  2074 +
       
  2075  struct ibv_create_comp_channel {
       
  2076  	__u32 command;
       
  2077  	__u16 in_words;
       
  2078 @@ -289,6 +383,7 @@
       
  2079  
       
  2080  struct ibv_create_comp_channel_resp {
       
  2081  	__u32 fd;
       
  2082 +	__u32 reserved;
       
  2083  };
       
  2084  
       
  2085  struct ibv_create_cq {
       
  2086 @@ -334,6 +429,7 @@
       
  2087  	__u64 response;
       
  2088  	__u32 cq_handle;
       
  2089  	__u32 ne;
       
  2090 +	__u64 user_handle;
       
  2091  };
       
  2092  
       
  2093  struct ibv_poll_cq_resp {
       
  2094 @@ -348,6 +444,7 @@
       
  2095  	__u16 out_words;
       
  2096  	__u32 cq_handle;
       
  2097  	__u32 solicited;
       
  2098 +	__u64 user_handle;
       
  2099  };
       
  2100  
       
  2101  struct ibv_resize_cq {
       
  2102 @@ -357,6 +454,7 @@
       
  2103  	__u64 response;
       
  2104  	__u32 cq_handle;
       
  2105  	__u32 cqe;
       
  2106 +	__u64 user_handle;
       
  2107  	__u64 driver_data[0];
       
  2108  };
       
  2109  
       
  2110 @@ -373,6 +471,7 @@
       
  2111  	__u64 response;
       
  2112  	__u32 cq_handle;
       
  2113  	__u32 reserved;
       
  2114 +	__u64 user_handle;
       
  2115  };
       
  2116  
       
  2117  struct ibv_destroy_cq_resp {
       
  2118 @@ -493,6 +592,7 @@
       
  2119  	__u64 response;
       
  2120  	__u32 qp_handle;
       
  2121  	__u32 attr_mask;
       
  2122 +	__u64 user_handle;
       
  2123  	__u64 driver_data[0];
       
  2124  };
       
  2125  
       
  2126 @@ -560,6 +660,7 @@
       
  2127  	__u8  alt_port_num;
       
  2128  	__u8  alt_timeout;
       
  2129  	__u8  reserved[2];
       
  2130 +	__u64 user_handle;
       
  2131  	__u64 driver_data[0];
       
  2132  };
       
  2133  
       
  2134 @@ -570,10 +671,12 @@
       
  2135  	__u64 response;
       
  2136  	__u32 qp_handle;
       
  2137  	__u32 reserved;
       
  2138 +	__u64 user_handle;
       
  2139  };
       
  2140  
       
  2141  struct ibv_destroy_qp_resp {
       
  2142  	__u32 events_reported;
       
  2143 +	__u32 reserved;
       
  2144  };
       
  2145  
       
  2146  struct ibv_create_xrc_rcv_qp {
       
  2147 @@ -705,6 +808,7 @@
       
  2148  
       
  2149  struct ibv_post_send_resp {
       
  2150  	__u32 bad_wr;
       
  2151 +	__u32 reserved;
       
  2152  };
       
  2153  
       
  2154  struct ibv_kern_recv_wr {
       
  2155 @@ -727,6 +831,7 @@
       
  2156  
       
  2157  struct ibv_post_recv_resp {
       
  2158  	__u32 bad_wr;
       
  2159 +	__u32 reserved;
       
  2160  };
       
  2161  
       
  2162  struct ibv_post_srq_recv {
       
  2163 @@ -743,6 +848,7 @@
       
  2164  
       
  2165  struct ibv_post_srq_recv_resp {
       
  2166  	__u32 bad_wr;
       
  2167 +	__u32 reserved;
       
  2168  };
       
  2169  
       
  2170  struct ibv_create_ah {
       
  2171 @@ -758,6 +864,7 @@
       
  2172  
       
  2173  struct ibv_create_ah_resp {
       
  2174  	__u32 handle;
       
  2175 +	__u32 reserved;
       
  2176  };
       
  2177  
       
  2178  struct ibv_destroy_ah {
       
  2179 @@ -765,6 +872,8 @@
       
  2180  	__u16 in_words;
       
  2181  	__u16 out_words;
       
  2182  	__u32 ah_handle;
       
  2183 +	__u32 reserved;
       
  2184 +	__u64 user_handle;
       
  2185  };
       
  2186  
       
  2187  struct ibv_attach_mcast {
       
  2188 @@ -775,6 +884,7 @@
       
  2189  	__u32 qp_handle;
       
  2190  	__u16 mlid;
       
  2191  	__u16 reserved;
       
  2192 +	__u64 user_handle;
       
  2193  	__u64 driver_data[0];
       
  2194  };
       
  2195  
       
  2196 @@ -786,6 +896,7 @@
       
  2197  	__u32 qp_handle;
       
  2198  	__u16 mlid;
       
  2199  	__u16 reserved;
       
  2200 +	__u64 user_handle;
       
  2201  	__u64 driver_data[0];
       
  2202  };
       
  2203  
       
  2204 @@ -832,6 +943,7 @@
       
  2205  	__u32 attr_mask;
       
  2206  	__u32 max_wr;
       
  2207  	__u32 srq_limit;
       
  2208 +	__u64 user_handle;
       
  2209  	__u64 driver_data[0];
       
  2210  };
       
  2211  
       
  2212 @@ -842,6 +954,7 @@
       
  2213  	__u64 response;
       
  2214  	__u32 srq_handle;
       
  2215  	__u32 reserved;
       
  2216 +	__u64 user_handle;
       
  2217  	__u64 driver_data[0];
       
  2218  };
       
  2219  
       
  2220 @@ -859,10 +972,12 @@
       
  2221  	__u64 response;
       
  2222  	__u32 srq_handle;
       
  2223  	__u32 reserved;
       
  2224 +	__u64 user_handle;
       
  2225  };
       
  2226  
       
  2227  struct ibv_destroy_srq_resp {
       
  2228  	__u32 events_reported;
       
  2229 +	__u32 reserved;
       
  2230  };
       
  2231  
       
  2232  struct ibv_open_xrc_domain {
       
  2233 @@ -877,6 +992,7 @@
       
  2234  
       
  2235  struct ibv_open_xrc_domain_resp {
       
  2236  	__u32 xrcd_handle;
       
  2237 +	__u32 reserved;
       
  2238  };
       
  2239  
       
  2240  struct ibv_close_xrc_domain {
       
  2241 @@ -946,6 +1062,14 @@
       
  2242  	IB_USER_VERBS_CMD_QUERY_XRC_RCV_QP_V2 = -1,
       
  2243  	IB_USER_VERBS_CMD_REG_XRC_RCV_QP_V2 = -1,
       
  2244  	IB_USER_VERBS_CMD_UNREG_XRC_RCV_QP_V2 = -1,
       
  2245 +	IB_USER_VERBS_CMD_REG_MR_RELAXED_V2 = -1,
       
  2246 +	IB_USER_VERBS_CMD_DEREG_MR_RELAXED_V2 = -1,
       
  2247 +	IB_USER_VERBS_CMD_FLUSH_RELAXED_MR_V2 = -1,
       
  2248 +  	IB_USER_VERBS_CMD_ALLOC_SHPD_V2 = -1,
       
  2249 +  	IB_USER_VERBS_CMD_SHARE_PD_V2 = -1,
       
  2250 +	IB_USER_VERBS_CMD_REG_SM_EVENT_V2 = -1,
       
  2251 +	IB_USER_VERBS_CMD_UNREG_SM_EVENT_V2 = -1,
       
  2252 +	IB_USER_VERBS_CMD_GID_REACHABLE_V2 = -1,
       
  2253  };
       
  2254  
       
  2255  struct ibv_destroy_cq_v1 {
       
  2256 diff -r -u /tmp/846623/libibverbs-1.1.4/include/infiniband/driver.h libibverbs-1.1.4/include/infiniband/driver.h
       
  2257 --- /tmp/846623/libibverbs-1.1.4/include/infiniband/driver.h	Thu Feb  3 01:53:17 2011
       
  2258 +++ libibverbs-1.1.4/include/infiniband/driver.h	Fri Feb 11 04:02:20 2011
       
  2259 @@ -74,6 +74,14 @@
       
  2260  int ibv_cmd_alloc_pd(struct ibv_context *context, struct ibv_pd *pd,
       
  2261  		     struct ibv_alloc_pd *cmd, size_t cmd_size,
       
  2262  		     struct ibv_alloc_pd_resp *resp, size_t resp_size);
       
  2263 +int ibv_cmd_alloc_shpd(struct ibv_context *context, struct ibv_pd *pd,
       
  2264 +		     uint64_t share_key, struct ibv_shpd *shpd,
       
  2265 +		     struct ibv_alloc_shpd *cmd, size_t cmd_size,
       
  2266 +		     struct ibv_alloc_shpd_resp *resp, size_t resp_size);
       
  2267 +int ibv_cmd_share_pd(struct ibv_context *context, struct ibv_shpd *shpd,
       
  2268 +		     uint64_t share_key, struct ibv_pd *pd,
       
  2269 +		     struct ibv_share_pd *cmd, size_t cmd_size,
       
  2270 +		     struct ibv_share_pd_resp *resp, size_t resp_size);
       
  2271  int ibv_cmd_dealloc_pd(struct ibv_pd *pd);
       
  2272  #define IBV_CMD_REG_MR_HAS_RESP_PARAMS
       
  2273  int ibv_cmd_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
       
  2274 @@ -81,7 +89,15 @@
       
  2275  		   struct ibv_mr *mr, struct ibv_reg_mr *cmd,
       
  2276  		   size_t cmd_size,
       
  2277  		   struct ibv_reg_mr_resp *resp, size_t resp_size);
       
  2278 +#define IBV_CMD_REG_MR_RELAXED_HAS_RESP_PARAMS
       
  2279 +int ibv_cmd_reg_mr_relaxed(struct ibv_pd *pd, void *addr, size_t length,
       
  2280 +		   uint64_t hca_va, int access,
       
  2281 +		   struct ibv_mr *mr, struct ibv_reg_mr *cmd,
       
  2282 +		   size_t cmd_size,
       
  2283 +		   struct ibv_reg_mr_resp *resp, size_t resp_size);
       
  2284  int ibv_cmd_dereg_mr(struct ibv_mr *mr);
       
  2285 +int ibv_cmd_dereg_mr_relaxed(struct ibv_mr *mr);
       
  2286 +int ibv_cmd_flush_relaxed_mr(struct ibv_pd *pd);
       
  2287  int ibv_cmd_create_cq(struct ibv_context *context, int cqe,
       
  2288  		      struct ibv_comp_channel *channel,
       
  2289  		      int comp_vector, struct ibv_cq *cq,
       
  2290 @@ -133,6 +149,10 @@
       
  2291  			  struct ibv_recv_wr **bad_wr);
       
  2292  int ibv_cmd_create_ah(struct ibv_pd *pd, struct ibv_ah *ah,
       
  2293  		      struct ibv_ah_attr *attr);
       
  2294 +int ibv_cmd_create_ah_ex(struct ibv_pd *pd, struct ibv_ah *ah,
       
  2295 +			struct ibv_ah_attr *attr,
       
  2296 +			struct ibv_create_ah *cmd, size_t cmd_size,
       
  2297 +			struct ibv_create_ah_resp *resp, size_t resp_size);
       
  2298  int ibv_cmd_destroy_ah(struct ibv_ah *ah);
       
  2299  int ibv_cmd_attach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid);
       
  2300  int ibv_cmd_detach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid);
       
  2301 @@ -164,8 +184,8 @@
       
  2302  int ibv_read_sysfs_file(const char *dir, const char *file,
       
  2303  			char *buf, size_t size);
       
  2304  
       
  2305 -int ibv_resolve_eth_gid(const struct ibv_pd *pd, uint8_t port_num,
       
  2306 -			union ibv_gid *dgid, uint8_t sgid_index,
       
  2307 +int ibv_resolve_eth_gid(struct ibv_pd *pd, uint8_t port_num,
       
  2308 +			const union ibv_gid *dgid, uint8_t sgid_index,
       
  2309  			uint8_t mac[], uint16_t *vlan, uint8_t *tagged,
       
  2310  			uint8_t *is_mcast);
       
  2311  
       
  2312 diff -r -u /tmp/846623/libibverbs-1.1.4/include/infiniband/verbs.h libibverbs-1.1.4/include/infiniband/verbs.h
       
  2313 --- /tmp/846623/libibverbs-1.1.4/include/infiniband/verbs.h	Thu Feb  3 01:53:17 2011
       
  2314 +++ libibverbs-1.1.4/include/infiniband/verbs.h	Fri Feb 11 04:02:21 2011
       
  2315 @@ -38,6 +38,9 @@
       
  2316  
       
  2317  #include <stdint.h>
       
  2318  #include <pthread.h>
       
  2319 +#if defined(__SVR4) && defined(__sun)
       
  2320 +#include <infiniband/ofa_solaris.h>
       
  2321 +#endif
       
  2322  
       
  2323  #ifdef __cplusplus
       
  2324  #  define BEGIN_C_DECLS extern "C" {
       
  2325 @@ -105,6 +108,7 @@
       
  2326  struct ibv_device_attr {
       
  2327  	char			fw_ver[64];
       
  2328  	uint64_t		node_guid;
       
  2329 +	uint64_t		node_guid_external;
       
  2330  	uint64_t		sys_image_guid;
       
  2331  	uint64_t		max_mr_size;
       
  2332  	uint64_t		page_size_cap;
       
  2333 @@ -212,6 +216,10 @@
       
  2334  	IBV_EVENT_QP_LAST_WQE_REACHED,
       
  2335  	IBV_EVENT_CLIENT_REREGISTER,
       
  2336  	IBV_EVENT_GID_CHANGE,
       
  2337 +	IBV_EVENT_MCG_CREATED,
       
  2338 +	IBV_EVENT_MCG_DELETED,
       
  2339 +	IBV_EVENT_GID_AVAIL,
       
  2340 +	IBV_EVENT_GID_UNAVAIL,
       
  2341  };
       
  2342  
       
  2343  enum ibv_event_flags {
       
  2344 @@ -225,10 +233,20 @@
       
  2345  		struct ibv_srq *srq;
       
  2346  		int		port_num;
       
  2347  		uint32_t	xrc_qp_num;
       
  2348 +		union ibv_gid	gid;
       
  2349  	} element;
       
  2350  	enum ibv_event_type	event_type;
       
  2351  };
       
  2352  
       
  2353 +typedef enum ibv_sm_event_type_e {
       
  2354 +	IBV_SM_EVENT_MGID	= 1,
       
  2355 +	IBV_SM_EVENT_MGID_ALL	= 1 << 2,
       
  2356 +	IBV_SM_EVENT_UGID	= 1 << 3,
       
  2357 +	IBV_SM_EVENT_UGID_ALL	= 1 << 4,
       
  2358 +        IBV_SM_EVENT_ALL	= 1 << 5
       
  2359 +
       
  2360 +} ibv_sm_event_type_t;
       
  2361 +
       
  2362  enum ibv_wc_status {
       
  2363  	IBV_WC_SUCCESS,
       
  2364  	IBV_WC_LOC_LEN_ERR,
       
  2365 @@ -297,7 +315,8 @@
       
  2366  	IBV_ACCESS_REMOTE_WRITE		= (1<<1),
       
  2367  	IBV_ACCESS_REMOTE_READ		= (1<<2),
       
  2368  	IBV_ACCESS_REMOTE_ATOMIC	= (1<<3),
       
  2369 -	IBV_ACCESS_MW_BIND		= (1<<4)
       
  2370 +	IBV_ACCESS_MW_BIND		= (1<<4),
       
  2371 +	IBV_ACCESS_SO			= (1<<5)	/* Strong Order */
       
  2372  };
       
  2373  
       
  2374  struct ibv_pd {
       
  2375 @@ -305,6 +324,10 @@
       
  2376  	uint32_t		handle;
       
  2377  };
       
  2378  
       
  2379 +struct ibv_shpd {
       
  2380 +	uint32_t		handle;
       
  2381 +};
       
  2382 +
       
  2383  enum ibv_rereg_mr_flags {
       
  2384  	IBV_REREG_MR_CHANGE_TRANSLATION	= (1 << 0),
       
  2385  	IBV_REREG_MR_CHANGE_PD		= (1 << 1),
       
  2386 @@ -360,7 +383,15 @@
       
  2387  	IBV_RATE_40_GBPS  = 7,
       
  2388  	IBV_RATE_60_GBPS  = 8,
       
  2389  	IBV_RATE_80_GBPS  = 9,
       
  2390 -	IBV_RATE_120_GBPS = 10
       
  2391 +	IBV_RATE_120_GBPS = 10,
       
  2392 +	IBV_RATE_14_GBPS  = 11,
       
  2393 +	IBV_RATE_56_GBPS  = 12,
       
  2394 +	IBV_RATE_112_GBPS = 13,
       
  2395 +	IBV_RATE_168_GBPS = 14,
       
  2396 +	IBV_RATE_25_GBPS  = 15,
       
  2397 +	IBV_RATE_100_GBPS = 16,
       
  2398 +	IBV_RATE_200_GBPS = 17,
       
  2399 +	IBV_RATE_300_GBPS = 18
       
  2400  };
       
  2401  
       
  2402  /**
       
  2403 @@ -377,6 +408,20 @@
       
  2404   */
       
  2405  enum ibv_rate mult_to_ibv_rate(int mult) __attribute_const;
       
  2406  
       
  2407 +/**
       
  2408 + * ibv_rate_to_mbps - Convert the IB rate enum to Mbit/sec.
       
  2409 + * For example, IBV_RATE_5_GBPS will return the value 5000.
       
  2410 + * @rate: rate to convert.
       
  2411 + */
       
  2412 +int ibv_rate_to_mbps(enum ibv_rate rate) __attribute_const;
       
  2413 +
       
  2414 +/**
       
  2415 + * mbps_to_ibv_rate - Convert a Mbit/sec value to an IB rate enum.
       
  2416 + * @mbps: value to convert.
       
  2417 + */
       
  2418 +enum ibv_rate mbps_to_ibv_rate(int mbps) __attribute_const;
       
  2419 +
       
  2420 +
       
  2421  struct ibv_ah_attr {
       
  2422  	struct ibv_global_route	grh;
       
  2423  	uint16_t		dlid;
       
  2424 @@ -425,6 +470,14 @@
       
  2425  	uint32_t		max_inline_data;
       
  2426  };
       
  2427  
       
  2428 +#if defined(__SVR4) && defined(__sun)
       
  2429 +/*
       
  2430 + * The 31st bit of sq_sig_all is set for QPs allocated
       
  2431 + * using librdmacm. Consumers use sq_sig_all 0 /1.
       
  2432 + */
       
  2433 +#define LIB_RDMACM_QP_BIT	0x8000
       
  2434 +#endif
       
  2435 +
       
  2436  struct ibv_qp_init_attr {
       
  2437  	void		       *qp_context;
       
  2438  	struct ibv_cq	       *send_cq;
       
  2439 @@ -659,6 +712,7 @@
       
  2440  	char			dev_path[IBV_SYSFS_PATH_MAX];
       
  2441  	/* Path to infiniband class device in sysfs */
       
  2442  	char			ibdev_path[IBV_SYSFS_PATH_MAX];
       
  2443 +	uint			blueflame_enabled;
       
  2444  };
       
  2445  
       
  2446  struct ibv_more_ops {
       
  2447 @@ -743,6 +797,12 @@
       
  2448  	int			(*detach_mcast)(struct ibv_qp *qp, const union ibv_gid *gid,
       
  2449  						uint16_t lid);
       
  2450  	void			(*async_event)(struct ibv_async_event *event);
       
  2451 +	struct ibv_mr *		(*reg_mr_relaxed)(struct ibv_pd *pd, void *addr, size_t length,
       
  2452 +					  int access);
       
  2453 +	int			(*dereg_mr_relaxed)(struct ibv_mr *mr);
       
  2454 +	int			(*flush_relaxed_mr)(struct ibv_pd *pd);
       
  2455 +	struct ibv_shpd *	(*alloc_shpd)(struct ibv_pd *pd, uint64_t share_key, struct ibv_shpd *shpd);
       
  2456 +	struct ibv_pd *		(*share_pd)(struct ibv_context *context, struct ibv_shpd *shpd, uint64_t share_key);
       
  2457  };
       
  2458  
       
  2459  struct ibv_context {
       
  2460 @@ -749,6 +809,13 @@
       
  2461  	struct ibv_device      *device;
       
  2462  	struct ibv_context_ops	ops;
       
  2463  	int			cmd_fd;
       
  2464 +#if defined(__SVR4) && defined(__sun)
       
  2465 +	/*
       
  2466 +	 * Solaris user libraries use this FD for mmap operations. It is an
       
  2467 +	 * open to the underlying kernel hardware specific driver.
       
  2468 +	 */
       
  2469 +	int			mmap_fd;
       
  2470 +#endif
       
  2471  	int			async_fd;
       
  2472  	int			num_comp_vectors;
       
  2473  	pthread_mutex_t		mutex;
       
  2474 @@ -797,6 +864,11 @@
       
  2475  uint64_t ibv_get_device_guid(struct ibv_device *device);
       
  2476  
       
  2477  /**
       
  2478 + * ibv_get_device_guid_external - Return device's node external GUID
       
  2479 + */
       
  2480 +uint64_t ibv_get_device_guid_external(struct ibv_device *device);
       
  2481 +
       
  2482 +/**
       
  2483   * ibv_open_device - Initialize device for use
       
  2484   */
       
  2485  struct ibv_context *ibv_open_device(struct ibv_device *device);
       
  2486 @@ -853,11 +925,44 @@
       
  2487  		   int index, uint16_t *pkey);
       
  2488  
       
  2489  /**
       
  2490 + * ibv_register_sm_events - Register subnet event for GID change
       
  2491 + */
       
  2492 +int ibv_register_sm_events(struct ibv_context *context,
       
  2493 +    ibv_sm_event_type_t event, uint_t gid_num, union ibv_gid *gids);
       
  2494 +
       
  2495 +/**
       
  2496 + * ibv_unregister_sm_events - Unregister subnet event for GID change
       
  2497 + */
       
  2498 +int ibv_unregister_sm_events(struct ibv_context *context,
       
  2499 +    ibv_sm_event_type_t event, uint_t gid_num, union ibv_gid *gids);
       
  2500 +
       
  2501 +/**
       
  2502 + * ibv_gid_reachable - To contact subnet agent for GID status; reachable or
       
  2503 + * not reachable
       
  2504 + */
       
  2505 +int ibv_gid_reachable(struct ibv_context *context,
       
  2506 +    uint port, union ibv_gid *gid_p, int timeout);
       
  2507 +
       
  2508 +/**
       
  2509   * ibv_alloc_pd - Allocate a protection domain
       
  2510   */
       
  2511  struct ibv_pd *ibv_alloc_pd(struct ibv_context *context);
       
  2512  
       
  2513  /**
       
  2514 + * ibv_alloc_shpd - Mark given protection domain as shareable & return shpd structure
       
  2515 + *                  that identify it.
       
  2516 + *                  the storage for shpd structure needs to be provided by client.
       
  2517 + */
       
  2518 +struct ibv_shpd *ibv_alloc_shpd(struct ibv_pd *pd, uint64_t share_key, struct ibv_shpd *shpd);
       
  2519 +
       
  2520 +/**
       
  2521 + * ibv_share_pd - share the protection domain identified by given shpd struct & return a
       
  2522 + *                process linked ibv_pd struct.
       
  2523 + *                the share_key given should match with the share_key specifed in alloc_shpd().
       
  2524 + */
       
  2525 +struct ibv_pd *ibv_share_pd(struct ibv_context *context, struct ibv_shpd *shpd, uint64_t share_key);
       
  2526 +
       
  2527 +/**
       
  2528   * ibv_dealloc_pd - Free a protection domain
       
  2529   */
       
  2530  int ibv_dealloc_pd(struct ibv_pd *pd);
       
  2531 @@ -869,11 +974,27 @@
       
  2532  			  size_t length, int access);
       
  2533  
       
  2534  /**
       
  2535 + * ibv_reg_mr_relaxed - Register a memory region using FMR
       
  2536 + */
       
  2537 +struct ibv_mr *ibv_reg_mr_relaxed(struct ibv_pd *pd, void *addr,
       
  2538 +			  size_t length, int access);
       
  2539 +
       
  2540 +/**
       
  2541   * ibv_dereg_mr - Deregister a memory region
       
  2542   */
       
  2543  int ibv_dereg_mr(struct ibv_mr *mr);
       
  2544  
       
  2545  /**
       
  2546 + * ibv_dereg_mr_relaxed - Deregister a memory region registered using FMR
       
  2547 + */
       
  2548 +int ibv_dereg_mr_relaxed(struct ibv_mr *mr);
       
  2549 +
       
  2550 +/**
       
  2551 + * ibv_flush_relaxed_mr - Flush all free mr's in the protection domain
       
  2552 + */
       
  2553 +int ibv_flush_relaxed_mr(struct ibv_pd *pd);
       
  2554 +
       
  2555 +/**
       
  2556   * ibv_create_comp_channel - Create a completion event channel
       
  2557   */
       
  2558  struct ibv_comp_channel *ibv_create_comp_channel(struct ibv_context *context);
       
  2559 diff -r -u /tmp/846623/libibverbs-1.1.4/include/infiniband/arch.h libibverbs-1.1.4/include/infiniband/arch.h
       
  2560 --- /tmp/846623/libibverbs-1.1.4/include/infiniband/arch.h	Wed Sep 16 04:27:22 2009
       
  2561 +++ libibverbs-1.1.4/include/infiniband/arch.h	Fri Feb 11 04:02:20 2011
       
  2562 @@ -34,6 +34,7 @@
       
  2563  #define INFINIBAND_ARCH_H
       
  2564  
       
  2565  #include <stdint.h>
       
  2566 +#if !(defined(__SVR4) && defined(__sun))
       
  2567  #include <endian.h>
       
  2568  #include <byteswap.h>
       
  2569  
       
  2570 @@ -46,6 +47,9 @@
       
  2571  #else
       
  2572  #error __BYTE_ORDER is neither __LITTLE_ENDIAN nor __BIG_ENDIAN
       
  2573  #endif
       
  2574 +#else
       
  2575 +#include <infiniband/ofa_solaris.h>
       
  2576 +#endif
       
  2577  
       
  2578  /*
       
  2579   * Architecture-specific defines.  Currently, an architecture is
       
  2580 diff -r -u /tmp/846623/libibverbs-1.1.4/Makefile.in libibverbs-1.1.4/Makefile.in
       
  2581 --- /tmp/846623/libibverbs-1.1.4/Makefile.in	Thu Feb  3 01:53:23 2011
       
  2582 +++ libibverbs-1.1.4/Makefile.in	Fri Feb 11 05:27:45 2011
       
  2583 @@ -90,7 +90,8 @@
       
  2584  	src_libibverbs_la-compat-1_0.lo src_libibverbs_la-device.lo \
       
  2585  	src_libibverbs_la-init.lo src_libibverbs_la-marshall.lo \
       
  2586  	src_libibverbs_la-memory.lo src_libibverbs_la-sysfs.lo \
       
  2587 -	src_libibverbs_la-verbs.lo src_libibverbs_la-enum_strs.lo
       
  2588 +	src_libibverbs_la-verbs.lo src_libibverbs_la-enum_strs.lo \
       
  2589 +	src_libibverbs_la-solaris.lo
       
  2590  src_libibverbs_la_OBJECTS = $(am_src_libibverbs_la_OBJECTS)
       
  2591  AM_V_lt = $(am__v_lt_$(V))
       
  2592  am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
       
  2593 @@ -313,11 +314,11 @@
       
  2594  INCLUDES = -I$(srcdir)/include
       
  2595  lib_LTLIBRARIES = src/libibverbs.la
       
  2596  AM_CFLAGS = -g -Wall -D_GNU_SOURCE
       
  2597 -src_libibverbs_la_CFLAGS = $(AM_CFLAGS) -DIBV_CONFIG_DIR=\"$(sysconfdir)/libibverbs.d\"
       
  2598 +src_libibverbs_la_CFLAGS = $(AM_CFLAGS) -DIBV_CONFIG_DIR=\"$(datadir)/libibverbs.d\"
       
  2599  libibverbs_version_script = @LIBIBVERBS_VERSION_SCRIPT@
       
  2600  src_libibverbs_la_SOURCES = src/cmd.c src/compat-1_0.c src/device.c src/init.c \
       
  2601  			    src/marshall.c src/memory.c src/sysfs.c src/verbs.c \
       
  2602 -			    src/enum_strs.c
       
  2603 +			    src/enum_strs.c src/solaris_compatability src/verbs.c
       
  2604  
       
  2605  src_libibverbs_la_LDFLAGS = -version-info 1 -export-dynamic \
       
  2606      $(libibverbs_version_script)
       
  2607 @@ -340,6 +341,7 @@
       
  2608  libibverbsincludedir = $(includedir)/infiniband
       
  2609  libibverbsinclude_HEADERS = include/infiniband/arch.h include/infiniband/driver.h \
       
  2610      include/infiniband/kern-abi.h include/infiniband/opcode.h include/infiniband/verbs.h \
       
  2611 +	include/infiniband/ofa_solaris.h \
       
  2612      include/infiniband/sa-kern-abi.h include/infiniband/sa.h include/infiniband/marshall.h
       
  2613  
       
  2614  man_MANS = man/ibv_asyncwatch.1 man/ibv_devices.1 man/ibv_devinfo.1	\
       
  2615 @@ -368,6 +370,7 @@
       
  2616  
       
  2617  EXTRA_DIST = include/infiniband/driver.h include/infiniband/kern-abi.h \
       
  2618      include/infiniband/opcode.h include/infiniband/verbs.h include/infiniband/marshall.h \
       
  2619 +	 include/infiniband/ofa_solaris.h \
       
  2620      include/infiniband/sa-kern-abi.h include/infiniband/sa.h \
       
  2621      src/ibverbs.h examples/pingpong.h \
       
  2622      src/libibverbs.map libibverbs.spec.in $(man_MANS)
       
  2623 @@ -440,8 +443,8 @@
       
  2624  	  else :; fi; \
       
  2625  	done; \
       
  2626  	test -z "$$list2" || { \
       
  2627 -	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
       
  2628 -	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
       
  2629 +	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) -m 755 $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
       
  2630 +	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) -m 755 $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
       
  2631  	}
       
  2632  
       
  2633  uninstall-libLTLIBRARIES:
       
  2634 @@ -486,8 +489,8 @@
       
  2635  	while read type dir files; do \
       
  2636  	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
       
  2637  	    test -z "$$files" || { \
       
  2638 -	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
       
  2639 -	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
       
  2640 +	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) -m 755 $$files '$(DESTDIR)$(bindir)$$dir'"; \
       
  2641 +	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) -m 755 $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
       
  2642  	    } \
       
  2643  	; done
       
  2644  
       
  2645 @@ -554,6 +557,7 @@
       
  2646  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/src_libibverbs_la-memory.Plo@am__quote@
       
  2647  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/src_libibverbs_la-sysfs.Plo@am__quote@
       
  2648  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/src_libibverbs_la-verbs.Plo@am__quote@
       
  2649 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/src_libibverbs_la-solaris.Plo@am__quote@
       
  2650  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/srq_pingpong.Po@am__quote@
       
  2651  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uc_pingpong.Po@am__quote@
       
  2652  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ud_pingpong.Po@am__quote@
       
  2653 @@ -654,6 +658,14 @@
       
  2654  @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
       
  2655  @am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_libibverbs_la_CFLAGS) $(CFLAGS) -c -o src_libibverbs_la-enum_strs.lo `test -f 'src/enum_strs.c' || echo '$(srcdir)/'`src/enum_strs.c
       
  2656  
       
  2657 +src_libibverbs_la-solaris.lo: src/solaris_compatibility.c
       
  2658 +@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_libibverbs_la_CFLAGS) $(CFLAGS) -MT src_libibverbs_la-solaris.lo -MD -MP -MF $(DEPDIR)/src_libibverbs_la-solaris.Tpo -c -o src_libibverbs_la-solaris.lo `test -f 'src/solaris_compatibility.c' || echo '$(srcdir)/'`src/solaris_compatibility.c
       
  2659 +@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/src_libibverbs_la-solaris.Tpo $(DEPDIR)/src_libibverbs_la-solaris.Plo
       
  2660 +@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
       
  2661 +@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/solaris_compatibility.c' object='src_libibverbs_la-solaris.lo' libtool=yes @AMDEPBACKSLASH@
       
  2662 +@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
       
  2663 +@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_libibverbs_la_CFLAGS) $(CFLAGS) -c -o src_libibverbs_la-solaris.lo `test -f 'src/solaris_compatibility.c' || echo '$(srcdir)/'`src/solaris_compatibility.c
       
  2664 +
       
  2665  asyncwatch.o: examples/asyncwatch.c
       
  2666  @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT asyncwatch.o -MD -MP -MF $(DEPDIR)/asyncwatch.Tpo -c -o asyncwatch.o `test -f 'examples/asyncwatch.c' || echo '$(srcdir)/'`examples/asyncwatch.c
       
  2667  @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/asyncwatch.Tpo $(DEPDIR)/asyncwatch.Po
       
  2668 @@ -669,7 +681,6 @@
       
  2669  @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='examples/asyncwatch.c' object='asyncwatch.obj' libtool=no @AMDEPBACKSLASH@
       
  2670  @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
       
  2671  @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o asyncwatch.obj `if test -f 'examples/asyncwatch.c'; then $(CYGPATH_W) 'examples/asyncwatch.c'; else $(CYGPATH_W) '$(srcdir)/examples/asyncwatch.c'; fi`
       
  2672 -
       
  2673  device_list.o: examples/device_list.c
       
  2674  @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT device_list.o -MD -MP -MF $(DEPDIR)/device_list.Tpo -c -o device_list.o `test -f 'examples/device_list.c' || echo '$(srcdir)/'`examples/device_list.c
       
  2675  @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/device_list.Tpo $(DEPDIR)/device_list.Po
       
  2676 diff -r -u /tmp/846623/libibverbs-1.1.4/examples/uc_pingpong.c libibverbs-1.1.4/examples/uc_pingpong.c
       
  2677 --- /tmp/846623/libibverbs-1.1.4/examples/uc_pingpong.c	Thu Mar 10 06:58:21 2011
       
  2678 +++ libibverbs-1.1.4/examples/uc_pingpong.c	Tue Jan  6 10:05:55 2015
       
  2679 @@ -144,7 +144,7 @@
       
  2680  
       
  2681  	n = getaddrinfo(servername, service, &hints, &res);
       
  2682  
       
  2683 -	if (n < 0) {
       
  2684 +	if (n != 0) {
       
  2685  		fprintf(stderr, "%s for %s:%d\n", gai_strerror(n), servername, port);
       
  2686  		free(service);
       
  2687  		return NULL;
       
  2688 @@ -219,7 +219,7 @@
       
  2689  
       
  2690  	n = getaddrinfo(NULL, service, &hints, &res);
       
  2691  
       
  2692 -	if (n < 0) {
       
  2693 +	if (n != 0) {
       
  2694  		fprintf(stderr, "%s for port %d\n", gai_strerror(n), port);
       
  2695  		free(service);
       
  2696  		return NULL;
       
  2697 diff -r -u /tmp/846623/libibverbs-1.1.4/examples/asyncwatch.c libibverbs-1.1.4/examples/asyncwatch.c
       
  2698 --- /tmp/846623/libibverbs-1.1.4/examples/asyncwatch.c	Thu Mar 10 06:58:21 2011
       
  2699 +++ libibverbs-1.1.4/examples/asyncwatch.c	Fri Feb 11 04:02:18 2011
       
  2700 @@ -35,11 +35,72 @@
       
  2701  #endif /* HAVE_CONFIG_H */
       
  2702  
       
  2703  #include <stdio.h>
       
  2704 +#include <stdlib.h>
       
  2705 +#include <ctype.h>
       
  2706 +#include <getopt.h>
       
  2707 +#include <signal.h>
       
  2708 +#include <string.h>
       
  2709 +#include <strings.h>
       
  2710 +#if !(defined(__SVR4) && defined(__sun))
       
  2711  #include <endian.h>
       
  2712  #include <byteswap.h>
       
  2713 +#endif
       
  2714  
       
  2715  #include <infiniband/verbs.h>
       
  2716  
       
  2717 +#define IS_PORT_EVENT(event)				\
       
  2718 +	((event == IBV_EVENT_PORT_ACTIVE) ||		\
       
  2719 +	(event == IBV_EVENT_PORT_ERR ) ||		\
       
  2720 +	(event == IBV_EVENT_LID_CHANGE) ||		\
       
  2721 +	(event == IBV_EVENT_PKEY_CHANGE) ||		\
       
  2722 +	(event == IBV_EVENT_SM_CHANGE) ||		\
       
  2723 +	(event == IBV_EVENT_GID_CHANGE) ||		\
       
  2724 +	(event == IBV_EVENT_CLIENT_REREGISTER))
       
  2725 +
       
  2726 +#define IS_SM_EVENT(event)				\
       
  2727 +	((event == IBV_EVENT_MCG_CREATED) ||		\
       
  2728 +	(event == IBV_EVENT_MCG_DELETED) ||		\
       
  2729 +	(event == IBV_EVENT_GID_AVAIL) ||		\
       
  2730 +	(event == IBV_EVENT_GID_UNAVAIL))
       
  2731 +
       
  2732 +#define IS_QP_EVENT(event)				\
       
  2733 +	((event == IBV_EVENT_CQ_ERR) ||			\
       
  2734 +	(event == IBV_EVENT_QP_FATAL) ||		\
       
  2735 +	(event == IBV_EVENT_QP_REQ_ERR) ||		\
       
  2736 +	(event == IBV_EVENT_COMM_EST) ||		\
       
  2737 +	(event == IBV_EVENT_SQ_DRAINED) ||		\
       
  2738 +	(event == IBV_EVENT_PATH_MIG) ||		\
       
  2739 +	(event == IBV_EVENT_PATH_MIG_ERR) ||		\
       
  2740 +	(event == IBV_EVENT_QP_LAST_WQE_REACHED) ||	\
       
  2741 +	(event == IBV_EVENT_QP_ACCESS_ERR))
       
  2742 +
       
  2743 +#define IS_CQ_EVENT(event)				\
       
  2744 +	(event == IBV_EVENT_CQ_ERR)
       
  2745 +
       
  2746 +#define IS_SRQ_EVENT(event)				\
       
  2747 +	((event == IBV_EVENT_SRQ_ERR) ||		\
       
  2748 +	(event == IBV_EVENT_SRQ_LIMIT_REACHED))
       
  2749 +
       
  2750 +#define IS_CA_EVENT(event)				\
       
  2751 +	(event == IBV_EVENT_DEVICE_FATAL)
       
  2752 +
       
  2753 +
       
  2754 +struct ibv_device	**dev_list;
       
  2755 +struct ibv_context	*context;
       
  2756 +struct ibv_async_event	event;
       
  2757 +union ibv_gid		*gids = NULL;
       
  2758 +uint_t			num_gids = 0;
       
  2759 +ibv_sm_event_type_t	events;
       
  2760 +
       
  2761 +static struct option long_options[] = {
       
  2762 +    {"sm",		0, 0, 's'},
       
  2763 +    {"GUID",		0, 0, 'G'},
       
  2764 +    {"MCG",		0, 0, 'M'},
       
  2765 +    {"port",		1, 0, 'p'},
       
  2766 +    {0, 0, 0, 0}
       
  2767 +};
       
  2768 +
       
  2769 +
       
  2770  static const char *event_name_str(enum ibv_event_type event_type)
       
  2771  {
       
  2772  	switch (event_type) {
       
  2773 @@ -59,7 +120,14 @@
       
  2774  		return "IBV_EVENT_CLIENT_REREGISTER";
       
  2775  	case IBV_EVENT_GID_CHANGE:
       
  2776  		return "IBV_EVENT_GID_CHANGE";
       
  2777 -
       
  2778 +	case IBV_EVENT_MCG_CREATED:
       
  2779 +		return "IBV_EVENT_MCG_CREATED";
       
  2780 +	case IBV_EVENT_MCG_DELETED:
       
  2781 +		return "IBV_EVENT_MCG_DELETED";
       
  2782 +	case IBV_EVENT_GID_AVAIL:
       
  2783 +		return "IBV_EVENT_GID_AVAIL";
       
  2784 +	case IBV_EVENT_GID_UNAVAIL:
       
  2785 +		return "IBV_EVENT_GID_UNAVAIL";
       
  2786  	case IBV_EVENT_CQ_ERR:
       
  2787  	case IBV_EVENT_QP_FATAL:
       
  2788  	case IBV_EVENT_QP_REQ_ERR:
       
  2789 @@ -76,15 +144,173 @@
       
  2790  	}
       
  2791  }
       
  2792  
       
  2793 -int main(int argc, char *argv[])
       
  2794 +static void catch_signal(int sig_num)
       
  2795  {
       
  2796 -	struct ibv_device **dev_list;
       
  2797 -	struct ibv_context *context;
       
  2798 -	struct ibv_async_event event;
       
  2799 +	ibv_unregister_sm_events(context, events, num_gids, gids);
       
  2800 +	if (gids)
       
  2801 +		free(gids);
       
  2802 +	ibv_close_device(context);
       
  2803 +	(void) ibv_free_device_list(dev_list);
       
  2804 +	exit (0);
       
  2805 +}
       
  2806  
       
  2807 -	/* Force line-buffering in case stdout is redirected */
       
  2808 -	setvbuf(stdout, NULL, _IOLBF, 0);
       
  2809 +static void usage(const char *argv0)
       
  2810 +{
       
  2811 +	printf("Usage:\n");
       
  2812 +	printf("\n");
       
  2813 +	printf("Options:\n");
       
  2814 +	printf("[ -s, --sm<gid> ]\t\tsm event\n");
       
  2815 +	printf("[ -M, --M ]\t\t\tsm event for MGID (multicast)\n");
       
  2816 +	printf("[ -G, --G ]\t\t\tsm event for UGID (unicast)\n");
       
  2817 +	printf("[ -p, --port=<port> ]\t\t(default 1)\n");
       
  2818 +	printf("\nExamples;\n");
       
  2819 +	printf("ibv_asyncwatch -s\t\t# monitor event=IBV_SM_EVENT_ALL\n");
       
  2820 +	printf("ibv_asyncwatch -G -s\t\t# monitor event="
       
  2821 +	    "IBV_SM_EVENT_UGID_ALL\n");
       
  2822 +	printf("ibv_asyncwatch -M -s\t\t# monitor event="
       
  2823 +	    "IBV_SM_EVENT_MGID_ALL\n");
       
  2824 +	printf("ibv_asyncwatch -G -s0x0021280001a0e4d9,0x0021280001a0e4da\n");
       
  2825 +	printf("\t\t\t\t# monitor event=IBV_SM_EVENT_UGID\n");
       
  2826 +	printf("ibv_asyncwatch -M -s0xff12:4001:ffff::c:2238,");
       
  2827 +	printf("0xff12:ffff::38:220c\n");
       
  2828 +	printf("\t\t\t\t# monitor event=IBV_SM_EVENT_MGID\n");
       
  2829 +}
       
  2830  
       
  2831 +
       
  2832 +uint_t get_gids(char *argptr, uint64_t subnet_prefix)
       
  2833 +{
       
  2834 +	char		*curr, *next;
       
  2835 +	char		*guid_str_p1, *guid_str_p2 = NULL;
       
  2836 +	int		i = 0;
       
  2837 +	int		data_num;
       
  2838 +
       
  2839 +	for (curr = argptr; curr; curr = next, i++) {
       
  2840 +		next = strchr(curr, ',');
       
  2841 +		if (next)
       
  2842 +			next++;
       
  2843 +        }
       
  2844 +	data_num = i;
       
  2845 +	if (data_num == 0)
       
  2846 +		return (0);
       
  2847 +
       
  2848 +	gids = (union ibv_gid *)calloc(data_num, sizeof (union ibv_gid));
       
  2849 +	guid_str_p1 = malloc(strlen(argptr));
       
  2850 +	strncpy(guid_str_p1, argptr, strlen(argptr));
       
  2851 +
       
  2852 +	i = 0;
       
  2853 +	guid_str_p2 = strtok(guid_str_p1, (const char *)",");
       
  2854 +	while (guid_str_p2 != NULL) {
       
  2855 +		gids[i].global.subnet_prefix = subnet_prefix;
       
  2856 +		gids[i].global.interface_id =
       
  2857 +		    htonll((uint64_t)strtoull(guid_str_p2, 0, 0));
       
  2858 +		i++;
       
  2859 +		guid_str_p2 = strtok(NULL, (const char *)",");
       
  2860 +	}
       
  2861 +	free (guid_str_p1);
       
  2862 +	return (data_num);
       
  2863 +}
       
  2864 +
       
  2865 +void process_one_mcg_gid(union ibv_gid *gid, char *mcg_str)
       
  2866 +{
       
  2867 +	char		*token, *token_p, half_token[3];
       
  2868 +	uint8_t		mcg_gid[16];
       
  2869 +	int		i, j = 0, num_data = -1;
       
  2870 +	char		*curr, *next;
       
  2871 +
       
  2872 +	/* find out how many two-byte data from command line input */
       
  2873 +	for (curr = mcg_str; curr; curr = next, num_data++) {
       
  2874 +		next = strchr(curr, ':');
       
  2875 +		if (next)
       
  2876 +			next++;
       
  2877 +        }
       
  2878 +
       
  2879 +	if (num_data > 8) {
       
  2880 +		fprintf(stderr, "Invalid MGID input format: %s\n", mcg_str);
       
  2881 +		exit (-1);
       
  2882 +	}
       
  2883 +
       
  2884 +	curr = mcg_str + 2;	/* Skip past 0x */
       
  2885 +	while ((token = strsep(&curr, ":")) != NULL && j < 15) {
       
  2886 +		if (strncmp(token, "\0", 1) == 0) {
       
  2887 +			/* We have :: in the input */
       
  2888 +			for (i = 0; i < 8 - num_data; i++) {
       
  2889 +				mcg_gid[j++] = 0;
       
  2890 +				mcg_gid[j++] = 0;
       
  2891 +			}
       
  2892 +		} else {
       
  2893 +			if (strlen(token) < 3) {
       
  2894 +				mcg_gid[j++] = 0;
       
  2895 +				mcg_gid[j++] =
       
  2896 +				    (uint8_t)strtoll(token, NULL, 16);
       
  2897 +			} else {
       
  2898 +				memset(half_token, 0, 3);
       
  2899 +				token_p = token;
       
  2900 +				if (strlen(token) == 3) {
       
  2901 +					strncpy(half_token, token, 1);
       
  2902 +					token_p += 1;
       
  2903 +				} else {
       
  2904 +					strncpy(half_token, token, 2);
       
  2905 +					token_p += 2;
       
  2906 +				}
       
  2907 +				mcg_gid[j++] = (uint8_t)strtol(half_token,
       
  2908 +				    NULL, 16);
       
  2909 +
       
  2910 +				mcg_gid[j++] = (uint8_t)strtol(token_p,
       
  2911 +				    NULL, 16);
       
  2912 +			}
       
  2913 +		}
       
  2914 +	}
       
  2915 +
       
  2916 +	memcpy(gid->raw, mcg_gid, 16);
       
  2917 +}
       
  2918 +
       
  2919 +uint_t get_mcgs(char *argptr, uint64_t subnet_prefix)
       
  2920 +{
       
  2921 +	char            *curr, *next;
       
  2922 +	char		*mcg_str_p1, *mcg_str_p2 = NULL;
       
  2923 +	int		i = 0;
       
  2924 +	int		data_num;
       
  2925 +
       
  2926 +	for (curr = argptr; curr; curr = next, i++) {
       
  2927 +		next = strchr(curr, ',');
       
  2928 +		if (next)
       
  2929 +			next++;
       
  2930 +        }
       
  2931 +	data_num = i;
       
  2932 +	if (data_num == 0)
       
  2933 +		return (0);
       
  2934 +
       
  2935 +	gids = (union ibv_gid *)calloc(data_num, sizeof (union ibv_gid));
       
  2936 +	mcg_str_p1 = malloc(strlen(argptr));
       
  2937 +	strncpy(mcg_str_p1, argptr, strlen(argptr));
       
  2938 +
       
  2939 +	i = 0;
       
  2940 +	mcg_str_p2 = strtok(mcg_str_p1, (const char *)",");
       
  2941 +	while (mcg_str_p2 != NULL) {
       
  2942 +		if (strncmp(mcg_str_p2, "0xff", 4) != 0) {
       
  2943 +			fprintf(stderr, "Invalid MGID input format: %s\n",
       
  2944 +			    mcg_str_p2);
       
  2945 +			exit (-1);
       
  2946 +		}
       
  2947 +		process_one_mcg_gid(&gids[i], mcg_str_p2);
       
  2948 +		i++;
       
  2949 +		mcg_str_p2 = strtok(NULL, (const char *)",");
       
  2950 +	}
       
  2951 +	free(mcg_str_p1);
       
  2952 +	return (data_num);
       
  2953 +}
       
  2954 +
       
  2955 +int main(int argc, char *argv[])
       
  2956 +{
       
  2957 +	int		c;
       
  2958 +	int		ret;
       
  2959 +	uint_t		port = 1;	/* default */
       
  2960 +	uint_t		do_sm_event_register = 0;
       
  2961 +	union ibv_gid	sgid;
       
  2962 +	uint64_t	subnet_prefix = 0ULL;
       
  2963 +	int		mcgflag = 0;
       
  2964 +	int		guidflag = 0;
       
  2965 +
       
  2966  	dev_list = ibv_get_device_list(NULL);
       
  2967  	if (!dev_list) {
       
  2968  		perror("Failed to get IB devices list");
       
  2969 @@ -103,19 +329,111 @@
       
  2970  		return 1;
       
  2971  	}
       
  2972  
       
  2973 -	printf("%s: async event FD %d\n",
       
  2974 +	printf("\n%s: async event FD %d\n\n",
       
  2975  	       ibv_get_device_name(*dev_list), context->async_fd);
       
  2976  
       
  2977 +	ibv_query_gid(context, port, 0, &sgid);
       
  2978 +	subnet_prefix = sgid.global.subnet_prefix;
       
  2979 +
       
  2980 +	while ((c = getopt_long(argc, argv, "p:GMs::t:", long_options, NULL))
       
  2981 +	    != -1) {
       
  2982 +		switch(c) {
       
  2983 +			case 'G':
       
  2984 +				guidflag = 1;
       
  2985 +				break;
       
  2986 +			case 'M':
       
  2987 +				mcgflag = 1;
       
  2988 +				break;
       
  2989 +			case 's':
       
  2990 +				do_sm_event_register = 1;
       
  2991 +				if (mcgflag == 1)
       
  2992 +					num_gids =
       
  2993 +					    get_mcgs(optarg, subnet_prefix);
       
  2994 +				else
       
  2995 +					num_gids =
       
  2996 +					    get_gids(optarg, subnet_prefix);
       
  2997 +				break;
       
  2998 +			case 'p':
       
  2999 +				port = strtol(optarg, NULL, 0);
       
  3000 +				ibv_query_gid(context, port, 0, &sgid);
       
  3001 +				subnet_prefix = sgid.global.subnet_prefix;
       
  3002 +				break;
       
  3003 +			default:
       
  3004 +				usage(argv[0]);
       
  3005 +				return 1;
       
  3006 +		}
       
  3007 +	}
       
  3008 +
       
  3009 +	/* Force line-buffering in case stdout is redirected */
       
  3010 +	setvbuf(stdout, NULL, _IOLBF, 0);
       
  3011 +
       
  3012 +	if (num_gids) {
       
  3013 +		if (mcgflag)
       
  3014 +			events = IBV_SM_EVENT_MGID;
       
  3015 +		else
       
  3016 +			events = IBV_SM_EVENT_UGID;
       
  3017 +	} else {
       
  3018 +		if (mcgflag && guidflag)
       
  3019 +			events = IBV_SM_EVENT_ALL;
       
  3020 +		else if (mcgflag)
       
  3021 +			events = IBV_SM_EVENT_MGID_ALL;
       
  3022 +		else if (guidflag)
       
  3023 +			events = IBV_SM_EVENT_UGID_ALL;
       
  3024 +		else
       
  3025 +			events = IBV_SM_EVENT_ALL;
       
  3026 +	}
       
  3027 +
       
  3028 +	if (do_sm_event_register)
       
  3029 +		ret = ibv_register_sm_events(context, events, num_gids, gids);
       
  3030 +
       
  3031 +	(void) signal(SIGINT, catch_signal);
       
  3032 +
       
  3033  	while (1) {
       
  3034  		if (ibv_get_async_event(context, &event))
       
  3035  			return 1;
       
  3036  
       
  3037 -		printf("  event_type %s (%d), port %d\n",
       
  3038 -		       event_name_str(event.event_type),
       
  3039 -		       event.event_type, event.element.port_num);
       
  3040 +		if (IS_PORT_EVENT(event.event_type))
       
  3041 +			printf("Event: %s (%d), port %d\n",
       
  3042 +			    event_name_str(event.event_type),
       
  3043 +			    event.event_type, event.element.port_num);
       
  3044 +		else if (IS_SM_EVENT(event.event_type))
       
  3045 +			printf("Event: %s (%d), gid " \
       
  3046 +			    "%02x%02x:%02x%02x:%02x%02x:%02x%02x:"\
       
  3047 +			    "%02x%02x:%02x%02x:%02x%02x:%02x%02x\n",
       
  3048 +			    event_name_str(event.event_type), event.event_type,
       
  3049 +			    event.element.gid.raw[0], event.element.gid.raw[1],
       
  3050 +			    event.element.gid.raw[2], event.element.gid.raw[3],
       
  3051 +			    event.element.gid.raw[4], event.element.gid.raw[5],
       
  3052 +			    event.element.gid.raw[6], event.element.gid.raw[7],
       
  3053 +			    event.element.gid.raw[8], event.element.gid.raw[9],
       
  3054 +			    event.element.gid.raw[10],
       
  3055 +			    event.element.gid.raw[11],
       
  3056 +			    event.element.gid.raw[12],
       
  3057 +			    event.element.gid.raw[13],
       
  3058 +			    event.element.gid.raw[14],
       
  3059 +			    event.element.gid.raw[15]);
       
  3060 +		else if (IS_QP_EVENT(event.event_type))
       
  3061 +			printf("Event: %s (%d) QPN %d\n",
       
  3062 +			    event_name_str(event.event_type), event.event_type,
       
  3063 +			    event.element.qp->qp_num);
       
  3064 +		else if (IS_CQ_EVENT(event.event_type))
       
  3065 +			printf("Event: %s (%d) CQE %d\n",
       
  3066 +			    event_name_str(event.event_type), event.event_type,
       
  3067 +			    event.element.cq->cqe);
       
  3068 +		else if (IS_SRQ_EVENT(event.event_type))
       
  3069 +			printf("Event: %s (%d) SRQ %d\n",
       
  3070 +			    event_name_str(event.event_type), event.event_type,
       
  3071 +			    event.element.srq->handle);
       
  3072 +		else
       
  3073 +			printf("Event: %s (%d)\n",
       
  3074 +			    event_name_str(event.event_type), event.event_type);
       
  3075  
       
  3076  		ibv_ack_async_event(&event);
       
  3077 -	}
       
  3078  
       
  3079 +		if (event.event_type == IBV_EVENT_GID_AVAIL) {
       
  3080 +			ret = ibv_gid_reachable(context, port,
       
  3081 +			    &event.element.gid, 0);
       
  3082 +		}
       
  3083 +	}
       
  3084  	return 0;
       
  3085  }
       
  3086 diff -r -u /tmp/846623/libibverbs-1.1.4/examples/srq_pingpong.c libibverbs-1.1.4/examples/srq_pingpong.c
       
  3087 --- /tmp/846623/libibverbs-1.1.4/examples/srq_pingpong.c	Thu Mar 10 06:58:21 2011
       
  3088 +++ libibverbs-1.1.4/examples/srq_pingpong.c	Wed Jun  8 09:46:34 2011
       
  3089 @@ -165,8 +165,13 @@
       
  3090  
       
  3091  	n = getaddrinfo(servername, service, &hints, &res);
       
  3092  
       
  3093 -	if (n < 0) {
       
  3094 -		fprintf(stderr, "%s for %s:%d\n", gai_strerror(n), servername, port);
       
  3095 +	if (n != 0) {
       
  3096 +		if (n == EAI_NONAME)
       
  3097 +			fprintf(stderr,
       
  3098 +			    "Name or service not known for %s:%d\n", servername, port);
       
  3099 +		else
       
  3100 +			fprintf(stderr,
       
  3101 +			    "%s for %s:%d\n", gai_strerror(n), servername, port);
       
  3102  		free(service);
       
  3103  		return NULL;
       
  3104  	}
       
  3105 @@ -253,7 +258,7 @@
       
  3106  
       
  3107  	n = getaddrinfo(NULL, service, &hints, &res);
       
  3108  
       
  3109 -	if (n < 0) {
       
  3110 +	if (n != 0) {
       
  3111  		fprintf(stderr, "%s for port %d\n", gai_strerror(n), port);
       
  3112  		free(service);
       
  3113  		return NULL;
       
  3114 diff -r -u /tmp/846623/libibverbs-1.1.4/examples/ud_pingpong.c libibverbs-1.1.4/examples/ud_pingpong.c
       
  3115 --- /tmp/846623/libibverbs-1.1.4/examples/ud_pingpong.c	Thu Mar 10 06:58:21 2011
       
  3116 +++ libibverbs-1.1.4/examples/ud_pingpong.c	Wed Jun  8 09:46:34 2011
       
  3117 @@ -143,8 +143,13 @@
       
  3118  
       
  3119  	n = getaddrinfo(servername, service, &hints, &res);
       
  3120  
       
  3121 -	if (n < 0) {
       
  3122 -		fprintf(stderr, "%s for %s:%d\n", gai_strerror(n), servername, port);
       
  3123 +	if (n != 0) {
       
  3124 +		if (n == EAI_NONAME)
       
  3125 +			fprintf(stderr,
       
  3126 +			    "Name or service not known for %s:%d\n", servername, port);
       
  3127 +		else
       
  3128 +			fprintf(stderr,
       
  3129 +			    "%s for %s:%d\n", gai_strerror(n), servername, port);
       
  3130  		free(service);
       
  3131  		return NULL;
       
  3132  	}
       
  3133 @@ -217,7 +222,7 @@
       
  3134  
       
  3135  	n = getaddrinfo(NULL, service, &hints, &res);
       
  3136  
       
  3137 -	if (n < 0) {
       
  3138 +	if (n != 0) {
       
  3139  		fprintf(stderr, "%s for port %d\n", gai_strerror(n), port);
       
  3140  		free(service);
       
  3141  		return NULL;
       
  3142 diff -r -u /tmp/846623/libibverbs-1.1.4/examples/rc_pingpong.c libibverbs-1.1.4/examples/rc_pingpong.c
       
  3143 --- /tmp/846623/libibverbs-1.1.4/examples/rc_pingpong.c	Thu Mar 10 06:58:21 2011
       
  3144 +++ libibverbs-1.1.4/examples/rc_pingpong.c	Wed Jun  8 09:46:34 2011
       
  3145 @@ -155,8 +155,13 @@
       
  3146  
       
  3147  	n = getaddrinfo(servername, service, &hints, &res);
       
  3148  
       
  3149 -	if (n < 0) {
       
  3150 -		fprintf(stderr, "%s for %s:%d\n", gai_strerror(n), servername, port);
       
  3151 +	if (n != 0) {
       
  3152 +		if (n == EAI_NONAME)
       
  3153 +			fprintf(stderr,
       
  3154 +			    "Name or service not known for %s:%d\n", servername, port);
       
  3155 +		else
       
  3156 +			fprintf(stderr,
       
  3157 +			    "%s for %s:%d\n", gai_strerror(n), servername, port);
       
  3158  		free(service);
       
  3159  		return NULL;
       
  3160  	}
       
  3161 @@ -230,7 +235,7 @@
       
  3162  
       
  3163  	n = getaddrinfo(NULL, service, &hints, &res);
       
  3164  
       
  3165 -	if (n < 0) {
       
  3166 +	if (n != 0) {
       
  3167  		fprintf(stderr, "%s for port %d\n", gai_strerror(n), port);
       
  3168  		free(service);
       
  3169  		return NULL;
       
  3170 diff -r -u /tmp/846623/libibverbs-1.1.4/examples/device_list.c libibverbs-1.1.4/examples/device_list.c
       
  3171 --- /tmp/846623/libibverbs-1.1.4/examples/device_list.c	Sun Nov  1 06:47:19 2009
       
  3172 +++ libibverbs-1.1.4/examples/device_list.c	Fri Feb 11 04:02:18 2011
       
  3173 @@ -36,16 +36,32 @@
       
  3174  
       
  3175  #include <stdio.h>
       
  3176  
       
  3177 +#if !(defined(__SVR4) && defined(__sun))
       
  3178  #include <endian.h>
       
  3179  #include <byteswap.h>
       
  3180 +#endif
       
  3181  
       
  3182 +#include <stdlib.h>
       
  3183 +#include <string.h>
       
  3184  #include <infiniband/verbs.h>
       
  3185  #include <infiniband/arch.h>
       
  3186  
       
  3187 +/*
       
  3188 + * Structure to hold the data printed by ibv_devices.
       
  3189 + */
       
  3190 +typedef struct dev_print_s {
       
  3191 +	char			name[24];
       
  3192 +	unsigned long long	guid;
       
  3193 +	uint8_t			is_pf;
       
  3194 +} dev_print_t;
       
  3195 +
       
  3196  int main(int argc, char *argv[])
       
  3197  {
       
  3198  	struct ibv_device **dev_list;
       
  3199  	int num_devices, i;
       
  3200 +	unsigned long long	guid_external;
       
  3201 +	dev_print_t	*dp;
       
  3202 +	int	print_col = 0;
       
  3203  
       
  3204  	dev_list = ibv_get_device_list(&num_devices);
       
  3205  	if (!dev_list) {
       
  3206 @@ -53,15 +69,45 @@
       
  3207  		return 1;
       
  3208  	}
       
  3209  
       
  3210 -	printf("    %-16s\t   node GUID\n", "device");
       
  3211 -	printf("    %-16s\t----------------\n", "------");
       
  3212 +	dp = (dev_print_t *)malloc(sizeof(dev_print_t) * num_devices);
       
  3213  
       
  3214 -	for (i = 0; i < num_devices; ++i) {
       
  3215 -		printf("    %-16s\t%016llx\n",
       
  3216 -		       ibv_get_device_name(dev_list[i]),
       
  3217 -		       (unsigned long long) ntohll(ibv_get_device_guid(dev_list[i])));
       
  3218 +	for (i = (num_devices - 1); i >= 0; --i) {
       
  3219 +		strcpy(dp[i].name, ibv_get_device_name(dev_list[i]));
       
  3220 +
       
  3221 +		dp[i].guid = (unsigned long long) ntohll(ibv_get_device_guid(dev_list[i]));
       
  3222 +		guid_external = (unsigned long long) ntohll(ibv_get_device_guid_external(dev_list[i]));
       
  3223 +		if (dp[i].guid != guid_external) {
       
  3224 +			print_col = 1;
       
  3225 +			dp[i].is_pf = 0;
       
  3226 +		} else
       
  3227 +			dp[i].is_pf = 1;
       
  3228  	}
       
  3229  
       
  3230 +	if (print_col) {
       
  3231 +		printf("    %-16s\t   node GUID\t        type\n", "device");
       
  3232 +		printf("    %-16s\t----------------\t----\n", "------");
       
  3233 +		/* First print PFs */
       
  3234 +		for (i = (num_devices - 1); i >= 0; --i) {
       
  3235 +			if (dp[i].is_pf)
       
  3236 +				printf("    %-16s\t%016llx\t %s\n",
       
  3237 +					dp[i].name, dp[i].guid, "PF");
       
  3238 +		}
       
  3239 +		/* print VFs */
       
  3240 +		for (i = (num_devices - 1); i >= 0; --i) {
       
  3241 +			if (!dp[i].is_pf)
       
  3242 +				printf("    %-16s\t%016llx\t %s\n",
       
  3243 +					dp[i].name, dp[i].guid, "VF");
       
  3244 +		}
       
  3245 +	} else {
       
  3246 +		printf("    %-16s\t   node GUID\n", "device");
       
  3247 +		printf("    %-16s\t----------------\n", "------");
       
  3248 +		for (i = (num_devices - 1); i >= 0; --i) {
       
  3249 +			printf("    %-16s\t%016llx\n",
       
  3250 +				dp[i].name, dp[i].guid);
       
  3251 +		}
       
  3252 +	}
       
  3253 +	free(dp);
       
  3254 +
       
  3255  	ibv_free_device_list(dev_list);
       
  3256  
       
  3257  	return 0;
       
  3258 diff -r -u /tmp/846623/libibverbs-1.1.4/examples/devinfo.c libibverbs-1.1.4/examples/devinfo.c
       
  3259 --- /tmp/846623/libibverbs-1.1.4/examples/devinfo.c	Thu Mar 10 06:58:21 2011
       
  3260 +++ libibverbs-1.1.4/examples/devinfo.c	Fri Feb 11 04:02:19 2011
       
  3261 @@ -41,8 +41,10 @@
       
  3262  #include <string.h>
       
  3263  #include <getopt.h>
       
  3264  #include <netinet/in.h>
       
  3265 +#if !(defined(__SVR4) && defined(__sun))
       
  3266  #include <endian.h>
       
  3267  #include <byteswap.h>
       
  3268 +#endif
       
  3269  
       
  3270  #include <infiniband/verbs.h>
       
  3271  #include <infiniband/driver.h>
       
  3272 @@ -140,6 +142,9 @@
       
  3273  	case 1:  return "2.5 Gbps";
       
  3274  	case 2:  return "5.0 Gbps";
       
  3275  	case 4:  return "10.0 Gbps";
       
  3276 +	case 8:  return "10.0 Gbps";
       
  3277 +	case 16: return "14.0 Gbps";
       
  3278 +	case 32: return "25.0 Gbps";
       
  3279  	default: return "invalid speed";
       
  3280  	}
       
  3281  }