1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2016 - 2018 Cavium Inc.
10 #include "qede_ethdev.h"
20 uint8_t hw_mac[RTE_ETHER_ADDR_LEN];
31 #define QED_MFW_VERSION_0_MASK 0x000000FF
32 #define QED_MFW_VERSION_0_OFFSET 0
33 #define QED_MFW_VERSION_1_MASK 0x0000FF00
34 #define QED_MFW_VERSION_1_OFFSET 8
35 #define QED_MFW_VERSION_2_MASK 0x00FF0000
36 #define QED_MFW_VERSION_2_OFFSET 16
37 #define QED_MFW_VERSION_3_MASK 0xFF000000
38 #define QED_MFW_VERSION_3_OFFSET 24
42 bool b_inter_pf_switch;
50 #define QED_MBI_VERSION_0_MASK 0x000000FF
51 #define QED_MBI_VERSION_0_OFFSET 0
52 #define QED_MBI_VERSION_1_MASK 0x0000FF00
53 #define QED_MBI_VERSION_1_OFFSET 8
54 #define QED_MBI_VERSION_2_MASK 0x00FF0000
55 #define QED_MBI_VERSION_2_OFFSET 16
57 /* Out param for qede */
62 enum ecore_dev_type dev_type;
65 struct qed_dev_eth_info {
66 struct qed_dev_info common;
71 struct rte_ether_addr port_mac;
72 uint16_t num_vlan_filters;
73 uint32_t num_mac_filters;
75 /* Legacy VF - this affects the datapath */
79 #define INIT_STRUCT_FIELD(field, value) .field = value
82 const struct qed_common_ops *common;
83 int (*fill_dev_info)(struct ecore_dev *edev,
84 struct qed_dev_eth_info *info);
85 void (*sriov_configure)(struct ecore_dev *edev, int num_vfs);
88 struct qed_link_params {
91 #define QED_LINK_OVERRIDE_SPEED_AUTONEG (1 << 0)
92 #define QED_LINK_OVERRIDE_SPEED_ADV_SPEEDS (1 << 1)
93 #define QED_LINK_OVERRIDE_SPEED_FORCED_SPEED (1 << 2)
94 #define QED_LINK_OVERRIDE_PAUSE_CONFIG (1 << 3)
95 #define QED_LINK_OVERRIDE_EEE_CONFIG (1 << 5)
96 uint32_t override_flags;
99 uint32_t forced_speed;
100 #define QED_LINK_PAUSE_AUTONEG_ENABLE (1 << 0)
101 #define QED_LINK_PAUSE_RX_ENABLE (1 << 1)
102 #define QED_LINK_PAUSE_TX_ENABLE (1 << 2)
103 uint32_t pause_config;
104 struct ecore_link_eee_params eee;
107 struct qed_link_output {
109 uint32_t supported_caps; /* In SUPPORTED defs */
110 uint32_t advertised_caps; /* In ADVERTISED defs */
111 uint32_t lp_caps; /* In ADVERTISED defs */
112 uint32_t speed; /* In Mb/s */
113 uint32_t adv_speed; /* Speed mask */
114 uint8_t duplex; /* In DUPLEX defs */
115 uint16_t port; /* In PORT defs */
117 uint32_t pause_config;
119 /* EEE - capability & param */
123 struct ecore_link_eee_params eee;
126 struct qed_slowpath_params {
132 uint8_t name[NAME_SIZE];
135 struct qed_common_cb_ops {
136 void (*link_update)(void *dev, struct qed_link_output *link);
139 struct qed_common_ops {
140 int (*probe)(struct ecore_dev *edev,
141 struct rte_pci_device *pci_dev,
142 uint32_t dp_module, uint8_t dp_level, bool is_vf);
143 void (*set_name)(struct ecore_dev *edev, char name[]);
145 (*chain_alloc)(struct ecore_dev *edev,
146 enum ecore_chain_use_mode
148 enum ecore_chain_mode mode,
149 enum ecore_chain_cnt_type cnt_type,
151 osal_size_t elem_size,
152 struct ecore_chain *p_chain,
153 struct ecore_chain_ext_pbl *ext_pbl);
155 void (*chain_free)(struct ecore_dev *edev,
156 struct ecore_chain *p_chain);
158 void (*get_link)(struct ecore_dev *edev,
159 struct qed_link_output *if_link);
160 int (*set_link)(struct ecore_dev *edev,
161 struct qed_link_params *params);
163 int (*drain)(struct ecore_dev *edev);
165 void (*remove)(struct ecore_dev *edev);
167 int (*slowpath_stop)(struct ecore_dev *edev);
169 void (*update_pf_params)(struct ecore_dev *edev,
170 struct ecore_pf_params *params);
172 int (*slowpath_start)(struct ecore_dev *edev,
173 struct qed_slowpath_params *params);
175 int (*set_fp_int)(struct ecore_dev *edev, uint16_t cnt);
177 uint32_t (*sb_init)(struct ecore_dev *edev,
178 struct ecore_sb_info *sb_info,
180 dma_addr_t sb_phy_addr,
183 int (*get_sb_info)(struct ecore_dev *edev,
184 struct ecore_sb_info *sb, u16 qid,
185 struct ecore_sb_info_dbg *sb_dbg);
187 bool (*can_link_change)(struct ecore_dev *edev);
189 void (*update_msglvl)(struct ecore_dev *edev,
190 uint32_t dp_module, uint8_t dp_level);
192 int (*send_drv_state)(struct ecore_dev *edev, bool active);
194 /* ############### DEBUG *************************/
196 int (*dbg_grc)(struct ecore_dev *edev,
198 u32 *num_dumped_bytes);
199 int (*dbg_grc_size)(struct ecore_dev *edev);
201 int (*dbg_idle_chk)(struct ecore_dev *edev,
203 u32 *num_dumped_bytes);
204 int (*dbg_idle_chk_size)(struct ecore_dev *edev);
206 int (*dbg_reg_fifo)(struct ecore_dev *edev,
208 u32 *num_dumped_bytes);
209 int (*dbg_reg_fifo_size)(struct ecore_dev *edev);
211 int (*dbg_mcp_trace)(struct ecore_dev *edev,
213 u32 *num_dumped_bytes);
214 int (*dbg_mcp_trace_size)(struct ecore_dev *edev);
216 int (*dbg_protection_override)(struct ecore_dev *edev, void *buffer,
217 u32 *num_dumped_bytes);
218 int (*dbg_protection_override_size)(struct ecore_dev *edev);
220 int (*dbg_igu_fifo_size)(struct ecore_dev *edev);
221 int (*dbg_igu_fifo)(struct ecore_dev *edev, void *buffer,
222 u32 *num_dumped_bytes);
224 int (*dbg_fw_asserts)(struct ecore_dev *edev, void *buffer,
225 u32 *num_dumped_bytes);
227 int (*dbg_fw_asserts_size)(struct ecore_dev *edev);
229 int (*dbg_ilt)(struct ecore_dev *edev, void *buffer,
230 u32 *num_dumped_bytes);
232 int (*dbg_ilt_size)(struct ecore_dev *edev);
234 u8 (*dbg_get_debug_engine)(struct ecore_dev *edev);
235 void (*dbg_set_debug_engine)(struct ecore_dev *edev,
242 const struct qed_eth_ops *qed_get_eth_ops(void);
244 #endif /* _QEDE_IF_H */