[DAT/DAPL 2.0] Initial checkin; not enable as part of the standard build yet.
authorstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 6 Sep 2007 18:17:48 +0000 (18:17 +0000)
committerstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 6 Sep 2007 18:17:48 +0000 (18:17 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@783 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

310 files changed:
ulp/dapl2/AUTHORS [new file with mode: 0644]
ulp/dapl2/COPYING [new file with mode: 0644]
ulp/dapl2/LICENSE.txt [new file with mode: 0644]
ulp/dapl2/LICENSE2.txt [new file with mode: 0644]
ulp/dapl2/LICENSE3.txt [new file with mode: 0644]
ulp/dapl2/README [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_adapter_util.h [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_cno_util.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_cno_util.h [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_cookie.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_cookie.h [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_cr_accept.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_cr_callback.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_cr_handoff.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_cr_query.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_cr_reject.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_cr_util.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_cr_util.h [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_csp.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_debug.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ep_connect.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ep_create.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ep_create_with_srq.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ep_disconnect.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ep_dup_connect.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ep_free.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ep_get_status.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ep_modify.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ep_post_rdma_read.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ep_post_rdma_read_to_rmr.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ep_post_rdma_write.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ep_post_recv.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ep_post_send.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ep_post_send_invalidate.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ep_query.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ep_recv_query.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ep_reset.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ep_set_watermark.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ep_util.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ep_util.h [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_evd_connection_callb.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_evd_cq_async_error_callb.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_evd_dequeue.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_evd_dto_callb.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_evd_free.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_evd_post_se.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_evd_qp_async_error_callb.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_evd_resize.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_evd_un_async_error_callb.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_evd_util.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_evd_util.h [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_get_consumer_context.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_get_handle_type.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_hash.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_hash.h [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_hca_util.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_hca_util.h [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ia_close.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ia_ha.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ia_open.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ia_query.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ia_util.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ia_util.h [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_init.h [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_llist.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_lmr_free.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_lmr_query.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_lmr_sync_rdma_read.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_lmr_sync_rdma_write.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_lmr_util.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_lmr_util.h [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_mr_util.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_mr_util.h [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_name_service.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_name_service.h [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_provider.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_provider.h [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_psp_create.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_psp_create_any.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_psp_free.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_psp_query.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_pz_create.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_pz_free.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_pz_query.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_pz_util.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_pz_util.h [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ring_buffer_util.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_ring_buffer_util.h [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_rmr_bind.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_rmr_create.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_rmr_free.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_rmr_query.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_rmr_util.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_rmr_util.h [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_rsp_create.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_rsp_free.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_rsp_query.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_set_consumer_context.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_sp_util.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_sp_util.h [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_srq_create.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_srq_free.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_srq_post_recv.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_srq_query.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_srq_resize.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_srq_set_lw.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_srq_util.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_srq_util.h [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_timer_util.c [new file with mode: 0644]
ulp/dapl2/dapl/common/dapl_timer_util.h [new file with mode: 0644]
ulp/dapl2/dapl/dirs [new file with mode: 0644]
ulp/dapl2/dapl/ibal/dapl_ibal_cm.c [new file with mode: 0644]
ulp/dapl2/dapl/ibal/dapl_ibal_cq.c [new file with mode: 0644]
ulp/dapl2/dapl/ibal/dapl_ibal_dto.h [new file with mode: 0644]
ulp/dapl2/dapl/ibal/dapl_ibal_extensions.c [new file with mode: 0644]
ulp/dapl2/dapl/ibal/dapl_ibal_kmod.h [new file with mode: 0644]
ulp/dapl2/dapl/ibal/dapl_ibal_mrdb.c [new file with mode: 0644]
ulp/dapl2/dapl/ibal/dapl_ibal_mrdb.h [new file with mode: 0644]
ulp/dapl2/dapl/ibal/dapl_ibal_name_service.h [new file with mode: 0644]
ulp/dapl2/dapl/ibal/dapl_ibal_qp.c [new file with mode: 0644]
ulp/dapl2/dapl/ibal/dapl_ibal_util.c [new file with mode: 0644]
ulp/dapl2/dapl/ibal/dapl_ibal_util.h [new file with mode: 0644]
ulp/dapl2/dapl/include/dapl.h [new file with mode: 0644]
ulp/dapl2/dapl/include/dapl_debug.h [new file with mode: 0644]
ulp/dapl2/dapl/include/dapl_ipoib_names.h [new file with mode: 0644]
ulp/dapl2/dapl/include/dapl_vendor.h [new file with mode: 0644]
ulp/dapl2/dapl/udapl/Makefile.linux [new file with mode: 0644]
ulp/dapl2/dapl/udapl/SOURCES [new file with mode: 0644]
ulp/dapl2/dapl/udapl/dapl_cno_create.c [new file with mode: 0644]
ulp/dapl2/dapl/udapl/dapl_cno_free.c [new file with mode: 0644]
ulp/dapl2/dapl/udapl/dapl_cno_modify_agent.c [new file with mode: 0644]
ulp/dapl2/dapl/udapl/dapl_cno_query.c [new file with mode: 0644]
ulp/dapl2/dapl/udapl/dapl_cno_wait.c [new file with mode: 0644]
ulp/dapl2/dapl/udapl/dapl_evd_clear_unwaitable.c [new file with mode: 0644]
ulp/dapl2/dapl/udapl/dapl_evd_create.c [new file with mode: 0644]
ulp/dapl2/dapl/udapl/dapl_evd_disable.c [new file with mode: 0644]
ulp/dapl2/dapl/udapl/dapl_evd_enable.c [new file with mode: 0644]
ulp/dapl2/dapl/udapl/dapl_evd_modify_cno.c [new file with mode: 0644]
ulp/dapl2/dapl/udapl/dapl_evd_query.c [new file with mode: 0644]
ulp/dapl2/dapl/udapl/dapl_evd_set_unwaitable.c [new file with mode: 0644]
ulp/dapl2/dapl/udapl/dapl_evd_wait.c [new file with mode: 0644]
ulp/dapl2/dapl/udapl/dapl_init.c [new file with mode: 0644]
ulp/dapl2/dapl/udapl/dapl_lmr_create.c [new file with mode: 0644]
ulp/dapl2/dapl/udapl/libdaplcma.map [new file with mode: 0644]
ulp/dapl2/dapl/udapl/libdaplscm.map [new file with mode: 0644]
ulp/dapl2/dapl/udapl/linux/dapl_osd.c [new file with mode: 0644]
ulp/dapl2/dapl/udapl/linux/dapl_osd.h [new file with mode: 0644]
ulp/dapl2/dapl/udapl/makefile [new file with mode: 0644]
ulp/dapl2/dapl/udapl/udapl.rc [new file with mode: 0644]
ulp/dapl2/dapl/udapl/udapl_exports.src [new file with mode: 0644]
ulp/dapl2/dapl/udapl/udapl_sources.c [new file with mode: 0644]
ulp/dapl2/dapl/udapl/windows/dapl_osd.c [new file with mode: 0644]
ulp/dapl2/dapl/udapl/windows/dapl_osd.h [new file with mode: 0644]
ulp/dapl2/dat/common/dat_api.c [new file with mode: 0644]
ulp/dapl2/dat/common/dat_dictionary.c [new file with mode: 0644]
ulp/dapl2/dat/common/dat_dictionary.h [new file with mode: 0644]
ulp/dapl2/dat/common/dat_dr.c [new file with mode: 0644]
ulp/dapl2/dat/common/dat_dr.h [new file with mode: 0644]
ulp/dapl2/dat/common/dat_init.c [new file with mode: 0644]
ulp/dapl2/dat/common/dat_init.h [new file with mode: 0644]
ulp/dapl2/dat/common/dat_sr.c [new file with mode: 0644]
ulp/dapl2/dat/common/dat_sr.h [new file with mode: 0644]
ulp/dapl2/dat/common/dat_strerror.c [new file with mode: 0644]
ulp/dapl2/dat/dirs [new file with mode: 0644]
ulp/dapl2/dat/include/dat/dat.h [new file with mode: 0644]
ulp/dapl2/dat/include/dat/dat_error.h [new file with mode: 0644]
ulp/dapl2/dat/include/dat/dat_ib_extensions.h [new file with mode: 0644]
ulp/dapl2/dat/include/dat/dat_iw_extensions.h [new file with mode: 0644]
ulp/dapl2/dat/include/dat/dat_platform_specific.h [new file with mode: 0644]
ulp/dapl2/dat/include/dat/dat_redirection.h [new file with mode: 0644]
ulp/dapl2/dat/include/dat/dat_registry.h [new file with mode: 0644]
ulp/dapl2/dat/include/dat/dat_vendor_specific.h [new file with mode: 0644]
ulp/dapl2/dat/include/dat/kdat.h [new file with mode: 0644]
ulp/dapl2/dat/include/dat/kdat_config.h [new file with mode: 0644]
ulp/dapl2/dat/include/dat/kdat_redirection.h [new file with mode: 0644]
ulp/dapl2/dat/include/dat/kdat_vendor_specific.h [new file with mode: 0644]
ulp/dapl2/dat/include/dat/udat.h [new file with mode: 0644]
ulp/dapl2/dat/include/dat/udat_config.h [new file with mode: 0644]
ulp/dapl2/dat/include/dat/udat_redirection.h [new file with mode: 0644]
ulp/dapl2/dat/include/dat/udat_vendor_specific.h [new file with mode: 0644]
ulp/dapl2/dat/udat/Makefile.linux [new file with mode: 0644]
ulp/dapl2/dat/udat/SOURCES [new file with mode: 0644]
ulp/dapl2/dat/udat/linux/dat-registry-1.1.spec [new file with mode: 0644]
ulp/dapl2/dat/udat/linux/dat_osd.c [new file with mode: 0644]
ulp/dapl2/dat/udat/linux/dat_osd.h [new file with mode: 0644]
ulp/dapl2/dat/udat/makefile [new file with mode: 0644]
ulp/dapl2/dat/udat/udat.c [new file with mode: 0644]
ulp/dapl2/dat/udat/udat.rc [new file with mode: 0644]
ulp/dapl2/dat/udat/udat_api.c [new file with mode: 0644]
ulp/dapl2/dat/udat/udat_exports.src [new file with mode: 0644]
ulp/dapl2/dat/udat/udat_sources.c [new file with mode: 0644]
ulp/dapl2/dat/udat/udat_sr_parser.c [new file with mode: 0644]
ulp/dapl2/dat/udat/udat_sr_parser.h [new file with mode: 0644]
ulp/dapl2/dat/udat/windows/dat_osd.c [new file with mode: 0644]
ulp/dapl2/dat/udat/windows/dat_osd.h [new file with mode: 0644]
ulp/dapl2/dat/udat/windows/dat_osd_sr.h [new file with mode: 0644]
ulp/dapl2/dirs [new file with mode: 0644]
ulp/dapl2/doc/dapl_coding_style.txt [new file with mode: 0644]
ulp/dapl2/doc/dapl_end_point_design.txt [new file with mode: 0644]
ulp/dapl2/doc/dapl_environ.txt [new file with mode: 0644]
ulp/dapl2/doc/dapl_event_design.txt [new file with mode: 0644]
ulp/dapl2/doc/dapl_ibm_api_variations.txt [new file with mode: 0644]
ulp/dapl2/doc/dapl_memory_management_design.txt [new file with mode: 0644]
ulp/dapl2/doc/dapl_patch.txt [new file with mode: 0644]
ulp/dapl2/doc/dapl_registry_design.txt [new file with mode: 0644]
ulp/dapl2/doc/dapl_shared_memory_design.txt [new file with mode: 0644]
ulp/dapl2/doc/dapl_vendor_specific_changes.txt [new file with mode: 0644]
ulp/dapl2/doc/dat_environ.txt [new file with mode: 0644]
ulp/dapl2/man/dapltest.1 [new file with mode: 0644]
ulp/dapl2/man/dtest.1 [new file with mode: 0644]
ulp/dapl2/test/dapltest/README [new file with mode: 0644]
ulp/dapl2/test/dapltest/SOURCES [new file with mode: 0644]
ulp/dapl2/test/dapltest/cmd/dapl_fft_cmd.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/cmd/dapl_getopt.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/cmd/dapl_limit_cmd.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/cmd/dapl_main.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/cmd/dapl_netaddr.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/cmd/dapl_params.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/cmd/dapl_performance_cmd.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/cmd/dapl_qos_util.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/cmd/dapl_quit_cmd.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/cmd/dapl_server_cmd.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/cmd/dapl_test_data.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/cmd/dapl_transaction_cmd.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/common/dapl_endian.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/common/dapl_global.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/common/dapl_performance_cmd_util.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/common/dapl_quit_cmd_util.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/common/dapl_transaction_cmd_util.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/dapltest.rc [new file with mode: 0644]
ulp/dapl2/test/dapltest/dt_cmd.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/dt_common.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/dt_mdep.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/dt_test.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/dt_udapl.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_bpool.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_client_info.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_common.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_execute.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_fft_cmd.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_fft_util.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_getopt.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_global.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_limit_cmd.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_mdep.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_memlist.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_params.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_performance_cmd.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_performance_stats.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_performance_test.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_proto.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_quit_cmd.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_server_cmd.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_server_info.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_tdep.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_tdep_print.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_test_data.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_transaction_cmd.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_transaction_stats.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_transaction_test.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/include/dapl_version.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/makefile [new file with mode: 0644]
ulp/dapl2/test/dapltest/mdep/linux/dapl_mdep_kernel.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/mdep/linux/dapl_mdep_kernel.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/mdep/linux/dapl_mdep_user.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/mdep/linux/dapl_mdep_user.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/mdep/solaris/dapl_mdep_user.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/mdep/solaris/dapl_mdep_user.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/mdep/windows/dapl_mdep_user.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/mdep/windows/dapl_mdep_user.h [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_bpool.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_client.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_client_info.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_cnxn.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_execute.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_fft_connmgt.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_fft_dataxfer.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_fft_dataxfer_client.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_fft_endpoint.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_fft_hwconn.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_fft_mem.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_fft_pz.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_fft_queryinfo.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_fft_test.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_fft_util.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_limit.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_memlist.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_performance_client.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_performance_server.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_performance_stats.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_performance_util.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_quit_util.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_server.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_server_info.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_test_data.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_test_util.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_thread.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_transaction_stats.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_transaction_test.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_transaction_util.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/test/dapl_util.c [new file with mode: 0644]
ulp/dapl2/test/dapltest/udapl/udapl_tdep.c [new file with mode: 0644]
ulp/dapl2/test/dirs [new file with mode: 0644]
ulp/dapl2/test/dtest/GETOPT.C [new file with mode: 0644]
ulp/dapl2/test/dtest/GETOPT.H [new file with mode: 0644]
ulp/dapl2/test/dtest/README [new file with mode: 0644]
ulp/dapl2/test/dtest/SOURCES [new file with mode: 0644]
ulp/dapl2/test/dtest/dtest.c [new file with mode: 0644]
ulp/dapl2/test/dtest/dtest.rc [new file with mode: 0644]
ulp/dapl2/test/dtest/makefile [new file with mode: 0644]

diff --git a/ulp/dapl2/AUTHORS b/ulp/dapl2/AUTHORS
new file mode 100644 (file)
index 0000000..8f6ba2c
--- /dev/null
@@ -0,0 +1,17 @@
+This is an incomplete list of people who have contributed to the \r
+DAPL project:\r
+\r
+ Caitlin Bestler\r
+ Philip Christopher\r
+ Jay Danielsen\r
+ Arlin Davis\r
+ Tom Duffy\r
+ Matthew Finlay\r
+ Jimmy Hill\r
+ James Lentini\r
+ Gil Rubin\r
+ Steve Sears\r
+ Randy Smith\r
+ Stan Smith\r
+ Anthony Topper\r
+ Steve Wise \r
diff --git a/ulp/dapl2/COPYING b/ulp/dapl2/COPYING
new file mode 100644 (file)
index 0000000..a1e8bac
--- /dev/null
@@ -0,0 +1,36 @@
+#\r
+# Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.\r
+# Copyright (c) 2005 Voltaire Inc.  All rights reserved.\r
+# Copyright (c) 2005 Intel Corporation. All rights reserved.\r
+# Copyright (c) 2004-2005, Mellanox Technologies, Inc. All rights reserved. \r
+# Copyright (c) 2003 Topspin Corporation.  All rights reserved. \r
+# Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.\r
+#\r
+# This Software is licensed under one of the following licenses:\r
+#\r
+# 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+#    in the file LICENSE.txt in the root directory. The license is also\r
+#    available from the Open Source Initiative, see\r
+#    http://www.opensource.org/licenses/cpl.php.\r
+#\r
+# 2) under the terms of the "The BSD License" a copy of which is in the file\r
+#    LICENSE2.txt in the root directory. The license is also available from\r
+#    the Open Source Initiative, see\r
+#    http://www.opensource.org/licenses/bsd-license.php.\r
+#\r
+# 3) under the terms of the "GNU General Public License (GPL) Version 2" a \r
+#    copy of which is in the file LICENSE3.txt in the root directory. The \r
+#    license is also available from the Open Source Initiative, see\r
+#    http://www.opensource.org/licenses/gpl-license.php.\r
+#\r
+# Licensee has the right to choose one of the above licenses.\r
+#\r
+# Redistributions of source code must retain the above copyright\r
+# notice and one of the license notices.\r
+#\r
+# Redistributions in binary form must reproduce both the above copyright\r
+# notice, one of the license notices in the documentation\r
+# and/or other materials provided with the distribution.\r
+#\r
+\r
+\r
diff --git a/ulp/dapl2/LICENSE.txt b/ulp/dapl2/LICENSE.txt
new file mode 100644 (file)
index 0000000..8572031
--- /dev/null
@@ -0,0 +1,235 @@
+Common Public License 1.0\r
+\r
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON \r
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF \r
+THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. \r
+\r
+1. DEFINITIONS\r
+\r
+"Contribution" means:\r
+\r
+     a) in the case of the initial Contributor, the initial code and\r
+     documentation distributed under this Agreement, and\r
+\r
+     b) in the case of each subsequent Contributor:\r
+\r
+     i) changes to the Program, and\r
+\r
+     ii) additions to the Program;\r
+\r
+     where such changes and/or additions to the Program originate from\r
+     and are distributed by that particular Contributor. A Contribution\r
+     'originates' from a Contributor if it was added to the Program by\r
+     such Contributor itself or anyone acting on such Contributor's\r
+     behalf.  Contributions do not include additions to the Program\r
+     which: (i) are separate modules of software distributed in\r
+     conjunction with the Program under their own license agreement, and\r
+     (ii) are not derivative works of the Program.\r
+\r
+"Contributor" means any person or entity that distributes the Program. \r
+\r
+"Licensed Patents " mean patent claims licensable by a Contributor \r
+which are necessarily infringed by the use or sale of its Contribution \r
+alone or when combined with the Program.\r
+\r
+"Program" means the Contributions distributed in accordance with this \r
+Agreement. \r
+\r
+"Recipient" means anyone who receives the Program under this Agreement, \r
+including all Contributors. \r
+\r
+2. GRANT OF RIGHTS\r
+\r
+     a) Subject to the terms of this Agreement, each Contributor hereby\r
+     grants Recipient a non-exclusive, worldwide, royalty-free copyright\r
+     license to reproduce, prepare derivative works of, publicly\r
+     display, publicly perform, distribute and sublicense the\r
+     Contribution of such Contributor, if any, and such derivative\r
+     works, in source code and object code form.\r
+\r
+     b) Subject to the terms of this Agreement, each Contributor hereby\r
+     grants Recipient a non-exclusive, worldwide, royalty-free patent\r
+     license under Licensed Patents to make, use, sell, offer to sell,\r
+     import and otherwise transfer the Contribution of such Contributor,\r
+     if any, in source code and object code form. This patent license\r
+     shall apply to the combination of the Contribution and the Program\r
+     if, at the time the Contribution is added by the Contributor, such\r
+     addition of the Contribution causes such combination to be covered\r
+     by the Licensed Patents. The patent license shall not apply to any\r
+     other combinations which include the Contribution. No hardware per\r
+     se is licensed hereunder.\r
+\r
+     c) Recipient understands that although each Contributor grants the\r
+     licenses to its Contributions set forth herein, no assurances are\r
+     provided by any Contributor that the Program does not infringe the\r
+     patent or other intellectual property rights of any other\r
+     entity. Each Contributor disclaims any liability to Recipient for\r
+     claims brought by any other entity based on infringement of\r
+     intellectual property rights or otherwise. As a condition to\r
+     exercising the rights and licenses granted hereunder, each\r
+     Recipient hereby assumes sole responsibility to secure any other\r
+     intellectual property rights needed, if any. For example, if a\r
+     third party patent license is required to allow Recipient to\r
+     distribute the Program, it is Recipient's responsibility to acquire\r
+     that license before distributing the Program.\r
+\r
+     d) Each Contributor represents that to its knowledge it has\r
+     sufficient copyright rights in its Contribution, if any, to grant\r
+     the copyright license set forth in this Agreement.\r
+\r
+3. REQUIREMENTS \r
+\r
+A Contributor may choose to distribute the Program in object code form \r
+under its own license agreement, provided that: \r
+\r
+     a) it complies with the terms and conditions of this Agreement; and\r
+\r
+     b) its license agreement:\r
+\r
+     i) effectively disclaims on behalf of all Contributors all\r
+     warranties and conditions, express and implied, including\r
+     warranties or conditions of title and non-infringement, and implied\r
+     warranties or conditions of merchantability and fitness for a\r
+     particular purpose;\r
+\r
+     ii) effectively excludes on behalf of all Contributors all\r
+     liability for damages, including direct, indirect, special,\r
+     incidental and consequential damages, such as lost profits;\r
+\r
+     iii) states that any provisions which differ from this Agreement\r
+     are offered by that Contributor alone and not by any other party;\r
+     and\r
+\r
+     iv) states that source code for the Program is available from such\r
+     Contributor, and informs licensees how to obtain it in a reasonable\r
+     manner on or through a medium customarily used for software\r
+     exchange.  \r
+\r
+When the Program is made available in source code form:\r
+\r
+     a) it must be made available under this Agreement; and\r
+\r
+     b) a copy of this Agreement must be included with each copy of the\r
+     Program.\r
+\r
+Contributors may not remove or alter any copyright notices contained \r
+within the Program.\r
+\r
+Each Contributor must identify itself as the originator of its \r
+Contribution, if any, in a manner that reasonably allows subsequent \r
+Recipients to identify the originator of the Contribution. \r
+\r
+4. COMMERCIAL DISTRIBUTION \r
+\r
+Commercial distributors of software may accept certain responsibilities\r
+with respect to end users, business partners and the like. While this\r
+license is intended to facilitate the commercial use of the Program, the\r
+Contributor who includes the Program in a commercial product offering\r
+should do so in a manner which does not create potential liability for\r
+other Contributors. Therefore, if a Contributor includes the Program in\r
+a commercial product offering, such Contributor ("Commercial\r
+Contributor") hereby agrees to defend and indemnify every other\r
+Contributor ("Indemnified Contributor") against any losses, damages and\r
+costs (collectively "Losses") arising from claims, lawsuits and other\r
+legal actions brought by a third party against the Indemnified\r
+Contributor to the extent caused by the acts or omissions of such\r
+Commercial Contributor in connection with its distribution of the\r
+Program in a commercial product offering. The obligations in this\r
+section do not apply to any claims or Losses relating to any actual or\r
+alleged intellectual property infringement. In order to qualify, an\r
+Indemnified Contributor must: a) promptly notify the Commercial\r
+Contributor in writing of such claim, and b) allow the Commercial\r
+Contributor to control, and cooperate with the Commercial Contributor\r
+in, the defense and any related settlement negotiations. The Indemnified\r
+Contributor may participate in any such claim at its own expense.\r
+\r
+For example, a Contributor might include the Program in a commercial\r
+product offering, Product X. That Contributor is then a Commercial\r
+Contributor. If that Commercial Contributor then makes performance\r
+claims, or offers warranties related to Product X, those performance\r
+claims and warranties are such Commercial Contributor's responsibility\r
+alone. Under this section, the Commercial Contributor would have to\r
+defend claims against the other Contributors related to those\r
+performance claims and warranties, and if a court requires any other\r
+Contributor to pay any damages as a result, the Commercial Contributor\r
+must pay those damages.\r
+\r
+5. NO WARRANTY\r
+\r
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS \r
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY \r
+KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY \r
+WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR \r
+FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible \r
+for determining the appropriateness of using and distributing the \r
+Program and assumes all risks associated with its exercise of rights \r
+under this Agreement, including but not limited to the risks and costs \r
+of program errors, compliance with applicable laws, damage to or loss \r
+of data, programs or equipment, and unavailability or interruption of \r
+operations. \r
+\r
+6. DISCLAIMER OF LIABILITY \r
+\r
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR \r
+ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, \r
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING \r
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF \r
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING \r
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR \r
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED \r
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. \r
+\r
+7. GENERAL\r
+\r
+If any provision of this Agreement is invalid or unenforceable under \r
+applicable law, it shall not affect the validity or enforceability of \r
+the remainder of the terms of this Agreement, and without further \r
+action by the parties hereto, such provision shall be reformed to the \r
+minimum extent necessary to make such provision valid and enforceable. \r
+\r
+If Recipient institutes patent litigation against a Contributor with \r
+respect to a patent applicable to software (including a cross-claim or \r
+counterclaim in a lawsuit), then any patent licenses granted by that \r
+Contributor to such Recipient under this Agreement shall terminate as \r
+of the date such litigation is filed. In addition, if Recipient \r
+institutes patent litigation against any entity (including a cross-\r
+claim or counterclaim in a lawsuit) alleging that the Program itself \r
+(excluding combinations of the Program with other software or hardware) \r
+infringes such Recipient's patent(s), then such Recipient's rights \r
+granted under Section 2(b) shall terminate as of the date such \r
+litigation is filed.\r
+\r
+All Recipient's rights under this Agreement shall terminate if it fails \r
+to comply with any of the material terms or conditions of this \r
+Agreement and does not cure such failure in a reasonable period of time \r
+after becoming aware of such noncompliance. If all Recipient's rights \r
+under this Agreement terminate, Recipient agrees to cease use and \r
+distribution of the Program as soon as reasonably practicable. However, \r
+Recipient's obligations under this Agreement and any licenses granted \r
+by Recipient relating to the Program shall continue and survive. \r
+\r
+Everyone is permitted to copy and distribute copies of this Agreement, \r
+but in order to avoid inconsistency the Agreement is copyrighted and \r
+may only be modified in the following manner. The Agreement Steward \r
+reserves the right to publish new versions (including revisions) of \r
+this Agreement from time to time. No one other than the Agreement \r
+Steward has the right to modify this Agreement. IBM is the initial \r
+Agreement Steward. IBM may assign the responsibility to serve as the \r
+Agreement Steward to a suitable separate entity. Each new version of \r
+the Agreement will be given a distinguishing version number. The \r
+Program (including Contributions) may always be distributed subject to \r
+the version of the Agreement under which it was received. In addition, \r
+after a new version of the Agreement is published, Contributor may \r
+elect to distribute the Program (including its Contributions) under the \r
+new version. Except as expressly stated in Sections 2(a) and 2(b) \r
+above, Recipient receives no rights or licenses to the intellectual \r
+property of any Contributor under this Agreement, whether expressly, by \r
+implication, estoppel or otherwise. All rights in the Program not \r
+expressly granted under this Agreement are reserved. \r
+\r
+This Agreement is governed by the laws of the State of New York and the \r
+intellectual property laws of the United States of America. No party to \r
+this Agreement will bring a legal action under this Agreement more than \r
+one year after the cause of action arose. Each party waives its rights \r
+to a jury trial in any resulting litigation.\r
+\r
diff --git a/ulp/dapl2/LICENSE2.txt b/ulp/dapl2/LICENSE2.txt
new file mode 100644 (file)
index 0000000..0f84e3b
--- /dev/null
@@ -0,0 +1,30 @@
+Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.\r
+\r
+Redistribution and use in source and binary forms, with or without\r
+modification, are permitted provided that the following conditions are\r
+met:\r
+\r
+       Redistributions of source code must retain the above copyright\r
+       notice, this list of conditions and the following disclaimer.\r
+\r
+       Redistributions in binary form must reproduce the above\r
+       copyright notice, this list of conditions and the following\r
+       disclaimer in the documentation and/or other materials provided\r
+       with the distribution.\r
+\r
+       Neither the name of the Network Appliance, Inc. nor the names of\r
+       its contributors may be used to endorse or promote products\r
+       derived from this software without specific prior written\r
+       permission.\r
+\r
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
diff --git a/ulp/dapl2/LICENSE3.txt b/ulp/dapl2/LICENSE3.txt
new file mode 100644 (file)
index 0000000..d826fce
--- /dev/null
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE\r
+Version 2, June 1991\r
+\r
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.\r
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+Everyone is permitted to copy and distribute verbatim copies\r
+of this license document, but changing it is not allowed.\r
+\r
+Preamble\r
+\r
+The licenses for most software are designed to take away your\r
+freedom to share and change it. By contrast, the GNU General Public\r
+License is intended to guarantee your freedom to share and change free\r
+software--to make sure the software is free for all its users. This\r
+General Public License applies to most of the Free Software\r
+Foundation's software and to any other program whose authors commit to\r
+using it. (Some other Free Software Foundation software is covered by\r
+the GNU Library General Public License instead.) You can apply it to\r
+your programs, too.\r
+\r
+When we speak of free software, we are referring to freedom, not\r
+price. Our General Public Licenses are designed to make sure that you\r
+have the freedom to distribute copies of free software (and charge for\r
+this service if you wish), that you receive source code or can get it\r
+if you want it, that you can change the software or use pieces of it\r
+in new free programs; and that you know you can do these things.\r
+\r
+To protect your rights, we need to make restrictions that forbid\r
+anyone to deny you these rights or to ask you to surrender the rights.\r
+These restrictions translate to certain responsibilities for you if you\r
+distribute copies of the software, or if you modify it.\r
+\r
+For example, if you distribute copies of such a program, whether\r
+gratis or for a fee, you must give the recipients all the rights that\r
+you have. You must make sure that they, too, receive or can get the\r
+source code. And you must show them these terms so they know their\r
+rights.\r
+\r
+We protect your rights with two steps: (1) copyright the software, and\r
+(2) offer you this license which gives you legal permission to copy,\r
+distribute and/or modify the software.\r
+\r
+Also, for each author's protection and ours, we want to make certain\r
+that everyone understands that there is no warranty for this free\r
+software. If the software is modified by someone else and passed on, we\r
+want its recipients to know that what they have is not the original, so\r
+that any problems introduced by others will not reflect on the original\r
+authors' reputations.\r
+\r
+Finally, any free program is threatened constantly by software\r
+patents. We wish to avoid the danger that redistributors of a free\r
+program will individually obtain patent licenses, in effect making the\r
+program proprietary. To prevent this, we have made it clear that any\r
+patent must be licensed for everyone's free use or not licensed at all.\r
+\r
+The precise terms and conditions for copying, distribution and\r
+modification follow.\r
+\r
+GNU GENERAL PUBLIC LICENSE\r
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\r
+\r
+0. This License applies to any program or other work which contains\r
+a notice placed by the copyright holder saying it may be distributed\r
+under the terms of this General Public License. The "Program", below,\r
+refers to any such program or work, and a "work based on the Program"\r
+means either the Program or any derivative work under copyright law:\r
+that is to say, a work containing the Program or a portion of it,\r
+either verbatim or with modifications and/or translated into another\r
+language. (Hereinafter, translation is included without limitation in\r
+the term "modification".) Each licensee is addressed as "you".\r
+\r
+Activities other than copying, distribution and modification are not\r
+covered by this License; they are outside its scope. The act of\r
+running the Program is not restricted, and the output from the Program\r
+is covered only if its contents constitute a work based on the\r
+Program (independent of having been made by running the Program).\r
+Whether that is true depends on what the Program does.\r
+\r
+1. You may copy and distribute verbatim copies of the Program's\r
+source code as you receive it, in any medium, provided that you\r
+conspicuously and appropriately publish on each copy an appropriate\r
+copyright notice and disclaimer of warranty; keep intact all the\r
+notices that refer to this License and to the absence of any warranty;\r
+and give any other recipients of the Program a copy of this License\r
+along with the Program.\r
+\r
+You may charge a fee for the physical act of transferring a copy, and\r
+you may at your option offer warranty protection in exchange for a fee.\r
+\r
+2. You may modify your copy or copies of the Program or any portion\r
+of it, thus forming a work based on the Program, and copy and\r
+distribute such modifications or work under the terms of Section 1\r
+above, provided that you also meet all of these conditions:\r
+\r
+a) You must cause the modified files to carry prominent notices\r
+stating that you changed the files and the date of any change.\r
+\r
+b) You must cause any work that you distribute or publish, that in\r
+whole or in part contains or is derived from the Program or any\r
+part thereof, to be licensed as a whole at no charge to all third\r
+parties under the terms of this License.\r
+\r
+c) If the modified program normally reads commands interactively\r
+when run, you must cause it, when started running for such\r
+interactive use in the most ordinary way, to print or display an\r
+announcement including an appropriate copyright notice and a\r
+notice that there is no warranty (or else, saying that you provide\r
+a warranty) and that users may redistribute the program under\r
+these conditions, and telling the user how to view a copy of this\r
+License. (Exception: if the Program itself is interactive but\r
+does not normally print such an announcement, your work based on\r
+the Program is not required to print an announcement.)\r
+\r
+These requirements apply to the modified work as a whole. If\r
+identifiable sections of that work are not derived from the Program,\r
+and can be reasonably considered independent and separate works in\r
+themselves, then this License, and its terms, do not apply to those\r
+sections when you distribute them as separate works. But when you\r
+distribute the same sections as part of a whole which is a work based\r
+on the Program, the distribution of the whole must be on the terms of\r
+this License, whose permissions for other licensees extend to the\r
+entire whole, and thus to each and every part regardless of who wrote it.\r
+\r
+Thus, it is not the intent of this section to claim rights or contest\r
+your rights to work written entirely by you; rather, the intent is to\r
+exercise the right to control the distribution of derivative or\r
+collective works based on the Program.\r
+\r
+In addition, mere aggregation of another work not based on the Program\r
+with the Program (or with a work based on the Program) on a volume of\r
+a storage or distribution medium does not bring the other work under\r
+the scope of this License.\r
+\r
+3. You may copy and distribute the Program (or a work based on it,\r
+under Section 2) in object code or executable form under the terms of\r
+Sections 1 and 2 above provided that you also do one of the following:\r
+\r
+a) Accompany it with the complete corresponding machine-readable\r
+source code, which must be distributed under the terms of Sections\r
+1 and 2 above on a medium customarily used for software interchange; or,\r
+\r
+b) Accompany it with a written offer, valid for at least three\r
+years, to give any third party, for a charge no more than your\r
+cost of physically performing source distribution, a complete\r
+machine-readable copy of the corresponding source code, to be\r
+distributed under the terms of Sections 1 and 2 above on a medium\r
+customarily used for software interchange; or,\r
+\r
+c) Accompany it with the information you received as to the offer\r
+to distribute corresponding source code. (This alternative is\r
+allowed only for noncommercial distribution and only if you\r
+received the program in object code or executable form with such\r
+an offer, in accord with Subsection b above.)\r
+\r
+The source code for a work means the preferred form of the work for\r
+making modifications to it. For an executable work, complete source\r
+code means all the source code for all modules it contains, plus any\r
+associated interface definition files, plus the scripts used to\r
+control compilation and installation of the executable. However, as a\r
+special exception, the source code distributed need not include\r
+anything that is normally distributed (in either source or binary\r
+form) with the major components (compiler, kernel, and so on) of the\r
+operating system on which the executable runs, unless that component\r
+itself accompanies the executable.\r
+\r
+If distribution of executable or object code is made by offering\r
+access to copy from a designated place, then offering equivalent\r
+access to copy the source code from the same place counts as\r
+distribution of the source code, even though third parties are not\r
+compelled to copy the source along with the object code.\r
+\r
+4. You may not copy, modify, sublicense, or distribute the Program\r
+except as expressly provided under this License. Any attempt\r
+otherwise to copy, modify, sublicense or distribute the Program is\r
+void, and will automatically terminate your rights under this License.\r
+However, parties who have received copies, or rights, from you under\r
+this License will not have their licenses terminated so long as such\r
+parties remain in full compliance.\r
+\r
+5. You are not required to accept this License, since you have not\r
+signed it. However, nothing else grants you permission to modify or\r
+distribute the Program or its derivative works. These actions are\r
+prohibited by law if you do not accept this License. Therefore, by\r
+modifying or distributing the Program (or any work based on the\r
+Program), you indicate your acceptance of this License to do so, and\r
+all its terms and conditions for copying, distributing or modifying\r
+the Program or works based on it.\r
+\r
+6. Each time you redistribute the Program (or any work based on the\r
+Program), the recipient automatically receives a license from the\r
+original licensor to copy, distribute or modify the Program subject to\r
+these terms and conditions. You may not impose any further\r
+restrictions on the recipients' exercise of the rights granted herein.\r
+You are not responsible for enforcing compliance by third parties to\r
+this License.\r
+\r
+7. If, as a consequence of a court judgment or allegation of patent\r
+infringement or for any other reason (not limited to patent issues),\r
+conditions are imposed on you (whether by court order, agreement or\r
+otherwise) that contradict the conditions of this License, they do not\r
+excuse you from the conditions of this License. If you cannot\r
+distribute so as to satisfy simultaneously your obligations under this\r
+License and any other pertinent obligations, then as a consequence you\r
+may not distribute the Program at all. For example, if a patent\r
+license would not permit royalty-free redistribution of the Program by\r
+all those who receive copies directly or indirectly through you, then\r
+the only way you could satisfy both it and this License would be to\r
+refrain entirely from distribution of the Program.\r
+\r
+If any portion of this section is held invalid or unenforceable under\r
+any particular circumstance, the balance of the section is intended to\r
+apply and the section as a whole is intended to apply in other\r
+circumstances.\r
+\r
+It is not the purpose of this section to induce you to infringe any\r
+patents or other property right claims or to contest validity of any\r
+such claims; this section has the sole purpose of protecting the\r
+integrity of the free software distribution system, which is\r
+implemented by public license practices. Many people have made\r
+generous contributions to the wide range of software distributed\r
+through that system in reliance on consistent application of that\r
+system; it is up to the author/donor to decide if he or she is willing\r
+to distribute software through any other system and a licensee cannot\r
+impose that choice.\r
+\r
+This section is intended to make thoroughly clear what is believed to\r
+be a consequence of the rest of this License.\r
+\r
+8. If the distribution and/or use of the Program is restricted in\r
+certain countries either by patents or by copyrighted interfaces, the\r
+original copyright holder who places the Program under this License\r
+may add an explicit geographical distribution limitation excluding\r
+those countries, so that distribution is permitted only in or among\r
+countries not thus excluded. In such case, this License incorporates\r
+the limitation as if written in the body of this License.\r
+\r
+9. The Free Software Foundation may publish revised and/or new versions\r
+of the General Public License from time to time. Such new versions will\r
+be similar in spirit to the present version, but may differ in detail to\r
+address new problems or concerns.\r
+\r
+Each version is given a distinguishing version number. If the Program\r
+specifies a version number of this License which applies to it and "any\r
+later version", you have the option of following the terms and conditions\r
+either of that version or of any later version published by the Free\r
+Software Foundation. If the Program does not specify a version number of\r
+this License, you may choose any version ever published by the Free Software\r
+Foundation.\r
+\r
+10. If you wish to incorporate parts of the Program into other free\r
+programs whose distribution conditions are different, write to the author\r
+to ask for permission. For software which is copyrighted by the Free\r
+Software Foundation, write to the Free Software Foundation; we sometimes\r
+make exceptions for this. Our decision will be guided by the two goals\r
+of preserving the free status of all derivatives of our free software and\r
+of promoting the sharing and reuse of software generally.\r
+\r
+NO WARRANTY\r
+\r
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\r
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN\r
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\r
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\r
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS\r
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE\r
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\r
+REPAIR OR CORRECTION.\r
+\r
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\r
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\r
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\r
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\r
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\r
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\r
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\r
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\r
+POSSIBILITY OF SUCH DAMAGES.\r
+\r
+END OF TERMS AND CONDITIONS\r
+\r
+How to Apply These Terms to Your New Programs\r
+\r
+If you develop a new program, and you want it to be of the greatest\r
+possible use to the public, the best way to achieve this is to make it\r
+free software which everyone can redistribute and change under these terms.\r
+\r
+To do so, attach the following notices to the program. It is safest\r
+to attach them to the start of each source file to most effectively\r
+convey the exclusion of warranty; and each file should have at least\r
+the "copyright" line and a pointer to where the full notice is found.\r
+\r
+<one line to give the program's name and a brief idea of what it does.>\r
+Copyright (C) <year> <name of author>\r
+\r
+This program is free software; you can redistribute it and/or modify\r
+it under the terms of the GNU General Public License as published by\r
+the Free Software Foundation; either version 2 of the License, or\r
+(at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+\r
+\r
+Also add information on how to contact you by electronic and paper mail.\r
+\r
+If the program is interactive, make it output a short notice like this\r
+when it starts in an interactive mode:\r
+\r
+Gnomovision version 69, Copyright (C) year name of author\r
+Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\r
+This is free software, and you are welcome to redistribute it\r
+under certain conditions; type `show c' for details.\r
+\r
+The hypothetical commands `show w' and `show c' should show the appropriate\r
+parts of the General Public License. Of course, the commands you use may\r
+be called something other than `show w' and `show c'; they could even be\r
+mouse-clicks or menu items--whatever suits your program.\r
+\r
+You should also get your employer (if you work as a programmer) or your\r
+school, if any, to sign a "copyright disclaimer" for the program, if\r
+necessary. Here is a sample; alter the names:\r
+\r
+Yoyodyne, Inc., hereby disclaims all copyright interest in the program\r
+`Gnomovision' (which makes passes at compilers) written by James Hacker.\r
+\r
+<signature of Ty Coon>, 1 April 1989\r
+Ty Coon, President of Vice\r
+\r
+This General Public License does not permit incorporating your program into\r
+proprietary programs. If your program is a subroutine library, you may\r
+consider it more useful to permit linking proprietary applications with the\r
+library. If this is what you want to do, use the GNU Library General\r
+Public License instead of this License.\r
diff --git a/ulp/dapl2/README b/ulp/dapl2/README
new file mode 100644 (file)
index 0000000..8a86524
--- /dev/null
@@ -0,0 +1,419 @@
+\r
+==========\r
+1.0 BUILD:\r
+==========\r
+\r
+The default build includes a non-debug version of libdat and libdapl-cma uDAPL provider. It will also builds test suites dtest and dapltest and provides manpages for each. This version requires libibverbs and librdmacm installation, IPoIB installation, and IPoIB configuration with an IP address. \r
+\r
+Building :\r
+----------\r
+./autogen.sh \r
+./configure \r
+make\r
+\r
+Building debug version:\r
+----------------------\r
+./autogen.sh\r
+./configure --enable-debug\r
+make\r
+\r
+Build example with OFED prefix (x86_64)\r
+-----------------------------------------\r
+./autogen.sh\r
+./configure --prefix /usr/local/ofed --libdir /usr/local/ofed/lib64 LDFLAGS=-L/usr/local/ofed/lib64 CPPFLAGS="-I/usr/local/ofed/include"\r
+make\r
+\r
+Installing:\r
+----------\r
+make install\r
+\r
+NOTE: to link these libraries you must either use libtool and \r
+specify the full pathname of the library, or use the `-LLIBDIR' \r
+flag during linking and do at least one of the following:\r
+   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable\r
+     during execution\r
+   - add LIBDIR to the `LD_RUN_PATH' environment variable\r
+     during linking\r
+   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag\r
+   - have your system administrator add LIBDIR to `/etc/ld.so.conf'\r
+\r
+See any operating system documentation about shared libraries for\r
+more information, such as the ld(1) and ld.so(8) manual pages.\r
+\r
+===================\r
+2.0 CONFIGURATION:\r
+===================\r
+\r
+sample /etc/dat.conf \r
+\r
+#\r
+# DAT 1.2 configuration file, sample OFED\r
+#\r
+# Each entry should have the following fields:\r
+#\r
+# <ia_name> <api_version> <threadsafety> <default> <lib_path> \\r
+#           <provider_version> <ia_params> <platform_params>\r
+#\r
+# For openib-cma provider you can specify <ia_params> as either:\r
+#      network address, network hostname, or netdev name and 0 for port\r
+#\r
+# This example shows netdev name, enabling administrator to use same copy across cluster\r
+#\r
+OpenIB-cma u1.2 nonthreadsafe default /usr/local/ofed/lib64/libdapl-cma.so mv_dapl.1.2 "ib0 0" ""\r
+\r
+=============================\r
+3.0 Bugs/Known issues\r
+=============================\r
+\r
+\r
+\r
+=============================\r
+4.0 SAMPLE uDAPL APPLICATION:\r
+=============================\r
+\r
+There are 2 sample programs, with manpages, provided with this package.\r
+\r
+(dapl/test/dtest/)\r
+\r
+NAME\r
+       dtest - simple uDAPL send/receive and RDMA test\r
+\r
+SYNOPSIS\r
+       dtest [-P provider] [-b buf size] [-B burst count][-v] [-c] [-p] [-d] [-s]\r
+\r
+       dtest [-P provider] [-b buf size] [-B burst count][-v] [-c] [-p] [-d] [-h HOSTNAME]\r
+\r
+DESCRIPTION\r
+       dtest  is a simple test used to exercise and verify the uDAPL interfaces.  At least two instantia-\r
+       tions of the test must be run. One acts as the server and the other the client. The server side of\r
+       the  test,  once invoked listens for connection requests, until timing out or killed. Upon receipt\r
+       of a cd connection request, the connection is established, the server and  client  sides  exchange\r
+       information necessary to perform RDMA writes and reads.\r
+\r
+OPTIONS\r
+       -P=PROVIDER\r
+              use PROVIDER to specify uDAPL interface using /etc/dat.conf (default OpenIB-cma)\r
+\r
+       -b=BUFFER_SIZE\r
+              use buffer size BUFFER_SIZE for RDMA(default 64)\r
+\r
+       -B=BURST_COUNT\r
+              use busrt count BURST_COUNT for interations (default 10)\r
+\r
+       -v, verbose output(default off)\r
+\r
+       -c, use consumer notification events (default off)\r
+\r
+       -p, use polling (default wait for event)\r
+\r
+       -d, delay in seconds before close (default off)\r
+\r
+       -s, run as server (default - run as server)\r
+\r
+       -h=HOSTNAME\r
+              use HOSTNAME to specify server hostname or IP address (default - none)\r
+\r
+EXAMPLES\r
+       dtest -P OpenIB-cma -v -s\r
+            Starts a server process with debug verbosity using provider OpenIB-cma.\r
+\r
+       dtest -P OpenIB-cma -h server1-ib0\r
+\r
+            Starts a client process, using OpenIB-cma provider to connect to hostname server1-ib0.\r
+\r
+SEE ALSO\r
+       dapltest(1)\r
+\r
+AUTHORS\r
+       Arlin Davis\r
+              <ardavis@ichips.intel.com>\r
+\r
+BUGS\r
+\r
+/dapl/test/dapltest/\r
+\r
+NAME\r
+        dapltest - test for the Direct Access Programming Library (DAPL)\r
+\r
+DESCRIPTION\r
+       Dapltest  is  a  set  of tests developed to exercise, characterize, and verify the DAPL interfaces\r
+       during development and porting.  At least two instantiations of the test must be run. One acts  as\r
+       the  server, fielding requests and spawning server-side test threads as needed. Other client invo-\r
+       cations connect to the server and issue test requests. The server side of the test, once  invoked,\r
+       listens  continuously for client connection requests, until quit or killed. Upon receipt of a con-\r
+       nection request, the connection is established, the server and client sides swap  version  numbers\r
+       to  verify that they are able to communicate, and the client sends the test request to the server.\r
+       If the version numbers match, and the test request is well-formed, the server spawns  the  threads\r
+       needed to run the test before awaiting further connections.\r
+\r
+USAGE\r
+       dapltest [ -f script_file_name ] [ -T S|Q|T|P|L ] [ -D device_name ] [ -d ] [ -R HT|LL|EC|PM|BE ]\r
+\r
+       With  no  arguments,  dapltest runs as a server using default values, and loops accepting requests\r
+       from clients.\r
+\r
+       The -f option allows all arguments to be placed in a file, to ease test automation.\r
+\r
+       The following arguments are common to all tests:\r
+\r
+       [ -T S|Q|T|P|L ]\r
+              Test function to be performed:\r
+\r
+              S      - server loop\r
+\r
+              Q      - quit, client requests that server wait for any outstanding tests to complete, then\r
+                     clean up and exit\r
+\r
+              T      - transaction test, transfers data between client and server\r
+\r
+              P      - performance test, times DTO operations\r
+\r
+              L      -  limit  test,  exhausts  various  resources, runs in client w/o server interaction\r
+                     Default: S\r
+\r
+      [ -D device_name ]\r
+              Specifies the interface adapter name as documented in the /etc/dat.conf  static  configura-\r
+              tion file. This name corresponds to the provider library to open.  Default: none\r
+\r
+       [ -d ] Enables  extra  debug  verbosity,  primarily tracing of the various DAPL operations as they\r
+              progress.  Repeating this parameter increases debug spew.  Errors encountered result in the\r
+              test  spewing some explanatory text and stopping; this flag provides more detail about what\r
+              lead up to the error.  Default: zero\r
+\r
+       [ -R BE ]\r
+              Indicate the quality of service (QoS) desired.  Choices are:\r
+\r
+              HT     - high throughput\r
+\r
+              LL     - low latency\r
+\r
+              EC     - economy (neither HT nor LL)\r
+\r
+              PM     - premium\r
+\r
+              BE     - best effort Default: BE\r
+\r
+       Usage - Quit test client\r
+\r
+           dapltest [Common_Args] [ -s server_name ]\r
+\r
+           Quit testing (-T Q) connects to the server to ask it to clean up and\r
+           exit (after it waits for any outstanding test runs to complete).\r
+           In addition to being more polite than simply killing the server,\r
+           this test exercises the DAPL object teardown code paths.\r
+           There is only one argument other than those supported by all tests:\r
+\r
+           -s server_name      Specifies the name of the server interface.\r
+                               No default.\r
+\r
+       Usage - Transaction test client\r
+\r
+           dapltest [Common_Args] [ -s server_name ]\r
+                    [ -t threads ] [ -w endpoints ] [ -i iterations ] [ -Q ]\r
+                    [ -V ] [ -P ] OPclient OPserver [ op3,\r
+\r
+           Transaction testing (-T T) transfers a variable amount of data between\r
+:\r
+          client and server.  The data transfer can be described as a sequence of\r
+           individual operations; that entire sequence is transferred ’iterations’\r
+           times by each thread over all of its endpoint(s).\r
+\r
+           The following parameters determine the behavior of the transaction test:\r
+\r
+           -s server_name      Specifies the name or IP address of the server interface.\r
+                               No default.\r
+\r
+           [ -t threads ]      Specify the number of threads to be used.\r
+                               Default: 1\r
+\r
+           [ -w endpoints ]    Specify the number of connected endpoints per thread.\r
+                               Default: 1\r
+\r
+           [ -i iterations ]   Specify the number of times the entire sequence\r
+                               of data transfers will be made over each endpoint.\r
+                               Default: 1000\r
+\r
+           [ -Q ]              Funnel completion events into a CNO.\r
+                               Default: use EVDs\r
+\r
+           [ -V ]              Validate the data being transferred.\r
+                               Default: ignore the data\r
+\r
+           [ -P ]              Turn on DTO completion polling\r
+                               Default: off\r
+\r
+           OP1 OP2 [ OP3, ... ]\r
+                               A single transaction (OPx) consists of:\r
+\r
+                               server|client   Indicates who initiates the\r
+                                               data transfer.\r
+\r
+                               SR|RR|RW        Indicates the type of transfer:\r
+                                               SR  send/recv\r
+                                               RR  RDMA read\r
+                                               RW  RDMA write\r
+                               Defaults: none\r
+\r
+                               [ seg_size [ num_segs ] ]\r
+:\r
+\r
+                                              Indicates the amount and format\r
+                                               of the data to be transferred.\r
+                                               Default:  4096  1\r
+                                                         (i.e., 1 4KB buffer)\r
+\r
+                               [ -f ]          For SR transfers only, indicates\r
+                                               that a client’s send transfer\r
+                                               completion should be reaped when\r
+                                               the next recv completion is reaped.\r
+                                               Sends and receives must be paired\r
+                                               (one client, one server, and in that\r
+                                               order) for this option to be used.\r
+\r
+           Restrictions:\r
+\r
+           Due to the flow control algorithm used by the transaction test, there\r
+           must be at least one SR OP for both the client and the server.\r
+\r
+           Requesting data validation (-V) causes the test to automatically append\r
+           three OPs to those specified. These additional operations provide\r
+           synchronization points during each iteration, at which all user-specified\r
+           transaction buffers are checked. These three appended operations satisfy\r
+           the "one SR in each direction" requirement.\r
+\r
+           The transaction OP list is printed out if -d is supplied.\r
+\r
+       Usage - Performance test client\r
+\r
+           dapltest [Common_Args] -s server_name [ -m p|b ]\r
+                    [ -i iterations ] [ -p pipeline ] OP\r
+\r
+           Performance testing (-T P) times the transfer of an operation.\r
+           The operation is posted ’iterations’ times.\r
+\r
+           The following parameters determine the behavior of the transaction test:\r
+\r
+           -s server_name      Specifies the name or IP address of the server interface.\r
+                               No default.\r
+\r
+           -m b|p              Used to choose either blocking (b) or polling (p)\r
+                               Default: blocking (b)\r
+          [ -i iterations ]   Specify the number of times the entire sequence\r
+                               of data transfers will be made over each endpoint.\r
+                               Default: 1000\r
+\r
+           [ -p pipeline ]     Specify the pipline length, valid arguments are in\r
+                               the range [0,MAX_SEND_DTOS]. If a value greater than\r
+                               MAX_SEND_DTOS is requested the value will be\r
+                               adjusted down to MAX_SEND_DTOS.\r
+                               Default: MAX_SEND_DTOS\r
+\r
+           OP                  Specifies the operation as follow:\r
+\r
+                               RR|RW           Indicates the type of transfer:\r
+                                               RR  RDMA read\r
+                                               RW  RDMA write\r
+                                               Defaults: none\r
+\r
+                               [ seg_size [ num_segs ] ]\r
+                                               Indicates the amount and format\r
+                                               of the data to be transferred.\r
+                                               Default:  4096  1\r
+                                                         (i.e., 1 4KB buffer)\r
+\r
+       Usage - Limit test client\r
+\r
+           Limit testing (-T L) neither requires nor connects to any server\r
+           instance.  The client runs one or more tests which attempt to\r
+           exhaust various resources to determine DAPL limits and exercise\r
+           DAPL error paths.  If no arguments are given, all tests are run.\r
+\r
+           Limit testing creates the sequence of DAT objects needed to\r
+           move data back and forth, attempting to find the limits supported\r
+           for the DAPL object requested.  For example, if the LMR creation\r
+           limit is being examined, the test will create a set of\r
+           {IA, PZ, CNO, EVD, EP} before trying to run dat_lmr_create() to\r
+           failure using that set of DAPL objects.  The ’width’ parameter\r
+           can be used to control how many of these parallel DAPL object\r
+           sets are created before beating upon the requested constructor.\r
+           Use of -m limits the number of dat_*_create() calls that will\r
+           be attempted, which can be helpful if the DAPL in use supports\r
+           essentailly unlimited numbers of some objects.\r
+           The limit test arguments are:\r
+\r
+           [ -m maximum ]      Specify the maximum number of dapl_*_create()\r
+                               attempts.\r
+                               Default: run to object creation failure\r
+\r
+           [ -w width ]        Specify the number of DAPL object sets to\r
+                               create while initializing.\r
+                               Default: 1\r
+\r
+           [ limit_ia ]        Attempt to exhaust dat_ia_open()\r
+\r
+           [ limit_pz ]        Attempt to exhaust dat_pz_create()\r
+\r
+           [ limit_cno ]       Attempt to exhaust dat_cno_create()\r
+\r
+           [ limit_evd ]       Attempt to exhaust dat_evd_create()\r
+\r
+           [ limit_ep ]        Attempt to exhaust dat_ep_create()\r
+\r
+           [ limit_rsp ]       Attempt to exhaust dat_rsp_create()\r
+\r
+           [ limit_psp ]       Attempt to exhaust dat_psp_create()\r
+\r
+           [ limit_lmr ]       Attempt to exhaust dat_lmr_create(4KB)\r
+\r
+           [ limit_rpost ]     Attempt to exhaust dat_ep_post_recv(4KB)\r
+\r
+           [ limit_size_lmr ]  Probe maximum size dat_lmr_create()\r
+\r
+                               Default: run all tests\r
+\r
+EXAMPLES\r
+       dapltest -T S -d -D OpenIB-cma\r
+\r
+                               Starts a server process with debug verbosity.\r
+\r
+       dapltest -T T -d -s host1-ib0 -D OpenIB-cma -i 100 client SR 4096 2 server SR 4096 2\r
+\r
+                               Runs a transaction test, with both sides\r
+                               sending one buffer with two 4KB segments,\r
+                              one hundred times.\r
+\r
+       dapltest -T P -d -s host1-ib0 -D OpenIB-cma -i 100 SR 4096 2\r
+\r
+                               Runs a performance test, with the client\r
+                               sending one buffer with two 4KB segments,\r
+                               one hundred times.\r
+\r
+       dapltest -T Q -s host1-ib0 -D OpenIB-cma\r
+\r
+                               Asks the server to clean up and exit.\r
+\r
+       dapltest -T L -D OpenIB-cma -d -w 16 -m 1000\r
+\r
+                               Runs all of the limit tests, setting up\r
+                               16 complete sets of DAPL objects, and\r
+                               creating at most a thousand instances\r
+                               when trying to exhaust resources.\r
+\r
+       dapltest -T T -V -d -t 2 -w 4 -i 55555 -s linux3 -D OpenIB-cma client RW 4096 1 server RW  2048  4\r
+       client SR 1024 4 server SR 4096 2 client SR 1024 3 -f server SR 2048 1 -f\r
+\r
+                               Runs a more complicated transaction test,\r
+                               with two thread using four EPs each,\r
+                               sending a more complicated buffer pattern\r
+                               for a larger number of iterations,\r
+                               validating the data received.\r
+\r
+       BUGS   (and  To Do List)\r
+\r
+           Use of CNOs (-Q) is not yet supported.\r
+\r
+           Further limit tests could be added.\r
+\r
+\r
+\r
+\r
diff --git a/ulp/dapl2/dapl/common/dapl_adapter_util.h b/ulp/dapl2/dapl/common/dapl_adapter_util.h
new file mode 100644 (file)
index 0000000..a962a88
--- /dev/null
@@ -0,0 +1,298 @@
+/*\r
+ * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    in the file LICENSE.txt in the root directory. The license is also\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is in the file\r
+ *    LICENSE2.txt in the root directory. The license is also available from\r
+ *    the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a \r
+ *    copy of which is in the file LICENSE3.txt in the root directory. The \r
+ *    license is also available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+/**********************************************************************\r
+ * \r
+ * HEADER: dapl_adapter_util.h\r
+ *\r
+ * PURPOSE: Utility defs & routines for the adapter data structure\r
+ *\r
+ * $Id: dapl_adapter_util.h 1317 2005-04-25 17:29:42Z jlentini $\r
+ *\r
+ **********************************************************************/\r
+\r
+#ifndef _DAPL_ADAPTER_UTIL_H_\r
+#define _DAPL_ADAPTER_UTIL_H_\r
+\r
+\r
+typedef enum async_handler_type\r
+{\r
+    DAPL_ASYNC_UNAFILIATED,\r
+       DAPL_ASYNC_CQ_ERROR,\r
+       DAPL_ASYNC_CQ_COMPLETION,\r
+       DAPL_ASYNC_QP_ERROR\r
+} DAPL_ASYNC_HANDLER_TYPE;\r
+\r
+\r
+int dapls_ib_init (void);\r
+\r
+int dapls_ib_release (void);\r
+\r
+DAT_RETURN dapls_ib_enum_hcas (\r
+        IN   const char                 *vendor, \r
+       OUT  DAPL_HCA_NAME              **hca_names,\r
+       OUT  DAT_COUNT                  *total_hca_count);\r
+\r
+DAT_RETURN dapls_ib_get_instance_data(\r
+       IN  DAPL_HCA_NAME hca_name, \r
+       OUT char *instance);\r
+\r
+DAT_RETURN dapls_ib_open_hca (\r
+       IN   char                      *namestr,\r
+       IN   DAPL_HCA                  *hca_ptr);\r
+\r
+DAT_RETURN dapls_ib_close_hca (\r
+       IN   DAPL_HCA                  *hca_ptr);\r
+\r
+DAT_RETURN dapls_ib_qp_alloc (\r
+       IN  DAPL_IA                     *ia_ptr,\r
+       IN  DAPL_EP                     *ep_ptr,\r
+       IN  DAPL_EP                     *ep_ctx_ptr);\r
+\r
+DAT_RETURN dapls_ib_qp_free (\r
+       IN  DAPL_IA                     *ia_ptr,\r
+       IN  DAPL_EP                     *ep_ptr);\r
+\r
+DAT_RETURN dapls_ib_qp_modify (\r
+       IN  DAPL_IA                     *ia_ptr,\r
+       IN  DAPL_EP                     *ep_ptr,\r
+       IN  DAT_EP_ATTR                 *ep_attr);\r
+\r
+DAT_RETURN dapls_ib_connect (\r
+       IN  DAT_EP_HANDLE               ep_handle,\r
+       IN  DAT_IA_ADDRESS_PTR          remote_ia_address,\r
+       IN  DAT_CONN_QUAL               remote_conn_qual,\r
+       IN  DAT_COUNT                   private_data_size,\r
+       IN  DAT_PVOID                   private_data);\r
+\r
+DAT_RETURN dapls_ib_disconnect (\r
+       IN  DAPL_EP                     *ep_ptr,\r
+       IN  DAT_CLOSE_FLAGS             close_flags);\r
+\r
+DAT_RETURN dapls_ib_setup_conn_listener (\r
+       IN  DAPL_IA                     *ia_ptr,\r
+       IN  DAT_UINT64                  ServiceID,\r
+       IN  DAPL_SP                     *sp_ptr);\r
+\r
+DAT_RETURN dapls_ib_remove_conn_listener (\r
+       IN  DAPL_IA                     *ia_ptr,\r
+       IN  DAPL_SP                     *sp_ptr);\r
+\r
+DAT_RETURN dapls_ib_accept_connection (\r
+       IN  DAT_CR_HANDLE               cr_handle,\r
+       IN  DAT_EP_HANDLE               ep_handle,\r
+       IN  DAT_COUNT                   private_data_size,\r
+       IN  const DAT_PVOID             private_data);\r
+\r
+DAT_RETURN dapls_ib_reject_connection (\r
+       IN  dp_ib_cm_handle_t   cm_handle,\r
+       IN  int                         reject_reason);\r
+\r
+DAT_RETURN dapls_ib_setup_async_callback (\r
+       IN  DAPL_IA                     *ia_ptr,\r
+       IN  DAPL_ASYNC_HANDLER_TYPE     handler_type,\r
+       IN  DAPL_EVD                    *evd_ptr,\r
+       IN  ib_async_handler_t          callback,\r
+       IN  void                        *context);\r
+\r
+DAT_RETURN dapls_ib_cq_alloc (\r
+       IN  DAPL_IA                     *ia_ptr,\r
+       IN  DAPL_EVD                    *evd_ptr,\r
+       IN  DAT_COUNT                   *cqlen);\r
+\r
+DAT_RETURN dapls_ib_cq_free (\r
+       IN  DAPL_IA                     *ia_ptr,\r
+       IN  DAPL_EVD                    *evd_ptr);\r
+\r
+DAT_RETURN dapls_set_cq_notify (\r
+       IN  DAPL_IA                     *ia_ptr,\r
+       IN  DAPL_EVD                    *evd_ptr);\r
+\r
+DAT_RETURN dapls_ib_cq_resize (\r
+       IN  DAPL_IA                     *ia_ptr,\r
+       IN  DAPL_EVD                    *evd_ptr,\r
+       IN  DAT_COUNT                   *cqlen);\r
+\r
+DAT_RETURN dapls_ib_pd_alloc (\r
+       IN  DAPL_IA                     *ia_ptr,\r
+       IN  DAPL_PZ                     *pz);\r
+\r
+DAT_RETURN dapls_ib_pd_free (\r
+       IN  DAPL_PZ                     *pz);\r
+\r
+DAT_RETURN dapls_ib_mr_register (\r
+       IN  DAPL_IA                     *ia_ptr,\r
+        IN  DAPL_LMR                   *lmr,\r
+       IN  DAT_PVOID                   virt_addr,\r
+       IN  DAT_VLEN                    length,\r
+       IN  DAT_MEM_PRIV_FLAGS          privileges,\r
+       IN  DAT_VA_TYPE                 va_type);\r
+\r
+#if defined(__KDAPL__)\r
+DAT_RETURN dapls_ib_mr_register_physical (\r
+       IN  DAPL_IA                     *ia_ptr,\r
+       INOUT  DAPL_LMR                 *lmr,\r
+       IN  DAT_PADDR                   phys_addr,\r
+       IN  DAT_VLEN                    length,\r
+       IN  DAT_MEM_PRIV_FLAGS          privileges);\r
+#endif /* __KDAPL__ */\r
+\r
+DAT_RETURN dapls_ib_mr_deregister (\r
+       IN  DAPL_LMR                    *lmr);\r
+\r
+DAT_RETURN dapls_ib_mr_register_shared (\r
+       IN  DAPL_IA                     *ia_ptr,\r
+        IN  DAPL_LMR                   *lmr,\r
+       IN  DAT_MEM_PRIV_FLAGS          privileges,\r
+       IN  DAT_VA_TYPE                 va_type);\r
+\r
+DAT_RETURN dapls_ib_mw_alloc (\r
+       IN  DAPL_RMR                    *rmr);\r
+\r
+DAT_RETURN dapls_ib_mw_free (\r
+       IN  DAPL_RMR                    *rmr);\r
+\r
+DAT_RETURN dapls_ib_mw_bind (\r
+       IN  DAPL_RMR                    *rmr,\r
+       IN  DAPL_LMR                    *lmr,\r
+       IN  DAPL_EP                     *ep,\r
+       IN  DAPL_COOKIE                 *cookie,\r
+       IN  DAT_VADDR                   virtual_address,\r
+       IN  DAT_VLEN                    length,\r
+       IN  DAT_MEM_PRIV_FLAGS          mem_priv,\r
+       IN  DAT_BOOLEAN                 is_signaled);\r
+\r
+DAT_RETURN dapls_ib_mw_unbind (\r
+       IN  DAPL_RMR                    *rmr,\r
+       IN  DAPL_EP                     *ep,\r
+       IN  DAPL_COOKIE                 *cookie,\r
+       IN  DAT_BOOLEAN                 is_signaled);\r
+\r
+DAT_RETURN dapls_ib_query_hca (\r
+       IN  DAPL_HCA                    *hca_ptr,\r
+       OUT DAT_IA_ATTR                 *ia_attr,\r
+       OUT DAT_EP_ATTR                 *ep_attr,\r
+       OUT DAT_SOCK_ADDR6              *ip_addr);\r
+\r
+DAT_RETURN dapls_ib_completion_poll (\r
+       IN  DAPL_HCA                    *hca_ptr,\r
+       IN  DAPL_EVD                    *evd_ptr,\r
+       IN  ib_work_completion_t        *cqe_ptr);\r
+\r
+DAT_RETURN dapls_ib_completion_notify (\r
+       IN  ib_hca_handle_t             hca_handle,\r
+       IN  DAPL_EVD                    *evd_ptr,\r
+       IN  ib_notification_type_t      type);\r
+\r
+DAT_DTO_COMPLETION_STATUS dapls_ib_get_dto_status (\r
+       IN  ib_work_completion_t        *cqe_ptr);\r
+\r
+void dapls_ib_reinit_ep (\r
+       IN  DAPL_EP                     *ep_ptr);\r
+\r
+void dapls_ib_disconnect_clean (\r
+       IN  DAPL_EP                     *ep_ptr,\r
+       IN  DAT_BOOLEAN                 passive,\r
+       IN  const ib_cm_events_t        ib_cm_event);\r
+\r
+DAT_RETURN dapls_ib_get_async_event (\r
+       IN  ib_error_record_t           *cause_ptr,\r
+       OUT DAT_EVENT_NUMBER            *async_event);\r
+\r
+DAT_EVENT_NUMBER dapls_ib_get_dat_event (\r
+       IN  const ib_cm_events_t        ib_cm_event,\r
+       IN  DAT_BOOLEAN                 active);\r
+\r
+ib_cm_events_t dapls_ib_get_cm_event (\r
+       IN  DAT_EVENT_NUMBER            dat_event_num);\r
+\r
+DAT_RETURN dapls_ib_cm_remote_addr (\r
+       IN  DAT_HANDLE                  dat_handle,\r
+       OUT DAT_SOCK_ADDR6              *remote_ia_address);\r
+\r
+int dapls_ib_private_data_size (\r
+       IN  DAPL_PRIVATE                *prd_ptr,\r
+       IN  DAPL_PDATA_OP               conn_op);\r
+\r
+void \r
+dapls_query_provider_specific_attr(\r
+       IN DAT_PROVIDER_ATTR            *provider_attr );\r
+\r
+#ifdef CQ_WAIT_OBJECT\r
+DAT_RETURN\r
+dapls_ib_wait_object_create (\r
+       IN DAPL_EVD                     *evd_ptr,\r
+       IN ib_wait_obj_handle_t         *p_cq_wait_obj_handle);\r
+\r
+DAT_RETURN\r
+dapls_ib_wait_object_destroy (\r
+       IN ib_wait_obj_handle_t         cq_wait_obj_handle);\r
+\r
+DAT_RETURN\r
+dapls_ib_wait_object_wakeup (\r
+       IN ib_wait_obj_handle_t         cq_wait_obj_handle);\r
+\r
+DAT_RETURN\r
+dapls_ib_wait_object_wait (\r
+       IN ib_wait_obj_handle_t         cq_wait_obj_handle,\r
+       IN u_int32_t                    timeout);\r
+#endif\r
+\r
+#ifdef DAT_EXTENSIONS\r
+void\r
+dapls_cqe_to_event_extension(\r
+       IN DAPL_EP                      *ep_ptr,\r
+       IN DAPL_COOKIE                  *cookie,\r
+       IN ib_work_completion_t         *cqe_ptr,\r
+       IN DAT_EVENT                    *event_ptr);\r
+#endif\r
+\r
+/*\r
+ * Values for provider DAT_NAMED_ATTR\r
+ */\r
+#define IB_QP_STATE            1       /* QP state change request */\r
+\r
+\r
+#ifdef IBAPI\r
+#include "dapl_ibapi_dto.h"\r
+#elif VAPI\r
+#include "dapl_vapi_dto.h"\r
+#elif __OPENIB__\r
+#include "dapl_openib_dto.h"\r
+#elif DUMMY\r
+#include "dapl_dummy_dto.h"\r
+#elif OPENIB\r
+#include "dapl_ib_dto.h"\r
+#else\r
+#include "dapl_ibal_dto.h"\r
+#endif\r
+\r
+\r
+#endif /*  _DAPL_ADAPTER_UTIL_H_ */\r
diff --git a/ulp/dapl2/dapl/common/dapl_cno_util.c b/ulp/dapl2/dapl/common/dapl_cno_util.c
new file mode 100644 (file)
index 0000000..a4c3146
--- /dev/null
@@ -0,0 +1,336 @@
+/*\r
+ * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
+ *    copy of which is available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+/**********************************************************************\r
+ *\r
+ * MODULE: dapl_cno_util.c\r
+ *\r
+ * PURPOSE: Manage CNO Info structure\r
+ *\r
+ * $Id:$\r
+ **********************************************************************/\r
+\r
+#include "dapl_ia_util.h"\r
+#include "dapl_cno_util.h"\r
+#include "dapl_adapter_util.h"\r
+\r
+\r
+\r
+/*\r
+ * dapl_cno_alloc\r
+ *\r
+ * alloc and initialize an EVD struct\r
+ *\r
+ * Input:\r
+ *     ia\r
+ *\r
+ * Returns:\r
+ *     cno_ptr, or null on failure.\r
+ */\r
+#if defined(__KDAPL__)\r
+DAPL_CNO *\r
+dapl_cno_alloc (\r
+    IN DAPL_IA                         *ia_ptr,\r
+    IN const DAT_UPCALL_OBJECT         *upcall)\r
+#else\r
+DAPL_CNO *\r
+dapl_cno_alloc (\r
+    IN DAPL_IA                         *ia_ptr,\r
+    IN DAT_OS_WAIT_PROXY_AGENT         wait_agent)\r
+#endif /* defined(__KDAPL__) */\r
+{\r
+    DAPL_CNO *cno_ptr;\r
+\r
+    cno_ptr = (DAPL_CNO *) dapl_os_alloc (sizeof (DAPL_CNO));\r
+    if (!cno_ptr)\r
+    {\r
+       return NULL;\r
+    }\r
+\r
+    /* zero the structure */\r
+    dapl_os_memzero (cno_ptr, sizeof (DAPL_CNO));\r
+\r
+    /*\r
+     * Initialize the header.\r
+     */\r
+    cno_ptr->header.provider            = ia_ptr->header.provider;\r
+    cno_ptr->header.magic               = DAPL_MAGIC_CNO;\r
+#if !defined(__KDAPL__)\r
+    cno_ptr->header.handle_type         = DAT_HANDLE_TYPE_CNO;\r
+#endif /* defined(__KDAPL__) */\r
+    cno_ptr->header.owner_ia            = ia_ptr;\r
+    cno_ptr->header.user_context.as_64  = 0;\r
+    cno_ptr->header.user_context.as_ptr = NULL;\r
+    dapl_llist_init_entry (&cno_ptr->header.ia_list_entry);\r
+    dapl_os_lock_init (&cno_ptr->header.lock);\r
+\r
+    /*\r
+     * Initialize the body\r
+     */\r
+    cno_ptr->cno_waiters = 0;\r
+    dapl_os_atomic_set (&cno_ptr->cno_ref_count, 0);\r
+    cno_ptr->cno_state = DAPL_CNO_STATE_UNTRIGGERED;\r
+    cno_ptr->cno_evd_triggered = NULL;\r
+#if defined(__KDAPL__)\r
+    cno_ptr->cno_upcall = *upcall;\r
+#else\r
+    cno_ptr->cno_wait_agent = wait_agent;\r
+#endif /* defined(__KDAPL__) */\r
+    dapl_os_wait_object_init (&cno_ptr->cno_wait_object);\r
+\r
+    return cno_ptr;\r
+}\r
+\r
+/*\r
+ * dapl_cno_dealloc\r
+ *\r
+ * Free the passed in CNO structure.\r
+ *\r
+ * Input:\r
+ *     cno_ptr\r
+ *\r
+ * Output:\r
+ *     none\r
+ *\r
+ * Returns:\r
+ *     none\r
+ *\r
+ */\r
+void\r
+dapl_cno_dealloc (\r
+    IN DAPL_CNO *cno_ptr)\r
+{\r
+    dapl_os_assert (cno_ptr->header.magic == DAPL_MAGIC_CNO);\r
+    dapl_os_assert (dapl_os_atomic_read (&cno_ptr->cno_ref_count) == 0);\r
+\r
+    /*\r
+     * deinitialize the header\r
+     */\r
+    cno_ptr->header.magic = DAPL_MAGIC_INVALID; /* reset magic to prevent reuse */\r
+\r
+    dapl_os_wait_object_destroy (&cno_ptr->cno_wait_object);\r
+    dapl_os_free (cno_ptr, sizeof (DAPL_CNO));\r
+}\r
+\r
+\r
+/*\r
+ * dapl_internal_cno_trigger\r
+ *\r
+ * DAPL Internal routine to trigger the specified CNO.\r
+ * Called by the callback of some EVD associated with the CNO.\r
+ *\r
+ *\r
+ *\r
+ * Input:\r
+ *     cno_ptr\r
+ *     evd_ptr         EVD triggering\r
+ *\r
+ * Output:\r
+ *     None\r
+ *\r
+ * Returns:\r
+ *     None\r
+ */\r
+void\r
+dapl_internal_cno_trigger (\r
+    IN DAPL_CNO                *cno_ptr,\r
+    IN DAPL_EVD                *evd_ptr)\r
+{\r
+    DAT_RETURN         dat_status;\r
+#if defined(__KDAPL__)\r
+    DAT_EVENT          event;\r
+#endif /* defined(__KDAPL__) */\r
+\r
+    dat_status = DAT_SUCCESS;\r
+\r
+    dapl_os_assert (cno_ptr->header.magic == DAPL_MAGIC_CNO);\r
+    /* The spec allows NULL EVDs. kDAPL doesn't have CNOs, they\r
+     * are strictly used behind the scenes\r
+     */\r
+    dapl_os_assert (evd_ptr == NULL || evd_ptr->header.magic == DAPL_MAGIC_EVD);\r
+\r
+    dapl_os_lock (&cno_ptr->header.lock);\r
+\r
+    /* Maybe I should just return, but this really shouldn't happen.  */\r
+    dapl_os_assert (cno_ptr->cno_state != DAPL_CNO_STATE_DEAD);\r
+\r
+    if (cno_ptr->cno_state == DAPL_CNO_STATE_UNTRIGGERED)\r
+    {\r
+#if !defined(__KDAPL__)\r
+       DAT_OS_WAIT_PROXY_AGENT agent;\r
+\r
+       /* Squirrel away wait agent, and delete link.  */\r
+       agent = cno_ptr->cno_wait_agent;\r
+#endif /* !defined(__KDAPL__) */\r
+\r
+       /* Separate assignments for windows compiler.  */\r
+#ifndef _WIN32\r
+#if defined(__KDAPL__)\r
+       cno_ptr->cno_upcall = DAT_UPCALL_NULL;\r
+#else\r
+       cno_ptr->cno_wait_agent = DAT_OS_WAIT_PROXY_AGENT_NULL;\r
+#endif /* defined(__KDAPL__) */\r
+#else\r
+       cno_ptr->cno_wait_agent.instance_data    = NULL;\r
+       cno_ptr->cno_wait_agent.proxy_agent_func = NULL;\r
+#endif\r
+\r
+       cno_ptr->cno_evd_triggered = evd_ptr;\r
+\r
+       /*\r
+        * Must set to triggerred and let waiter untrigger to handle\r
+        * timeout of waiter.\r
+        */\r
+       cno_ptr->cno_state = DAPL_CNO_STATE_TRIGGERED;\r
+       if (cno_ptr->cno_waiters > 0)\r
+       {\r
+           dapl_os_wait_object_wakeup (&cno_ptr->cno_wait_object);\r
+       }\r
+\r
+       dapl_os_unlock (&cno_ptr->header.lock);\r
+\r
+       /* Trigger the OS proxy wait agent, if one exists.  */\r
+#if defined(__KDAPL__)\r
+       dat_status = dapl_evd_dequeue ( (DAT_EVD_HANDLE)evd_ptr,\r
+                                      &event );\r
+       while (dat_status == DAT_SUCCESS )\r
+       {\r
+           if (cno_ptr->cno_upcall.upcall_func != (DAT_UPCALL_FUNC) NULL)\r
+           {\r
+               cno_ptr->cno_upcall.upcall_func (\r
+                                       cno_ptr->cno_upcall.instance_data,\r
+                                       &event,\r
+                                       DAT_FALSE);\r
+           }\r
+           dat_status = dapl_evd_dequeue ( (DAT_EVD_HANDLE)evd_ptr,\r
+                                          &event );\r
+       }\r
+#else\r
+       if (agent.proxy_agent_func != (DAT_AGENT_FUNC) NULL)\r
+       {\r
+           agent.proxy_agent_func (\r
+               agent.instance_data, (DAT_EVD_HANDLE) evd_ptr );\r
+       }\r
+#endif /* defined(__KDAPL__) */\r
+    }\r
+    else\r
+    {\r
+       dapl_os_unlock (&cno_ptr->header.lock);\r
+#if defined(__KDAPL__)\r
+       dat_status = dapl_evd_dequeue ( (DAT_EVD_HANDLE)evd_ptr,\r
+                                      &event );\r
+       while (dat_status == DAT_SUCCESS )\r
+       {\r
+           if (cno_ptr->cno_upcall.upcall_func != (DAT_UPCALL_FUNC) NULL)\r
+           {\r
+               cno_ptr->cno_upcall.upcall_func (\r
+                                       cno_ptr->cno_upcall.instance_data,\r
+                                       &event,\r
+                                       DAT_FALSE);\r
+           }\r
+           dat_status = dapl_evd_dequeue ( (DAT_EVD_HANDLE)evd_ptr,\r
+                                          &event );\r
+       }\r
+#endif /* defined(__KDAPL__) */\r
+    }\r
+\r
+    return;\r
+}\r
+\r
+/*\r
+ * dapl_cno_fd_create\r
+ *\r
+ * DAPL Requirements Version 2.0, 6.3.2.x\r
+ *\r
+ * creates a CNO instance. Upon creation, there are no\r
+ * Event Dispatchers feeding it. os_fd is a File Descriptor in Unix, \r
+ * i.e. struct pollfd or an equivalent object in other OSes that is \r
+ * always associates with the created CNO. Consumer can multiplex event \r
+ * waiting using UNIX poll or select functions. Upon creation, the CNO \r
+ * is not associated with any EVDs, has no waiters and has the os_fd \r
+ * associated with it.\r
+ *\r
+ * Input:\r
+ *     ia_handle\r
+ *\r
+ * Output:\r
+ *     file descripter\r
+ *     cno_handle\r
+ * \r
+ * Returns:\r
+ *     DAT_SUCCESS\r
+ *     DAT_INSUFFICIENT_RESOURCES\r
+ *     DAT_INVALID_PARAMETER\r
+ *     DAT_INVALID_HANDLE\r
+ *     DAT_INVALID_STATE\r
+ *     DAT_LENGTH_ERROR\r
+ *     DAT_PROTECTION_VIOLATION\r
+ *     DAT_PRIVILEGES_VIOLATION\r
+ *     DAT_MODEL_NOT_SUPPORTED\r
+ */\r
+DAT_RETURN DAT_API\r
+dapl_cno_fd_create (\r
+       IN      DAT_IA_HANDLE ia_handle,        /* ia_handle            */\r
+       OUT     DAT_FD *fd,                     /* file_descriptor      */\r
+       OUT     DAT_CNO_HANDLE *cno_handle)     /* cno_handle           */\r
+{\r
+       return DAT_MODEL_NOT_SUPPORTED;\r
+}\r
+\r
+/*\r
+ * dapl_cno_fd_create\r
+ *\r
+ * DAPL Requirements Version 2.0, 6.3.2.x\r
+ *\r
+ * Returns the latest EVD that triggered the CNO.\r
+ * \r
+ * Input:\r
+ *     cno_handle\r
+ *\r
+ * Output:\r
+ *     evd_handle\r
+ * \r
+ * Returns:\r
+ *     DAT_SUCCESS\r
+ *     DAT_INVALID_HANDLE\r
+ *     DAT_MODEL_NOT_SUPPORTED\r
+ */\r
+DAT_RETURN DAT_API\r
+dapl_cno_trigger(\r
+    IN  DAT_CNO_HANDLE cno_handle,\r
+    OUT DAT_EVD_HANDLE *evd_handle)\r
+{\r
+       return DAT_MODEL_NOT_SUPPORTED;\r
+}\r
+\r
+/*\r
+ * Local variables:\r
+ *  c-indent-level: 4\r
+ *  c-basic-offset: 4\r
+ *  tab-width: 8\r
+ * End:\r
+ */\r
diff --git a/ulp/dapl2/dapl/common/dapl_cno_util.h b/ulp/dapl2/dapl/common/dapl_cno_util.h
new file mode 100644 (file)
index 0000000..7cd204c
--- /dev/null
@@ -0,0 +1,66 @@
+/*\r
+ * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
+ *    copy of which is available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+/**********************************************************************\r
+ * \r
+ * HEADER: dapl_cno_util.h\r
+ *\r
+ * PURPOSE: Utility defs & routines for the cno data structure\r
+ *\r
+ * $Id:$\r
+ *\r
+ **********************************************************************/\r
+\r
+#ifndef _DAPL_CNO_UTIL_H_\r
+#define _DAPL_CNO_UTIL_H_\r
+\r
+#include "dapl.h"\r
+\r
+#if defined(__KDAPL__)\r
+DAPL_CNO *\r
+dapl_cno_alloc (\r
+    IN DAPL_IA                         *ia_ptr,\r
+    IN const DAT_UPCALL_OBJECT         *upcall) ;\r
+\r
+#else\r
+DAPL_CNO *\r
+dapl_cno_alloc (\r
+    IN DAPL_IA                         *ia_ptr,\r
+    IN DAT_OS_WAIT_PROXY_AGENT         wait_agent) ;\r
+\r
+#endif /* defined(__KDAPL__) */\r
+\r
+void\r
+dapl_cno_dealloc (\r
+    IN DAPL_CNO *cno_ptr) ;\r
+\r
+void\r
+dapl_internal_cno_trigger(\r
+    IN DAPL_CNO                *cno_ptr,\r
+    IN DAPL_EVD                *evd_ptr);\r
+\r
+#endif\r
diff --git a/ulp/dapl2/dapl/common/dapl_cookie.c b/ulp/dapl2/dapl/common/dapl_cookie.c
new file mode 100644 (file)
index 0000000..7819187
--- /dev/null
@@ -0,0 +1,368 @@
+/*\r
+ * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
+ *    copy of which is available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+/**********************************************************************\r
+ * \r
+ * MODULE: dapl_cookie.c\r
+ *\r
+ * PURPOSE: Manage CQE cookie structures\r
+ *\r
+ * The DAPL spec requires that all a cookies passed to a posting operation \r
+ * be returned in the operation's corresponding completion. \r
+ * \r
+ * Implementing this feature is complicated by the user's ability to \r
+ * suppress event generation for specific operations. When these operations \r
+ * complete successfully, the provider does not have an easy way to \r
+ * deallocate resources devoted to storing context data for these operations.\r
+ *\r
+ * To support this feature, a pool of memory is allocated up front large \r
+ * enough to hold cookie data for the maximum number of operations possible \r
+ * on an endpoint. \r
+ *\r
+ * Two pieces of information are maintained to manage cookie allocation:\r
+ *\r
+ * head index : index of next unallocated cookie \r
+ * tail index : index of last unallocated cookie\r
+ *\r
+ * Each cookie store its index in this memory pool.\r
+ *\r
+ * When an event is received, the index stored in the event's cookie will be \r
+ * used to update the tail. This will implicitly deallocate all of the cookies \r
+ * "between" the old tail and the new tail.\r
+ *\r
+ * The implementation relies on the following assumptions:\r
+ *\r
+ * - there can be only 1 thread in dat_ep_post_send(), dat_ep_post_rdma_write(),\r
+ *   dat_ep_post_rdma_read(), or dat_rmr_bind() at a time, therefore \r
+ *   dapls_cb_get() does not need to be thread safe when manipulating\r
+ *   request data structures.\r
+ *\r
+ * - there can be only 1 thread in dat_ep_post_recv(), therefore \r
+ *   dapls_cb_get() does not need to be thread safe when manipulating\r
+ *   receive data structures.\r
+ *\r
+ * - there can be only 1 thread generating completions for a given EP's request \r
+ *   opeartions, therefore dapls_cb_put() does not need to be thread safe when \r
+ *   manipulating request data structures.\r
+ *\r
+ * - there can be only 1 thread generating completions for a given EP's receive \r
+ *   opeartions therefore dapls_cb_put() does not need to be thread safe when \r
+ *   manipulating receive data structures.\r
+ *\r
+ * - completions are delivered in order\r
+ *\r
+ * $Id:$\r
+ **********************************************************************/\r
+\r
+#include "dapl_cookie.h"\r
+#include "dapl_ring_buffer_util.h"\r
+\r
+\r
+/*********************************************************************\r
+ *                                                                   *\r
+ * Function Prototypes                                               *\r
+ *                                                                   *\r
+ *********************************************************************/\r
+\r
+DAT_RETURN \r
+dapls_cb_get (\r
+    DAPL_COOKIE_BUFFER         *buffer,\r
+    DAPL_COOKIE                **cookie_ptr );\r
+\r
+DAT_RETURN \r
+dapls_cb_put (\r
+    DAPL_COOKIE_BUFFER         *buffer,\r
+    DAPL_COOKIE                *cookie );\r
+\r
+\r
+/*********************************************************************\r
+ *                                                                   *\r
+ * Function Definitions                                              *\r
+ *                                                                   *\r
+ *********************************************************************/\r
+\r
+\r
+/*\r
+ * dapls_cb_create\r
+ *\r
+ * Given a DAPL_COOKIE_BUFFER, allocate and initialize memory for\r
+ * the data structure.\r
+ *\r
+ * Input:\r
+ *     buffer          pointer to DAPL_COOKIE_BUFFER\r
+ *     ep              endpoint to associate with cookies\r
+ *     size            number of elements to allocate & manage\r
+ *\r
+ * Output:\r
+ *     none\r
+ *\r
+ * Returns:\r
+ *     DAT_SUCCESS\r
+ *     DAT_INSUFFICIENT_RESOURCES\r
+ *\r
+ */\r
+DAT_RETURN\r
+dapls_cb_create (\r
+    IN  DAPL_COOKIE_BUFFER     *buffer,\r
+    IN         DAPL_EP                 *ep,\r
+    IN  DAT_COUNT              size )\r
+{\r
+    DAT_COUNT                  i;\r
+\r
+    /*\r
+     * allocate one additional entry so that the tail \r
+     * can always point at an empty location\r
+     */\r
+    size++; \r
+\r
+    buffer->pool = dapl_os_alloc (size * sizeof (DAPL_COOKIE));\r
+    if ( NULL != buffer->pool )\r
+    {\r
+       buffer->pool_size = size;\r
+       dapl_os_atomic_set(&buffer->head, 0);\r
+       dapl_os_atomic_set(&buffer->tail, 0);\r
+\r
+        for ( i = 0; i < size; i++ )\r
+        {\r
+            buffer->pool[i].index = i;\r
+            buffer->pool[i].ep = ep;\r
+        }\r
+\r
+        return (DAT_SUCCESS);\r
+    }\r
+    else\r
+    {\r
+       return (DAT_INSUFFICIENT_RESOURCES);\r
+    }\r
+}\r
+\r
+\r
+/*\r
+ * dapls_cb_free\r
+ *\r
+ * Free the data structure\r
+ *\r
+ * Input:\r
+ *     buffer          pointer to DAPL_COOKIE_BUFFER\r
+ *\r
+ * Output:\r
+ *     none\r
+ *\r
+ * Returns:\r
+ *     none\r
+ *\r
+ */\r
+void\r
+dapls_cb_free (\r
+    IN  DAPL_COOKIE_BUFFER     *buffer )\r
+{\r
+    if ( NULL != buffer->pool )\r
+    {\r
+        dapl_os_free (buffer->pool, buffer->pool_size * sizeof (DAPL_COOKIE));\r
+    }\r
+}\r
+\r
+\r
+/*\r
+ * dapls_cb_get\r
+ *\r
+ * Remove an entry from the buffer\r
+ *\r
+ * Input:\r
+ *     buffer          pointer to DAPL_COOKIE_BUFFER\r
+ *\r
+ * Output:\r
+ *      cookie_ptr     pointer to pointer to cookie\r
+ *\r
+ * Returns:\r
+ *     DAT_SUCCESS\r
+ *     DAT_INVALID_PARAMETER\r
+ *     DAT_INSUFFICIENT_RESOURCES\r
+ *\r
+ */\r
+DAT_RETURN \r
+dapls_cb_get (\r
+    IN  DAPL_COOKIE_BUFFER     *buffer,\r
+    OUT DAPL_COOKIE            **cookie_ptr )\r
+{\r
+    DAT_RETURN                 dat_status;\r
+    DAT_COUNT                  new_head;\r
+\r
+    dapl_os_assert(NULL != cookie_ptr);\r
+\r
+    new_head = (dapl_os_atomic_read (&buffer->head) + 1) % buffer->pool_size;\r
+\r
+    if ( new_head == dapl_os_atomic_read (&buffer->tail) )\r
+    {\r
+        dat_status = DAT_INSUFFICIENT_RESOURCES;\r
+       goto bail;\r
+    }\r
+    else\r
+    {\r
+        dapl_os_atomic_set (&buffer->head, new_head);\r
+\r
+       *cookie_ptr = &buffer->pool[dapl_os_atomic_read (&buffer->head)];\r
+       dat_status = DAT_SUCCESS;\r
+    }\r
+bail:\r
+    return dat_status;\r
+}\r
+\r
+\r
+/*\r
+ * dapls_cb_put\r
+ *\r
+ * Add entry(s) to the buffer\r
+ *\r
+ * Input:\r
+ *     buffer          pointer to DAPL_COOKIE_BUFFER\r
+ *      cookie                 pointer to cookie\r
+ *\r
+ * Output:\r
+ *     entry           entry removed from the ring buffer\r
+ *\r
+ * Returns:\r
+ *     DAT_SUCCESS\r
+ *     DAT_INSUFFICIENT_EMPTY\r
+ *\r
+ */\r
+DAT_RETURN \r
+dapls_cb_put (\r
+    IN  DAPL_COOKIE_BUFFER     *buffer,\r
+    IN  DAPL_COOKIE            *cookie )\r
+{\r
+    dapl_os_atomic_set (&buffer->tail, cookie->index);\r
+\r
+    return DAT_SUCCESS;\r
+}\r
+\r
+\r
+/*\r
+ * dapls_rmr_cookie_alloc\r
+ *\r
+ * Allocate an RMR Bind cookie\r
+ *\r
+ * Input:\r
+ *     buffer          pointer to DAPL_COOKIE_BUFFER\r
+ *      rmr            rmr to associate with the cookie\r
+ *      user_cookie     user's cookie data \r
+ *\r
+ * Output:\r
+ *     cookie_ptr      pointer to pointer to allocated cookie\r
+ *\r
+ * Returns:\r
+ *     DAT_SUCCESS\r
+ *     DAT_INSUFFICIENT_EMPTY\r
+ *\r
+ */\r
+DAT_RETURN\r
+dapls_rmr_cookie_alloc (\r
+    IN  DAPL_COOKIE_BUFFER     *buffer,\r
+    IN         DAPL_RMR                *rmr,\r
+    IN         DAT_RMR_COOKIE          user_cookie,\r
+    OUT DAPL_COOKIE            **cookie_ptr )\r
+{\r
+    DAPL_COOKIE                *cookie;\r
+    DAT_RETURN                 dat_status;\r
+\r
+    if ( DAT_SUCCESS != dapls_cb_get (buffer, &cookie) )\r
+    {\r
+        *cookie_ptr = NULL;\r
+        dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
+       goto bail;\r
+    }\r
+    \r
+    dat_status = DAT_SUCCESS;\r
+    cookie->type           = DAPL_COOKIE_TYPE_RMR;\r
+    cookie->val.rmr.rmr    = rmr;\r
+    cookie->val.rmr.cookie = user_cookie;\r
+\r
+    *cookie_ptr =  cookie;\r
+\r
+ bail:\r
+    return dat_status;\r
+}\r
+\r
+\r
+/*\r
+ * dapls_dto_cookie_alloc\r
+ *\r
+ * Allocate a DTO cookie\r
+ *\r
+ * Input:\r
+ *     buffer          pointer to DAPL_COOKIE_BUFFER\r
+ *     type            DTO type\r
+ *      user_cookie     user's cookie data \r
+ *\r
+ * Output:\r
+ *     cookie_ptr      pointer to pointer to allocated cookie\r
+ *\r
+ * Returns:\r
+ *     DAT_SUCCESS\r
+ *     DAT_INSUFFICIENT_EMPTY\r
+ *\r
+ */\r
+DAT_RETURN\r
+dapls_dto_cookie_alloc (\r
+    IN  DAPL_COOKIE_BUFFER     *buffer,\r
+    IN  DAPL_DTO_TYPE          type,\r
+    IN         DAT_DTO_COOKIE          user_cookie,\r
+    OUT DAPL_COOKIE            **cookie_ptr )\r
+{\r
+    DAPL_COOKIE                *cookie;\r
+\r
+    if ( DAT_SUCCESS != dapls_cb_get (buffer, &cookie) )\r
+    {\r
+        *cookie_ptr = NULL;\r
+        return DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
+    }\r
+    \r
+    cookie->type = DAPL_COOKIE_TYPE_DTO;\r
+    cookie->val.dto.type = type;\r
+    cookie->val.dto.cookie = user_cookie;\r
+    cookie->val.dto.size = 0;\r
+\r
+    *cookie_ptr = cookie;\r
+    return DAT_SUCCESS;\r
+}\r
+\r
+void\r
+dapls_cookie_dealloc (\r
+    IN  DAPL_COOKIE_BUFFER     *buffer,\r
+    IN         DAPL_COOKIE             *cookie)\r
+{\r
+    dapls_cb_put (buffer, cookie);\r
+}\r
+\r
+\r
+/*\r
+ * Local variables:\r
+ *  c-indent-level: 4\r
+ *  c-basic-offset: 4\r
+ *  tab-width: 8\r
+ * End:\r
+ */\r
diff --git a/ulp/dapl2/dapl/common/dapl_cookie.h b/ulp/dapl2/dapl/common/dapl_cookie.h
new file mode 100644 (file)
index 0000000..7aa4457
--- /dev/null
@@ -0,0 +1,72 @@
+/*\r
+ * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
+ *    copy of which is available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+/**********************************************************************\r
+ * \r
+ * HEADER: dapl_cookie.h\r
+ *\r
+ * PURPOSE: Utility defs & routines for the cookie data structure\r
+ *\r
+ * $Id:$\r
+ *\r
+ **********************************************************************/\r
+\r
+#ifndef _DAPL_COOKIE_H\r
+#define _DAPL_COOKIE_H_\r
+\r
+#include "dapl.h"\r
+\r
+extern DAT_RETURN \r
+dapls_cb_create (\r
+    DAPL_COOKIE_BUFFER         *buffer,\r
+    DAPL_EP                    *ep,\r
+    DAT_COUNT                  size );\r
+\r
+extern void \r
+dapls_cb_free (\r
+    DAPL_COOKIE_BUFFER         *buffer );\r
+\r
+extern DAT_RETURN\r
+dapls_rmr_cookie_alloc (\r
+    IN  DAPL_COOKIE_BUFFER     *buffer,\r
+    IN         DAPL_RMR                *rmr,\r
+    IN         DAT_RMR_COOKIE          user_cookie,\r
+    OUT DAPL_COOKIE            **cookie_ptr );\r
+\r
+extern DAT_RETURN\r
+dapls_dto_cookie_alloc (\r
+    IN  DAPL_COOKIE_BUFFER     *buffer,\r
+    IN  DAPL_DTO_TYPE          type,\r
+    IN         DAT_DTO_COOKIE          user_cookie,\r
+    OUT DAPL_COOKIE            **cookie_ptr );\r
+\r
+extern void\r
+dapls_cookie_dealloc (\r
+    IN  DAPL_COOKIE_BUFFER     *buffer,\r
+    IN         DAPL_COOKIE             *cookie );\r
+\r
+#endif /* _DAPL_COOKIE_H_ */\r
diff --git a/ulp/dapl2/dapl/common/dapl_cr_accept.c b/ulp/dapl2/dapl/common/dapl_cr_accept.c
new file mode 100644 (file)
index 0000000..3db6f75
--- /dev/null
@@ -0,0 +1,251 @@
+/*\r
+ * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
+ *    copy of which is available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+/**********************************************************************\r
+ * \r
+ * MODULE: dapl_cr_accept.c\r
+ *\r
+ * PURPOSE: Connection management\r
+ * Description: Interfaces in this file are completely described in\r
+ *             the DAPL 1.1 API, Chapter 6, section 4\r
+ *\r
+ * $Id:$\r
+ **********************************************************************/\r
+\r
+#include "dapl.h"\r
+#include "dapl_adapter_util.h"\r
+#include "dapl_evd_util.h"\r
+\r
+/*\r
+ * dapl_cr_accept\r
+ *\r
+ * DAPL Requirements Version xxx, 6.4.2.1\r
+ *\r
+ * Establish a connection between active remote side requesting Endpoint\r
+ * and passic side local Endpoint.\r
+ *\r
+ * Input:\r
+ *     cr_handle\r
+ *     ep_handle\r
+ *     private_data_size\r
+ *     private_data\r
+ *\r
+ * Output:\r
+ *     none\r
+ *\r
+ * Returns:\r
+ *     DAT_SUCCESS\r
+ *     DAT_INVALID_PARAMETER\r
+ *     DAT_INVALID_ATTRIBUTE\r
+ */\r
+DAT_RETURN DAT_API\r
+dapl_cr_accept (\r
+       IN      DAT_CR_HANDLE           cr_handle,\r
+       IN      DAT_EP_HANDLE           ep_handle,\r
+       IN      DAT_COUNT               private_data_size,\r
+       IN      const DAT_PVOID         private_data )\r
+{\r
+    DAPL_EP            *ep_ptr;\r
+    DAT_RETURN         dat_status;\r
+    DAPL_CR            *cr_ptr;\r
+    DAT_EP_STATE       entry_ep_state;\r
+    DAT_EP_HANDLE      entry_ep_handle;\r
+\r
+    dapl_dbg_log (DAPL_DBG_TYPE_API,\r
+                  "dapl_cr_accept (CR %p EP %p, PDsz %d)\n",\r
+                  cr_handle, \r
+                  ep_handle, \r
+                  private_data_size);\r
+\r
+    if ( DAPL_BAD_HANDLE (cr_handle, DAPL_MAGIC_CR) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_CR);\r
+       goto bail;\r
+    }\r
+\r
+    cr_ptr = (DAPL_CR *) cr_handle;\r
\r
+    /*\r
+     * Return an error if we have an ep_handle and the CR already has an\r
+     * EP, indicating this is an RSP connection or PSP_PROVIDER_FLAG was\r
+     * specified.\r
+     */\r
+    if ( ep_handle != NULL &&\r
+        ( DAPL_BAD_HANDLE (ep_handle, DAPL_MAGIC_EP) ||\r
+          cr_ptr->param.local_ep_handle != NULL ) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);\r
+       goto bail;\r
+    }\r
\r
+    /* Make sure we have an EP handle in one place or another */\r
+    if ( ep_handle == NULL && cr_ptr->param.local_ep_handle == NULL )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);\r
+       goto bail;\r
+    }\r
+    \r
+    if ( (0 != private_data_size) && (NULL == private_data) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG4);\r
+       goto bail;\r
+    }\r
+\r
+    /*\r
+     * ep_handle is NULL if the user specified DAT_PSP_PROVIDER_FLAG\r
+     * OR this is an RSP connection; retrieve it from the cr.\r
+     */\r
+    if ( ep_handle == NULL )\r
+    {\r
+        ep_handle = cr_ptr->param.local_ep_handle;\r
+       if ( (((DAPL_EP *) ep_handle)->param.ep_state != DAT_EP_STATE_TENTATIVE_CONNECTION_PENDING)\r
+            && (((DAPL_EP *)ep_handle)->param.ep_state != DAT_EP_STATE_PASSIVE_CONNECTION_PENDING)  )\r
+       {\r
+           return DAT_INVALID_STATE;\r
+       }\r
+    } else\r
+    {\r
+        /* ensure this EP isn't connected or in use*/\r
+       if ( ((DAPL_EP *) ep_handle)->param.ep_state != DAT_EP_STATE_UNCONNECTED )\r
+       {\r
+           return DAT_INVALID_STATE;\r
+       }\r
+    }\r
+\r
+    ep_ptr = (DAPL_EP *) ep_handle;\r
+\r
+    /*\r
+     * Verify the attributes of the EP handle before we connect it. Test\r
+     * all of the handles to make sure they are currently valid.\r
+     * Specifically:\r
+     *   pz_handle             required\r
+     *   recv_evd_handle       optional, but must be valid\r
+     *   request_evd_handle    optional, but must be valid\r
+     *   connect_evd_handle    required\r
+     * We do all verification and state change under lock, at which\r
+     * point the EP state should protect us from most races.\r
+     */\r
+    dapl_os_lock ( &ep_ptr->header.lock );\r
+    if ( ep_ptr->param.pz_handle == NULL\r
+        ||  DAPL_BAD_HANDLE (ep_ptr->param.pz_handle, DAPL_MAGIC_PZ)\r
+        /* test connect handle */\r
+        || ep_ptr->param.connect_evd_handle == NULL\r
+        || DAPL_BAD_HANDLE (ep_ptr->param.connect_evd_handle, DAPL_MAGIC_EVD)\r
+        || ! (((DAPL_EVD *)ep_ptr->param.connect_evd_handle)->evd_flags & DAT_EVD_CONNECTION_FLAG)\r
+        /* test optional completion handles */\r
+        || (ep_ptr->param.recv_evd_handle != DAT_HANDLE_NULL &&\r
+            (DAPL_BAD_HANDLE (ep_ptr->param.recv_evd_handle, DAPL_MAGIC_EVD)))\r
+\r
+        || (ep_ptr->param.request_evd_handle != DAT_HANDLE_NULL &&\r
+            (DAPL_BAD_HANDLE (ep_ptr->param.request_evd_handle, DAPL_MAGIC_EVD))))\r
+    {\r
+       dapl_os_unlock ( &ep_ptr->header.lock );\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_EP);\r
+       goto bail;\r
+    }\r
+\r
+    /* The qp must be attached by this point! */\r
+    if ( ep_ptr->qp_state == DAPL_QP_STATE_UNATTACHED )\r
+    {\r
+        dapl_os_unlock ( &ep_ptr->header.lock );\r
+        dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_EP);\r
+        goto bail;\r
+    }\r
+\r
+    entry_ep_state         = ep_ptr->param.ep_state;\r
+    entry_ep_handle        = cr_ptr->param.local_ep_handle;\r
+    ep_ptr->param.ep_state = DAT_EP_STATE_COMPLETION_PENDING;\r
+    ep_ptr->cm_handle      = cr_ptr->ib_cm_handle;\r
+    ep_ptr->cr_ptr         = cr_ptr;\r
+    ep_ptr->param.remote_ia_address_ptr = cr_ptr->param.remote_ia_address_ptr;\r
+    cr_ptr->param.local_ep_handle       = ep_handle;\r
+\r
+    dapl_os_unlock ( &ep_ptr->header.lock );\r
+\r
+    dat_status = dapls_ib_accept_connection ( cr_handle,\r
+                                             ep_handle,\r
+                                             private_data_size,\r
+                                             private_data );\r
+\r
+    /*\r
+     * If the provider failed, unwind the damage so we are back at\r
+     * the initial state.\r
+     */\r
+    if ( dat_status != DAT_SUCCESS)\r
+    {\r
+       if ( DAT_GET_TYPE(dat_status) == DAT_INVALID_ADDRESS )\r
+       {\r
+           /* The remote connection request has disappeared; timeout,\r
+            * system error, app termination, perhaps other reasons.\r
+            */\r
+           dat_status = dapls_evd_post_connection_event (\r
+               ep_ptr->param.connect_evd_handle,\r
+               DAT_CONNECTION_EVENT_ACCEPT_COMPLETION_ERROR,\r
+               (DAT_HANDLE) ep_ptr,\r
+               0,\r
+               0 );\r
+\r
+           cr_ptr->header.magic = DAPL_MAGIC_CR_DESTROYED;\r
+       } \r
+       else\r
+       {\r
+           ep_ptr->param.ep_state        = entry_ep_state;\r
+           cr_ptr->param.local_ep_handle = entry_ep_handle;\r
+           ep_ptr->cr_ptr                = NULL;\r
+           ep_ptr->param.remote_ia_address_ptr = NULL;\r
+       }\r
+\r
+       /*\r
+        * After restoring values above, we now check if we need\r
+        * to translate the error\r
+        */\r
+       if ( DAT_GET_TYPE(dat_status) == DAT_LENGTH_ERROR )\r
+       {\r
+           dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);\r
+       }\r
+\r
+    }\r
+    else\r
+    {\r
+       /* Make this CR invalid. We need to hang on to it until\r
+        * the connection terminates, but it's destroyed from\r
+        * the app point of view.\r
+        */\r
+       cr_ptr->header.magic = DAPL_MAGIC_CR_DESTROYED;\r
+    }\r
+\r
+ bail:\r
+    return dat_status;\r
+}\r
+\r
+/*\r
+ * Local variables:\r
+ *  c-indent-level: 4\r
+ *  c-basic-offset: 4\r
+ *  tab-width: 8\r
+ * End:\r
+ */\r
diff --git a/ulp/dapl2/dapl/common/dapl_cr_callback.c b/ulp/dapl2/dapl/common/dapl_cr_callback.c
new file mode 100644 (file)
index 0000000..0359ddb
--- /dev/null
@@ -0,0 +1,592 @@
+/*\r
+ * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
+ *    copy of which is available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+/**********************************************************************\r
+ *\r
+ * MODULE: dapls_cr_callback.c\r
+ *\r
+ * PURPOSE: implements passive side connection callbacks\r
+ *\r
+ * Description: Accepts asynchronous callbacks from the Communications Manager\r
+ *              for EVDs that have been specified as the connection_evd.\r
+ *\r
+ * $Id:$\r
+ **********************************************************************/\r
+\r
+#include "dapl.h"\r
+#include "dapl_evd_util.h"\r
+#include "dapl_cr_util.h"\r
+#include "dapl_ia_util.h"\r
+#include "dapl_sp_util.h"\r
+#include "dapl_ep_util.h"\r
+#include "dapl_adapter_util.h"\r
+\r
+\r
+/*\r
+ * Prototypes\r
+ */\r
+DAT_RETURN dapli_connection_request (\r
+       IN  dp_ib_cm_handle_t   ib_cm_handle,\r
+       IN  DAPL_SP             *sp_ptr,\r
+       IN  DAPL_PRIVATE        *prd_ptr,\r
+       IN  DAPL_EVD            *evd_ptr);\r
+\r
+DAPL_EP * dapli_get_sp_ep (\r
+       IN  dp_ib_cm_handle_t   ib_cm_handle,\r
+       IN  DAPL_SP             *sp_ptr,\r
+       IN  DAT_EVENT_NUMBER    dat_event_num);\r
+\r
+\r
+/*\r
+ * dapls_cr_callback\r
+ *\r
+ * The callback function registered with verbs for passive side of\r
+ * connection requests. The interface is specified by cm_api.h\r
+ *\r
+ *\r
+ * Input:\r
+ *     ib_cm_handle,           Handle to CM\r
+ *     ib_cm_event             Specific CM event\r
+ *     instant_data            Private data with DAT ADDRESS header\r
+ *     context                 SP pointer\r
+ *\r
+ * Output:\r
+ *     None\r
+ *\r
+ */\r
+void\r
+dapls_cr_callback (\r
+    IN    dp_ib_cm_handle_t     ib_cm_handle,\r
+    IN    const ib_cm_events_t  ib_cm_event,\r
+    IN   const void            *private_data_ptr,     /* event data */\r
+    IN    const void           *context)\r
+{\r
+    DAPL_EP            *ep_ptr;\r
+    DAPL_EVD           *evd_ptr;\r
+    DAPL_SP            *sp_ptr;\r
+    DAPL_PRIVATE       *prd_ptr;\r
+    DAT_EVENT_NUMBER   dat_event_num;\r
+    DAT_RETURN         dat_status;\r
+\r
+    dapl_dbg_log (DAPL_DBG_TYPE_CM | DAPL_DBG_TYPE_CALLBACK,\r
+                 "--> dapls_cr_callback! context %p event %d cm_hdl %lx\n",\r
+                 context, ib_cm_event);\r
+\r
+    /*\r
+     * Passive side of the connection, context is a SP and\r
+     * we need to look up the EP.\r
+     */\r
+    sp_ptr = (DAPL_SP *) context;\r
+    /*\r
+     * The context pointer could have been cleaned up in a racing\r
+     * CM callback, check to see if we should just exit here\r
+     */\r
+    if (sp_ptr->header.magic == DAPL_MAGIC_INVALID)\r
+    {\r
+       return;\r
+    }\r
+    dapl_os_assert ( sp_ptr->header.magic == DAPL_MAGIC_PSP ||\r
+                    sp_ptr->header.magic == DAPL_MAGIC_RSP );\r
+\r
+    /* Obtain the event number from the provider layer */\r
+    dat_event_num = dapls_ib_get_dat_event (ib_cm_event, DAT_FALSE);\r
+\r
+    /*\r
+     * CONNECT_REQUEST events create an event on the PSP\r
+     * EVD, which will trigger connection processing. The\r
+     * sequence is:\r
+     *    CONNECT_REQUEST         Event to SP\r
+     *    CONNECTED              Event to EP\r
+     *    DISCONNECT             Event to EP\r
+     *\r
+     * Obtain the EP if required and set an event up on the correct\r
+     * EVD.\r
+     */\r
+    if (dat_event_num == DAT_CONNECTION_REQUEST_EVENT)\r
+    {\r
+       ep_ptr = NULL;\r
+       evd_ptr = sp_ptr->evd_handle;\r
+    }\r
+    else\r
+    {\r
+       /* see if there is an EP connected with this CM handle */\r
+       ep_ptr = dapli_get_sp_ep ( ib_cm_handle,\r
+                                   sp_ptr,\r
+                                   dat_event_num );\r
+\r
+       /* if we lost a race with the CM just exit. */\r
+       if (ep_ptr == NULL)\r
+       {\r
+           return;\r
+       }\r
+\r
+       evd_ptr = (DAPL_EVD *) ep_ptr->param.connect_evd_handle;\r
+       /* if something has happened to our EVD, bail. */\r
+       if (evd_ptr == NULL)\r
+       {\r
+           return;\r
+       }\r
+    }\r
+\r
+    prd_ptr = (DAPL_PRIVATE *)private_data_ptr;\r
+\r
+    dat_status = DAT_INTERNAL_ERROR;   /* init to ERR */\r
+\r
+    switch (dat_event_num)\r
+    {\r
+       case DAT_CONNECTION_REQUEST_EVENT:\r
+       {\r
+           /*\r
+            * Requests arriving on a disabled SP are immediatly rejected\r
+            */\r
+\r
+           dapl_os_lock (&sp_ptr->header.lock);\r
+           if ( sp_ptr->listening == DAT_FALSE )\r
+           {\r
+               dapl_os_unlock (&sp_ptr->header.lock);\r
+               dapl_dbg_log (DAPL_DBG_TYPE_CM,\r
+                         "---> dapls_cr_callback: conn event on down SP\n");\r
+               (void)dapls_ib_reject_connection (ib_cm_handle,\r
+                                                 DAT_CONNECTION_EVENT_UNREACHABLE );\r
+\r
+               return;\r
+           }\r
+\r
+           if ( sp_ptr->header.handle_type == DAT_HANDLE_TYPE_RSP )\r
+           {\r
+               /*\r
+                * RSP connections only allow a single connection. Close\r
+                * it down NOW so we reject any further connections.\r
+                */\r
+               sp_ptr->listening = DAT_FALSE;\r
+           }\r
+           dapl_os_unlock (&sp_ptr->header.lock);\r
+\r
+           /*\r
+            * Only occurs on the passive side of a connection\r
+            * dapli_connection_request will post the connection\r
+            * event if appropriate.\r
+            */\r
+           dat_status = dapli_connection_request ( ib_cm_handle,\r
+                                                   sp_ptr,\r
+                                                   prd_ptr,\r
+                                                   evd_ptr );\r
+           /* Set evd_ptr = NULL so we don't generate an event below */\r
+           evd_ptr = NULL;\r
+\r
+           break;\r
+       }\r
+       case DAT_CONNECTION_EVENT_ESTABLISHED:\r
+       {\r
+           /* This is just a notification the connection is now\r
+            * established, there isn't any private data to deal with.\r
+            *\r
+            * Update the EP state and cache a copy of the cm handle,\r
+            * then let the user know we are ready to go.\r
+            */\r
+           dapl_os_lock ( &ep_ptr->header.lock );\r
+           if (ep_ptr->header.magic != DAPL_MAGIC_EP ||\r
+               ep_ptr->param.ep_state != DAT_EP_STATE_COMPLETION_PENDING)\r
+           {\r
+               /* If someone pulled the plug on the EP or connection,\r
+                * just exit\r
+                */\r
+               dapl_os_unlock ( &ep_ptr->header.lock );\r
+               dat_status = DAT_SUCCESS;\r
+               /* Set evd_ptr = NULL so we don't generate an event below */\r
+               evd_ptr = NULL;\r
+\r
+               break;\r
+           }\r
+\r
+           ep_ptr->param.ep_state = DAT_EP_STATE_CONNECTED;\r
+           ep_ptr->cm_handle      = ib_cm_handle;\r
+           dapl_os_unlock ( &ep_ptr->header.lock );\r
+\r
+           break;\r
+       }\r
+       case DAT_CONNECTION_EVENT_DISCONNECTED:\r
+       {\r
+           /*\r
+            * EP is now fully disconnected; initiate any post processing\r
+            * to reset the underlying QP and get the EP ready for\r
+            * another connection\r
+            */\r
+           dapl_os_lock ( &ep_ptr->header.lock );\r
+           if (ep_ptr->param.ep_state  == DAT_EP_STATE_DISCONNECTED)\r
+           {\r
+               /* The disconnect has already occurred, we are now\r
+                * cleaned up and ready to exit\r
+                */\r
+               dapl_os_unlock ( &ep_ptr->header.lock );\r
+               return;\r
+           }\r
+           ep_ptr->param.ep_state  = DAT_EP_STATE_DISCONNECTED;\r
+           dapls_ib_disconnect_clean (ep_ptr, DAT_FALSE, ib_cm_event);\r
+           dapl_os_unlock ( &ep_ptr->header.lock );\r
+\r
+           break;\r
+       }\r
+       case DAT_CONNECTION_EVENT_NON_PEER_REJECTED:\r
+       case DAT_CONNECTION_EVENT_PEER_REJECTED:\r
+       case DAT_CONNECTION_EVENT_UNREACHABLE:\r
+       {\r
+           /*\r
+            * After posting an accept the requesting node has\r
+            * stopped talking.\r
+            */\r
+           dapl_os_lock ( &ep_ptr->header.lock );\r
+           ep_ptr->param.ep_state  = DAT_EP_STATE_DISCONNECTED;\r
+           ep_ptr->cm_handle       = IB_INVALID_HANDLE;\r
+           dapls_ib_disconnect_clean (ep_ptr, DAT_FALSE, ib_cm_event);\r
+           dapl_os_unlock ( &ep_ptr->header.lock );\r
+\r
+           break;\r
+       }\r
+       case DAT_CONNECTION_EVENT_BROKEN:\r
+       {\r
+           dapl_os_lock ( &ep_ptr->header.lock );\r
+           ep_ptr->param.ep_state  = DAT_EP_STATE_DISCONNECTED;\r
+           dapls_ib_disconnect_clean (ep_ptr, DAT_FALSE, ib_cm_event);\r
+           dapl_os_unlock ( &ep_ptr->header.lock );\r
+\r
+           break;\r
+       }\r
+       default:\r
+       {\r
+           evd_ptr = NULL;\r
+           dapl_os_assert (0);         /* shouldn't happen */\r
+           break;\r
+       }\r
+    }\r
+\r
+    if (evd_ptr != NULL )\r
+    {\r
+       dat_status = dapls_evd_post_connection_event (\r
+                               evd_ptr,\r
+                               dat_event_num,\r
+                               (DAT_HANDLE) ep_ptr,\r
+                               0,\r
+                               NULL);\r
+    }\r
+\r
+    if (dat_status != DAT_SUCCESS)\r
+    {\r
+       /* The event post failed; take appropriate action.  */\r
+       (void)dapls_ib_reject_connection ( ib_cm_handle,\r
+                                          DAT_CONNECTION_EVENT_BROKEN);\r
+\r
+       return;\r
+    }\r
+}\r
+\r
+\r
+/*\r
+ * dapli_connection_request\r
+ *\r
+ * Process a connection request on the Passive side of a connection.\r
+ * Create a CR record and link it on to the SP so we can update it\r
+ * and free it later. Create an EP if specified by the PSP flags.\r
+ *\r
+ * Input:\r
+ *     ib_cm_handle,\r
+ *     sp_ptr\r
+ *     event_ptr\r
+ *     prd_ptr\r
+ *\r
+ * Output:\r
+ *     None\r
+ *\r
+ * Returns\r
+ *     DAT_INSUFFICIENT_RESOURCES\r
+ *     DAT_SUCCESS\r
+ *\r
+ */\r
+DAT_RETURN\r
+dapli_connection_request (\r
+       IN  dp_ib_cm_handle_t   ib_cm_handle,\r
+       IN  DAPL_SP             *sp_ptr,\r
+       IN  DAPL_PRIVATE        *prd_ptr,\r
+       IN  DAPL_EVD            *evd_ptr)\r
+{\r
+    DAT_RETURN         dat_status;\r
+\r
+    DAPL_CR            *cr_ptr;\r
+    DAPL_EP            *ep_ptr;\r
+    DAPL_IA            *ia_ptr;\r
+    DAT_SP_HANDLE      sp_handle;\r
+\r
+    cr_ptr = dapls_cr_alloc (sp_ptr->header.owner_ia);\r
+    if ( cr_ptr == NULL )\r
+    {\r
+       /* Invoking function will call dapls_ib_cm_reject() */\r
+       return DAT_INSUFFICIENT_RESOURCES;\r
+    }\r
+\r
+    /*\r
+     * Set up the CR\r
+     */\r
+    cr_ptr->sp_ptr = sp_ptr;           /* maintain sp_ptr in case of reject */\r
+    cr_ptr->param.remote_port_qual = 0;\r
+    cr_ptr->ib_cm_handle = ib_cm_handle;\r
+\r
+#ifdef IBHOSTS_NAMING\r
+    /*\r
+     * Special case: pull the remote HCA address from the private data\r
+     * prefix. This is a spec violation as it introduces a protocol, but\r
+     * some implementations may find it necessary for a time.\r
+     */\r
+    cr_ptr->remote_ia_address = prd_ptr->hca_address;\r
+#endif /* IBHOSTS_NAMING */\r
+    cr_ptr->param.remote_ia_address_ptr = (DAT_IA_ADDRESS_PTR)&cr_ptr->remote_ia_address;\r
+    /*\r
+     * Copy the remote address and private data out of the private_data\r
+     * payload and put them in a local structure\r
+     */\r
+\r
+    /* Private data size will be determined by the provider layer */\r
+    cr_ptr->param.private_data      = cr_ptr->private_data;\r
+    if (prd_ptr == NULL)\r
+    {\r
+       cr_ptr->param.private_data_size = 0;\r
+    }\r
+    else\r
+    {\r
+       cr_ptr->param.private_data_size = \r
+               dapls_ib_private_data_size (prd_ptr, DAPL_PDATA_CONN_REQ);\r
+    }\r
+    if (cr_ptr->param.private_data_size > 0)\r
+    {\r
+       dapl_os_memcpy (cr_ptr->private_data,\r
+                       prd_ptr->private_data,\r
+                       DAPL_MIN(cr_ptr->param.private_data_size,\r
+                                DAPL_MAX_PRIVATE_DATA_SIZE));\r
+    }\r
+\r
+    /* EP will be NULL unless RSP service point */\r
+    ep_ptr = (DAPL_EP *) sp_ptr->ep_handle;\r
+\r
+    if ( sp_ptr->psp_flags == DAT_PSP_PROVIDER_FLAG )\r
+    {\r
+       /*\r
+        * Never true for RSP connections\r
+        *\r
+        * Create an EP for the user. If we can't allocate an\r
+        * EP we are out of resources and need to tell the\r
+        * requestor that we cant help them.\r
+        */\r
+       ia_ptr = sp_ptr->header.owner_ia;\r
+       ep_ptr = dapl_ep_alloc (ia_ptr, NULL);\r
+       if ( ep_ptr == NULL )\r
+       {\r
+           dapls_cr_free (cr_ptr);\r
+           /* Invoking function will call dapls_ib_cm_reject() */\r
+           return DAT_INSUFFICIENT_RESOURCES;\r
+       }\r
+       ep_ptr->param.ia_handle           = ia_ptr;\r
+       ep_ptr->param.local_ia_address_ptr= (DAT_IA_ADDRESS_PTR)\r
+                                                  &ia_ptr->hca_ptr->hca_address;\r
+\r
+       /* Link the EP onto the IA */\r
+       dapl_ia_link_ep (ia_ptr, ep_ptr);\r
+    }\r
+\r
+    cr_ptr->param.local_ep_handle = ep_ptr;\r
+\r
+    if ( ep_ptr != NULL )\r
+    {\r
+       /* Assign valid EP fields: RSP and PSP_PROVIDER_FLAG only */\r
+       if ( sp_ptr->psp_flags == DAT_PSP_PROVIDER_FLAG )\r
+       {\r
+           ep_ptr->param.ep_state =\r
+               DAT_EP_STATE_TENTATIVE_CONNECTION_PENDING;\r
+       }\r
+       else\r
+       {\r
+           /* RSP */\r
+           dapl_os_assert (sp_ptr->header.handle_type == DAT_HANDLE_TYPE_RSP);\r
+           ep_ptr->param.ep_state =\r
+               DAT_EP_STATE_PASSIVE_CONNECTION_PENDING;\r
+       }\r
+       ep_ptr->cm_handle       = ib_cm_handle;\r
+    }\r
+\r
+    /* link the CR onto the SP so we can pick it up later */\r
+    dapl_sp_link_cr (sp_ptr, cr_ptr);\r
+\r
+    /* Post the event.  */\r
+    /* assign sp_ptr to union to avoid typecast errors from some compilers */\r
+    sp_handle.psp_handle = (DAT_PSP_HANDLE)sp_ptr;\r
+\r
+    dat_status = dapls_evd_post_cr_arrival_event (\r
+       evd_ptr,\r
+       DAT_CONNECTION_REQUEST_EVENT,\r
+       sp_handle,\r
+       (DAT_IA_ADDRESS_PTR)&sp_ptr->header.owner_ia->hca_ptr->hca_address,\r
+       sp_ptr->conn_qual,\r
+       (DAT_CR_HANDLE)cr_ptr);\r
+\r
+    if (dat_status != DAT_SUCCESS)\r
+    {\r
+       dapls_cr_free (cr_ptr);\r
+       (void)dapls_ib_reject_connection (ib_cm_handle,\r
+                                         DAT_CONNECTION_EVENT_BROKEN);\r
+\r
+       /* Take the CR off the list, we can't use it */\r
+       dapl_os_lock (&sp_ptr->header.lock);\r
+       dapl_sp_remove_cr (sp_ptr, cr_ptr);\r
+       dapl_os_unlock (&sp_ptr->header.lock);\r
+       return DAT_INSUFFICIENT_RESOURCES;\r
+    }\r
+\r
+\r
+    return DAT_SUCCESS;\r
+}\r
+\r
+\r
+/*\r
+ * dapli_get_sp_ep\r
+ *\r
+ * Passive side of a connection is now fully established. Clean\r
+ * up resources and obtain the EP pointer associated with a CR in\r
+ * the SP\r
+ *\r
+ * Input:\r
+ *     ib_cm_handle,\r
+ *     sp_ptr\r
+ *     connection_event\r
+ *\r
+ * Output:\r
+ *     none\r
+ *\r
+ * Returns\r
+ *     ep_ptr\r
+ *\r
+ */\r
+DAPL_EP *\r
+dapli_get_sp_ep (\r
+       IN  dp_ib_cm_handle_t   ib_cm_handle,\r
+       IN  DAPL_SP             *sp_ptr,\r
+       IN  DAT_EVENT_NUMBER    dat_event_num)\r
+{\r
+    DAPL_CR            *cr_ptr;\r
+    DAPL_EP            *ep_ptr;\r
+\r
+    /*\r
+     * acquire the lock, we may be racing with other threads here\r
+     */\r
+    dapl_os_lock (&sp_ptr->header.lock);\r
+\r
+    /* Verify under lock that the SP is still valid */\r
+    if (sp_ptr->header.magic == DAPL_MAGIC_INVALID)\r
+    {\r
+       dapl_os_unlock (&sp_ptr->header.lock);\r
+       return NULL;\r
+    }\r
+    /*\r
+     * There are potentially multiple connections in progress. Need to\r
+     * go through the list and find the one we are interested\r
+     * in. There is no guarantee of order. dapl_sp_search_cr\r
+     * leaves the CR on the SP queue.\r
+     */\r
+    cr_ptr = dapl_sp_search_cr (sp_ptr, ib_cm_handle);\r
+    if ( cr_ptr == NULL )\r
+    {\r
+       dapl_os_unlock (&sp_ptr->header.lock);\r
+       return NULL;\r
+    }\r
+\r
+    ep_ptr = (DAPL_EP *)cr_ptr->param.local_ep_handle;\r
+\r
+\r
+    /* Quick check to ensure our EP is still valid */\r
+    if ( (DAPL_BAD_HANDLE (ep_ptr, DAPL_MAGIC_EP )) )\r
+    {\r
+       ep_ptr = NULL;\r
+    }\r
+\r
+    /* The CR record is discarded in all except for the CONNECTED case,\r
+     * as it will have no further relevance.\r
+     */\r
+    if (dat_event_num != DAT_CONNECTION_EVENT_ESTABLISHED)\r
+    {\r
+       /* Remove the CR from the queue */\r
+       dapl_sp_remove_cr (sp_ptr, cr_ptr);\r
+\r
+       if (ep_ptr != NULL)\r
+       {\r
+           ep_ptr->cr_ptr = NULL;\r
+       }\r
+\r
+       /*\r
+        * If this SP has been removed from service, free it\r
+        * up after the last CR is removed\r
+        */\r
+       if ( sp_ptr->listening != DAT_TRUE && sp_ptr->cr_list_count == 0 &&\r
+            sp_ptr->state != DAPL_SP_STATE_FREE )\r
+       {\r
+           dapl_dbg_log (DAPL_DBG_TYPE_CM,\r
+                 "--> dapli_get_sp_ep! disconnect dump sp: %p \n", sp_ptr);\r
+           /* Decrement the ref count on the EVD */\r
+           if (sp_ptr->evd_handle)\r
+           {\r
+               dapl_os_atomic_dec (& ((DAPL_EVD *)sp_ptr->evd_handle)->evd_ref_count);\r
+               sp_ptr->evd_handle = NULL;\r
+           }\r
+           sp_ptr->state = DAPL_SP_STATE_FREE;\r
+           dapl_os_unlock (&sp_ptr->header.lock);\r
+           (void) dapls_ib_remove_conn_listener ( sp_ptr->header.owner_ia,\r
+                                                  sp_ptr );\r
+           dapls_ia_unlink_sp ( (DAPL_IA *)sp_ptr->header.owner_ia,\r
+                                sp_ptr );\r
+           dapls_sp_free_sp ( sp_ptr );\r
+           dapls_cr_free (cr_ptr);\r
+           goto skip_unlock;\r
+       }\r
+\r
+       dapl_os_unlock (&sp_ptr->header.lock);\r
+       /* free memory outside of the lock */\r
+       dapls_cr_free (cr_ptr);\r
+    }\r
+    else\r
+    {\r
+       dapl_os_unlock (&sp_ptr->header.lock);\r
+    }\r
+\r
+skip_unlock:\r
+    return ep_ptr;\r
+}\r
+\r
+\r
+/*\r
+ * Local variables:\r
+ *  c-indent-level: 4\r
+ *  c-basic-offset: 4\r
+ *  c-brace-offset: -4\r
+ *  tab-width: 8\r
+ * End:\r
+ */\r
diff --git a/ulp/dapl2/dapl/common/dapl_cr_handoff.c b/ulp/dapl2/dapl/common/dapl_cr_handoff.c
new file mode 100644 (file)
index 0000000..9852f1b
--- /dev/null
@@ -0,0 +1,67 @@
+/*\r
+ * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
+ *    copy of which is available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+/**********************************************************************\r
+ * \r
+ * MODULE: dapl_cr_handoff.c\r
+ *\r
+ * PURPOSE: Connection management\r
+ * Description: Interfaces in this file are completely described in\r
+ *             the DAPL 1.1 API, Chapter 6, section 4\r
+ *\r
+ * $Id:$\r
+ **********************************************************************/\r
+\r
+#include "dapl.h"\r
+\r
+/*\r
+ * dapl_cr_handoff\r
+ *\r
+ * DAPL Requirements Version xxx, 6.4.2.4\r
+ *\r
+ * Hand the connection request to another Sevice pont specified by the\r
+ * Connectin Qualifier.\r
+ *\r
+ * Input:\r
+ *     cr_handle\r
+ *     cr_handoff\r
+ *\r
+ * Output:\r
+ *     none\r
+ *\r
+ * Returns:\r
+ *     DAT_SUCCESS\r
+ *     DAT_INVALID_HANDLE\r
+ *     DAT_INVALID_PARAMETER\r
+ */\r
+DAT_RETURN DAT_API\r
+dapl_cr_handoff (\r
+       IN      DAT_CR_HANDLE      cr_handle,\r
+       IN      DAT_CONN_QUAL      cr_handoff )         /* handoff */\r
+{\r
+    return DAT_ERROR (DAT_NOT_IMPLEMENTED,0);\r
+}\r
diff --git a/ulp/dapl2/dapl/common/dapl_cr_query.c b/ulp/dapl2/dapl/common/dapl_cr_query.c
new file mode 100644 (file)
index 0000000..5f96533
--- /dev/null
@@ -0,0 +1,104 @@
+/*\r
+ * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
+ *    copy of which is available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+/**********************************************************************\r
+ * \r
+ * MODULE: dapl_cr_query.c\r
+ *\r
+ * PURPOSE: Connection management\r
+ * Description: Interfaces in this file are completely described in\r
+ *             the DAPL 1.1 API, Chapter 6, section 4\r
+ *\r
+ * $Id:$\r
+ **********************************************************************/\r
+\r
+#include "dapl.h"\r
+#include "dapl_adapter_util.h"\r
+\r
+/*\r
+ * dapl_cr_query\r
+ *\r
+ * DAPL Requirements Version xxx, 6.4.2.1\r
+ *\r
+ * Return Connection Request args\r
+ *\r
+ * Input:\r
+ *     cr_handle\r
+ *     cr_param_mask\r
+ *\r
+ * Output:\r
+ *     cr_param\r
+ *\r
+ * Returns:\r
+ *     DAT_SUCCESS\r
+ *     DAT_INVALID_PARAMETER\r
+ *     DAT_INVALID_HANDLE\r
+ */\r
+DAT_RETURN DAT_API\r
+dapl_cr_query (\r
+       IN      DAT_CR_HANDLE           cr_handle,\r
+       IN      DAT_CR_PARAM_MASK       cr_param_mask,\r
+       OUT     DAT_CR_PARAM            *cr_param)\r
+{\r
+    DAPL_CR    *cr_ptr;\r
+    DAT_RETURN dat_status;\r
+\r
+    dapl_dbg_log (DAPL_DBG_TYPE_API,\r
+                 "dapl_cr_query (%p, %x, %p)\n",\r
+                 cr_handle, \r
+                 cr_param_mask, \r
+                 cr_param);\r
+\r
+    dat_status = DAT_SUCCESS;\r
+    if ( DAPL_BAD_HANDLE (cr_handle, DAPL_MAGIC_CR) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_CR);\r
+       goto bail;\r
+    }\r
+\r
+    if (NULL == cr_param)\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG3);\r
+       goto bail;\r
+    }\r
+\r
+    cr_ptr = (DAPL_CR *) cr_handle;\r
+\r
+    /* obtain the remote IP address */\r
+    if (cr_param_mask & DAT_CR_FIELD_REMOTE_IA_ADDRESS_PTR)\r
+    {\r
+       dat_status = dapls_ib_cm_remote_addr ((DAT_HANDLE)cr_handle,\r
+                                             &cr_ptr->remote_ia_address );\r
+    }\r
+\r
+    /* since the arguments are easily accessible, ignore the mask */\r
+    dapl_os_memcpy (cr_param, &cr_ptr->param, sizeof (DAT_CR_PARAM));\r
+\r
+ bail:\r
+    return dat_status;\r
+}\r
+\r
diff --git a/ulp/dapl2/dapl/common/dapl_cr_reject.c b/ulp/dapl2/dapl/common/dapl_cr_reject.c
new file mode 100644 (file)
index 0000000..37efe49
--- /dev/null
@@ -0,0 +1,144 @@
+/*\r
+ * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
+ *    copy of which is available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+/**********************************************************************\r
+ * \r
+ * MODULE: dapl_cr_reject.c\r
+ *\r
+ * PURPOSE: Connection management\r
+ * Description: Interfaces in this file are completely described in\r
+ *             the DAPL 1.1 API, Chapter 6, section 4\r
+ *\r
+ * $Id:$\r
+ **********************************************************************/\r
+\r
+#include "dapl.h"\r
+#include "dapl_cr_util.h"\r
+#include "dapl_sp_util.h"\r
+#include "dapl_adapter_util.h"\r
+\r
+/*\r
+ * dapl_cr_reject\r
+ *\r
+ * DAPL Requirements Version xxx, 6.4.2.2\r
+ *\r
+ * Reject a connection request from the active remote side requesting\r
+ * an Endpoint.\r
+ *\r
+ * Input:\r
+ *     cr_handle\r
+ *\r
+ * Output:\r
+ *     none\r
+ *\r
+ * Returns:\r
+ *     DAT_SUCCESS\r
+ *     DAT_INVALID_PARAMETER\r
+ */\r
+DAT_RETURN DAT_API\r
+dapl_cr_reject (\r
+       IN      DAT_CR_HANDLE cr_handle,/* cr_handle            */\r
+       IN      DAT_COUNT pdata_size,   /* private_data_size    */\r
+       IN      const DAT_PVOID pdata ) /* private_data         */\r
+{\r
+    DAPL_CR            *cr_ptr;\r
+    DAPL_EP            *ep_ptr;\r
+    DAT_EP_STATE       entry_ep_state;\r
+    DAT_EP_HANDLE      entry_ep_handle;\r
+    DAPL_SP            *sp_ptr;\r
+    DAT_RETURN         dat_status;\r
+\r
+    dapl_dbg_log (DAPL_DBG_TYPE_API, "dapl_cr_reject (%p)\n", cr_handle);\r
+\r
+    if ( DAPL_BAD_HANDLE (cr_handle, DAPL_MAGIC_CR) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_CR);\r
+       goto bail;\r
+    }\r
+\r
+    cr_ptr = (DAPL_CR *)cr_handle;\r
+\r
+    /*\r
+     * Clean up provider created EP if there is one: only if\r
+     * DAT_PSP_PROVIDER_FLAG was set on the PSP\r
+     */\r
+    ep_ptr = (DAPL_EP *)cr_ptr->param.local_ep_handle;\r
+    entry_ep_handle = cr_ptr->param.local_ep_handle;\r
+    entry_ep_state  = 0;\r
+    if ( ep_ptr != NULL )\r
+    {\r
+       entry_ep_state                = ep_ptr->param.ep_state;\r
+       ep_ptr->param.ep_state        = DAT_EP_STATE_UNCONNECTED;\r
+       cr_ptr->param.local_ep_handle = NULL;\r
+    }\r
+\r
+    dat_status =  dapls_ib_reject_connection ( cr_ptr->ib_cm_handle,\r
+                                              IB_CM_REJ_REASON_CONSUMER_REJ );\r
+\r
+    if ( dat_status != DAT_SUCCESS)\r
+    {\r
+       if ( ep_ptr != NULL )\r
+       {\r
+           /* Revert our state to the beginning */\r
+           ep_ptr->param.ep_state        = entry_ep_state;\r
+           cr_ptr->param.local_ep_handle = entry_ep_handle;\r
+           cr_ptr->param.local_ep_handle = (DAT_EP_HANDLE)ep_ptr;\r
+       }\r
+    }\r
+    else\r
+    {\r
+       /* \r
+        * If this EP has been allocated by the provider, clean it up;\r
+        * see DAT 1.1 spec, page 100, lines 3-4 (section 6.4.3.1.1.1).\r
+        * RSP and user-provided EPs are in the control of the user.\r
+        */\r
+       sp_ptr = cr_ptr->sp_ptr;\r
+       if ( ep_ptr != NULL &&\r
+            sp_ptr->psp_flags == DAT_PSP_PROVIDER_FLAG )\r
+       {\r
+           (void)dapl_ep_free (ep_ptr);\r
+       }\r
+\r
+       /* Remove the CR from the queue, then free it */\r
+       dapl_os_lock (&sp_ptr->header.lock);\r
+       dapl_sp_remove_cr ( sp_ptr, cr_ptr );\r
+       dapl_os_unlock (&sp_ptr->header.lock);\r
+\r
+       dapls_cr_free ( cr_ptr );\r
+    }\r
+\r
+ bail:\r
+    return dat_status;\r
+}\r
+\r
+/*\r
+ * Local variables:\r
+ *  c-indent-level: 4\r
+ *  c-basic-offset: 4\r
+ *  tab-width: 8\r
+ * End:\r
+ */\r
diff --git a/ulp/dapl2/dapl/common/dapl_cr_util.c b/ulp/dapl2/dapl/common/dapl_cr_util.c
new file mode 100644 (file)
index 0000000..03a046a
--- /dev/null
@@ -0,0 +1,110 @@
+/*\r
+ * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
+ *    copy of which is available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+/**********************************************************************\r
+ * \r
+ * MODULE: dapl_cr_util.c\r
+ *\r
+ * PURPOSE: Manage CR (Connection Request) structure\r
+ *\r
+ * $Id:$\r
+ **********************************************************************/\r
+\r
+#include "dapl.h"\r
+#include "dapl_cr_util.h"\r
+\r
+/*\r
+ * dapls_cr_create\r
+ *\r
+ * Create a CR. Part of the passive side of a connection\r
+ *\r
+ * Input:\r
+ *     ia_ptr\r
+ *\r
+ * Returns:\r
+ *     DAPL_CR\r
+ *\r
+ */\r
+\r
+DAPL_CR        *\r
+dapls_cr_alloc (\r
+       DAPL_IA         *ia_ptr )\r
+{\r
+    DAPL_CR    *cr_ptr;\r
+\r
+    /* Allocate EP */\r
+    cr_ptr = (DAPL_CR *)dapl_os_alloc (sizeof (DAPL_CR));\r
+    if ( cr_ptr == NULL )\r
+    {\r
+       return (NULL);\r
+    }\r
+\r
+    /* zero the structure */\r
+    dapl_os_memzero (cr_ptr, sizeof (DAPL_CR));\r
+\r
+    /*\r
+     * initialize the header\r
+     */\r
+    cr_ptr->header.provider            = ia_ptr->header.provider;\r
+    cr_ptr->header.magic               = DAPL_MAGIC_CR;\r
+    cr_ptr->header.handle_type         = DAT_HANDLE_TYPE_CR;\r
+    cr_ptr->header.owner_ia            = ia_ptr;\r
+    cr_ptr->header.user_context.as_64  = 0;\r
+    cr_ptr->header.user_context.as_ptr = NULL;\r
+    dapl_llist_init_entry (&cr_ptr->header.ia_list_entry);\r
+    dapl_os_lock_init (&cr_ptr->header.lock);\r
+\r
+    return (cr_ptr);\r
+}\r
+\r
+\r
+/*\r
+ * dapls_cr_free\r
+ *\r
+ * Free the passed in EP structure.\r
+ *\r
+ * Input:\r
+ *     entry point pointer\r
+ *\r
+ * Output:\r
+ *     none\r
+ *\r
+ * Returns:\r
+ *     none\r
+ *\r
+ */\r
+void\r
+dapls_cr_free (\r
+       IN DAPL_CR              *cr_ptr )\r
+{\r
+    dapl_os_assert (cr_ptr->header.magic == DAPL_MAGIC_CR ||\r
+                   cr_ptr->header.magic == DAPL_MAGIC_CR_DESTROYED );\r
+\r
+    cr_ptr->header.magic = DAPL_MAGIC_INVALID;/* reset magic to prevent reuse */\r
+    dapl_os_free (cr_ptr, sizeof (DAPL_CR));\r
+}\r
+\r
diff --git a/ulp/dapl2/dapl/common/dapl_cr_util.h b/ulp/dapl2/dapl/common/dapl_cr_util.h
new file mode 100644 (file)
index 0000000..b2b2f60
--- /dev/null
@@ -0,0 +1,58 @@
+/*\r
+ * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
+ *    copy of which is available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+/**********************************************************************\r
+ * \r
+ * HEADER: dapl_cr_util.h\r
+ *\r
+ * PURPOSE: Utility defs & routines for the CR data structure\r
+ *\r
+ * $Id:$\r
+ *\r
+ **********************************************************************/\r
+\r
+#ifndef _DAPL_CR_UTIL_H_\r
+#define _DAPL_CR_UTIL_H_\r
+\r
+#include "dapl.h" \r
+\r
+DAPL_CR        *\r
+dapls_cr_alloc (\r
+       DAPL_IA         *ia_ptr );\r
+\r
+void\r
+dapls_cr_free (\r
+       IN DAPL_CR              *cr_ptr );\r
+\r
+void\r
+dapls_cr_callback (\r
+    IN    dp_ib_cm_handle_t     ib_cm_handle,\r
+    IN    const ib_cm_events_t  ib_cm_event,\r
+    IN   const void            *instant_data_p,\r
+    IN    const void           *context);\r
+\r
+#endif /* _DAPL_CR_UTIL_H_ */\r
diff --git a/ulp/dapl2/dapl/common/dapl_csp.c b/ulp/dapl2/dapl/common/dapl_csp.c
new file mode 100644 (file)
index 0000000..77d51b3
--- /dev/null
@@ -0,0 +1,108 @@
+/*\r
+ * Copyright (c) 2007 Intel Corporation.  All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
+ *    copy of which is available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+/**********************************************************************\r
+ * \r
+ * MODULE: dapl_csp.c\r
+ *\r
+ * PURPOSE: Connection management\r
+ * Description: Interfaces in this file are completely described in\r
+ *             the DAPL 2.0 API, Chapter 6, section 4\r
+ *\r
+ * $Id:$\r
+ **********************************************************************/\r
+\r
+#include "dapl.h"\r
+#include "dapl_sp_util.h"\r
+#include "dapl_ia_util.h"\r
+#include "dapl_adapter_util.h"\r
+\r
+/*\r
+ * dapl_psp_create, dapl_csp_query, dapl_csp_free\r
+ *\r
+ * uDAPL: User Direct Access Program Library Version 2.0, 6.4.4.2\r
+ *\r
+ * The Common Service Point is transport-independent analog of the Public\r
+ * Service Point. It allows the Consumer to listen on socket-equivalent for\r
+ * requests for connections arriving on a specified IP port instead of\r
+ * transport-dependent Connection Qualifier. An IA Address follows the\r
+ * platform conventions and provides among others the IP port to listen on.\r
+ * An IP port of the Common Service Point advertisement is supported by\r
+ * existing Ethernet infrastructure or DAT Name Service.\r
+ *\r
+ * Input:\r
+ *     ia_handle\r
+ *     comm_id\r
+ *     address\r
+ *     evd_handle\r
+ *      csp_handle\r
+ *\r
+ * Output:\r
+ *     csp_handle\r
+ *\r
+ * Returns:\r
+ *     DAT_SUCCESS\r
+ *     DAT_INSUFFICIENT_RESOURCES\r
+ *     DAT_INVALID_PARAMETER\r
+ *     DAT_CONN_QUAL_IN_USE\r
+ *     DAT_MODEL_NOT_SUPPORTED\r
+ */\r
+DAT_RETURN DAT_API\r
+dapl_csp_create (\r
+       IN      DAT_IA_HANDLE ia_handle,          /* ia_handle      */\r
+       IN      DAT_COMM *comm,                   /* communicator   */\r
+       IN      DAT_IA_ADDRESS_PTR addr,          /* address        */\r
+       IN      DAT_EVD_HANDLE evd_handle,        /* evd_handle     */\r
+       OUT     DAT_CSP_HANDLE *csp_handle )      /* csp_handle     */\r
+{\r
+       return DAT_MODEL_NOT_SUPPORTED;\r
+}\r
+\r
+DAT_RETURN DAT_API\r
+dapl_csp_query (\r
+       IN      DAT_CSP_HANDLE csp_handle,         /* csp_handle     */\r
+       IN      DAT_CSP_PARAM_MASK param_mask,     /* csp_param_mask */\r
+       OUT     DAT_CSP_PARAM *param )             /* csp_param      */\r
+{\r
+       return DAT_MODEL_NOT_SUPPORTED;\r
+}\r
+\r
+DAT_RETURN DAT_API\r
+dapl_csp_free (\r
+       IN      DAT_CSP_HANDLE csp_handle )        /* csp_handle     */\r
+{\r
+       return DAT_MODEL_NOT_SUPPORTED;\r
+}\r
+\r
+/*\r
+ * Local variables:\r
+ *  c-indent-level: 4\r
+ *  c-basic-offset: 4\r
+ *  c-brace-offset: -4\r
+ *  tab-width: 8\r
+ * End:\r
+ */\r
diff --git a/ulp/dapl2/dapl/common/dapl_debug.c b/ulp/dapl2/dapl/common/dapl_debug.c
new file mode 100644 (file)
index 0000000..73f30cc
--- /dev/null
@@ -0,0 +1,109 @@
+/*\r
+ * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
+ *    copy of which is available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+#include "dapl_debug.h"\r
+#include "dapl.h"\r
+#if !defined(__KDAPL__)\r
+#include <stdarg.h>\r
+#include <stdlib.h>\r
+#endif /* __KDAPL__ */\r
+\r
+#ifdef DAPL_DBG\r
+DAPL_DBG_TYPE g_dapl_dbg_type;         /* initialized in dapl_init.c */\r
+DAPL_DBG_DEST g_dapl_dbg_dest;         /* initialized in dapl_init.c */\r
+\r
+void dapl_internal_dbg_log ( DAPL_DBG_TYPE type, const char *fmt, ...)\r
+{\r
+    va_list args;\r
+\r
+    if ( type & g_dapl_dbg_type )\r
+    {\r
+       va_start (args, fmt);\r
+\r
+       if ( DAPL_DBG_DEST_STDOUT & g_dapl_dbg_dest )\r
+       {\r
+           dapl_os_vprintf (fmt, args);\r
+       }\r
+\r
+       if ( DAPL_DBG_DEST_SYSLOG & g_dapl_dbg_dest )\r
+       {\r
+           dapl_os_syslog(fmt, args);\r
+       }\r
+       va_end (args);\r
+    }\r
+}\r
+\r
+#if defined(DAPL_COUNTERS)\r
+int dapl_dbg_counters[DCNT_NUM_COUNTERS] = { 0 };\r
+\r
+/*\r
+ * The order of this list must match exactly with the #defines\r
+ * in dapl_debug.h\r
+ */\r
+char  *dapl_dbg_counter_names[] = {\r
+       "dapl_ep_create",\r
+       "dapl_ep_free",\r
+       "dapl_ep_connect",\r
+       "dapl_ep_disconnect",\r
+       "dapl_ep_post_send",\r
+       "dapl_ep_post_recv",\r
+       "dapl_ep_post_rdma_write",\r
+       "dapl_ep_post_rdma_read",\r
+       "dapl_evd_create",\r
+       "dapl_evd_free",\r
+       "dapl_evd_wait",\r
+       "dapl_evd_blocked",\r
+       "dapl_evd_completion_notify",\r
+       "dapl_evd_dto_callback",\r
+       "dapl_evd_connection_callback",\r
+       "dapl_evd_dequeue",\r
+       "dapl_evd_poll",\r
+       "dapl_evd_found",\r
+       "dapl_evd_not_found",\r
+       "dapls_timer_set",\r
+       "dapls_timer_cancel",\r
+};\r
+\r
+void dapl_dump_cntr( int cntr )\r
+{\r
+    int i;\r
+\r
+    for ( i = 0; i < DCNT_NUM_COUNTERS; i++ )\r
+    {\r
+        if (( cntr == i ) || ( cntr == DCNT_ALL_COUNTERS ))\r
+        {\r
+            dapl_dbg_log (  DAPL_DBG_TYPE_CNTR,\r
+                            "DAPL Counter: %s = %lu \n",\r
+                            dapl_dbg_counter_names[i],\r
+                            dapl_dbg_counters[i] );\r
+        }\r
+    }\r
+}\r
+\r
+#endif /* DAPL_COUNTERS */\r
+#endif\r
+\r
diff --git a/ulp/dapl2/dapl/common/dapl_ep_connect.c b/ulp/dapl2/dapl/common/dapl_ep_connect.c
new file mode 100644 (file)
index 0000000..d71295c
--- /dev/null
@@ -0,0 +1,423 @@
+/*\r
+ * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
+ *    copy of which is available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+/**********************************************************************\r
+ *\r
+ * MODULE: dapl_ep_connect.c\r
+ *\r
+ * PURPOSE: Endpoint management\r
+ *\r
+ * $Id:$\r
+ **********************************************************************/\r
+\r
+#include "dapl.h"\r
+#include "dapl_ep_util.h"\r
+#include "dapl_adapter_util.h"\r
+#include "dapl_evd_util.h"\r
+#include "dapl_timer_util.h"\r
+\r
+/*\r
+ * dapl_ep_connect\r
+ *\r
+ * Request a connection be established between the local Endpoint\r
+ * and a remote Endpoint. This operation is used by the active/client\r
+ * side of a connection\r
+ *\r
+ * Input:\r
+ *     ep_handle\r
+ *     remote_ia_address\r
+ *     remote_conn_qual\r
+ *     timeout\r
+ *     private_data_size\r
+ *     privaet_data\r
+ *     qos\r
+ *     connect_flags\r
+ *\r
+ * Output:\r
+ *     None\r
+ *\r
+ * Returns:\r
+ *     DAT_SUCCESS\r
+ *     DAT_INSUFFICIENT_RESOUCRES\r
+ *     DAT_INVALID_PARAMETER\r
+ *     DAT_MODLE_NOT_SUPPORTED\r
+ */\r
+DAT_RETURN DAT_API\r
+dapl_ep_connect (\r
+       IN      DAT_EP_HANDLE           ep_handle,\r
+       IN      DAT_IA_ADDRESS_PTR      remote_ia_address,\r
+       IN      DAT_CONN_QUAL           remote_conn_qual,\r
+       IN      DAT_TIMEOUT             timeout,\r
+       IN      DAT_COUNT               private_data_size,\r
+       IN      const DAT_PVOID         private_data,\r
+       IN      DAT_QOS                 qos,\r
+       IN      DAT_CONNECT_FLAGS       connect_flags )\r
+{\r
+    DAPL_EP            *ep_ptr;\r
+    DAPL_EP            alloc_ep;\r
+    DAT_RETURN         dat_status;\r
+    DAT_COUNT          req_hdr_size;\r
+    DAT_UINT32         max_req_pdata_size;\r
+    void               *private_data_ptr;\r
+\r
+    dapl_dbg_log (DAPL_DBG_TYPE_API | DAPL_DBG_TYPE_CM,\r
+               "dapl_ep_connect (%p, {%u.%u.%u.%u}, %X, %d, %d, %p, %x, %x)\n",\r
+               ep_handle,\r
+               remote_ia_address->sa_data[2],\r
+               remote_ia_address->sa_data[3],\r
+               remote_ia_address->sa_data[4],\r
+               remote_ia_address->sa_data[5],\r
+               remote_conn_qual,\r
+               timeout,\r
+               private_data_size,\r
+               private_data,\r
+               qos,\r
+               connect_flags);\r
+    DAPL_CNTR (DCNT_EP_CONNECT);\r
+\r
+    dat_status = DAT_SUCCESS;\r
+    ep_ptr = (DAPL_EP *) ep_handle;\r
+\r
+    /*\r
+     * Verify parameter & state. The connection handle must be good\r
+     * at this point.\r
+     */\r
+    if ( DAPL_BAD_HANDLE (ep_ptr, DAPL_MAGIC_EP ) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);\r
+       goto bail;\r
+    }\r
+\r
+    if ( DAPL_BAD_HANDLE (ep_ptr->param.connect_evd_handle, DAPL_MAGIC_EVD) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EVD_CONN);\r
+       goto bail;\r
+    }\r
+\r
+    /* Can't do a connection in 0 time, reject outright */\r
+    if ( timeout == 0 )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG4);\r
+       goto bail;\r
+    }\r
+\r
+    /*\r
+     * If the endpoint needs a QP, associated the QP with it.\r
+     * This needs to be done carefully, in order to:\r
+     * * Avoid allocating under a lock.\r
+     *  * Not step on data structures being altered by\r
+     *    routines with which we are racing.\r
+     * So we:\r
+     *  * Confirm that a new QP is needed and is not forbidden by the\r
+     *    current state.\r
+     *  * Allocate it into a separate EP.\r
+     *  * Take the EP lock.\r
+     *  * Reconfirm that the EP is in a state where it needs a QP.\r
+     *  * Assign the QP and release the lock.\r
+     */\r
+    if ( ep_ptr->qp_state == DAPL_QP_STATE_UNATTACHED )\r
+    {\r
+       if ( ep_ptr->param.pz_handle == NULL\r
+            ||  DAPL_BAD_HANDLE (ep_ptr->param.pz_handle, DAPL_MAGIC_PZ) )\r
+       {\r
+           dat_status = DAT_ERROR (DAT_INVALID_STATE, DAT_INVALID_STATE_EP_NOTREADY);\r
+           goto bail;\r
+       }\r
+       alloc_ep = *ep_ptr;\r
+\r
+       dat_status = dapls_ib_qp_alloc ( ep_ptr->header.owner_ia,\r
+                                        &alloc_ep,\r
+                                        ep_ptr );\r
+       if ( dat_status != DAT_SUCCESS )\r
+       {\r
+           dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);\r
+           goto bail;\r
+       }\r
+\r
+       dapl_os_lock ( &ep_ptr->header.lock );\r
+       /*\r
+        * PZ shouldn't have changed since we're only racing with\r
+        * dapl_cr_accept()\r
+        */\r
+       if ( ep_ptr->qp_state != DAPL_QP_STATE_UNATTACHED )\r
+       {\r
+           /* Bail, cleaning up.  */\r
+           dapl_os_unlock ( &ep_ptr->header.lock );\r
+           dat_status = dapls_ib_qp_free ( ep_ptr->header.owner_ia,\r
+                                           &alloc_ep );\r
+           if (dat_status != DAT_SUCCESS)\r
+           {\r
+               dapl_dbg_log (DAPL_DBG_TYPE_WARN,\r
+                             "ep_connect: ib_qp_free failed with %x\n",\r
+                             dat_status);\r
+           }\r
+           dat_status = DAT_ERROR (DAT_INVALID_STATE, dapls_ep_state_subtype (ep_ptr));\r
+           goto bail;\r
+       }\r
+\r
+       ep_ptr->qp_handle = alloc_ep.qp_handle;\r
+       ep_ptr->qpn = alloc_ep.qpn;\r
+       ep_ptr->qp_state = alloc_ep.qp_state;\r
+\r
+       dapl_os_unlock ( &ep_ptr->header.lock );\r
+    }\r
+\r
+    /*\r
+     * We do state checks and transitions under lock.\r
+     * The only code we're racing against is dapl_cr_accept.\r
+     */\r
+    dapl_os_lock ( &ep_ptr->header.lock );\r
+\r
+    /*\r
+     * Verify the attributes of the EP handle before we connect it. Test\r
+     * all of the handles to make sure they are currently valid.\r
+     * Specifically:\r
+     *   pz_handle             required\r
+     *   recv_evd_handle       optional, but must be valid\r
+     *   request_evd_handle    optional, but must be valid\r
+     *   connect_evd_handle    required\r
+     */\r
+    if ( ep_ptr->param.pz_handle == NULL\r
+        ||  DAPL_BAD_HANDLE (ep_ptr->param.pz_handle, DAPL_MAGIC_PZ)\r
+        /* test connect handle */\r
+        || ep_ptr->param.connect_evd_handle == NULL\r
+        || DAPL_BAD_HANDLE (ep_ptr->param.connect_evd_handle, DAPL_MAGIC_EVD)\r
+        || ! (((DAPL_EVD *)ep_ptr->param.connect_evd_handle)->evd_flags & DAT_EVD_CONNECTION_FLAG)\r
+        /* test optional completion handles */\r
+        || (ep_ptr->param.recv_evd_handle != DAT_HANDLE_NULL &&\r
+            (DAPL_BAD_HANDLE (ep_ptr->param.recv_evd_handle, DAPL_MAGIC_EVD)))\r
+        || (ep_ptr->param.request_evd_handle != DAT_HANDLE_NULL &&\r
+            (DAPL_BAD_HANDLE (ep_ptr->param.request_evd_handle, DAPL_MAGIC_EVD))))\r
+    {\r
+       dapl_os_unlock ( &ep_ptr->header.lock );\r
+       dat_status = DAT_ERROR (DAT_INVALID_STATE, DAT_INVALID_STATE_EP_NOTREADY);\r
+       goto bail;\r
+    }\r
+\r
+    /* Check both the EP state and the QP state: if we don't have a QP\r
+     *  we need to attach one now.\r
+     */\r
+    if ( ep_ptr->qp_state == DAPL_QP_STATE_UNATTACHED )\r
+    {\r
+       dat_status = dapls_ib_qp_alloc ( ep_ptr->header.owner_ia,\r
+                                        ep_ptr, ep_ptr );\r
+\r
+       if ( dat_status != DAT_SUCCESS)\r
+       {\r
+           dapl_os_unlock ( &ep_ptr->header.lock );\r
+           dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_TEP);\r
+           goto bail;\r
+       }\r
+    }\r
+\r
+    if ( ep_ptr->param.ep_state != DAT_EP_STATE_UNCONNECTED )\r
+    {\r
+       dapl_os_unlock ( &ep_ptr->header.lock );\r
+       dat_status = DAT_ERROR (DAT_INVALID_STATE, dapls_ep_state_subtype (ep_ptr));\r
+       goto bail;\r
+    }\r
+\r
+    if ( qos != DAT_QOS_BEST_EFFORT ||\r
+        connect_flags != DAT_CONNECT_DEFAULT_FLAG )\r
+    {\r
+       /*\r
+        * At this point we only support one QOS level\r
+        */\r
+       dapl_os_unlock ( &ep_ptr->header.lock );\r
+       dat_status = DAT_ERROR (DAT_MODEL_NOT_SUPPORTED, 0);\r
+       goto bail;\r
+    }\r
+\r
+    /*\r
+     * Verify the private data size doesn't exceed the max\r
+     * req_hdr_size will evaluate to 0 unless IBHOSTS_NAMING is enabled.\r
+     */\r
+    req_hdr_size = (sizeof (DAPL_PRIVATE) - DAPL_MAX_PRIVATE_DATA_SIZE);\r
+\r
+    max_req_pdata_size = dapls_ib_private_data_size (NULL, DAPL_PDATA_CONN_REQ);\r
+\r
+    if (private_data_size + req_hdr_size > (DAT_COUNT)max_req_pdata_size) \r
+    {\r
+       dapl_os_unlock ( &ep_ptr->header.lock );\r
+       dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG5);\r
+       goto bail;\r
+    }\r
+\r
+    /* transition the state before requesting a connection to avoid\r
+     * race conditions\r
+     */\r
+    ep_ptr->param.ep_state = DAT_EP_STATE_ACTIVE_CONNECTION_PENDING;\r
+\r
+    /*\r
+     * At this point we're committed, and done with the endpoint\r
+     * except for the connect, so we can drop the lock.\r
+     */\r
+    dapl_os_unlock ( &ep_ptr->header.lock );\r
+\r
+#ifdef IBHOSTS_NAMING\r
+    /*\r
+     * Special case: put the remote HCA address into the private data\r
+     * prefix. This is a spec violation as it introduces a protocol, but\r
+     * some implementations may find it necessary for a time.\r
+     * Copy the private data into the EP area so the data is contiguous.\r
+     * If the provider needs to pad the buffer with NULLs, it happens at\r
+     * the provider layer.\r
+     */\r
+    dapl_os_memcpy (&ep_ptr->hca_address,\r
+                   &ep_ptr->header.owner_ia->hca_ptr->hca_address,\r
+                   sizeof (DAT_SOCK_ADDR));\r
+    dapl_os_memcpy (ep_ptr->private.private_data, private_data, private_data_size);\r
+    private_data_ptr = (void *)&ep_ptr->private.private_data;\r
+#else\r
+    private_data_ptr = private_data;\r
+#endif /* IBHOSTS_NAMING */\r
+\r
+    /* Copy the connection qualifiers */\r
+    dapl_os_memcpy ( ep_ptr->param.remote_ia_address_ptr,\r
+                    remote_ia_address,\r
+                    sizeof ( DAT_SOCK_ADDR) );\r
+    ep_ptr->param.remote_port_qual = remote_conn_qual;\r
+\r
+    dat_status =  dapls_ib_connect ( ep_handle,\r
+                                    remote_ia_address,\r
+                                    remote_conn_qual,\r
+                                    private_data_size + req_hdr_size,\r
+                                    private_data_ptr );\r
+\r
+    if ( dat_status != DAT_SUCCESS )\r
+    {\r
+       ep_ptr->param.ep_state = DAT_EP_STATE_UNCONNECTED;\r
+\r
+       /*\r
+        * Some implementations provide us with an error code that the\r
+        * remote destination is unreachable, but DAT doesn't have a\r
+        * synchronous error code to communicate this. So the provider\r
+        * layer generates an INTERNAL_ERROR with a subtype; when\r
+        * this happens, return SUCCESS and generate the event\r
+        */\r
+       if (dat_status == DAT_ERROR (DAT_INTERNAL_ERROR, 1) )\r
+       {\r
+           dapls_evd_post_connection_event (\r
+                       (DAPL_EVD *)ep_ptr->param.connect_evd_handle,\r
+                       DAT_CONNECTION_EVENT_UNREACHABLE,\r
+                       (DAT_HANDLE) ep_ptr,\r
+                       0,\r
+                       0);\r
+           dat_status = DAT_SUCCESS;\r
+       }\r
+    }\r
+    else\r
+    {\r
+       /*\r
+        * Acquire the lock and recheck the state of the EP; this\r
+        * thread could have been descheduled after issuing the connect\r
+        * request and the EP is now connected. Set up a timer if\r
+        * necessary.\r
+        */\r
+       dapl_os_lock ( &ep_ptr->header.lock );\r
+       if (ep_ptr->param.ep_state == DAT_EP_STATE_ACTIVE_CONNECTION_PENDING &&\r
+           timeout != DAT_TIMEOUT_INFINITE )\r
+       {\r
+           ep_ptr->cxn_timer =\r
+               (DAPL_OS_TIMER *)dapl_os_alloc (sizeof (DAPL_OS_TIMER));\r
+\r
+           dapls_timer_set ( ep_ptr->cxn_timer,\r
+                             dapls_ep_timeout,\r
+                             ep_ptr,\r
+                             timeout );\r
+       }\r
+       dapl_os_unlock ( &ep_ptr->header.lock );\r
+    }\r
+\r
+bail:\r
+    dapl_dbg_log (DAPL_DBG_TYPE_RTN | DAPL_DBG_TYPE_CM,\r
+                 "dapl_ep_connect () returns 0x%x\n",\r
+                 dat_status);\r
+\r
+    return dat_status;\r
+}\r
+\r
+/*\r
+ * dapl_ep_common_connect\r
+ *\r
+ * DAPL Requirements Version 2.0, 6.6.x\r
+ *\r
+ * Requests that a connection be established\r
+ * between the local Endpoint and a remote Endpoint specified by the\r
+ * remote_ia_address. This operation is used by the active/client side\r
+ * Consumer of the Connection establishment model.\r
+ *\r
+ * EP must be properly configured for this operation. The EP Communicator\r
+ * must be specified. As part of the successful completion of this operation,\r
+ * the local Endpoint is bound to a local IA Address if it had these assigned\r
+ * before.\r
+ * \r
+ * The local IP Address, port and protocol are passed to the remote side of\r
+ * the requested connection and is available to the remote Consumer in the\r
+ * Connection Request of the DAT_CONNECTION_REQUEST_EVENT.\r
+ * \r
+ * The Consumer-provided private_data is passed to the remote side and is\r
+ * provided to the remote Consumer in the Connection Request. Consumers\r
+ * can encapsulate any local Endpoint attributes that remote Consumers\r
+ * need to know as part of an upper-level protocol.\r
+ *\r
+ * Input:\r
+ *     ep_handle\r
+ *     remote_ia_address\r
+ *     timeout\r
+ *     private_data_size\r
+ *     private_date pointer\r
+ *\r
+ * Output:\r
+ *     none\r
+ * \r
+ * Returns:\r
+ *     DAT_SUCCESS\r
+ *     DAT_INSUFFICIENT_RESOURCES\r
+ *     DAT_INVALID_PARAMETER\r
+ *     DAT_INVALID_HANDLE\r
+ *     DAT_INVALID_STATE\r
+ *     DAT_MODEL_NOT_SUPPORTED\r
+ */\r
+DAT_RETURN DAT_API \r
+dapl_ep_common_connect (\r
+       IN      DAT_EP_HANDLE ep,               /* ep_handle            */\r
+       IN      DAT_IA_ADDRESS_PTR remote_addr, /* remote_ia_address    */\r
+       IN      DAT_TIMEOUT timeout,            /* timeout              */\r
+       IN      DAT_COUNT pdata_size,           /* private_data_size    */\r
+       IN      const DAT_PVOID pdata   )       /* private_data         */\r
+{\r
+       return DAT_MODEL_NOT_SUPPORTED;\r
+}\r
+\r
+/*\r
+ * Local variables:\r
+ *  c-indent-level: 4\r
+ *  c-basic-offset: 4\r
+ *  tab-width: 8\r
+ * End:\r
+ */\r
diff --git a/ulp/dapl2/dapl/common/dapl_ep_create.c b/ulp/dapl2/dapl/common/dapl_ep_create.c
new file mode 100644 (file)
index 0000000..ccb506d
--- /dev/null
@@ -0,0 +1,343 @@
+/*\r
+ * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
+ *    copy of which is available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+/**********************************************************************\r
+ * \r
+ * MODULE: dapl_ep_create.c\r
+ *\r
+ * PURPOSE: Endpoint management\r
+ *\r
+ * $Id:$\r
+ **********************************************************************/\r
+\r
+#include "dapl.h"\r
+#include "dapl_ia_util.h"\r
+#include "dapl_ep_util.h"\r
+#include "dapl_adapter_util.h"\r
+\r
+\r
+/*\r
+ * dapl_ep_create\r
+ *\r
+ * Create an instance of an Endpoint that is provided to the\r
+ * consumer at ep_handle.\r
+ *\r
+ * Input:\r
+ *     ia_handle\r
+ *     pz_handle\r
+ *     recv_evd_handle (recv DTOs)\r
+ *     request_evd_handle (xmit DTOs)\r
+ *     connect_evd_handle\r
+ *     ep_attrs\r
+ *\r
+ * Output:\r
+ *     ep_handle\r
+ *\r
+ * Returns:\r
+ *     DAT_SUCCESS\r
+ *     DAT_INSUFFICIENT_RESOURCES\r
+ *     DAT_INVALID_PARAMETER\r
+ *     DAT_INVALID_ATTRIBUTE\r
+ *     DAT_MODEL_NOT_SUPPORTED\r
+ */\r
+DAT_RETURN DAT_API\r
+dapl_ep_create (\r
+    IN  DAT_IA_HANDLE           ia_handle,\r
+    IN  DAT_PZ_HANDLE           pz_handle,\r
+    IN  DAT_EVD_HANDLE          recv_evd_handle,\r
+    IN  DAT_EVD_HANDLE          request_evd_handle,\r
+    IN  DAT_EVD_HANDLE          connect_evd_handle,\r
+    IN  const DAT_EP_ATTR       *ep_attr,\r
+    OUT DAT_EP_HANDLE           *ep_handle )\r
+{\r
+    DAPL_IA                     *ia_ptr;\r
+    DAPL_EP                     *ep_ptr;\r
+    DAT_EP_ATTR                 ep_attr_limit;\r
+    DAPL_EVD                    *evd_ptr;\r
+    DAT_RETURN                  dat_status;\r
+\r
+    dapl_dbg_log (DAPL_DBG_TYPE_API,\r
+                 "dapl_ep_create (%p, %p, %p, %p, %p, %p, %p)\n",\r
+                 ia_handle, \r
+                 pz_handle, \r
+                 recv_evd_handle, \r
+                 request_evd_handle,\r
+                 connect_evd_handle, \r
+                 ep_attr, \r
+                 ep_handle);\r
+    DAPL_CNTR(DCNT_EP_CREATE);\r
+\r
+    ia_ptr = (DAPL_IA *)ia_handle;\r
+    dat_status = DAT_SUCCESS;\r
+\r
+    /*\r
+     * Verify parameters\r
+     */\r
+    if ( DAPL_BAD_HANDLE (ia_ptr, DAPL_MAGIC_IA) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);\r
+       goto bail;\r
+    }\r
+\r
+    /*\r
+     * Verify non-required parameters.\r
+     * N.B. Assumption: any parameter that can be\r
+     *      modified by dat_ep_modify() is not strictly\r
+     *      required when the EP is created\r
+     */\r
+    if ( pz_handle != DAT_HANDLE_NULL && \r
+        DAPL_BAD_HANDLE (pz_handle, DAPL_MAGIC_PZ) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PZ);\r
+       goto bail;\r
+    }\r
+\r
+    /* If connect handle is !NULL verify handle is good  */\r
+    if (connect_evd_handle != DAT_HANDLE_NULL &&\r
+       (DAPL_BAD_HANDLE (connect_evd_handle, DAPL_MAGIC_EVD) ||\r
+        ! (((DAPL_EVD *)connect_evd_handle)->evd_flags & DAT_EVD_CONNECTION_FLAG)) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EVD_CONN);\r
+       goto bail;\r
+    }\r
+\r
+    /* If recv_evd is !NULL, verify handle is good and flags are valid */\r
+    if (recv_evd_handle != DAT_HANDLE_NULL &&\r
+       (DAPL_BAD_HANDLE (recv_evd_handle, DAPL_MAGIC_EVD) ||\r
+        ! (((DAPL_EVD *)recv_evd_handle)->evd_flags & DAT_EVD_DTO_FLAG) ) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EVD_RECV);\r
+       goto bail;\r
+    }\r
+\r
+    /* If req_evd is !NULL, verify handle is good and flags are valid */\r
+    if (request_evd_handle != DAT_HANDLE_NULL && \r
+       (DAPL_BAD_HANDLE (request_evd_handle, DAPL_MAGIC_EVD) ||\r
+        ! (((DAPL_EVD *)request_evd_handle)->evd_flags & DAT_EVD_DTO_FLAG) ) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EVD_REQUEST);\r
+       goto bail;\r
+    }\r
+\r
+    if ( ep_handle == NULL )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG7);\r
+       goto bail;\r
+    }\r
+    if (DAPL_BAD_PTR(ep_attr))\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG6);\r
+       goto bail;\r
+    }\r
+\r
+    /*\r
+     * Qualify EP Attributes are legal and make sense.  Note that if one\r
+     * or both of the DTO handles are NULL, then the corresponding\r
+     * max_*_dtos must 0 as the user will not be able to post dto ops on\r
+     * the respective queue.\r
+     */\r
+    if (ep_attr != NULL && \r
+       (ep_attr->service_type != DAT_SERVICE_TYPE_RC ||\r
+        (recv_evd_handle == DAT_HANDLE_NULL && ep_attr->max_recv_dtos != 0) ||\r
+        (recv_evd_handle != DAT_HANDLE_NULL && ep_attr->max_recv_dtos == 0) ||\r
+        (request_evd_handle == DAT_HANDLE_NULL && ep_attr->max_request_dtos != 0) ||\r
+        (request_evd_handle != DAT_HANDLE_NULL && ep_attr->max_request_dtos == 0) ||\r
+        (recv_evd_handle != DAT_HANDLE_NULL && ep_attr->max_recv_iov == 0) ||\r
+        ep_attr->max_request_iov == 0 ||\r
+         (DAT_SUCCESS != dapl_ep_check_recv_completion_flags (\r
+             ep_attr->recv_completion_flags)) ))\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG6);\r
+       goto bail;\r
+    }\r
+\r
+    /* Verify the attributes against the transport */\r
+    if (ep_attr != NULL)\r
+    {\r
+       dapl_os_memzero (&ep_attr_limit, sizeof (DAT_EP_ATTR));\r
+       dat_status = dapls_ib_query_hca (ia_ptr->hca_ptr, \r
+                                        NULL, &ep_attr_limit, NULL);\r
+       if (dat_status != DAT_SUCCESS)\r
+       {\r
+           goto bail;\r
+       }\r
+       if ( ep_attr->max_mtu_size     > ep_attr_limit.max_mtu_size       ||\r
+            ep_attr->max_rdma_size    > ep_attr_limit.max_rdma_size      ||\r
+            ep_attr->max_recv_dtos    > ep_attr_limit.max_recv_dtos      ||\r
+            ep_attr->max_request_dtos > ep_attr_limit.max_request_dtos   ||\r
+            ep_attr->max_recv_iov     > ep_attr_limit.max_recv_iov       ||\r
+            ep_attr->max_request_iov  > ep_attr_limit.max_request_iov    ||\r
+            ep_attr->max_rdma_read_in > ep_attr_limit.max_rdma_read_in   ||\r
+            ep_attr->max_rdma_read_out> ep_attr_limit.max_rdma_read_out )\r
+\r
+       {\r
+           dat_status = DAT_INVALID_PARAMETER | DAT_INVALID_ARG6;\r
+           goto bail;\r
+       }\r
+    }\r
+\r
+    /*\r
+     * Verify the completion flags for the EVD and the EP\r
+     */\r
+    /*\r
+     * XXX FIXME\r
+     * XXX Need to make assign the EVD to the right completion type\r
+     * XXX depending on the EP attributes. Fail if the types don't\r
+     * XXX match, they are mutually exclusive.\r
+     */\r
+    evd_ptr = (DAPL_EVD *)recv_evd_handle;\r
+    if (evd_ptr != NULL && evd_ptr->completion_type == DAPL_EVD_STATE_INIT)\r
+    {\r
+       if (ep_attr != NULL && \r
+           ep_attr->recv_completion_flags == DAT_COMPLETION_DEFAULT_FLAG)\r
+       {\r
+           evd_ptr->completion_type = DAPL_EVD_STATE_THRESHOLD;\r
+       }\r
+       else\r
+       {\r
+           evd_ptr->completion_type = ep_attr->recv_completion_flags;\r
+       }\r
+    }\r
+\r
+    evd_ptr = (DAPL_EVD *)request_evd_handle;\r
+    if (evd_ptr != NULL && evd_ptr->completion_type == DAPL_EVD_STATE_INIT)\r
+    {\r
+       if (ep_attr != NULL && \r
+           ep_attr->recv_completion_flags == DAT_COMPLETION_DEFAULT_FLAG)\r
+       {\r
+           evd_ptr->completion_type = DAPL_EVD_STATE_THRESHOLD;\r
+       }\r
+       else\r
+       {\r
+           evd_ptr->completion_type = ep_attr->recv_completion_flags;\r
+       }\r
+    }\r
+\r
+\r
+    /* Allocate EP */\r
+    ep_ptr = dapl_ep_alloc ( ia_ptr, ep_attr );\r
+    if ( ep_ptr == NULL )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);\r
+       goto bail;\r
+    }\r
+\r
+    /*\r
+     * Fill in the EP\r
+     */\r
+    ep_ptr->param.ia_handle           = ia_handle;\r
+    ep_ptr->param.ep_state           = DAT_EP_STATE_UNCONNECTED;\r
+    ep_ptr->param.local_ia_address_ptr=\r
+       (DAT_IA_ADDRESS_PTR)&ia_ptr->hca_ptr->hca_address;\r
+    /* Set the remote address pointer to the end of the EP struct */\r
+    ep_ptr->param.remote_ia_address_ptr = (DAT_IA_ADDRESS_PTR) (ep_ptr + 1);\r
+\r
+    ep_ptr->param.pz_handle           = pz_handle;\r
+    ep_ptr->param.recv_evd_handle     = recv_evd_handle;\r
+    ep_ptr->param.request_evd_handle  = request_evd_handle;\r
+    ep_ptr->param.connect_evd_handle  = connect_evd_handle;\r
+\r
+    /*\r
+     * Make sure we handle the NULL DTO EVDs\r
+     */\r
+    if ( recv_evd_handle == DAT_HANDLE_NULL && ep_attr == NULL )\r
+    {\r
+       ep_ptr->param.ep_attr.max_recv_dtos = 0;\r
+    }\r
+\r
+    if ( request_evd_handle == DAT_HANDLE_NULL && ep_attr == NULL )\r
+    {\r
+       ep_ptr->param.ep_attr.max_request_dtos = 0;\r
+    }\r
+\r
+    /*\r
+     * If the user has specified a PZ handle we allocate a QP for\r
+     * this EP; else we defer until it is assigned via ep_modify().\r
+     * As much as possible we try to keep QP creation out of the\r
+     * connect path to avoid resource errors in strange places.\r
+     */\r
+    if (pz_handle != DAT_HANDLE_NULL )\r
+    {\r
+       /* Take a reference on the PZ handle */\r
+       dapl_os_atomic_inc (& ((DAPL_PZ *)pz_handle)->pz_ref_count);\r
+\r
+       /*\r
+        * Get a QP from the IB provider\r
+        */\r
+       dat_status = dapls_ib_qp_alloc ( ia_ptr, ep_ptr, ep_ptr );\r
+\r
+       if ( dat_status != DAT_SUCCESS)\r
+       {\r
+           dapl_os_atomic_dec (& ((DAPL_PZ *)pz_handle)->pz_ref_count);\r
+           dapl_ep_dealloc ( ep_ptr );\r
+           goto bail;\r
+       }\r
+    }\r
+    else\r
+    {\r
+       ep_ptr->qp_state = DAPL_QP_STATE_UNATTACHED;\r
+    }\r
+\r
+    /*\r
+     * Update ref counts. See the spec where the endpoint marks\r
+     * a data object as 'in use'\r
+     *   pz_handle: dat_pz_free, uDAPL Document, 6.6.1.2\r
+     *   evd_handles:\r
+     *\r
+     * N.B. This should really be done by a util routine.\r
+     */\r
+    if (connect_evd_handle != DAT_HANDLE_NULL)\r
+    {\r
+       dapl_os_atomic_inc (& ((DAPL_EVD *)connect_evd_handle)->evd_ref_count);\r
+    }\r
+    /* Optional handles */\r
+    if (recv_evd_handle != DAT_HANDLE_NULL)\r
+    {\r
+       dapl_os_atomic_inc (& ((DAPL_EVD *)recv_evd_handle)->evd_ref_count);\r
+    }\r
+    if (request_evd_handle != DAT_HANDLE_NULL)\r
+    {\r
+       dapl_os_atomic_inc (& ((DAPL_EVD *)request_evd_handle)->evd_ref_count);\r
+    }\r
+\r
+    /* Link it onto the IA */\r
+    dapl_ia_link_ep (ia_ptr, ep_ptr);\r
+\r
+    *ep_handle = ep_ptr;\r
+\r
+bail:\r
+    return dat_status;\r
+}\r
+\r
+\r
+/*\r
+ * Local variables:\r
+ *  c-indent-level: 4\r
+ *  c-basic-offset: 4\r
+ *  tab-width: 8\r
+ * End:\r
+ */\r
diff --git a/ulp/dapl2/dapl/common/dapl_ep_create_with_srq.c b/ulp/dapl2/dapl/common/dapl_ep_create_with_srq.c
new file mode 100644 (file)
index 0000000..72fa583
--- /dev/null
@@ -0,0 +1,369 @@
+/*\r
+ * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
+ *    copy of which is available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+/**********************************************************************\r
+ * \r
+ * MODULE: dapl_ep_create_with_srq.c\r
+ *\r
+ * PURPOSE: Endpoint management\r
+ * Description: Interfaces in this file are completely described in\r
+ *             the kDAPL 1.2 API, Chapter 6, section 6.5\r
+ *\r
+ * $Id:$\r
+ **********************************************************************/\r
+\r
+#include "dapl.h"\r
+#include "dapl_ia_util.h"\r
+#include "dapl_ep_util.h"\r
+#include "dapl_adapter_util.h"\r
+\r
+\r
+/*\r
+ * dapl_ep_create_with_srq\r
+ *\r
+ * uDAPL Version 1.2, 6.6.5\r
+ *\r
+ * Create an instance of an Endpoint that is provided to the\r
+ * consumer at ep_handle.\r
+ *\r
+ * Input:\r
+ *     ia_handle\r
+ *     pz_handle\r
+ *     recv_evd_handle (recv DTOs)\r
+ *     request_evd_handle (xmit DTOs)\r
+ *     connect_evd_handle\r
+ *     srq_handle\r
+ *     ep_attrs\r
+ *\r
+ * Output:\r
+ *     ep_handle\r
+ *\r
+ * Returns:\r
+ *     DAT_SUCCESS\r
+ *     DAT_INSUFFICIENT_RESOURCES\r
+ *     DAT_INVALID_HANDLE\r
+ *     DAT_INVALID_PARAMETER\r
+ *     DAT_INVALID_ATTRIBUTE\r
+ *     DAT_MODEL_NOT_SUPPORTED\r
+ */\r
+DAT_RETURN DAT_API\r
+dapl_ep_create_with_srq (\r
+       IN      DAT_IA_HANDLE           ia_handle,\r
+       IN      DAT_PZ_HANDLE           pz_handle,\r
+       IN      DAT_EVD_HANDLE          recv_evd_handle,\r
+       IN      DAT_EVD_HANDLE          request_evd_handle,\r
+       IN      DAT_EVD_HANDLE          connect_evd_handle,\r
+       IN      DAT_SRQ_HANDLE          srq_handle,\r
+       IN      const DAT_EP_ATTR       *ep_attr,\r
+       OUT     DAT_EP_HANDLE           *ep_handle )\r
+{\r
+    DAPL_IA            *ia_ptr;\r
+    DAPL_EP            *ep_ptr;\r
+    DAT_EP_ATTR                ep_attr_limit;\r
+    DAPL_EVD           *evd_ptr;\r
+    DAT_RETURN         dat_status;\r
+\r
+    dat_status = DAT_SUCCESS;\r
+    dapl_dbg_log (DAPL_DBG_TYPE_API,\r
+                 "dapl_ep_create_with_srq (%p, %p, %p, %p, %p, %p, %p %p)\n",\r
+                 ia_handle,\r
+                 pz_handle,\r
+                 recv_evd_handle,\r
+                 request_evd_handle,\r
+                 connect_evd_handle,\r
+                 srq_handle,\r
+                 ep_attr,\r
+                 ep_handle);\r
+\r
+    ia_ptr = (DAPL_IA *)ia_handle;\r
+\r
+    /*\r
+     * Verify parameters\r
+     */\r
+    if ( DAPL_BAD_HANDLE (ia_ptr, DAPL_MAGIC_IA) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);\r
+       goto bail;\r
+    }\r
+\r
+    /*\r
+     * Verify non-required parameters.\r
+     * N.B. Assumption: any parameter that can be\r
+     *      modified by dat_ep_modify() is not strictly\r
+     *      required when the EP is created\r
+     */\r
+    if ( pz_handle != NULL && \r
+        DAPL_BAD_HANDLE (pz_handle, DAPL_MAGIC_PZ) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PZ);\r
+       goto bail;\r
+    }\r
+\r
+    /* If connect handle is !NULL verify handle is good  */\r
+    if (connect_evd_handle != DAT_HANDLE_NULL &&\r
+       (DAPL_BAD_HANDLE (connect_evd_handle, DAPL_MAGIC_EVD) ||\r
+        ! (((DAPL_EVD *)connect_evd_handle)->evd_flags & DAT_EVD_CONNECTION_FLAG)) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EVD_CONN);\r
+       goto bail;\r
+    }\r
+    /* If recv_evd is !NULL, verify handle is good and flags are valid */\r
+    if (recv_evd_handle != DAT_HANDLE_NULL &&\r
+       (DAPL_BAD_HANDLE (recv_evd_handle, DAPL_MAGIC_EVD) ||\r
+        ! (((DAPL_EVD *)recv_evd_handle)->evd_flags & DAT_EVD_DTO_FLAG) ) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EVD_RECV);\r
+       goto bail;\r
+    }\r
+\r
+    /* If req_evd is !NULL, verify handle is good and flags are valid */\r
+    if (request_evd_handle != DAT_HANDLE_NULL && \r
+       (DAPL_BAD_HANDLE (request_evd_handle, DAPL_MAGIC_EVD) ||\r
+        ! (((DAPL_EVD *)request_evd_handle)->evd_flags & DAT_EVD_DTO_FLAG) ) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EVD_REQUEST);\r
+       goto bail;\r
+    }\r
+\r
+    /*\r
+     * Verify the SRQ handle. It is an error to invoke this call with\r
+     * a NULL handle\r
+     */\r
+    if (DAPL_BAD_HANDLE (srq_handle, DAPL_MAGIC_SRQ))\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ);\r
+       goto bail;\r
+    }\r
+\r
+    if ( ep_handle == NULL )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG7);\r
+       goto bail;\r
+    }\r
+\r
+    if ( DAPL_BAD_PTR(ep_attr) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG6);\r
+       goto bail;\r
+    }\r
+\r
+    /*\r
+     * Qualify EP Attributes are legal and make sense.  Note that if one\r
+     * or both of the DTO handles are NULL, then the corresponding\r
+     * max_*_dtos must 0 as the user will not be able to post dto ops on\r
+     * the respective queue.\r
+     */\r
+    if (ep_attr != NULL && \r
+       (ep_attr->service_type != DAT_SERVICE_TYPE_RC ||\r
+        (recv_evd_handle == DAT_HANDLE_NULL && ep_attr->max_recv_dtos != 0) ||\r
+        (recv_evd_handle != DAT_HANDLE_NULL && ep_attr->max_recv_dtos == 0) ||\r
+        (request_evd_handle == DAT_HANDLE_NULL && ep_attr->max_request_dtos != 0) ||\r
+        (request_evd_handle != DAT_HANDLE_NULL && ep_attr->max_request_dtos == 0) ||\r
+        ep_attr->max_recv_iov == 0 ||\r
+        ep_attr->max_request_iov == 0 ||\r
+         (DAT_SUCCESS != dapl_ep_check_recv_completion_flags (\r
+             ep_attr->recv_completion_flags)) ))\r
+    {\r
+       dat_status = DAT_INVALID_PARAMETER | DAT_INVALID_ARG6;\r
+       goto bail;\r
+    }\r
+\r
+    /* Verify the attributes against the transport */\r
+    if (ep_attr != NULL)\r
+    {\r
+       dapl_os_memzero (&ep_attr_limit, sizeof (DAT_EP_ATTR));\r
+       dat_status = dapls_ib_query_hca (ia_ptr->hca_ptr, \r
+                                        NULL, &ep_attr_limit, NULL);\r
+       if (dat_status != DAT_SUCCESS)\r
+       {\r
+           goto bail;\r
+       }\r
+       if ( ep_attr->max_mtu_size     > ep_attr_limit.max_mtu_size       ||\r
+            ep_attr->max_rdma_size    > ep_attr_limit.max_rdma_size      ||\r
+            ep_attr->max_recv_dtos    > ep_attr_limit.max_recv_dtos      ||\r
+            ep_attr->max_request_dtos > ep_attr_limit.max_request_dtos   ||\r
+            ep_attr->max_recv_iov     > ep_attr_limit.max_recv_iov       ||\r
+            ep_attr->max_request_iov  > ep_attr_limit.max_request_iov    ||\r
+            ep_attr->max_rdma_read_in > ep_attr_limit.max_rdma_read_in   ||\r
+            ep_attr->max_rdma_read_out> ep_attr_limit.max_rdma_read_out )\r
+\r
+       {\r
+           dat_status = DAT_INVALID_PARAMETER | DAT_INVALID_ARG6;\r
+           goto bail;\r
+       }\r
+    }\r
+\r
+    /*\r
+     * Verify the completion flags for the EVD and the EP\r
+     */\r
+    /*\r
+     * XXX FIXME\r
+     * XXX Need to make assign the EVD to the right completion type\r
+     * XXX depending on the EP attributes. Fail if the types don't\r
+     * XXX match, they are mutually exclusive.\r
+     */\r
+    evd_ptr = (DAPL_EVD *)recv_evd_handle;\r
+    if (evd_ptr != NULL && evd_ptr->completion_type == DAPL_EVD_STATE_INIT)\r
+    {\r
+       if (ep_attr != NULL && \r
+           ep_attr->recv_completion_flags == DAT_COMPLETION_DEFAULT_FLAG)\r
+       {\r
+           evd_ptr->completion_type = DAPL_EVD_STATE_THRESHOLD;\r
+       }\r
+       else\r
+       {\r
+           evd_ptr->completion_type = ep_attr->recv_completion_flags;\r
+       }\r
+    }\r
+\r
+    evd_ptr = (DAPL_EVD *)request_evd_handle;\r
+    if (evd_ptr != NULL && evd_ptr->completion_type == DAPL_EVD_STATE_INIT)\r
+    {\r
+       if (ep_attr != NULL && \r
+           ep_attr->recv_completion_flags == DAT_COMPLETION_DEFAULT_FLAG)\r
+       {\r
+           evd_ptr->completion_type = DAPL_EVD_STATE_THRESHOLD;\r
+       }\r
+       else\r
+       {\r
+           evd_ptr->completion_type = ep_attr->recv_completion_flags;\r
+       }\r
+    }\r
+\r
+    dat_status = DAT_NOT_IMPLEMENTED;\r
+\r
+    /*\r
+     * XXX The rest of the EP code is useful in this case too,\r
+     * XXX but need to complete the SRQ implementation before\r
+     * XXX committing resources\r
+     */\r
+    *ep_handle = ep_ptr = NULL;\r
+    goto bail;\r
+#ifdef notdef\r
+\r
+    /* Allocate EP */\r
+    ep_ptr = dapl_ep_alloc ( ia_ptr, ep_attr );\r
+    if ( ep_ptr == NULL )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);\r
+       goto bail;\r
+    }\r
+\r
+    /*\r
+     * Fill in the EP\r
+     */\r
+    ep_ptr->param.ia_handle           = ia_handle;\r
+    ep_ptr->param.ep_state           = DAT_EP_STATE_UNCONNECTED;\r
+    ep_ptr->param.local_ia_address_ptr=\r
+       (DAT_IA_ADDRESS_PTR)&ia_ptr->hca_ptr->hca_address;\r
+    /* Set the remote address pointer to the end of the EP struct */\r
+    ep_ptr->param.remote_ia_address_ptr = (DAT_IA_ADDRESS_PTR) (ep_ptr + 1);\r
+\r
+    ep_ptr->param.pz_handle           = pz_handle;\r
+    ep_ptr->param.recv_evd_handle     = recv_evd_handle;\r
+    ep_ptr->param.request_evd_handle  = request_evd_handle;\r
+    ep_ptr->param.connect_evd_handle  = connect_evd_handle;\r
+\r
+    /*\r
+     * Make sure we handle the NULL DTO EVDs\r
+     */\r
+    if ( recv_evd_handle == DAT_HANDLE_NULL && ep_attr == NULL )\r
+    {\r
+       ep_ptr->param.ep_attr.max_recv_dtos = 0;\r
+    }\r
+\r
+    if ( request_evd_handle == DAT_HANDLE_NULL && ep_attr == NULL )\r
+    {\r
+       ep_ptr->param.ep_attr.max_request_dtos = 0;\r
+    }\r
+\r
+    /*\r
+     * If the user has specified a PZ handle we allocate a QP for\r
+     * this EP; else we defer until it is assigned via ep_modify().\r
+     * As much as possible we try to keep QP creation out of the\r
+     * connect path to avoid resource errors in strange places.\r
+     */\r
+    if (pz_handle != DAT_HANDLE_NULL )\r
+    {\r
+       /* Take a reference on the PZ handle */\r
+       dapl_os_atomic_inc (& ((DAPL_PZ *)pz_handle)->pz_ref_count);\r
+\r
+       /*\r
+        * Get a QP from the IB provider\r
+        */\r
+       dat_status = dapls_ib_qp_alloc ( ia_ptr, ep_ptr, ep_ptr );\r
+\r
+       if ( dat_status != DAT_SUCCESS)\r
+       {\r
+           dapl_os_atomic_dec (& ((DAPL_PZ *)pz_handle)->pz_ref_count);\r
+           dapl_ep_dealloc ( ep_ptr );\r
+           goto bail;\r
+       }\r
+    }\r
+    else\r
+    {\r
+       ep_ptr->qp_state = DAPL_QP_STATE_UNATTACHED;\r
+    }\r
+\r
+    /*\r
+     * Update ref counts. See the spec where the endpoint marks\r
+     * a data object as 'in use'\r
+     *   pz_handle: dat_pz_free, uDAPL Document, 6.6.1.2\r
+     *   evd_handles:\r
+     *\r
+     * N.B. This should really be done by a util routine.\r
+     */\r
+    dapl_os_atomic_inc (& ((DAPL_EVD *)connect_evd_handle)->evd_ref_count);\r
+    /* Optional handles */\r
+    if (recv_evd_handle != DAT_HANDLE_NULL)\r
+    {\r
+       dapl_os_atomic_inc (& ((DAPL_EVD *)recv_evd_handle)->evd_ref_count);\r
+    }\r
+    if (request_evd_handle != DAT_HANDLE_NULL)\r
+    {\r
+       dapl_os_atomic_inc (& ((DAPL_EVD *)request_evd_handle)->evd_ref_count);\r
+    }\r
+\r
+    /* Link it onto the IA */\r
+    dapl_ia_link_ep (ia_ptr, ep_ptr);\r
+\r
+    *ep_handle = ep_ptr;\r
+\r
+#endif /* notdef */\r
+\r
+bail:\r
+    return dat_status;\r
+}\r
+\r
+\r
+/*\r
+ * Local variables:\r
+ *  c-indent-level: 4\r
+ *  c-basic-offset: 4\r
+ *  tab-width: 8\r
+ * End:\r
+ */\r
diff --git a/ulp/dapl2/dapl/common/dapl_ep_disconnect.c b/ulp/dapl2/dapl/common/dapl_ep_disconnect.c
new file mode 100644 (file)
index 0000000..8e4c1c2
--- /dev/null
@@ -0,0 +1,190 @@
+/*\r
+ * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
+ *    copy of which is available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+/**********************************************************************\r
+ *\r
+ * MODULE: dapl_ep_disconnect.c\r
+ *\r
+ * PURPOSE: Endpoint management\r
+ * Description: Interfaces in this file are completely described in\r
+ *             the DAPL 1.1 API, Chapter 6, section 5\r
+ *\r
+ * $Id:$\r
+ **********************************************************************/\r
+\r
+#include "dapl.h"\r
+#include "dapl_ia_util.h"\r
+#include "dapl_ep_util.h"\r
+#include "dapl_sp_util.h"\r
+#include "dapl_evd_util.h"\r
+#include "dapl_adapter_util.h"\r
+\r
+/*\r
+ * dapl_ep_disconnect\r
+ *\r
+ * DAPL Requirements Version xxx, 6.5.9\r
+ *\r
+ * Terminate a connection.\r
+ *\r
+ * Input:\r
+ *     ep_handle\r
+ *     disconnect_flags\r
+ *\r
+ * Output:\r
+ *     None\r
+ *\r
+ * Returns:\r
+ *     DAT_SUCCESS\r
+ *     DAT_INSUFFICIENT_RESOURCES\r
+ *     DAT_INVALID_PARAMETER\r
+ */\r
+DAT_RETURN DAT_API\r
+dapl_ep_disconnect (\r
+       IN      DAT_EP_HANDLE           ep_handle,\r
+       IN      DAT_CLOSE_FLAGS         disconnect_flags)\r
+{\r
+    DAPL_EP            *ep_ptr;\r
+    DAPL_EVD           *evd_ptr;\r
+    DAT_RETURN         dat_status;\r
+\r
+    dapl_dbg_log (DAPL_DBG_TYPE_API | DAPL_DBG_TYPE_CM,\r
+                "dapl_ep_disconnect (%p, %x)\n",\r
+                 ep_handle,\r
+                 disconnect_flags);\r
+    DAPL_CNTR(DCNT_EP_DISCONNECT);\r
+\r
+    ep_ptr = (DAPL_EP *) ep_handle;\r
+\r
+    /*\r
+     * Verify parameter & state\r
+     */\r
+    if ( DAPL_BAD_HANDLE (ep_ptr, DAPL_MAGIC_EP ) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);\r
+       goto bail;\r
+    }\r
+\r
+    /*\r
+     * Do the verification of parameters and the state change\r
+     * atomically.\r
+     */\r
+    dapl_os_lock ( &ep_ptr->header.lock );\r
+\r
+    /* Disconnecting a disconnected EP is a no-op. */\r
+    if ( ep_ptr->param.ep_state == DAT_EP_STATE_DISCONNECTED )\r
+    {\r
+       dapl_os_unlock ( &ep_ptr->header.lock );\r
+       dat_status = DAT_SUCCESS;\r
+       goto bail;\r
+    }\r
+\r
+    /* Check the EP state to ensure we are queiscent. Note that\r
+     * we may get called in UNCONNECTED state in order to remove\r
+     * RECV requests from the queue prior to destroying an EP.\r
+     * See the states in the spec at 6.5.1 Endpont Lifecycle\r
+     */\r
+    if ( ep_ptr->param.ep_state != DAT_EP_STATE_CONNECTED &&\r
+        ep_ptr->param.ep_state != DAT_EP_STATE_ACTIVE_CONNECTION_PENDING &&\r
+        ep_ptr->param.ep_state != DAT_EP_STATE_COMPLETION_PENDING &&\r
+        ep_ptr->param.ep_state != DAT_EP_STATE_DISCONNECT_PENDING )\r
+    {\r
+       dapl_os_unlock ( &ep_ptr->header.lock );\r
+       dat_status = DAT_ERROR (DAT_INVALID_STATE, dapls_ep_state_subtype (ep_ptr));\r
+       goto bail;\r
+    }\r
+\r
+    if ( ep_ptr->param.ep_state == DAT_EP_STATE_DISCONNECT_PENDING &&\r
+        disconnect_flags != DAT_CLOSE_ABRUPT_FLAG)\r
+    {\r
+       /*\r
+        * If in state DISCONNECT_PENDING then this must be an\r
+        * ABRUPT disconnect\r
+        */\r
+       dapl_os_unlock ( &ep_ptr->header.lock );\r
+       dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);\r
+       goto bail;\r
+    }\r
+\r
+    if ( ep_ptr->param.ep_state == DAT_EP_STATE_ACTIVE_CONNECTION_PENDING ||\r
+        ep_ptr->param.ep_state == DAT_EP_STATE_COMPLETION_PENDING )\r
+    {\r
+       /*\r
+        * Beginning or waiting on a connection: abort and reset the\r
+        * state\r
+        */\r
+       ep_ptr->param.ep_state  = DAT_EP_STATE_DISCONNECTED;\r
+\r
+       dapl_os_unlock ( &ep_ptr->header.lock );\r
+       /* disconnect and make sure we get no callbacks */\r
+       (void) dapls_ib_disconnect (ep_ptr, DAT_CLOSE_ABRUPT_FLAG);\r
+\r
+       /* clean up connection state */\r
+       dapl_sp_remove_ep (ep_ptr);\r
+\r
+       evd_ptr = (DAPL_EVD *) ep_ptr->param.connect_evd_handle;\r
+       dapls_evd_post_connection_event (evd_ptr,\r
+                                       DAT_CONNECTION_EVENT_DISCONNECTED,\r
+                                       (DAT_HANDLE) ep_ptr,\r
+                                       0,\r
+                                       0);\r
+       dat_status = DAT_SUCCESS;\r
+       goto bail;\r
+    }\r
+\r
+    /*\r
+     * Transition the EP state to DISCONNECT_PENDING if we are\r
+     * CONNECTED. Otherwise we do not get a disconnect event and will be\r
+     * stuck in DISCONNECT_PENDING.\r
+     *\r
+     * If the user specifies a graceful disconnect, the underlying\r
+     * provider should complete all DTOs before disconnecting; in IB\r
+     * terms, this means setting the QP state to SQD before completing\r
+     * the disconnect state transitions.\r
+     */\r
+    if ( ep_ptr->param.ep_state == DAT_EP_STATE_CONNECTED )\r
+    {\r
+       ep_ptr->param.ep_state = DAT_EP_STATE_DISCONNECT_PENDING;\r
+    }\r
+    dapl_os_unlock ( &ep_ptr->header.lock );\r
+    dat_status =  dapls_ib_disconnect ( ep_ptr, disconnect_flags );\r
+\r
+bail:\r
+    dapl_dbg_log (DAPL_DBG_TYPE_RTN | DAPL_DBG_TYPE_CM,\r
+                 "dapl_ep_disconnect (%lx) returns 0x%x\n",\r
+                 ep_ptr, dat_status);\r
+\r
+    return dat_status;\r
+}\r
+\r
+\r
+/*\r
+ * Local variables:\r
+ *  c-indent-level: 4\r
+ *  c-basic-offset: 4\r
+ *  tab-width: 8\r
+ * End:\r
+ */\r
diff --git a/ulp/dapl2/dapl/common/dapl_ep_dup_connect.c b/ulp/dapl2/dapl/common/dapl_ep_dup_connect.c
new file mode 100644 (file)
index 0000000..5c81810
--- /dev/null
@@ -0,0 +1,130 @@
+/*\r
+ * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
+ *    copy of which is available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+/**********************************************************************\r
+ * \r
+ * MODULE: dapl_ep_dup_connect.c \r
+ *\r
+ * PURPOSE: Endpoint management\r
+ * Description: Interfaces in this file are completely described in\r
+ *             the DAPL 1.1 API, Chapter 6, section 5\r
+ *\r
+ * $Id:$\r
+ **********************************************************************/\r
+\r
+#include "dapl.h"\r
+#include "dapl_ep_util.h"\r
+#include "dapl_adapter_util.h"\r
+#include "dapl_timer_util.h"\r
+\r
+/*\r
+ * dapl_ep_dup_connect\r
+ *\r
+ * DAPL Requirements Version xxx, 6.5.8\r
+ *\r
+ * Requst that a connection be established between the local Endpoint\r
+ * and a remote Endpoint. The remote Endpoint is identified by the\r
+ * dup_ep.\r
+ *\r
+ * Input:\r
+ *     ep_handle\r
+ *     ep_dup_handle\r
+ *     conn_qual\r
+ *     timeout\r
+ *     private_data_size\r
+ *     private_data\r
+ *     qos\r
+ *\r
+ * Output:\r
+ *     none\r
+ *\r
+ * Returns:\r
+ *     DAT_SUCCESS\r
+ *     DAT_INSUFFICIENT_RESOURCES\r
+ *     DAT_INVALID_PARAMETER\r
+ *     DAT_INVALID_STATE\r
+ *     DAT_MODEL_NOT_SUPPORTED\r
+ */\r
+DAT_RETURN DAT_API\r
+dapl_ep_dup_connect (\r
+       IN      DAT_EP_HANDLE           ep_handle,\r
+       IN      DAT_EP_HANDLE           ep_dup_handle,\r
+       IN      DAT_TIMEOUT             timeout,\r
+       IN      DAT_COUNT               private_data_size,\r
+       IN      const DAT_PVOID         private_data,\r
+       IN      DAT_QOS                 qos)\r
+{\r
+    DAPL_EP            *ep_dup_ptr;\r
+    DAT_RETURN         dat_status;\r
+    DAT_IA_ADDRESS_PTR remote_ia_address_ptr;\r
+    DAT_CONN_QUAL      remote_conn_qual;\r
+\r
+    ep_dup_ptr = (DAPL_EP *) ep_dup_handle;\r
+\r
+    /*\r
+     * Verify the dup handle, which must be connected. All other\r
+     * parameters will be verified by dapl_ep_connect\r
+     */\r
+    if (  DAPL_BAD_HANDLE (ep_dup_handle, DAPL_MAGIC_EP ) )\r
+    {\r
+           dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_EP);\r
+           goto bail;\r
+    }\r
+\r
+    /* Can't do a connection in 0 time, reject outright */\r
+    if ( timeout == 0 )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);\r
+       goto bail;\r
+    }\r
+\r
+    /* Check both the EP state and the QP state: if we don't have a QP\r
+     *  there is a problem.  Do this under a lock and pull out\r
+     * the connection parameters for atomicity.\r
+     */\r
+    dapl_os_lock ( &ep_dup_ptr->header.lock );\r
+    if ( ep_dup_ptr->param.ep_state != DAT_EP_STATE_CONNECTED )\r
+    {\r
+       dapl_os_unlock ( &ep_dup_ptr->header.lock );\r
+       dat_status = DAT_ERROR (DAT_INVALID_STATE,dapls_ep_state_subtype (ep_dup_ptr));\r
+       goto bail;\r
+    }\r
+    remote_ia_address_ptr = ep_dup_ptr->param.remote_ia_address_ptr;\r
+    remote_conn_qual = ep_dup_ptr->param.remote_port_qual;\r
+    dapl_os_unlock ( &ep_dup_ptr->header.lock );\r
+\r
+    dat_status = dapl_ep_connect ( ep_handle,\r
+                                  remote_ia_address_ptr, \r
+                                  remote_conn_qual, \r
+                                  timeout,\r
+                                  private_data_size,\r
+                                  private_data,\r
+                                  qos,\r
+                                  DAT_CONNECT_DEFAULT_FLAG );\r
+ bail:\r
+    return dat_status;\r
+}\r
diff --git a/ulp/dapl2/dapl/common/dapl_ep_free.c b/ulp/dapl2/dapl/common/dapl_ep_free.c
new file mode 100644 (file)
index 0000000..1b09d92
--- /dev/null
@@ -0,0 +1,205 @@
+/*\r
+ * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
+ *    copy of which is available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+/**********************************************************************\r
+ *\r
+ * MODULE: dapl_ep_free.c\r
+ *\r
+ * PURPOSE: Endpoint management\r
+ * Description: Interfaces in this file are completely described in\r
+ *             the DAPL 1.1 API, Chapter 6, section 5.4\r
+ *\r
+ * $Id:$\r
+ **********************************************************************/\r
+\r
+#include "dapl.h"\r
+#include "dapl_ia_util.h"\r
+#include "dapl_ep_util.h"\r
+#include "dapl_adapter_util.h"\r
+#include "dapl_ring_buffer_util.h"\r
+#include "dapl_timer_util.h"\r
+\r
+/*\r
+ * dapl_ep_free\r
+ *\r
+ * DAPL Requirements Version xxx, 6.5.3\r
+ *\r
+ * Destroy an instance of the Endpoint\r
+ *\r
+ * Input:\r
+ *     ep_handle\r
+ *\r
+ * Output:\r
+ *     none\r
+ *\r
+ * Returns:\r
+ *     DAT_SUCCESS\r
+ *     DAT_INVALID_PARAMETER\r
+ *     DAT_INVALID_STATE\r
+ */\r
+DAT_RETURN DAT_API\r
+dapl_ep_free (\r
+       IN      DAT_EP_HANDLE      ep_handle)\r
+{\r
+    DAPL_EP            *ep_ptr;\r
+    DAPL_IA            *ia_ptr;\r
+    DAT_EP_PARAM       *param;\r
+    ib_qp_state_t      save_qp_state;\r
+    DAT_RETURN         dat_status = DAT_SUCCESS;\r
+\r
+    dapl_dbg_log (DAPL_DBG_TYPE_API | DAPL_DBG_TYPE_CM,\r
+                  "dapl_ep_free (%p)\n", ep_handle);\r
+    DAPL_CNTR(DCNT_EP_FREE);\r
+\r
+    ep_ptr = (DAPL_EP *) ep_handle;\r
+    param = &ep_ptr->param;\r
+\r
+    /*\r
+     * Verify parameter & state\r
+     */\r
+    if ( DAPL_BAD_HANDLE (ep_ptr, DAPL_MAGIC_EP ) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);\r
+       goto bail;\r
+    }\r
+\r
+    if ( ep_ptr->param.ep_state == DAT_EP_STATE_RESERVED ||\r
+        ep_ptr->param.ep_state == DAT_EP_STATE_PASSIVE_CONNECTION_PENDING ||\r
+        ep_ptr->param.ep_state == DAT_EP_STATE_TENTATIVE_CONNECTION_PENDING )\r
+    {\r
+       dapl_dbg_log (DAPL_DBG_TYPE_WARN,\r
+                     "--> dapl_ep_free: invalid state: %x, ep %p\n",\r
+                     ep_ptr->param.ep_state,\r
+                     ep_ptr);\r
+       dat_status = DAT_ERROR (DAT_INVALID_STATE,\r
+                               dapls_ep_state_subtype (ep_ptr));\r
+       goto bail;\r
+    }\r
+\r
+    ia_ptr = ep_ptr->header.owner_ia;\r
+\r
+    /* If we are connected, issue a disconnect. If we are in the\r
+     * disconnect_pending state, disconnect with the ABRUPT flag\r
+     * set.\r
+     */\r
+\r
+    /*\r
+     * Invoke ep_disconnect to clean up outstanding connections\r
+     */\r
+    (void) dapl_ep_disconnect (ep_ptr, DAT_CLOSE_ABRUPT_FLAG);\r
+    dapl_os_assert (ep_ptr->param.ep_state == DAT_EP_STATE_DISCONNECTED ||\r
+                   ep_ptr->param.ep_state == DAT_EP_STATE_UNCONNECTED);\r
+\r
+    /*\r
+     * Do verification of parameters and the state change atomically.\r
+     */\r
+    dapl_os_lock ( &ep_ptr->header.lock );\r
+\r
+    if (ep_ptr->cxn_timer != NULL)\r
+    {\r
+       dapls_timer_cancel ( ep_ptr->cxn_timer );\r
+       dapl_os_free ( ep_ptr->cxn_timer, sizeof ( DAPL_OS_TIMER ) );\r
+       ep_ptr->cxn_timer = NULL;\r
+    }\r
+\r
+    /* Remove the EP from the IA */\r
+    dapl_ia_unlink_ep ( ia_ptr, ep_ptr );\r
+\r
+    /*\r
+     * Update ref counts. Note the user may have used ep_modify\r
+     * to set handles to NULL. Set handles to NULL so this routine\r
+     * is idempotent.\r
+     */\r
+    if ( param->pz_handle != NULL )\r
+    {\r
+       dapl_os_atomic_dec (& ((DAPL_PZ *)param->pz_handle)->pz_ref_count);\r
+       param->pz_handle = NULL;\r
+    }\r
+    if ( param->recv_evd_handle != NULL )\r
+    {\r
+       dapl_os_atomic_dec (& ((DAPL_EVD *)param->recv_evd_handle)->evd_ref_count);\r
+       param->recv_evd_handle = NULL;\r
+    }\r
+    if ( param->request_evd_handle != NULL )\r
+    {\r
+       dapl_os_atomic_dec (& ((DAPL_EVD *)param->request_evd_handle)->evd_ref_count);\r
+       param->request_evd_handle = NULL;\r
+    }\r
+    if ( param->connect_evd_handle != NULL )\r
+    {\r
+       dapl_os_atomic_dec (& ((DAPL_EVD *)param->connect_evd_handle)->evd_ref_count);\r
+       param->connect_evd_handle = NULL;\r
+    }\r
+\r
+    /*\r
+     * Finish tearing everything down.\r
+     */\r
+    dapl_dbg_log (DAPL_DBG_TYPE_EP | DAPL_DBG_TYPE_CM,\r
+                 "dapl_ep_free: Free EP: %x, ep %p qp_state %x qp_handle %x\n",\r
+                 ep_ptr->param.ep_state,\r
+                 ep_ptr,\r
+                 ep_ptr->qp_state,\r
+                 ep_ptr->qp_handle);\r
+    /*\r
+     * Take care of the transport resource. Make a copy of the qp_state\r
+     * to prevent race conditions when we exit the lock.\r
+     */\r
+    save_qp_state     = ep_ptr->qp_state;\r
+    ep_ptr->qp_state  = DAPL_QP_STATE_UNATTACHED;\r
+    dapl_os_unlock (&ep_ptr->header.lock);\r
+\r
+    /* Free the QP. If the EP has never been used, the QP is invalid */\r
+    if ( save_qp_state != DAPL_QP_STATE_UNATTACHED )\r
+    {\r
+       dat_status = dapls_ib_qp_free (ia_ptr, ep_ptr);\r
+       /* This should always succeed, but report to the user if\r
+        * there is a problem. The qp_state must be restored so\r
+        * they can try it again in the face of EINTR or similar\r
+        * where the QP is OK but the call couldn't complete.\r
+        */\r
+       if (dat_status != DAT_SUCCESS)\r
+       {\r
+           ep_ptr->qp_state = save_qp_state;\r
+           goto bail;\r
+       }\r
+    }\r
+\r
+    /* Free the resource */\r
+    dapl_ep_dealloc (ep_ptr);\r
+\r
+bail:\r
+    return dat_status;\r
+\r
+}\r
+\r
+/*\r
+ * Local variables:\r
+ *  c-indent-level: 4\r
+ *  c-basic-offset: 4\r
+ *  tab-width: 8\r
+ * End:\r
+ */\r
diff --git a/ulp/dapl2/dapl/common/dapl_ep_get_status.c b/ulp/dapl2/dapl/common/dapl_ep_get_status.c
new file mode 100644 (file)
index 0000000..b3da206
--- /dev/null
@@ -0,0 +1,120 @@
+/*\r
+ * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
+ *    copy of which is available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+/**********************************************************************\r
+ * \r
+ * MODULE: dapl_ep_get_status.c\r
+ *\r
+ * PURPOSE: Endpoint management\r
+ * Description: Interfaces in this file are completely described in\r
+ *             the DAPL 1.1 API, Chapter 6, section 5\r
+ *\r
+ * $Id:$\r
+ **********************************************************************/\r
+\r
+#include "dapl.h"\r
+#include "dapl_ring_buffer_util.h"\r
+\r
+/*\r
+ * dapl_ep_get_status\r
+ *\r
+ * DAPL Requirements Version xxx, 6.5.4\r
+ *\r
+ * Provide the consumer with a quick snapshot of the Endpoint.\r
+ * The snapshot consists of Endpoint state and DTO information.\r
+ *\r
+ * Input:\r
+ *     ep_handle\r
+ *\r
+ * Output:\r
+ *     ep_state\r
+ *     in_dto_idle\r
+ *     out_dto_idle\r
+ *\r
+ * Returns:\r
+ *     DAT_SUCCESS\r
+ *     DAT_INVALID_PARAMETER\r
+ */\r
+DAT_RETURN DAT_API\r
+dapl_ep_get_status (\r
+       IN      DAT_EP_HANDLE      ep_handle,\r
+       OUT     DAT_EP_STATE       *ep_state,\r
+       OUT     DAT_BOOLEAN        *in_dto_idle,\r
+       OUT     DAT_BOOLEAN        *out_dto_idle)\r
+{\r
+    DAPL_EP            *ep_ptr;\r
+    DAT_RETURN         dat_status;\r
+\r
+    dapl_dbg_log (DAPL_DBG_TYPE_API,\r
+                 "dapl_ep_get_status (%p, %p, %p, %p)\n",\r
+                 ep_handle, \r
+                 ep_state, \r
+                 in_dto_idle, \r
+                 out_dto_idle);\r
+\r
+    ep_ptr = (DAPL_EP *) ep_handle;\r
+    dat_status = DAT_SUCCESS;\r
+\r
+    /*\r
+     * Verify parameter & state\r
+     */\r
+    if ( DAPL_BAD_HANDLE (ep_ptr, DAPL_MAGIC_EP ) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_EP);\r
+       goto bail;\r
+    }\r
+\r
+    /*\r
+     * Gather state info for user\r
+     */\r
+    if ( ep_state != NULL )\r
+    {\r
+       *ep_state = ep_ptr->param.ep_state;\r
+    }\r
+\r
+    if ( in_dto_idle != NULL )\r
+    {\r
+       *in_dto_idle = (dapl_os_atomic_read (&ep_ptr->recv_count)) ? DAT_FALSE : DAT_TRUE;\r
+    }\r
+\r
+    if ( out_dto_idle != NULL )\r
+    {\r
+       *out_dto_idle = (dapl_os_atomic_read (&ep_ptr->req_count)) ? DAT_FALSE : DAT_TRUE;\r
+    }\r
+\r
+ bail:\r
+    return dat_status;\r
+}\r
+\r
+\r
+/*\r
+ * Local variables:\r
+ *  c-indent-level: 4\r
+ *  c-basic-offset: 4\r
+ *  tab-width: 8\r
+ * End:\r
+ */\r
diff --git a/ulp/dapl2/dapl/common/dapl_ep_modify.c b/ulp/dapl2/dapl/common/dapl_ep_modify.c
new file mode 100644 (file)
index 0000000..59742e0
--- /dev/null
@@ -0,0 +1,792 @@
+/*\r
+ * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
+ *\r
+ * This Software is licensed under one of the following licenses:\r
+ *\r
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/cpl.php.\r
+ *\r
+ * 2) under the terms of the "The BSD License" a copy of which is\r
+ *    available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/bsd-license.php.\r
+ *\r
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
+ *    copy of which is available from the Open Source Initiative, see\r
+ *    http://www.opensource.org/licenses/gpl-license.php.\r
+ *\r
+ * Licensee has the right to choose one of the above licenses.\r
+ *\r
+ * Redistributions of source code must retain the above copyright\r
+ * notice and one of the license notices.\r
+ *\r
+ * Redistributions in binary form must reproduce both the above copyright\r
+ * notice, one of the license notices in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ */\r
+\r
+/**********************************************************************\r
+ *\r
+ * MODULE: dapl_ep_modify.c\r
+ *\r
+ * PURPOSE: Endpoint management\r
+ * Description: Interfaces in this file are completely described in\r
+ *             the DAPL 1.0 API, Chapter 6, section 5\r
+ *\r
+ * $Id:$\r
+ **********************************************************************/\r
+\r
+#include "dapl.h"\r
+#include "dapl_cookie.h"\r
+#include "dapl_ep_util.h"\r
+#include "dapl_adapter_util.h"\r
+\r
+/*\r
+ * Internal prototypes\r
+ */\r
+\r
+static _INLINE_ DAT_RETURN\r
+dapli_ep_modify_validate_parameters (\r
+    IN         DAT_EP_HANDLE                   ep_handle,\r
+    IN         DAT_EP_PARAM_MASK               ep_param_mask,\r
+    IN         const DAT_EP_PARAM              *ep_param,\r
+    OUT DAPL_IA                                **ia_ptr,\r
+    OUT DAPL_EP                                **ep_ptr,\r
+    OUT DAT_EP_ATTR                    *ep_attr_ptr );\r
+\r
+\r
+/*\r
+ * dapl_ep_modify\r
+ *\r
+ * DAPL Requirements Version xxx, 6.5.6\r
+ *\r
+ * Provide the consumer parameters, including attributes and status of\r
+ * the Endpoint.\r
+ *\r
+ * Input:\r
+ *     ep_handle\r
+ *     ep_args_mask\r
+ *\r
+ * Output:\r
+ *     ep_args\r
+ *\r
+ * Returns:\r
+ *     DAT_SUCCESS\r
+ *     DAT_INVALID_PARAMETER\r
+ *     DAT_INVALID_ATTRIBUTE\r
+ *     DAT_INVALID_STATE\r
+ */\r
+DAT_RETURN DAT_API\r
+dapl_ep_modify (\r
+       IN      DAT_EP_HANDLE           ep_handle,\r
+       IN      DAT_EP_PARAM_MASK       ep_param_mask,\r
+       IN      const DAT_EP_PARAM      *ep_param )\r
+{\r
+    DAPL_IA                            *ia;\r
+    DAPL_EP                            *ep1, *ep2;\r
+    DAT_EP_ATTR                                ep_attr1, ep_attr2;\r
+    DAPL_EP                            new_ep, copy_of_old_ep;\r
+    DAPL_EP                            alloc_ep; /* Holder for resources.  */\r
+    DAPL_PZ                            *tmp_pz;\r
+    DAPL_EVD                           *tmp_evd;\r
+    DAT_RETURN                         dat_status;\r
+\r
+    /* Flag indicating we've allocated a new one of these.  */\r
+    DAT_BOOLEAN                                qp_allocated = DAT_FALSE;\r
+    DAT_BOOLEAN                                rqst_cb_allocated = DAT_FALSE;\r
+    DAT_BOOLEAN                                recv_cb_allocated = DAT_FALSE;\r
+    DAT_BOOLEAN                                rqst_iov_allocated = DAT_FALSE;\r
+    DAT_BOOLEAN                                recv_iov_allocated = DAT_FALSE;\r
+\r
+    /* Flag indicating we've used (assigned to QP) a new one of these.  */\r
+    DAT_BOOLEAN                                qp_used = DAT_FALSE;\r
+    DAT_BOOLEAN                                rqst_cb_used = DAT_FALSE;\r
+    DAT_BOOLEAN                                recv_cb_used = DAT_FALSE;\r
+    DAT_BOOLEAN                                rqst_iov_used = DAT_FALSE;\r
+    DAT_BOOLEAN                                recv_iov_used = DAT_FALSE;\r
+\r
+    dat_status = dapli_ep_modify_validate_parameters ( ep_handle,\r
+                                                     ep_param_mask,\r
+                                                     ep_param,\r
+                                                     &ia,\r
+                                                     &ep1,\r
+                                                     &ep_attr1);\r
+    if ( DAT_SUCCESS != dat_status)\r
+    {\r
+       goto bail;\r
+    }\r
+\r
+    /*\r
+     * Setup the alloc_ep with the appropriate parameters (primarily\r
+     * for allocating the QP.\r
+     */\r
+    alloc_ep = *ep1;\r
+    alloc_ep.param.ep_attr = ep_attr1;\r
+    if ( ep_param_mask & DAT_EP_FIELD_PZ_HANDLE )\r
+    {\r
+       alloc_ep.param.pz_handle = ep_param->pz_handle;\r
+    }\r
+\r
+    if ( ep_param_mask & DAT_EP_FIELD_RECV_EVD_HANDLE )\r
+    {\r
+       alloc_ep.param.recv_evd_handle = ep_param->recv_evd_handle;\r
+    }\r
+\r
+    if ( ep_param_mask & DAT_EP_FIELD_REQUEST_EVD_HANDLE )\r
+    {\r
+       alloc_ep.param.request_evd_handle = ep_param->request_evd_handle;\r
+    }\r
+\r
+    if ( ep_param_mask & DAT_EP_FIELD_CONNECT_EVD_HANDLE )\r
+    {\r
+       alloc_ep.param.connect_evd_handle = ep_param->connect_evd_handle;\r
+    }\r
+\r
+    /*\r
+     * Allocate everything that might be needed.\r
+     * We allocate separately, and into a different "holding"\r
+     * ep, since we a) want the copy of the old ep into the new ep to\r
+     * be atomic with the assignment back (under lock), b) want the\r
+     * assignment of the allocated materials to be after the copy of the\r
+     * old ep into the new ep, and c) don't want the allocation done\r
+     * under lock.\r
+     */\r
+    dat_status = dapls_cb_create (\r
+       &alloc_ep.req_buffer,\r
+       ep1,                    /* For pointer in buffer bool.  */\r
+       ep_attr1.max_request_dtos );\r
+    if ( DAT_SUCCESS != dat_status )\r
+    {\r
+       goto bail;\r
+    }\r
+    rqst_cb_allocated = DAT_TRUE;\r
+\r
+    dat_status = dapls_cb_create (\r
+       &alloc_ep.recv_buffer,\r
+       ep1,                    /* For pointer in buffer bool.  */\r
+       ep_attr1.max_recv_dtos );\r
+    if ( DAT_SUCCESS != dat_status )\r
+    {\r
+       goto bail;\r
+    }\r
+    recv_cb_allocated = DAT_TRUE;\r
+\r
+    alloc_ep.send_iov_num = ep_attr1.max_request_iov;\r
+\r
+    /*\r
+     * Ensure that send_iov_num is big enough for all types\r
+     * of send requests.\r
+     */\r
+    if (ep_attr1.max_rdma_read_iov > alloc_ep.send_iov_num)\r
+    {\r
+        alloc_ep.send_iov_num = ep_attr1.max_rdma_read_iov;\r
+    }\r
+    if (ep_attr1.max_rdma_write_iov > alloc_ep.send_iov_num)\r
+    {\r
+        alloc_ep.send_iov_num = ep_attr1.max_rdma_write_iov;\r
+    }\r
+    alloc_ep.send_iov = dapl_os_alloc (alloc_ep.send_iov_num\r
+                                       * sizeof (ib_data_segment_t));\r
+    if ( alloc_ep.send_iov == NULL )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);\r
+       goto bail;\r
+    }\r
+    rqst_iov_allocated = DAT_TRUE;\r
+\r
+    alloc_ep.recv_iov_num = ep_attr1.max_recv_iov;\r
+    alloc_ep.recv_iov = dapl_os_alloc (ep_attr1.max_recv_iov\r
+                                       * sizeof (ib_data_segment_t));\r
+    if ( alloc_ep.recv_iov == NULL )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);\r
+       goto bail;\r
+    }\r
+    recv_iov_allocated = DAT_TRUE;\r
+\r
+    dat_status = dapls_ib_qp_alloc ( ia, &alloc_ep, ep1 );\r
+    if ( dat_status != DAT_SUCCESS )\r
+    {\r
+       goto bail;\r
+    }\r
+    qp_allocated = DAT_TRUE;\r
+\r
+    /*\r
+     * Now we atomically modify the EP, under lock\r
+     * There's a lot of work done here, but there should be no\r
+     * allocation or blocking.\r
+     */\r
+    dapl_os_lock ( &ep1->header.lock );\r
+\r
+    /*\r
+     * Revalidate parameters; make sure that races haven't\r
+     * changed anything important.\r
+     */\r
+    dat_status = dapli_ep_modify_validate_parameters ( ep_handle,\r
+                                                      ep_param_mask,\r
+                                                      ep_param,\r
+                                                      &ia,\r
+                                                      &ep2,\r
+                                                      &ep_attr2 );\r
+    if ( DAT_SUCCESS != dat_status )\r
+    {\r
+       dapl_os_unlock ( &ep2->header.lock );\r
+       goto bail;\r
+    }\r
+\r
+    /*\r
+     * All of the following should be impossible, if validation\r
+     * occurred.  But they're important to the logic of this routine,\r
+     * so we check.\r
+     */\r
+    dapl_os_assert ( ep1 == ep2 );\r
+    dapl_os_assert ( ep_attr2.max_recv_dtos == ep_attr1.max_recv_dtos );\r
+    dapl_os_assert ( ep_attr2.max_request_dtos == ep_attr1.max_request_dtos );\r
+    dapl_os_assert ( ep_attr2.max_recv_iov == ep_attr1.max_recv_iov );\r
+    dapl_os_assert ( ep_attr2.max_request_iov == ep_attr1.max_request_iov );\r
+\r
+    copy_of_old_ep = *ep2;\r
+\r
+    /*\r
+     * Setup new ep.\r
+     */\r
+    new_ep = *ep2;\r
+    new_ep.param.ep_attr = ep_attr2;\r
+\r
+    /*\r
+     * We can initialize the PZ and EVD handles from the alloc_ep because\r
+     * the only thing that could have changed since we setup the alloc_ep\r
+     * is stuff changed by dapl_cr_accept, and neither PZ nor EVD is in that\r
+     * list.\r
+     */\r
+    new_ep.param.pz_handle = alloc_ep.param.pz_handle;\r
+    new_ep.param.recv_evd_handle = alloc_ep.param.recv_evd_handle;\r
+    new_ep.param.request_evd_handle = alloc_ep.param.request_evd_handle;\r
+    new_ep.param.connect_evd_handle = alloc_ep.param.connect_evd_handle;\r
+\r
+    /* Deal with each of the allocation fields.  */\r
+    if ( ep_param_mask & DAT_EP_FIELD_EP_ATTR_MAX_RECV_DTOS\r
+        && (ep_param->ep_attr.max_recv_dtos\r
+            != ep2->param.ep_attr.max_recv_dtos) )\r
+    {\r
+       new_ep.recv_buffer = alloc_ep.recv_buffer;\r
+       recv_cb_used = DAT_TRUE;\r
+    }\r
+\r
+    if ( ep_param_mask & DAT_EP_FIELD_EP_ATTR_MAX_REQUEST_DTOS\r
+        && (ep_param->ep_attr.max_request_dtos\r
+            != ep2->param.ep_attr.max_request_dtos) )\r
+    {\r
+       new_ep.req_buffer = alloc_ep.req_buffer;\r
+       rqst_cb_used = DAT_TRUE;\r
+    }\r
+\r
+    if ( ep_param_mask & DAT_EP_FIELD_EP_ATTR_MAX_RECV_IOV\r
+        && new_ep.recv_iov_num != ep2->recv_iov_num )\r
+    {\r
+       new_ep.recv_iov = alloc_ep.recv_iov;\r
+       recv_iov_used = DAT_TRUE;\r
+    }\r
+\r
+    if ( ep_param_mask & DAT_EP_FIELD_EP_ATTR_MAX_REQUEST_IOV\r
+        && new_ep.send_iov_num != ep2->send_iov_num )\r
+    {\r
+       new_ep.send_iov = alloc_ep.send_iov;\r
+       recv_iov_used = DAT_TRUE;\r
+    }\r
+\r
+    /*\r
+     * We need to change the QP only if there already was a QP\r
+     * (leave things the way you found them!) and one of the\r
+     * following has changed: send/recv EVD, send/recv reqs/IOV max.\r
+     */\r
+    if ( DAPL_QP_STATE_UNATTACHED != new_ep.qp_state\r
+        && (ep_param_mask\r
+            & (DAT_EP_FIELD_EP_ATTR_MAX_REQUEST_IOV\r
+               | DAT_EP_FIELD_EP_ATTR_MAX_RECV_IOV\r
+               | DAT_EP_FIELD_EP_ATTR_MAX_REQUEST_DTOS\r
+               | DAT_EP_FIELD_EP_ATTR_MAX_RECV_DTOS\r
+               | DAT_EP_FIELD_RECV_EVD_HANDLE\r
+               | DAT_EP_FIELD_REQUEST_EVD_HANDLE)) )\r
+    {\r
+       /*\r
+        * We shouldn't be racing with connection establishment\r
+        * because the parameter validate routine should protect us,\r
+        * but it's an important enough point that we assert it.\r
+        */\r
+       dapl_os_assert ( (ep2->param.ep_state\r
+                         != DAT_EP_STATE_PASSIVE_CONNECTION_PENDING)\r
+                        && (ep2->param.ep_state\r
+                            != DAT_EP_STATE_ACTIVE_CONNECTION_PENDING) );\r
+\r
+       new_ep.qp_handle = alloc_ep.qp_handle;\r
+       new_ep.qpn = alloc_ep.qpn;\r
+    }\r
+\r
+    /*\r
+     * The actual assignment, including modifying QP parameters.\r
+     * Modifying QP parameters needs to come first, as if it fails\r
+     * we need to exit. \r
+     */\r
+    if ( DAPL_QP_STATE_UNATTACHED != new_ep.qp_state )\r
+    {\r
+       dat_status = dapls_ib_qp_modify ( ia, ep2, &ep_attr2 );\r
+       if ( dat_status != DAT_SUCCESS )\r
+       {\r
+           dapl_os_unlock ( & ep2->header.lock );\r
+           goto bail;\r
+       }\r
+    }\r
+    *ep2 = new_ep;\r
+\r
+    dapl_os_unlock ( &ep2->header.lock );\r
+\r
+    /*\r
+     * Modify reference counts, incrementing new ones\r
+     * and then decrementing old ones (so if they're the same\r
+     * the refcount never drops to zero).\r
+     */\r
+    tmp_pz = (DAPL_PZ *) new_ep.param.pz_handle;\r
+    if ( NULL != tmp_pz )\r
+    {\r
+       dapl_os_atomic_inc (&tmp_pz->pz_ref_count);\r
+    }\r
+\r
+    tmp_evd = (DAPL_EVD *) new_ep.param.recv_evd_handle;\r
+    if ( NULL != tmp_evd )\r
+    {\r
+       dapl_os_atomic_inc (&tmp_evd->evd_ref_count);\r
+    }\r
+\r
+    tmp_evd = (DAPL_EVD *) new_ep.param.request_evd_handle;\r
+    if ( NULL != tmp_evd )\r
+    {\r
+       dapl_os_atomic_inc (&tmp_evd->evd_ref_count);\r
+    }\r
+\r
+    tmp_evd = (DAPL_EVD *) new_ep.param.connect_evd_handle;\r
+    if ( NULL != tmp_evd )\r
+    {\r
+       dapl_os_atomic_inc (&tmp_evd->evd_ref_count);\r
+    }\r
+\r
+    /* decreament the old reference counts */\r
+    tmp_pz = (DAPL_PZ *) copy_of_old_ep.param.pz_handle;\r
+    if ( NULL != tmp_pz )\r
+    {\r
+       dapl_os_atomic_dec (&tmp_pz->pz_ref_count);\r
+    }\r
+\r
+    tmp_evd = (DAPL_EVD *) copy_of_old_ep.param.recv_evd_handle;\r
+    if ( NULL != tmp_evd )\r
+    {\r
+       dapl_os_atomic_dec (&tmp_evd->evd_ref_count);\r
+    }\r
+\r
+    tmp_evd = (DAPL_EVD *) copy_of_old_ep.param.request_evd_handle;\r
+    if ( NULL != tmp_evd )\r
+    {\r
+       dapl_os_atomic_dec (&tmp_evd->evd_ref_count);\r
+    }\r
+\r
+    tmp_evd = (DAPL_EVD *) copy_of_old_ep.param.connect_evd_handle;\r
+    if ( NULL != tmp_evd )\r
+    {\r
+       dapl_os_atomic_dec (&tmp_evd->evd_ref_count);\r
+    }\r
+\r
+bail:\r
+    if ( qp_allocated )\r
+    {\r
+       DAT_RETURN local_dat_status;\r
+       if ( dat_status != DAT_SUCCESS || !qp_used )\r
+       {\r
+           local_dat_status = dapls_ib_qp_free (ia, &alloc_ep );\r
+       }\r
+       else\r
+       {\r
+           local_dat_status = dapls_ib_qp_free (ia, &copy_of_old_ep );\r
+       }\r
+       if (local_dat_status != DAT_SUCCESS)\r
+       {\r
+           dapl_dbg_log (DAPL_DBG_TYPE_WARN,\r
+                         "ep_modify: Failed to free QP; status %x\n",\r
+                         local_dat_status);\r
+       }\r
+    }\r
+\r
+    if ( rqst_cb_allocated )\r
+    {\r
+       if ( dat_status != DAT_SUCCESS || !rqst_cb_used )\r
+       {\r
+           dapls_cb_free ( &alloc_ep.req_buffer );\r
+       }\r
+       else\r
+       {\r
+           dapls_cb_free ( &copy_of_old_ep.req_buffer );\r
+       }\r
+    }\r
+\r
+    if ( recv_cb_allocated )\r
+    {\r
+       if ( dat_status != DAT_SUCCESS || !recv_cb_used )\r
+       {\r
+           dapls_cb_free ( &alloc_ep.recv_buffer );\r
+       }\r
+       else\r
+       {\r
+           dapls_cb_free ( &copy_of_old_ep.recv_buffer );\r
+       }\r
+    }\r
+\r
+    if ( rqst_iov_allocated )\r
+    {\r
+       if ( dat_status != DAT_SUCCESS || !rqst_iov_used )\r
+       {\r
+           dapl_os_free ( alloc_ep.send_iov,\r
+                          (alloc_ep.send_iov_num\r
+                           * sizeof (ib_data_segment_t)));\r
+       }\r
+       else\r
+       {\r
+           dapl_os_free ( copy_of_old_ep.send_iov,\r
+                          (copy_of_old_ep.send_iov_num\r
+                           * sizeof (ib_data_segment_t)));\r
+       }\r
+    }\r
+\r
+    if ( recv_iov_allocated )\r
+    {\r
+       if ( dat_status != DAT_SUCCESS || !recv_iov_used )\r
+       {\r
+           dapl_os_free ( alloc_ep.recv_iov,\r
+                          (alloc_ep.recv_iov_num\r
+                           * sizeof (ib_data_segment_t)));\r
+       }\r
+       else\r
+       {\r
+           dapl_os_free ( copy_of_old_ep.recv_iov,\r
+                          (copy_of_old_ep.recv_iov_num\r
+                           * sizeof (ib_data_segment_t)));\r
+       }\r
+    }\r
+    return dat_status;\r
+}\r
+\r
+\r
+/*\r
+ * dapli_ep_modify_validate_parameters\r
+ *\r
+ * Validate parameters\r
+ *\r
+ * The space for the ep_attr_ptr parameter should be allocated by the\r
+ * consumer. Upon success, this parameter will contain the current ep\r
+ * attribute values with the requested modifications made.\r
+ *\r
+ */\r
+\r
+static DAT_RETURN\r
+dapli_ep_modify_validate_parameters (\r
+    IN         DAT_EP_HANDLE                   ep_handle,\r
+    IN         DAT_EP_PARAM_MASK               ep_param_mask,\r
+    IN         const DAT_EP_PARAM              *ep_param,\r
+    OUT DAPL_IA                                **ia_ptr,\r
+    OUT DAPL_EP                                **ep_ptr,\r
+    OUT DAT_EP_ATTR                    *ep_attr_ptr )\r
+{\r
+    DAPL_IA                            *ia;\r
+    DAPL_EP                            *ep;\r
+    DAT_EP_ATTR                                ep_attr;\r
+    DAT_EP_ATTR                                ep_attr_limit;\r
+    DAT_EP_ATTR                                ep_attr_request;\r
+    DAT_RETURN                         dat_status;\r
+\r
+    *ia_ptr = NULL;\r
+    *ep_ptr = NULL;\r
+    dat_status = DAT_SUCCESS;\r
+\r
+    if ( DAPL_BAD_HANDLE (ep_handle, DAPL_MAGIC_EP ) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);\r
+       goto bail;\r
+    }\r
+\r
+    ep = (DAPL_EP *) ep_handle;\r
+    ia = ep->header.owner_ia;\r
+\r
+    /*\r
+     * Verify parameters valid in current EP state\r
+     */\r
+    if ( ep_param_mask & (DAT_EP_FIELD_IA_HANDLE |\r
+                          DAT_EP_FIELD_EP_STATE |\r
+                          DAT_EP_FIELD_LOCAL_IA_ADDRESS_PTR |\r
+                          DAT_EP_FIELD_LOCAL_PORT_QUAL |\r
+                          DAT_EP_FIELD_REMOTE_IA_ADDRESS_PTR |\r
+                          DAT_EP_FIELD_REMOTE_PORT_QUAL) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);\r
+       goto bail;\r
+    }\r
+\r
+    /*\r
+     * Can only change the PZ handle if we are UNCONNECTED or\r
+     * TENTATIVE_CONNECTION_PENDING (psp PROVIDER allocated EP)\r
+     */\r
+    if ( (ep_param_mask & DAT_EP_FIELD_PZ_HANDLE)  &&\r
+        ( ep->param.ep_state != DAT_EP_STATE_UNCONNECTED &&\r
+          ep->param.ep_state != DAT_EP_STATE_TENTATIVE_CONNECTION_PENDING ) )\r
+    {\r
+       dat_status = DAT_ERROR (DAT_INVALID_STATE, dapls_ep_state_subtype (ep));\r
+       goto bail;\r
+    }\r
+\r
+    if ( (ep_param_mask & (DAT_EP_FIELD_RECV_EVD_HANDLE |\r
+                         DAT_EP_FIELD_REQUEST_EVD_HANDLE |\r
+                         DAT_EP_FIELD_CONNECT_EVD_HANDLE |\r
+                         DAT_EP_FIELD_EP_ATTR_SERVICE_TYPE |\r
+                         DAT_EP_FIELD_EP_ATTR_MAX_MESSAGE_SIZE |\r
+                         DAT_EP_FIELD_EP_ATTR_MAX_RDMA_SIZE |\r
+     &nb