diff options
Diffstat (limited to 'drivers/net/bnx2x/bnx2x_sp.h')
-rw-r--r-- | drivers/net/bnx2x/bnx2x_sp.h | 1235 |
1 files changed, 1235 insertions, 0 deletions
diff --git a/drivers/net/bnx2x/bnx2x_sp.h b/drivers/net/bnx2x/bnx2x_sp.h new file mode 100644 index 000000000000..86eaa80721ea --- /dev/null +++ b/drivers/net/bnx2x/bnx2x_sp.h | |||
@@ -0,0 +1,1235 @@ | |||
1 | /* bnx2x_sp.h: Broadcom Everest network driver. | ||
2 | * | ||
3 | * Copyright 2011 Broadcom Corporation | ||
4 | * | ||
5 | * Unless you and Broadcom execute a separate written software license | ||
6 | * agreement governing use of this software, this software is licensed to you | ||
7 | * under the terms of the GNU General Public License version 2, available | ||
8 | * at http://www.gnu.org/licenses/old-licenses/gpl-2.0.html (the "GPL"). | ||
9 | * | ||
10 | * Notwithstanding the above, under no circumstances may you combine this | ||
11 | * software in any way with any other Broadcom software provided under a | ||
12 | * license other than the GPL, without Broadcom's express prior written | ||
13 | * consent. | ||
14 | * | ||
15 | * Maintained by: Eilon Greenstein <eilong@broadcom.com> | ||
16 | * Written by: Vladislav Zolotarov | ||
17 | * | ||
18 | */ | ||
19 | #ifndef BNX2X_SP_VERBS | ||
20 | #define BNX2X_SP_VERBS | ||
21 | |||
22 | struct bnx2x; | ||
23 | struct eth_context; | ||
24 | |||
25 | /* Bits representing general command's configuration */ | ||
26 | enum { | ||
27 | RAMROD_TX, | ||
28 | RAMROD_RX, | ||
29 | /* Wait until all pending commands complete */ | ||
30 | RAMROD_COMP_WAIT, | ||
31 | /* Don't send a ramrod, only update a registry */ | ||
32 | RAMROD_DRV_CLR_ONLY, | ||
33 | /* Configure HW according to the current object state */ | ||
34 | RAMROD_RESTORE, | ||
35 | /* Execute the next command now */ | ||
36 | RAMROD_EXEC, | ||
37 | /* | ||
38 | * Don't add a new command and continue execution of posponed | ||
39 | * commands. If not set a new command will be added to the | ||
40 | * pending commands list. | ||
41 | */ | ||
42 | RAMROD_CONT, | ||
43 | }; | ||
44 | |||
45 | typedef enum { | ||
46 | BNX2X_OBJ_TYPE_RX, | ||
47 | BNX2X_OBJ_TYPE_TX, | ||
48 | BNX2X_OBJ_TYPE_RX_TX, | ||
49 | } bnx2x_obj_type; | ||
50 | |||
51 | /* Filtering states */ | ||
52 | enum { | ||
53 | BNX2X_FILTER_MAC_PENDING, | ||
54 | BNX2X_FILTER_VLAN_PENDING, | ||
55 | BNX2X_FILTER_VLAN_MAC_PENDING, | ||
56 | BNX2X_FILTER_RX_MODE_PENDING, | ||
57 | BNX2X_FILTER_RX_MODE_SCHED, | ||
58 | BNX2X_FILTER_ISCSI_ETH_START_SCHED, | ||
59 | BNX2X_FILTER_ISCSI_ETH_STOP_SCHED, | ||
60 | BNX2X_FILTER_FCOE_ETH_START_SCHED, | ||
61 | BNX2X_FILTER_FCOE_ETH_STOP_SCHED, | ||
62 | BNX2X_FILTER_MCAST_PENDING, | ||
63 | BNX2X_FILTER_MCAST_SCHED, | ||
64 | BNX2X_FILTER_RSS_CONF_PENDING, | ||
65 | }; | ||
66 | |||
67 | struct bnx2x_raw_obj { | ||
68 | u8 func_id; | ||
69 | |||
70 | /* Queue params */ | ||
71 | u8 cl_id; | ||
72 | u32 cid; | ||
73 | |||
74 | /* Ramrod data buffer params */ | ||
75 | void *rdata; | ||
76 | dma_addr_t rdata_mapping; | ||
77 | |||
78 | /* Ramrod state params */ | ||
79 | int state; /* "ramrod is pending" state bit */ | ||
80 | unsigned long *pstate; /* pointer to state buffer */ | ||
81 | |||
82 | bnx2x_obj_type obj_type; | ||
83 | |||
84 | int (*wait_comp)(struct bnx2x *bp, | ||
85 | struct bnx2x_raw_obj *o); | ||
86 | |||
87 | bool (*check_pending)(struct bnx2x_raw_obj *o); | ||
88 | void (*clear_pending)(struct bnx2x_raw_obj *o); | ||
89 | void (*set_pending)(struct bnx2x_raw_obj *o); | ||
90 | }; | ||
91 | |||
92 | /************************* VLAN-MAC commands related parameters ***************/ | ||
93 | struct bnx2x_mac_ramrod_data { | ||
94 | u8 mac[ETH_ALEN]; | ||
95 | }; | ||
96 | |||
97 | struct bnx2x_vlan_ramrod_data { | ||
98 | u16 vlan; | ||
99 | }; | ||
100 | |||
101 | struct bnx2x_vlan_mac_ramrod_data { | ||
102 | u8 mac[ETH_ALEN]; | ||
103 | u16 vlan; | ||
104 | }; | ||
105 | |||
106 | union bnx2x_classification_ramrod_data { | ||
107 | struct bnx2x_mac_ramrod_data mac; | ||
108 | struct bnx2x_vlan_ramrod_data vlan; | ||
109 | struct bnx2x_vlan_mac_ramrod_data vlan_mac; | ||
110 | }; | ||
111 | |||
112 | /* VLAN_MAC commands */ | ||
113 | enum bnx2x_vlan_mac_cmd { | ||
114 | BNX2X_VLAN_MAC_ADD, | ||
115 | BNX2X_VLAN_MAC_DEL, | ||
116 | BNX2X_VLAN_MAC_MOVE, | ||
117 | }; | ||
118 | |||
119 | struct bnx2x_vlan_mac_data { | ||
120 | /* Requested command: BNX2X_VLAN_MAC_XX */ | ||
121 | enum bnx2x_vlan_mac_cmd cmd; | ||
122 | /* | ||
123 | * used to contain the data related vlan_mac_flags bits from | ||
124 | * ramrod parameters. | ||
125 | */ | ||
126 | unsigned long vlan_mac_flags; | ||
127 | |||
128 | /* Needed for MOVE command */ | ||
129 | struct bnx2x_vlan_mac_obj *target_obj; | ||
130 | |||
131 | union bnx2x_classification_ramrod_data u; | ||
132 | }; | ||
133 | |||
134 | /*************************** Exe Queue obj ************************************/ | ||
135 | union bnx2x_exe_queue_cmd_data { | ||
136 | struct bnx2x_vlan_mac_data vlan_mac; | ||
137 | |||
138 | struct { | ||
139 | /* TODO */ | ||
140 | } mcast; | ||
141 | }; | ||
142 | |||
143 | struct bnx2x_exeq_elem { | ||
144 | struct list_head link; | ||
145 | |||
146 | /* Length of this element in the exe_chunk. */ | ||
147 | int cmd_len; | ||
148 | |||
149 | union bnx2x_exe_queue_cmd_data cmd_data; | ||
150 | }; | ||
151 | |||
152 | union bnx2x_qable_obj; | ||
153 | |||
154 | union bnx2x_exeq_comp_elem { | ||
155 | union event_ring_elem *elem; | ||
156 | }; | ||
157 | |||
158 | struct bnx2x_exe_queue_obj; | ||
159 | |||
160 | typedef int (*exe_q_validate)(struct bnx2x *bp, | ||
161 | union bnx2x_qable_obj *o, | ||
162 | struct bnx2x_exeq_elem *elem); | ||
163 | |||
164 | /** | ||
165 | * @return positive is entry was optimized, 0 - if not, negative | ||
166 | * in case of an error. | ||
167 | */ | ||
168 | typedef int (*exe_q_optimize)(struct bnx2x *bp, | ||
169 | union bnx2x_qable_obj *o, | ||
170 | struct bnx2x_exeq_elem *elem); | ||
171 | typedef int (*exe_q_execute)(struct bnx2x *bp, | ||
172 | union bnx2x_qable_obj *o, | ||
173 | struct list_head *exe_chunk, | ||
174 | unsigned long *ramrod_flags); | ||
175 | typedef struct bnx2x_exeq_elem * | ||
176 | (*exe_q_get)(struct bnx2x_exe_queue_obj *o, | ||
177 | struct bnx2x_exeq_elem *elem); | ||
178 | |||
179 | struct bnx2x_exe_queue_obj { | ||
180 | /* | ||
181 | * Commands pending for an execution. | ||
182 | */ | ||
183 | struct list_head exe_queue; | ||
184 | |||
185 | /* | ||
186 | * Commands pending for an completion. | ||
187 | */ | ||
188 | struct list_head pending_comp; | ||
189 | |||
190 | spinlock_t lock; | ||
191 | |||
192 | /* Maximum length of commands' list for one execution */ | ||
193 | int exe_chunk_len; | ||
194 | |||
195 | union bnx2x_qable_obj *owner; | ||
196 | |||
197 | /****** Virtual functions ******/ | ||
198 | /** | ||
199 | * Called before commands execution for commands that are really | ||
200 | * going to be executed (after 'optimize'). | ||
201 | * | ||
202 | * Must run under exe_queue->lock | ||
203 | */ | ||
204 | exe_q_validate validate; | ||
205 | |||
206 | |||
207 | /** | ||
208 | * This will try to cancel the current pending commands list | ||
209 | * considering the new command. | ||
210 | * | ||
211 | * Must run under exe_queue->lock | ||
212 | */ | ||
213 | exe_q_optimize optimize; | ||
214 | |||
215 | /** | ||
216 | * Run the next commands chunk (owner specific). | ||
217 | */ | ||
218 | exe_q_execute execute; | ||
219 | |||
220 | /** | ||
221 | * Return the exe_queue element containing the specific command | ||
222 | * if any. Otherwise return NULL. | ||
223 | */ | ||
224 | exe_q_get get; | ||
225 | }; | ||
226 | /***************** Classification verbs: Set/Del MAC/VLAN/VLAN-MAC ************/ | ||
227 | /* | ||
228 | * Element in the VLAN_MAC registry list having all currenty configured | ||
229 | * rules. | ||
230 | */ | ||
231 | struct bnx2x_vlan_mac_registry_elem { | ||
232 | struct list_head link; | ||
233 | |||
234 | /* | ||
235 | * Used to store the cam offset used for the mac/vlan/vlan-mac. | ||
236 | * Relevant for 57710 and 57711 only. VLANs and MACs share the | ||
237 | * same CAM for these chips. | ||
238 | */ | ||
239 | int cam_offset; | ||
240 | |||
241 | /* Needed for DEL and RESTORE flows */ | ||
242 | unsigned long vlan_mac_flags; | ||
243 | |||
244 | union bnx2x_classification_ramrod_data u; | ||
245 | }; | ||
246 | |||
247 | /* Bits representing VLAN_MAC commands specific flags */ | ||
248 | enum { | ||
249 | BNX2X_UC_LIST_MAC, | ||
250 | BNX2X_ETH_MAC, | ||
251 | BNX2X_ISCSI_ETH_MAC, | ||
252 | BNX2X_NETQ_ETH_MAC, | ||
253 | BNX2X_DONT_CONSUME_CAM_CREDIT, | ||
254 | BNX2X_DONT_CONSUME_CAM_CREDIT_DEST, | ||
255 | }; | ||
256 | |||
257 | struct bnx2x_vlan_mac_ramrod_params { | ||
258 | /* Object to run the command from */ | ||
259 | struct bnx2x_vlan_mac_obj *vlan_mac_obj; | ||
260 | |||
261 | /* General command flags: COMP_WAIT, etc. */ | ||
262 | unsigned long ramrod_flags; | ||
263 | |||
264 | /* Command specific configuration request */ | ||
265 | struct bnx2x_vlan_mac_data user_req; | ||
266 | }; | ||
267 | |||
268 | struct bnx2x_vlan_mac_obj { | ||
269 | struct bnx2x_raw_obj raw; | ||
270 | |||
271 | /* Bookkeeping list: will prevent the addition of already existing | ||
272 | * entries. | ||
273 | */ | ||
274 | struct list_head head; | ||
275 | |||
276 | /* TODO: Add it's initialization in the init functions */ | ||
277 | struct bnx2x_exe_queue_obj exe_queue; | ||
278 | |||
279 | /* MACs credit pool */ | ||
280 | struct bnx2x_credit_pool_obj *macs_pool; | ||
281 | |||
282 | /* VLANs credit pool */ | ||
283 | struct bnx2x_credit_pool_obj *vlans_pool; | ||
284 | |||
285 | /* RAMROD command to be used */ | ||
286 | int ramrod_cmd; | ||
287 | |||
288 | /** | ||
289 | * Checks if ADD-ramrod with the given params may be performed. | ||
290 | * | ||
291 | * @return zero if the element may be added | ||
292 | */ | ||
293 | |||
294 | int (*check_add)(struct bnx2x_vlan_mac_obj *o, | ||
295 | union bnx2x_classification_ramrod_data *data); | ||
296 | |||
297 | /** | ||
298 | * Checks if DEL-ramrod with the given params may be performed. | ||
299 | * | ||
300 | * @return true if the element may be deleted | ||
301 | */ | ||
302 | struct bnx2x_vlan_mac_registry_elem * | ||
303 | (*check_del)(struct bnx2x_vlan_mac_obj *o, | ||
304 | union bnx2x_classification_ramrod_data *data); | ||
305 | |||
306 | /** | ||
307 | * Checks if DEL-ramrod with the given params may be performed. | ||
308 | * | ||
309 | * @return true if the element may be deleted | ||
310 | */ | ||
311 | bool (*check_move)(struct bnx2x_vlan_mac_obj *src_o, | ||
312 | struct bnx2x_vlan_mac_obj *dst_o, | ||
313 | union bnx2x_classification_ramrod_data *data); | ||
314 | |||
315 | /** | ||
316 | * Update the relevant credit object(s) (consume/return | ||
317 | * correspondingly). | ||
318 | */ | ||
319 | bool (*get_credit)(struct bnx2x_vlan_mac_obj *o); | ||
320 | bool (*put_credit)(struct bnx2x_vlan_mac_obj *o); | ||
321 | bool (*get_cam_offset)(struct bnx2x_vlan_mac_obj *o, int *offset); | ||
322 | bool (*put_cam_offset)(struct bnx2x_vlan_mac_obj *o, int offset); | ||
323 | |||
324 | /** | ||
325 | * Configures one rule in the ramrod data buffer. | ||
326 | */ | ||
327 | void (*set_one_rule)(struct bnx2x *bp, | ||
328 | struct bnx2x_vlan_mac_obj *o, | ||
329 | struct bnx2x_exeq_elem *elem, int rule_idx, | ||
330 | int cam_offset); | ||
331 | |||
332 | /** | ||
333 | * Delete all configured elements having the given | ||
334 | * vlan_mac_flags specification. Assumes no pending for | ||
335 | * execution commands. Will schedule all all currently | ||
336 | * configured MACs/VLANs/VLAN-MACs matching the vlan_mac_flags | ||
337 | * specification for deletion and will use the given | ||
338 | * ramrod_flags for the last DEL operation. | ||
339 | * | ||
340 | * @param bp | ||
341 | * @param o | ||
342 | * @param ramrod_flags RAMROD_XX flags | ||
343 | * | ||
344 | * @return 0 if the last operation has completed successfully | ||
345 | * and there are no more elements left, positive value | ||
346 | * if there are pending for completion commands, | ||
347 | * negative value in case of failure. | ||
348 | */ | ||
349 | int (*delete_all)(struct bnx2x *bp, | ||
350 | struct bnx2x_vlan_mac_obj *o, | ||
351 | unsigned long *vlan_mac_flags, | ||
352 | unsigned long *ramrod_flags); | ||
353 | |||
354 | /** | ||
355 | * Reconfigures the next MAC/VLAN/VLAN-MAC element from the previously | ||
356 | * configured elements list. | ||
357 | * | ||
358 | * @param bp | ||
359 | * @param p Command parameters (RAMROD_COMP_WAIT bit in | ||
360 | * ramrod_flags is only taken into an account) | ||
361 | * @param ppos a pointer to the cooky that should be given back in the | ||
362 | * next call to make function handle the next element. If | ||
363 | * *ppos is set to NULL it will restart the iterator. | ||
364 | * If returned *ppos == NULL this means that the last | ||
365 | * element has been handled. | ||
366 | * | ||
367 | * @return int | ||
368 | */ | ||
369 | int (*restore)(struct bnx2x *bp, | ||
370 | struct bnx2x_vlan_mac_ramrod_params *p, | ||
371 | struct bnx2x_vlan_mac_registry_elem **ppos); | ||
372 | |||
373 | /** | ||
374 | * Should be called on a completion arival. | ||
375 | * | ||
376 | * @param bp | ||
377 | * @param o | ||
378 | * @param cqe Completion element we are handling | ||
379 | * @param ramrod_flags if RAMROD_CONT is set the next bulk of | ||
380 | * pending commands will be executed. | ||
381 | * RAMROD_DRV_CLR_ONLY and RAMROD_RESTORE | ||
382 | * may also be set if needed. | ||
383 | * | ||
384 | * @return 0 if there are neither pending nor waiting for | ||
385 | * completion commands. Positive value if there are | ||
386 | * pending for execution or for completion commands. | ||
387 | * Negative value in case of an error (including an | ||
388 | * error in the cqe). | ||
389 | */ | ||
390 | int (*complete)(struct bnx2x *bp, struct bnx2x_vlan_mac_obj *o, | ||
391 | union event_ring_elem *cqe, | ||
392 | unsigned long *ramrod_flags); | ||
393 | |||
394 | /** | ||
395 | * Wait for completion of all commands. Don't schedule new ones, | ||
396 | * just wait. It assumes that the completion code will schedule | ||
397 | * for new commands. | ||
398 | */ | ||
399 | int (*wait)(struct bnx2x *bp, struct bnx2x_vlan_mac_obj *o); | ||
400 | }; | ||
401 | |||
402 | /** RX_MODE verbs:DROP_ALL/ACCEPT_ALL/ACCEPT_ALL_MULTI/ACCEPT_ALL_VLAN/NORMAL */ | ||
403 | |||
404 | /* RX_MODE ramrod spesial flags: set in rx_mode_flags field in | ||
405 | * a bnx2x_rx_mode_ramrod_params. | ||
406 | */ | ||
407 | enum { | ||
408 | BNX2X_RX_MODE_FCOE_ETH, | ||
409 | BNX2X_RX_MODE_ISCSI_ETH, | ||
410 | }; | ||
411 | |||
412 | enum { | ||
413 | BNX2X_ACCEPT_UNICAST, | ||
414 | BNX2X_ACCEPT_MULTICAST, | ||
415 | BNX2X_ACCEPT_ALL_UNICAST, | ||
416 | BNX2X_ACCEPT_ALL_MULTICAST, | ||
417 | BNX2X_ACCEPT_BROADCAST, | ||
418 | BNX2X_ACCEPT_UNMATCHED, | ||
419 | BNX2X_ACCEPT_ANY_VLAN | ||
420 | }; | ||
421 | |||
422 | struct bnx2x_rx_mode_ramrod_params { | ||
423 | struct bnx2x_rx_mode_obj *rx_mode_obj; | ||
424 | unsigned long *pstate; | ||
425 | int state; | ||
426 | u8 cl_id; | ||
427 | u32 cid; | ||
428 | u8 func_id; | ||
429 | unsigned long ramrod_flags; | ||
430 | unsigned long rx_mode_flags; | ||
431 | |||
432 | /* | ||
433 | * rdata is either a pointer to eth_filter_rules_ramrod_data(e2) or to | ||
434 | * a tstorm_eth_mac_filter_config (e1x). | ||
435 | */ | ||
436 | void *rdata; | ||
437 | dma_addr_t rdata_mapping; | ||
438 | |||
439 | /* Rx mode settings */ | ||
440 | unsigned long rx_accept_flags; | ||
441 | |||
442 | /* internal switching settings */ | ||
443 | unsigned long tx_accept_flags; | ||
444 | }; | ||
445 | |||
446 | struct bnx2x_rx_mode_obj { | ||
447 | int (*config_rx_mode)(struct bnx2x *bp, | ||
448 | struct bnx2x_rx_mode_ramrod_params *p); | ||
449 | |||
450 | int (*wait_comp)(struct bnx2x *bp, | ||
451 | struct bnx2x_rx_mode_ramrod_params *p); | ||
452 | }; | ||
453 | |||
454 | /********************** Set multicast group ***********************************/ | ||
455 | |||
456 | struct bnx2x_mcast_list_elem { | ||
457 | struct list_head link; | ||
458 | u8 *mac; | ||
459 | }; | ||
460 | |||
461 | union bnx2x_mcast_config_data { | ||
462 | u8 *mac; | ||
463 | u8 bin; /* used in a RESTORE flow */ | ||
464 | }; | ||
465 | |||
466 | struct bnx2x_mcast_ramrod_params { | ||
467 | struct bnx2x_mcast_obj *mcast_obj; | ||
468 | |||
469 | /* Relevant options are RAMROD_COMP_WAIT and RAMROD_DRV_CLR_ONLY */ | ||
470 | unsigned long ramrod_flags; | ||
471 | |||
472 | struct list_head mcast_list; /* list of struct bnx2x_mcast_list_elem */ | ||
473 | /** TODO: | ||
474 | * - rename it to macs_num. | ||
475 | * - Add a new command type for handling pending commands | ||
476 | * (remove "zero semantics"). | ||
477 | * | ||
478 | * Length of mcast_list. If zero and ADD_CONT command - post | ||
479 | * pending commands. | ||
480 | */ | ||
481 | int mcast_list_len; | ||
482 | }; | ||
483 | |||
484 | enum { | ||
485 | BNX2X_MCAST_CMD_ADD, | ||
486 | BNX2X_MCAST_CMD_CONT, | ||
487 | BNX2X_MCAST_CMD_DEL, | ||
488 | BNX2X_MCAST_CMD_RESTORE, | ||
489 | }; | ||
490 | |||
491 | struct bnx2x_mcast_obj { | ||
492 | struct bnx2x_raw_obj raw; | ||
493 | |||
494 | union { | ||
495 | struct { | ||
496 | #define BNX2X_MCAST_BINS_NUM 256 | ||
497 | #define BNX2X_MCAST_VEC_SZ (BNX2X_MCAST_BINS_NUM / 64) | ||
498 | u64 vec[BNX2X_MCAST_VEC_SZ]; | ||
499 | |||
500 | /** Number of BINs to clear. Should be updated | ||
501 | * immediately when a command arrives in order to | ||
502 | * properly create DEL commands. | ||
503 | */ | ||
504 | int num_bins_set; | ||
505 | } aprox_match; | ||
506 | |||
507 | struct { | ||
508 | struct list_head macs; | ||
509 | int num_macs_set; | ||
510 | } exact_match; | ||
511 | } registry; | ||
512 | |||
513 | /* Pending commands */ | ||
514 | struct list_head pending_cmds_head; | ||
515 | |||
516 | /* A state that is set in raw.pstate, when there are pending commands */ | ||
517 | int sched_state; | ||
518 | |||
519 | /* Maximal number of mcast MACs configured in one command */ | ||
520 | int max_cmd_len; | ||
521 | |||
522 | /* Total number of currently pending MACs to configure: both | ||
523 | * in the pending commands list and in the current command. | ||
524 | */ | ||
525 | int total_pending_num; | ||
526 | |||
527 | u8 engine_id; | ||
528 | |||
529 | /** | ||
530 | * @param cmd command to execute (BNX2X_MCAST_CMD_X, see above) | ||
531 | */ | ||
532 | int (*config_mcast)(struct bnx2x *bp, | ||
533 | struct bnx2x_mcast_ramrod_params *p, int cmd); | ||
534 | |||
535 | /** | ||
536 | * Fills the ramrod data during the RESTORE flow. | ||
537 | * | ||
538 | * @param bp | ||
539 | * @param o | ||
540 | * @param start_idx Registry index to start from | ||
541 | * @param rdata_idx Index in the ramrod data to start from | ||
542 | * | ||
543 | * @return -1 if we handled the whole registry or index of the last | ||
544 | * handled registry element. | ||
545 | */ | ||
546 | int (*hdl_restore)(struct bnx2x *bp, struct bnx2x_mcast_obj *o, | ||
547 | int start_bin, int *rdata_idx); | ||
548 | |||
549 | int (*enqueue_cmd)(struct bnx2x *bp, struct bnx2x_mcast_obj *o, | ||
550 | struct bnx2x_mcast_ramrod_params *p, int cmd); | ||
551 | |||
552 | void (*set_one_rule)(struct bnx2x *bp, | ||
553 | struct bnx2x_mcast_obj *o, int idx, | ||
554 | union bnx2x_mcast_config_data *cfg_data, int cmd); | ||
555 | |||
556 | /** Checks if there are more mcast MACs to be set or a previous | ||
557 | * command is still pending. | ||
558 | */ | ||
559 | bool (*check_pending)(struct bnx2x_mcast_obj *o); | ||
560 | |||
561 | /** | ||
562 | * Set/Clear/Check SCHEDULED state of the object | ||
563 | */ | ||
564 | void (*set_sched)(struct bnx2x_mcast_obj *o); | ||
565 | void (*clear_sched)(struct bnx2x_mcast_obj *o); | ||
566 | bool (*check_sched)(struct bnx2x_mcast_obj *o); | ||
567 | |||
568 | /* Wait until all pending commands complete */ | ||
569 | int (*wait_comp)(struct bnx2x *bp, struct bnx2x_mcast_obj *o); | ||
570 | |||
571 | /** | ||
572 | * Handle the internal object counters needed for proper | ||
573 | * commands handling. Checks that the provided parameters are | ||
574 | * feasible. | ||
575 | */ | ||
576 | int (*validate)(struct bnx2x *bp, | ||
577 | struct bnx2x_mcast_ramrod_params *p, int cmd); | ||
578 | |||
579 | /** | ||
580 | * Restore the values of internal counters in case of a failure. | ||
581 | */ | ||
582 | void (*revert)(struct bnx2x *bp, | ||
583 | struct bnx2x_mcast_ramrod_params *p, | ||
584 | int old_num_bins); | ||
585 | |||
586 | int (*get_registry_size)(struct bnx2x_mcast_obj *o); | ||
587 | void (*set_registry_size)(struct bnx2x_mcast_obj *o, int n); | ||
588 | }; | ||
589 | |||
590 | /*************************** Credit handling **********************************/ | ||
591 | struct bnx2x_credit_pool_obj { | ||
592 | |||
593 | /* Current amount of credit in the pool */ | ||
594 | atomic_t credit; | ||
595 | |||
596 | /* Maximum allowed credit. put() will check against it. */ | ||
597 | int pool_sz; | ||
598 | |||
599 | /* | ||
600 | * Allocate a pool table statically. | ||
601 | * | ||
602 | * Currently the mamimum allowed size is MAX_MAC_CREDIT_E2(272) | ||
603 | * | ||
604 | * The set bit in the table will mean that the entry is available. | ||
605 | */ | ||
606 | #define BNX2X_POOL_VEC_SIZE (MAX_MAC_CREDIT_E2 / 64) | ||
607 | u64 pool_mirror[BNX2X_POOL_VEC_SIZE]; | ||
608 | |||
609 | /* Base pool offset (initialized differently */ | ||
610 | int base_pool_offset; | ||
611 | |||
612 | /** | ||
613 | * Get the next free pool entry. | ||
614 | * | ||
615 | * @return true if there was a free entry in the pool | ||
616 | */ | ||
617 | bool (*get_entry)(struct bnx2x_credit_pool_obj *o, int *entry); | ||
618 | |||
619 | /** | ||
620 | * Return the entry back to the pool. | ||
621 | * | ||
622 | * @return true if entry is legal and has been successfully | ||
623 | * returned to the pool. | ||
624 | */ | ||
625 | bool (*put_entry)(struct bnx2x_credit_pool_obj *o, int entry); | ||
626 | |||
627 | /** | ||
628 | * Get the requested amount of credit from the pool. | ||
629 | * | ||
630 | * @param cnt Amount of requested credit | ||
631 | * @return true if the operation is successful | ||
632 | */ | ||
633 | bool (*get)(struct bnx2x_credit_pool_obj *o, int cnt); | ||
634 | |||
635 | /** | ||
636 | * Returns the credit to the pool. | ||
637 | * | ||
638 | * @param cnt Amount of credit to return | ||
639 | * @return true if the operation is successful | ||
640 | */ | ||
641 | bool (*put)(struct bnx2x_credit_pool_obj *o, int cnt); | ||
642 | |||
643 | /** | ||
644 | * Reads the current amount of credit. | ||
645 | */ | ||
646 | int (*check)(struct bnx2x_credit_pool_obj *o); | ||
647 | }; | ||
648 | |||
649 | /*************************** RSS configuration ********************************/ | ||
650 | enum { | ||
651 | /* RSS_MODE bits are mutually exclusive */ | ||
652 | BNX2X_RSS_MODE_DISABLED, | ||
653 | BNX2X_RSS_MODE_REGULAR, | ||
654 | BNX2X_RSS_MODE_VLAN_PRI, | ||
655 | BNX2X_RSS_MODE_E1HOV_PRI, | ||
656 | BNX2X_RSS_MODE_IP_DSCP, | ||
657 | |||
658 | BNX2X_RSS_SET_SRCH, /* Setup searcher, E1x specific flag */ | ||
659 | |||
660 | BNX2X_RSS_IPV4, | ||
661 | BNX2X_RSS_IPV4_TCP, | ||
662 | BNX2X_RSS_IPV6, | ||
663 | BNX2X_RSS_IPV6_TCP, | ||
664 | }; | ||
665 | |||
666 | struct bnx2x_config_rss_params { | ||
667 | struct bnx2x_rss_config_obj *rss_obj; | ||
668 | |||
669 | /* may have RAMROD_COMP_WAIT set only */ | ||
670 | unsigned long ramrod_flags; | ||
671 | |||
672 | /* BNX2X_RSS_X bits */ | ||
673 | unsigned long rss_flags; | ||
674 | |||
675 | /* Number hash bits to take into an account */ | ||
676 | u8 rss_result_mask; | ||
677 | |||
678 | /* Indirection table */ | ||
679 | u8 ind_table[T_ETH_INDIRECTION_TABLE_SIZE]; | ||
680 | |||
681 | /* RSS hash values */ | ||
682 | u32 rss_key[10]; | ||
683 | |||
684 | /* valid only iff BNX2X_RSS_UPDATE_TOE is set */ | ||
685 | u16 toe_rss_bitmap; | ||
686 | }; | ||
687 | |||
688 | struct bnx2x_rss_config_obj { | ||
689 | struct bnx2x_raw_obj raw; | ||
690 | |||
691 | /* RSS engine to use */ | ||
692 | u8 engine_id; | ||
693 | |||
694 | /* Last configured indirection table */ | ||
695 | u8 ind_table[T_ETH_INDIRECTION_TABLE_SIZE]; | ||
696 | |||
697 | int (*config_rss)(struct bnx2x *bp, | ||
698 | struct bnx2x_config_rss_params *p); | ||
699 | }; | ||
700 | |||
701 | /*********************** Queue state update ***********************************/ | ||
702 | |||
703 | /* UPDATE command options */ | ||
704 | enum { | ||
705 | BNX2X_Q_UPDATE_IN_VLAN_REM, | ||
706 | BNX2X_Q_UPDATE_IN_VLAN_REM_CHNG, | ||
707 | BNX2X_Q_UPDATE_OUT_VLAN_REM, | ||
708 | BNX2X_Q_UPDATE_OUT_VLAN_REM_CHNG, | ||
709 | BNX2X_Q_UPDATE_ANTI_SPOOF, | ||
710 | BNX2X_Q_UPDATE_ANTI_SPOOF_CHNG, | ||
711 | BNX2X_Q_UPDATE_ACTIVATE, | ||
712 | BNX2X_Q_UPDATE_ACTIVATE_CHNG, | ||
713 | BNX2X_Q_UPDATE_DEF_VLAN_EN, | ||
714 | BNX2X_Q_UPDATE_DEF_VLAN_EN_CHNG, | ||
715 | BNX2X_Q_UPDATE_SILENT_VLAN_REM_CHNG, | ||
716 | BNX2X_Q_UPDATE_SILENT_VLAN_REM | ||
717 | }; | ||
718 | |||
719 | /* Allowed Queue states */ | ||
720 | enum bnx2x_q_state { | ||
721 | BNX2X_Q_STATE_RESET, | ||
722 | BNX2X_Q_STATE_INITIALIZED, | ||
723 | BNX2X_Q_STATE_ACTIVE, | ||
724 | BNX2X_Q_STATE_INACTIVE, | ||
725 | BNX2X_Q_STATE_STOPPED, | ||
726 | BNX2X_Q_STATE_TERMINATED, | ||
727 | BNX2X_Q_STATE_FLRED, | ||
728 | BNX2X_Q_STATE_MAX, | ||
729 | }; | ||
730 | |||
731 | /* Allowed commands */ | ||
732 | enum bnx2x_queue_cmd { | ||
733 | BNX2X_Q_CMD_INIT, | ||
734 | BNX2X_Q_CMD_SETUP, | ||
735 | BNX2X_Q_CMD_DEACTIVATE, | ||
736 | BNX2X_Q_CMD_ACTIVATE, | ||
737 | BNX2X_Q_CMD_UPDATE, | ||
738 | BNX2X_Q_CMD_UPDATE_TPA, | ||
739 | BNX2X_Q_CMD_HALT, | ||
740 | BNX2X_Q_CMD_CFC_DEL, | ||
741 | BNX2X_Q_CMD_TERMINATE, | ||
742 | BNX2X_Q_CMD_EMPTY, | ||
743 | BNX2X_Q_CMD_MAX, | ||
744 | }; | ||
745 | |||
746 | /* queue SETUP + INIT flags */ | ||
747 | enum { | ||
748 | BNX2X_Q_FLG_TPA, | ||
749 | BNX2X_Q_FLG_STATS, | ||
750 | BNX2X_Q_FLG_ZERO_STATS, | ||
751 | BNX2X_Q_FLG_ACTIVE, | ||
752 | BNX2X_Q_FLG_OV, | ||
753 | BNX2X_Q_FLG_VLAN, | ||
754 | BNX2X_Q_FLG_COS, | ||
755 | BNX2X_Q_FLG_HC, | ||
756 | BNX2X_Q_FLG_HC_EN, | ||
757 | BNX2X_Q_FLG_DHC, | ||
758 | BNX2X_Q_FLG_FCOE, | ||
759 | BNX2X_Q_FLG_LEADING_RSS, | ||
760 | BNX2X_Q_FLG_MCAST, | ||
761 | BNX2X_Q_FLG_DEF_VLAN, | ||
762 | BNX2X_Q_FLG_TX_SWITCH, | ||
763 | BNX2X_Q_FLG_TX_SEC, | ||
764 | BNX2X_Q_FLG_ANTI_SPOOF, | ||
765 | BNX2X_Q_FLG_SILENT_VLAN_REM | ||
766 | }; | ||
767 | |||
768 | /* Queue type options: queue type may be a compination of below. */ | ||
769 | enum bnx2x_q_type { | ||
770 | /** TODO: Consider moving both these flags into the init() | ||
771 | * ramrod params. | ||
772 | */ | ||
773 | BNX2X_Q_TYPE_HAS_RX, | ||
774 | BNX2X_Q_TYPE_HAS_TX, | ||
775 | }; | ||
776 | |||
777 | struct bnx2x_queue_init_params { | ||
778 | struct { | ||
779 | unsigned long flags; | ||
780 | u16 hc_rate; | ||
781 | u8 fw_sb_id; | ||
782 | u8 sb_cq_index; | ||
783 | } tx; | ||
784 | |||
785 | struct { | ||
786 | unsigned long flags; | ||
787 | u16 hc_rate; | ||
788 | u8 fw_sb_id; | ||
789 | u8 sb_cq_index; | ||
790 | } rx; | ||
791 | |||
792 | /* CID context in the host memory */ | ||
793 | struct eth_context *cxt; | ||
794 | }; | ||
795 | |||
796 | struct bnx2x_queue_update_params { | ||
797 | unsigned long update_flags; /* BNX2X_Q_UPDATE_XX bits */ | ||
798 | u16 def_vlan; | ||
799 | u16 silent_removal_value; | ||
800 | u16 silent_removal_mask; | ||
801 | }; | ||
802 | |||
803 | struct rxq_pause_params { | ||
804 | u16 bd_th_lo; | ||
805 | u16 bd_th_hi; | ||
806 | u16 rcq_th_lo; | ||
807 | u16 rcq_th_hi; | ||
808 | u16 sge_th_lo; /* valid iff BNX2X_Q_FLG_TPA */ | ||
809 | u16 sge_th_hi; /* valid iff BNX2X_Q_FLG_TPA */ | ||
810 | u16 pri_map; | ||
811 | }; | ||
812 | |||
813 | /* general */ | ||
814 | struct bnx2x_general_setup_params { | ||
815 | /* valid iff BNX2X_Q_FLG_STATS */ | ||
816 | u8 stat_id; | ||
817 | |||
818 | u8 spcl_id; | ||
819 | u16 mtu; | ||
820 | }; | ||
821 | |||
822 | struct bnx2x_rxq_setup_params { | ||
823 | /* dma */ | ||
824 | dma_addr_t dscr_map; | ||
825 | dma_addr_t sge_map; | ||
826 | dma_addr_t rcq_map; | ||
827 | dma_addr_t rcq_np_map; | ||
828 | |||
829 | u16 drop_flags; | ||
830 | u16 buf_sz; | ||
831 | u8 fw_sb_id; | ||
832 | u8 cl_qzone_id; | ||
833 | |||
834 | /* valid iff BNX2X_Q_FLG_TPA */ | ||
835 | u16 tpa_agg_sz; | ||
836 | u16 sge_buf_sz; | ||
837 | u8 max_sges_pkt; | ||
838 | u8 max_tpa_queues; | ||
839 | u8 rss_engine_id; | ||
840 | |||
841 | u8 cache_line_log; | ||
842 | |||
843 | u8 sb_cq_index; | ||
844 | |||
845 | /* valid iff BXN2X_Q_FLG_SILENT_VLAN_REM */ | ||
846 | u16 silent_removal_value; | ||
847 | u16 silent_removal_mask; | ||
848 | }; | ||
849 | |||
850 | struct bnx2x_txq_setup_params { | ||
851 | /* dma */ | ||
852 | dma_addr_t dscr_map; | ||
853 | |||
854 | u8 fw_sb_id; | ||
855 | u8 sb_cq_index; | ||
856 | u8 cos; /* valid iff BNX2X_Q_FLG_COS */ | ||
857 | u16 traffic_type; | ||
858 | /* equals to the leading rss client id, used for TX classification*/ | ||
859 | u8 tss_leading_cl_id; | ||
860 | |||
861 | /* valid iff BNX2X_Q_FLG_DEF_VLAN */ | ||
862 | u16 default_vlan; | ||
863 | }; | ||
864 | |||
865 | struct bnx2x_queue_setup_params { | ||
866 | struct rxq_pause_params pause; | ||
867 | struct bnx2x_general_setup_params gen_params; | ||
868 | struct bnx2x_rxq_setup_params rxq_params; | ||
869 | struct bnx2x_txq_setup_params txq_params; | ||
870 | unsigned long flags; | ||
871 | }; | ||
872 | |||
873 | |||
874 | struct bnx2x_queue_state_params { | ||
875 | struct bnx2x_queue_sp_obj *q_obj; | ||
876 | |||
877 | /* Current command */ | ||
878 | enum bnx2x_queue_cmd cmd; | ||
879 | |||
880 | /* may have RAMROD_COMP_WAIT set only */ | ||
881 | unsigned long ramrod_flags; | ||
882 | |||
883 | /* Params according to the current command */ | ||
884 | union { | ||
885 | struct bnx2x_queue_update_params update; | ||
886 | struct bnx2x_queue_setup_params setup; | ||
887 | struct bnx2x_queue_init_params init; | ||
888 | } params; | ||
889 | }; | ||
890 | |||
891 | struct bnx2x_queue_sp_obj { | ||
892 | u32 cid; | ||
893 | u8 cl_id; | ||
894 | u8 func_id; | ||
895 | |||
896 | enum bnx2x_q_state state, next_state; | ||
897 | |||
898 | /* bits from enum bnx2x_q_type */ | ||
899 | unsigned long type; | ||
900 | |||
901 | /* BNX2X_Q_CMD_XX bits. This object implements "one | ||
902 | * pending" paradigm but for debug and tracing purposes it's | ||
903 | * more convinient to have different bits for different | ||
904 | * commands. | ||
905 | */ | ||
906 | unsigned long pending; | ||
907 | |||
908 | /* Buffer to use as a ramrod data and its mapping */ | ||
909 | void *rdata; | ||
910 | dma_addr_t rdata_mapping; | ||
911 | |||
912 | /** | ||
913 | * Performs one state change according to the given parameters. | ||
914 | * | ||
915 | * @return 0 in case of success and negative value otherwise. | ||
916 | */ | ||
917 | int (*send_cmd)(struct bnx2x *bp, | ||
918 | struct bnx2x_queue_state_params *params); | ||
919 | |||
920 | /** | ||
921 | * Sets the pending bit according to the requested transition. | ||
922 | */ | ||
923 | int (*set_pending)(struct bnx2x_queue_sp_obj *o, | ||
924 | struct bnx2x_queue_state_params *params); | ||
925 | |||
926 | /** | ||
927 | * Checks that the requested state transition is legal. | ||
928 | */ | ||
929 | int (*check_transition)(struct bnx2x *bp, | ||
930 | struct bnx2x_queue_sp_obj *o, | ||
931 | struct bnx2x_queue_state_params *params); | ||
932 | |||
933 | /** | ||
934 | * Completes the pending command. | ||
935 | */ | ||
936 | int (*complete_cmd)(struct bnx2x *bp, | ||
937 | struct bnx2x_queue_sp_obj *o, | ||
938 | enum bnx2x_queue_cmd); | ||
939 | |||
940 | int (*wait_comp)(struct bnx2x *bp, | ||
941 | struct bnx2x_queue_sp_obj *o, | ||
942 | enum bnx2x_queue_cmd cmd); | ||
943 | }; | ||
944 | |||
945 | /********************** Function state update *********************************/ | ||
946 | /* Allowed Function states */ | ||
947 | enum bnx2x_func_state { | ||
948 | BNX2X_F_STATE_RESET, | ||
949 | BNX2X_F_STATE_INITIALIZED, | ||
950 | BNX2X_F_STATE_STARTED, | ||
951 | BNX2X_F_STATE_MAX, | ||
952 | }; | ||
953 | |||
954 | /* Allowed Function commands */ | ||
955 | enum bnx2x_func_cmd { | ||
956 | BNX2X_F_CMD_HW_INIT, | ||
957 | BNX2X_F_CMD_START, | ||
958 | BNX2X_F_CMD_STOP, | ||
959 | BNX2X_F_CMD_HW_RESET, | ||
960 | BNX2X_F_CMD_MAX, | ||
961 | }; | ||
962 | |||
963 | struct bnx2x_func_hw_init_params { | ||
964 | /* A load phase returned by MCP. | ||
965 | * | ||
966 | * May be: | ||
967 | * FW_MSG_CODE_DRV_LOAD_COMMON_CHIP | ||
968 | * FW_MSG_CODE_DRV_LOAD_COMMON | ||
969 | * FW_MSG_CODE_DRV_LOAD_PORT | ||
970 | * FW_MSG_CODE_DRV_LOAD_FUNCTION | ||
971 | */ | ||
972 | u32 load_phase; | ||
973 | }; | ||
974 | |||
975 | struct bnx2x_func_hw_reset_params { | ||
976 | /* A load phase returned by MCP. | ||
977 | * | ||
978 | * May be: | ||
979 | * FW_MSG_CODE_DRV_LOAD_COMMON_CHIP | ||
980 | * FW_MSG_CODE_DRV_LOAD_COMMON | ||
981 | * FW_MSG_CODE_DRV_LOAD_PORT | ||
982 | * FW_MSG_CODE_DRV_LOAD_FUNCTION | ||
983 | */ | ||
984 | u32 reset_phase; | ||
985 | }; | ||
986 | |||
987 | struct bnx2x_func_start_params { | ||
988 | /* Multi Function mode: | ||
989 | * - Single Function | ||
990 | * - Switch Dependent | ||
991 | * - Switch Independent | ||
992 | */ | ||
993 | u16 mf_mode; | ||
994 | |||
995 | /* Switch Dependent mode outer VLAN tag */ | ||
996 | u16 sd_vlan_tag; | ||
997 | |||
998 | /* Function cos mode */ | ||
999 | u8 network_cos_mode; | ||
1000 | }; | ||
1001 | |||
1002 | struct bnx2x_func_state_params { | ||
1003 | struct bnx2x_func_sp_obj *f_obj; | ||
1004 | |||
1005 | /* Current command */ | ||
1006 | enum bnx2x_func_cmd cmd; | ||
1007 | |||
1008 | /* may have RAMROD_COMP_WAIT set only */ | ||
1009 | unsigned long ramrod_flags; | ||
1010 | |||
1011 | /* Params according to the current command */ | ||
1012 | union { | ||
1013 | struct bnx2x_func_hw_init_params hw_init; | ||
1014 | struct bnx2x_func_hw_reset_params hw_reset; | ||
1015 | struct bnx2x_func_start_params start; | ||
1016 | } params; | ||
1017 | }; | ||
1018 | |||
1019 | struct bnx2x_func_sp_drv_ops { | ||
1020 | /* Init tool + runtime initialization: | ||
1021 | * - Common Chip | ||
1022 | * - Common (per Path) | ||
1023 | * - Port | ||
1024 | * - Function phases | ||
1025 | */ | ||
1026 | int (*init_hw_cmn_chip)(struct bnx2x *bp); | ||
1027 | int (*init_hw_cmn)(struct bnx2x *bp); | ||
1028 | int (*init_hw_port)(struct bnx2x *bp); | ||
1029 | int (*init_hw_func)(struct bnx2x *bp); | ||
1030 | |||
1031 | /* Reset Function HW: Common, Port, Function phases. */ | ||
1032 | void (*reset_hw_cmn)(struct bnx2x *bp); | ||
1033 | void (*reset_hw_port)(struct bnx2x *bp); | ||
1034 | void (*reset_hw_func)(struct bnx2x *bp); | ||
1035 | |||
1036 | /* Init/Free GUNZIP resources */ | ||
1037 | int (*gunzip_init)(struct bnx2x *bp); | ||
1038 | void (*gunzip_end)(struct bnx2x *bp); | ||
1039 | |||
1040 | /* Prepare/Release FW resources */ | ||
1041 | int (*init_fw)(struct bnx2x *bp); | ||
1042 | void (*release_fw)(struct bnx2x *bp); | ||
1043 | }; | ||
1044 | |||
1045 | struct bnx2x_func_sp_obj { | ||
1046 | enum bnx2x_func_state state, next_state; | ||
1047 | |||
1048 | /* BNX2X_FUNC_CMD_XX bits. This object implements "one | ||
1049 | * pending" paradigm but for debug and tracing purposes it's | ||
1050 | * more convinient to have different bits for different | ||
1051 | * commands. | ||
1052 | */ | ||
1053 | unsigned long pending; | ||
1054 | |||
1055 | /* Buffer to use as a ramrod data and its mapping */ | ||
1056 | void *rdata; | ||
1057 | dma_addr_t rdata_mapping; | ||
1058 | |||
1059 | /* this mutex validates that when pending flag is taken, the next | ||
1060 | * ramrod to be sent will be the one set the pending bit | ||
1061 | */ | ||
1062 | struct mutex one_pending_mutex; | ||
1063 | |||
1064 | /* Driver interface */ | ||
1065 | struct bnx2x_func_sp_drv_ops *drv; | ||
1066 | |||
1067 | /** | ||
1068 | * Performs one state change according to the given parameters. | ||
1069 | * | ||
1070 | * @return 0 in case of success and negative value otherwise. | ||
1071 | */ | ||
1072 | int (*send_cmd)(struct bnx2x *bp, | ||
1073 | struct bnx2x_func_state_params *params); | ||
1074 | |||
1075 | /** | ||
1076 | * Checks that the requested state transition is legal. | ||
1077 | */ | ||
1078 | int (*check_transition)(struct bnx2x *bp, | ||
1079 | struct bnx2x_func_sp_obj *o, | ||
1080 | struct bnx2x_func_state_params *params); | ||
1081 | |||
1082 | /** | ||
1083 | * Completes the pending command. | ||
1084 | */ | ||
1085 | int (*complete_cmd)(struct bnx2x *bp, | ||
1086 | struct bnx2x_func_sp_obj *o, | ||
1087 | enum bnx2x_func_cmd cmd); | ||
1088 | |||
1089 | int (*wait_comp)(struct bnx2x *bp, struct bnx2x_func_sp_obj *o, | ||
1090 | enum bnx2x_func_cmd cmd); | ||
1091 | }; | ||
1092 | |||
1093 | /********************** Interfaces ********************************************/ | ||
1094 | /* Queueable objects set */ | ||
1095 | union bnx2x_qable_obj { | ||
1096 | struct bnx2x_vlan_mac_obj vlan_mac; | ||
1097 | }; | ||
1098 | /************** Function state update *********/ | ||
1099 | void bnx2x_init_func_obj(struct bnx2x *bp, | ||
1100 | struct bnx2x_func_sp_obj *obj, | ||
1101 | void *rdata, dma_addr_t rdata_mapping, | ||
1102 | struct bnx2x_func_sp_drv_ops *drv_iface); | ||
1103 | |||
1104 | int bnx2x_func_state_change(struct bnx2x *bp, | ||
1105 | struct bnx2x_func_state_params *params); | ||
1106 | |||
1107 | /******************* Queue State **************/ | ||
1108 | void bnx2x_init_queue_obj(struct bnx2x *bp, | ||
1109 | struct bnx2x_queue_sp_obj *obj, u8 cl_id, u32 cid, | ||
1110 | u8 func_id, void *rdata, dma_addr_t rdata_mapping, | ||
1111 | unsigned long type); | ||
1112 | |||
1113 | int bnx2x_queue_state_change(struct bnx2x *bp, | ||
1114 | struct bnx2x_queue_state_params *params); | ||
1115 | |||
1116 | /********************* VLAN-MAC ****************/ | ||
1117 | void bnx2x_init_mac_obj(struct bnx2x *bp, | ||
1118 | struct bnx2x_vlan_mac_obj *mac_obj, | ||
1119 | u8 cl_id, u32 cid, u8 func_id, void *rdata, | ||
1120 | dma_addr_t rdata_mapping, int state, | ||
1121 | unsigned long *pstate, bnx2x_obj_type type, | ||
1122 | struct bnx2x_credit_pool_obj *macs_pool); | ||
1123 | |||
1124 | void bnx2x_init_vlan_obj(struct bnx2x *bp, | ||
1125 | struct bnx2x_vlan_mac_obj *vlan_obj, | ||
1126 | u8 cl_id, u32 cid, u8 func_id, void *rdata, | ||
1127 | dma_addr_t rdata_mapping, int state, | ||
1128 | unsigned long *pstate, bnx2x_obj_type type, | ||
1129 | struct bnx2x_credit_pool_obj *vlans_pool); | ||
1130 | |||
1131 | void bnx2x_init_vlan_mac_obj(struct bnx2x *bp, | ||
1132 | struct bnx2x_vlan_mac_obj *vlan_mac_obj, | ||
1133 | u8 cl_id, u32 cid, u8 func_id, void *rdata, | ||
1134 | dma_addr_t rdata_mapping, int state, | ||
1135 | unsigned long *pstate, bnx2x_obj_type type, | ||
1136 | struct bnx2x_credit_pool_obj *macs_pool, | ||
1137 | struct bnx2x_credit_pool_obj *vlans_pool); | ||
1138 | |||
1139 | int bnx2x_config_vlan_mac(struct bnx2x *bp, | ||
1140 | struct bnx2x_vlan_mac_ramrod_params *p); | ||
1141 | |||
1142 | int bnx2x_vlan_mac_move(struct bnx2x *bp, | ||
1143 | struct bnx2x_vlan_mac_ramrod_params *p, | ||
1144 | struct bnx2x_vlan_mac_obj *dest_o); | ||
1145 | |||
1146 | /********************* RX MODE ****************/ | ||
1147 | |||
1148 | void bnx2x_init_rx_mode_obj(struct bnx2x *bp, | ||
1149 | struct bnx2x_rx_mode_obj *o); | ||
1150 | |||
1151 | /** | ||
1152 | * Send and RX_MODE ramrod according to the provided parameters. | ||
1153 | * | ||
1154 | * @param bp | ||
1155 | * @param p Command parameters | ||
1156 | * | ||
1157 | * @return 0 - if operation was successfull and there is no pending completions, | ||
1158 | * positive number - if there are pending completions, | ||
1159 | * negative - if there were errors | ||
1160 | */ | ||
1161 | int bnx2x_config_rx_mode(struct bnx2x *bp, | ||
1162 | struct bnx2x_rx_mode_ramrod_params *p); | ||
1163 | |||
1164 | /****************** MULTICASTS ****************/ | ||
1165 | |||
1166 | void bnx2x_init_mcast_obj(struct bnx2x *bp, | ||
1167 | struct bnx2x_mcast_obj *mcast_obj, | ||
1168 | u8 mcast_cl_id, u32 mcast_cid, u8 func_id, | ||
1169 | u8 engine_id, void *rdata, dma_addr_t rdata_mapping, | ||
1170 | int state, unsigned long *pstate, | ||
1171 | bnx2x_obj_type type); | ||
1172 | |||
1173 | /** | ||
1174 | * Configure multicast MACs list. May configure a new list | ||
1175 | * provided in p->mcast_list (BNX2X_MCAST_CMD_ADD), clean up | ||
1176 | * (BNX2X_MCAST_CMD_DEL) or restore (BNX2X_MCAST_CMD_RESTORE) a current | ||
1177 | * configuration, continue to execute the pending commands | ||
1178 | * (BNX2X_MCAST_CMD_CONT). | ||
1179 | * | ||
1180 | * If previous command is still pending or if number of MACs to | ||
1181 | * configure is more that maximum number of MACs in one command, | ||
1182 | * the current command will be enqueued to the tail of the | ||
1183 | * pending commands list. | ||
1184 | * | ||
1185 | * @param bp | ||
1186 | * @param p | ||
1187 | * @param command to execute: BNX2X_MCAST_CMD_X | ||
1188 | * | ||
1189 | * @return 0 is operation was sucessfull and there are no pending completions, | ||
1190 | * negative if there were errors, positive if there are pending | ||
1191 | * completions. | ||
1192 | */ | ||
1193 | int bnx2x_config_mcast(struct bnx2x *bp, | ||
1194 | struct bnx2x_mcast_ramrod_params *p, int cmd); | ||
1195 | |||
1196 | /****************** CREDIT POOL ****************/ | ||
1197 | void bnx2x_init_mac_credit_pool(struct bnx2x *bp, | ||
1198 | struct bnx2x_credit_pool_obj *p, u8 func_id, | ||
1199 | u8 func_num); | ||
1200 | void bnx2x_init_vlan_credit_pool(struct bnx2x *bp, | ||
1201 | struct bnx2x_credit_pool_obj *p, u8 func_id, | ||
1202 | u8 func_num); | ||
1203 | |||
1204 | |||
1205 | /****************** RSS CONFIGURATION ****************/ | ||
1206 | void bnx2x_init_rss_config_obj(struct bnx2x *bp, | ||
1207 | struct bnx2x_rss_config_obj *rss_obj, | ||
1208 | u8 cl_id, u32 cid, u8 func_id, u8 engine_id, | ||
1209 | void *rdata, dma_addr_t rdata_mapping, | ||
1210 | int state, unsigned long *pstate, | ||
1211 | bnx2x_obj_type type); | ||
1212 | |||
1213 | /** | ||
1214 | * Updates RSS configuration according to provided parameters. | ||
1215 | * | ||
1216 | * @param bp | ||
1217 | * @param p | ||
1218 | * | ||
1219 | * @return 0 in case of success | ||
1220 | */ | ||
1221 | int bnx2x_config_rss(struct bnx2x *bp, | ||
1222 | struct bnx2x_config_rss_params *p); | ||
1223 | |||
1224 | /** | ||
1225 | * Return the current ind_table configuration. | ||
1226 | * | ||
1227 | * @param bp | ||
1228 | * @param ind_table buffer to fill with the current indirection | ||
1229 | * table content. Should be at least | ||
1230 | * T_ETH_INDIRECTION_TABLE_SIZE bytes long. | ||
1231 | */ | ||
1232 | void bnx2x_get_rss_ind_table(struct bnx2x_rss_config_obj *rss_obj, | ||
1233 | u8 *ind_table); | ||
1234 | |||
1235 | #endif /* BNX2X_SP_VERBS */ | ||