[golan] Add Connect-IB, ConnectX-4 and ConnectX-4 Lx (Infiniband) support
[ipxe.git] / src / drivers / infiniband / mlx_nodnic / include / mlx_port.h
1 #ifndef NODNIC_PORT_H_
2 #define NODNIC_PORT_H_
3
4 /*
5 * Copyright (C) 2015 Mellanox Technologies Ltd.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301, USA.
21 */
22
23 FILE_LICENCE ( GPL2_OR_LATER );
24
25 #include "mlx_nodnic_data_structures.h"
26
27 #define NODNIC_PORT_MAC_FILTERS_OFFSET 0x10
28
29 typedef enum {
30 nodnic_port_option_link_type = 0,
31 nodnic_port_option_mac_low,
32 nodnic_port_option_mac_high,
33 nodnic_port_option_log_cq_size,
34 nodnic_port_option_reset_needed,
35 nodnic_port_option_mac_filters_en,
36 nodnic_port_option_port_state,
37 nodnic_port_option_network_en,
38 nodnic_port_option_dma_en,
39 nodnic_port_option_eq_addr_low,
40 nodnic_port_option_eq_addr_high,
41 nodnic_port_option_cq_addr_low,
42 nodnic_port_option_cq_addr_high,
43 nodnic_port_option_port_management_change_event,
44 nodnic_port_option_port_promisc_en,
45 nodnic_port_option_arm_cq,
46 nodnic_port_option_port_promisc_multicast_en,
47 #ifdef DEVICE_CX3
48 nodnic_port_option_crspace_en,
49 #endif
50 }nodnic_port_option;
51
52 struct nodnic_port_data_entry{
53 nodnic_port_option option;
54 mlx_uint32 offset;
55 mlx_uint8 align;
56 mlx_uint32 mask;
57 };
58
59 struct nodnic_qp_data_entry{
60 nodnic_queue_pair_type type;
61 mlx_uint32 send_offset;
62 mlx_uint32 recv_offset;
63 };
64
65
66 typedef enum {
67 nodnic_port_state_down = 0,
68 nodnic_port_state_initialize,
69 nodnic_port_state_armed,
70 nodnic_port_state_active,
71 }nodnic_port_state;
72
73 mlx_status
74 nodnic_port_get_state(
75 IN nodnic_port_priv *port_priv,
76 OUT nodnic_port_state *state
77 );
78
79 mlx_status
80 nodnic_port_get_type(
81 IN nodnic_port_priv *port_priv,
82 OUT nodnic_port_type *type
83 );
84
85 mlx_status
86 nodnic_port_query(
87 IN nodnic_port_priv *port_priv,
88 IN nodnic_port_option option,
89 OUT mlx_uint32 *out
90 );
91
92 mlx_status
93 nodnic_port_set(
94 IN nodnic_port_priv *port_priv,
95 IN nodnic_port_option option,
96 IN mlx_uint32 in
97 );
98
99 mlx_status
100 nodnic_port_create_cq(
101 IN nodnic_port_priv *port_priv,
102 IN mlx_size cq_size,
103 OUT nodnic_cq **cq
104 );
105
106 mlx_status
107 nodnic_port_destroy_cq(
108 IN nodnic_port_priv *port_priv,
109 IN nodnic_cq *cq
110 );
111
112 mlx_status
113 nodnic_port_create_qp(
114 IN nodnic_port_priv *port_priv,
115 IN nodnic_queue_pair_type type,
116 IN mlx_size send_wq_size,
117 IN mlx_uint32 send_wqe_num,
118 IN mlx_size receive_wq_size,
119 IN mlx_uint32 recv_wqe_num,
120 OUT nodnic_qp **qp
121 );
122
123 mlx_status
124 nodnic_port_destroy_qp(
125 IN nodnic_port_priv *port_priv,
126 IN nodnic_queue_pair_type type,
127 IN nodnic_qp *qp
128 );
129 mlx_status
130 nodnic_port_get_qpn(
131 IN nodnic_port_priv *port_priv,
132 IN struct nodnic_ring *ring,
133 OUT mlx_uint32 *qpn
134 );
135 mlx_status
136 nodnic_port_update_ring_doorbell(
137 IN nodnic_port_priv *port_priv,
138 IN struct nodnic_ring *ring,
139 IN mlx_uint16 index
140 );
141 mlx_status
142 nodnic_port_get_cq_size(
143 IN nodnic_port_priv *port_priv,
144 OUT mlx_uint64 *cq_size
145 );
146
147 mlx_status
148 nodnic_port_allocate_eq(
149 IN nodnic_port_priv *port_priv,
150 IN mlx_uint8 log_eq_size
151 );
152 mlx_status
153 nodnic_port_free_eq(
154 IN nodnic_port_priv *port_priv
155 );
156
157 mlx_status
158 nodnic_port_add_mac_filter(
159 IN nodnic_port_priv *port_priv,
160 IN mlx_mac_address mac
161 );
162
163 mlx_status
164 nodnic_port_remove_mac_filter(
165 IN nodnic_port_priv *port_priv,
166 IN mlx_mac_address mac
167 );
168 mlx_status
169 nodnic_port_add_mgid_filter(
170 IN nodnic_port_priv *port_priv,
171 IN mlx_mac_address mac
172 );
173
174 mlx_status
175 nodnic_port_remove_mgid_filter(
176 IN nodnic_port_priv *port_priv,
177 IN mlx_mac_address mac
178 );
179 mlx_status
180 nodnic_port_thin_init(
181 IN nodnic_device_priv *device_priv,
182 IN nodnic_port_priv *port_priv,
183 IN mlx_uint8 port_index
184 );
185
186 mlx_status
187 nodnic_port_set_promisc(
188 IN nodnic_port_priv *port_priv,
189 IN mlx_boolean value
190 );
191
192 mlx_status
193 nodnic_port_set_promisc_multicast(
194 IN nodnic_port_priv *port_priv,
195 IN mlx_boolean value
196 );
197
198 mlx_status
199 nodnic_port_init(
200 IN nodnic_port_priv *port_priv
201 );
202
203 mlx_status
204 nodnic_port_close(
205 IN nodnic_port_priv *port_priv
206 );
207
208 mlx_status
209 nodnic_port_enable_dma(
210 IN nodnic_port_priv *port_priv
211 );
212
213 mlx_status
214 nodnic_port_disable_dma(
215 IN nodnic_port_priv *port_priv
216 );
217
218 mlx_status
219 nodnic_port_read_reset_needed(
220 IN nodnic_port_priv *port_priv,
221 OUT mlx_boolean *reset_needed
222 );
223
224 mlx_status
225 nodnic_port_read_port_management_change_event(
226 IN nodnic_port_priv *port_priv,
227 OUT mlx_boolean *change_event
228 );
229 #endif /* STUB_NODNIC_PORT_H_ */