1*17a2b317SBill Taylor /*
2*17a2b317SBill Taylor  * CDDL HEADER START
3*17a2b317SBill Taylor  *
4*17a2b317SBill Taylor  * The contents of this file are subject to the terms of the
5*17a2b317SBill Taylor  * Common Development and Distribution License (the "License").
6*17a2b317SBill Taylor  * You may not use this file except in compliance with the License.
7*17a2b317SBill Taylor  *
8*17a2b317SBill Taylor  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*17a2b317SBill Taylor  * or http://www.opensolaris.org/os/licensing.
10*17a2b317SBill Taylor  * See the License for the specific language governing permissions
11*17a2b317SBill Taylor  * and limitations under the License.
12*17a2b317SBill Taylor  *
13*17a2b317SBill Taylor  * When distributing Covered Code, include this CDDL HEADER in each
14*17a2b317SBill Taylor  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*17a2b317SBill Taylor  * If applicable, add the following below this CDDL HEADER, with the
16*17a2b317SBill Taylor  * fields enclosed by brackets "[]" replaced with your own identifying
17*17a2b317SBill Taylor  * information: Portions Copyright [yyyy] [name of copyright owner]
18*17a2b317SBill Taylor  *
19*17a2b317SBill Taylor  * CDDL HEADER END
20*17a2b317SBill Taylor  */
21*17a2b317SBill Taylor 
22*17a2b317SBill Taylor /*
23*17a2b317SBill Taylor  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
24*17a2b317SBill Taylor  */
25*17a2b317SBill Taylor 
26*17a2b317SBill Taylor #ifndef	_SYS_IB_ADAPTERS_HERMON_FCOIB_H
27*17a2b317SBill Taylor #define	_SYS_IB_ADAPTERS_HERMON_FCOIB_H
28*17a2b317SBill Taylor 
29*17a2b317SBill Taylor /*
30*17a2b317SBill Taylor  * hermon_fcoib.h
31*17a2b317SBill Taylor  */
32*17a2b317SBill Taylor 
33*17a2b317SBill Taylor #ifdef __cplusplus
34*17a2b317SBill Taylor extern "C" {
35*17a2b317SBill Taylor #endif
36*17a2b317SBill Taylor 
37*17a2b317SBill Taylor typedef struct hermon_fcoib_qp_s {
38*17a2b317SBill Taylor 	hermon_rsrc_t	hfc_qp_rsrc;
39*17a2b317SBill Taylor 	vmem_t		*hfc_qp_vmp;
40*17a2b317SBill Taylor } hermon_fcoib_qp_t;
41*17a2b317SBill Taylor 
42*17a2b317SBill Taylor typedef struct hermon_fcoib_s {
43*17a2b317SBill Taylor 	uint8_t		hfc_log2_max_port_ids_queried;
44*17a2b317SBill Taylor 	uint8_t		hfc_log2_max_fexch_queried;
45*17a2b317SBill Taylor 	uint8_t		hfc_log2_max_rfci_queried;
46*17a2b317SBill Taylor 	kmutex_t	hfc_lock;
47*17a2b317SBill Taylor 	hermon_rsrc_t	*hfc_mpt_rsrc;	/* FEXCH MPTs for all ports */
48*17a2b317SBill Taylor 	hermon_rsrc_t	*hfc_mtt_rsrc;	/* FEXCH MTTs for all MPTs */
49*17a2b317SBill Taylor 	hermon_rsrc_t	*hfc_fexch_rsrc; /* FEXCH QPs for all ports */
50*17a2b317SBill Taylor 	hermon_rsrc_t	*hfc_rfci_rsrc;	/* RFCI QPs for all ports */
51*17a2b317SBill Taylor 	uint8_t		hfc_nports;	/* #HCA ports */
52*17a2b317SBill Taylor 	uint8_t		hfc_port_enabled[HERMON_MAX_PORTS];
53*17a2b317SBill Taylor 	uint_t		hfc_mpts_per_port;
54*17a2b317SBill Taylor 	uint_t		hfc_mtts_per_mpt;
55*17a2b317SBill Taylor 	uint_t		hfc_fexch_qps_per_port;
56*17a2b317SBill Taylor 	uint_t		hfc_rfci_qps_per_port;
57*17a2b317SBill Taylor 	vmem_t		*hfc_rfci_vmemp[HERMON_MAX_PORTS];
58*17a2b317SBill Taylor 	vmem_t		*hfc_fexch_vmemp[HERMON_MAX_PORTS];
59*17a2b317SBill Taylor 	uintptr_t	hfc_vmemstart;
60*17a2b317SBill Taylor 	uint32_t	*hfc_n_port_ids[HERMON_MAX_PORTS];
61*17a2b317SBill Taylor 
62*17a2b317SBill Taylor 	/* Convenient, but redundant values */
63*17a2b317SBill Taylor 	uint32_t	hfc_mpt_base[HERMON_MAX_PORTS];
64*17a2b317SBill Taylor 	uint32_t	hfc_mtt_base[HERMON_MAX_PORTS];
65*17a2b317SBill Taylor 	uint32_t	hfc_fexch_base[HERMON_MAX_PORTS];
66*17a2b317SBill Taylor 	uint32_t	hfc_rfci_base[HERMON_MAX_PORTS];
67*17a2b317SBill Taylor } hermon_fcoib_t;
68*17a2b317SBill Taylor 
69*17a2b317SBill Taylor _NOTE(DATA_READABLE_WITHOUT_LOCK(hermon_fcoib_s::hfc_fexch_rsrc
70*17a2b317SBill Taylor     hermon_fcoib_s::hfc_nports
71*17a2b317SBill Taylor     hermon_fcoib_s::hfc_mpts_per_port
72*17a2b317SBill Taylor     hermon_fcoib_s::hfc_mtts_per_mpt
73*17a2b317SBill Taylor     hermon_fcoib_s::hfc_fexch_qps_per_port
74*17a2b317SBill Taylor     hermon_fcoib_s::hfc_rfci_qps_per_port
75*17a2b317SBill Taylor     hermon_fcoib_s::hfc_mpt_base
76*17a2b317SBill Taylor     hermon_fcoib_s::hfc_mtt_base
77*17a2b317SBill Taylor     hermon_fcoib_s::hfc_fexch_base
78*17a2b317SBill Taylor     hermon_fcoib_s::hfc_rfci_base))
79*17a2b317SBill Taylor 
80*17a2b317SBill Taylor int hermon_fcoib_set_id(hermon_state_t *state, int port, uint32_t rfci_qpn,
81*17a2b317SBill Taylor     uint32_t src_id);
82*17a2b317SBill Taylor int hermon_fcoib_get_id_idx(hermon_state_t *state, int port,
83*17a2b317SBill Taylor     ibt_fc_attr_t *fcp);
84*17a2b317SBill Taylor int hermon_fcoib_check_exch_base_off(hermon_state_t *state, int port,
85*17a2b317SBill Taylor     ibt_fc_attr_t *fcp);
86*17a2b317SBill Taylor uint_t hermon_fcoib_qpnum_from_fexch(hermon_state_t *state, int port,
87*17a2b317SBill Taylor     uint16_t fexch);
88*17a2b317SBill Taylor int hermon_fcoib_is_fexch_qpn(hermon_state_t *state, uint_t qpnum);
89*17a2b317SBill Taylor uint32_t hermon_fcoib_qpn_to_mkey(hermon_state_t *state, uint_t qpnum);
90*17a2b317SBill Taylor int hermon_fcoib_fexch_mkey_init(hermon_state_t *state, hermon_pdhdl_t pd,
91*17a2b317SBill Taylor     uint8_t port, uint32_t qp_indx, uint_t sleep);
92*17a2b317SBill Taylor int hermon_fcoib_fexch_mkey_fini(hermon_state_t *state, hermon_pdhdl_t pd,
93*17a2b317SBill Taylor     uint32_t qpnum, uint_t sleep);
94*17a2b317SBill Taylor uint32_t hermon_fcoib_fexch_relative_qpn(hermon_state_t *state, uint8_t port,
95*17a2b317SBill Taylor     uint32_t qpnum);
96*17a2b317SBill Taylor int hermon_fcoib_init(hermon_state_t *state);
97*17a2b317SBill Taylor void hermon_fcoib_fini(hermon_state_t *state);
98*17a2b317SBill Taylor 
99*17a2b317SBill Taylor 
100*17a2b317SBill Taylor #ifdef __cplusplus
101*17a2b317SBill Taylor }
102*17a2b317SBill Taylor #endif
103*17a2b317SBill Taylor 
104*17a2b317SBill Taylor #endif	/* _SYS_IB_ADAPTERS_HERMON_FCOIB_H */
105