0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #ifndef BNX2X_SP_VERBS
0022 #define BNX2X_SP_VERBS
0023
0024 struct bnx2x;
0025 struct eth_context;
0026
0027
0028 enum {
0029 RAMROD_TX,
0030 RAMROD_RX,
0031
0032 RAMROD_COMP_WAIT,
0033
0034 RAMROD_DRV_CLR_ONLY,
0035
0036 RAMROD_RESTORE,
0037
0038 RAMROD_EXEC,
0039
0040
0041
0042
0043 RAMROD_CONT,
0044
0045
0046
0047
0048
0049 RAMROD_RETRY,
0050 };
0051
0052 typedef enum {
0053 BNX2X_OBJ_TYPE_RX,
0054 BNX2X_OBJ_TYPE_TX,
0055 BNX2X_OBJ_TYPE_RX_TX,
0056 } bnx2x_obj_type;
0057
0058
0059 enum {
0060 BNX2X_FILTER_MAC_PENDING,
0061 BNX2X_FILTER_VLAN_PENDING,
0062 BNX2X_FILTER_VLAN_MAC_PENDING,
0063 BNX2X_FILTER_RX_MODE_PENDING,
0064 BNX2X_FILTER_RX_MODE_SCHED,
0065 BNX2X_FILTER_ISCSI_ETH_START_SCHED,
0066 BNX2X_FILTER_ISCSI_ETH_STOP_SCHED,
0067 BNX2X_FILTER_FCOE_ETH_START_SCHED,
0068 BNX2X_FILTER_FCOE_ETH_STOP_SCHED,
0069 BNX2X_FILTER_MCAST_PENDING,
0070 BNX2X_FILTER_MCAST_SCHED,
0071 BNX2X_FILTER_RSS_CONF_PENDING,
0072 BNX2X_AFEX_FCOE_Q_UPDATE_PENDING,
0073 BNX2X_AFEX_PENDING_VIFSET_MCP_ACK
0074 };
0075
0076 struct bnx2x_raw_obj {
0077 u8 func_id;
0078
0079
0080 u8 cl_id;
0081 u32 cid;
0082
0083
0084 void *rdata;
0085 dma_addr_t rdata_mapping;
0086
0087
0088 int state;
0089 unsigned long *pstate;
0090
0091 bnx2x_obj_type obj_type;
0092
0093 int (*wait_comp)(struct bnx2x *bp,
0094 struct bnx2x_raw_obj *o);
0095
0096 bool (*check_pending)(struct bnx2x_raw_obj *o);
0097 void (*clear_pending)(struct bnx2x_raw_obj *o);
0098 void (*set_pending)(struct bnx2x_raw_obj *o);
0099 };
0100
0101
0102 struct bnx2x_mac_ramrod_data {
0103 u8 mac[ETH_ALEN];
0104 u8 is_inner_mac;
0105 };
0106
0107 struct bnx2x_vlan_ramrod_data {
0108 u16 vlan;
0109 };
0110
0111 struct bnx2x_vlan_mac_ramrod_data {
0112 u8 mac[ETH_ALEN];
0113 u8 is_inner_mac;
0114 u16 vlan;
0115 };
0116
0117 union bnx2x_classification_ramrod_data {
0118 struct bnx2x_mac_ramrod_data mac;
0119 struct bnx2x_vlan_ramrod_data vlan;
0120 struct bnx2x_vlan_mac_ramrod_data vlan_mac;
0121 };
0122
0123
0124 enum bnx2x_vlan_mac_cmd {
0125 BNX2X_VLAN_MAC_ADD,
0126 BNX2X_VLAN_MAC_DEL,
0127 BNX2X_VLAN_MAC_MOVE,
0128 };
0129
0130 struct bnx2x_vlan_mac_data {
0131
0132 enum bnx2x_vlan_mac_cmd cmd;
0133
0134
0135
0136 unsigned long vlan_mac_flags;
0137
0138
0139 struct bnx2x_vlan_mac_obj *target_obj;
0140
0141 union bnx2x_classification_ramrod_data u;
0142 };
0143
0144
0145 union bnx2x_exe_queue_cmd_data {
0146 struct bnx2x_vlan_mac_data vlan_mac;
0147
0148 struct {
0149
0150 } mcast;
0151 };
0152
0153 struct bnx2x_exeq_elem {
0154 struct list_head link;
0155
0156
0157 int cmd_len;
0158
0159 union bnx2x_exe_queue_cmd_data cmd_data;
0160 };
0161
0162 union bnx2x_qable_obj;
0163
0164 union bnx2x_exeq_comp_elem {
0165 union event_ring_elem *elem;
0166 };
0167
0168 struct bnx2x_exe_queue_obj;
0169
0170 typedef int (*exe_q_validate)(struct bnx2x *bp,
0171 union bnx2x_qable_obj *o,
0172 struct bnx2x_exeq_elem *elem);
0173
0174 typedef int (*exe_q_remove)(struct bnx2x *bp,
0175 union bnx2x_qable_obj *o,
0176 struct bnx2x_exeq_elem *elem);
0177
0178
0179
0180
0181 typedef int (*exe_q_optimize)(struct bnx2x *bp,
0182 union bnx2x_qable_obj *o,
0183 struct bnx2x_exeq_elem *elem);
0184 typedef int (*exe_q_execute)(struct bnx2x *bp,
0185 union bnx2x_qable_obj *o,
0186 struct list_head *exe_chunk,
0187 unsigned long *ramrod_flags);
0188 typedef struct bnx2x_exeq_elem *
0189 (*exe_q_get)(struct bnx2x_exe_queue_obj *o,
0190 struct bnx2x_exeq_elem *elem);
0191
0192 struct bnx2x_exe_queue_obj {
0193
0194 struct list_head exe_queue;
0195
0196
0197 struct list_head pending_comp;
0198
0199 spinlock_t lock;
0200
0201
0202 int exe_chunk_len;
0203
0204 union bnx2x_qable_obj *owner;
0205
0206
0207
0208
0209
0210
0211
0212
0213 exe_q_validate validate;
0214
0215
0216
0217
0218
0219 exe_q_remove remove;
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229 exe_q_optimize optimize;
0230
0231
0232
0233
0234 exe_q_execute execute;
0235
0236
0237
0238
0239
0240 exe_q_get get;
0241 };
0242
0243
0244
0245
0246
0247 struct bnx2x_vlan_mac_registry_elem {
0248 struct list_head link;
0249
0250
0251
0252
0253
0254 int cam_offset;
0255
0256
0257 unsigned long vlan_mac_flags;
0258
0259 union bnx2x_classification_ramrod_data u;
0260 };
0261
0262
0263 enum {
0264 BNX2X_UC_LIST_MAC,
0265 BNX2X_ETH_MAC,
0266 BNX2X_ISCSI_ETH_MAC,
0267 BNX2X_NETQ_ETH_MAC,
0268 BNX2X_VLAN,
0269 BNX2X_DONT_CONSUME_CAM_CREDIT,
0270 BNX2X_DONT_CONSUME_CAM_CREDIT_DEST,
0271 };
0272
0273 #define BNX2X_VLAN_MAC_CMP_MASK (1 << BNX2X_UC_LIST_MAC | \
0274 1 << BNX2X_ETH_MAC | \
0275 1 << BNX2X_ISCSI_ETH_MAC | \
0276 1 << BNX2X_NETQ_ETH_MAC | \
0277 1 << BNX2X_VLAN)
0278 #define BNX2X_VLAN_MAC_CMP_FLAGS(flags) \
0279 ((flags) & BNX2X_VLAN_MAC_CMP_MASK)
0280
0281 struct bnx2x_vlan_mac_ramrod_params {
0282
0283 struct bnx2x_vlan_mac_obj *vlan_mac_obj;
0284
0285
0286 unsigned long ramrod_flags;
0287
0288
0289 struct bnx2x_vlan_mac_data user_req;
0290 };
0291
0292 struct bnx2x_vlan_mac_obj {
0293 struct bnx2x_raw_obj raw;
0294
0295
0296
0297
0298 struct list_head head;
0299
0300
0301
0302 u8 head_reader;
0303 bool head_exe_request;
0304 unsigned long saved_ramrod_flags;
0305
0306
0307 struct bnx2x_exe_queue_obj exe_queue;
0308
0309
0310 struct bnx2x_credit_pool_obj *macs_pool;
0311
0312
0313 struct bnx2x_credit_pool_obj *vlans_pool;
0314
0315
0316 int ramrod_cmd;
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328 int (*get_n_elements)(struct bnx2x *bp,
0329 struct bnx2x_vlan_mac_obj *o, int n, u8 *base,
0330 u8 stride, u8 size);
0331
0332
0333
0334
0335
0336
0337
0338 int (*check_add)(struct bnx2x *bp,
0339 struct bnx2x_vlan_mac_obj *o,
0340 union bnx2x_classification_ramrod_data *data);
0341
0342
0343
0344
0345
0346
0347 struct bnx2x_vlan_mac_registry_elem *
0348 (*check_del)(struct bnx2x *bp,
0349 struct bnx2x_vlan_mac_obj *o,
0350 union bnx2x_classification_ramrod_data *data);
0351
0352
0353
0354
0355
0356
0357 bool (*check_move)(struct bnx2x *bp,
0358 struct bnx2x_vlan_mac_obj *src_o,
0359 struct bnx2x_vlan_mac_obj *dst_o,
0360 union bnx2x_classification_ramrod_data *data);
0361
0362
0363
0364
0365
0366 bool (*get_credit)(struct bnx2x_vlan_mac_obj *o);
0367 bool (*put_credit)(struct bnx2x_vlan_mac_obj *o);
0368 bool (*get_cam_offset)(struct bnx2x_vlan_mac_obj *o, int *offset);
0369 bool (*put_cam_offset)(struct bnx2x_vlan_mac_obj *o, int offset);
0370
0371
0372
0373
0374 void (*set_one_rule)(struct bnx2x *bp,
0375 struct bnx2x_vlan_mac_obj *o,
0376 struct bnx2x_exeq_elem *elem, int rule_idx,
0377 int cam_offset);
0378
0379
0380
0381
0382
0383
0384
0385
0386
0387
0388
0389
0390
0391
0392
0393
0394
0395
0396 int (*delete_all)(struct bnx2x *bp,
0397 struct bnx2x_vlan_mac_obj *o,
0398 unsigned long *vlan_mac_flags,
0399 unsigned long *ramrod_flags);
0400
0401
0402
0403
0404
0405
0406
0407
0408
0409
0410
0411
0412
0413
0414
0415
0416 int (*restore)(struct bnx2x *bp,
0417 struct bnx2x_vlan_mac_ramrod_params *p,
0418 struct bnx2x_vlan_mac_registry_elem **ppos);
0419
0420
0421
0422
0423
0424
0425
0426
0427
0428
0429
0430
0431
0432
0433
0434
0435
0436
0437 int (*complete)(struct bnx2x *bp, struct bnx2x_vlan_mac_obj *o,
0438 union event_ring_elem *cqe,
0439 unsigned long *ramrod_flags);
0440
0441
0442
0443
0444
0445
0446 int (*wait)(struct bnx2x *bp, struct bnx2x_vlan_mac_obj *o);
0447 };
0448
0449 enum {
0450 BNX2X_LLH_CAM_ISCSI_ETH_LINE = 0,
0451 BNX2X_LLH_CAM_ETH_LINE,
0452 BNX2X_LLH_CAM_MAX_PF_LINE = NIG_REG_LLH1_FUNC_MEM_SIZE / 2
0453 };
0454
0455
0456
0457
0458
0459
0460 enum {
0461 BNX2X_RX_MODE_FCOE_ETH,
0462 BNX2X_RX_MODE_ISCSI_ETH,
0463 };
0464
0465 enum {
0466 BNX2X_ACCEPT_UNICAST,
0467 BNX2X_ACCEPT_MULTICAST,
0468 BNX2X_ACCEPT_ALL_UNICAST,
0469 BNX2X_ACCEPT_ALL_MULTICAST,
0470 BNX2X_ACCEPT_BROADCAST,
0471 BNX2X_ACCEPT_UNMATCHED,
0472 BNX2X_ACCEPT_ANY_VLAN
0473 };
0474
0475 struct bnx2x_rx_mode_ramrod_params {
0476 struct bnx2x_rx_mode_obj *rx_mode_obj;
0477 unsigned long *pstate;
0478 int state;
0479 u8 cl_id;
0480 u32 cid;
0481 u8 func_id;
0482 unsigned long ramrod_flags;
0483 unsigned long rx_mode_flags;
0484
0485
0486
0487
0488 void *rdata;
0489 dma_addr_t rdata_mapping;
0490
0491
0492 unsigned long rx_accept_flags;
0493
0494
0495 unsigned long tx_accept_flags;
0496 };
0497
0498 struct bnx2x_rx_mode_obj {
0499 int (*config_rx_mode)(struct bnx2x *bp,
0500 struct bnx2x_rx_mode_ramrod_params *p);
0501
0502 int (*wait_comp)(struct bnx2x *bp,
0503 struct bnx2x_rx_mode_ramrod_params *p);
0504 };
0505
0506
0507
0508 struct bnx2x_mcast_list_elem {
0509 struct list_head link;
0510 u8 *mac;
0511 };
0512
0513 union bnx2x_mcast_config_data {
0514 u8 *mac;
0515 u8 bin;
0516 };
0517
0518 struct bnx2x_mcast_ramrod_params {
0519 struct bnx2x_mcast_obj *mcast_obj;
0520
0521
0522 unsigned long ramrod_flags;
0523
0524 struct list_head mcast_list;
0525
0526
0527
0528
0529
0530
0531
0532
0533 int mcast_list_len;
0534 };
0535
0536 enum bnx2x_mcast_cmd {
0537 BNX2X_MCAST_CMD_ADD,
0538 BNX2X_MCAST_CMD_CONT,
0539 BNX2X_MCAST_CMD_DEL,
0540 BNX2X_MCAST_CMD_RESTORE,
0541
0542
0543
0544
0545
0546
0547 BNX2X_MCAST_CMD_SET,
0548 BNX2X_MCAST_CMD_SET_ADD,
0549 BNX2X_MCAST_CMD_SET_DEL,
0550 };
0551
0552 struct bnx2x_mcast_obj {
0553 struct bnx2x_raw_obj raw;
0554
0555 union {
0556 struct {
0557 #define BNX2X_MCAST_BINS_NUM 256
0558 #define BNX2X_MCAST_VEC_SZ (BNX2X_MCAST_BINS_NUM / 64)
0559 u64 vec[BNX2X_MCAST_VEC_SZ];
0560
0561
0562
0563
0564
0565 int num_bins_set;
0566 } aprox_match;
0567
0568 struct {
0569 struct list_head macs;
0570 int num_macs_set;
0571 } exact_match;
0572 } registry;
0573
0574
0575 struct list_head pending_cmds_head;
0576
0577
0578 int sched_state;
0579
0580
0581 int max_cmd_len;
0582
0583
0584
0585
0586 int total_pending_num;
0587
0588 u8 engine_id;
0589
0590
0591
0592
0593 int (*config_mcast)(struct bnx2x *bp,
0594 struct bnx2x_mcast_ramrod_params *p,
0595 enum bnx2x_mcast_cmd cmd);
0596
0597
0598
0599
0600
0601
0602
0603
0604
0605
0606
0607
0608 int (*hdl_restore)(struct bnx2x *bp, struct bnx2x_mcast_obj *o,
0609 int start_bin, int *rdata_idx);
0610
0611 int (*enqueue_cmd)(struct bnx2x *bp, struct bnx2x_mcast_obj *o,
0612 struct bnx2x_mcast_ramrod_params *p,
0613 enum bnx2x_mcast_cmd cmd);
0614
0615 void (*set_one_rule)(struct bnx2x *bp,
0616 struct bnx2x_mcast_obj *o, int idx,
0617 union bnx2x_mcast_config_data *cfg_data,
0618 enum bnx2x_mcast_cmd cmd);
0619
0620
0621
0622
0623 bool (*check_pending)(struct bnx2x_mcast_obj *o);
0624
0625
0626
0627
0628 void (*set_sched)(struct bnx2x_mcast_obj *o);
0629 void (*clear_sched)(struct bnx2x_mcast_obj *o);
0630 bool (*check_sched)(struct bnx2x_mcast_obj *o);
0631
0632
0633 int (*wait_comp)(struct bnx2x *bp, struct bnx2x_mcast_obj *o);
0634
0635
0636
0637
0638
0639
0640 int (*validate)(struct bnx2x *bp,
0641 struct bnx2x_mcast_ramrod_params *p,
0642 enum bnx2x_mcast_cmd cmd);
0643
0644
0645
0646
0647 void (*revert)(struct bnx2x *bp,
0648 struct bnx2x_mcast_ramrod_params *p,
0649 int old_num_bins,
0650 enum bnx2x_mcast_cmd cmd);
0651
0652 int (*get_registry_size)(struct bnx2x_mcast_obj *o);
0653 void (*set_registry_size)(struct bnx2x_mcast_obj *o, int n);
0654 };
0655
0656
0657 struct bnx2x_credit_pool_obj {
0658
0659
0660 atomic_t credit;
0661
0662
0663 int pool_sz;
0664
0665
0666
0667
0668
0669
0670
0671 #define BNX2X_POOL_VEC_SIZE (MAX_MAC_CREDIT_E2 / 64)
0672 u64 pool_mirror[BNX2X_POOL_VEC_SIZE];
0673
0674
0675 int base_pool_offset;
0676
0677
0678
0679
0680
0681
0682 bool (*get_entry)(struct bnx2x_credit_pool_obj *o, int *entry);
0683
0684
0685
0686
0687
0688
0689
0690 bool (*put_entry)(struct bnx2x_credit_pool_obj *o, int entry);
0691
0692
0693
0694
0695
0696
0697
0698 bool (*get)(struct bnx2x_credit_pool_obj *o, int cnt);
0699
0700
0701
0702
0703
0704
0705
0706 bool (*put)(struct bnx2x_credit_pool_obj *o, int cnt);
0707
0708
0709
0710
0711 int (*check)(struct bnx2x_credit_pool_obj *o);
0712 };
0713
0714
0715 enum {
0716
0717 BNX2X_RSS_MODE_DISABLED,
0718 BNX2X_RSS_MODE_REGULAR,
0719
0720 BNX2X_RSS_SET_SRCH,
0721
0722 BNX2X_RSS_IPV4,
0723 BNX2X_RSS_IPV4_TCP,
0724 BNX2X_RSS_IPV4_UDP,
0725 BNX2X_RSS_IPV6,
0726 BNX2X_RSS_IPV6_TCP,
0727 BNX2X_RSS_IPV6_UDP,
0728
0729 BNX2X_RSS_IPV4_VXLAN,
0730 BNX2X_RSS_IPV6_VXLAN,
0731 BNX2X_RSS_TUNN_INNER_HDRS,
0732 };
0733
0734 struct bnx2x_config_rss_params {
0735 struct bnx2x_rss_config_obj *rss_obj;
0736
0737
0738 unsigned long ramrod_flags;
0739
0740
0741 unsigned long rss_flags;
0742
0743
0744 u8 rss_result_mask;
0745
0746
0747 u8 ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
0748
0749
0750 u32 rss_key[10];
0751
0752
0753 u16 toe_rss_bitmap;
0754 };
0755
0756 struct bnx2x_rss_config_obj {
0757 struct bnx2x_raw_obj raw;
0758
0759
0760 u8 engine_id;
0761
0762
0763 u8 ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
0764
0765
0766 u8 udp_rss_v4;
0767 u8 udp_rss_v6;
0768
0769 int (*config_rss)(struct bnx2x *bp,
0770 struct bnx2x_config_rss_params *p);
0771 };
0772
0773
0774
0775
0776 enum {
0777 BNX2X_Q_UPDATE_IN_VLAN_REM,
0778 BNX2X_Q_UPDATE_IN_VLAN_REM_CHNG,
0779 BNX2X_Q_UPDATE_OUT_VLAN_REM,
0780 BNX2X_Q_UPDATE_OUT_VLAN_REM_CHNG,
0781 BNX2X_Q_UPDATE_ANTI_SPOOF,
0782 BNX2X_Q_UPDATE_ANTI_SPOOF_CHNG,
0783 BNX2X_Q_UPDATE_ACTIVATE,
0784 BNX2X_Q_UPDATE_ACTIVATE_CHNG,
0785 BNX2X_Q_UPDATE_DEF_VLAN_EN,
0786 BNX2X_Q_UPDATE_DEF_VLAN_EN_CHNG,
0787 BNX2X_Q_UPDATE_SILENT_VLAN_REM_CHNG,
0788 BNX2X_Q_UPDATE_SILENT_VLAN_REM,
0789 BNX2X_Q_UPDATE_TX_SWITCHING_CHNG,
0790 BNX2X_Q_UPDATE_TX_SWITCHING,
0791 BNX2X_Q_UPDATE_PTP_PKTS_CHNG,
0792 BNX2X_Q_UPDATE_PTP_PKTS,
0793 };
0794
0795
0796 enum bnx2x_q_state {
0797 BNX2X_Q_STATE_RESET,
0798 BNX2X_Q_STATE_INITIALIZED,
0799 BNX2X_Q_STATE_ACTIVE,
0800 BNX2X_Q_STATE_MULTI_COS,
0801 BNX2X_Q_STATE_MCOS_TERMINATED,
0802 BNX2X_Q_STATE_INACTIVE,
0803 BNX2X_Q_STATE_STOPPED,
0804 BNX2X_Q_STATE_TERMINATED,
0805 BNX2X_Q_STATE_FLRED,
0806 BNX2X_Q_STATE_MAX,
0807 };
0808
0809
0810 enum bnx2x_q_logical_state {
0811 BNX2X_Q_LOGICAL_STATE_ACTIVE,
0812 BNX2X_Q_LOGICAL_STATE_STOPPED,
0813 };
0814
0815
0816 enum bnx2x_queue_cmd {
0817 BNX2X_Q_CMD_INIT,
0818 BNX2X_Q_CMD_SETUP,
0819 BNX2X_Q_CMD_SETUP_TX_ONLY,
0820 BNX2X_Q_CMD_DEACTIVATE,
0821 BNX2X_Q_CMD_ACTIVATE,
0822 BNX2X_Q_CMD_UPDATE,
0823 BNX2X_Q_CMD_UPDATE_TPA,
0824 BNX2X_Q_CMD_HALT,
0825 BNX2X_Q_CMD_CFC_DEL,
0826 BNX2X_Q_CMD_TERMINATE,
0827 BNX2X_Q_CMD_EMPTY,
0828 BNX2X_Q_CMD_MAX,
0829 };
0830
0831
0832 enum {
0833 BNX2X_Q_FLG_TPA,
0834 BNX2X_Q_FLG_TPA_IPV6,
0835 BNX2X_Q_FLG_TPA_GRO,
0836 BNX2X_Q_FLG_STATS,
0837 BNX2X_Q_FLG_ZERO_STATS,
0838 BNX2X_Q_FLG_ACTIVE,
0839 BNX2X_Q_FLG_OV,
0840 BNX2X_Q_FLG_VLAN,
0841 BNX2X_Q_FLG_COS,
0842 BNX2X_Q_FLG_HC,
0843 BNX2X_Q_FLG_HC_EN,
0844 BNX2X_Q_FLG_DHC,
0845 BNX2X_Q_FLG_FCOE,
0846 BNX2X_Q_FLG_LEADING_RSS,
0847 BNX2X_Q_FLG_MCAST,
0848 BNX2X_Q_FLG_DEF_VLAN,
0849 BNX2X_Q_FLG_TX_SWITCH,
0850 BNX2X_Q_FLG_TX_SEC,
0851 BNX2X_Q_FLG_ANTI_SPOOF,
0852 BNX2X_Q_FLG_SILENT_VLAN_REM,
0853 BNX2X_Q_FLG_FORCE_DEFAULT_PRI,
0854 BNX2X_Q_FLG_REFUSE_OUTBAND_VLAN,
0855 BNX2X_Q_FLG_PCSUM_ON_PKT,
0856 BNX2X_Q_FLG_TUN_INC_INNER_IP_ID
0857 };
0858
0859
0860 enum bnx2x_q_type {
0861
0862
0863
0864 BNX2X_Q_TYPE_HAS_RX,
0865 BNX2X_Q_TYPE_HAS_TX,
0866 };
0867
0868 #define BNX2X_PRIMARY_CID_INDEX 0
0869 #define BNX2X_MULTI_TX_COS_E1X 3
0870 #define BNX2X_MULTI_TX_COS_E2_E3A0 2
0871 #define BNX2X_MULTI_TX_COS_E3B0 3
0872 #define BNX2X_MULTI_TX_COS 3
0873
0874 #define MAC_PAD (ALIGN(ETH_ALEN, sizeof(u32)) - ETH_ALEN)
0875
0876
0877
0878 #define FW_DMAE_CMD_ID 6
0879
0880 struct bnx2x_queue_init_params {
0881 struct {
0882 unsigned long flags;
0883 u16 hc_rate;
0884 u8 fw_sb_id;
0885 u8 sb_cq_index;
0886 } tx;
0887
0888 struct {
0889 unsigned long flags;
0890 u16 hc_rate;
0891 u8 fw_sb_id;
0892 u8 sb_cq_index;
0893 } rx;
0894
0895
0896 struct eth_context *cxts[BNX2X_MULTI_TX_COS];
0897
0898
0899 u8 max_cos;
0900 };
0901
0902 struct bnx2x_queue_terminate_params {
0903
0904 u8 cid_index;
0905 };
0906
0907 struct bnx2x_queue_cfc_del_params {
0908
0909 u8 cid_index;
0910 };
0911
0912 struct bnx2x_queue_update_params {
0913 unsigned long update_flags;
0914 u16 def_vlan;
0915 u16 silent_removal_value;
0916 u16 silent_removal_mask;
0917
0918 u8 cid_index;
0919 };
0920
0921 struct bnx2x_queue_update_tpa_params {
0922 dma_addr_t sge_map;
0923 u8 update_ipv4;
0924 u8 update_ipv6;
0925 u8 max_tpa_queues;
0926 u8 max_sges_pkt;
0927 u8 complete_on_both_clients;
0928 u8 dont_verify_thr;
0929 u8 tpa_mode;
0930 u8 _pad;
0931
0932 u16 sge_buff_sz;
0933 u16 max_agg_sz;
0934
0935 u16 sge_pause_thr_low;
0936 u16 sge_pause_thr_high;
0937 };
0938
0939 struct rxq_pause_params {
0940 u16 bd_th_lo;
0941 u16 bd_th_hi;
0942 u16 rcq_th_lo;
0943 u16 rcq_th_hi;
0944 u16 sge_th_lo;
0945 u16 sge_th_hi;
0946 u16 pri_map;
0947 };
0948
0949
0950 struct bnx2x_general_setup_params {
0951
0952 u8 stat_id;
0953
0954 u8 spcl_id;
0955 u16 mtu;
0956 u8 cos;
0957
0958 u8 fp_hsi;
0959 };
0960
0961 struct bnx2x_rxq_setup_params {
0962
0963 dma_addr_t dscr_map;
0964 dma_addr_t sge_map;
0965 dma_addr_t rcq_map;
0966 dma_addr_t rcq_np_map;
0967
0968 u16 drop_flags;
0969 u16 buf_sz;
0970 u8 fw_sb_id;
0971 u8 cl_qzone_id;
0972
0973
0974 u16 tpa_agg_sz;
0975 u16 sge_buf_sz;
0976 u8 max_sges_pkt;
0977 u8 max_tpa_queues;
0978 u8 rss_engine_id;
0979
0980
0981 u8 mcast_engine_id;
0982
0983 u8 cache_line_log;
0984
0985 u8 sb_cq_index;
0986
0987
0988 u16 silent_removal_value;
0989 u16 silent_removal_mask;
0990 };
0991
0992 struct bnx2x_txq_setup_params {
0993
0994 dma_addr_t dscr_map;
0995
0996 u8 fw_sb_id;
0997 u8 sb_cq_index;
0998 u8 cos;
0999 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 BNX2X_VFS_VLAN_CREDIT(bp) \
1540 (GET_NUM_VFS_PER_PATH(bp) * VF_VLAN_CREDIT_CNT)
1541
1542 #define PF_VLAN_CREDIT_E2(bp, func_num) \
1543 ((MAX_VLAN_CREDIT_E2 - 1 - BNX2X_VFS_VLAN_CREDIT(bp)) / \
1544 func_num + GET_NUM_VFS_PER_PF(bp) * VF_VLAN_CREDIT_CNT)
1545
1546 #endif