xref: /dpdk/drivers/net/intel/ipn3ke/ipn3ke_ethdev.h (revision c1d145834f287aa8cf53de914618a7312f2c360e)
1*c1d14583SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause
2*c1d14583SBruce Richardson  * Copyright(c) 2019 Intel Corporation
3*c1d14583SBruce Richardson  */
4*c1d14583SBruce Richardson 
5*c1d14583SBruce Richardson #ifndef _IPN3KE_ETHDEV_H_
6*c1d14583SBruce Richardson #define _IPN3KE_ETHDEV_H_
7*c1d14583SBruce Richardson 
8*c1d14583SBruce Richardson #include <stdbool.h>
9*c1d14583SBruce Richardson #include <stddef.h>
10*c1d14583SBruce Richardson #include <stdint.h>
11*c1d14583SBruce Richardson #include <limits.h>
12*c1d14583SBruce Richardson #include <net/if.h>
13*c1d14583SBruce Richardson #include <netinet/in.h>
14*c1d14583SBruce Richardson #include <sys/queue.h>
15*c1d14583SBruce Richardson 
16*c1d14583SBruce Richardson #include <rte_mbuf.h>
17*c1d14583SBruce Richardson #include <rte_flow_driver.h>
18*c1d14583SBruce Richardson #include <ethdev_driver.h>
19*c1d14583SBruce Richardson #include <ethdev_vdev.h>
20*c1d14583SBruce Richardson #include <rte_malloc.h>
21*c1d14583SBruce Richardson #include <rte_memcpy.h>
22*c1d14583SBruce Richardson #include <bus_vdev_driver.h>
23*c1d14583SBruce Richardson #include <rte_kvargs.h>
24*c1d14583SBruce Richardson #include <rte_spinlock.h>
25*c1d14583SBruce Richardson 
26*c1d14583SBruce Richardson #include <rte_cycles.h>
27*c1d14583SBruce Richardson #include <bus_ifpga_driver.h>
28*c1d14583SBruce Richardson #include <rte_tm_driver.h>
29*c1d14583SBruce Richardson 
30*c1d14583SBruce Richardson #define IPN3KE_TM_SCRATCH_RW 0
31*c1d14583SBruce Richardson 
32*c1d14583SBruce Richardson /* TM Levels */
33*c1d14583SBruce Richardson enum ipn3ke_tm_node_level {
34*c1d14583SBruce Richardson 	IPN3KE_TM_NODE_LEVEL_PORT,
35*c1d14583SBruce Richardson 	IPN3KE_TM_NODE_LEVEL_VT,
36*c1d14583SBruce Richardson 	IPN3KE_TM_NODE_LEVEL_COS,
37*c1d14583SBruce Richardson 	IPN3KE_TM_NODE_LEVEL_MAX,
38*c1d14583SBruce Richardson };
39*c1d14583SBruce Richardson 
40*c1d14583SBruce Richardson /* TM Shaper Profile */
41*c1d14583SBruce Richardson struct ipn3ke_tm_shaper_profile {
42*c1d14583SBruce Richardson 	uint32_t valid;
43*c1d14583SBruce Richardson 	uint32_t m;
44*c1d14583SBruce Richardson 	uint32_t e;
45*c1d14583SBruce Richardson 	uint64_t rate;
46*c1d14583SBruce Richardson 	struct rte_tm_shaper_params params;
47*c1d14583SBruce Richardson };
48*c1d14583SBruce Richardson 
49*c1d14583SBruce Richardson TAILQ_HEAD(ipn3ke_tm_shaper_profile_list, ipn3ke_tm_shaper_profile);
50*c1d14583SBruce Richardson 
51*c1d14583SBruce Richardson 
52*c1d14583SBruce Richardson #define IPN3KE_TDROP_TH1_MASK  0x1ffffff
53*c1d14583SBruce Richardson #define IPN3KE_TDROP_TH1_SHIFT (25)
54*c1d14583SBruce Richardson #define IPN3KE_TDROP_TH2_MASK  0x1ffffff
55*c1d14583SBruce Richardson 
56*c1d14583SBruce Richardson /* TM TDROP Profile */
57*c1d14583SBruce Richardson struct ipn3ke_tm_tdrop_profile {
58*c1d14583SBruce Richardson 	uint32_t tdrop_profile_id;
59*c1d14583SBruce Richardson 	uint32_t th1;
60*c1d14583SBruce Richardson 	uint32_t th2;
61*c1d14583SBruce Richardson 	uint32_t n_users;
62*c1d14583SBruce Richardson 	uint32_t valid;
63*c1d14583SBruce Richardson 	struct rte_tm_wred_params params;
64*c1d14583SBruce Richardson };
65*c1d14583SBruce Richardson 
66*c1d14583SBruce Richardson /* TM node priority */
67*c1d14583SBruce Richardson enum ipn3ke_tm_node_state {
68*c1d14583SBruce Richardson 	IPN3KE_TM_NODE_STATE_IDLE = 0,
69*c1d14583SBruce Richardson 	IPN3KE_TM_NODE_STATE_CONFIGURED_ADD,
70*c1d14583SBruce Richardson 	IPN3KE_TM_NODE_STATE_CONFIGURED_DEL,
71*c1d14583SBruce Richardson 	IPN3KE_TM_NODE_STATE_COMMITTED,
72*c1d14583SBruce Richardson 	IPN3KE_TM_NODE_STATE_MAX,
73*c1d14583SBruce Richardson };
74*c1d14583SBruce Richardson 
75*c1d14583SBruce Richardson TAILQ_HEAD(ipn3ke_tm_node_list, ipn3ke_tm_node);
76*c1d14583SBruce Richardson 
77*c1d14583SBruce Richardson /* IPN3KE TM Node */
78*c1d14583SBruce Richardson struct ipn3ke_tm_node {
79*c1d14583SBruce Richardson 	TAILQ_ENTRY(ipn3ke_tm_node) node;
80*c1d14583SBruce Richardson 	uint32_t node_index;
81*c1d14583SBruce Richardson 	uint32_t level;
82*c1d14583SBruce Richardson 	uint32_t tm_id;
83*c1d14583SBruce Richardson 	enum ipn3ke_tm_node_state node_state;
84*c1d14583SBruce Richardson 	uint32_t parent_node_id;
85*c1d14583SBruce Richardson 	uint32_t priority;
86*c1d14583SBruce Richardson 	uint32_t weight;
87*c1d14583SBruce Richardson 	struct ipn3ke_tm_node *parent_node;
88*c1d14583SBruce Richardson 	struct ipn3ke_tm_shaper_profile shaper_profile;
89*c1d14583SBruce Richardson 	struct ipn3ke_tm_tdrop_profile *tdrop_profile;
90*c1d14583SBruce Richardson 	struct rte_tm_node_params params;
91*c1d14583SBruce Richardson 	struct rte_tm_node_stats stats;
92*c1d14583SBruce Richardson 	uint32_t n_children;
93*c1d14583SBruce Richardson 	struct ipn3ke_tm_node_list children_node_list;
94*c1d14583SBruce Richardson };
95*c1d14583SBruce Richardson 
96*c1d14583SBruce Richardson /* IPN3KE TM Hierarchy Specification */
97*c1d14583SBruce Richardson struct ipn3ke_tm_hierarchy {
98*c1d14583SBruce Richardson 	struct ipn3ke_tm_node *port_node;
99*c1d14583SBruce Richardson 	uint32_t n_shaper_profiles;
100*c1d14583SBruce Richardson 	uint32_t n_tdrop_profiles;
101*c1d14583SBruce Richardson 	uint32_t n_vt_nodes;
102*c1d14583SBruce Richardson 	uint32_t n_cos_nodes;
103*c1d14583SBruce Richardson 	struct ipn3ke_tm_node *port_commit_node;
104*c1d14583SBruce Richardson 	struct ipn3ke_tm_node_list vt_commit_node_list;
105*c1d14583SBruce Richardson 	struct ipn3ke_tm_node_list cos_commit_node_list;
106*c1d14583SBruce Richardson };
107*c1d14583SBruce Richardson 
108*c1d14583SBruce Richardson struct ipn3ke_tm_internals {
109*c1d14583SBruce Richardson 	/** Hierarchy specification
110*c1d14583SBruce Richardson 	 *
111*c1d14583SBruce Richardson 	 *     -Hierarchy is unfrozen at init and when port is stopped.
112*c1d14583SBruce Richardson 	 *     -Hierarchy is frozen on successful hierarchy commit.
113*c1d14583SBruce Richardson 	 *     -Run-time hierarchy changes are not allowed, therefore it makes
114*c1d14583SBruce Richardson 	 *      sense to keep the hierarchy frozen after the port is started.
115*c1d14583SBruce Richardson 	 */
116*c1d14583SBruce Richardson 	struct ipn3ke_tm_hierarchy h;
117*c1d14583SBruce Richardson 	int hierarchy_frozen;
118*c1d14583SBruce Richardson 	int tm_started;
119*c1d14583SBruce Richardson 	uint32_t tm_id;
120*c1d14583SBruce Richardson };
121*c1d14583SBruce Richardson 
122*c1d14583SBruce Richardson #define IPN3KE_TM_COS_NODE_NUM      (64 * 1024)
123*c1d14583SBruce Richardson #define IPN3KE_TM_VT_NODE_NUM       (IPN3KE_TM_COS_NODE_NUM / 8)
124*c1d14583SBruce Richardson #define IPN3KE_TM_10G_PORT_NODE_NUM (8)
125*c1d14583SBruce Richardson #define IPN3KE_TM_25G_PORT_NODE_NUM (4)
126*c1d14583SBruce Richardson 
127*c1d14583SBruce Richardson #define IPN3KE_TM_NODE_LEVEL_MOD    (100000)
128*c1d14583SBruce Richardson #define IPN3KE_TM_NODE_MOUNT_MAX    (8)
129*c1d14583SBruce Richardson 
130*c1d14583SBruce Richardson #define IPN3KE_TM_TDROP_PROFILE_NUM (2 * 1024)
131*c1d14583SBruce Richardson 
132*c1d14583SBruce Richardson /* TM node priority */
133*c1d14583SBruce Richardson enum ipn3ke_tm_node_priority {
134*c1d14583SBruce Richardson 	IPN3KE_TM_NODE_PRIORITY_NORMAL0 = 0,
135*c1d14583SBruce Richardson 	IPN3KE_TM_NODE_PRIORITY_LOW,
136*c1d14583SBruce Richardson 	IPN3KE_TM_NODE_PRIORITY_NORMAL1,
137*c1d14583SBruce Richardson 	IPN3KE_TM_NODE_PRIORITY_HIGHEST,
138*c1d14583SBruce Richardson };
139*c1d14583SBruce Richardson 
140*c1d14583SBruce Richardson #define IPN3KE_TM_NODE_WEIGHT_MAX UINT8_MAX
141*c1d14583SBruce Richardson 
142*c1d14583SBruce Richardson /** Set a bit in the uint32 variable */
143*c1d14583SBruce Richardson #define IPN3KE_BIT_SET(var, pos) \
144*c1d14583SBruce Richardson 	((var) |= ((uint32_t)1 << ((pos))))
145*c1d14583SBruce Richardson 
146*c1d14583SBruce Richardson /** Reset the bit in the variable */
147*c1d14583SBruce Richardson #define IPN3KE_BIT_RESET(var, pos) \
148*c1d14583SBruce Richardson 	((var) &= ~((uint32_t)1 << ((pos))))
149*c1d14583SBruce Richardson 
150*c1d14583SBruce Richardson /** Check the bit is set in the variable */
151*c1d14583SBruce Richardson #define IPN3KE_BIT_ISSET(var, pos) \
152*c1d14583SBruce Richardson 	(((var) & ((uint32_t)1 << ((pos)))) ? 1 : 0)
153*c1d14583SBruce Richardson 
154*c1d14583SBruce Richardson struct ipn3ke_hw;
155*c1d14583SBruce Richardson 
156*c1d14583SBruce Richardson #define IPN3KE_HW_BASE               0x4000000
157*c1d14583SBruce Richardson 
158*c1d14583SBruce Richardson #define IPN3KE_CAPABILITY_REGISTERS_BLOCK_OFFSET \
159*c1d14583SBruce Richardson 	(IPN3KE_HW_BASE + hw->hw_cap.capability_registers_block_offset)
160*c1d14583SBruce Richardson 
161*c1d14583SBruce Richardson #define IPN3KE_STATUS_REGISTERS_BLOCK_OFFSET \
162*c1d14583SBruce Richardson 	(IPN3KE_HW_BASE + hw->hw_cap.status_registers_block_offset)
163*c1d14583SBruce Richardson 
164*c1d14583SBruce Richardson #define IPN3KE_CTRL_RESET \
165*c1d14583SBruce Richardson 	(IPN3KE_HW_BASE + hw->hw_cap.control_registers_block_offset)
166*c1d14583SBruce Richardson 
167*c1d14583SBruce Richardson #define IPN3KE_CTRL_MTU \
168*c1d14583SBruce Richardson 	(IPN3KE_HW_BASE + hw->hw_cap.control_registers_block_offset + 4)
169*c1d14583SBruce Richardson 
170*c1d14583SBruce Richardson #define IPN3KE_CLASSIFY_OFFSET \
171*c1d14583SBruce Richardson 	(IPN3KE_HW_BASE + hw->hw_cap.classify_offset)
172*c1d14583SBruce Richardson 
173*c1d14583SBruce Richardson #define IPN3KE_POLICER_OFFSET \
174*c1d14583SBruce Richardson 	(IPN3KE_HW_BASE + hw->hw_cap.policer_offset)
175*c1d14583SBruce Richardson 
176*c1d14583SBruce Richardson #define IPN3KE_RSS_KEY_ARRAY_OFFSET \
177*c1d14583SBruce Richardson 	(IPN3KE_HW_BASE + hw->hw_cap.rss_key_array_offset)
178*c1d14583SBruce Richardson 
179*c1d14583SBruce Richardson #define IPN3KE_RSS_INDIRECTION_TABLE_ARRAY_OFFSET \
180*c1d14583SBruce Richardson 	(IPN3KE_HW_BASE + hw->hw_cap.rss_indirection_table_array_offset)
181*c1d14583SBruce Richardson 
182*c1d14583SBruce Richardson #define IPN3KE_DMAC_MAP_OFFSET \
183*c1d14583SBruce Richardson 	(IPN3KE_HW_BASE + hw->hw_cap.dmac_map_offset)
184*c1d14583SBruce Richardson 
185*c1d14583SBruce Richardson #define IPN3KE_QM_OFFSET \
186*c1d14583SBruce Richardson 	(IPN3KE_HW_BASE + hw->hw_cap.qm_offset)
187*c1d14583SBruce Richardson 
188*c1d14583SBruce Richardson #define IPN3KE_CCB_OFFSET \
189*c1d14583SBruce Richardson 	(IPN3KE_HW_BASE + hw->hw_cap.ccb_offset)
190*c1d14583SBruce Richardson 
191*c1d14583SBruce Richardson #define IPN3KE_QOS_OFFSET \
192*c1d14583SBruce Richardson 	(IPN3KE_HW_BASE + hw->hw_cap.qos_offset)
193*c1d14583SBruce Richardson 
194*c1d14583SBruce Richardson struct ipn3ke_hw_cap {
195*c1d14583SBruce Richardson 	uint32_t version_number;
196*c1d14583SBruce Richardson 	uint32_t capability_registers_block_offset;
197*c1d14583SBruce Richardson 	uint32_t status_registers_block_offset;
198*c1d14583SBruce Richardson 	uint32_t control_registers_block_offset;
199*c1d14583SBruce Richardson 	uint32_t classify_offset;
200*c1d14583SBruce Richardson 	uint32_t classy_size;
201*c1d14583SBruce Richardson 	uint32_t policer_offset;
202*c1d14583SBruce Richardson 	uint32_t policer_entry_size;
203*c1d14583SBruce Richardson 	uint32_t rss_key_array_offset;
204*c1d14583SBruce Richardson 	uint32_t rss_key_entry_size;
205*c1d14583SBruce Richardson 	uint32_t rss_indirection_table_array_offset;
206*c1d14583SBruce Richardson 	uint32_t rss_indirection_table_entry_size;
207*c1d14583SBruce Richardson 	uint32_t dmac_map_offset;
208*c1d14583SBruce Richardson 	uint32_t dmac_map_size;
209*c1d14583SBruce Richardson 	uint32_t qm_offset;
210*c1d14583SBruce Richardson 	uint32_t qm_size;
211*c1d14583SBruce Richardson 	uint32_t ccb_offset;
212*c1d14583SBruce Richardson 	uint32_t ccb_entry_size;
213*c1d14583SBruce Richardson 	uint32_t qos_offset;
214*c1d14583SBruce Richardson 	uint32_t qos_size;
215*c1d14583SBruce Richardson 
216*c1d14583SBruce Richardson 	uint32_t num_rx_flow;    /* Default: 64K */
217*c1d14583SBruce Richardson 	uint32_t num_rss_blocks; /* Default: 512 */
218*c1d14583SBruce Richardson 	uint32_t num_dmac_map;   /* Default: 1K */
219*c1d14583SBruce Richardson 	uint32_t num_tx_flow;    /* Default: 64K */
220*c1d14583SBruce Richardson 	uint32_t num_smac_map;   /* Default: 1K */
221*c1d14583SBruce Richardson 
222*c1d14583SBruce Richardson 	uint32_t link_speed_mbps;
223*c1d14583SBruce Richardson };
224*c1d14583SBruce Richardson 
225*c1d14583SBruce Richardson /**
226*c1d14583SBruce Richardson  * Structure to store private data for each representor instance
227*c1d14583SBruce Richardson  */
228*c1d14583SBruce Richardson struct ipn3ke_rpst {
229*c1d14583SBruce Richardson 	TAILQ_ENTRY(ipn3ke_rpst) next;       /**< Next in device list. */
230*c1d14583SBruce Richardson 	uint16_t switch_domain_id;
231*c1d14583SBruce Richardson 	/**< Switch ID */
232*c1d14583SBruce Richardson 	uint16_t port_id;
233*c1d14583SBruce Richardson 	struct rte_eth_dev *ethdev;
234*c1d14583SBruce Richardson 	/**< Port ID */
235*c1d14583SBruce Richardson 	struct ipn3ke_hw *hw;
236*c1d14583SBruce Richardson 	struct rte_eth_dev *i40e_pf_eth;
237*c1d14583SBruce Richardson 	uint16_t i40e_pf_eth_port_id;
238*c1d14583SBruce Richardson 	struct rte_eth_link ori_linfo;
239*c1d14583SBruce Richardson 	struct ipn3ke_tm_internals tm;
240*c1d14583SBruce Richardson 	/**< Private data store of associated physical function */
241*c1d14583SBruce Richardson 	struct rte_ether_addr mac_addr;
242*c1d14583SBruce Richardson };
243*c1d14583SBruce Richardson 
244*c1d14583SBruce Richardson /* UUID IDs */
245*c1d14583SBruce Richardson #define MAP_UUID_10G_LOW                0xffffffffffffffff
246*c1d14583SBruce Richardson #define MAP_UUID_10G_HIGH               0xffffffffffffffff
247*c1d14583SBruce Richardson #define IPN3KE_UUID_10G_LOW             0xc000c9660d824272
248*c1d14583SBruce Richardson #define IPN3KE_UUID_10G_HIGH            0x9aeffe5f84570612
249*c1d14583SBruce Richardson #define IPN3KE_UUID_VBNG_LOW		0x8991165349d23ff9
250*c1d14583SBruce Richardson #define IPN3KE_UUID_VBNG_HIGH		0xb74cf419d15a481f
251*c1d14583SBruce Richardson #define IPN3KE_UUID_25G_LOW             0xb7d9bac566bfbc80
252*c1d14583SBruce Richardson #define IPN3KE_UUID_25G_HIGH            0xb07bac1aeef54d67
253*c1d14583SBruce Richardson 
254*c1d14583SBruce Richardson #define IPN3KE_AFU_BUF_SIZE_MIN         1024
255*c1d14583SBruce Richardson #define IPN3KE_AFU_FRAME_SIZE_MAX       9728
256*c1d14583SBruce Richardson 
257*c1d14583SBruce Richardson #define IPN3KE_RAWDEV_ATTR_LEN_MAX      (64)
258*c1d14583SBruce Richardson 
259*c1d14583SBruce Richardson typedef int (*ipn3ke_indirect_mac_read_t)(struct ipn3ke_hw *hw,
260*c1d14583SBruce Richardson 	uint32_t *rd_data, uint32_t addr, uint32_t mac_num,
261*c1d14583SBruce Richardson 	uint32_t eth_wrapper_sel);
262*c1d14583SBruce Richardson 
263*c1d14583SBruce Richardson typedef int (*ipn3ke_indirect_mac_write_t)(struct ipn3ke_hw *hw,
264*c1d14583SBruce Richardson 	uint32_t wr_data, uint32_t addr, uint32_t mac_num,
265*c1d14583SBruce Richardson 	uint32_t eth_wrapper_sel);
266*c1d14583SBruce Richardson 
267*c1d14583SBruce Richardson struct ipn3ke_hw {
268*c1d14583SBruce Richardson 	struct rte_eth_dev *eth_dev;
269*c1d14583SBruce Richardson 
270*c1d14583SBruce Richardson 	/* afu info */
271*c1d14583SBruce Richardson 	struct rte_afu_id afu_id;
272*c1d14583SBruce Richardson 	struct rte_rawdev *rawdev;
273*c1d14583SBruce Richardson 
274*c1d14583SBruce Richardson 	struct ipn3ke_hw_cap hw_cap;
275*c1d14583SBruce Richardson 
276*c1d14583SBruce Richardson 	struct ifpga_rawdevg_retimer_info retimer;
277*c1d14583SBruce Richardson 
278*c1d14583SBruce Richardson 	uint16_t switch_domain_id;
279*c1d14583SBruce Richardson 	uint16_t port_num;
280*c1d14583SBruce Richardson 
281*c1d14583SBruce Richardson 	uint32_t tm_hw_enable;
282*c1d14583SBruce Richardson 	uint32_t flow_hw_enable;
283*c1d14583SBruce Richardson 
284*c1d14583SBruce Richardson 	uint32_t acc_tm;
285*c1d14583SBruce Richardson 	uint32_t acc_flow;
286*c1d14583SBruce Richardson 
287*c1d14583SBruce Richardson 	struct ipn3ke_flow_list flow_list;
288*c1d14583SBruce Richardson 	uint32_t flow_max_entries;
289*c1d14583SBruce Richardson 	uint32_t flow_num_entries;
290*c1d14583SBruce Richardson 
291*c1d14583SBruce Richardson 	struct ipn3ke_tm_node *nodes;
292*c1d14583SBruce Richardson 	struct ipn3ke_tm_node *port_nodes;
293*c1d14583SBruce Richardson 	struct ipn3ke_tm_node *vt_nodes;
294*c1d14583SBruce Richardson 	struct ipn3ke_tm_node *cos_nodes;
295*c1d14583SBruce Richardson 
296*c1d14583SBruce Richardson 	struct ipn3ke_tm_tdrop_profile *tdrop_profile;
297*c1d14583SBruce Richardson 	uint32_t tdrop_profile_num;
298*c1d14583SBruce Richardson 
299*c1d14583SBruce Richardson 	uint32_t ccb_status;
300*c1d14583SBruce Richardson 	uint32_t ccb_seg_free;
301*c1d14583SBruce Richardson 	uint32_t ccb_seg_num;
302*c1d14583SBruce Richardson 	uint32_t ccb_seg_k;
303*c1d14583SBruce Richardson 
304*c1d14583SBruce Richardson 	uint8_t *eth_group_bar[2];
305*c1d14583SBruce Richardson 	/**< MAC Register read */
306*c1d14583SBruce Richardson 	ipn3ke_indirect_mac_read_t f_mac_read;
307*c1d14583SBruce Richardson 	/**< MAC Register write */
308*c1d14583SBruce Richardson 	ipn3ke_indirect_mac_write_t f_mac_write;
309*c1d14583SBruce Richardson 
310*c1d14583SBruce Richardson 	uint8_t *hw_addr;
311*c1d14583SBruce Richardson };
312*c1d14583SBruce Richardson 
313*c1d14583SBruce Richardson /**
314*c1d14583SBruce Richardson  * @internal
315*c1d14583SBruce Richardson  * Helper macro for drivers that need to convert to struct rte_afu_device.
316*c1d14583SBruce Richardson  */
317*c1d14583SBruce Richardson #define RTE_DEV_TO_AFU(ptr) \
318*c1d14583SBruce Richardson 	container_of(ptr, struct rte_afu_device, device)
319*c1d14583SBruce Richardson 
320*c1d14583SBruce Richardson #define RTE_DEV_TO_AFU_CONST(ptr) \
321*c1d14583SBruce Richardson 	container_of(ptr, const struct rte_afu_device, device)
322*c1d14583SBruce Richardson 
323*c1d14583SBruce Richardson #define RTE_ETH_DEV_TO_AFU(eth_dev) \
324*c1d14583SBruce Richardson 	RTE_DEV_TO_AFU((eth_dev)->device)
325*c1d14583SBruce Richardson 
326*c1d14583SBruce Richardson /**
327*c1d14583SBruce Richardson  * PCIe MMIO Access
328*c1d14583SBruce Richardson  */
329*c1d14583SBruce Richardson 
330*c1d14583SBruce Richardson #define IPN3KE_PCI_REG(reg)    rte_read32(reg)
331*c1d14583SBruce Richardson #define IPN3KE_PCI_REG_ADDR(a, reg) \
332*c1d14583SBruce Richardson 	((volatile uint32_t *)((char *)(a)->hw_addr + (reg)))
333*c1d14583SBruce Richardson static inline uint32_t ipn3ke_read_addr(volatile void *addr)
334*c1d14583SBruce Richardson {
335*c1d14583SBruce Richardson 	return rte_le_to_cpu_32(IPN3KE_PCI_REG(addr));
336*c1d14583SBruce Richardson }
337*c1d14583SBruce Richardson 
338*c1d14583SBruce Richardson #define WCMD 0x8000000000000000
339*c1d14583SBruce Richardson #define RCMD 0x4000000000000000
340*c1d14583SBruce Richardson #define INDRCT_CTRL 0x30
341*c1d14583SBruce Richardson #define INDRCT_STS 0x38
342*c1d14583SBruce Richardson static inline uint32_t _ipn3ke_indrct_read(struct ipn3ke_hw *hw,
343*c1d14583SBruce Richardson 		uint32_t addr)
344*c1d14583SBruce Richardson {
345*c1d14583SBruce Richardson 	uint64_t word_offset;
346*c1d14583SBruce Richardson 	uint64_t read_data = 0;
347*c1d14583SBruce Richardson 	uint64_t indirect_value;
348*c1d14583SBruce Richardson 	volatile void *indirect_addrs;
349*c1d14583SBruce Richardson 
350*c1d14583SBruce Richardson 	word_offset = (addr & 0x1FFFFFF) >> 2;
351*c1d14583SBruce Richardson 	indirect_value = RCMD | word_offset << 32;
352*c1d14583SBruce Richardson 	indirect_addrs = hw->hw_addr + (uint32_t)(INDRCT_CTRL);
353*c1d14583SBruce Richardson 
354*c1d14583SBruce Richardson 	rte_delay_us(10);
355*c1d14583SBruce Richardson 
356*c1d14583SBruce Richardson 	rte_write64((rte_cpu_to_le_64(indirect_value)), indirect_addrs);
357*c1d14583SBruce Richardson 
358*c1d14583SBruce Richardson 	indirect_addrs = hw->hw_addr + (uint32_t)(INDRCT_STS);
359*c1d14583SBruce Richardson 	while ((read_data >> 32) != 1)
360*c1d14583SBruce Richardson 		read_data = rte_read64(indirect_addrs);
361*c1d14583SBruce Richardson 
362*c1d14583SBruce Richardson 	return rte_le_to_cpu_32(read_data);
363*c1d14583SBruce Richardson }
364*c1d14583SBruce Richardson 
365*c1d14583SBruce Richardson static inline void _ipn3ke_indrct_write(struct ipn3ke_hw *hw,
366*c1d14583SBruce Richardson 		uint32_t addr, uint32_t value)
367*c1d14583SBruce Richardson {
368*c1d14583SBruce Richardson 	uint64_t word_offset;
369*c1d14583SBruce Richardson 	uint64_t indirect_value;
370*c1d14583SBruce Richardson 	volatile void *indirect_addrs = 0;
371*c1d14583SBruce Richardson 
372*c1d14583SBruce Richardson 	word_offset = (addr & 0x1FFFFFF) >> 2;
373*c1d14583SBruce Richardson 	indirect_value = WCMD | word_offset << 32 | value;
374*c1d14583SBruce Richardson 	indirect_addrs = hw->hw_addr + (uint32_t)(INDRCT_CTRL);
375*c1d14583SBruce Richardson 
376*c1d14583SBruce Richardson 	rte_write64((rte_cpu_to_le_64(indirect_value)), indirect_addrs);
377*c1d14583SBruce Richardson 	rte_delay_us(10);
378*c1d14583SBruce Richardson }
379*c1d14583SBruce Richardson 
380*c1d14583SBruce Richardson #define IPN3KE_PCI_REG_WRITE(reg, value) \
381*c1d14583SBruce Richardson 	rte_write32((rte_cpu_to_le_32(value)), reg)
382*c1d14583SBruce Richardson 
383*c1d14583SBruce Richardson #define IPN3KE_PCI_REG_WRITE_RELAXED(reg, value) \
384*c1d14583SBruce Richardson 	rte_write32_relaxed((rte_cpu_to_le_32(value)), reg)
385*c1d14583SBruce Richardson 
386*c1d14583SBruce Richardson #define IPN3KE_READ_REG(hw, reg) \
387*c1d14583SBruce Richardson 	_ipn3ke_indrct_read((hw), (reg))
388*c1d14583SBruce Richardson 
389*c1d14583SBruce Richardson #define IPN3KE_WRITE_REG(hw, reg, value) \
390*c1d14583SBruce Richardson 	_ipn3ke_indrct_write((hw), (reg), (value))
391*c1d14583SBruce Richardson 
392*c1d14583SBruce Richardson #define IPN3KE_MASK_READ_REG(hw, reg, x, mask) \
393*c1d14583SBruce Richardson 	((mask) & IPN3KE_READ_REG((hw), ((reg) + (0x4 * (x)))))
394*c1d14583SBruce Richardson 
395*c1d14583SBruce Richardson #define IPN3KE_MASK_WRITE_REG(hw, reg, x, value, mask) \
396*c1d14583SBruce Richardson 	IPN3KE_WRITE_REG((hw), ((reg) + (0x4 * (x))), ((mask) & (value)))
397*c1d14583SBruce Richardson 
398*c1d14583SBruce Richardson #define IPN3KE_DEV_PRIVATE_TO_HW(dev) \
399*c1d14583SBruce Richardson 	(((struct ipn3ke_rpst *)(dev)->data->dev_private)->hw)
400*c1d14583SBruce Richardson 
401*c1d14583SBruce Richardson #define IPN3KE_DEV_PRIVATE_TO_RPST(dev) \
402*c1d14583SBruce Richardson 	((struct ipn3ke_rpst *)(dev)->data->dev_private)
403*c1d14583SBruce Richardson 
404*c1d14583SBruce Richardson #define IPN3KE_DEV_PRIVATE_TO_TM(dev) \
405*c1d14583SBruce Richardson 	(&(((struct ipn3ke_rpst *)(dev)->data->dev_private)->tm))
406*c1d14583SBruce Richardson 
407*c1d14583SBruce Richardson #define IPN3KE_VBNG_INIT_DONE                      (0x3)
408*c1d14583SBruce Richardson #define IPN3KE_VBNG_INIT_STS                      (0x204)
409*c1d14583SBruce Richardson 
410*c1d14583SBruce Richardson /* Byte address of IPN3KE internal module */
411*c1d14583SBruce Richardson #define IPN3KE_TM_VERSION                     (IPN3KE_QM_OFFSET + 0x0000)
412*c1d14583SBruce Richardson #define IPN3KE_TM_SCRATCH                     (IPN3KE_QM_OFFSET + 0x0004)
413*c1d14583SBruce Richardson #define IPN3KE_TM_STATUS                      (IPN3KE_QM_OFFSET + 0x0008)
414*c1d14583SBruce Richardson #define IPN3KE_TM_MISC_STATUS                 (IPN3KE_QM_OFFSET + 0x0010)
415*c1d14583SBruce Richardson #define IPN3KE_TM_MISC_WARNING_0              (IPN3KE_QM_OFFSET + 0x0040)
416*c1d14583SBruce Richardson #define IPN3KE_TM_MISC_MON_0                  (IPN3KE_QM_OFFSET + 0x0048)
417*c1d14583SBruce Richardson #define IPN3KE_TM_MISC_FATAL_0                (IPN3KE_QM_OFFSET + 0x0050)
418*c1d14583SBruce Richardson #define IPN3KE_TM_BW_MON_CTRL_1               (IPN3KE_QM_OFFSET + 0x0080)
419*c1d14583SBruce Richardson #define IPN3KE_TM_BW_MON_CTRL_2               (IPN3KE_QM_OFFSET + 0x0084)
420*c1d14583SBruce Richardson #define IPN3KE_TM_BW_MON_RATE                 (IPN3KE_QM_OFFSET + 0x0088)
421*c1d14583SBruce Richardson #define IPN3KE_TM_STATS_CTRL                  (IPN3KE_QM_OFFSET + 0x0100)
422*c1d14583SBruce Richardson #define IPN3KE_TM_STATS_DATA_0                (IPN3KE_QM_OFFSET + 0x0110)
423*c1d14583SBruce Richardson #define IPN3KE_TM_STATS_DATA_1                (IPN3KE_QM_OFFSET + 0x0114)
424*c1d14583SBruce Richardson #define IPN3KE_QM_UID_CONFIG_CTRL             (IPN3KE_QM_OFFSET + 0x0200)
425*c1d14583SBruce Richardson #define IPN3KE_QM_UID_CONFIG_DATA             (IPN3KE_QM_OFFSET + 0x0204)
426*c1d14583SBruce Richardson 
427*c1d14583SBruce Richardson #define IPN3KE_BM_VERSION                     (IPN3KE_QM_OFFSET + 0x4000)
428*c1d14583SBruce Richardson #define IPN3KE_BM_STATUS                      (IPN3KE_QM_OFFSET + 0x4008)
429*c1d14583SBruce Richardson #define IPN3KE_BM_STORE_CTRL                  (IPN3KE_QM_OFFSET + 0x4010)
430*c1d14583SBruce Richardson #define IPN3KE_BM_STORE_STATUS                (IPN3KE_QM_OFFSET + 0x4018)
431*c1d14583SBruce Richardson #define IPN3KE_BM_STORE_MON                   (IPN3KE_QM_OFFSET + 0x4028)
432*c1d14583SBruce Richardson #define IPN3KE_BM_WARNING_0                   (IPN3KE_QM_OFFSET + 0x4040)
433*c1d14583SBruce Richardson #define IPN3KE_BM_MON_0                       (IPN3KE_QM_OFFSET + 0x4048)
434*c1d14583SBruce Richardson #define IPN3KE_BM_FATAL_0                     (IPN3KE_QM_OFFSET + 0x4050)
435*c1d14583SBruce Richardson #define IPN3KE_BM_DRAM_ACCESS_CTRL            (IPN3KE_QM_OFFSET + 0x4100)
436*c1d14583SBruce Richardson #define IPN3KE_BM_DRAM_ACCESS_DATA_0          (IPN3KE_QM_OFFSET + 0x4120)
437*c1d14583SBruce Richardson #define IPN3KE_BM_DRAM_ACCESS_DATA_1          (IPN3KE_QM_OFFSET + 0x4124)
438*c1d14583SBruce Richardson #define IPN3KE_BM_DRAM_ACCESS_DATA_2          (IPN3KE_QM_OFFSET + 0x4128)
439*c1d14583SBruce Richardson #define IPN3KE_BM_DRAM_ACCESS_DATA_3          (IPN3KE_QM_OFFSET + 0x412C)
440*c1d14583SBruce Richardson #define IPN3KE_BM_DRAM_ACCESS_DATA_4          (IPN3KE_QM_OFFSET + 0x4130)
441*c1d14583SBruce Richardson #define IPN3KE_BM_DRAM_ACCESS_DATA_5          (IPN3KE_QM_OFFSET + 0x4134)
442*c1d14583SBruce Richardson #define IPN3KE_BM_DRAM_ACCESS_DATA_6          (IPN3KE_QM_OFFSET + 0x4138)
443*c1d14583SBruce Richardson 
444*c1d14583SBruce Richardson #define IPN3KE_QM_VERSION                     (IPN3KE_QM_OFFSET + 0x8000)
445*c1d14583SBruce Richardson #define IPN3KE_QM_STATUS                      (IPN3KE_QM_OFFSET + 0x8008)
446*c1d14583SBruce Richardson #define IPN3KE_QM_LL_TABLE_MON                (IPN3KE_QM_OFFSET + 0x8018)
447*c1d14583SBruce Richardson #define IPN3KE_QM_WARNING_0                   (IPN3KE_QM_OFFSET + 0x8040)
448*c1d14583SBruce Richardson #define IPN3KE_QM_MON_0                       (IPN3KE_QM_OFFSET + 0x8048)
449*c1d14583SBruce Richardson #define IPN3KE_QM_FATAL_0                     (IPN3KE_QM_OFFSET + 0x8050)
450*c1d14583SBruce Richardson #define IPN3KE_QM_FATAL_1                     (IPN3KE_QM_OFFSET + 0x8054)
451*c1d14583SBruce Richardson #define IPN3KE_LL_TABLE_ACCESS_CTRL           (IPN3KE_QM_OFFSET + 0x8100)
452*c1d14583SBruce Richardson #define IPN3KE_LL_TABLE_ACCESS_DATA_0         (IPN3KE_QM_OFFSET + 0x8110)
453*c1d14583SBruce Richardson #define IPN3KE_LL_TABLE_ACCESS_DATA_1         (IPN3KE_QM_OFFSET + 0x8114)
454*c1d14583SBruce Richardson 
455*c1d14583SBruce Richardson #define IPN3KE_CCB_ERROR                      (IPN3KE_CCB_OFFSET + 0x0008)
456*c1d14583SBruce Richardson #define IPN3KE_CCB_NSEGFREE                   (IPN3KE_CCB_OFFSET + 0x200000)
457*c1d14583SBruce Richardson #define IPN3KE_CCB_NSEGFREE_MASK               0x3FFFFF
458*c1d14583SBruce Richardson #define IPN3KE_CCB_PSEGMAX_COEF               (IPN3KE_CCB_OFFSET + 0x200008)
459*c1d14583SBruce Richardson #define IPN3KE_CCB_PSEGMAX_COEF_MASK           0xFFFFF
460*c1d14583SBruce Richardson #define IPN3KE_CCB_NSEG_P                     (IPN3KE_CCB_OFFSET + 0x200080)
461*c1d14583SBruce Richardson #define IPN3KE_CCB_NSEG_MASK                   0x3FFFFF
462*c1d14583SBruce Richardson #define IPN3KE_CCB_QPROFILE_Q                 (IPN3KE_CCB_OFFSET + 0x240000)
463*c1d14583SBruce Richardson #define IPN3KE_CCB_QPROFILE_MASK               0x7FF
464*c1d14583SBruce Richardson #define IPN3KE_CCB_PROFILE_P                  (IPN3KE_CCB_OFFSET + 0x280000)
465*c1d14583SBruce Richardson #define IPN3KE_CCB_PROFILE_MASK                0x1FFFFFF
466*c1d14583SBruce Richardson #define IPN3KE_CCB_PROFILE_MS                 (IPN3KE_CCB_OFFSET + 0xC)
467*c1d14583SBruce Richardson #define IPN3KE_CCB_PROFILE_MS_MASK             0x1FFFFFF
468*c1d14583SBruce Richardson #define IPN3KE_CCB_LR_LB_DBG_CTRL             (IPN3KE_CCB_OFFSET + 0x2C0000)
469*c1d14583SBruce Richardson #define IPN3KE_CCB_LR_LB_DBG_DONE             (IPN3KE_CCB_OFFSET + 0x2C0004)
470*c1d14583SBruce Richardson #define IPN3KE_CCB_LR_LB_DBG_RDATA            (IPN3KE_CCB_OFFSET + 0x2C000C)
471*c1d14583SBruce Richardson 
472*c1d14583SBruce Richardson #define IPN3KE_QOS_MAP_L1_X                   (IPN3KE_QOS_OFFSET + 0x000000)
473*c1d14583SBruce Richardson #define IPN3KE_QOS_MAP_L1_MASK                 0x1FFF
474*c1d14583SBruce Richardson #define IPN3KE_QOS_MAP_L2_X                   (IPN3KE_QOS_OFFSET + 0x040000)
475*c1d14583SBruce Richardson #define IPN3KE_QOS_MAP_L2_MASK                 0x7
476*c1d14583SBruce Richardson #define IPN3KE_QOS_TYPE_MASK                   0x3
477*c1d14583SBruce Richardson #define IPN3KE_QOS_TYPE_L1_X                  (IPN3KE_QOS_OFFSET + 0x200000)
478*c1d14583SBruce Richardson #define IPN3KE_QOS_TYPE_L2_X                  (IPN3KE_QOS_OFFSET + 0x240000)
479*c1d14583SBruce Richardson #define IPN3KE_QOS_TYPE_L3_X                  (IPN3KE_QOS_OFFSET + 0x280000)
480*c1d14583SBruce Richardson #define IPN3KE_QOS_SCH_WT_MASK                 0xFF
481*c1d14583SBruce Richardson #define IPN3KE_QOS_SCH_WT_L1_X                (IPN3KE_QOS_OFFSET + 0x400000)
482*c1d14583SBruce Richardson #define IPN3KE_QOS_SCH_WT_L2_X                (IPN3KE_QOS_OFFSET + 0x440000)
483*c1d14583SBruce Richardson #define IPN3KE_QOS_SCH_WT_L3_X                (IPN3KE_QOS_OFFSET + 0x480000)
484*c1d14583SBruce Richardson #define IPN3KE_QOS_SHAP_WT_MASK                0x3FFF
485*c1d14583SBruce Richardson #define IPN3KE_QOS_SHAP_WT_L1_X               (IPN3KE_QOS_OFFSET + 0x600000)
486*c1d14583SBruce Richardson #define IPN3KE_QOS_SHAP_WT_L2_X               (IPN3KE_QOS_OFFSET + 0x640000)
487*c1d14583SBruce Richardson #define IPN3KE_QOS_SHAP_WT_L3_X               (IPN3KE_QOS_OFFSET + 0x680000)
488*c1d14583SBruce Richardson 
489*c1d14583SBruce Richardson #define IPN3KE_CLF_BASE_DST_MAC_ADDR_HI       (IPN3KE_CLASSIFY_OFFSET + 0x0000)
490*c1d14583SBruce Richardson #define IPN3KE_CLF_BASE_DST_MAC_ADDR_LOW      (IPN3KE_CLASSIFY_OFFSET + 0x0004)
491*c1d14583SBruce Richardson #define IPN3KE_CLF_QINQ_STAG                  (IPN3KE_CLASSIFY_OFFSET + 0x0008)
492*c1d14583SBruce Richardson #define IPN3KE_CLF_LKUP_ENABLE                (IPN3KE_CLASSIFY_OFFSET + 0x000C)
493*c1d14583SBruce Richardson #define IPN3KE_CLF_DFT_FLOW_ID                (IPN3KE_CLASSIFY_OFFSET + 0x0040)
494*c1d14583SBruce Richardson #define IPN3KE_CLF_RX_PARSE_CFG               (IPN3KE_CLASSIFY_OFFSET + 0x0080)
495*c1d14583SBruce Richardson #define IPN3KE_CLF_RX_STATS_CFG               (IPN3KE_CLASSIFY_OFFSET + 0x00C0)
496*c1d14583SBruce Richardson #define IPN3KE_CLF_RX_STATS_RPT               (IPN3KE_CLASSIFY_OFFSET + 0x00C4)
497*c1d14583SBruce Richardson #define IPN3KE_CLF_RX_TEST                    (IPN3KE_CLASSIFY_OFFSET + 0x0400)
498*c1d14583SBruce Richardson 
499*c1d14583SBruce Richardson #define IPN3KE_CLF_EM_VERSION       (IPN3KE_CLASSIFY_OFFSET + 0x40000 + 0x0000)
500*c1d14583SBruce Richardson #define IPN3KE_CLF_EM_NUM           (IPN3KE_CLASSIFY_OFFSET + 0x40000 + 0x0008)
501*c1d14583SBruce Richardson #define IPN3KE_CLF_EM_KEY_WDTH      (IPN3KE_CLASSIFY_OFFSET + 0x40000 + 0x000C)
502*c1d14583SBruce Richardson #define IPN3KE_CLF_EM_RES_WDTH      (IPN3KE_CLASSIFY_OFFSET + 0x40000 + 0x0010)
503*c1d14583SBruce Richardson #define IPN3KE_CLF_EM_ALARMS        (IPN3KE_CLASSIFY_OFFSET + 0x40000 + 0x0014)
504*c1d14583SBruce Richardson #define IPN3KE_CLF_EM_DRC_RLAT      (IPN3KE_CLASSIFY_OFFSET + 0x40000 + 0x0018)
505*c1d14583SBruce Richardson 
506*c1d14583SBruce Richardson #define IPN3KE_CLF_MHL_VERSION      (IPN3KE_CLASSIFY_OFFSET + 0x50000 + 0x0000)
507*c1d14583SBruce Richardson #define IPN3KE_CLF_MHL_GEN_CTRL     (IPN3KE_CLASSIFY_OFFSET + 0x50000 + 0x0018)
508*c1d14583SBruce Richardson #define IPN3KE_CLF_MHL_MGMT_CTRL    (IPN3KE_CLASSIFY_OFFSET + 0x50000 + 0x0020)
509*c1d14583SBruce Richardson #define IPN3KE_CLF_MHL_MGMT_CTRL_BIT_BUSY      31
510*c1d14583SBruce Richardson #define IPN3KE_CLF_MHL_MGMT_CTRL_FLUSH         0x0
511*c1d14583SBruce Richardson #define IPN3KE_CLF_MHL_MGMT_CTRL_INSERT        0x1
512*c1d14583SBruce Richardson #define IPN3KE_CLF_MHL_MGMT_CTRL_DELETE        0x2
513*c1d14583SBruce Richardson #define IPN3KE_CLF_MHL_MGMT_CTRL_SEARCH        0x3
514*c1d14583SBruce Richardson #define IPN3KE_CLF_MHL_FATAL_0     (IPN3KE_CLASSIFY_OFFSET + 0x50000 + 0x0050)
515*c1d14583SBruce Richardson #define IPN3KE_CLF_MHL_MON_0       (IPN3KE_CLASSIFY_OFFSET + 0x50000 + 0x0060)
516*c1d14583SBruce Richardson #define IPN3KE_CLF_MHL_TOTAL_ENTRIES   (IPN3KE_CLASSIFY_OFFSET + \
517*c1d14583SBruce Richardson 					0x50000 + 0x0080)
518*c1d14583SBruce Richardson #define IPN3KE_CLF_MHL_ONEHIT_BUCKETS  (IPN3KE_CLASSIFY_OFFSET + \
519*c1d14583SBruce Richardson 					0x50000 + 0x0084)
520*c1d14583SBruce Richardson #define IPN3KE_CLF_MHL_KEY_MASK         0xFFFFFFFF
521*c1d14583SBruce Richardson #define IPN3KE_CLF_MHL_KEY_0       (IPN3KE_CLASSIFY_OFFSET + 0x50000 + 0x1000)
522*c1d14583SBruce Richardson #define IPN3KE_CLF_MHL_KEY_1       (IPN3KE_CLASSIFY_OFFSET + 0x50000 + 0x1004)
523*c1d14583SBruce Richardson #define IPN3KE_CLF_MHL_KEY_2       (IPN3KE_CLASSIFY_OFFSET + 0x50000 + 0x1008)
524*c1d14583SBruce Richardson #define IPN3KE_CLF_MHL_KEY_3       (IPN3KE_CLASSIFY_OFFSET + 0x50000 + 0x100C)
525*c1d14583SBruce Richardson #define IPN3KE_CLF_MHL_RES_MASK    0xFFFFFFFF
526*c1d14583SBruce Richardson #define IPN3KE_CLF_MHL_RES         (IPN3KE_CLASSIFY_OFFSET + 0x50000 + 0x2000)
527*c1d14583SBruce Richardson 
528*c1d14583SBruce Richardson int
529*c1d14583SBruce Richardson ipn3ke_rpst_dev_set_link_up(struct rte_eth_dev *dev);
530*c1d14583SBruce Richardson int
531*c1d14583SBruce Richardson ipn3ke_rpst_dev_set_link_down(struct rte_eth_dev *dev);
532*c1d14583SBruce Richardson int
533*c1d14583SBruce Richardson ipn3ke_rpst_link_update(struct rte_eth_dev *ethdev,
534*c1d14583SBruce Richardson 	__rte_unused int wait_to_complete);
535*c1d14583SBruce Richardson int
536*c1d14583SBruce Richardson ipn3ke_rpst_promiscuous_enable(struct rte_eth_dev *ethdev);
537*c1d14583SBruce Richardson int
538*c1d14583SBruce Richardson ipn3ke_rpst_promiscuous_disable(struct rte_eth_dev *ethdev);
539*c1d14583SBruce Richardson int
540*c1d14583SBruce Richardson ipn3ke_rpst_allmulticast_enable(struct rte_eth_dev *ethdev);
541*c1d14583SBruce Richardson int
542*c1d14583SBruce Richardson ipn3ke_rpst_allmulticast_disable(struct rte_eth_dev *ethdev);
543*c1d14583SBruce Richardson int
544*c1d14583SBruce Richardson ipn3ke_rpst_mac_addr_set(struct rte_eth_dev *ethdev,
545*c1d14583SBruce Richardson 		struct rte_ether_addr *mac_addr);
546*c1d14583SBruce Richardson int
547*c1d14583SBruce Richardson ipn3ke_rpst_mtu_set(struct rte_eth_dev *ethdev, uint16_t mtu);
548*c1d14583SBruce Richardson 
549*c1d14583SBruce Richardson int
550*c1d14583SBruce Richardson ipn3ke_rpst_init(struct rte_eth_dev *ethdev, void *init_params);
551*c1d14583SBruce Richardson int
552*c1d14583SBruce Richardson ipn3ke_rpst_uninit(struct rte_eth_dev *ethdev);
553*c1d14583SBruce Richardson int
554*c1d14583SBruce Richardson ipn3ke_hw_tm_init(struct ipn3ke_hw *hw);
555*c1d14583SBruce Richardson void
556*c1d14583SBruce Richardson ipn3ke_tm_init(struct ipn3ke_rpst *rpst);
557*c1d14583SBruce Richardson int
558*c1d14583SBruce Richardson ipn3ke_tm_ops_get(struct rte_eth_dev *ethdev,
559*c1d14583SBruce Richardson 		void *arg);
560*c1d14583SBruce Richardson 
561*c1d14583SBruce Richardson 
562*c1d14583SBruce Richardson /* IPN3KE_MASK is a macro used on 32 bit registers */
563*c1d14583SBruce Richardson #define IPN3KE_MASK(mask, shift) ((mask) << (shift))
564*c1d14583SBruce Richardson 
565*c1d14583SBruce Richardson #define IPN3KE_MAC_CTRL_BASE_0    0x00000000
566*c1d14583SBruce Richardson #define IPN3KE_MAC_CTRL_BASE_1    0x00008000
567*c1d14583SBruce Richardson 
568*c1d14583SBruce Richardson #define IPN3KE_MAC_STATS_MASK    0xFFFFFFFFF
569*c1d14583SBruce Richardson 
570*c1d14583SBruce Richardson /* All the address are in 4Bytes*/
571*c1d14583SBruce Richardson #define IPN3KE_MAC_PRIMARY_MAC_ADDR0    0x0010
572*c1d14583SBruce Richardson #define IPN3KE_MAC_PRIMARY_MAC_ADDR1    0x0011
573*c1d14583SBruce Richardson 
574*c1d14583SBruce Richardson #define IPN3KE_MAC_MAC_RESET_CONTROL    0x001F
575*c1d14583SBruce Richardson #define IPN3KE_MAC_MAC_RESET_CONTROL_TX_SHIFT    0
576*c1d14583SBruce Richardson #define IPN3KE_MAC_MAC_RESET_CONTROL_TX_MASK \
577*c1d14583SBruce Richardson 	IPN3KE_MASK(0x1, IPN3KE_MAC_MAC_RESET_CONTROL_TX_SHIFT)
578*c1d14583SBruce Richardson 
579*c1d14583SBruce Richardson #define IPN3KE_MAC_MAC_RESET_CONTROL_RX_SHIFT    8
580*c1d14583SBruce Richardson #define IPN3KE_MAC_MAC_RESET_CONTROL_RX_MASK \
581*c1d14583SBruce Richardson 	IPN3KE_MASK(0x1, IPN3KE_MAC_MAC_RESET_CONTROL_RX_SHIFT)
582*c1d14583SBruce Richardson 
583*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_PACKET_CONTROL    0x0020
584*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_PACKET_CONTROL_SHIFT    0
585*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_PACKET_CONTROL_MASK \
586*c1d14583SBruce Richardson 	IPN3KE_MASK(0x1, IPN3KE_MAC_TX_PACKET_CONTROL_SHIFT)
587*c1d14583SBruce Richardson 
588*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_SRC_ADDR_OVERRIDE    0x002A
589*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_SRC_ADDR_OVERRIDE_SHIFT    0
590*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_SRC_ADDR_OVERRIDE_MASK \
591*c1d14583SBruce Richardson 	IPN3KE_MASK(0x1, IPN3KE_MAC_TX_SRC_ADDR_OVERRIDE_SHIFT)
592*c1d14583SBruce Richardson 
593*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_FRAME_MAXLENGTH    0x002C
594*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_FRAME_MAXLENGTH_SHIFT    0
595*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_FRAME_MAXLENGTH_MASK \
596*c1d14583SBruce Richardson 	IPN3KE_MASK(0xFFFF, IPN3KE_MAC_TX_FRAME_MAXLENGTH_SHIFT)
597*c1d14583SBruce Richardson 
598*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_PAUSEFRAME_CONTROL    0x0040
599*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_PAUSEFRAME_CONTROL_SHIFT    0
600*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_PAUSEFRAME_CONTROL_MASK \
601*c1d14583SBruce Richardson 	IPN3KE_MASK(0x3, IPN3KE_MAC_TX_PAUSEFRAME_CONTROL_SHIFT)
602*c1d14583SBruce Richardson 
603*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_PAUSEFRAME_QUANTA    0x0042
604*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_PAUSEFRAME_QUANTA_SHIFT    0
605*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_PAUSEFRAME_QUANTA_MASK \
606*c1d14583SBruce Richardson 	IPN3KE_MASK(0xFFFF, IPN3KE_MAC_TX_PAUSEFRAME_QUANTA_SHIFT)
607*c1d14583SBruce Richardson 
608*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_PAUSEFRAME_HOLDOFF_QUANTA    0x0043
609*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_PAUSEFRAME_HOLDOFF_QUANTA_SHIFT    0
610*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_PAUSEFRAME_HOLDOFF_QUANTA_MASK \
611*c1d14583SBruce Richardson 	IPN3KE_MASK(0xFFFF, IPN3KE_MAC_TX_PAUSEFRAME_HOLDOFF_QUANTA_SHIFT)
612*c1d14583SBruce Richardson 
613*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_PAUSEFRAME_ENABLE    0x0044
614*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_PAUSEFRAME_ENABLE_CFG_SHIFT    0
615*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_PAUSEFRAME_ENABLE_CFG_MASK \
616*c1d14583SBruce Richardson 	IPN3KE_MASK(0x1, IPN3KE_MAC_TX_PAUSEFRAME_ENABLE_CFG_SHIFT)
617*c1d14583SBruce Richardson 
618*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_PAUSEFRAME_ENABLE_TYPE_SHIFT    1
619*c1d14583SBruce Richardson #define IPN3KE_MAC_TX_PAUSEFRAME_ENABLE_TYPE_MASK \
620*c1d14583SBruce Richardson 	IPN3KE_MASK(0x3, IPN3KE_MAC_TX_PAUSEFRAME_ENABLE_TYPE_SHIFT)
621*c1d14583SBruce Richardson 
622*c1d14583SBruce Richardson #define IPN3KE_MAC_RX_TRANSFER_CONTROL    0x00A0
623*c1d14583SBruce Richardson #define IPN3KE_MAC_RX_TRANSFER_CONTROL_SHIFT    0x0
624*c1d14583SBruce Richardson #define IPN3KE_MAC_RX_TRANSFER_CONTROL_MASK \
625*c1d14583SBruce Richardson 	IPN3KE_MASK(0x1, IPN3KE_MAC_RX_TRANSFER_CONTROL_SHIFT)
626*c1d14583SBruce Richardson 
627*c1d14583SBruce Richardson #define IPN3KE_MAC_RX_FRAME_CONTROL    0x00AC
628*c1d14583SBruce Richardson #define IPN3KE_MAC_RX_FRAME_CONTROL_EN_ALLUCAST_SHIFT    0x0
629*c1d14583SBruce Richardson #define IPN3KE_MAC_RX_FRAME_CONTROL_EN_ALLUCAST_MASK \
630*c1d14583SBruce Richardson 	IPN3KE_MASK(0x1, IPN3KE_MAC_RX_FRAME_CONTROL_EN_ALLUCAST_SHIFT)
631*c1d14583SBruce Richardson 
632*c1d14583SBruce Richardson #define IPN3KE_MAC_RX_FRAME_CONTROL_EN_ALLMCAST_SHIFT    0x1
633*c1d14583SBruce Richardson #define IPN3KE_MAC_RX_FRAME_CONTROL_EN_ALLMCAST_MASK \
634*c1d14583SBruce Richardson 	IPN3KE_MASK(0x1, IPN3KE_MAC_RX_FRAME_CONTROL_EN_ALLMCAST_SHIFT)
635*c1d14583SBruce Richardson 
636*c1d14583SBruce Richardson /**
637*c1d14583SBruce Richardson  * The overhead from MTU to max frame size.
638*c1d14583SBruce Richardson  * Considering QinQ packet, the VLAN tag needs to be counted twice.
639*c1d14583SBruce Richardson  */
640*c1d14583SBruce Richardson #define IPN3KE_ETH_OVERHEAD \
641*c1d14583SBruce Richardson 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + RTE_VLAN_HLEN * 2)
642*c1d14583SBruce Richardson #define IPN3KE_ETH_MAX_LEN (RTE_ETHER_MTU + IPN3KE_ETH_OVERHEAD)
643*c1d14583SBruce Richardson 
644*c1d14583SBruce Richardson #define IPN3KE_MAC_FRAME_SIZE_MAX    9728
645*c1d14583SBruce Richardson #define IPN3KE_MAC_RX_FRAME_MAXLENGTH    0x00AE
646*c1d14583SBruce Richardson #define IPN3KE_MAC_RX_FRAME_MAXLENGTH_SHIFT    0
647*c1d14583SBruce Richardson #define IPN3KE_MAC_RX_FRAME_MAXLENGTH_MASK \
648*c1d14583SBruce Richardson 	IPN3KE_MASK(0xFFFF, IPN3KE_MAC_RX_FRAME_MAXLENGTH_SHIFT)
649*c1d14583SBruce Richardson 
650*c1d14583SBruce Richardson #define IPN3KE_25G_MAX_TX_SIZE_CONFIG                                0x407
651*c1d14583SBruce Richardson #define IPN3KE_25G_MAX_RX_SIZE_CONFIG                                0x506
652*c1d14583SBruce Richardson 
653*c1d14583SBruce Richardson #define IPN3KE_10G_TX_FRAME_MAXLENGTH                                0x002C
654*c1d14583SBruce Richardson #define IPN3KE_10G_RX_FRAME_MAXLENGTH                                0x00AE
655*c1d14583SBruce Richardson 
656*c1d14583SBruce Richardson #define IPN3KE_REGISTER_WIDTH                                        32
657*c1d14583SBruce Richardson 
658*c1d14583SBruce Richardson /*Bits[2:0]: Configuration of TX statistics counters:
659*c1d14583SBruce Richardson  *Bit[2]: Shadow request (active high): When set to the value of 1,
660*c1d14583SBruce Richardson  *TX statistics collection is paused. The underlying counters
661*c1d14583SBruce Richardson  *continue to operate, but the readable values reflect a snapshot at
662*c1d14583SBruce Richardson  *the time the pause flag was activated. Write a 0 to release.
663*c1d14583SBruce Richardson  *Bit[1]: Parity-error clear. When software sets this bit, the IP core
664*c1d14583SBruce Richardson  *clears the parity bit CNTR_TX_STATUS[0]. This bit
665*c1d14583SBruce Richardson  *(CNTR_TX_CONFIG[1]) is self-clearing.
666*c1d14583SBruce Richardson  *Bit[0]: Software can set this bit to the value of 1 to reset all of
667*c1d14583SBruce Richardson  *the TX statistics registers at the same time. This bit is selfclearing.
668*c1d14583SBruce Richardson  *Bits[31:3] are Reserved
669*c1d14583SBruce Richardson  */
670*c1d14583SBruce Richardson #define IPN3KE_25G_TX_STATISTICS_CONFIG                              0x845
671*c1d14583SBruce Richardson #define IPN3KE_25G_TX_STATISTICS_CONFIG_SHADOW_REQUEST_MASK          0x00000004
672*c1d14583SBruce Richardson 
673*c1d14583SBruce Richardson /*Bit[1]: Indicates that the TX statistics registers are paused (while
674*c1d14583SBruce Richardson  *CNTR_TX_CONFIG[2] is asserted).
675*c1d14583SBruce Richardson  *Bit[0]: Indicates the presence of at least one parity error in the
676*c1d14583SBruce Richardson  *TX statistics counters.
677*c1d14583SBruce Richardson  *Bits[31:2] are Reserved.
678*c1d14583SBruce Richardson  */
679*c1d14583SBruce Richardson #define IPN3KE_25G_TX_STATISTICS_STATUS                              0x846
680*c1d14583SBruce Richardson #define IPN3KE_25G_TX_STATISTICS_STATUS_SHADOW_REQUEST_MASK          0x00000002
681*c1d14583SBruce Richardson 
682*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_FRAGMENTS_LO                              0x800
683*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_FRAGMENTS_HI                              0x801
684*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_JABBERS_LO                                0x802
685*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_JABBERS_HI                                0x803
686*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_FCS_LO                                    0x804
687*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_FCS_HI                                    0x805
688*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_CRCERR_LO                                 0x806
689*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_CRCERR_HI                                 0x807
690*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_MCAST_DATA_ERR_LO                         0x808
691*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_MCAST_DATA_ERR_HI                         0x809
692*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_BCAST_DATA_ERR_LO                         0x80A
693*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_BCAST_DATA_ERR_HI                         0x80B
694*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_UCAST_DATA_ERR_LO                         0x80C
695*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_UCAST_DATA_ERR_HI                         0x80D
696*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_MCAST_CTRL_ERR_LO                         0x80E
697*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_MCAST_CTRL_ERR_HI                         0x80F
698*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_BCAST_CTRL_ERR_LO                         0x810
699*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_BCAST_CTRL_ERR_HI                         0x811
700*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_UCAST_CTRL_ERR_LO                         0x812
701*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_UCAST_CTRL_ERR_HI                         0x813
702*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_PAUSE_ERR_LO                              0x814
703*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_PAUSE_ERR_HI                              0x815
704*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_64B_LO                                    0x816
705*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_64B_HI                                    0x817
706*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_65_127B_LO                                0x818
707*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_65_127B_HI                                0x819
708*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_128_255B_LO                               0x81A
709*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_128_255B_HI                               0x81B
710*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_256_511B_LO                               0x81C
711*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_256_511B_HI                               0x81D
712*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_512_1023B_LO                              0x81E
713*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_512_1023B_HI                              0x81F
714*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_1024_1518B_LO                             0x820
715*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_1024_1518B_HI                             0x821
716*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_1519_MAXB_LO                              0x822
717*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_1519_MAXB_HI                              0x823
718*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_OVERSIZE_LO                               0x824
719*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_OVERSIZE_HI                               0x825
720*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_MCAST_DATA_OK_LO                          0x826
721*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_MCAST_DATA_OK_HI                          0x827
722*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_BCAST_DATA_OK_LO                          0x828
723*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_BCAST_DATA_OK_HI                          0x829
724*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_UCAST_DATA_OK_LO                          0x82A
725*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_UCAST_DATA_OK_HI                          0x82B
726*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_MCAST_CTRL_LO                             0x82C
727*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_MCAST_CTRL_HI                             0x82D
728*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_BCAST_CTRL_LO                             0x82E
729*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_BCAST_CTRL_HI                             0x82F
730*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_UCAST_CTRL_LO                             0x830
731*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_UCAST_CTRL_HI                             0x831
732*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_PAUSE_LO                                  0x832
733*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_PAUSE_HI                                  0x833
734*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_RUNT_LO                                   0x834
735*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_TX_RUNT_HI                                   0x835
736*c1d14583SBruce Richardson #define IPN3KE_25G_TX_PAYLOAD_OCTETS_OK_LO                           0x860
737*c1d14583SBruce Richardson #define IPN3KE_25G_TX_PAYLOAD_OCTETS_OK_HI                           0x861
738*c1d14583SBruce Richardson #define IPN3KE_25G_TX_FRAME_OCTETS_OK_LO                             0x862
739*c1d14583SBruce Richardson #define IPN3KE_25G_TX_FRAME_OCTETS_OK_HI                             0x863
740*c1d14583SBruce Richardson 
741*c1d14583SBruce Richardson /*Bits[2:0]: Configuration of RX statistics counters:
742*c1d14583SBruce Richardson  *Bit[2]: Shadow request (active high): When set to the value of 1,
743*c1d14583SBruce Richardson  *RX statistics collection is paused. The underlying counters
744*c1d14583SBruce Richardson  *continue to operate, but the readable values reflect a snapshot
745*c1d14583SBruce Richardson  *at the time the pause flag was activated. Write a 0 to release.
746*c1d14583SBruce Richardson  *Bit[1]: Parity-error clear. When software sets this bit, the IP
747*c1d14583SBruce Richardson  *core clears the parity bit CNTR_RX_STATUS[0]. This bit
748*c1d14583SBruce Richardson  *(CNTR_RX_CONFIG[1]) is self-clearing.
749*c1d14583SBruce Richardson  *Bit[0]: Software can set this bit to the value of 1 to reset all of
750*c1d14583SBruce Richardson  *the RX statistics registers at the same time. This bit is selfclearing.
751*c1d14583SBruce Richardson  *Bits[31:3] are Reserved.
752*c1d14583SBruce Richardson  */
753*c1d14583SBruce Richardson #define IPN3KE_25G_RX_STATISTICS_CONFIG                              0x945
754*c1d14583SBruce Richardson #define IPN3KE_25G_RX_STATISTICS_CONFIG_SHADOW_REQUEST_MASK          0x00000004
755*c1d14583SBruce Richardson 
756*c1d14583SBruce Richardson /*Bit[1]: Indicates that the RX statistics registers are paused
757*c1d14583SBruce Richardson  *(while CNTR_RX_CONFIG[2] is asserted).
758*c1d14583SBruce Richardson  *Bit[0]: Indicates the presence of at least one parity error in the
759*c1d14583SBruce Richardson  *RX statistics counters.
760*c1d14583SBruce Richardson  *Bits [31:2] are Reserved
761*c1d14583SBruce Richardson  */
762*c1d14583SBruce Richardson #define IPN3KE_25G_RX_STATISTICS_STATUS                              0x946
763*c1d14583SBruce Richardson #define IPN3KE_25G_RX_STATISTICS_STATUS_SHADOW_REQUEST_MASK          0x00000002
764*c1d14583SBruce Richardson 
765*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_FRAGMENTS_LO                              0x900
766*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_FRAGMENTS_HI                              0x901
767*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_JABBERS_LO                                0x902
768*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_JABBERS_HI                                0x903
769*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_FCS_LO                                    0x904
770*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_FCS_HI                                    0x905
771*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_CRCERR_LO                                 0x906
772*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_CRCERR_HI                                 0x907
773*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_MCAST_DATA_ERR_LO                         0x908
774*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_MCAST_DATA_ERR_HI                         0x909
775*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_BCAST_DATA_ERR_LO                         0x90A
776*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_BCAST_DATA_ERR_HI                         0x90B
777*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_UCAST_DATA_ERR_LO                         0x90C
778*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_UCAST_DATA_ERR_HI                         0x90D
779*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_MCAST_CTRL_ERR_LO                         0x90E
780*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_MCAST_CTRL_ERR_HI                         0x90F
781*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_BCAST_CTRL_ERR_LO                         0x910
782*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_BCAST_CTRL_ERR_HI                         0x911
783*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_UCAST_CTRL_ERR_LO                         0x912
784*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_UCAST_CTRL_ERR_HI                         0x913
785*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_PAUSE_ERR_LO                              0x914
786*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_PAUSE_ERR_HI                              0x915
787*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_64B_LO                                    0x916
788*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_64B_HI                                    0x917
789*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_65_127B_LO                                0x918
790*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_65_127B_HI                                0x919
791*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_128_255B_LO                               0x91A
792*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_128_255B_HI                               0x91B
793*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_256_511B_LO                               0x91C
794*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_256_511B_HI                               0x91D
795*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_512_1023B_LO                              0x91E
796*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_512_1023B_HI                              0x91F
797*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_1024_1518B_LO                             0x920
798*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_1024_1518B_HI                             0x921
799*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_1519_MAXB_LO                              0x922
800*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_1519_MAXB_HI                              0x923
801*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_OVERSIZE_LO                               0x924
802*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_OVERSIZE_HI                               0x925
803*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_MCAST_DATA_OK_LO                          0x926
804*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_MCAST_DATA_OK_HI                          0x927
805*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_BCAST_DATA_OK_LO                          0x928
806*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_BCAST_DATA_OK_HI                          0x929
807*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_UCAST_DATA_OK_LO                          0x92A
808*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_UCAST_DATA_OK_HI                          0x92B
809*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_MCAST_CTRL_LO                             0x92C
810*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_MCAST_CTRL_HI                             0x92D
811*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_BCAST_CTRL_LO                             0x92E
812*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_BCAST_CTRL_HI                             0x92F
813*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_UCAST_CTRL_LO                             0x930
814*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_UCAST_CTRL_HI                             0x931
815*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_PAUSE_LO                                  0x932
816*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_PAUSE_HI                                  0x933
817*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_RUNT_LO                                   0x934
818*c1d14583SBruce Richardson #define IPN3KE_25G_CNTR_RX_RUNT_HI                                   0x935
819*c1d14583SBruce Richardson #define IPN3KE_25G_RX_PAYLOAD_OCTETS_OK_LO                           0x960
820*c1d14583SBruce Richardson #define IPN3KE_25G_RX_PAYLOAD_OCTETS_OK_HI                           0x961
821*c1d14583SBruce Richardson #define IPN3KE_25G_RX_FRAME_OCTETS_OK_LO                             0x962
822*c1d14583SBruce Richardson #define IPN3KE_25G_RX_FRAME_OCTETS_OK_HI                             0x963
823*c1d14583SBruce Richardson 
824*c1d14583SBruce Richardson #define IPN3KE_10G_STATS_HI_VALID_MASK                               0x0000000F
825*c1d14583SBruce Richardson 
826*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_CLR                                      0x0140
827*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_CLR_CLEAR_SHIFT    0
828*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_CLR_CLEAR_MASK \
829*c1d14583SBruce Richardson 	IPN3KE_MASK(0x1, IPN3KE_10G_TX_STATS_CLR_CLEAR_SHIFT)
830*c1d14583SBruce Richardson 
831*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_CLR                                      0x01C0
832*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_CLR_CLEAR_SHIFT    0
833*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_CLR_CLEAR_MASK \
834*c1d14583SBruce Richardson 	IPN3KE_MASK(0x1, IPN3KE_10G_RX_STATS_CLR_CLEAR_SHIFT)
835*c1d14583SBruce Richardson 
836*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_FRAME_OK_LO                              0x0142
837*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_FRAME_OK_HI                              0x0143
838*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_FRAME_OK_LO                              0x01C2
839*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_FRAME_OK_HI                              0x01C3
840*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_FRAME_ERR_LO                             0x0144
841*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_FRAME_ERR_HI                             0x0145
842*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_FRAME_ERR_LO                             0x01C4
843*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_FRAME_ERR_HI                             0x01C5
844*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_FRAME_CRC_ERR_LO                         0x01C6
845*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_FRAME_CRC_ERR_HI                         0x01C7
846*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_OCTETS_OK_LO                             0x0148
847*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_OCTETS_OK_HI                             0x0149
848*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_OCTETS_OK_LO                             0x01C8
849*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_OCTETS_OK_HI                             0x01C9
850*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_PAUSE_MAC_CTRL_FRAMES_LO                 0x014A
851*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_PAUSE_MAC_CTRL_FRAMES_HI                 0x014B
852*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_PAUSE_MAC_CTRL_FRAMES_LO                 0x01CA
853*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_PAUSE_MAC_CTRL_FRAMES_HI                 0x01CB
854*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_IF_ERRORS_LO                             0x014C
855*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_IF_ERRORS_HI                             0x014D
856*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_IF_ERRORS_LO                             0x01CC
857*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_IF_ERRORS_HI                             0x01CD
858*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_UNICAST_FRAME_OK_LO                      0x014E
859*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_UNICAST_FRAME_OK_HI                      0x014F
860*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_UNICAST_FRAME_OK_LO                      0x01CE
861*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_UNICAST_FRAME_OK_HI                      0x01CF
862*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_UNICAST_FRAME_ERR_LO                     0x0150
863*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_UNICAST_FRAME_ERR_HI                     0x0151
864*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_UNICAST_FRAME_ERR_LO                     0x01D0
865*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_UNICAST_FRAME_ERR_HI                     0x01D1
866*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_MULTICAST_FRAME_OK_LO                    0x0152
867*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_MULTICAST_FRAME_OK_HI                    0x0153
868*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_MULTICAST_FRAME_OK_LO                    0x01D2
869*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_MULTICAST_FRAME_OK_HI                    0x01D3
870*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_MULTICAST_FRAME_ERR_LO                   0x0154
871*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_MULTICAST_FRAME_ERR_HI                   0x0155
872*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_MULTICAST_FRAME_ERR_LO                   0x01D4
873*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_MULTICAST_FRAME_ERR_HI                   0x01D5
874*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_BROADCAST_FRAME_OK_LO                    0x0156
875*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_BROADCAST_FRAME_OK_HI                    0x0157
876*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_BROADCAST_FRAME_OK_LO                    0x01D6
877*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_BROADCAST_FRAME_OK_HI                    0x01D7
878*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_BROADCAST_FRAME_ERR_LO                   0x0158
879*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_BROADCAST_FRAME_ERR_HI                   0x0159
880*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_BROADCAST_FRAME_ERR_LO                   0x01D8
881*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_BROADCAST_FRAME_ERR_HI                   0x01D9
882*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_OCTETS_LO                    0x015A
883*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_OCTETS_HI                    0x015B
884*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_OCTETS_LO                    0x01DA
885*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_OCTETS_HI                    0x01DB
886*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_PKTS_LO                      0x015C
887*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_PKTS_HI                      0x015D
888*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_PKTS_LO                      0x01DC
889*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_PKTS_HI                      0x01DD
890*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_UNDER_SIZE_PKTS_LO           0x015E
891*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_UNDER_SIZE_PKTS_HI           0x015F
892*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_UNDER_SIZE_PKTS_LO           0x01DE
893*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_UNDER_SIZE_PKTS_HI           0x01DF
894*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_OVER_SIZE_PKTS_LO            0x0160
895*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_OVER_SIZE_PKTS_HI            0x0161
896*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_OVER_SIZE_PKTS_LO            0x01E0
897*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_OVER_SIZE_PKTS_HI            0x01E1
898*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_PKTS_64_OCTETS_LO            0x0162
899*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_PKTS_64_OCTETS_HI            0x0163
900*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_PKTS_64_OCTETS_LO            0x01E2
901*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_PKTS_64_OCTETS_HI            0x01E3
902*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_PKTS_65_127_OCTETS_LO        0x0164
903*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_PKTS_65_127_OCTETS_HI        0x0165
904*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_PKTS_65_127_OCTETS_LO        0x01E4
905*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_PKTS_65_127_OCTETS_HI        0x01E5
906*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_PKTS_128_255_OCTETS_LO       0x0166
907*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_PKTS_128_255_OCTETS_HI       0x0167
908*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_PKTS_128_255_OCTETS_LO       0x01E6
909*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_PKTS_128_255_OCTETS_HI       0x01E7
910*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_PKTS_256_511_OCTETS_LO       0x0168
911*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_PKTS_256_511_OCTETS_HI       0x0169
912*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_PKTS_256_511_OCTETS_LO       0x01E8
913*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_PKTS_256_511_OCTETS_HI       0x01E9
914*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_PKTS_512_1023_OCTETS_LO      0x016A
915*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_PKTS_512_1023_OCTETS_HI      0x016B
916*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_PKTS_512_1023_OCTETS_LO      0x01EA
917*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_PKTS_512_1023_OCTETS_HI      0x01EB
918*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_PKTS_1024_1518_OCTETS_LO     0x016C
919*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_PKTS_1024_1518_OCTETS_HI     0x016D
920*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_PKTS_1024_1518_OCTETS_LO     0x01EC
921*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_PKTS_1024_1518_OCTETS_HI     0x01ED
922*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_PKTS_1519_X_OCTETS_LO        0x016E
923*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_ETHER_STATS_PKTS_1519_X_OCTETS_HI        0x016F
924*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_PKTS_1519_X_OCTETS_LO        0x01EE
925*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_PKTS_1519_X_OCTETS_HI        0x01EF
926*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_FRAGMENTS_LO                 0x01E0
927*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_FRAGMENTS_HI                 0x01F1
928*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_JABBERS_LO                   0x01E2
929*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_JABBERS_HI                   0x01F3
930*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_CRC_ERR_LO                   0x01E4
931*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_ETHER_STATS_CRC_ERR_HI                   0x01F5
932*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_UNICAST_MAC_CTRL_FRAMES_LO               0x0176
933*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_UNICAST_MAC_CTRL_FRAMES_HI               0x0177
934*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_UNICAST_MAC_CTRL_FRAMES_LO               0x01F6
935*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_UNICAST_MAC_CTRL_FRAMES_HI               0x01F7
936*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_MULTICAST_MAC_CTRL_FRAMES_LO             0x0178
937*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_MULTICAST_MAC_CTRL_FRAMES_HI             0x0179
938*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_MULTICAST_MAC_CTRL_FRAMES_LO             0x01F8
939*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_MULTICAST_MAC_CTRL_FRAMES_HI             0x01F9
940*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_BROADCAST_MAC_CTRL_FRAMES_LO             0x017A
941*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_BROADCAST_MAC_CTRL_FRAMES_HI             0x017B
942*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_BROADCAST_MAC_CTRL_FRAMES_LO             0x01FA
943*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_BROADCAST_MAC_CTRL_FRAMES_HI             0x01FB
944*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_PFC_MAC_CTRL_FRAMES_LO                   0x017C
945*c1d14583SBruce Richardson #define IPN3KE_10G_TX_STATS_PFC_MAC_CTRL_FRAMES_HI                   0x017D
946*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_PFC_MAC_CTRL_FRAMES_LO                   0x01FC
947*c1d14583SBruce Richardson #define IPN3KE_10G_RX_STATS_PFC_MAC_CTRL_FRAMES_HI                   0x01FD
948*c1d14583SBruce Richardson 
949*c1d14583SBruce Richardson static inline void ipn3ke_xmac_tx_enable(struct ipn3ke_hw *hw,
950*c1d14583SBruce Richardson 		uint32_t mac_num, uint32_t eth_group_sel)
951*c1d14583SBruce Richardson {
952*c1d14583SBruce Richardson #define IPN3KE_XMAC_TX_ENABLE (0 & (IPN3KE_MAC_TX_PACKET_CONTROL_MASK))
953*c1d14583SBruce Richardson 
954*c1d14583SBruce Richardson 	(*hw->f_mac_write)(hw,
955*c1d14583SBruce Richardson 					IPN3KE_XMAC_TX_ENABLE,
956*c1d14583SBruce Richardson 					IPN3KE_MAC_TX_PACKET_CONTROL,
957*c1d14583SBruce Richardson 					mac_num,
958*c1d14583SBruce Richardson 					eth_group_sel);
959*c1d14583SBruce Richardson }
960*c1d14583SBruce Richardson 
961*c1d14583SBruce Richardson static inline void ipn3ke_xmac_tx_disable(struct ipn3ke_hw *hw,
962*c1d14583SBruce Richardson 		uint32_t mac_num, uint32_t eth_group_sel)
963*c1d14583SBruce Richardson {
964*c1d14583SBruce Richardson #define IPN3KE_XMAC_TX_DISABLE (1 & (IPN3KE_MAC_TX_PACKET_CONTROL_MASK))
965*c1d14583SBruce Richardson 
966*c1d14583SBruce Richardson 	(*hw->f_mac_write)(hw,
967*c1d14583SBruce Richardson 					IPN3KE_XMAC_TX_DISABLE,
968*c1d14583SBruce Richardson 					IPN3KE_MAC_TX_PACKET_CONTROL,
969*c1d14583SBruce Richardson 					mac_num,
970*c1d14583SBruce Richardson 					eth_group_sel);
971*c1d14583SBruce Richardson }
972*c1d14583SBruce Richardson 
973*c1d14583SBruce Richardson static inline void ipn3ke_xmac_rx_enable(struct ipn3ke_hw *hw,
974*c1d14583SBruce Richardson 		uint32_t mac_num, uint32_t eth_group_sel)
975*c1d14583SBruce Richardson {
976*c1d14583SBruce Richardson #define IPN3KE_XMAC_RX_ENABLE (0 & (IPN3KE_MAC_RX_TRANSFER_CONTROL_MASK))
977*c1d14583SBruce Richardson 
978*c1d14583SBruce Richardson 	(*hw->f_mac_write)(hw,
979*c1d14583SBruce Richardson 					IPN3KE_XMAC_RX_ENABLE,
980*c1d14583SBruce Richardson 					IPN3KE_MAC_RX_TRANSFER_CONTROL,
981*c1d14583SBruce Richardson 					mac_num,
982*c1d14583SBruce Richardson 					eth_group_sel);
983*c1d14583SBruce Richardson }
984*c1d14583SBruce Richardson 
985*c1d14583SBruce Richardson static inline void ipn3ke_xmac_rx_disable(struct ipn3ke_hw *hw,
986*c1d14583SBruce Richardson 		uint32_t mac_num, uint32_t eth_group_sel)
987*c1d14583SBruce Richardson {
988*c1d14583SBruce Richardson #define IPN3KE_XMAC_RX_DISABLE (1 & (IPN3KE_MAC_RX_TRANSFER_CONTROL_MASK))
989*c1d14583SBruce Richardson 
990*c1d14583SBruce Richardson 	(*hw->f_mac_write)(hw,
991*c1d14583SBruce Richardson 					IPN3KE_XMAC_RX_DISABLE,
992*c1d14583SBruce Richardson 					IPN3KE_MAC_RX_TRANSFER_CONTROL,
993*c1d14583SBruce Richardson 					mac_num,
994*c1d14583SBruce Richardson 					eth_group_sel);
995*c1d14583SBruce Richardson }
996*c1d14583SBruce Richardson 
997*c1d14583SBruce Richardson static inline void ipn3ke_xmac_smac_ovd_dis(struct ipn3ke_hw *hw,
998*c1d14583SBruce Richardson 	uint32_t mac_num, uint32_t eth_group_sel)
999*c1d14583SBruce Richardson {
1000*c1d14583SBruce Richardson #define IPN3KE_XMAC_SMAC_OVERRIDE_DISABLE (0 & \
1001*c1d14583SBruce Richardson 	(IPN3KE_MAC_TX_SRC_ADDR_OVERRIDE_MASK))
1002*c1d14583SBruce Richardson 
1003*c1d14583SBruce Richardson 	(*hw->f_mac_write)(hw,
1004*c1d14583SBruce Richardson 					IPN3KE_XMAC_SMAC_OVERRIDE_DISABLE,
1005*c1d14583SBruce Richardson 					IPN3KE_MAC_TX_SRC_ADDR_OVERRIDE,
1006*c1d14583SBruce Richardson 					mac_num,
1007*c1d14583SBruce Richardson 					eth_group_sel);
1008*c1d14583SBruce Richardson }
1009*c1d14583SBruce Richardson 
1010*c1d14583SBruce Richardson static inline void ipn3ke_xmac_tx_clr_10G_stcs
1011*c1d14583SBruce Richardson (struct ipn3ke_hw *hw, uint32_t mac_num, uint32_t eth_group_sel)
1012*c1d14583SBruce Richardson {
1013*c1d14583SBruce Richardson 	uint32_t tmp;
1014*c1d14583SBruce Richardson 	tmp = 0x00000000;
1015*c1d14583SBruce Richardson 	(*hw->f_mac_read)(hw,
1016*c1d14583SBruce Richardson 					&tmp,
1017*c1d14583SBruce Richardson 					IPN3KE_10G_TX_STATS_CLR,
1018*c1d14583SBruce Richardson 					mac_num,
1019*c1d14583SBruce Richardson 					eth_group_sel);
1020*c1d14583SBruce Richardson 	tmp |= 0x00000001;
1021*c1d14583SBruce Richardson 	(*hw->f_mac_write)(hw,
1022*c1d14583SBruce Richardson 					tmp,
1023*c1d14583SBruce Richardson 					IPN3KE_10G_TX_STATS_CLR,
1024*c1d14583SBruce Richardson 					mac_num,
1025*c1d14583SBruce Richardson 					eth_group_sel);
1026*c1d14583SBruce Richardson }
1027*c1d14583SBruce Richardson 
1028*c1d14583SBruce Richardson static inline void ipn3ke_xmac_rx_clr_10G_stcs
1029*c1d14583SBruce Richardson (struct ipn3ke_hw *hw, uint32_t mac_num, uint32_t eth_group_sel)
1030*c1d14583SBruce Richardson {
1031*c1d14583SBruce Richardson 	uint32_t tmp;
1032*c1d14583SBruce Richardson 	tmp = 0x00000000;
1033*c1d14583SBruce Richardson 	(*hw->f_mac_read)(hw,
1034*c1d14583SBruce Richardson 					&tmp,
1035*c1d14583SBruce Richardson 					IPN3KE_10G_RX_STATS_CLR,
1036*c1d14583SBruce Richardson 					mac_num,
1037*c1d14583SBruce Richardson 					eth_group_sel);
1038*c1d14583SBruce Richardson 	tmp |= 0x00000001;
1039*c1d14583SBruce Richardson 	(*hw->f_mac_write)(hw,
1040*c1d14583SBruce Richardson 					tmp,
1041*c1d14583SBruce Richardson 					IPN3KE_10G_RX_STATS_CLR,
1042*c1d14583SBruce Richardson 					mac_num,
1043*c1d14583SBruce Richardson 					eth_group_sel);
1044*c1d14583SBruce Richardson }
1045*c1d14583SBruce Richardson 
1046*c1d14583SBruce Richardson static inline void ipn3ke_xmac_tx_clr_25G_stcs
1047*c1d14583SBruce Richardson (struct ipn3ke_hw *hw, uint32_t mac_num, uint32_t eth_group_sel)
1048*c1d14583SBruce Richardson {
1049*c1d14583SBruce Richardson 	uint32_t tmp = 0x00000001;
1050*c1d14583SBruce Richardson 
1051*c1d14583SBruce Richardson 	/* Bit[0]: Software can set this bit to the value of 1
1052*c1d14583SBruce Richardson 	 * to reset all of the TX statistics registers at the same time.
1053*c1d14583SBruce Richardson 	 * This bit is selfclearing.
1054*c1d14583SBruce Richardson 	 */
1055*c1d14583SBruce Richardson 	(*hw->f_mac_write)(hw,
1056*c1d14583SBruce Richardson 					tmp,
1057*c1d14583SBruce Richardson 					IPN3KE_25G_TX_STATISTICS_CONFIG,
1058*c1d14583SBruce Richardson 					mac_num,
1059*c1d14583SBruce Richardson 					eth_group_sel);
1060*c1d14583SBruce Richardson }
1061*c1d14583SBruce Richardson 
1062*c1d14583SBruce Richardson static inline void ipn3ke_xmac_rx_clr_25G_stcs
1063*c1d14583SBruce Richardson (struct ipn3ke_hw *hw, uint32_t mac_num, uint32_t eth_group_sel)
1064*c1d14583SBruce Richardson {
1065*c1d14583SBruce Richardson 	uint32_t tmp = 0x00000001;
1066*c1d14583SBruce Richardson 
1067*c1d14583SBruce Richardson 	/* Bit[0]: Software can set this bit to the value of 1
1068*c1d14583SBruce Richardson 	 * to reset all of the RX statistics registers at the same time.
1069*c1d14583SBruce Richardson 	 * This bit is selfclearing.
1070*c1d14583SBruce Richardson 	 */
1071*c1d14583SBruce Richardson 	(*hw->f_mac_write)(hw,
1072*c1d14583SBruce Richardson 					tmp,
1073*c1d14583SBruce Richardson 					IPN3KE_25G_RX_STATISTICS_CONFIG,
1074*c1d14583SBruce Richardson 					mac_num,
1075*c1d14583SBruce Richardson 					eth_group_sel);
1076*c1d14583SBruce Richardson }
1077*c1d14583SBruce Richardson 
1078*c1d14583SBruce Richardson #endif /* _IPN3KE_ETHDEV_H_ */
1079