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