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