1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2018, Intel Corporation. */
7 #define ICE_BYTES_PER_WORD 2
8 #define ICE_BYTES_PER_DWORD 4
10 #include "ice_status.h"
11 #include "ice_hw_autogen.h"
12 #include "ice_osdep.h"
13 #include "ice_controlq.h"
14 #include "ice_lan_tx_rx.h"
15 #include "ice_flex_type.h"
16 #include "ice_protocol_type.h"
18 static inline bool ice_is_tc_ena(unsigned long bitmap, u8 tc)
20 return test_bit(tc, &bitmap);
23 static inline u64 round_up_64bit(u64 a, u32 b)
25 return div64_long(((a) + (b) / 2), (b));
28 static inline u32 ice_round_to_num(u32 N, u32 R)
30 return ((((N) % (R)) < ((R) / 2)) ? (((N) / (R)) * (R)) :
31 ((((N) + (R) - 1) / (R)) * (R)));
34 /* Driver always calls main vsi_handle first */
35 #define ICE_MAIN_VSI_HANDLE 0
37 /* debug masks - set these bits in hw->debug_mask to control output */
38 #define ICE_DBG_INIT BIT_ULL(1)
39 #define ICE_DBG_FW_LOG BIT_ULL(3)
40 #define ICE_DBG_LINK BIT_ULL(4)
41 #define ICE_DBG_PHY BIT_ULL(5)
42 #define ICE_DBG_QCTX BIT_ULL(6)
43 #define ICE_DBG_NVM BIT_ULL(7)
44 #define ICE_DBG_LAN BIT_ULL(8)
45 #define ICE_DBG_FLOW BIT_ULL(9)
46 #define ICE_DBG_SW BIT_ULL(13)
47 #define ICE_DBG_SCHED BIT_ULL(14)
48 #define ICE_DBG_PKG BIT_ULL(16)
49 #define ICE_DBG_RES BIT_ULL(17)
50 #define ICE_DBG_AQ_MSG BIT_ULL(24)
51 #define ICE_DBG_AQ_DESC BIT_ULL(25)
52 #define ICE_DBG_AQ_DESC_BUF BIT_ULL(26)
53 #define ICE_DBG_AQ_CMD BIT_ULL(27)
54 #define ICE_DBG_USER BIT_ULL(31)
59 ICE_CHANGE_LOCK_RES_ID,
60 ICE_GLOBAL_CFG_LOCK_RES_ID
63 /* FW update timeout definitions are in milliseconds */
64 #define ICE_NVM_TIMEOUT 180000
65 #define ICE_CHANGE_LOCK_TIMEOUT 1000
66 #define ICE_GLOBAL_CFG_LOCK_TIMEOUT 3000
68 enum ice_aq_res_access_type {
73 struct ice_driver_ver {
90 enum ice_phy_cache_mode {
103 struct ice_phy_cache_mode_data {
105 enum ice_fec_mode curr_user_fec_req;
106 enum ice_fc_mode curr_user_fc_req;
107 u16 curr_user_speed_req;
111 enum ice_set_fc_aq_failures {
112 ICE_SET_FC_AQ_FAIL_NONE = 0,
113 ICE_SET_FC_AQ_FAIL_GET,
114 ICE_SET_FC_AQ_FAIL_SET,
115 ICE_SET_FC_AQ_FAIL_UPDATE
118 /* Various MAC types */
126 enum ice_media_type {
127 ICE_MEDIA_UNKNOWN = 0,
137 ICE_VSI_CTRL = 3, /* equates to ICE_VSI_PF with 1 queue pair */
141 struct ice_link_status {
142 /* Refer to ice_aq_phy_type for bits definition */
145 u8 topo_media_conflict;
149 u8 lse_ena; /* Link Status Event notification */
155 /* Refer to #define from module_type[ICE_MODULE_TYPE_TOTAL_BYTE] of
156 * ice_aqc_get_phy_caps structure
158 u8 module_type[ICE_MODULE_TYPE_TOTAL_BYTE];
161 /* Different reset sources for which a disable queue AQ call has to be made in
162 * order to clean the Tx scheduler as a part of the reset
164 enum ice_disq_rst_src {
170 /* PHY info such as phy_type, etc... */
171 struct ice_phy_info {
172 struct ice_link_status link_info;
173 struct ice_link_status link_info_old;
176 enum ice_media_type media_type;
178 /* Please refer to struct ice_aqc_get_link_status_data to get
179 * detail of enable bit in curr_user_speed_req
181 u16 curr_user_speed_req;
182 enum ice_fec_mode curr_user_fec_req;
183 enum ice_fc_mode curr_user_fc_req;
184 struct ice_aqc_set_phy_cfg_data curr_user_phy_cfg;
187 /* protocol enumeration for filters */
188 enum ice_fltr_ptype {
189 /* NONE - used for undef/error */
190 ICE_FLTR_PTYPE_NONF_NONE = 0,
191 ICE_FLTR_PTYPE_NONF_IPV4_UDP,
192 ICE_FLTR_PTYPE_NONF_IPV4_TCP,
193 ICE_FLTR_PTYPE_NONF_IPV4_SCTP,
194 ICE_FLTR_PTYPE_NONF_IPV4_OTHER,
195 ICE_FLTR_PTYPE_FRAG_IPV4,
196 ICE_FLTR_PTYPE_NONF_IPV6_UDP,
197 ICE_FLTR_PTYPE_NONF_IPV6_TCP,
198 ICE_FLTR_PTYPE_NONF_IPV6_SCTP,
199 ICE_FLTR_PTYPE_NONF_IPV6_OTHER,
204 ICE_FD_HW_SEG_NON_TUN = 0,
209 /* 2 VSI = 1 ICE_VSI_PF + 1 ICE_VSI_CTRL */
210 #define ICE_MAX_FDIR_VSI_PER_FILTER 2
212 struct ice_fd_hw_prof {
213 struct ice_flow_seg_info *fdir_seg[ICE_FD_HW_SEG_MAX];
215 u64 entry_h[ICE_MAX_FDIR_VSI_PER_FILTER][ICE_FD_HW_SEG_MAX];
216 u16 vsi_h[ICE_MAX_FDIR_VSI_PER_FILTER];
219 /* Common HW capabilities for SW use */
220 struct ice_hw_common_caps {
222 /* DCB capabilities */
223 u32 active_tc_bitmap;
227 u16 num_rxq; /* Number/Total Rx queues */
228 u16 rxq_first_id; /* First queue ID for Rx queues */
229 u16 num_txq; /* Number/Total Tx queues */
230 u16 txq_first_id; /* First queue ID for Tx queues */
233 u16 num_msix_vectors;
234 u16 msix_vector_first_id;
236 /* Max MTU for function or device */
239 /* Virtualization support */
240 u8 sr_iov_1_1; /* SR-IOV enabled */
242 /* RSS related capabilities */
243 u16 rss_table_size; /* 512 for PFs and 64 for VFs */
244 u8 rss_table_entry_width; /* RSS Entry width in bits */
248 bool nvm_update_pending_nvm;
249 bool nvm_update_pending_orom;
250 bool nvm_update_pending_netlist;
251 #define ICE_NVM_PENDING_NVM_IMAGE BIT(0)
252 #define ICE_NVM_PENDING_OROM BIT(1)
253 #define ICE_NVM_PENDING_NETLIST BIT(2)
254 bool nvm_unified_update;
255 #define ICE_NVM_MGMT_UNIFIED_UPD_SUPPORT BIT(3)
258 /* Function specific capabilities */
259 struct ice_hw_func_caps {
260 struct ice_hw_common_caps common_cap;
261 u32 num_allocd_vfs; /* Number of allocated VFs */
262 u32 vf_base_id; /* Logical ID of the first VF */
264 u32 fd_fltr_guar; /* Number of filters guaranteed */
265 u32 fd_fltr_best_effort; /* Number of best effort filters */
268 /* Device wide capabilities */
269 struct ice_hw_dev_caps {
270 struct ice_hw_common_caps common_cap;
271 u32 num_vfs_exposed; /* Total number of VFs exposed */
272 u32 num_vsi_allocd_to_host; /* Excluding EMP VSI */
273 u32 num_flow_director_fltr; /* Number of FD filters available */
278 struct ice_mac_info {
279 u8 lan_addr[ETH_ALEN];
280 u8 perm_addr[ETH_ALEN];
283 /* Reset types used to determine which kind of reset was requested. These
284 * defines match what the RESET_TYPE field of the GLGEN_RSTAT register.
285 * ICE_RESET_PFR does not match any RESET_TYPE field in the GLGEN_RSTAT register
286 * because its reset source is different than the other types listed.
298 struct ice_bus_info {
303 /* Flow control (FC) parameters */
305 enum ice_fc_mode current_mode; /* FC mode in effect */
306 enum ice_fc_mode req_mode; /* FC mode requested by caller */
309 /* Option ROM version information */
310 struct ice_orom_info {
311 u8 major; /* Major version of OROM */
312 u8 patch; /* Patch version of OROM */
313 u16 build; /* Build version of OROM */
316 /* NVM version information */
317 struct ice_nvm_info {
323 /* netlist version information */
324 struct ice_netlist_info {
325 u32 major; /* major high/low */
326 u32 minor; /* minor high/low */
327 u32 type; /* type high/low */
328 u32 rev; /* revision high/low */
329 u32 hash; /* SHA-1 hash word */
330 u16 cust_ver; /* customer version */
333 /* Enumeration of possible flash banks for the NVM, OROM, and Netlist modules
334 * of the flash image.
336 enum ice_flash_bank {
337 ICE_INVALID_FLASH_BANK,
342 /* Enumeration of which flash bank is desired to read from, either the active
343 * bank or the inactive bank. Used to abstract 1st and 2nd bank notion from
344 * code which just wants to read the active or inactive flash bank.
346 enum ice_bank_select {
347 ICE_ACTIVE_FLASH_BANK,
348 ICE_INACTIVE_FLASH_BANK,
351 /* information for accessing NVM, OROM, and Netlist flash banks */
352 struct ice_bank_info {
353 u32 nvm_ptr; /* Pointer to 1st NVM bank */
354 u32 nvm_size; /* Size of NVM bank */
355 u32 orom_ptr; /* Pointer to 1st OROM bank */
356 u32 orom_size; /* Size of OROM bank */
357 u32 netlist_ptr; /* Pointer to 1st Netlist bank */
358 u32 netlist_size; /* Size of Netlist bank */
359 enum ice_flash_bank nvm_bank; /* Active NVM bank */
360 enum ice_flash_bank orom_bank; /* Active OROM bank */
361 enum ice_flash_bank netlist_bank; /* Active Netlist bank */
364 /* Flash Chip Information */
365 struct ice_flash_info {
366 struct ice_orom_info orom; /* Option ROM version info */
367 struct ice_nvm_info nvm; /* NVM version information */
368 struct ice_netlist_info netlist;/* Netlist version info */
369 struct ice_bank_info banks; /* Flash Bank information */
370 u16 sr_words; /* Shadow RAM size in words */
371 u32 flash_size; /* Size of available flash in bytes */
372 u8 blank_nvm_mode; /* is NVM empty (no FW present) */
375 struct ice_link_default_override_tlv {
377 #define ICE_LINK_OVERRIDE_OPT_M 0x3F
378 #define ICE_LINK_OVERRIDE_STRICT_MODE BIT(0)
379 #define ICE_LINK_OVERRIDE_EPCT_DIS BIT(1)
380 #define ICE_LINK_OVERRIDE_PORT_DIS BIT(2)
381 #define ICE_LINK_OVERRIDE_EN BIT(3)
382 #define ICE_LINK_OVERRIDE_AUTO_LINK_DIS BIT(4)
383 #define ICE_LINK_OVERRIDE_EEE_EN BIT(5)
385 #define ICE_LINK_OVERRIDE_PHY_CFG_S 8
386 #define ICE_LINK_OVERRIDE_PHY_CFG_M (0xC3 << ICE_LINK_OVERRIDE_PHY_CFG_S)
387 #define ICE_LINK_OVERRIDE_PAUSE_M 0x3
388 #define ICE_LINK_OVERRIDE_LESM_EN BIT(6)
389 #define ICE_LINK_OVERRIDE_AUTO_FEC_EN BIT(7)
391 #define ICE_LINK_OVERRIDE_FEC_OPT_M 0xFF
397 #define ICE_NVM_VER_LEN 32
399 /* Max number of port to queue branches w.r.t topology */
400 #define ICE_MAX_TRAFFIC_CLASS 8
401 #define ICE_TXSCHED_MAX_BRANCHES ICE_MAX_TRAFFIC_CLASS
403 #define ice_for_each_traffic_class(_i) \
404 for ((_i) = 0; (_i) < ICE_MAX_TRAFFIC_CLASS; (_i)++)
406 #define ICE_INVAL_TEID 0xFFFFFFFF
408 struct ice_sched_node {
409 struct ice_sched_node *parent;
410 struct ice_sched_node *sibling; /* next sibling in the same layer */
411 struct ice_sched_node **children;
412 struct ice_aqc_txsched_elem_data info;
413 u32 agg_id; /* aggregator group ID */
415 u8 in_use; /* suspended or in use */
416 u8 tx_sched_layer; /* Logical Layer (1-9) */
420 #define ICE_SCHED_NODE_OWNER_LAN 0
423 /* Access Macros for Tx Sched Elements data */
424 #define ICE_TXSCHED_GET_NODE_TEID(x) le32_to_cpu((x)->info.node_teid)
426 /* The aggregator type determines if identifier is for a VSI group,
427 * aggregator group, aggregator of queues, or queue group.
430 ICE_AGG_TYPE_UNKNOWN = 0,
432 ICE_AGG_TYPE_AGG, /* aggregator */
437 /* Rate limit types */
440 ICE_MIN_BW, /* for CIR profile */
441 ICE_MAX_BW, /* for EIR profile */
442 ICE_SHARED_BW /* for shared profile */
445 #define ICE_SCHED_MIN_BW 500 /* in Kbps */
446 #define ICE_SCHED_MAX_BW 100000000 /* in Kbps */
447 #define ICE_SCHED_DFLT_BW 0xFFFFFFFF /* unlimited */
448 #define ICE_SCHED_DFLT_RL_PROF_ID 0
449 #define ICE_SCHED_NO_SHARED_RL_PROF_ID 0xFFFF
450 #define ICE_SCHED_DFLT_BW_WT 4
451 #define ICE_SCHED_INVAL_PROF_ID 0xFFFF
452 #define ICE_SCHED_DFLT_BURST_SIZE (15 * 1024) /* in bytes (15k) */
454 /* Data structure for saving BW information */
462 ICE_BW_TYPE_CNT /* This must be last */
470 struct ice_bw_type_info {
471 DECLARE_BITMAP(bw_t_bitmap, ICE_BW_TYPE_CNT);
473 struct ice_bw cir_bw;
474 struct ice_bw eir_bw;
478 /* VSI queue context structure for given TC */
482 /* bw_t_info saves queue BW information */
483 struct ice_bw_type_info bw_t_info;
486 /* VSI type list entry to locate corresponding VSI/aggregator nodes */
487 struct ice_sched_vsi_info {
488 struct ice_sched_node *vsi_node[ICE_MAX_TRAFFIC_CLASS];
489 struct ice_sched_node *ag_node[ICE_MAX_TRAFFIC_CLASS];
490 struct list_head list_entry;
491 u16 max_lanq[ICE_MAX_TRAFFIC_CLASS];
494 /* driver defines the policy */
495 struct ice_sched_tx_policy {
497 u8 max_num_lan_qs_per_tc[ICE_MAX_TRAFFIC_CLASS];
501 /* CEE or IEEE 802.1Qaz ETS Configuration data */
502 struct ice_dcb_ets_cfg {
506 u8 prio_table[ICE_MAX_TRAFFIC_CLASS];
507 u8 tcbwtable[ICE_MAX_TRAFFIC_CLASS];
508 u8 tsatable[ICE_MAX_TRAFFIC_CLASS];
511 /* CEE or IEEE 802.1Qaz PFC Configuration data */
512 struct ice_dcb_pfc_cfg {
519 /* CEE or IEEE 802.1Qaz Application Priority data */
520 struct ice_dcb_app_priority_table {
526 #define ICE_MAX_USER_PRIORITY 8
527 #define ICE_DCBX_MAX_APPS 32
528 #define ICE_LLDPDU_SIZE 1500
529 #define ICE_TLV_STATUS_OPER 0x1
530 #define ICE_TLV_STATUS_SYNC 0x2
531 #define ICE_TLV_STATUS_ERR 0x4
532 #define ICE_APP_PROT_ID_FCOE 0x8906
533 #define ICE_APP_PROT_ID_ISCSI 0x0cbc
534 #define ICE_APP_PROT_ID_FIP 0x8914
535 #define ICE_APP_SEL_ETHTYPE 0x1
536 #define ICE_APP_SEL_TCPIP 0x2
537 #define ICE_CEE_APP_SEL_ETHTYPE 0x0
538 #define ICE_SR_LINK_DEFAULT_OVERRIDE_PTR 0x134
539 #define ICE_CEE_APP_SEL_TCPIP 0x1
541 struct ice_dcbx_cfg {
543 u32 tlv_status; /* CEE mode TLV status */
544 struct ice_dcb_ets_cfg etscfg;
545 struct ice_dcb_ets_cfg etsrec;
546 struct ice_dcb_pfc_cfg pfc;
547 struct ice_dcb_app_priority_table app[ICE_DCBX_MAX_APPS];
549 #define ICE_DCBX_MODE_CEE 0x1
550 #define ICE_DCBX_MODE_IEEE 0x2
552 #define ICE_DCBX_APPS_NON_WILLING 0x1
555 struct ice_port_info {
556 struct ice_sched_node *root; /* Root Node per Port */
557 struct ice_hw *hw; /* back pointer to HW instance */
558 u32 last_node_teid; /* scheduler last node info */
559 u16 sw_id; /* Initial switch ID belongs to port */
562 #define ICE_SCHED_PORT_STATE_INIT 0x0
563 #define ICE_SCHED_PORT_STATE_READY 0x1
565 #define ICE_LPORT_MASK 0xff
566 u16 dflt_tx_vsi_rule_id;
568 u16 dflt_rx_vsi_rule_id;
570 struct ice_fc_info fc;
571 struct ice_mac_info mac;
572 struct ice_phy_info phy;
573 struct mutex sched_lock; /* protect access to TXSched tree */
574 struct ice_sched_node *
575 sib_head[ICE_MAX_TRAFFIC_CLASS][ICE_AQC_TOPO_MAX_LEVEL_NUM];
576 /* List contain profile ID(s) and other params per layer */
577 struct list_head rl_prof_list[ICE_AQC_TOPO_MAX_LEVEL_NUM];
578 struct ice_dcbx_cfg local_dcbx_cfg; /* Oper/Local Cfg */
580 struct ice_dcbx_cfg remote_dcbx_cfg; /* Peer Cfg */
581 struct ice_dcbx_cfg desired_dcbx_cfg; /* CEE Desired Cfg */
582 /* LLDP/DCBX Status */
583 u8 dcbx_status:3; /* see ICE_DCBX_STATUS_DIS */
588 struct ice_switch_info {
589 struct list_head vsi_list_map_head;
590 struct ice_sw_recipe *recp_list;
593 /* FW logging configuration */
594 struct ice_fw_log_evnt {
595 u8 cfg : 4; /* New event enables to configure */
596 u8 cur : 4; /* Current/active event enables */
599 struct ice_fw_log_cfg {
600 u8 cq_en : 1; /* FW logging is enabled via the control queue */
601 u8 uart_en : 1; /* FW logging is enabled via UART for all PFs */
602 u8 actv_evnts; /* Cumulation of currently enabled log events */
604 #define ICE_FW_LOG_EVNT_INFO (ICE_AQC_FW_LOG_INFO_EN >> ICE_AQC_FW_LOG_EN_S)
605 #define ICE_FW_LOG_EVNT_INIT (ICE_AQC_FW_LOG_INIT_EN >> ICE_AQC_FW_LOG_EN_S)
606 #define ICE_FW_LOG_EVNT_FLOW (ICE_AQC_FW_LOG_FLOW_EN >> ICE_AQC_FW_LOG_EN_S)
607 #define ICE_FW_LOG_EVNT_ERR (ICE_AQC_FW_LOG_ERR_EN >> ICE_AQC_FW_LOG_EN_S)
608 struct ice_fw_log_evnt evnts[ICE_AQC_FW_LOG_ID_MAX];
611 /* Port hardware description */
615 struct ice_aqc_layer_props *layer_info;
616 struct ice_port_info *port_info;
617 u64 debug_mask; /* bitmap for debug mask */
618 enum ice_mac_type mac_type;
620 u16 fd_ctr_base; /* FD counter base index */
625 u16 subsystem_device_id;
626 u16 subsystem_vendor_id;
629 u8 pf_id; /* device profile info */
631 u16 max_burst_size; /* driver sets this value */
633 /* Tx Scheduler values */
634 u8 num_tx_sched_layers;
635 u8 num_tx_sched_phys_layers;
638 u8 sw_entry_point_layer;
639 u16 max_children[ICE_AQC_TOPO_MAX_LEVEL_NUM];
640 struct list_head agg_list; /* lists all aggregator */
642 struct ice_vsi_ctx *vsi_ctx[ICE_MAX_VSI];
643 u8 evb_veb; /* true for VEB, false for VEPA */
644 u8 reset_ongoing; /* true if HW is in reset, false otherwise */
645 struct ice_bus_info bus;
646 struct ice_flash_info flash;
647 struct ice_hw_dev_caps dev_caps; /* device capabilities */
648 struct ice_hw_func_caps func_caps; /* function capabilities */
650 struct ice_switch_info *switch_info; /* switch filter lists */
652 /* Control Queue info */
653 struct ice_ctl_q_info adminq;
654 struct ice_ctl_q_info mailboxq;
656 u8 api_branch; /* API branch version */
657 u8 api_maj_ver; /* API major version */
658 u8 api_min_ver; /* API minor version */
659 u8 api_patch; /* API patch version */
660 u8 fw_branch; /* firmware branch version */
661 u8 fw_maj_ver; /* firmware major version */
662 u8 fw_min_ver; /* firmware minor version */
663 u8 fw_patch; /* firmware patch version */
664 u32 fw_build; /* firmware build number */
666 struct ice_fw_log_cfg fw_log;
668 /* Device max aggregate bandwidths corresponding to the GL_PWR_MODE_CTL
669 * register. Used for determining the ITR/INTRL granularity during
672 #define ICE_MAX_AGG_BW_200G 0x0
673 #define ICE_MAX_AGG_BW_100G 0X1
674 #define ICE_MAX_AGG_BW_50G 0x2
675 #define ICE_MAX_AGG_BW_25G 0x3
676 /* ITR granularity for different speeds */
677 #define ICE_ITR_GRAN_ABOVE_25 2
678 #define ICE_ITR_GRAN_MAX_25 4
679 /* ITR granularity in 1 us */
681 /* INTRL granularity for different speeds */
682 #define ICE_INTRL_GRAN_ABOVE_25 4
683 #define ICE_INTRL_GRAN_MAX_25 8
684 /* INTRL granularity in 1 us */
687 u8 ucast_shared; /* true if VSIs can share unicast addr */
689 /* Active package version (currently active) */
690 struct ice_pkg_ver active_pkg_ver;
692 u8 active_pkg_name[ICE_PKG_NAME_SIZE];
693 u8 active_pkg_in_nvm;
695 enum ice_aq_err pkg_dwnld_status;
697 /* Driver's package ver - (from the Metadata seg) */
698 struct ice_pkg_ver pkg_ver;
699 u8 pkg_name[ICE_PKG_NAME_SIZE];
701 /* Driver's Ice package version (from the Ice seg) */
702 struct ice_pkg_ver ice_pkg_ver;
703 u8 ice_pkg_name[ICE_PKG_NAME_SIZE];
705 /* Pointer to the ice segment */
708 /* Pointer to allocated copy of pkg memory */
713 struct mutex tnl_lock;
714 struct ice_tunnel_table tnl;
716 struct udp_tunnel_nic_shared udp_tunnel_shared;
717 struct udp_tunnel_nic_info udp_tunnel_nic;
719 /* HW block tables */
720 struct ice_blk_info blk[ICE_BLK_COUNT];
721 struct mutex fl_profs_locks[ICE_BLK_COUNT]; /* lock fltr profiles */
722 struct list_head fl_profs[ICE_BLK_COUNT];
724 /* Flow Director filter info */
725 int fdir_active_fltr;
727 struct mutex fdir_fltr_lock; /* protect Flow Director */
728 struct list_head fdir_list_head;
730 /* Book-keeping of side-band filter count per flow-type.
731 * This is used to detect and handle input set changes for
732 * respective flow-type.
734 u16 fdir_fltr_cnt[ICE_FLTR_PTYPE_MAX];
736 struct ice_fd_hw_prof **fdir_prof;
737 DECLARE_BITMAP(fdir_perfect_fltr, ICE_FLTR_PTYPE_MAX);
738 struct mutex rss_locks; /* protect RSS configuration */
739 struct list_head rss_list_head;
742 /* Statistics collected by each port, VSI, VEB, and S-channel */
743 struct ice_eth_stats {
744 u64 rx_bytes; /* gorc */
745 u64 rx_unicast; /* uprc */
746 u64 rx_multicast; /* mprc */
747 u64 rx_broadcast; /* bprc */
748 u64 rx_discards; /* rdpc */
749 u64 rx_unknown_protocol; /* rupp */
750 u64 tx_bytes; /* gotc */
751 u64 tx_unicast; /* uptc */
752 u64 tx_multicast; /* mptc */
753 u64 tx_broadcast; /* bptc */
754 u64 tx_discards; /* tdpc */
755 u64 tx_errors; /* tepc */
760 /* Statistics collected by the MAC */
761 struct ice_hw_port_stats {
762 /* eth stats collected by the port */
763 struct ice_eth_stats eth;
764 /* additional port specific stats */
765 u64 tx_dropped_link_down; /* tdold */
766 u64 crc_errors; /* crcerrs */
767 u64 illegal_bytes; /* illerrc */
768 u64 error_bytes; /* errbc */
769 u64 mac_local_faults; /* mlfc */
770 u64 mac_remote_faults; /* mrfc */
771 u64 rx_len_errors; /* rlec */
772 u64 link_xon_rx; /* lxonrxc */
773 u64 link_xoff_rx; /* lxoffrxc */
774 u64 link_xon_tx; /* lxontxc */
775 u64 link_xoff_tx; /* lxofftxc */
776 u64 priority_xon_rx[8]; /* pxonrxc[8] */
777 u64 priority_xoff_rx[8]; /* pxoffrxc[8] */
778 u64 priority_xon_tx[8]; /* pxontxc[8] */
779 u64 priority_xoff_tx[8]; /* pxofftxc[8] */
780 u64 priority_xon_2_xoff[8]; /* pxon2offc[8] */
781 u64 rx_size_64; /* prc64 */
782 u64 rx_size_127; /* prc127 */
783 u64 rx_size_255; /* prc255 */
784 u64 rx_size_511; /* prc511 */
785 u64 rx_size_1023; /* prc1023 */
786 u64 rx_size_1522; /* prc1522 */
787 u64 rx_size_big; /* prc9522 */
788 u64 rx_undersize; /* ruc */
789 u64 rx_fragments; /* rfc */
790 u64 rx_oversize; /* roc */
791 u64 rx_jabber; /* rjc */
792 u64 tx_size_64; /* ptc64 */
793 u64 tx_size_127; /* ptc127 */
794 u64 tx_size_255; /* ptc255 */
795 u64 tx_size_511; /* ptc511 */
796 u64 tx_size_1023; /* ptc1023 */
797 u64 tx_size_1522; /* ptc1522 */
798 u64 tx_size_big; /* ptc9522 */
799 /* flow director stats */
804 /* Checksum and Shadow RAM pointers */
805 #define ICE_SR_NVM_CTRL_WORD 0x00
806 #define ICE_SR_BOOT_CFG_PTR 0x132
807 #define ICE_SR_NVM_WOL_CFG 0x19
808 #define ICE_NVM_OROM_VER_OFF 0x02
809 #define ICE_SR_PBA_BLOCK_PTR 0x16
810 #define ICE_SR_NVM_DEV_STARTER_VER 0x18
811 #define ICE_SR_NVM_EETRACK_LO 0x2D
812 #define ICE_SR_NVM_EETRACK_HI 0x2E
813 #define ICE_NVM_VER_LO_SHIFT 0
814 #define ICE_NVM_VER_LO_MASK (0xff << ICE_NVM_VER_LO_SHIFT)
815 #define ICE_NVM_VER_HI_SHIFT 12
816 #define ICE_NVM_VER_HI_MASK (0xf << ICE_NVM_VER_HI_SHIFT)
817 #define ICE_OROM_VER_PATCH_SHIFT 0
818 #define ICE_OROM_VER_PATCH_MASK (0xff << ICE_OROM_VER_PATCH_SHIFT)
819 #define ICE_OROM_VER_BUILD_SHIFT 8
820 #define ICE_OROM_VER_BUILD_MASK (0xffff << ICE_OROM_VER_BUILD_SHIFT)
821 #define ICE_OROM_VER_SHIFT 24
822 #define ICE_OROM_VER_MASK (0xff << ICE_OROM_VER_SHIFT)
823 #define ICE_SR_PFA_PTR 0x40
824 #define ICE_SR_1ST_NVM_BANK_PTR 0x42
825 #define ICE_SR_NVM_BANK_SIZE 0x43
826 #define ICE_SR_1ST_OROM_BANK_PTR 0x44
827 #define ICE_SR_OROM_BANK_SIZE 0x45
828 #define ICE_SR_NETLIST_BANK_PTR 0x46
829 #define ICE_SR_NETLIST_BANK_SIZE 0x47
830 #define ICE_SR_SECTOR_SIZE_IN_WORDS 0x800
832 /* CSS Header words */
833 #define ICE_NVM_CSS_SREV_L 0x14
834 #define ICE_NVM_CSS_SREV_H 0x15
836 /* Length of CSS header section in words */
837 #define ICE_CSS_HEADER_LENGTH 330
839 /* Offset of Shadow RAM copy in the NVM bank area. */
840 #define ICE_NVM_SR_COPY_WORD_OFFSET roundup(ICE_CSS_HEADER_LENGTH, 32)
842 /* Size in bytes of Option ROM trailer */
843 #define ICE_NVM_OROM_TRAILER_LENGTH (2 * ICE_CSS_HEADER_LENGTH)
845 /* The Link Topology Netlist section is stored as a series of words. It is
846 * stored in the NVM as a TLV, with the first two words containing the type
849 #define ICE_NETLIST_LINK_TOPO_MOD_ID 0x011B
850 #define ICE_NETLIST_TYPE_OFFSET 0x0000
851 #define ICE_NETLIST_LEN_OFFSET 0x0001
853 /* The Link Topology section follows the TLV header. When reading the netlist
854 * using ice_read_netlist_module, we need to account for the 2-word TLV
857 #define ICE_NETLIST_LINK_TOPO_OFFSET(n) ((n) + 2)
859 #define ICE_LINK_TOPO_MODULE_LEN ICE_NETLIST_LINK_TOPO_OFFSET(0x0000)
860 #define ICE_LINK_TOPO_NODE_COUNT ICE_NETLIST_LINK_TOPO_OFFSET(0x0001)
862 #define ICE_LINK_TOPO_NODE_COUNT_M ICE_M(0x3FF, 0)
864 /* The Netlist ID Block is located after all of the Link Topology nodes. */
865 #define ICE_NETLIST_ID_BLK_SIZE 0x30
866 #define ICE_NETLIST_ID_BLK_OFFSET(n) ICE_NETLIST_LINK_TOPO_OFFSET(0x0004 + 2 * (n))
868 /* netlist ID block field offsets (word offsets) */
869 #define ICE_NETLIST_ID_BLK_MAJOR_VER_LOW 0x02
870 #define ICE_NETLIST_ID_BLK_MAJOR_VER_HIGH 0x03
871 #define ICE_NETLIST_ID_BLK_MINOR_VER_LOW 0x04
872 #define ICE_NETLIST_ID_BLK_MINOR_VER_HIGH 0x05
873 #define ICE_NETLIST_ID_BLK_TYPE_LOW 0x06
874 #define ICE_NETLIST_ID_BLK_TYPE_HIGH 0x07
875 #define ICE_NETLIST_ID_BLK_REV_LOW 0x08
876 #define ICE_NETLIST_ID_BLK_REV_HIGH 0x09
877 #define ICE_NETLIST_ID_BLK_SHA_HASH_WORD(n) (0x0A + (n))
878 #define ICE_NETLIST_ID_BLK_CUST_VER 0x2F
880 /* Auxiliary field, mask, and shift definition for Shadow RAM and NVM Flash */
881 #define ICE_SR_CTRL_WORD_1_S 0x06
882 #define ICE_SR_CTRL_WORD_1_M (0x03 << ICE_SR_CTRL_WORD_1_S)
883 #define ICE_SR_CTRL_WORD_VALID 0x1
884 #define ICE_SR_CTRL_WORD_OROM_BANK BIT(3)
885 #define ICE_SR_CTRL_WORD_NETLIST_BANK BIT(4)
886 #define ICE_SR_CTRL_WORD_NVM_BANK BIT(5)
888 #define ICE_SR_NVM_PTR_4KB_UNITS BIT(15)
890 /* Link override related */
891 #define ICE_SR_PFA_LINK_OVERRIDE_WORDS 10
892 #define ICE_SR_PFA_LINK_OVERRIDE_PHY_WORDS 4
893 #define ICE_SR_PFA_LINK_OVERRIDE_OFFSET 2
894 #define ICE_SR_PFA_LINK_OVERRIDE_FEC_OFFSET 1
895 #define ICE_SR_PFA_LINK_OVERRIDE_PHY_OFFSET 2
896 #define ICE_FW_API_LINK_OVERRIDE_MAJ 1
897 #define ICE_FW_API_LINK_OVERRIDE_MIN 5
898 #define ICE_FW_API_LINK_OVERRIDE_PATCH 2
900 #define ICE_SR_WORDS_IN_1KB 512
902 /* Hash redirection LUT for VSI - maximum array size */
903 #define ICE_VSIQF_HLUT_ARRAY_SIZE ((VSIQF_HLUT_MAX_INDEX + 1) * 4)
905 #endif /* _ICE_TYPE_H_ */