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