xref: /linux/drivers/net/ethernet/marvell/prestera/prestera_hw.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1501ef306SVadym Kochan /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
2501ef306SVadym Kochan /* Copyright (c) 2019-2020 Marvell International Ltd. All rights reserved. */
3501ef306SVadym Kochan 
4501ef306SVadym Kochan #ifndef _PRESTERA_HW_H_
5501ef306SVadym Kochan #define _PRESTERA_HW_H_
6501ef306SVadym Kochan 
7501ef306SVadym Kochan #include <linux/types.h>
847327e19SVolodymyr Mytnyk #include "prestera_acl.h"
9501ef306SVadym Kochan 
10e1189d9aSVadym Kochan enum prestera_accept_frm_type {
11e1189d9aSVadym Kochan 	PRESTERA_ACCEPT_FRAME_TYPE_TAGGED,
12e1189d9aSVadym Kochan 	PRESTERA_ACCEPT_FRAME_TYPE_UNTAGGED,
13e1189d9aSVadym Kochan 	PRESTERA_ACCEPT_FRAME_TYPE_ALL,
14e1189d9aSVadym Kochan };
15e1189d9aSVadym Kochan 
16e1189d9aSVadym Kochan enum prestera_fdb_flush_mode {
17e1189d9aSVadym Kochan 	PRESTERA_FDB_FLUSH_MODE_DYNAMIC = BIT(0),
18e1189d9aSVadym Kochan 	PRESTERA_FDB_FLUSH_MODE_STATIC = BIT(1),
19e1189d9aSVadym Kochan 	PRESTERA_FDB_FLUSH_MODE_ALL = PRESTERA_FDB_FLUSH_MODE_DYNAMIC
20e1189d9aSVadym Kochan 					| PRESTERA_FDB_FLUSH_MODE_STATIC,
21e1189d9aSVadym Kochan };
22e1189d9aSVadym Kochan 
23501ef306SVadym Kochan enum {
24bb5dbf2cSVolodymyr Mytnyk 	PRESTERA_MAC_MODE_INTERNAL,
25bb5dbf2cSVolodymyr Mytnyk 	PRESTERA_MAC_MODE_SGMII,
26bb5dbf2cSVolodymyr Mytnyk 	PRESTERA_MAC_MODE_1000BASE_X,
27bb5dbf2cSVolodymyr Mytnyk 	PRESTERA_MAC_MODE_KR,
28bb5dbf2cSVolodymyr Mytnyk 	PRESTERA_MAC_MODE_KR2,
29bb5dbf2cSVolodymyr Mytnyk 	PRESTERA_MAC_MODE_KR4,
30bb5dbf2cSVolodymyr Mytnyk 	PRESTERA_MAC_MODE_CR,
31bb5dbf2cSVolodymyr Mytnyk 	PRESTERA_MAC_MODE_CR2,
32bb5dbf2cSVolodymyr Mytnyk 	PRESTERA_MAC_MODE_CR4,
33bb5dbf2cSVolodymyr Mytnyk 	PRESTERA_MAC_MODE_SR_LR,
34bb5dbf2cSVolodymyr Mytnyk 	PRESTERA_MAC_MODE_SR_LR2,
35bb5dbf2cSVolodymyr Mytnyk 	PRESTERA_MAC_MODE_SR_LR4,
36bb5dbf2cSVolodymyr Mytnyk 
37bb5dbf2cSVolodymyr Mytnyk 	PRESTERA_MAC_MODE_MAX
38bb5dbf2cSVolodymyr Mytnyk };
39bb5dbf2cSVolodymyr Mytnyk 
40bb5dbf2cSVolodymyr Mytnyk enum {
41a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_10baseT_Half,
42a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_10baseT_Full,
43a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_100baseT_Half,
44a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_100baseT_Full,
45a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_1000baseT_Half,
46a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_1000baseT_Full,
47a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_1000baseX_Full,
48a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_1000baseKX_Full,
49a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_2500baseX_Full,
50a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_10GbaseKR_Full,
51a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_10GbaseSR_Full,
52a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_10GbaseLR_Full,
53a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_20GbaseKR2_Full,
54a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_25GbaseCR_Full,
55a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_25GbaseKR_Full,
56a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_25GbaseSR_Full,
57a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_40GbaseKR4_Full,
58a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_40GbaseCR4_Full,
59a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_40GbaseSR4_Full,
60a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_50GbaseCR2_Full,
61a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_50GbaseKR2_Full,
62a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_50GbaseSR2_Full,
63a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_100GbaseKR4_Full,
64a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_100GbaseSR4_Full,
65a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_100GbaseCR4_Full,
66a97d3c69SVadym Kochan 
67a97d3c69SVadym Kochan 	PRESTERA_LINK_MODE_MAX
68a97d3c69SVadym Kochan };
69a97d3c69SVadym Kochan 
70a97d3c69SVadym Kochan enum {
71501ef306SVadym Kochan 	PRESTERA_PORT_TYPE_NONE,
72501ef306SVadym Kochan 	PRESTERA_PORT_TYPE_TP,
73a97d3c69SVadym Kochan 	PRESTERA_PORT_TYPE_AUI,
74a97d3c69SVadym Kochan 	PRESTERA_PORT_TYPE_MII,
75a97d3c69SVadym Kochan 	PRESTERA_PORT_TYPE_FIBRE,
76a97d3c69SVadym Kochan 	PRESTERA_PORT_TYPE_BNC,
77a97d3c69SVadym Kochan 	PRESTERA_PORT_TYPE_DA,
78a97d3c69SVadym Kochan 	PRESTERA_PORT_TYPE_OTHER,
79501ef306SVadym Kochan 
80501ef306SVadym Kochan 	PRESTERA_PORT_TYPE_MAX
81501ef306SVadym Kochan };
82501ef306SVadym Kochan 
83501ef306SVadym Kochan enum {
84a97d3c69SVadym Kochan 	PRESTERA_PORT_TCVR_COPPER,
85a97d3c69SVadym Kochan 	PRESTERA_PORT_TCVR_SFP,
86a97d3c69SVadym Kochan 
87a97d3c69SVadym Kochan 	PRESTERA_PORT_TCVR_MAX
88a97d3c69SVadym Kochan };
89a97d3c69SVadym Kochan 
90a97d3c69SVadym Kochan enum {
91501ef306SVadym Kochan 	PRESTERA_PORT_FEC_OFF,
92a97d3c69SVadym Kochan 	PRESTERA_PORT_FEC_BASER,
93a97d3c69SVadym Kochan 	PRESTERA_PORT_FEC_RS,
94501ef306SVadym Kochan 
95501ef306SVadym Kochan 	PRESTERA_PORT_FEC_MAX
96501ef306SVadym Kochan };
97501ef306SVadym Kochan 
98a97d3c69SVadym Kochan enum {
99a97d3c69SVadym Kochan 	PRESTERA_PORT_DUPLEX_HALF,
100a97d3c69SVadym Kochan 	PRESTERA_PORT_DUPLEX_FULL,
101a97d3c69SVadym Kochan };
102a97d3c69SVadym Kochan 
103e1189d9aSVadym Kochan enum {
104e1189d9aSVadym Kochan 	PRESTERA_STP_DISABLED,
105e1189d9aSVadym Kochan 	PRESTERA_STP_BLOCK_LISTEN,
106e1189d9aSVadym Kochan 	PRESTERA_STP_LEARN,
107e1189d9aSVadym Kochan 	PRESTERA_STP_FORWARD,
108e1189d9aSVadym Kochan };
109e1189d9aSVadym Kochan 
110dde2daa0SVolodymyr Mytnyk enum {
111dde2daa0SVolodymyr Mytnyk 	PRESTERA_POLICER_TYPE_INGRESS,
112dde2daa0SVolodymyr Mytnyk 	PRESTERA_POLICER_TYPE_EGRESS
113dde2daa0SVolodymyr Mytnyk };
114dde2daa0SVolodymyr Mytnyk 
115a80cf955SOleksandr Mazur enum prestera_hw_cpu_code_cnt_t {
116a80cf955SOleksandr Mazur 	PRESTERA_HW_CPU_CODE_CNT_TYPE_DROP = 0,
117a80cf955SOleksandr Mazur 	PRESTERA_HW_CPU_CODE_CNT_TYPE_TRAP = 1,
118a80cf955SOleksandr Mazur };
119a80cf955SOleksandr Mazur 
12047327e19SVolodymyr Mytnyk enum prestera_hw_vtcam_direction_t {
12147327e19SVolodymyr Mytnyk 	PRESTERA_HW_VTCAM_DIR_INGRESS = 0,
12247327e19SVolodymyr Mytnyk 	PRESTERA_HW_VTCAM_DIR_EGRESS = 1,
12347327e19SVolodymyr Mytnyk };
12447327e19SVolodymyr Mytnyk 
1256e36c7bcSVolodymyr Mytnyk enum {
126702e7014SMaksym Glubokiy 	PRESTERA_HW_COUNTER_CLIENT_INGRESS_LOOKUP_0 = 0,
127702e7014SMaksym Glubokiy 	PRESTERA_HW_COUNTER_CLIENT_INGRESS_LOOKUP_1 = 1,
128702e7014SMaksym Glubokiy 	PRESTERA_HW_COUNTER_CLIENT_INGRESS_LOOKUP_2 = 2,
129702e7014SMaksym Glubokiy 	PRESTERA_HW_COUNTER_CLIENT_EGRESS_LOOKUP = 3,
1306e36c7bcSVolodymyr Mytnyk };
1316e36c7bcSVolodymyr Mytnyk 
132501ef306SVadym Kochan struct prestera_switch;
133501ef306SVadym Kochan struct prestera_port;
134501ef306SVadym Kochan struct prestera_port_stats;
135501ef306SVadym Kochan struct prestera_port_caps;
136501ef306SVadym Kochan enum prestera_event_type;
137501ef306SVadym Kochan struct prestera_event;
138501ef306SVadym Kochan 
139501ef306SVadym Kochan typedef void (*prestera_event_cb_t)
140501ef306SVadym Kochan 	(struct prestera_switch *sw, struct prestera_event *evt, void *arg);
141501ef306SVadym Kochan 
142501ef306SVadym Kochan struct prestera_rxtx_params;
14347327e19SVolodymyr Mytnyk struct prestera_acl_hw_action_info;
14447327e19SVolodymyr Mytnyk struct prestera_acl_iface;
1456e36c7bcSVolodymyr Mytnyk struct prestera_counter_stats;
1460f07bd6bSYevhen Orlov struct prestera_iface;
147fec7c9c7SOleksandr Mazur struct prestera_flood_domain;
148fec7c9c7SOleksandr Mazur struct prestera_mdb_entry;
149*0a23ae23SYevhen Orlov struct prestera_neigh_info;
150501ef306SVadym Kochan 
151501ef306SVadym Kochan /* Switch API */
152501ef306SVadym Kochan int prestera_hw_switch_init(struct prestera_switch *sw);
153501ef306SVadym Kochan void prestera_hw_switch_fini(struct prestera_switch *sw);
154e1189d9aSVadym Kochan int prestera_hw_switch_ageing_set(struct prestera_switch *sw, u32 ageing_ms);
155501ef306SVadym Kochan int prestera_hw_switch_mac_set(struct prestera_switch *sw, const char *mac);
156501ef306SVadym Kochan 
157501ef306SVadym Kochan /* Port API */
158501ef306SVadym Kochan int prestera_hw_port_info_get(const struct prestera_port *port,
159501ef306SVadym Kochan 			      u32 *dev_id, u32 *hw_id, u16 *fp_id);
160bb5dbf2cSVolodymyr Mytnyk 
161bb5dbf2cSVolodymyr Mytnyk int prestera_hw_port_mac_mode_get(const struct prestera_port *port,
162bb5dbf2cSVolodymyr Mytnyk 				  u32 *mode, u32 *speed, u8 *duplex, u8 *fec);
163bb5dbf2cSVolodymyr Mytnyk int prestera_hw_port_mac_mode_set(const struct prestera_port *port,
164bb5dbf2cSVolodymyr Mytnyk 				  bool admin, u32 mode, u8 inband,
165bb5dbf2cSVolodymyr Mytnyk 				  u32 speed, u8 duplex, u8 fec);
166bb5dbf2cSVolodymyr Mytnyk int prestera_hw_port_phy_mode_get(const struct prestera_port *port,
167bb5dbf2cSVolodymyr Mytnyk 				  u8 *mdix, u64 *lmode_bmap,
168bb5dbf2cSVolodymyr Mytnyk 				  bool *fc_pause, bool *fc_asym);
169bb5dbf2cSVolodymyr Mytnyk int prestera_hw_port_phy_mode_set(const struct prestera_port *port,
170bb5dbf2cSVolodymyr Mytnyk 				  bool admin, bool adv, u32 mode, u64 modes,
171bb5dbf2cSVolodymyr Mytnyk 				  u8 mdix);
172bb5dbf2cSVolodymyr Mytnyk 
173501ef306SVadym Kochan int prestera_hw_port_mtu_set(const struct prestera_port *port, u32 mtu);
174501ef306SVadym Kochan int prestera_hw_port_mtu_get(const struct prestera_port *port, u32 *mtu);
175501ef306SVadym Kochan int prestera_hw_port_mac_set(const struct prestera_port *port, const char *mac);
176501ef306SVadym Kochan int prestera_hw_port_mac_get(const struct prestera_port *port, char *mac);
177501ef306SVadym Kochan int prestera_hw_port_cap_get(const struct prestera_port *port,
178501ef306SVadym Kochan 			     struct prestera_port_caps *caps);
179a97d3c69SVadym Kochan int prestera_hw_port_type_get(const struct prestera_port *port, u8 *type);
180a97d3c69SVadym Kochan int prestera_hw_port_autoneg_restart(struct prestera_port *port);
181501ef306SVadym Kochan int prestera_hw_port_stats_get(const struct prestera_port *port,
182501ef306SVadym Kochan 			       struct prestera_port_stats *stats);
183a97d3c69SVadym Kochan int prestera_hw_port_speed_get(const struct prestera_port *port, u32 *speed);
184e1189d9aSVadym Kochan int prestera_hw_port_learning_set(struct prestera_port *port, bool enable);
185116f5af7SOleksandr Mazur int prestera_hw_port_uc_flood_set(const struct prestera_port *port, bool flood);
186116f5af7SOleksandr Mazur int prestera_hw_port_mc_flood_set(const struct prestera_port *port, bool flood);
18773ef239cSOleksandr Mazur int prestera_hw_port_br_locked_set(const struct prestera_port *port,
18873ef239cSOleksandr Mazur 				   bool br_locked);
189e1189d9aSVadym Kochan int prestera_hw_port_accept_frm_type(struct prestera_port *port,
190e1189d9aSVadym Kochan 				     enum prestera_accept_frm_type type);
191e1189d9aSVadym Kochan /* Vlan API */
192e1189d9aSVadym Kochan int prestera_hw_vlan_create(struct prestera_switch *sw, u16 vid);
193e1189d9aSVadym Kochan int prestera_hw_vlan_delete(struct prestera_switch *sw, u16 vid);
194e1189d9aSVadym Kochan int prestera_hw_vlan_port_set(struct prestera_port *port, u16 vid,
195e1189d9aSVadym Kochan 			      bool is_member, bool untagged);
196e1189d9aSVadym Kochan int prestera_hw_vlan_port_vid_set(struct prestera_port *port, u16 vid);
197e1189d9aSVadym Kochan int prestera_hw_vlan_port_stp_set(struct prestera_port *port, u16 vid, u8 state);
198e1189d9aSVadym Kochan 
199e1189d9aSVadym Kochan /* FDB API */
200e1189d9aSVadym Kochan int prestera_hw_fdb_add(struct prestera_port *port, const unsigned char *mac,
201e1189d9aSVadym Kochan 			u16 vid, bool dynamic);
202e1189d9aSVadym Kochan int prestera_hw_fdb_del(struct prestera_port *port, const unsigned char *mac,
203e1189d9aSVadym Kochan 			u16 vid);
204e1189d9aSVadym Kochan int prestera_hw_fdb_flush_port(struct prestera_port *port, u32 mode);
205e1189d9aSVadym Kochan int prestera_hw_fdb_flush_vlan(struct prestera_switch *sw, u16 vid, u32 mode);
206e1189d9aSVadym Kochan int prestera_hw_fdb_flush_port_vlan(struct prestera_port *port, u16 vid,
207e1189d9aSVadym Kochan 				    u32 mode);
208e1189d9aSVadym Kochan 
209e1189d9aSVadym Kochan /* Bridge API */
210e1189d9aSVadym Kochan int prestera_hw_bridge_create(struct prestera_switch *sw, u16 *bridge_id);
211e1189d9aSVadym Kochan int prestera_hw_bridge_delete(struct prestera_switch *sw, u16 bridge_id);
212e1189d9aSVadym Kochan int prestera_hw_bridge_port_add(struct prestera_port *port, u16 bridge_id);
213e1189d9aSVadym Kochan int prestera_hw_bridge_port_delete(struct prestera_port *port, u16 bridge_id);
214501ef306SVadym Kochan 
21547327e19SVolodymyr Mytnyk /* vTCAM API */
21647327e19SVolodymyr Mytnyk int prestera_hw_vtcam_create(struct prestera_switch *sw,
21747327e19SVolodymyr Mytnyk 			     u8 lookup, const u32 *keymask, u32 *vtcam_id,
21847327e19SVolodymyr Mytnyk 			     enum prestera_hw_vtcam_direction_t direction);
21947327e19SVolodymyr Mytnyk int prestera_hw_vtcam_rule_add(struct prestera_switch *sw, u32 vtcam_id,
22047327e19SVolodymyr Mytnyk 			       u32 prio, void *key, void *keymask,
22147327e19SVolodymyr Mytnyk 			       struct prestera_acl_hw_action_info *act,
22247327e19SVolodymyr Mytnyk 			       u8 n_act, u32 *rule_id);
22347327e19SVolodymyr Mytnyk int prestera_hw_vtcam_rule_del(struct prestera_switch *sw,
22447327e19SVolodymyr Mytnyk 			       u32 vtcam_id, u32 rule_id);
22547327e19SVolodymyr Mytnyk int prestera_hw_vtcam_destroy(struct prestera_switch *sw, u32 vtcam_id);
22647327e19SVolodymyr Mytnyk int prestera_hw_vtcam_iface_bind(struct prestera_switch *sw,
22747327e19SVolodymyr Mytnyk 				 struct prestera_acl_iface *iface,
22847327e19SVolodymyr Mytnyk 				 u32 vtcam_id, u16 pcl_id);
22947327e19SVolodymyr Mytnyk int prestera_hw_vtcam_iface_unbind(struct prestera_switch *sw,
23047327e19SVolodymyr Mytnyk 				   struct prestera_acl_iface *iface,
23147327e19SVolodymyr Mytnyk 				   u32 vtcam_id);
2328b474a9fSSerhiy Boiko 
2336e36c7bcSVolodymyr Mytnyk /* Counter API */
2346e36c7bcSVolodymyr Mytnyk int prestera_hw_counter_trigger(struct prestera_switch *sw, u32 block_id);
2356e36c7bcSVolodymyr Mytnyk int prestera_hw_counter_abort(struct prestera_switch *sw);
2366e36c7bcSVolodymyr Mytnyk int prestera_hw_counters_get(struct prestera_switch *sw, u32 idx,
2376e36c7bcSVolodymyr Mytnyk 			     u32 *len, bool *done,
2386e36c7bcSVolodymyr Mytnyk 			     struct prestera_counter_stats *stats);
2396e36c7bcSVolodymyr Mytnyk int prestera_hw_counter_block_get(struct prestera_switch *sw,
2406e36c7bcSVolodymyr Mytnyk 				  u32 client, u32 *block_id, u32 *offset,
2416e36c7bcSVolodymyr Mytnyk 				  u32 *num_counters);
2426e36c7bcSVolodymyr Mytnyk int prestera_hw_counter_block_release(struct prestera_switch *sw,
2436e36c7bcSVolodymyr Mytnyk 				      u32 block_id);
2446e36c7bcSVolodymyr Mytnyk int prestera_hw_counter_clear(struct prestera_switch *sw, u32 block_id,
2456e36c7bcSVolodymyr Mytnyk 			      u32 counter_id);
2466e36c7bcSVolodymyr Mytnyk 
24713defa27SSerhiy Boiko /* SPAN API */
24813defa27SSerhiy Boiko int prestera_hw_span_get(const struct prestera_port *port, u8 *span_id);
2498c448c2bSSerhiy Boiko int prestera_hw_span_bind(const struct prestera_port *port, u8 span_id,
2508c448c2bSSerhiy Boiko 			  bool ingress);
2518c448c2bSSerhiy Boiko int prestera_hw_span_unbind(const struct prestera_port *port, bool ingress);
25213defa27SSerhiy Boiko int prestera_hw_span_release(struct prestera_switch *sw, u8 span_id);
25313defa27SSerhiy Boiko 
2540f07bd6bSYevhen Orlov /* Router API */
2550f07bd6bSYevhen Orlov int prestera_hw_rif_create(struct prestera_switch *sw,
2560f07bd6bSYevhen Orlov 			   struct prestera_iface *iif, u8 *mac, u16 *rif_id);
2570f07bd6bSYevhen Orlov int prestera_hw_rif_delete(struct prestera_switch *sw, u16 rif_id,
2580f07bd6bSYevhen Orlov 			   struct prestera_iface *iif);
2590f07bd6bSYevhen Orlov 
2606d1b3eb5SYevhen Orlov /* Virtual Router API */
2616d1b3eb5SYevhen Orlov int prestera_hw_vr_create(struct prestera_switch *sw, u16 *vr_id);
2626d1b3eb5SYevhen Orlov int prestera_hw_vr_delete(struct prestera_switch *sw, u16 vr_id);
2636d1b3eb5SYevhen Orlov 
26419787b93SYevhen Orlov /* LPM PI */
26519787b93SYevhen Orlov int prestera_hw_lpm_add(struct prestera_switch *sw, u16 vr_id,
26619787b93SYevhen Orlov 			__be32 dst, u32 dst_len, u32 grp_id);
26719787b93SYevhen Orlov int prestera_hw_lpm_del(struct prestera_switch *sw, u16 vr_id,
26819787b93SYevhen Orlov 			__be32 dst, u32 dst_len);
26919787b93SYevhen Orlov 
270*0a23ae23SYevhen Orlov /* NH API */
271*0a23ae23SYevhen Orlov int prestera_hw_nh_entries_set(struct prestera_switch *sw, int count,
272*0a23ae23SYevhen Orlov 			       struct prestera_neigh_info *nhs, u32 grp_id);
273*0a23ae23SYevhen Orlov int prestera_hw_nhgrp_blk_get(struct prestera_switch *sw,
274*0a23ae23SYevhen Orlov 			      u8 *hw_state, u32 buf_size /* Buffer in bytes */);
275*0a23ae23SYevhen Orlov int prestera_hw_nh_group_create(struct prestera_switch *sw, u16 nh_count,
276*0a23ae23SYevhen Orlov 				u32 *grp_id);
277*0a23ae23SYevhen Orlov int prestera_hw_nh_group_delete(struct prestera_switch *sw, u16 nh_count,
278*0a23ae23SYevhen Orlov 				u32 grp_id);
279*0a23ae23SYevhen Orlov 
280501ef306SVadym Kochan /* Event handlers */
281501ef306SVadym Kochan int prestera_hw_event_handler_register(struct prestera_switch *sw,
282501ef306SVadym Kochan 				       enum prestera_event_type type,
283501ef306SVadym Kochan 				       prestera_event_cb_t fn,
284501ef306SVadym Kochan 				       void *arg);
285501ef306SVadym Kochan void prestera_hw_event_handler_unregister(struct prestera_switch *sw,
286501ef306SVadym Kochan 					  enum prestera_event_type type,
287501ef306SVadym Kochan 					  prestera_event_cb_t fn);
288501ef306SVadym Kochan 
289501ef306SVadym Kochan /* RX/TX */
290501ef306SVadym Kochan int prestera_hw_rxtx_init(struct prestera_switch *sw,
291501ef306SVadym Kochan 			  struct prestera_rxtx_params *params);
292501ef306SVadym Kochan 
293255213caSSerhiy Boiko /* LAG API */
294255213caSSerhiy Boiko int prestera_hw_lag_member_add(struct prestera_port *port, u16 lag_id);
295255213caSSerhiy Boiko int prestera_hw_lag_member_del(struct prestera_port *port, u16 lag_id);
296255213caSSerhiy Boiko int prestera_hw_lag_member_enable(struct prestera_port *port, u16 lag_id,
297255213caSSerhiy Boiko 				  bool enable);
298255213caSSerhiy Boiko int prestera_hw_lag_fdb_add(struct prestera_switch *sw, u16 lag_id,
299255213caSSerhiy Boiko 			    const unsigned char *mac, u16 vid, bool dynamic);
300255213caSSerhiy Boiko int prestera_hw_lag_fdb_del(struct prestera_switch *sw, u16 lag_id,
301255213caSSerhiy Boiko 			    const unsigned char *mac, u16 vid);
302255213caSSerhiy Boiko int prestera_hw_fdb_flush_lag(struct prestera_switch *sw, u16 lag_id,
303255213caSSerhiy Boiko 			      u32 mode);
304255213caSSerhiy Boiko int prestera_hw_fdb_flush_lag_vlan(struct prestera_switch *sw,
305255213caSSerhiy Boiko 				   u16 lag_id, u16 vid, u32 mode);
306255213caSSerhiy Boiko 
307a80cf955SOleksandr Mazur /* HW trap/drop counters API */
308a80cf955SOleksandr Mazur int
309a80cf955SOleksandr Mazur prestera_hw_cpu_code_counters_get(struct prestera_switch *sw, u8 code,
310a80cf955SOleksandr Mazur 				  enum prestera_hw_cpu_code_cnt_t counter_type,
311a80cf955SOleksandr Mazur 				  u64 *packet_count);
312a80cf955SOleksandr Mazur 
313dde2daa0SVolodymyr Mytnyk /* Policer API */
314dde2daa0SVolodymyr Mytnyk int prestera_hw_policer_create(struct prestera_switch *sw, u8 type,
315dde2daa0SVolodymyr Mytnyk 			       u32 *policer_id);
316dde2daa0SVolodymyr Mytnyk int prestera_hw_policer_release(struct prestera_switch *sw,
317dde2daa0SVolodymyr Mytnyk 				u32 policer_id);
318dde2daa0SVolodymyr Mytnyk int prestera_hw_policer_sr_tcm_set(struct prestera_switch *sw,
319dde2daa0SVolodymyr Mytnyk 				   u32 policer_id, u64 cir, u32 cbs);
320dde2daa0SVolodymyr Mytnyk 
321fec7c9c7SOleksandr Mazur /* Flood domain / MDB API */
322fec7c9c7SOleksandr Mazur int prestera_hw_flood_domain_create(struct prestera_flood_domain *domain);
323fec7c9c7SOleksandr Mazur int prestera_hw_flood_domain_destroy(struct prestera_flood_domain *domain);
324fec7c9c7SOleksandr Mazur int prestera_hw_flood_domain_ports_set(struct prestera_flood_domain *domain);
325fec7c9c7SOleksandr Mazur int prestera_hw_flood_domain_ports_reset(struct prestera_flood_domain *domain);
326fec7c9c7SOleksandr Mazur 
327fec7c9c7SOleksandr Mazur int prestera_hw_mdb_create(struct prestera_mdb_entry *mdb);
328fec7c9c7SOleksandr Mazur int prestera_hw_mdb_destroy(struct prestera_mdb_entry *mdb);
329fec7c9c7SOleksandr Mazur 
330501ef306SVadym Kochan #endif /* _PRESTERA_HW_H_ */
331