1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved. 24 */ 25 26 /* 27 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 28 * Use is subject to license terms. 29 */ 30 31 /* 32 * 33 * MODULE: dat_api.c 34 * 35 * PURPOSE: DAT Provider and Consumer registry functions. 36 * 37 */ 38 39 #include "dat_osd.h" 40 #include <dat/dat_registry.h> 41 42 43 DAT_RETURN dat_set_consumer_context( 44 IN DAT_HANDLE dat_handle, 45 IN DAT_CONTEXT context) 46 { 47 if (DAT_BAD_HANDLE(dat_handle)) { 48 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE1)); 49 } 50 return DAT_SET_CONSUMER_CONTEXT(dat_handle, 51 context); 52 } 53 54 55 DAT_RETURN dat_get_consumer_context( 56 IN DAT_HANDLE dat_handle, 57 OUT DAT_CONTEXT *context) 58 { 59 if (DAT_BAD_HANDLE(dat_handle)) { 60 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE1)); 61 } 62 return DAT_GET_CONSUMER_CONTEXT(dat_handle, 63 context); 64 65 } 66 67 68 DAT_RETURN dat_get_handle_type( 69 IN DAT_HANDLE dat_handle, 70 OUT DAT_HANDLE_TYPE *type) 71 { 72 if (DAT_BAD_HANDLE(dat_handle)) { 73 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE1)); 74 } 75 return DAT_GET_HANDLE_TYPE(dat_handle, 76 type); 77 } 78 79 80 DAT_RETURN dat_cr_query( 81 IN DAT_CR_HANDLE cr_handle, 82 IN DAT_CR_PARAM_MASK cr_param_mask, 83 OUT DAT_CR_PARAM *cr_param) 84 { 85 if (DAT_BAD_HANDLE(cr_handle)) { 86 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CR)); 87 } 88 return DAT_CR_QUERY(cr_handle, 89 cr_param_mask, 90 cr_param); 91 } 92 93 94 DAT_RETURN dat_cr_accept( 95 IN DAT_CR_HANDLE cr_handle, 96 IN DAT_EP_HANDLE ep_handle, 97 IN DAT_COUNT private_data_size, 98 IN const DAT_PVOID private_data) 99 { 100 if (DAT_BAD_HANDLE(cr_handle)) { 101 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CR)); 102 } 103 return DAT_CR_ACCEPT(cr_handle, 104 ep_handle, 105 private_data_size, 106 private_data); 107 } 108 109 110 DAT_RETURN dat_cr_reject( 111 IN DAT_CR_HANDLE cr_handle) 112 { 113 if (DAT_BAD_HANDLE(cr_handle)) { 114 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CR)); 115 } 116 return (DAT_CR_REJECT(cr_handle)); 117 } 118 119 120 DAT_RETURN dat_evd_resize( 121 IN DAT_EVD_HANDLE evd_handle, 122 IN DAT_COUNT evd_min_qlen) 123 { 124 if (DAT_BAD_HANDLE(evd_handle)) { 125 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE1)); 126 } 127 return DAT_EVD_RESIZE(evd_handle, 128 evd_min_qlen); 129 } 130 131 132 DAT_RETURN dat_evd_post_se( 133 IN DAT_EVD_HANDLE evd_handle, 134 IN const DAT_EVENT *event) 135 { 136 if (DAT_BAD_HANDLE(evd_handle)) { 137 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE1)); 138 } 139 return DAT_EVD_POST_SE(evd_handle, 140 event); 141 } 142 143 144 DAT_RETURN dat_evd_dequeue( 145 IN DAT_EVD_HANDLE evd_handle, 146 OUT DAT_EVENT *event) 147 { 148 if (DAT_BAD_HANDLE(evd_handle)) { 149 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE1)); 150 } 151 return DAT_EVD_DEQUEUE(evd_handle, 152 event); 153 } 154 155 156 DAT_RETURN dat_evd_free( 157 IN DAT_EVD_HANDLE evd_handle) 158 { 159 if (DAT_BAD_HANDLE(evd_handle)) { 160 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE1)); 161 } 162 return (DAT_EVD_FREE(evd_handle)); 163 } 164 165 166 DAT_RETURN dat_ep_create( 167 IN DAT_IA_HANDLE ia_handle, 168 IN DAT_PZ_HANDLE pz_handle, 169 IN DAT_EVD_HANDLE recv_completion_evd_handle, 170 IN DAT_EVD_HANDLE request_completion_evd_handle, 171 IN DAT_EVD_HANDLE connect_evd_handle, 172 IN const DAT_EP_ATTR *ep_attributes, 173 OUT DAT_EP_HANDLE *ep_handle) 174 { 175 if (DAT_BAD_HANDLE(ia_handle)) { 176 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA)); 177 } 178 return DAT_EP_CREATE(ia_handle, 179 pz_handle, 180 recv_completion_evd_handle, 181 request_completion_evd_handle, 182 connect_evd_handle, 183 ep_attributes, 184 ep_handle); 185 } 186 187 188 DAT_RETURN dat_ep_query( 189 IN DAT_EP_HANDLE ep_handle, 190 IN DAT_EP_PARAM_MASK ep_param_mask, 191 OUT DAT_EP_PARAM *ep_param) 192 { 193 if (DAT_BAD_HANDLE(ep_handle)) { 194 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP)); 195 } 196 return DAT_EP_QUERY(ep_handle, 197 ep_param_mask, 198 ep_param); 199 } 200 201 202 DAT_RETURN dat_ep_modify( 203 IN DAT_EP_HANDLE ep_handle, 204 IN DAT_EP_PARAM_MASK ep_param_mask, 205 IN const DAT_EP_PARAM *ep_param) 206 { 207 if (DAT_BAD_HANDLE(ep_handle)) { 208 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP)); 209 } 210 return DAT_EP_MODIFY(ep_handle, 211 ep_param_mask, 212 ep_param); 213 } 214 215 216 DAT_RETURN dat_ep_connect( 217 IN DAT_EP_HANDLE ep_handle, 218 IN DAT_IA_ADDRESS_PTR remote_ia_address, 219 IN DAT_CONN_QUAL remote_conn_qual, 220 IN DAT_TIMEOUT timeout, 221 IN DAT_COUNT private_data_size, 222 IN const DAT_PVOID private_data, 223 IN DAT_QOS quality_of_service, 224 IN DAT_CONNECT_FLAGS connect_flags) 225 { 226 if (DAT_BAD_HANDLE(ep_handle)) { 227 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP)); 228 } 229 return DAT_EP_CONNECT(ep_handle, 230 remote_ia_address, 231 remote_conn_qual, 232 timeout, 233 private_data_size, 234 private_data, 235 quality_of_service, 236 connect_flags); 237 } 238 239 240 DAT_RETURN dat_ep_dup_connect( 241 IN DAT_EP_HANDLE ep_handle, 242 IN DAT_EP_HANDLE ep_dup_handle, 243 IN DAT_TIMEOUT timeout, 244 IN DAT_COUNT private_data_size, 245 IN const DAT_PVOID private_data, 246 IN DAT_QOS quality_of_service) 247 { 248 if (DAT_BAD_HANDLE(ep_handle)) { 249 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP)); 250 } 251 return DAT_EP_DUP_CONNECT(ep_handle, 252 ep_dup_handle, 253 timeout, 254 private_data_size, 255 private_data, 256 quality_of_service); 257 } 258 259 260 DAT_RETURN dat_ep_disconnect( 261 IN DAT_EP_HANDLE ep_handle, 262 IN DAT_CLOSE_FLAGS close_flags) 263 { 264 if (DAT_BAD_HANDLE(ep_handle)) { 265 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP)); 266 } 267 return DAT_EP_DISCONNECT(ep_handle, 268 close_flags); 269 } 270 271 272 DAT_RETURN dat_ep_post_send( 273 IN DAT_EP_HANDLE ep_handle, 274 IN DAT_COUNT num_segments, 275 IN DAT_LMR_TRIPLET *local_iov, 276 IN DAT_DTO_COOKIE user_cookie, 277 IN DAT_COMPLETION_FLAGS completion_flags) 278 { 279 if (DAT_BAD_HANDLE(ep_handle)) { 280 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP)); 281 } 282 return DAT_EP_POST_SEND(ep_handle, 283 num_segments, 284 local_iov, 285 user_cookie, 286 completion_flags); 287 } 288 289 290 DAT_RETURN dat_ep_post_recv( 291 IN DAT_EP_HANDLE ep_handle, 292 IN DAT_COUNT num_segments, 293 IN DAT_LMR_TRIPLET *local_iov, 294 IN DAT_DTO_COOKIE user_cookie, 295 IN DAT_COMPLETION_FLAGS completion_flags) 296 { 297 if (DAT_BAD_HANDLE(ep_handle)) { 298 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP)); 299 } 300 return DAT_EP_POST_RECV(ep_handle, 301 num_segments, 302 local_iov, 303 user_cookie, 304 completion_flags); 305 } 306 307 308 DAT_RETURN dat_ep_post_rdma_read( 309 IN DAT_EP_HANDLE ep_handle, 310 IN DAT_COUNT num_segments, 311 IN DAT_LMR_TRIPLET *local_iov, 312 IN DAT_DTO_COOKIE user_cookie, 313 IN const DAT_RMR_TRIPLET *remote_iov, 314 IN DAT_COMPLETION_FLAGS completion_flags) 315 { 316 if (DAT_BAD_HANDLE(ep_handle)) { 317 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP)); 318 } 319 return DAT_EP_POST_RDMA_READ(ep_handle, 320 num_segments, 321 local_iov, 322 user_cookie, 323 remote_iov, 324 completion_flags); 325 } 326 327 328 DAT_RETURN dat_ep_post_rdma_write( 329 IN DAT_EP_HANDLE ep_handle, 330 IN DAT_COUNT num_segments, 331 IN DAT_LMR_TRIPLET *local_iov, 332 IN DAT_DTO_COOKIE user_cookie, 333 IN const DAT_RMR_TRIPLET *remote_iov, 334 IN DAT_COMPLETION_FLAGS completion_flags) 335 { 336 if (DAT_BAD_HANDLE(ep_handle)) { 337 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP)); 338 } 339 return DAT_EP_POST_RDMA_WRITE(ep_handle, 340 num_segments, 341 local_iov, 342 user_cookie, 343 remote_iov, 344 completion_flags); 345 } 346 347 348 DAT_RETURN dat_ep_get_status( 349 IN DAT_EP_HANDLE ep_handle, 350 OUT DAT_EP_STATE *ep_state, 351 OUT DAT_BOOLEAN *recv_idle, 352 OUT DAT_BOOLEAN *request_idle) 353 { 354 if (DAT_BAD_HANDLE(ep_handle)) { 355 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP)); 356 } 357 return DAT_EP_GET_STATUS(ep_handle, 358 ep_state, 359 recv_idle, 360 request_idle); 361 } 362 363 364 DAT_RETURN dat_ep_free( 365 IN DAT_EP_HANDLE ep_handle) 366 { 367 if (DAT_BAD_HANDLE(ep_handle)) { 368 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP)); 369 } 370 return (DAT_EP_FREE(ep_handle)); 371 } 372 373 374 DAT_RETURN dat_ep_reset( 375 IN DAT_EP_HANDLE ep_handle) 376 { 377 if (DAT_BAD_HANDLE(ep_handle)) { 378 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP)); 379 } 380 return (DAT_EP_RESET(ep_handle)); 381 } 382 383 384 DAT_RETURN dat_lmr_free( 385 IN DAT_LMR_HANDLE lmr_handle) 386 { 387 if (DAT_BAD_HANDLE(lmr_handle)) { 388 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_LMR)); 389 } 390 return (DAT_LMR_FREE(lmr_handle)); 391 } 392 393 394 DAT_RETURN dat_rmr_create( 395 IN DAT_PZ_HANDLE pz_handle, 396 OUT DAT_RMR_HANDLE *rmr_handle) 397 { 398 if (DAT_BAD_HANDLE(pz_handle)) { 399 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PZ)); 400 } 401 return DAT_RMR_CREATE(pz_handle, 402 rmr_handle); 403 } 404 405 406 DAT_RETURN dat_rmr_query( 407 IN DAT_RMR_HANDLE rmr_handle, 408 IN DAT_RMR_PARAM_MASK rmr_param_mask, 409 OUT DAT_RMR_PARAM *rmr_param) 410 { 411 if (DAT_BAD_HANDLE(rmr_handle)) { 412 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_RMR)); 413 } 414 return DAT_RMR_QUERY(rmr_handle, 415 rmr_param_mask, 416 rmr_param); 417 } 418 419 420 DAT_RETURN dat_rmr_bind( 421 IN DAT_RMR_HANDLE rmr_handle, 422 IN const DAT_LMR_TRIPLET *lmr_triplet, 423 IN DAT_MEM_PRIV_FLAGS mem_priv, 424 IN DAT_EP_HANDLE ep_handle, 425 IN DAT_RMR_COOKIE user_cookie, 426 IN DAT_COMPLETION_FLAGS completion_flags, 427 OUT DAT_RMR_CONTEXT *context) 428 { 429 if (DAT_BAD_HANDLE(rmr_handle)) { 430 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_RMR)); 431 } 432 return DAT_RMR_BIND(rmr_handle, 433 lmr_triplet, 434 mem_priv, 435 ep_handle, 436 user_cookie, 437 completion_flags, 438 context); 439 } 440 441 442 DAT_RETURN dat_rmr_free( 443 IN DAT_RMR_HANDLE rmr_handle) 444 { 445 if (DAT_BAD_HANDLE(rmr_handle)) { 446 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_RMR)); 447 } 448 return (DAT_RMR_FREE(rmr_handle)); 449 } 450 451 452 DAT_RETURN dat_psp_create( 453 IN DAT_IA_HANDLE ia_handle, 454 IN DAT_CONN_QUAL conn_qual, 455 IN DAT_EVD_HANDLE evd_handle, 456 IN DAT_PSP_FLAGS psp_flags, 457 OUT DAT_PSP_HANDLE *psp_handle) 458 { 459 if (DAT_BAD_HANDLE(ia_handle)) { 460 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA)); 461 } 462 return DAT_PSP_CREATE(ia_handle, 463 conn_qual, 464 evd_handle, 465 psp_flags, 466 psp_handle); 467 } 468 469 470 DAT_RETURN dat_psp_query( 471 IN DAT_PSP_HANDLE psp_handle, 472 IN DAT_PSP_PARAM_MASK psp_param_mask, 473 OUT DAT_PSP_PARAM *psp_param) 474 { 475 if (DAT_BAD_HANDLE(psp_handle)) { 476 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PSP)); 477 } 478 return DAT_PSP_QUERY(psp_handle, 479 psp_param_mask, 480 psp_param); 481 } 482 483 484 DAT_RETURN dat_psp_free( 485 IN DAT_PSP_HANDLE psp_handle) 486 { 487 if (DAT_BAD_HANDLE(psp_handle)) { 488 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PSP)); 489 } 490 return (DAT_PSP_FREE(psp_handle)); 491 } 492 493 494 DAT_RETURN dat_rsp_create( 495 IN DAT_IA_HANDLE ia_handle, 496 IN DAT_CONN_QUAL conn_qual, 497 IN DAT_EP_HANDLE ep_handle, 498 IN DAT_EVD_HANDLE evd_handle, 499 OUT DAT_RSP_HANDLE *rsp_handle) 500 { 501 if (DAT_BAD_HANDLE(ia_handle)) { 502 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA)); 503 } 504 return DAT_RSP_CREATE(ia_handle, 505 conn_qual, 506 ep_handle, 507 evd_handle, 508 rsp_handle); 509 } 510 511 512 DAT_RETURN dat_rsp_query( 513 IN DAT_RSP_HANDLE rsp_handle, 514 IN DAT_RSP_PARAM_MASK rsp_param_mask, 515 OUT DAT_RSP_PARAM *rsp_param) 516 { 517 if (DAT_BAD_HANDLE(rsp_handle)) { 518 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_RSP)); 519 } 520 return DAT_RSP_QUERY(rsp_handle, 521 rsp_param_mask, 522 rsp_param); 523 } 524 525 526 DAT_RETURN dat_rsp_free( 527 IN DAT_RSP_HANDLE rsp_handle) 528 { 529 if (DAT_BAD_HANDLE(rsp_handle)) { 530 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_RSP)); 531 } 532 return (DAT_RSP_FREE(rsp_handle)); 533 } 534 535 536 DAT_RETURN dat_pz_create( 537 IN DAT_IA_HANDLE ia_handle, 538 OUT DAT_PZ_HANDLE *pz_handle) 539 { 540 if (DAT_BAD_HANDLE(ia_handle)) { 541 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA)); 542 } 543 return DAT_PZ_CREATE(ia_handle, 544 pz_handle); 545 } 546 547 548 DAT_RETURN dat_pz_query( 549 IN DAT_PZ_HANDLE pz_handle, 550 IN DAT_PZ_PARAM_MASK pz_param_mask, 551 OUT DAT_PZ_PARAM *pz_param) 552 { 553 if (DAT_BAD_HANDLE(pz_handle)) { 554 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PZ)); 555 } 556 return DAT_PZ_QUERY(pz_handle, 557 pz_param_mask, 558 pz_param); 559 } 560 561 562 DAT_RETURN dat_pz_free( 563 IN DAT_PZ_HANDLE pz_handle) 564 { 565 if (DAT_BAD_HANDLE(pz_handle)) { 566 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PZ)); 567 } 568 return (DAT_PZ_FREE(pz_handle)); 569 } 570 571 /* ARGSUSED */ 572 DAT_RETURN dat_lmr_sync_rdma_read( 573 IN DAT_IA_HANDLE ia_handle, 574 IN const DAT_LMR_TRIPLET *local_segments, 575 IN DAT_VLEN num_segments) 576 { 577 if (DAT_BAD_HANDLE(ia_handle)) { 578 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA)); 579 } 580 581 #if defined(__x86) 582 return (DAT_SUCCESS); 583 #elif defined(__sparc) 584 return (DAT_LMR_SYNC_RDMA_READ(ia_handle, local_segments, 585 num_segments)); 586 #else 587 #error "ISA not supported" 588 #endif 589 } 590 591 /* ARGSUSED */ 592 DAT_RETURN dat_lmr_sync_rdma_write( 593 IN DAT_IA_HANDLE ia_handle, 594 IN const DAT_LMR_TRIPLET *local_segments, 595 IN DAT_VLEN num_segments) 596 { 597 if (DAT_BAD_HANDLE(ia_handle)) { 598 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA)); 599 } 600 601 #if defined(__x86) 602 return (DAT_SUCCESS); 603 #elif defined(__sparc) 604 return (DAT_LMR_SYNC_RDMA_WRITE(ia_handle, local_segments, 605 num_segments)); 606 #else 607 #error "ISA not supported" 608 #endif 609 } 610 611 DAT_RETURN dat_ep_create_with_srq( 612 IN DAT_IA_HANDLE ia_handle, 613 IN DAT_PZ_HANDLE pz_handle, 614 IN DAT_EVD_HANDLE recv_evd_handle, 615 IN DAT_EVD_HANDLE request_evd_handle, 616 IN DAT_EVD_HANDLE connect_evd_handle, 617 IN DAT_SRQ_HANDLE srq_handle, 618 IN const DAT_EP_ATTR *ep_attributes, 619 OUT DAT_EP_HANDLE *ep_handle) 620 { 621 if (DAT_BAD_HANDLE(ia_handle)) { 622 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA)); 623 } 624 return DAT_EP_CREATE_WITH_SRQ(ia_handle, 625 pz_handle, 626 recv_evd_handle, 627 request_evd_handle, 628 connect_evd_handle, 629 srq_handle, 630 ep_attributes, 631 ep_handle); 632 } 633 634 DAT_RETURN dat_ep_recv_query( 635 IN DAT_EP_HANDLE ep_handle, 636 OUT DAT_COUNT *nbufs_allocated, 637 OUT DAT_COUNT *bufs_alloc_span) 638 { 639 if (DAT_BAD_HANDLE(ep_handle)) { 640 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP)); 641 } 642 return DAT_EP_RECV_QUERY(ep_handle, 643 nbufs_allocated, 644 bufs_alloc_span); 645 } 646 647 DAT_RETURN dat_ep_set_watermark( 648 IN DAT_EP_HANDLE ep_handle, 649 IN DAT_COUNT soft_high_watermark, 650 IN DAT_COUNT hard_high_watermark) 651 { 652 if (DAT_BAD_HANDLE(ep_handle)) { 653 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP)); 654 } 655 return DAT_EP_SET_WATERMARK(ep_handle, 656 soft_high_watermark, 657 hard_high_watermark); 658 } 659 660 DAT_RETURN dat_srq_create( 661 IN DAT_IA_HANDLE ia_handle, 662 IN DAT_PZ_HANDLE pz_handle, 663 IN DAT_SRQ_ATTR *srq_attr, 664 OUT DAT_SRQ_HANDLE *srq_handle) 665 { 666 if (DAT_BAD_HANDLE(ia_handle)) { 667 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA)); 668 } 669 return DAT_SRQ_CREATE(ia_handle, 670 pz_handle, 671 srq_attr, 672 srq_handle); 673 } 674 675 DAT_RETURN dat_srq_free( 676 IN DAT_SRQ_HANDLE srq_handle) 677 { 678 if (DAT_BAD_HANDLE(srq_handle)) { 679 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ)); 680 } 681 return (DAT_SRQ_FREE(srq_handle)); 682 } 683 684 DAT_RETURN dat_srq_post_recv( 685 IN DAT_SRQ_HANDLE srq_handle, 686 IN DAT_COUNT num_segments, 687 IN DAT_LMR_TRIPLET *local_iov, 688 IN DAT_DTO_COOKIE user_cookie) 689 { 690 if (DAT_BAD_HANDLE(srq_handle)) { 691 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ)); 692 } 693 return DAT_SRQ_POST_RECV(srq_handle, 694 num_segments, 695 local_iov, 696 user_cookie); 697 } 698 699 DAT_RETURN dat_srq_query( 700 IN DAT_SRQ_HANDLE srq_handle, 701 IN DAT_SRQ_PARAM_MASK srq_param_mask, 702 OUT DAT_SRQ_PARAM *srq_param) 703 { 704 if (DAT_BAD_HANDLE(srq_handle)) { 705 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ)); 706 } 707 return DAT_SRQ_QUERY(srq_handle, 708 srq_param_mask, 709 srq_param); 710 } 711 712 DAT_RETURN dat_srq_resize( 713 IN DAT_SRQ_HANDLE srq_handle, 714 IN DAT_COUNT srq_max_recv_dto) 715 { 716 if (DAT_BAD_HANDLE(srq_handle)) { 717 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ)); 718 } 719 return DAT_SRQ_RESIZE(srq_handle, 720 srq_max_recv_dto); 721 } 722 723 DAT_RETURN dat_srq_set_lw( 724 IN DAT_SRQ_HANDLE srq_handle, 725 IN DAT_COUNT low_watermark) 726 { 727 if (DAT_BAD_HANDLE(srq_handle)) { 728 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ)); 729 } 730 return DAT_SRQ_SET_LW(srq_handle, 731 low_watermark); 732 } 733