5562N/A/*
5562N/A * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
5562N/A */
5562N/A
5562N/A/*
5562N/A * Driver for Oracle PSIF Infiniband PCI Express host channel adapter (HCA)
5562N/A *
5562N/A * sif_ireg.h: Functions to interface with IBTF
5562N/A */
5562N/A
5562N/A
5562N/A#ifndef _PSIF_IREG_H
5562N/A#define _PSIF_IREG_H
5562N/A
5562N/A#include <sif.h>
5562N/A
5562N/A#ifdef __cplusplus
5562N/Aextern "C" {
5562N/A#endif
5562N/A
5562N/A
5562N/A
5562N/A
5562N/A/* IB Device Registration */
5562N/Aint psif_register_ib_device(psif_t *psifp);
5562N/Aint psif_unregister_ib_device(psif_t *psifp);
5562N/A
5562N/A/* Agent handling Registration */
5562N/Aint psif_agent_handlers_init(psif_t *psifp);
5562N/Aint psif_agent_handlers_fini(psif_t *psifp);
5562N/A
5562N/A/* HCA and port related operations */
5562N/Aibt_status_t psif_ci_query_hca_ports(ibc_hca_hdl_t, uint8_t,
5562N/A ibt_hca_portinfo_t *);
5562N/Aibt_status_t psif_ci_modify_ports(ibc_hca_hdl_t, uint8_t,
5562N/A ibt_port_modify_flags_t, uint8_t);
5562N/Aibt_status_t psif_ci_modify_system_image(ibc_hca_hdl_t, ib_guid_t);
5562N/A
5562N/A
5562N/A/* Reliable Datagram Domains */
5562N/Aibt_status_t psif_ci_alloc_rdd(ibc_hca_hdl_t, ibc_rdd_flags_t,
5562N/A ibc_rdd_hdl_t *);
5562N/Aibt_status_t psif_ci_free_rdd(ibc_hca_hdl_t, ibc_rdd_hdl_t);
5562N/A
5562N/A/* EE Contexts */
5562N/Aibt_status_t psif_ci_alloc_eec(ibc_hca_hdl_t, ibc_eec_flags_t,
5562N/A ibt_eec_hdl_t, ibc_rdd_hdl_t, ibc_eec_hdl_t *);
5562N/Aibt_status_t psif_ci_free_eec(ibc_hca_hdl_t, ibc_eec_hdl_t);
5562N/Aibt_status_t psif_ci_query_eec(ibc_hca_hdl_t, ibc_eec_hdl_t,
5562N/A ibt_eec_query_attr_t *);
5562N/Aibt_status_t psif_ci_modify_eec(ibc_hca_hdl_t, ibc_eec_hdl_t,
5562N/A ibt_cep_modify_flags_t, ibt_eec_info_t *);
5562N/A
5562N/A/* Memory Windows */
5562N/Aibt_status_t psif_ci_alloc_mw(ibc_hca_hdl_t, ibc_pd_hdl_t,
5562N/A ibt_mw_flags_t, ibc_mw_hdl_t *, ibt_rkey_t *);
5562N/Aibt_status_t psif_ci_free_mw(ibc_hca_hdl_t, ibc_mw_hdl_t);
5562N/Aibt_status_t psif_ci_query_mw(ibc_hca_hdl_t, ibc_mw_hdl_t,
5562N/A ibt_mw_query_attr_t *);
5562N/A
5562N/A/* Multicast Groups */
5562N/Aibt_status_t psif_ci_attach_mcg(ibc_hca_hdl_t, ibc_qp_hdl_t,
5562N/A ib_gid_t, ib_lid_t);
5562N/Aibt_status_t psif_ci_detach_mcg(ibc_hca_hdl_t, ibc_qp_hdl_t,
5562N/A ib_gid_t, ib_lid_t);
5562N/A
5562N/A/* Work Request and Completion Processing */
5562N/Aibt_status_t psif_ci_post_send(ibc_hca_hdl_t, ibc_qp_hdl_t,
5562N/A ibt_send_wr_t *, uint_t, uint_t *);
5562N/Aibt_status_t psif_ci_post_recv(ibc_hca_hdl_t, ibc_qp_hdl_t,
5562N/A ibt_recv_wr_t *, uint_t, uint_t *);
5562N/Aibt_status_t psif_ci_poll_cq(ibc_hca_hdl_t, ibc_cq_hdl_t,
5562N/A ibt_wc_t *, uint_t, uint_t *);
5562N/Aibt_status_t psif_ci_notify_cq(ibc_hca_hdl_t, ibc_cq_hdl_t,
5562N/A ibt_cq_notify_flags_t);
5562N/A
5562N/A/* CI Object Private Data */
5562N/Aibt_status_t psif_ci_ci_data_in(ibc_hca_hdl_t, ibt_ci_data_flags_t,
5562N/A ibt_object_type_t, void *, void *, size_t);
5562N/A
5562N/A/* CI Object Private Data */
5562N/Aibt_status_t psif_ci_ci_data_out(ibc_hca_hdl_t, ibt_ci_data_flags_t,
5562N/A ibt_object_type_t, void *, void *, size_t);
5562N/A
5562N/A
5562N/A/* Address translation */
5562N/Aibt_status_t psif_ci_map_mem_area(ibc_hca_hdl_t, ibt_va_attr_t *,
5562N/A void *, uint_t, ibt_reg_req_t *, ibc_ma_hdl_t *);
5562N/Aibt_status_t psif_ci_unmap_mem_area(ibc_hca_hdl_t, ibc_ma_hdl_t);
5562N/Aibt_status_t psif_ci_map_mem_iov(ibc_hca_hdl_t, ibt_iov_attr_t *,
5562N/A ibt_all_wr_t *, ibc_mi_hdl_t *);
5562N/Aibt_status_t psif_ci_unmap_mem_iov(ibc_hca_hdl_t, ibc_mi_hdl_t);
5562N/A
5562N/A/* Allocate L_Key */
5562N/Aibt_status_t psif_ci_alloc_lkey(ibc_hca_hdl_t, ibc_pd_hdl_t,
5562N/A ibt_lkey_flags_t, uint_t, ibc_mr_hdl_t *, ibt_pmr_desc_t *);
5562N/A
5562N/A/* Physical Register Memory Region */
5562N/Aibt_status_t psif_ci_register_physical_mr(ibc_hca_hdl_t, ibc_pd_hdl_t,
5562N/A ibt_pmr_attr_t *, void *, ibc_mr_hdl_t *, ibt_pmr_desc_t *);
5562N/Aibt_status_t psif_ci_reregister_physical_mr(ibc_hca_hdl_t,
5562N/A ibc_mr_hdl_t, ibc_pd_hdl_t, ibt_pmr_attr_t *, void *, ibc_mr_hdl_t *,
5562N/A ibt_pmr_desc_t *);
5562N/A
5562N/A/* Mellanox FMR */
5562N/Aibt_status_t psif_ci_create_fmr_pool(ibc_hca_hdl_t, ibc_pd_hdl_t,
5562N/A ibt_fmr_pool_attr_t *, ibc_fmr_pool_hdl_t *);
5562N/Aibt_status_t psif_ci_destroy_fmr_pool(ibc_hca_hdl_t,
5562N/A ibc_fmr_pool_hdl_t);
5562N/Aibt_status_t psif_ci_flush_fmr_pool(ibc_hca_hdl_t, ibc_fmr_pool_hdl_t);
5562N/Aibt_status_t psif_ci_register_physical_fmr(ibc_hca_hdl_t,
5562N/A ibc_fmr_pool_hdl_t, ibt_pmr_attr_t *, void *, ibc_mr_hdl_t *,
5562N/A ibt_pmr_desc_t *);
5562N/Aibt_status_t psif_ci_deregister_fmr(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr);
5562N/A
5562N/A/* Memory Allocation/Deallocation */
5562N/A
5562N/Aibt_status_t
5562N/Apsif_ci_alloc_io_mem(ibc_hca_hdl_t, size_t, ibt_mr_flags_t, caddr_t *,
5562N/A ibt_mem_alloc_hdl_t);
5562N/A
5562N/Aibt_status_t
5562N/Apsif_ci_get_hca_port_counters(ibc_hca_hdl_t, uint8_t,
5562N/A ibt_hca_port_cntr_flags_t, ibt_hca_port_counters_t *);
5562N/A
5562N/Aibt_status_t
5562N/Apsif_ci_set_ibtl_private(ibc_hca_hdl_t, ibt_object_type_t, void *, void *);
5562N/Aibt_status_t
5562N/Apsif_ci_get_ibtl_private(ibc_hca_hdl_t, ibt_object_type_t, void *, void **);
5562N/A
5562N/Aibt_status_t
5562N/Apsif_ci_get_hca_resource_counters(ibc_hca_hdl_t,
5562N/A ibt_hca_resource_counters_t *);
5562N/A
5562N/Aibt_status_t
5562N/Apsif_ci_alloc_counter(ibc_hca_hdl_t, ibt_ci_counter_type_t,
5562N/A ibc_counter_hdl_t *);
5562N/Aibt_status_t
5562N/Apsif_ci_free_counter(ibc_hca_hdl_t, ibc_counter_hdl_t);
5562N/Aibt_status_t
5562N/Apsif_ci_query_counter(ibc_hca_hdl_t, ibc_counter_hdl_t,
5562N/A ibt_ci_counters_t *);
5562N/Aibt_status_t
5562N/Apsif_ci_reset_counter(ibc_hca_hdl_t, ibc_counter_hdl_t);
5562N/Aibt_status_t
5562N/Apsif_ci_set_qp_counter(ibc_hca_hdl_t, ibc_counter_hdl_t,
5562N/Aibc_qp_hdl_t *, uint_t);
5562N/Aibt_status_t
5562N/Apsif_ci_get_qp_counter(ibc_hca_hdl_t, ibc_qp_hdl_t *,
5562N/A ibc_counter_hdl_t *, uint_t);
5562N/Aibt_status_t psif_ci_not_supported();
5562N/A
5562N/A
5562N/A/* Dma handle struct for the kmem cache */
5562N/Atypedef struct psif_dmahdl_cache_s {
5562N/A ddi_dma_handle_t h_dmahdl;
5562N/A} psif_dmahdl_cache_t;
5562N/A_NOTE(SCHEME_PROTECTS_DATA("safe sharing", psif_dmahdl_cache_s::h_dmahdl))
5562N/A
5562N/A/* Address translation */
5562N/Astruct ibc_ma_s {
5562N/A int h_ma_addr_list_len;
5562N/A void *h_ma_addr_list;
5562N/A psif_dmahdl_cache_t *h_ma_dmahdlp; /* not FRWR */
5562N/A ddi_dma_handle_t h_ma_dmahdl; /* FRWR-only */
5562N/A ddi_dma_handle_t h_ma_list_hdl;
5562N/A ddi_acc_handle_t h_ma_list_acc_hdl;
5562N/A size_t h_ma_real_len;
5562N/A caddr_t h_ma_kaddr;
5562N/A ibt_phys_addr_t h_ma_list_cookie;
5562N/A ddi_umem_cookie_t h_ma_umem_cookie;
5562N/A ibc_mr_hdl_t h_ma_mr_hdl; /* used for umem callback */
5562N/A};
5562N/A_NOTE(SCHEME_PROTECTS_DATA("protected via umapdb scheme",
5562N/A ibc_ma_s::h_ma_mr_hdl))
5562N/A
5562N/Aextern uint32_t psif_max_cq_size;
5562N/Aextern uint32_t psif_max_srq_size;
5562N/Aextern uint32_t psif_max_sq_size;
5562N/A
5562N/A#ifdef __cplusplus
5562N/A}
5562N/A#endif
5562N/A
5562N/A#endif /* _PSIF_IREG_H */