net/txgbe: support DCB
[dpdk.git] / drivers / net / txgbe / base / txgbe_type.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2015-2020
3  */
4
5 #ifndef _TXGBE_TYPE_H_
6 #define _TXGBE_TYPE_H_
7
8 #define TXGBE_DCB_TC_MAX        TXGBE_MAX_UP
9 #define TXGBE_DCB_UP_MAX        TXGBE_MAX_UP
10 #define TXGBE_DCB_BWG_MAX       TXGBE_MAX_UP
11 #define TXGBE_LINK_UP_TIME      90 /* 9.0 Seconds */
12 #define TXGBE_AUTO_NEG_TIME     45 /* 4.5 Seconds */
13
14 #define TXGBE_FRAME_SIZE_MAX    (9728) /* Maximum frame size, +FCS */
15 #define TXGBE_FRAME_SIZE_DFT    (1518) /* Default frame size, +FCS */
16 #define TXGBE_NUM_POOL          (64)
17 #define TXGBE_PBTXSIZE_MAX      0x00028000 /* 160KB Packet Buffer */
18 #define TXGBE_TXPKT_SIZE_MAX    0xA /* Max Tx Packet size */
19 #define TXGBE_MAX_UP            8
20 #define TXGBE_MAX_QP            (128)
21 #define TXGBE_MAX_UTA           128
22
23 #define TXGBE_ALIGN             128 /* as intel did */
24
25 #include "txgbe_status.h"
26 #include "txgbe_osdep.h"
27 #include "txgbe_devids.h"
28
29 struct txgbe_thermal_diode_data {
30         s16 temp;
31         s16 alarm_thresh;
32         s16 dalarm_thresh;
33 };
34
35 struct txgbe_thermal_sensor_data {
36         struct txgbe_thermal_diode_data sensor[1];
37 };
38
39 /* Packet buffer allocation strategies */
40 enum {
41         PBA_STRATEGY_EQUAL      = 0, /* Distribute PB space equally */
42 #define PBA_STRATEGY_EQUAL      PBA_STRATEGY_EQUAL
43         PBA_STRATEGY_WEIGHTED   = 1, /* Weight front half of TCs */
44 #define PBA_STRATEGY_WEIGHTED   PBA_STRATEGY_WEIGHTED
45 };
46
47 /* Physical layer type */
48 #define TXGBE_PHYSICAL_LAYER_UNKNOWN            0
49 #define TXGBE_PHYSICAL_LAYER_10GBASE_T          0x00001
50 #define TXGBE_PHYSICAL_LAYER_1000BASE_T         0x00002
51 #define TXGBE_PHYSICAL_LAYER_100BASE_TX         0x00004
52 #define TXGBE_PHYSICAL_LAYER_SFP_PLUS_CU        0x00008
53 #define TXGBE_PHYSICAL_LAYER_10GBASE_LR         0x00010
54 #define TXGBE_PHYSICAL_LAYER_10GBASE_LRM        0x00020
55 #define TXGBE_PHYSICAL_LAYER_10GBASE_SR         0x00040
56 #define TXGBE_PHYSICAL_LAYER_10GBASE_KX4        0x00080
57 #define TXGBE_PHYSICAL_LAYER_10GBASE_CX4        0x00100
58 #define TXGBE_PHYSICAL_LAYER_1000BASE_KX        0x00200
59 #define TXGBE_PHYSICAL_LAYER_1000BASE_BX        0x00400
60 #define TXGBE_PHYSICAL_LAYER_10GBASE_KR         0x00800
61 #define TXGBE_PHYSICAL_LAYER_10GBASE_XAUI       0x01000
62 #define TXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA      0x02000
63 #define TXGBE_PHYSICAL_LAYER_1000BASE_SX        0x04000
64 #define TXGBE_PHYSICAL_LAYER_10BASE_T           0x08000
65 #define TXGBE_PHYSICAL_LAYER_2500BASE_KX        0x10000
66
67 #define TXGBE_ATR_HASH_MASK                     0x7fff
68
69 enum txgbe_eeprom_type {
70         txgbe_eeprom_unknown = 0,
71         txgbe_eeprom_spi,
72         txgbe_eeprom_flash,
73         txgbe_eeprom_none /* No NVM support */
74 };
75
76 enum txgbe_mac_type {
77         txgbe_mac_unknown = 0,
78         txgbe_mac_raptor,
79         txgbe_mac_raptor_vf,
80         txgbe_num_macs
81 };
82
83 enum txgbe_phy_type {
84         txgbe_phy_unknown = 0,
85         txgbe_phy_none,
86         txgbe_phy_tn,
87         txgbe_phy_aq,
88         txgbe_phy_ext_1g_t,
89         txgbe_phy_cu_mtd,
90         txgbe_phy_cu_unknown,
91         txgbe_phy_qt,
92         txgbe_phy_xaui,
93         txgbe_phy_nl,
94         txgbe_phy_sfp_tyco_passive,
95         txgbe_phy_sfp_unknown_passive,
96         txgbe_phy_sfp_unknown_active,
97         txgbe_phy_sfp_avago,
98         txgbe_phy_sfp_ftl,
99         txgbe_phy_sfp_ftl_active,
100         txgbe_phy_sfp_unknown,
101         txgbe_phy_sfp_intel,
102         txgbe_phy_qsfp_unknown_passive,
103         txgbe_phy_qsfp_unknown_active,
104         txgbe_phy_qsfp_intel,
105         txgbe_phy_qsfp_unknown,
106         txgbe_phy_sfp_unsupported, /* Enforce bit set with unsupported module */
107         txgbe_phy_sgmii,
108         txgbe_phy_fw,
109         txgbe_phy_generic
110 };
111
112 /*
113  * SFP+ module type IDs:
114  *
115  * ID   Module Type
116  * =============
117  * 0    SFP_DA_CU
118  * 1    SFP_SR
119  * 2    SFP_LR
120  * 3    SFP_DA_CU_CORE0 - chip-specific
121  * 4    SFP_DA_CU_CORE1 - chip-specific
122  * 5    SFP_SR/LR_CORE0 - chip-specific
123  * 6    SFP_SR/LR_CORE1 - chip-specific
124  */
125 enum txgbe_sfp_type {
126         txgbe_sfp_type_unknown = 0,
127         txgbe_sfp_type_da_cu,
128         txgbe_sfp_type_sr,
129         txgbe_sfp_type_lr,
130         txgbe_sfp_type_da_cu_core0,
131         txgbe_sfp_type_da_cu_core1,
132         txgbe_sfp_type_srlr_core0,
133         txgbe_sfp_type_srlr_core1,
134         txgbe_sfp_type_da_act_lmt_core0,
135         txgbe_sfp_type_da_act_lmt_core1,
136         txgbe_sfp_type_1g_cu_core0,
137         txgbe_sfp_type_1g_cu_core1,
138         txgbe_sfp_type_1g_sx_core0,
139         txgbe_sfp_type_1g_sx_core1,
140         txgbe_sfp_type_1g_lx_core0,
141         txgbe_sfp_type_1g_lx_core1,
142         txgbe_sfp_type_not_present = 0xFFFE,
143         txgbe_sfp_type_not_known = 0xFFFF
144 };
145
146 enum txgbe_media_type {
147         txgbe_media_type_unknown = 0,
148         txgbe_media_type_fiber,
149         txgbe_media_type_fiber_qsfp,
150         txgbe_media_type_copper,
151         txgbe_media_type_backplane,
152         txgbe_media_type_cx4,
153         txgbe_media_type_virtual
154 };
155
156
157 /* Smart Speed Settings */
158 #define TXGBE_SMARTSPEED_MAX_RETRIES    3
159 enum txgbe_smart_speed {
160         txgbe_smart_speed_auto = 0,
161         txgbe_smart_speed_on,
162         txgbe_smart_speed_off
163 };
164
165 /* PCI bus types */
166 enum txgbe_bus_type {
167         txgbe_bus_type_unknown = 0,
168         txgbe_bus_type_pci,
169         txgbe_bus_type_pcix,
170         txgbe_bus_type_pci_express,
171         txgbe_bus_type_internal,
172         txgbe_bus_type_reserved
173 };
174
175 /* PCI bus speeds */
176 enum txgbe_bus_speed {
177         txgbe_bus_speed_unknown = 0,
178         txgbe_bus_speed_33      = 33,
179         txgbe_bus_speed_66      = 66,
180         txgbe_bus_speed_100     = 100,
181         txgbe_bus_speed_120     = 120,
182         txgbe_bus_speed_133     = 133,
183         txgbe_bus_speed_2500    = 2500,
184         txgbe_bus_speed_5000    = 5000,
185         txgbe_bus_speed_8000    = 8000,
186         txgbe_bus_speed_reserved
187 };
188
189 /* PCI bus widths */
190 enum txgbe_bus_width {
191         txgbe_bus_width_unknown = 0,
192         txgbe_bus_width_pcie_x1 = 1,
193         txgbe_bus_width_pcie_x2 = 2,
194         txgbe_bus_width_pcie_x4 = 4,
195         txgbe_bus_width_pcie_x8 = 8,
196         txgbe_bus_width_32      = 32,
197         txgbe_bus_width_64      = 64,
198         txgbe_bus_width_reserved
199 };
200
201 struct txgbe_hw;
202
203 struct txgbe_addr_filter_info {
204         u32 num_mc_addrs;
205         u32 rar_used_count;
206         u32 mta_in_use;
207         u32 overflow_promisc;
208         bool user_set_promisc;
209 };
210
211 /* Bus parameters */
212 struct txgbe_bus_info {
213         s32 (*get_bus_info)(struct txgbe_hw *hw);
214         void (*set_lan_id)(struct txgbe_hw *hw);
215
216         enum txgbe_bus_speed speed;
217         enum txgbe_bus_width width;
218         enum txgbe_bus_type type;
219
220         u16 func;
221         u8 lan_id;
222         u16 instance_id;
223 };
224
225 /* Statistics counters collected by the MAC */
226 /* PB[] RxTx */
227 struct txgbe_pb_stats {
228         u64 tx_pb_xon_packets;
229         u64 rx_pb_xon_packets;
230         u64 tx_pb_xoff_packets;
231         u64 rx_pb_xoff_packets;
232         u64 rx_pb_dropped;
233         u64 rx_pb_mbuf_alloc_errors;
234         u64 tx_pb_xon2off_packets;
235 };
236
237 /* QP[] RxTx */
238 struct txgbe_qp_stats {
239         u64 rx_qp_packets;
240         u64 tx_qp_packets;
241         u64 rx_qp_bytes;
242         u64 tx_qp_bytes;
243         u64 rx_qp_mc_packets;
244 };
245
246 struct txgbe_hw_stats {
247         /* MNG RxTx */
248         u64 mng_bmc2host_packets;
249         u64 mng_host2bmc_packets;
250         /* Basix RxTx */
251         u64 rx_packets;
252         u64 tx_packets;
253         u64 rx_bytes;
254         u64 tx_bytes;
255         u64 rx_total_bytes;
256         u64 rx_total_packets;
257         u64 tx_total_packets;
258         u64 rx_total_missed_packets;
259         u64 rx_broadcast_packets;
260         u64 tx_broadcast_packets;
261         u64 rx_multicast_packets;
262         u64 tx_multicast_packets;
263         u64 rx_management_packets;
264         u64 tx_management_packets;
265         u64 rx_management_dropped;
266         u64 rx_drop_packets;
267
268         /* Basic Error */
269         u64 rx_crc_errors;
270         u64 rx_illegal_byte_errors;
271         u64 rx_error_bytes;
272         u64 rx_mac_short_packet_dropped;
273         u64 rx_length_errors;
274         u64 rx_undersize_errors;
275         u64 rx_fragment_errors;
276         u64 rx_oversize_errors;
277         u64 rx_jabber_errors;
278         u64 rx_l3_l4_xsum_error;
279         u64 mac_local_errors;
280         u64 mac_remote_errors;
281
282         /* Flow Director */
283         u64 flow_director_added_filters;
284         u64 flow_director_removed_filters;
285         u64 flow_director_filter_add_errors;
286         u64 flow_director_filter_remove_errors;
287         u64 flow_director_matched_filters;
288         u64 flow_director_missed_filters;
289
290         /* FCoE */
291         u64 rx_fcoe_crc_errors;
292         u64 rx_fcoe_mbuf_allocation_errors;
293         u64 rx_fcoe_dropped;
294         u64 rx_fcoe_packets;
295         u64 tx_fcoe_packets;
296         u64 rx_fcoe_bytes;
297         u64 tx_fcoe_bytes;
298         u64 rx_fcoe_no_ddp;
299         u64 rx_fcoe_no_ddp_ext_buff;
300
301         /* MACSEC */
302         u64 tx_macsec_pkts_untagged;
303         u64 tx_macsec_pkts_encrypted;
304         u64 tx_macsec_pkts_protected;
305         u64 tx_macsec_octets_encrypted;
306         u64 tx_macsec_octets_protected;
307         u64 rx_macsec_pkts_untagged;
308         u64 rx_macsec_pkts_badtag;
309         u64 rx_macsec_pkts_nosci;
310         u64 rx_macsec_pkts_unknownsci;
311         u64 rx_macsec_octets_decrypted;
312         u64 rx_macsec_octets_validated;
313         u64 rx_macsec_sc_pkts_unchecked;
314         u64 rx_macsec_sc_pkts_delayed;
315         u64 rx_macsec_sc_pkts_late;
316         u64 rx_macsec_sa_pkts_ok;
317         u64 rx_macsec_sa_pkts_invalid;
318         u64 rx_macsec_sa_pkts_notvalid;
319         u64 rx_macsec_sa_pkts_unusedsa;
320         u64 rx_macsec_sa_pkts_notusingsa;
321
322         /* MAC RxTx */
323         u64 rx_size_64_packets;
324         u64 rx_size_65_to_127_packets;
325         u64 rx_size_128_to_255_packets;
326         u64 rx_size_256_to_511_packets;
327         u64 rx_size_512_to_1023_packets;
328         u64 rx_size_1024_to_max_packets;
329         u64 tx_size_64_packets;
330         u64 tx_size_65_to_127_packets;
331         u64 tx_size_128_to_255_packets;
332         u64 tx_size_256_to_511_packets;
333         u64 tx_size_512_to_1023_packets;
334         u64 tx_size_1024_to_max_packets;
335
336         /* Flow Control */
337         u64 tx_xon_packets;
338         u64 rx_xon_packets;
339         u64 tx_xoff_packets;
340         u64 rx_xoff_packets;
341
342         /* PB[] RxTx */
343         struct {
344                 u64 rx_up_packets;
345                 u64 tx_up_packets;
346                 u64 rx_up_bytes;
347                 u64 tx_up_bytes;
348                 u64 rx_up_drop_packets;
349
350                 u64 tx_up_xon_packets;
351                 u64 rx_up_xon_packets;
352                 u64 tx_up_xoff_packets;
353                 u64 rx_up_xoff_packets;
354                 u64 rx_up_dropped;
355                 u64 rx_up_mbuf_alloc_errors;
356                 u64 tx_up_xon2off_packets;
357         } up[TXGBE_MAX_UP];
358
359         /* QP[] RxTx */
360         struct {
361                 u64 rx_qp_packets;
362                 u64 tx_qp_packets;
363                 u64 rx_qp_bytes;
364                 u64 tx_qp_bytes;
365                 u64 rx_qp_mc_packets;
366         } qp[TXGBE_MAX_QP];
367
368 };
369
370 /* iterator type for walking multicast address lists */
371 typedef u8* (*txgbe_mc_addr_itr) (struct txgbe_hw *hw, u8 **mc_addr_ptr,
372                                   u32 *vmdq);
373
374 struct txgbe_link_info {
375         s32 (*read_link)(struct txgbe_hw *hw, u8 addr, u16 reg, u16 *val);
376         s32 (*read_link_unlocked)(struct txgbe_hw *hw, u8 addr, u16 reg,
377                                   u16 *val);
378         s32 (*write_link)(struct txgbe_hw *hw, u8 addr, u16 reg, u16 val);
379         s32 (*write_link_unlocked)(struct txgbe_hw *hw, u8 addr, u16 reg,
380                                    u16 val);
381
382         u8 addr;
383 };
384
385 struct txgbe_rom_info {
386         s32 (*init_params)(struct txgbe_hw *hw);
387         s32 (*read16)(struct txgbe_hw *hw, u32 offset, u16 *data);
388         s32 (*readw_sw)(struct txgbe_hw *hw, u32 offset, u16 *data);
389         s32 (*readw_buffer)(struct txgbe_hw *hw, u32 offset, u32 words,
390                             void *data);
391         s32 (*read32)(struct txgbe_hw *hw, u32 addr, u32 *data);
392         s32 (*read_buffer)(struct txgbe_hw *hw, u32 addr, u32 len, void *data);
393         s32 (*write16)(struct txgbe_hw *hw, u32 offset, u16 data);
394         s32 (*writew_sw)(struct txgbe_hw *hw, u32 offset, u16 data);
395         s32 (*writew_buffer)(struct txgbe_hw *hw, u32 offset, u32 words,
396                              void *data);
397         s32 (*write32)(struct txgbe_hw *hw, u32 addr, u32 data);
398         s32 (*write_buffer)(struct txgbe_hw *hw, u32 addr, u32 len, void *data);
399         s32 (*validate_checksum)(struct txgbe_hw *hw, u16 *checksum_val);
400         s32 (*update_checksum)(struct txgbe_hw *hw);
401         s32 (*calc_checksum)(struct txgbe_hw *hw);
402
403         enum txgbe_eeprom_type type;
404         u32 semaphore_delay;
405         u16 word_size;
406         u16 address_bits;
407         u16 word_page_size;
408         u16 ctrl_word_3;
409
410         u32 sw_addr;
411 };
412
413 struct txgbe_flash_info {
414         u32 semaphore_delay;
415         u32 dword_size;
416         u16 address_bits;
417 };
418
419 #define TXGBE_FLAGS_DOUBLE_RESET_REQUIRED       0x01
420 struct txgbe_mac_info {
421         s32 (*init_hw)(struct txgbe_hw *hw);
422         s32 (*reset_hw)(struct txgbe_hw *hw);
423         s32 (*start_hw)(struct txgbe_hw *hw);
424         s32 (*stop_hw)(struct txgbe_hw *hw);
425         s32 (*clear_hw_cntrs)(struct txgbe_hw *hw);
426         s32 (*get_mac_addr)(struct txgbe_hw *hw, u8 *mac_addr);
427         s32 (*get_san_mac_addr)(struct txgbe_hw *hw, u8 *san_mac_addr);
428         s32 (*set_san_mac_addr)(struct txgbe_hw *hw, u8 *san_mac_addr);
429         s32 (*get_device_caps)(struct txgbe_hw *hw, u16 *device_caps);
430         s32 (*get_wwn_prefix)(struct txgbe_hw *hw, u16 *wwnn_prefix,
431                                  u16 *wwpn_prefix);
432         s32 (*setup_sfp)(struct txgbe_hw *hw);
433         s32 (*enable_rx_dma)(struct txgbe_hw *hw, u32 regval);
434         s32 (*disable_sec_rx_path)(struct txgbe_hw *hw);
435         s32 (*enable_sec_rx_path)(struct txgbe_hw *hw);
436         s32 (*disable_sec_tx_path)(struct txgbe_hw *hw);
437         s32 (*enable_sec_tx_path)(struct txgbe_hw *hw);
438         s32 (*acquire_swfw_sync)(struct txgbe_hw *hw, u32 mask);
439         void (*release_swfw_sync)(struct txgbe_hw *hw, u32 mask);
440         u64 (*autoc_read)(struct txgbe_hw *hw);
441         void (*autoc_write)(struct txgbe_hw *hw, u64 value);
442         s32 (*prot_autoc_read)(struct txgbe_hw *hw, bool *locked, u64 *value);
443         s32 (*prot_autoc_write)(struct txgbe_hw *hw, bool locked, u64 value);
444         s32 (*negotiate_api_version)(struct txgbe_hw *hw, int api);
445
446         /* Link */
447         void (*disable_tx_laser)(struct txgbe_hw *hw);
448         void (*enable_tx_laser)(struct txgbe_hw *hw);
449         void (*flap_tx_laser)(struct txgbe_hw *hw);
450         s32 (*setup_link)(struct txgbe_hw *hw, u32 speed,
451                                bool autoneg_wait_to_complete);
452         s32 (*setup_mac_link)(struct txgbe_hw *hw, u32 speed,
453                                bool autoneg_wait_to_complete);
454         s32 (*check_link)(struct txgbe_hw *hw, u32 *speed,
455                                bool *link_up, bool link_up_wait_to_complete);
456         s32 (*get_link_capabilities)(struct txgbe_hw *hw,
457                                       u32 *speed, bool *autoneg);
458         void (*set_rate_select_speed)(struct txgbe_hw *hw, u32 speed);
459
460         /* Packet Buffer manipulation */
461         void (*setup_pba)(struct txgbe_hw *hw, int num_pb, u32 headroom,
462                              int strategy);
463
464         /* LED */
465         s32 (*led_on)(struct txgbe_hw *hw, u32 index);
466         s32 (*led_off)(struct txgbe_hw *hw, u32 index);
467
468         /* RAR, Multicast, VLAN */
469         s32 (*set_rar)(struct txgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
470                           u32 enable_addr);
471         s32 (*set_uc_addr)(struct txgbe_hw *hw, u32 index, u8 *addr);
472         s32 (*clear_rar)(struct txgbe_hw *hw, u32 index);
473         s32 (*set_vmdq)(struct txgbe_hw *hw, u32 rar, u32 vmdq);
474         s32 (*clear_vmdq)(struct txgbe_hw *hw, u32 rar, u32 vmdq);
475         s32 (*init_rx_addrs)(struct txgbe_hw *hw);
476         s32 (*update_mc_addr_list)(struct txgbe_hw *hw, u8 *mc_addr_list,
477                                       u32 mc_addr_count,
478                                       txgbe_mc_addr_itr func, bool clear);
479         s32 (*clear_vfta)(struct txgbe_hw *hw);
480         s32 (*set_vfta)(struct txgbe_hw *hw, u32 vlan,
481                          u32 vind, bool vlan_on, bool vlvf_bypass);
482         s32 (*set_vlvf)(struct txgbe_hw *hw, u32 vlan, u32 vind,
483                            bool vlan_on, u32 *vfta_delta, u32 vfta,
484                            bool vlvf_bypass);
485         s32 (*init_uta_tables)(struct txgbe_hw *hw);
486         void (*set_mac_anti_spoofing)(struct txgbe_hw *hw, bool enable, int vf);
487         void (*set_vlan_anti_spoofing)(struct txgbe_hw *hw,
488                                         bool enable, int vf);
489         s32 (*update_xcast_mode)(struct txgbe_hw *hw, int xcast_mode);
490         s32 (*set_rlpml)(struct txgbe_hw *hw, u16 max_size);
491
492         /* Flow Control */
493         s32 (*fc_enable)(struct txgbe_hw *hw);
494         s32 (*setup_fc)(struct txgbe_hw *hw);
495         void (*fc_autoneg)(struct txgbe_hw *hw);
496
497         /* Manageability interface */
498         s32 (*set_fw_drv_ver)(struct txgbe_hw *hw, u8 maj, u8 min, u8 build,
499                          u8 ver, u16 len, const char *driver_ver);
500         s32 (*get_thermal_sensor_data)(struct txgbe_hw *hw);
501         s32 (*init_thermal_sensor_thresh)(struct txgbe_hw *hw);
502         void (*get_rtrup2tc)(struct txgbe_hw *hw, u8 *map);
503         void (*disable_rx)(struct txgbe_hw *hw);
504         void (*enable_rx)(struct txgbe_hw *hw);
505         void (*set_ethertype_anti_spoofing)(struct txgbe_hw *hw,
506                                                 bool enable, int vf);
507         s32 (*dmac_update_tcs)(struct txgbe_hw *hw);
508         s32 (*dmac_config_tcs)(struct txgbe_hw *hw);
509         s32 (*dmac_config)(struct txgbe_hw *hw);
510         s32 (*setup_eee)(struct txgbe_hw *hw, bool enable_eee);
511
512         enum txgbe_mac_type type;
513         u8 addr[ETH_ADDR_LEN];
514         u8 perm_addr[ETH_ADDR_LEN];
515         u8 san_addr[ETH_ADDR_LEN];
516         /* prefix for World Wide Node Name (WWNN) */
517         u16 wwnn_prefix;
518         /* prefix for World Wide Port Name (WWPN) */
519         u16 wwpn_prefix;
520 #define TXGBE_MAX_MTA                   128
521         u32 mta_shadow[TXGBE_MAX_MTA];
522         s32 mc_filter_type;
523         u32 mcft_size;
524         u32 vft_size;
525         u32 num_rar_entries;
526         u32 rx_pb_size;
527         u32 max_tx_queues;
528         u32 max_rx_queues;
529         u8  san_mac_rar_index;
530         bool get_link_status;
531         u64 orig_autoc;  /* cached value of AUTOC */
532         bool orig_link_settings_stored;
533         bool autotry_restart;
534         u8 flags;
535         struct txgbe_thermal_sensor_data  thermal_sensor_data;
536         bool set_lben;
537         u32  max_link_up_time;
538 };
539
540 struct txgbe_phy_info {
541         u32 (*get_media_type)(struct txgbe_hw *hw);
542         s32 (*identify)(struct txgbe_hw *hw);
543         s32 (*identify_sfp)(struct txgbe_hw *hw);
544         s32 (*init)(struct txgbe_hw *hw);
545         s32 (*reset)(struct txgbe_hw *hw);
546         s32 (*read_reg)(struct txgbe_hw *hw, u32 reg_addr,
547                                 u32 device_type, u16 *phy_data);
548         s32 (*write_reg)(struct txgbe_hw *hw, u32 reg_addr,
549                                 u32 device_type, u16 phy_data);
550         s32 (*read_reg_mdi)(struct txgbe_hw *hw, u32 reg_addr,
551                                 u32 device_type, u16 *phy_data);
552         s32 (*write_reg_mdi)(struct txgbe_hw *hw, u32 reg_addr,
553                                 u32 device_type, u16 phy_data);
554         s32 (*setup_link)(struct txgbe_hw *hw);
555         s32 (*setup_internal_link)(struct txgbe_hw *hw);
556         s32 (*setup_link_speed)(struct txgbe_hw *hw, u32 speed,
557                                 bool autoneg_wait_to_complete);
558         s32 (*check_link)(struct txgbe_hw *hw, u32 *speed, bool *link_up);
559         s32 (*read_i2c_byte)(struct txgbe_hw *hw, u8 byte_offset,
560                                 u8 dev_addr, u8 *data);
561         s32 (*write_i2c_byte)(struct txgbe_hw *hw, u8 byte_offset,
562                                 u8 dev_addr, u8 data);
563         s32 (*read_i2c_sff8472)(struct txgbe_hw *hw, u8 byte_offset,
564                                 u8 *sff8472_data);
565         s32 (*read_i2c_eeprom)(struct txgbe_hw *hw, u8 byte_offset,
566                                 u8 *eeprom_data);
567         s32 (*write_i2c_eeprom)(struct txgbe_hw *hw, u8 byte_offset,
568                                 u8 eeprom_data);
569         s32 (*check_overtemp)(struct txgbe_hw *hw);
570         s32 (*set_phy_power)(struct txgbe_hw *hw, bool on);
571         s32 (*handle_lasi)(struct txgbe_hw *hw);
572         s32 (*read_i2c_byte_unlocked)(struct txgbe_hw *hw, u8 offset, u8 addr,
573                                       u8 *value);
574         s32 (*write_i2c_byte_unlocked)(struct txgbe_hw *hw, u8 offset, u8 addr,
575                                        u8 value);
576
577         enum txgbe_phy_type type;
578         u32 addr;
579         u32 id;
580         enum txgbe_sfp_type sfp_type;
581         bool sfp_setup_needed;
582         u32 revision;
583         u32 media_type;
584         u32 phy_semaphore_mask;
585         bool reset_disable;
586         u32 autoneg_advertised;
587         u32 speeds_supported;
588         enum txgbe_smart_speed smart_speed;
589         bool smart_speed_active;
590         bool multispeed_fiber;
591         bool qsfp_shared_i2c_bus;
592         u32 nw_mng_if_sel;
593         u32 link_mode;
594 };
595
596 struct txgbe_mbx_stats {
597         u32 msgs_tx;
598         u32 msgs_rx;
599
600         u32 acks;
601         u32 reqs;
602         u32 rsts;
603 };
604
605 struct txgbe_mbx_info {
606         void (*init_params)(struct txgbe_hw *hw);
607         s32  (*read)(struct txgbe_hw *hw, u32 *msg, u16 size, u16 vf_number);
608         s32  (*write)(struct txgbe_hw *hw, u32 *msg, u16 size, u16 vf_number);
609         s32  (*read_posted)(struct txgbe_hw *hw, u32 *msg, u16 size,
610                                 u16 mbx_id);
611         s32  (*write_posted)(struct txgbe_hw *hw, u32 *msg, u16 size,
612                                 u16 mbx_id);
613         s32  (*check_for_msg)(struct txgbe_hw *hw, u16 mbx_id);
614         s32  (*check_for_ack)(struct txgbe_hw *hw, u16 mbx_id);
615         s32  (*check_for_rst)(struct txgbe_hw *hw, u16 mbx_id);
616
617         struct txgbe_mbx_stats stats;
618         u32 timeout;
619         u32 usec_delay;
620         u16 size;
621 };
622
623 enum txgbe_isb_idx {
624         TXGBE_ISB_HEADER,
625         TXGBE_ISB_MISC,
626         TXGBE_ISB_VEC0,
627         TXGBE_ISB_VEC1,
628         TXGBE_ISB_MAX
629 };
630
631 struct txgbe_hw {
632         void IOMEM *hw_addr;
633         void *back;
634         struct txgbe_mac_info mac;
635         struct txgbe_addr_filter_info addr_ctrl;
636         struct txgbe_phy_info phy;
637         struct txgbe_link_info link;
638         struct txgbe_rom_info rom;
639         struct txgbe_flash_info flash;
640         struct txgbe_bus_info bus;
641         struct txgbe_mbx_info mbx;
642         u16 device_id;
643         u16 vendor_id;
644         u16 subsystem_device_id;
645         u16 subsystem_vendor_id;
646         bool adapter_stopped;
647         bool allow_unsupported_sfp;
648         bool need_crosstalk_fix;
649
650         uint64_t isb_dma;
651         void IOMEM *isb_mem;
652         u16 nb_rx_queues;
653         u16 nb_tx_queues;
654         enum txgbe_link_status {
655                 TXGBE_LINK_STATUS_NONE = 0,
656                 TXGBE_LINK_STATUS_KX,
657                 TXGBE_LINK_STATUS_KX4
658         } link_status;
659         enum txgbe_reset_type {
660                 TXGBE_LAN_RESET = 0,
661                 TXGBE_SW_RESET,
662                 TXGBE_GLOBAL_RESET
663         } reset_type;
664
665         u32 q_rx_regs[128 * 4];
666         u32 q_tx_regs[128 * 4];
667         bool offset_loaded;
668         struct {
669                 u64 rx_qp_packets;
670                 u64 tx_qp_packets;
671                 u64 rx_qp_bytes;
672                 u64 tx_qp_bytes;
673                 u64 rx_qp_mc_packets;
674         } qp_last[TXGBE_MAX_QP];
675 };
676
677 #include "txgbe_regs.h"
678 #include "txgbe_dummy.h"
679
680 #endif /* _TXGBE_TYPE_H_ */