1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #ifndef BNX2X_SP_VERBS
22 #define BNX2X_SP_VERBS
23
24 struct bnx2x;
25 struct eth_context;
26
27
28 enum {
29 RAMROD_TX,
30 RAMROD_RX,
31
32 RAMROD_COMP_WAIT,
33
34 RAMROD_DRV_CLR_ONLY,
35
36 RAMROD_RESTORE,
37
38 RAMROD_EXEC,
39
40
41
42
43 RAMROD_CONT,
44
45
46
47
48
49 RAMROD_RETRY,
50 };
51
52 typedef enum {
53 BNX2X_OBJ_TYPE_RX,
54 BNX2X_OBJ_TYPE_TX,
55 BNX2X_OBJ_TYPE_RX_TX,
56 } bnx2x_obj_type;
57
58
59 enum {
60 BNX2X_FILTER_MAC_PENDING,
61 BNX2X_FILTER_VLAN_PENDING,
62 BNX2X_FILTER_VLAN_MAC_PENDING,
63 BNX2X_FILTER_RX_MODE_PENDING,
64 BNX2X_FILTER_RX_MODE_SCHED,
65 BNX2X_FILTER_ISCSI_ETH_START_SCHED,
66 BNX2X_FILTER_ISCSI_ETH_STOP_SCHED,
67 BNX2X_FILTER_FCOE_ETH_START_SCHED,
68 BNX2X_FILTER_FCOE_ETH_STOP_SCHED,
69 BNX2X_FILTER_MCAST_PENDING,
70 BNX2X_FILTER_MCAST_SCHED,
71 BNX2X_FILTER_RSS_CONF_PENDING,
72 BNX2X_AFEX_FCOE_Q_UPDATE_PENDING,
73 BNX2X_AFEX_PENDING_VIFSET_MCP_ACK
74 };
75
76 struct bnx2x_raw_obj {
77 u8 func_id;
78
79
80 u8 cl_id;
81 u32 cid;
82
83
84 void *rdata;
85 dma_addr_t rdata_mapping;
86
87
88 int state;
89 unsigned long *pstate;
90
91 bnx2x_obj_type obj_type;
92
93 int (*wait_comp)(struct bnx2x *bp,
94 struct bnx2x_raw_obj *o);
95
96 bool (*check_pending)(struct bnx2x_raw_obj *o);
97 void (*clear_pending)(struct bnx2x_raw_obj *o);
98 void (*set_pending)(struct bnx2x_raw_obj *o);
99 };
100
101
102 struct bnx2x_mac_ramrod_data {
103 u8 mac[ETH_ALEN];
104 u8 is_inner_mac;
105 };
106
107 struct bnx2x_vlan_ramrod_data {
108 u16 vlan;
109 };
110
111 struct bnx2x_vlan_mac_ramrod_data {
112 u8 mac[ETH_ALEN];
113 u8 is_inner_mac;
114 u16 vlan;
115 };
116
117 union bnx2x_classification_ramrod_data {
118 struct bnx2x_mac_ramrod_data mac;
119 struct bnx2x_vlan_ramrod_data vlan;
120 struct bnx2x_vlan_mac_ramrod_data vlan_mac;
121 };
122
123
124 enum bnx2x_vlan_mac_cmd {
125 BNX2X_VLAN_MAC_ADD,
126 BNX2X_VLAN_MAC_DEL,
127 BNX2X_VLAN_MAC_MOVE,
128 };
129
130 struct bnx2x_vlan_mac_data {
131
132 enum bnx2x_vlan_mac_cmd cmd;
133
134
135
136 unsigned long vlan_mac_flags;
137
138
139 struct bnx2x_vlan_mac_obj *target_obj;
140
141 union bnx2x_classification_ramrod_data u;
142 };
143
144
145 union bnx2x_exe_queue_cmd_data {
146 struct bnx2x_vlan_mac_data vlan_mac;
147
148 struct {
149
150 } mcast;
151 };
152
153 struct bnx2x_exeq_elem {
154 struct list_head link;
155
156
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
179
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 struct list_head exe_queue;
195
196
197 struct list_head pending_comp;
198
199 spinlock_t lock;
200
201
202 int exe_chunk_len;
203
204 union bnx2x_qable_obj *owner;
205
206
207
208
209
210
211
212
213 exe_q_validate validate;
214
215
216
217
218
219 exe_q_remove remove;
220
221
222
223
224
225
226
227
228
229 exe_q_optimize optimize;
230
231
232
233
234 exe_q_execute execute;
235
236
237
238
239
240 exe_q_get get;
241 };
242
243
244
245
246
247 struct bnx2x_vlan_mac_registry_elem {
248 struct list_head link;
249
250
251
252
253
254 int cam_offset;
255
256
257 unsigned long vlan_mac_flags;
258
259 union bnx2x_classification_ramrod_data u;
260 };
261
262
263 enum {
264 BNX2X_UC_LIST_MAC,
265 BNX2X_ETH_MAC,
266 BNX2X_ISCSI_ETH_MAC,
267 BNX2X_NETQ_ETH_MAC,
268 BNX2X_VLAN,
269 BNX2X_DONT_CONSUME_CAM_CREDIT,
270 BNX2X_DONT_CONSUME_CAM_CREDIT_DEST,
271 };
272
273 #define BNX2X_VLAN_MAC_CMP_MASK (1 << BNX2X_UC_LIST_MAC | \
274 1 << BNX2X_ETH_MAC | \
275 1 << BNX2X_ISCSI_ETH_MAC | \
276 1 << BNX2X_NETQ_ETH_MAC | \
277 1 << BNX2X_VLAN)
278 #define BNX2X_VLAN_MAC_CMP_FLAGS(flags) \
279 ((flags) & BNX2X_VLAN_MAC_CMP_MASK)
280
281 struct bnx2x_vlan_mac_ramrod_params {
282
283 struct bnx2x_vlan_mac_obj *vlan_mac_obj;
284
285
286 unsigned long ramrod_flags;
287
288
289 struct bnx2x_vlan_mac_data user_req;
290 };
291
292 struct bnx2x_vlan_mac_obj {
293 struct bnx2x_raw_obj raw;
294
295
296
297
298 struct list_head head;
299
300
301
302 u8 head_reader;
303 bool head_exe_request;
304 unsigned long saved_ramrod_flags;
305
306
307 struct bnx2x_exe_queue_obj exe_queue;
308
309
310 struct bnx2x_credit_pool_obj *macs_pool;
311
312
313 struct bnx2x_credit_pool_obj *vlans_pool;
314
315
316 int ramrod_cmd;
317
318
319
320
321
322
323
324
325
326
327
328 int (*get_n_elements)(struct bnx2x *bp,
329 struct bnx2x_vlan_mac_obj *o, int n, u8 *base,
330 u8 stride, u8 size);
331
332
333
334
335
336
337
338 int (*check_add)(struct bnx2x *bp,
339 struct bnx2x_vlan_mac_obj *o,
340 union bnx2x_classification_ramrod_data *data);
341
342
343
344
345
346
347 struct bnx2x_vlan_mac_registry_elem *
348 (*check_del)(struct bnx2x *bp,
349 struct bnx2x_vlan_mac_obj *o,
350 union bnx2x_classification_ramrod_data *data);
351
352
353
354
355
356
357 bool (*check_move)(struct bnx2x *bp,
358 struct bnx2x_vlan_mac_obj *src_o,
359 struct bnx2x_vlan_mac_obj *dst_o,
360 union bnx2x_classification_ramrod_data *data);
361
362
363
364
365
366 bool (*get_credit)(struct bnx2x_vlan_mac_obj *o);
367 bool (*put_credit)(struct bnx2x_vlan_mac_obj *o);
368 bool (*get_cam_offset)(struct bnx2x_vlan_mac_obj *o, int *offset);
369 bool (*put_cam_offset)(struct bnx2x_vlan_mac_obj *o, int offset);
370
371
372
373
374 void (*set_one_rule)(struct bnx2x *bp,
375 struct bnx2x_vlan_mac_obj *o,
376 struct bnx2x_exeq_elem *elem, int rule_idx,
377 int cam_offset);
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396 int (*delete_all)(struct bnx2x *bp,
397 struct bnx2x_vlan_mac_obj *o,
398 unsigned long *vlan_mac_flags,
399 unsigned long *ramrod_flags);
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416 int (*restore)(struct bnx2x *bp,
417 struct bnx2x_vlan_mac_ramrod_params *p,
418 struct bnx2x_vlan_mac_registry_elem **ppos);
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437 int (*complete)(struct bnx2x *bp, struct bnx2x_vlan_mac_obj *o,
438 union event_ring_elem *cqe,
439 unsigned long *ramrod_flags);
440
441
442
443
444
445
446 int (*wait)(struct bnx2x *bp, struct bnx2x_vlan_mac_obj *o);
447 };
448
449 enum {
450 BNX2X_LLH_CAM_ISCSI_ETH_LINE = 0,
451 BNX2X_LLH_CAM_ETH_LINE,
452 BNX2X_LLH_CAM_MAX_PF_LINE = NIG_REG_LLH1_FUNC_MEM_SIZE / 2
453 };
454
455
456
457
458
459
460 enum {
461 BNX2X_RX_MODE_FCOE_ETH,
462 BNX2X_RX_MODE_ISCSI_ETH,
463 };
464
465 enum {
466 BNX2X_ACCEPT_UNICAST,
467 BNX2X_ACCEPT_MULTICAST,
468 BNX2X_ACCEPT_ALL_UNICAST,
469 BNX2X_ACCEPT_ALL_MULTICAST,
470 BNX2X_ACCEPT_BROADCAST,
471 BNX2X_ACCEPT_UNMATCHED,
472 BNX2X_ACCEPT_ANY_VLAN
473 };
474
475 struct bnx2x_rx_mode_ramrod_params {
476 struct bnx2x_rx_mode_obj *rx_mode_obj;
477 unsigned long *pstate;
478 int state;
479 u8 cl_id;
480 u32 cid;
481 u8 func_id;
482 unsigned long ramrod_flags;
483 unsigned long rx_mode_flags;
484
485
486
487
488 void *rdata;
489 dma_addr_t rdata_mapping;
490
491
492 unsigned long rx_accept_flags;
493
494
495 unsigned long tx_accept_flags;
496 };
497
498 struct bnx2x_rx_mode_obj {
499 int (*config_rx_mode)(struct bnx2x *bp,
500 struct bnx2x_rx_mode_ramrod_params *p);
501
502 int (*wait_comp)(struct bnx2x *bp,
503 struct bnx2x_rx_mode_ramrod_params *p);
504 };
505
506
507
508 struct bnx2x_mcast_list_elem {
509 struct list_head link;
510 u8 *mac;
511 };
512
513 union bnx2x_mcast_config_data {
514 u8 *mac;
515 u8 bin;
516 };
517
518 struct bnx2x_mcast_ramrod_params {
519 struct bnx2x_mcast_obj *mcast_obj;
520
521
522 unsigned long ramrod_flags;
523
524 struct list_head mcast_list;
525
526
527
528
529
530
531
532
533 int mcast_list_len;
534 };
535
536 enum bnx2x_mcast_cmd {
537 BNX2X_MCAST_CMD_ADD,
538 BNX2X_MCAST_CMD_CONT,
539 BNX2X_MCAST_CMD_DEL,
540 BNX2X_MCAST_CMD_RESTORE,
541
542
543
544
545
546
547 BNX2X_MCAST_CMD_SET,
548 BNX2X_MCAST_CMD_SET_ADD,
549 BNX2X_MCAST_CMD_SET_DEL,
550 };
551
552 struct bnx2x_mcast_obj {
553 struct bnx2x_raw_obj raw;
554
555 union {
556 struct {
557 #define BNX2X_MCAST_BINS_NUM 256
558 #define BNX2X_MCAST_VEC_SZ (BNX2X_MCAST_BINS_NUM / 64)
559 u64 vec[BNX2X_MCAST_VEC_SZ];
560
561
562
563
564
565 int num_bins_set;
566 } aprox_match;
567
568 struct {
569 struct list_head macs;
570 int num_macs_set;
571 } exact_match;
572 } registry;
573
574
575 struct list_head pending_cmds_head;
576
577
578 int sched_state;
579
580
581 int max_cmd_len;
582
583
584
585
586 int total_pending_num;
587
588 u8 engine_id;
589
590
591
592
593 int (*config_mcast)(struct bnx2x *bp,
594 struct bnx2x_mcast_ramrod_params *p,
595 enum bnx2x_mcast_cmd cmd);
596
597
598
599
600
601
602
603
604
605
606
607
608 int (*hdl_restore)(struct bnx2x *bp, struct bnx2x_mcast_obj *o,
609 int start_bin, int *rdata_idx);
610
611 int (*enqueue_cmd)(struct bnx2x *bp, struct bnx2x_mcast_obj *o,
612 struct bnx2x_mcast_ramrod_params *p,
613 enum bnx2x_mcast_cmd cmd);
614
615 void (*set_one_rule)(struct bnx2x *bp,
616 struct bnx2x_mcast_obj *o, int idx,
617 union bnx2x_mcast_config_data *cfg_data,
618 enum bnx2x_mcast_cmd cmd);
619
620
621
622
623 bool (*check_pending)(struct bnx2x_mcast_obj *o);
624
625
626
627
628 void (*set_sched)(struct bnx2x_mcast_obj *o);
629 void (*clear_sched)(struct bnx2x_mcast_obj *o);
630 bool (*check_sched)(struct bnx2x_mcast_obj *o);
631
632
633 int (*wait_comp)(struct bnx2x *bp, struct bnx2x_mcast_obj *o);
634
635
636
637
638
639
640 int (*validate)(struct bnx2x *bp,
641 struct bnx2x_mcast_ramrod_params *p,
642 enum bnx2x_mcast_cmd cmd);
643
644
645
646
647 void (*revert)(struct bnx2x *bp,
648 struct bnx2x_mcast_ramrod_params *p,
649 int old_num_bins,
650 enum bnx2x_mcast_cmd cmd);
651
652 int (*get_registry_size)(struct bnx2x_mcast_obj *o);
653 void (*set_registry_size)(struct bnx2x_mcast_obj *o, int n);
654 };
655
656
657 struct bnx2x_credit_pool_obj {
658
659
660 atomic_t credit;
661
662
663 int pool_sz;
664
665
666
667
668
669
670
671 #define BNX2X_POOL_VEC_SIZE (MAX_MAC_CREDIT_E2 / 64)
672 u64 pool_mirror[BNX2X_POOL_VEC_SIZE];
673
674
675 int base_pool_offset;
676
677
678
679
680
681
682 bool (*get_entry)(struct bnx2x_credit_pool_obj *o, int *entry);
683
684
685
686
687
688
689
690 bool (*put_entry)(struct bnx2x_credit_pool_obj *o, int entry);
691
692
693
694
695
696
697
698 bool (*get)(struct bnx2x_credit_pool_obj *o, int cnt);
699
700
701
702
703
704
705
706 bool (*put)(struct bnx2x_credit_pool_obj *o, int cnt);
707
708
709
710
711 int (*check)(struct bnx2x_credit_pool_obj *o);
712 };
713
714
715 enum {
716
717 BNX2X_RSS_MODE_DISABLED,
718 BNX2X_RSS_MODE_REGULAR,
719
720 BNX2X_RSS_SET_SRCH,
721
722 BNX2X_RSS_IPV4,
723 BNX2X_RSS_IPV4_TCP,
724 BNX2X_RSS_IPV4_UDP,
725 BNX2X_RSS_IPV6,
726 BNX2X_RSS_IPV6_TCP,
727 BNX2X_RSS_IPV6_UDP,
728
729 BNX2X_RSS_IPV4_VXLAN,
730 BNX2X_RSS_IPV6_VXLAN,
731 BNX2X_RSS_TUNN_INNER_HDRS,
732 };
733
734 struct bnx2x_config_rss_params {
735 struct bnx2x_rss_config_obj *rss_obj;
736
737
738 unsigned long ramrod_flags;
739
740
741 unsigned long rss_flags;
742
743
744 u8 rss_result_mask;
745
746
747 u8 ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
748
749
750 u32 rss_key[10];
751
752
753 u16 toe_rss_bitmap;
754 };
755
756 struct bnx2x_rss_config_obj {
757 struct bnx2x_raw_obj raw;
758
759
760 u8 engine_id;
761
762
763 u8 ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
764
765
766 u8 udp_rss_v4;
767 u8 udp_rss_v6;
768
769 int (*config_rss)(struct bnx2x *bp,
770 struct bnx2x_config_rss_params *p);
771 };
772
773
774
775
776 enum {
777 BNX2X_Q_UPDATE_IN_VLAN_REM,
778 BNX2X_Q_UPDATE_IN_VLAN_REM_CHNG,
779 BNX2X_Q_UPDATE_OUT_VLAN_REM,
780 BNX2X_Q_UPDATE_OUT_VLAN_REM_CHNG,
781 BNX2X_Q_UPDATE_ANTI_SPOOF,
782 BNX2X_Q_UPDATE_ANTI_SPOOF_CHNG,
783 BNX2X_Q_UPDATE_ACTIVATE,
784 BNX2X_Q_UPDATE_ACTIVATE_CHNG,
785 BNX2X_Q_UPDATE_DEF_VLAN_EN,
786 BNX2X_Q_UPDATE_DEF_VLAN_EN_CHNG,
787 BNX2X_Q_UPDATE_SILENT_VLAN_REM_CHNG,
788 BNX2X_Q_UPDATE_SILENT_VLAN_REM,
789 BNX2X_Q_UPDATE_TX_SWITCHING_CHNG,
790 BNX2X_Q_UPDATE_TX_SWITCHING,
791 BNX2X_Q_UPDATE_PTP_PKTS_CHNG,
792 BNX2X_Q_UPDATE_PTP_PKTS,
793 };
794
795
796 enum bnx2x_q_state {
797 BNX2X_Q_STATE_RESET,
798 BNX2X_Q_STATE_INITIALIZED,
799 BNX2X_Q_STATE_ACTIVE,
800 BNX2X_Q_STATE_MULTI_COS,
801 BNX2X_Q_STATE_MCOS_TERMINATED,
802 BNX2X_Q_STATE_INACTIVE,
803 BNX2X_Q_STATE_STOPPED,
804 BNX2X_Q_STATE_TERMINATED,
805 BNX2X_Q_STATE_FLRED,
806 BNX2X_Q_STATE_MAX,
807 };
808
809
810 enum bnx2x_q_logical_state {
811 BNX2X_Q_LOGICAL_STATE_ACTIVE,
812 BNX2X_Q_LOGICAL_STATE_STOPPED,
813 };
814
815
816 enum bnx2x_queue_cmd {
817 BNX2X_Q_CMD_INIT,
818 BNX2X_Q_CMD_SETUP,
819 BNX2X_Q_CMD_SETUP_TX_ONLY,
820 BNX2X_Q_CMD_DEACTIVATE,
821 BNX2X_Q_CMD_ACTIVATE,
822 BNX2X_Q_CMD_UPDATE,
823 BNX2X_Q_CMD_UPDATE_TPA,
824 BNX2X_Q_CMD_HALT,
825 BNX2X_Q_CMD_CFC_DEL,
826 BNX2X_Q_CMD_TERMINATE,
827 BNX2X_Q_CMD_EMPTY,
828 BNX2X_Q_CMD_MAX,
829 };
830
831
832 enum {
833 BNX2X_Q_FLG_TPA,
834 BNX2X_Q_FLG_TPA_IPV6,
835 BNX2X_Q_FLG_TPA_GRO,
836 BNX2X_Q_FLG_STATS,
837 BNX2X_Q_FLG_ZERO_STATS,
838 BNX2X_Q_FLG_ACTIVE,
839 BNX2X_Q_FLG_OV,
840 BNX2X_Q_FLG_VLAN,
841 BNX2X_Q_FLG_COS,
842 BNX2X_Q_FLG_HC,
843 BNX2X_Q_FLG_HC_EN,
844 BNX2X_Q_FLG_DHC,
845 BNX2X_Q_FLG_FCOE,
846 BNX2X_Q_FLG_LEADING_RSS,
847 BNX2X_Q_FLG_MCAST,
848 BNX2X_Q_FLG_DEF_VLAN,
849 BNX2X_Q_FLG_TX_SWITCH,
850 BNX2X_Q_FLG_TX_SEC,
851 BNX2X_Q_FLG_ANTI_SPOOF,
852 BNX2X_Q_FLG_SILENT_VLAN_REM,
853 BNX2X_Q_FLG_FORCE_DEFAULT_PRI,
854 BNX2X_Q_FLG_REFUSE_OUTBAND_VLAN,
855 BNX2X_Q_FLG_PCSUM_ON_PKT,
856 BNX2X_Q_FLG_TUN_INC_INNER_IP_ID
857 };
858
859
860 enum bnx2x_q_type {
861
862
863
864 BNX2X_Q_TYPE_HAS_RX,
865 BNX2X_Q_TYPE_HAS_TX,
866 };
867
868 #define BNX2X_PRIMARY_CID_INDEX 0
869 #define BNX2X_MULTI_TX_COS_E1X 3
870 #define BNX2X_MULTI_TX_COS_E2_E3A0 2
871 #define BNX2X_MULTI_TX_COS_E3B0 3
872 #define BNX2X_MULTI_TX_COS 3
873
874 #define MAC_PAD (ALIGN(ETH_ALEN, sizeof(u32)) - ETH_ALEN)
875
876
877
878 #define FW_DMAE_CMD_ID 6
879
880 struct bnx2x_queue_init_params {
881 struct {
882 unsigned long flags;
883 u16 hc_rate;
884 u8 fw_sb_id;
885 u8 sb_cq_index;
886 } tx;
887
888 struct {
889 unsigned long flags;
890 u16 hc_rate;
891 u8 fw_sb_id;
892 u8 sb_cq_index;
893 } rx;
894
895
896 struct eth_context *cxts[BNX2X_MULTI_TX_COS];
897
898
899 u8 max_cos;
900 };
901
902 struct bnx2x_queue_terminate_params {
903
904 u8 cid_index;
905 };
906
907 struct bnx2x_queue_cfc_del_params {
908
909 u8 cid_index;
910 };
911
912 struct bnx2x_queue_update_params {
913 unsigned long update_flags;
914 u16 def_vlan;
915 u16 silent_removal_value;
916 u16 silent_removal_mask;
917
918 u8 cid_index;
919 };
920
921 struct bnx2x_queue_update_tpa_params {
922 dma_addr_t sge_map;
923 u8 update_ipv4;
924 u8 update_ipv6;
925 u8 max_tpa_queues;
926 u8 max_sges_pkt;
927 u8 complete_on_both_clients;
928 u8 dont_verify_thr;
929 u8 tpa_mode;
930 u8 _pad;
931
932 u16 sge_buff_sz;
933 u16 max_agg_sz;
934
935 u16 sge_pause_thr_low;
936 u16 sge_pause_thr_high;
937 };
938
939 struct rxq_pause_params {
940 u16 bd_th_lo;
941 u16 bd_th_hi;
942 u16 rcq_th_lo;
943 u16 rcq_th_hi;
944 u16 sge_th_lo;
945 u16 sge_th_hi;
946 u16 pri_map;
947 };
948
949
950 struct bnx2x_general_setup_params {
951
952 u8 stat_id;
953
954 u8 spcl_id;
955 u16 mtu;
956 u8 cos;
957
958 u8 fp_hsi;
959 };
960
961 struct bnx2x_rxq_setup_params {
962
963 dma_addr_t dscr_map;
964 dma_addr_t sge_map;
965 dma_addr_t rcq_map;
966 dma_addr_t rcq_np_map;
967
968 u16 drop_flags;
969 u16 buf_sz;
970 u8 fw_sb_id;
971 u8 cl_qzone_id;
972
973
974 u16 tpa_agg_sz;
975 u16 sge_buf_sz;
976 u8 max_sges_pkt;
977 u8 max_tpa_queues;
978 u8 rss_engine_id;
979
980
981 u8 mcast_engine_id;
982
983 u8 cache_line_log;
984
985 u8 sb_cq_index;
986
987
988 u16 silent_removal_value;
989 u16 silent_removal_mask;
990 };
991
992 struct bnx2x_txq_setup_params {
993
994 dma_addr_t dscr_map;
995
996 u8 fw_sb_id;
997 u8 sb_cq_index;
998 u8 cos;
999 u16 traffic_type;
1000
1001 u8 tss_leading_cl_id;
1002
1003
1004 u16 default_vlan;
1005 };
1006
1007 struct bnx2x_queue_setup_params {
1008 struct bnx2x_general_setup_params gen_params;
1009 struct bnx2x_txq_setup_params txq_params;
1010 struct bnx2x_rxq_setup_params rxq_params;
1011 struct rxq_pause_params pause_params;
1012 unsigned long flags;
1013 };
1014
1015 struct bnx2x_queue_setup_tx_only_params {
1016 struct bnx2x_general_setup_params gen_params;
1017 struct bnx2x_txq_setup_params txq_params;
1018 unsigned long flags;
1019
1020 u8 cid_index;
1021 };
1022
1023 struct bnx2x_queue_state_params {
1024 struct bnx2x_queue_sp_obj *q_obj;
1025
1026
1027 enum bnx2x_queue_cmd cmd;
1028
1029
1030 unsigned long ramrod_flags;
1031
1032
1033 union {
1034 struct bnx2x_queue_update_params update;
1035 struct bnx2x_queue_update_tpa_params update_tpa;
1036 struct bnx2x_queue_setup_params setup;
1037 struct bnx2x_queue_init_params init;
1038 struct bnx2x_queue_setup_tx_only_params tx_only;
1039 struct bnx2x_queue_terminate_params terminate;
1040 struct bnx2x_queue_cfc_del_params cfc_del;
1041 } params;
1042 };
1043
1044 struct bnx2x_viflist_params {
1045 u8 echo_res;
1046 u8 func_bit_map_res;
1047 };
1048
1049 struct bnx2x_queue_sp_obj {
1050 u32 cids[BNX2X_MULTI_TX_COS];
1051 u8 cl_id;
1052 u8 func_id;
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062 u8 max_cos;
1063 u8 num_tx_only, next_tx_only;
1064
1065 enum bnx2x_q_state state, next_state;
1066
1067
1068 unsigned long type;
1069
1070
1071
1072
1073
1074
1075 unsigned long pending;
1076
1077
1078 void *rdata;
1079 dma_addr_t rdata_mapping;
1080
1081
1082
1083
1084
1085
1086 int (*send_cmd)(struct bnx2x *bp,
1087 struct bnx2x_queue_state_params *params);
1088
1089
1090
1091
1092 int (*set_pending)(struct bnx2x_queue_sp_obj *o,
1093 struct bnx2x_queue_state_params *params);
1094
1095
1096
1097
1098 int (*check_transition)(struct bnx2x *bp,
1099 struct bnx2x_queue_sp_obj *o,
1100 struct bnx2x_queue_state_params *params);
1101
1102
1103
1104
1105 int (*complete_cmd)(struct bnx2x *bp,
1106 struct bnx2x_queue_sp_obj *o,
1107 enum bnx2x_queue_cmd);
1108
1109 int (*wait_comp)(struct bnx2x *bp,
1110 struct bnx2x_queue_sp_obj *o,
1111 enum bnx2x_queue_cmd cmd);
1112 };
1113
1114
1115
1116
1117 enum {
1118 BNX2X_F_UPDATE_TX_SWITCH_SUSPEND_CHNG,
1119 BNX2X_F_UPDATE_TX_SWITCH_SUSPEND,
1120 BNX2X_F_UPDATE_SD_VLAN_TAG_CHNG,
1121 BNX2X_F_UPDATE_SD_VLAN_ETH_TYPE_CHNG,
1122 BNX2X_F_UPDATE_VLAN_FORCE_PRIO_CHNG,
1123 BNX2X_F_UPDATE_VLAN_FORCE_PRIO_FLAG,
1124 BNX2X_F_UPDATE_TUNNEL_CFG_CHNG,
1125 BNX2X_F_UPDATE_TUNNEL_INNER_CLSS_L2GRE,
1126 BNX2X_F_UPDATE_TUNNEL_INNER_CLSS_VXLAN,
1127 BNX2X_F_UPDATE_TUNNEL_INNER_CLSS_L2GENEVE,
1128 BNX2X_F_UPDATE_TUNNEL_INNER_RSS,
1129 };
1130
1131
1132 enum bnx2x_func_state {
1133 BNX2X_F_STATE_RESET,
1134 BNX2X_F_STATE_INITIALIZED,
1135 BNX2X_F_STATE_STARTED,
1136 BNX2X_F_STATE_TX_STOPPED,
1137 BNX2X_F_STATE_MAX,
1138 };
1139
1140
1141 enum bnx2x_func_cmd {
1142 BNX2X_F_CMD_HW_INIT,
1143 BNX2X_F_CMD_START,
1144 BNX2X_F_CMD_STOP,
1145 BNX2X_F_CMD_HW_RESET,
1146 BNX2X_F_CMD_AFEX_UPDATE,
1147 BNX2X_F_CMD_AFEX_VIFLISTS,
1148 BNX2X_F_CMD_TX_STOP,
1149 BNX2X_F_CMD_TX_START,
1150 BNX2X_F_CMD_SWITCH_UPDATE,
1151 BNX2X_F_CMD_SET_TIMESYNC,
1152 BNX2X_F_CMD_MAX,
1153 };
1154
1155 struct bnx2x_func_hw_init_params {
1156
1157
1158
1159
1160
1161
1162
1163
1164 u32 load_phase;
1165 };
1166
1167 struct bnx2x_func_hw_reset_params {
1168
1169
1170
1171
1172
1173
1174
1175
1176 u32 reset_phase;
1177 };
1178
1179 struct bnx2x_func_start_params {
1180
1181
1182
1183
1184
1185 u16 mf_mode;
1186
1187
1188 u16 sd_vlan_tag;
1189
1190
1191 u8 network_cos_mode;
1192
1193
1194 u16 vxlan_dst_port;
1195
1196
1197 u16 geneve_dst_port;
1198
1199
1200 u8 inner_clss_l2gre;
1201
1202
1203 u8 inner_clss_l2geneve;
1204
1205
1206 u8 inner_clss_vxlan;
1207
1208
1209 u8 inner_rss;
1210
1211
1212
1213
1214 u8 class_fail;
1215 u16 class_fail_ethtype;
1216
1217
1218 u8 sd_vlan_force_pri;
1219 u8 sd_vlan_force_pri_val;
1220
1221
1222 u16 sd_vlan_eth_type;
1223
1224
1225 u8 no_added_tags;
1226
1227
1228 u8 c2s_pri[MAX_VLAN_PRIORITIES];
1229 u8 c2s_pri_default;
1230 u8 c2s_pri_valid;
1231 };
1232
1233 struct bnx2x_func_switch_update_params {
1234 unsigned long changes;
1235 u16 vlan;
1236 u16 vlan_eth_type;
1237 u8 vlan_force_prio;
1238 u16 vxlan_dst_port;
1239 u16 geneve_dst_port;
1240 };
1241
1242 struct bnx2x_func_afex_update_params {
1243 u16 vif_id;
1244 u16 afex_default_vlan;
1245 u8 allowed_priorities;
1246 };
1247
1248 struct bnx2x_func_afex_viflists_params {
1249 u16 vif_list_index;
1250 u8 func_bit_map;
1251 u8 afex_vif_list_command;
1252 u8 func_to_clear;
1253 };
1254
1255 struct bnx2x_func_tx_start_params {
1256 struct priority_cos traffic_type_to_priority_cos[MAX_TRAFFIC_TYPES];
1257 u8 dcb_enabled;
1258 u8 dcb_version;
1259 u8 dont_add_pri_0_en;
1260 u8 dcb_outer_pri[MAX_TRAFFIC_TYPES];
1261 };
1262
1263 struct bnx2x_func_set_timesync_params {
1264
1265 u8 drift_adjust_cmd;
1266
1267
1268 u8 offset_cmd;
1269
1270
1271 u8 add_sub_drift_adjust_value;
1272
1273
1274
1275
1276 u8 drift_adjust_value;
1277 u32 drift_adjust_period;
1278 u64 offset_delta;
1279 };
1280
1281 struct bnx2x_func_state_params {
1282 struct bnx2x_func_sp_obj *f_obj;
1283
1284
1285 enum bnx2x_func_cmd cmd;
1286
1287
1288 unsigned long ramrod_flags;
1289
1290
1291 union {
1292 struct bnx2x_func_hw_init_params hw_init;
1293 struct bnx2x_func_hw_reset_params hw_reset;
1294 struct bnx2x_func_start_params start;
1295 struct bnx2x_func_switch_update_params switch_update;
1296 struct bnx2x_func_afex_update_params afex_update;
1297 struct bnx2x_func_afex_viflists_params afex_viflists;
1298 struct bnx2x_func_tx_start_params tx_start;
1299 struct bnx2x_func_set_timesync_params set_timesync;
1300 } params;
1301 };
1302
1303 struct bnx2x_func_sp_drv_ops {
1304
1305
1306
1307
1308
1309
1310 int (*init_hw_cmn_chip)(struct bnx2x *bp);
1311 int (*init_hw_cmn)(struct bnx2x *bp);
1312 int (*init_hw_port)(struct bnx2x *bp);
1313 int (*init_hw_func)(struct bnx2x *bp);
1314
1315
1316 void (*reset_hw_cmn)(struct bnx2x *bp);
1317 void (*reset_hw_port)(struct bnx2x *bp);
1318 void (*reset_hw_func)(struct bnx2x *bp);
1319
1320
1321 int (*gunzip_init)(struct bnx2x *bp);
1322 void (*gunzip_end)(struct bnx2x *bp);
1323
1324
1325 int (*init_fw)(struct bnx2x *bp);
1326 void (*release_fw)(struct bnx2x *bp);
1327 };
1328
1329 struct bnx2x_func_sp_obj {
1330 enum bnx2x_func_state state, next_state;
1331
1332
1333
1334
1335
1336
1337 unsigned long pending;
1338
1339
1340 void *rdata;
1341 dma_addr_t rdata_mapping;
1342
1343
1344
1345
1346
1347 void *afex_rdata;
1348 dma_addr_t afex_rdata_mapping;
1349
1350
1351
1352
1353 struct mutex one_pending_mutex;
1354
1355
1356 struct bnx2x_func_sp_drv_ops *drv;
1357
1358
1359
1360
1361
1362
1363 int (*send_cmd)(struct bnx2x *bp,
1364 struct bnx2x_func_state_params *params);
1365
1366
1367
1368
1369 int (*check_transition)(struct bnx2x *bp,
1370 struct bnx2x_func_sp_obj *o,
1371 struct bnx2x_func_state_params *params);
1372
1373
1374
1375
1376 int (*complete_cmd)(struct bnx2x *bp,
1377 struct bnx2x_func_sp_obj *o,
1378 enum bnx2x_func_cmd cmd);
1379
1380 int (*wait_comp)(struct bnx2x *bp, struct bnx2x_func_sp_obj *o,
1381 enum bnx2x_func_cmd cmd);
1382 };
1383
1384
1385
1386 union bnx2x_qable_obj {
1387 struct bnx2x_vlan_mac_obj vlan_mac;
1388 };
1389
1390 void bnx2x_init_func_obj(struct bnx2x *bp,
1391 struct bnx2x_func_sp_obj *obj,
1392 void *rdata, dma_addr_t rdata_mapping,
1393 void *afex_rdata, dma_addr_t afex_rdata_mapping,
1394 struct bnx2x_func_sp_drv_ops *drv_iface);
1395
1396 int bnx2x_func_state_change(struct bnx2x *bp,
1397 struct bnx2x_func_state_params *params);
1398
1399 enum bnx2x_func_state bnx2x_func_get_state(struct bnx2x *bp,
1400 struct bnx2x_func_sp_obj *o);
1401
1402 void bnx2x_init_queue_obj(struct bnx2x *bp,
1403 struct bnx2x_queue_sp_obj *obj, u8 cl_id, u32 *cids,
1404 u8 cid_cnt, u8 func_id, void *rdata,
1405 dma_addr_t rdata_mapping, unsigned long type);
1406
1407 int bnx2x_queue_state_change(struct bnx2x *bp,
1408 struct bnx2x_queue_state_params *params);
1409
1410 int bnx2x_get_q_logical_state(struct bnx2x *bp,
1411 struct bnx2x_queue_sp_obj *obj);
1412
1413
1414 void bnx2x_init_mac_obj(struct bnx2x *bp,
1415 struct bnx2x_vlan_mac_obj *mac_obj,
1416 u8 cl_id, u32 cid, u8 func_id, void *rdata,
1417 dma_addr_t rdata_mapping, int state,
1418 unsigned long *pstate, bnx2x_obj_type type,
1419 struct bnx2x_credit_pool_obj *macs_pool);
1420
1421 void bnx2x_init_vlan_obj(struct bnx2x *bp,
1422 struct bnx2x_vlan_mac_obj *vlan_obj,
1423 u8 cl_id, u32 cid, u8 func_id, void *rdata,
1424 dma_addr_t rdata_mapping, int state,
1425 unsigned long *pstate, bnx2x_obj_type type,
1426 struct bnx2x_credit_pool_obj *vlans_pool);
1427
1428 void bnx2x_init_vlan_mac_obj(struct bnx2x *bp,
1429 struct bnx2x_vlan_mac_obj *vlan_mac_obj,
1430 u8 cl_id, u32 cid, u8 func_id, void *rdata,
1431 dma_addr_t rdata_mapping, int state,
1432 unsigned long *pstate, bnx2x_obj_type type,
1433 struct bnx2x_credit_pool_obj *macs_pool,
1434 struct bnx2x_credit_pool_obj *vlans_pool);
1435
1436 int bnx2x_vlan_mac_h_read_lock(struct bnx2x *bp,
1437 struct bnx2x_vlan_mac_obj *o);
1438 void bnx2x_vlan_mac_h_read_unlock(struct bnx2x *bp,
1439 struct bnx2x_vlan_mac_obj *o);
1440 int bnx2x_vlan_mac_h_write_lock(struct bnx2x *bp,
1441 struct bnx2x_vlan_mac_obj *o);
1442 int bnx2x_config_vlan_mac(struct bnx2x *bp,
1443 struct bnx2x_vlan_mac_ramrod_params *p);
1444
1445 int bnx2x_vlan_mac_move(struct bnx2x *bp,
1446 struct bnx2x_vlan_mac_ramrod_params *p,
1447 struct bnx2x_vlan_mac_obj *dest_o);
1448
1449
1450
1451 void bnx2x_init_rx_mode_obj(struct bnx2x *bp,
1452 struct bnx2x_rx_mode_obj *o);
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463 int bnx2x_config_rx_mode(struct bnx2x *bp,
1464 struct bnx2x_rx_mode_ramrod_params *p);
1465
1466
1467
1468 void bnx2x_init_mcast_obj(struct bnx2x *bp,
1469 struct bnx2x_mcast_obj *mcast_obj,
1470 u8 mcast_cl_id, u32 mcast_cid, u8 func_id,
1471 u8 engine_id, void *rdata, dma_addr_t rdata_mapping,
1472 int state, unsigned long *pstate,
1473 bnx2x_obj_type type);
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495 int bnx2x_config_mcast(struct bnx2x *bp,
1496 struct bnx2x_mcast_ramrod_params *p,
1497 enum bnx2x_mcast_cmd cmd);
1498
1499
1500 void bnx2x_init_mac_credit_pool(struct bnx2x *bp,
1501 struct bnx2x_credit_pool_obj *p, u8 func_id,
1502 u8 func_num);
1503 void bnx2x_init_vlan_credit_pool(struct bnx2x *bp,
1504 struct bnx2x_credit_pool_obj *p, u8 func_id,
1505 u8 func_num);
1506 void bnx2x_init_credit_pool(struct bnx2x_credit_pool_obj *p,
1507 int base, int credit);
1508
1509
1510 void bnx2x_init_rss_config_obj(struct bnx2x *bp,
1511 struct bnx2x_rss_config_obj *rss_obj,
1512 u8 cl_id, u32 cid, u8 func_id, u8 engine_id,
1513 void *rdata, dma_addr_t rdata_mapping,
1514 int state, unsigned long *pstate,
1515 bnx2x_obj_type type);
1516
1517
1518
1519
1520
1521
1522 int bnx2x_config_rss(struct bnx2x *bp,
1523 struct bnx2x_config_rss_params *p);
1524
1525
1526
1527
1528
1529
1530
1531
1532 void bnx2x_get_rss_ind_table(struct bnx2x_rss_config_obj *rss_obj,
1533 u8 *ind_table);
1534
1535 #define PF_MAC_CREDIT_E2(bp, func_num) \
1536 ((MAX_MAC_CREDIT_E2 - GET_NUM_VFS_PER_PATH(bp) * VF_MAC_CREDIT_CNT) / \
1537 func_num + GET_NUM_VFS_PER_PF(bp) * VF_MAC_CREDIT_CNT)
1538
1539 #define PF_VLAN_CREDIT_E2(bp, func_num) \
1540 ((MAX_MAC_CREDIT_E2 - GET_NUM_VFS_PER_PATH(bp) * VF_VLAN_CREDIT_CNT) / \
1541 func_num + GET_NUM_VFS_PER_PF(bp) * VF_VLAN_CREDIT_CNT)
1542
1543 #endif