1/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
2/* Copyright (c) 2015-2018 Mellanox Technologies. All rights reserved */
3
4#ifndef _MLXSW_SPECTRUM_H
5#define _MLXSW_SPECTRUM_H
6
7#include <linux/types.h>
8#include <linux/netdevice.h>
9#include <linux/rhashtable.h>
10#include <linux/bitops.h>
11#include <linux/if_bridge.h>
12#include <linux/if_vlan.h>
13#include <linux/list.h>
14#include <linux/dcbnl.h>
15#include <linux/in6.h>
16#include <linux/notifier.h>
17#include <net/psample.h>
18#include <net/pkt_cls.h>
19#include <net/red.h>
20#include <net/vxlan.h>
21
22#include "port.h"
23#include "core.h"
24#include "core_acl_flex_keys.h"
25#include "core_acl_flex_actions.h"
26#include "reg.h"
27
28#define MLXSW_SP_DEFAULT_VID (VLAN_N_VID - 1)
29
30#define MLXSW_SP_FID_8021D_MAX 1024
31
32#define MLXSW_SP_MID_MAX 7000
33
34#define MLXSW_SP_PORTS_PER_CLUSTER_MAX 4
35
36#define MLXSW_SP_PORT_BASE_SPEED_25G 25000 /* Mb/s */
37#define MLXSW_SP_PORT_BASE_SPEED_50G 50000 /* Mb/s */
38
39#define MLXSW_SP_KVD_LINEAR_SIZE 98304 /* entries */
40#define MLXSW_SP_KVD_GRANULARITY 128
41
42#define MLXSW_SP_RESOURCE_NAME_KVD "kvd"
43#define MLXSW_SP_RESOURCE_NAME_KVD_LINEAR "linear"
44#define MLXSW_SP_RESOURCE_NAME_KVD_HASH_SINGLE "hash_single"
45#define MLXSW_SP_RESOURCE_NAME_KVD_HASH_DOUBLE "hash_double"
46#define MLXSW_SP_RESOURCE_NAME_KVD_LINEAR_SINGLES "singles"
47#define MLXSW_SP_RESOURCE_NAME_KVD_LINEAR_CHUNKS "chunks"
48#define MLXSW_SP_RESOURCE_NAME_KVD_LINEAR_LARGE_CHUNKS "large_chunks"
49
50enum mlxsw_sp_resource_id {
51 MLXSW_SP_RESOURCE_KVD = 1,
52 MLXSW_SP_RESOURCE_KVD_LINEAR,
53 MLXSW_SP_RESOURCE_KVD_HASH_SINGLE,
54 MLXSW_SP_RESOURCE_KVD_HASH_DOUBLE,
55 MLXSW_SP_RESOURCE_KVD_LINEAR_SINGLE,
56 MLXSW_SP_RESOURCE_KVD_LINEAR_CHUNKS,
57 MLXSW_SP_RESOURCE_KVD_LINEAR_LARGE_CHUNKS,
58};
59
60struct mlxsw_sp_port;
61struct mlxsw_sp_rif;
62struct mlxsw_sp_span_entry;
63enum mlxsw_sp_l3proto;
64union mlxsw_sp_l3addr;
65
66struct mlxsw_sp_upper {
67 struct net_device *dev;
68 unsigned int ref_count;
69};
70
71enum mlxsw_sp_rif_type {
72 MLXSW_SP_RIF_TYPE_SUBPORT,
73 MLXSW_SP_RIF_TYPE_VLAN,
74 MLXSW_SP_RIF_TYPE_FID,
75 MLXSW_SP_RIF_TYPE_IPIP_LB, /* IP-in-IP loopback. */
76 MLXSW_SP_RIF_TYPE_MAX,
77};
78
79struct mlxsw_sp_rif_ops;
80
81extern const struct mlxsw_sp_rif_ops *mlxsw_sp1_rif_ops_arr[];
82extern const struct mlxsw_sp_rif_ops *mlxsw_sp2_rif_ops_arr[];
83
84enum mlxsw_sp_fid_type {
85 MLXSW_SP_FID_TYPE_8021Q,
86 MLXSW_SP_FID_TYPE_8021D,
87 MLXSW_SP_FID_TYPE_RFID,
88 MLXSW_SP_FID_TYPE_DUMMY,
89 MLXSW_SP_FID_TYPE_MAX,
90};
91
92enum mlxsw_sp_nve_type {
93 MLXSW_SP_NVE_TYPE_VXLAN,
94};
95
96struct mlxsw_sp_mid {
97 struct list_head list;
98 unsigned char addr[ETH_ALEN];
99 u16 fid;
100 u16 mid;
101 bool in_hw;
102 unsigned long *ports_in_mid; /* bits array */
103};
104
105enum mlxsw_sp_port_mall_action_type {
106 MLXSW_SP_PORT_MALL_MIRROR,
107 MLXSW_SP_PORT_MALL_SAMPLE,
108};
109
110struct mlxsw_sp_port_mall_mirror_tc_entry {
111 int span_id;
112 bool ingress;
113};
114
115struct mlxsw_sp_port_mall_tc_entry {
116 struct list_head list;
117 unsigned long cookie;
118 enum mlxsw_sp_port_mall_action_type type;
119 union {
120 struct mlxsw_sp_port_mall_mirror_tc_entry mirror;
121 };
122};
123
124struct mlxsw_sp_sb;
125struct mlxsw_sp_bridge;
126struct mlxsw_sp_router;
127struct mlxsw_sp_mr;
128struct mlxsw_sp_acl;
129struct mlxsw_sp_counter_pool;
130struct mlxsw_sp_fid_core;
131struct mlxsw_sp_kvdl;
132struct mlxsw_sp_nve;
133struct mlxsw_sp_kvdl_ops;
134struct mlxsw_sp_mr_tcam_ops;
135struct mlxsw_sp_acl_tcam_ops;
136struct mlxsw_sp_nve_ops;
137struct mlxsw_sp_sb_vals;
138struct mlxsw_sp_port_type_speed_ops;
139
140struct mlxsw_sp {
141 struct mlxsw_sp_port **ports;
142 struct mlxsw_core *core;
143 const struct mlxsw_bus_info *bus_info;
144 unsigned char base_mac[ETH_ALEN];
145 const unsigned char *mac_mask;
146 struct mlxsw_sp_upper *lags;
147 int *port_to_module;
148 struct mlxsw_sp_sb *sb;
149 struct mlxsw_sp_bridge *bridge;
150 struct mlxsw_sp_router *router;
151 struct mlxsw_sp_mr *mr;
152 struct mlxsw_afa *afa;
153 struct mlxsw_sp_acl *acl;
154 struct mlxsw_sp_fid_core *fid_core;
155 struct mlxsw_sp_kvdl *kvdl;
156 struct mlxsw_sp_nve *nve;
157 struct notifier_block netdevice_nb;
158
159 struct mlxsw_sp_counter_pool *counter_pool;
160 struct {
161 struct mlxsw_sp_span_entry *entries;
162 int entries_count;
163 } span;
164 const struct mlxsw_fw_rev *req_rev;
165 const char *fw_filename;
166 const struct mlxsw_sp_kvdl_ops *kvdl_ops;
167 const struct mlxsw_afa_ops *afa_ops;
168 const struct mlxsw_afk_ops *afk_ops;
169 const struct mlxsw_sp_mr_tcam_ops *mr_tcam_ops;
170 const struct mlxsw_sp_acl_tcam_ops *acl_tcam_ops;
171 const struct mlxsw_sp_nve_ops **nve_ops_arr;
172 const struct mlxsw_sp_rif_ops **rif_ops_arr;
173 const struct mlxsw_sp_sb_vals *sb_vals;
174 const struct mlxsw_sp_port_type_speed_ops *port_type_speed_ops;
175};
176
177static inline struct mlxsw_sp_upper *
178mlxsw_sp_lag_get(struct mlxsw_sp *mlxsw_sp, u16 lag_id)
179{
180 return &mlxsw_sp->lags[lag_id];
181}
182
183struct mlxsw_sp_port_pcpu_stats {
184 u64 rx_packets;
185 u64 rx_bytes;
186 u64 tx_packets;
187 u64 tx_bytes;
188 struct u64_stats_sync syncp;
189 u32 tx_dropped;
190};
191
192struct mlxsw_sp_port_sample {
193 struct psample_group __rcu *psample_group;
194 u32 trunc_size;
195 u32 rate;
196 bool truncate;
197};
198
199struct mlxsw_sp_bridge_port;
200struct mlxsw_sp_fid;
201
202struct mlxsw_sp_port_vlan {
203 struct list_head list;
204 struct mlxsw_sp_port *mlxsw_sp_port;
205 struct mlxsw_sp_fid *fid;
206 u16 vid;
207 struct mlxsw_sp_bridge_port *bridge_port;
208 struct list_head bridge_vlan_node;
209};
210
211/* No need an internal lock; At worse - miss a single periodic iteration */
212struct mlxsw_sp_port_xstats {
213 u64 ecn;
214 u64 wred_drop[TC_MAX_QUEUE];
215 u64 tail_drop[TC_MAX_QUEUE];
216 u64 backlog[TC_MAX_QUEUE];
217 u64 tx_bytes[IEEE_8021QAZ_MAX_TCS];
218 u64 tx_packets[IEEE_8021QAZ_MAX_TCS];
219};
220
221struct mlxsw_sp_port {
222 struct net_device *dev;
223 struct mlxsw_sp_port_pcpu_stats __percpu *pcpu_stats;
224 struct mlxsw_sp *mlxsw_sp;
225 u8 local_port;
226 u8 lagged:1,
227 split:1;
228 u16 pvid;
229 u16 lag_id;
230 struct {
231 u8 tx_pause:1,
232 rx_pause:1,
233 autoneg:1;
234 } link;
235 struct {
236 struct ieee_ets *ets;
237 struct ieee_maxrate *maxrate;
238 struct ieee_pfc *pfc;
239 enum mlxsw_reg_qpts_trust_state trust_state;
240 } dcb;
241 struct {
242 u8 module;
243 u8 width;
244 u8 lane;
245 } mapping;
246 /* TC handles */
247 struct list_head mall_tc_list;
248 struct {
249 #define MLXSW_HW_STATS_UPDATE_TIME HZ
250 struct rtnl_link_stats64 stats;
251 struct mlxsw_sp_port_xstats xstats;
252 struct delayed_work update_dw;
253 } periodic_hw_stats;
254 struct mlxsw_sp_port_sample *sample;
255 struct list_head vlans_list;
256 struct mlxsw_sp_port_vlan *default_vlan;
257 struct mlxsw_sp_qdisc *root_qdisc;
258 struct mlxsw_sp_qdisc *tclass_qdiscs;
259 unsigned acl_rule_count;
260 struct mlxsw_sp_acl_block *ing_acl_block;
261 struct mlxsw_sp_acl_block *eg_acl_block;
262};
263
264struct mlxsw_sp_port_type_speed_ops {
265 void (*from_ptys_supported_port)(struct mlxsw_sp *mlxsw_sp,
266 u32 ptys_eth_proto,
267 struct ethtool_link_ksettings *cmd);
268 void (*from_ptys_link)(struct mlxsw_sp *mlxsw_sp, u32 ptys_eth_proto,
269 unsigned long *mode);
270 void (*from_ptys_speed_duplex)(struct mlxsw_sp *mlxsw_sp,
271 bool carrier_ok, u32 ptys_eth_proto,
272 struct ethtool_link_ksettings *cmd);
273 u32 (*to_ptys_advert_link)(struct mlxsw_sp *mlxsw_sp,
274 const struct ethtool_link_ksettings *cmd);
275 u32 (*to_ptys_speed)(struct mlxsw_sp *mlxsw_sp, u32 speed);
276 u32 (*to_ptys_upper_speed)(struct mlxsw_sp *mlxsw_sp, u32 upper_speed);
277 int (*port_speed_base)(struct mlxsw_sp *mlxsw_sp, u8 local_port,
278 u32 *base_speed);
279 void (*reg_ptys_eth_pack)(struct mlxsw_sp *mlxsw_sp, char *payload,
280 u8 local_port, u32 proto_admin, bool autoneg);
281 void (*reg_ptys_eth_unpack)(struct mlxsw_sp *mlxsw_sp, char *payload,
282 u32 *p_eth_proto_cap,
283 u32 *p_eth_proto_admin,
284 u32 *p_eth_proto_oper);
285};
286
287static inline struct net_device *
288mlxsw_sp_bridge_vxlan_dev_find(struct net_device *br_dev)
289{
290 struct net_device *dev;
291 struct list_head *iter;
292
293 netdev_for_each_lower_dev(br_dev, dev, iter) {
294 if (netif_is_vxlan(dev))
295 return dev;
296 }
297
298 return NULL;
299}
300
301static inline bool mlxsw_sp_bridge_has_vxlan(struct net_device *br_dev)
302{
303 return !!mlxsw_sp_bridge_vxlan_dev_find(br_dev);
304}
305
306static inline int
307mlxsw_sp_vxlan_mapped_vid(const struct net_device *vxlan_dev, u16 *p_vid)
308{
309 struct bridge_vlan_info vinfo;
310 u16 vid = 0;
311 int err;
312
313 err = br_vlan_get_pvid(vxlan_dev, &vid);
314 if (err || !vid)
315 goto out;
316
317 err = br_vlan_get_info(vxlan_dev, vid, &vinfo);
318 if (err || !(vinfo.flags & BRIDGE_VLAN_INFO_UNTAGGED))
319 vid = 0;
320
321out:
322 *p_vid = vid;
323 return err;
324}
325
326static inline bool
327mlxsw_sp_port_is_pause_en(const struct mlxsw_sp_port *mlxsw_sp_port)
328{
329 return mlxsw_sp_port->link.tx_pause || mlxsw_sp_port->link.rx_pause;
330}
331
332static inline struct mlxsw_sp_port *
333mlxsw_sp_port_lagged_get(struct mlxsw_sp *mlxsw_sp, u16 lag_id, u8 port_index)
334{
335 struct mlxsw_sp_port *mlxsw_sp_port;
336 u8 local_port;
337
338 local_port = mlxsw_core_lag_mapping_get(mlxsw_sp->core,
339 lag_id, port_index);
340 mlxsw_sp_port = mlxsw_sp->ports[local_port];
341 return mlxsw_sp_port && mlxsw_sp_port->lagged ? mlxsw_sp_port : NULL;
342}
343
344static inline struct mlxsw_sp_port_vlan *
345mlxsw_sp_port_vlan_find_by_vid(const struct mlxsw_sp_port *mlxsw_sp_port,
346 u16 vid)
347{
348 struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
349
350 list_for_each_entry(mlxsw_sp_port_vlan, &mlxsw_sp_port->vlans_list,
351 list) {
352 if (mlxsw_sp_port_vlan->vid == vid)
353 return mlxsw_sp_port_vlan;
354 }
355
356 return NULL;
357}
358
359enum mlxsw_sp_flood_type {
360 MLXSW_SP_FLOOD_TYPE_UC,
361 MLXSW_SP_FLOOD_TYPE_BC,
362 MLXSW_SP_FLOOD_TYPE_MC,
363};
364
365/* spectrum_buffers.c */
366int mlxsw_sp_buffers_init(struct mlxsw_sp *mlxsw_sp);
367void mlxsw_sp_buffers_fini(struct mlxsw_sp *mlxsw_sp);
368int mlxsw_sp_port_buffers_init(struct mlxsw_sp_port *mlxsw_sp_port);
369int mlxsw_sp_sb_pool_get(struct mlxsw_core *mlxsw_core,
370 unsigned int sb_index, u16 pool_index,
371 struct devlink_sb_pool_info *pool_info);
372int mlxsw_sp_sb_pool_set(struct mlxsw_core *mlxsw_core,
373 unsigned int sb_index, u16 pool_index, u32 size,
374 enum devlink_sb_threshold_type threshold_type);
375int mlxsw_sp_sb_port_pool_get(struct mlxsw_core_port *mlxsw_core_port,
376 unsigned int sb_index, u16 pool_index,
377 u32 *p_threshold);
378int mlxsw_sp_sb_port_pool_set(struct mlxsw_core_port *mlxsw_core_port,
379 unsigned int sb_index, u16 pool_index,
380 u32 threshold);
381int mlxsw_sp_sb_tc_pool_bind_get(struct mlxsw_core_port *mlxsw_core_port,
382 unsigned int sb_index, u16 tc_index,
383 enum devlink_sb_pool_type pool_type,
384 u16 *p_pool_index, u32 *p_threshold);
385int mlxsw_sp_sb_tc_pool_bind_set(struct mlxsw_core_port *mlxsw_core_port,
386 unsigned int sb_index, u16 tc_index,
387 enum devlink_sb_pool_type pool_type,
388 u16 pool_index, u32 threshold);
389int mlxsw_sp_sb_occ_snapshot(struct mlxsw_core *mlxsw_core,
390 unsigned int sb_index);
391int mlxsw_sp_sb_occ_max_clear(struct mlxsw_core *mlxsw_core,
392 unsigned int sb_index);
393int mlxsw_sp_sb_occ_port_pool_get(struct mlxsw_core_port *mlxsw_core_port,
394 unsigned int sb_index, u16 pool_index,
395 u32 *p_cur, u32 *p_max);
396int mlxsw_sp_sb_occ_tc_port_bind_get(struct mlxsw_core_port *mlxsw_core_port,
397 unsigned int sb_index, u16 tc_index,
398 enum devlink_sb_pool_type pool_type,
399 u32 *p_cur, u32 *p_max);
400u32 mlxsw_sp_cells_bytes(const struct mlxsw_sp *mlxsw_sp, u32 cells);
401u32 mlxsw_sp_bytes_cells(const struct mlxsw_sp *mlxsw_sp, u32 bytes);
402u32 mlxsw_sp_sb_max_headroom_cells(const struct mlxsw_sp *mlxsw_sp);
403
404extern const struct mlxsw_sp_sb_vals mlxsw_sp1_sb_vals;
405extern const struct mlxsw_sp_sb_vals mlxsw_sp2_sb_vals;
406
407/* spectrum_switchdev.c */
408int mlxsw_sp_switchdev_init(struct mlxsw_sp *mlxsw_sp);
409void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp);
410int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid,
411 bool adding);
412void
413mlxsw_sp_port_vlan_bridge_leave(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan);
414int mlxsw_sp_port_bridge_join(struct mlxsw_sp_port *mlxsw_sp_port,
415 struct net_device *brport_dev,
416 struct net_device *br_dev,
417 struct netlink_ext_ack *extack);
418void mlxsw_sp_port_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_port,
419 struct net_device *brport_dev,
420 struct net_device *br_dev);
421bool mlxsw_sp_bridge_device_is_offloaded(const struct mlxsw_sp *mlxsw_sp,
422 const struct net_device *br_dev);
423int mlxsw_sp_bridge_vxlan_join(struct mlxsw_sp *mlxsw_sp,
424 const struct net_device *br_dev,
425 const struct net_device *vxlan_dev, u16 vid,
426 struct netlink_ext_ack *extack);
427void mlxsw_sp_bridge_vxlan_leave(struct mlxsw_sp *mlxsw_sp,
428 const struct net_device *vxlan_dev);
429struct mlxsw_sp_fid *mlxsw_sp_bridge_fid_get(struct mlxsw_sp *mlxsw_sp,
430 const struct net_device *br_dev,
431 u16 vid,
432 struct netlink_ext_ack *extack);
433extern struct notifier_block mlxsw_sp_switchdev_notifier;
434
435/* spectrum.c */
436int mlxsw_sp_port_ets_set(struct mlxsw_sp_port *mlxsw_sp_port,
437 enum mlxsw_reg_qeec_hr hr, u8 index, u8 next_index,
438 bool dwrr, u8 dwrr_weight);
439int mlxsw_sp_port_prio_tc_set(struct mlxsw_sp_port *mlxsw_sp_port,
440 u8 switch_prio, u8 tclass);
441int __mlxsw_sp_port_headroom_set(struct mlxsw_sp_port *mlxsw_sp_port, int mtu,
442 u8 *prio_tc, bool pause_en,
443 struct ieee_pfc *my_pfc);
444int mlxsw_sp_port_ets_maxrate_set(struct mlxsw_sp_port *mlxsw_sp_port,
445 enum mlxsw_reg_qeec_hr hr, u8 index,
446 u8 next_index, u32 maxrate);
447enum mlxsw_reg_spms_state mlxsw_sp_stp_spms_state(u8 stp_state);
448int mlxsw_sp_port_vid_stp_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid,
449 u8 state);
450int mlxsw_sp_port_vp_mode_set(struct mlxsw_sp_port *mlxsw_sp_port, bool enable);
451int mlxsw_sp_port_vid_learning_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid,
452 bool learn_enable);
453int mlxsw_sp_port_pvid_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid);
454struct mlxsw_sp_port_vlan *
455mlxsw_sp_port_vlan_create(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid);
456void mlxsw_sp_port_vlan_destroy(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan);
457int mlxsw_sp_port_vlan_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid_begin,
458 u16 vid_end, bool is_member, bool untagged);
459int mlxsw_sp_flow_counter_get(struct mlxsw_sp *mlxsw_sp,
460 unsigned int counter_index, u64 *packets,
461 u64 *bytes);
462int mlxsw_sp_flow_counter_alloc(struct mlxsw_sp *mlxsw_sp,
463 unsigned int *p_counter_index);
464void mlxsw_sp_flow_counter_free(struct mlxsw_sp *mlxsw_sp,
465 unsigned int counter_index);
466bool mlxsw_sp_port_dev_check(const struct net_device *dev);
467struct mlxsw_sp *mlxsw_sp_lower_get(struct net_device *dev);
468struct mlxsw_sp_port *mlxsw_sp_port_dev_lower_find(struct net_device *dev);
469struct mlxsw_sp_port *mlxsw_sp_port_lower_dev_hold(struct net_device *dev);
470void mlxsw_sp_port_dev_put(struct mlxsw_sp_port *mlxsw_sp_port);
471struct mlxsw_sp_port *mlxsw_sp_port_dev_lower_find_rcu(struct net_device *dev);
472
473/* spectrum_dcb.c */
474#ifdef CONFIG_MLXSW_SPECTRUM_DCB
475int mlxsw_sp_port_dcb_init(struct mlxsw_sp_port *mlxsw_sp_port);
476void mlxsw_sp_port_dcb_fini(struct mlxsw_sp_port *mlxsw_sp_port);
477#else
478static inline int mlxsw_sp_port_dcb_init(struct mlxsw_sp_port *mlxsw_sp_port)
479{
480 return 0;
481}
482static inline void mlxsw_sp_port_dcb_fini(struct mlxsw_sp_port *mlxsw_sp_port)
483{}
484#endif
485
486/* spectrum_router.c */
487enum mlxsw_sp_l3proto {
488 MLXSW_SP_L3_PROTO_IPV4,
489 MLXSW_SP_L3_PROTO_IPV6,
490#define MLXSW_SP_L3_PROTO_MAX (MLXSW_SP_L3_PROTO_IPV6 + 1)
491};
492
493union mlxsw_sp_l3addr {
494 __be32 addr4;
495 struct in6_addr addr6;
496};
497
498int mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp);
499void mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp);
500int mlxsw_sp_netdevice_router_port_event(struct net_device *dev,
501 unsigned long event, void *ptr);
502void mlxsw_sp_rif_macvlan_del(struct mlxsw_sp *mlxsw_sp,
503 const struct net_device *macvlan_dev);
504int mlxsw_sp_inetaddr_valid_event(struct notifier_block *unused,
505 unsigned long event, void *ptr);
506int mlxsw_sp_inet6addr_valid_event(struct notifier_block *unused,
507 unsigned long event, void *ptr);
508int mlxsw_sp_netdevice_vrf_event(struct net_device *l3_dev, unsigned long event,
509 struct netdev_notifier_changeupper_info *info);
510bool mlxsw_sp_netdev_is_ipip_ol(const struct mlxsw_sp *mlxsw_sp,
511 const struct net_device *dev);
512bool mlxsw_sp_netdev_is_ipip_ul(const struct mlxsw_sp *mlxsw_sp,
513 const struct net_device *dev);
514int mlxsw_sp_netdevice_ipip_ol_event(struct mlxsw_sp *mlxsw_sp,
515 struct net_device *l3_dev,
516 unsigned long event,
517 struct netdev_notifier_info *info);
518int
519mlxsw_sp_netdevice_ipip_ul_event(struct mlxsw_sp *mlxsw_sp,
520 struct net_device *l3_dev,
521 unsigned long event,
522 struct netdev_notifier_info *info);
523void
524mlxsw_sp_port_vlan_router_leave(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan);
525void mlxsw_sp_rif_destroy_by_dev(struct mlxsw_sp *mlxsw_sp,
526 struct net_device *dev);
527struct mlxsw_sp_rif *mlxsw_sp_rif_find_by_dev(const struct mlxsw_sp *mlxsw_sp,
528 const struct net_device *dev);
529u8 mlxsw_sp_router_port(const struct mlxsw_sp *mlxsw_sp);
530struct mlxsw_sp_fid *mlxsw_sp_rif_fid(const struct mlxsw_sp_rif *rif);
531int mlxsw_sp_router_nve_promote_decap(struct mlxsw_sp *mlxsw_sp, u32 ul_tb_id,
532 enum mlxsw_sp_l3proto ul_proto,
533 const union mlxsw_sp_l3addr *ul_sip,
534 u32 tunnel_index);
535void mlxsw_sp_router_nve_demote_decap(struct mlxsw_sp *mlxsw_sp, u32 ul_tb_id,
536 enum mlxsw_sp_l3proto ul_proto,
537 const union mlxsw_sp_l3addr *ul_sip);
538int mlxsw_sp_router_tb_id_vr_id(struct mlxsw_sp *mlxsw_sp, u32 tb_id,
539 u16 *vr_id);
540int mlxsw_sp_router_ul_rif_get(struct mlxsw_sp *mlxsw_sp, u32 ul_tb_id,
541 u16 *ul_rif_index);
542void mlxsw_sp_router_ul_rif_put(struct mlxsw_sp *mlxsw_sp, u16 ul_rif_index);
543
544/* spectrum_kvdl.c */
545enum mlxsw_sp_kvdl_entry_type {
546 MLXSW_SP_KVDL_ENTRY_TYPE_ADJ,
547 MLXSW_SP_KVDL_ENTRY_TYPE_ACTSET,
548 MLXSW_SP_KVDL_ENTRY_TYPE_PBS,
549 MLXSW_SP_KVDL_ENTRY_TYPE_MCRIGR,
550 MLXSW_SP_KVDL_ENTRY_TYPE_TNUMT,
551};
552
553static inline unsigned int
554mlxsw_sp_kvdl_entry_size(enum mlxsw_sp_kvdl_entry_type type)
555{
556 switch (type) {
557 case MLXSW_SP_KVDL_ENTRY_TYPE_ADJ: /* fall through */
558 case MLXSW_SP_KVDL_ENTRY_TYPE_ACTSET: /* fall through */
559 case MLXSW_SP_KVDL_ENTRY_TYPE_PBS: /* fall through */
560 case MLXSW_SP_KVDL_ENTRY_TYPE_MCRIGR: /* fall through */
561 case MLXSW_SP_KVDL_ENTRY_TYPE_TNUMT: /* fall through */
562 default:
563 return 1;
564 }
565}
566
567struct mlxsw_sp_kvdl_ops {
568 size_t priv_size;
569 int (*init)(struct mlxsw_sp *mlxsw_sp, void *priv);
570 void (*fini)(struct mlxsw_sp *mlxsw_sp, void *priv);
571 int (*alloc)(struct mlxsw_sp *mlxsw_sp, void *priv,
572 enum mlxsw_sp_kvdl_entry_type type,
573 unsigned int entry_count, u32 *p_entry_index);
574 void (*free)(struct mlxsw_sp *mlxsw_sp, void *priv,
575 enum mlxsw_sp_kvdl_entry_type type,
576 unsigned int entry_count, int entry_index);
577 int (*alloc_size_query)(struct mlxsw_sp *mlxsw_sp, void *priv,
578 enum mlxsw_sp_kvdl_entry_type type,
579 unsigned int entry_count,
580 unsigned int *p_alloc_count);
581 int (*resources_register)(struct mlxsw_sp *mlxsw_sp, void *priv);
582};
583
584int mlxsw_sp_kvdl_init(struct mlxsw_sp *mlxsw_sp);
585void mlxsw_sp_kvdl_fini(struct mlxsw_sp *mlxsw_sp);
586int mlxsw_sp_kvdl_alloc(struct mlxsw_sp *mlxsw_sp,
587 enum mlxsw_sp_kvdl_entry_type type,
588 unsigned int entry_count, u32 *p_entry_index);
589void mlxsw_sp_kvdl_free(struct mlxsw_sp *mlxsw_sp,
590 enum mlxsw_sp_kvdl_entry_type type,
591 unsigned int entry_count, int entry_index);
592int mlxsw_sp_kvdl_alloc_count_query(struct mlxsw_sp *mlxsw_sp,
593 enum mlxsw_sp_kvdl_entry_type type,
594 unsigned int entry_count,
595 unsigned int *p_alloc_count);
596
597/* spectrum1_kvdl.c */
598extern const struct mlxsw_sp_kvdl_ops mlxsw_sp1_kvdl_ops;
599int mlxsw_sp1_kvdl_resources_register(struct mlxsw_core *mlxsw_core);
600
601/* spectrum2_kvdl.c */
602extern const struct mlxsw_sp_kvdl_ops mlxsw_sp2_kvdl_ops;
603
604struct mlxsw_sp_acl_rule_info {
605 unsigned int priority;
606 struct mlxsw_afk_element_values values;
607 struct mlxsw_afa_block *act_block;
608 u8 action_created:1;
609 unsigned int counter_index;
610};
611
612struct mlxsw_sp_acl_block;
613struct mlxsw_sp_acl_ruleset;
614
615/* spectrum_acl.c */
616enum mlxsw_sp_acl_profile {
617 MLXSW_SP_ACL_PROFILE_FLOWER,
618 MLXSW_SP_ACL_PROFILE_MR,
619};
620
621struct mlxsw_afk *mlxsw_sp_acl_afk(struct mlxsw_sp_acl *acl);
622struct mlxsw_sp *mlxsw_sp_acl_block_mlxsw_sp(struct mlxsw_sp_acl_block *block);
623unsigned int mlxsw_sp_acl_block_rule_count(struct mlxsw_sp_acl_block *block);
624void mlxsw_sp_acl_block_disable_inc(struct mlxsw_sp_acl_block *block);
625void mlxsw_sp_acl_block_disable_dec(struct mlxsw_sp_acl_block *block);
626bool mlxsw_sp_acl_block_disabled(struct mlxsw_sp_acl_block *block);
627struct mlxsw_sp_acl_block *mlxsw_sp_acl_block_create(struct mlxsw_sp *mlxsw_sp,
628 struct net *net);
629void mlxsw_sp_acl_block_destroy(struct mlxsw_sp_acl_block *block);
630int mlxsw_sp_acl_block_bind(struct mlxsw_sp *mlxsw_sp,
631 struct mlxsw_sp_acl_block *block,
632 struct mlxsw_sp_port *mlxsw_sp_port,
633 bool ingress);
634int mlxsw_sp_acl_block_unbind(struct mlxsw_sp *mlxsw_sp,
635 struct mlxsw_sp_acl_block *block,
636 struct mlxsw_sp_port *mlxsw_sp_port,
637 bool ingress);
638bool mlxsw_sp_acl_block_is_egress_bound(struct mlxsw_sp_acl_block *block);
639struct mlxsw_sp_acl_ruleset *
640mlxsw_sp_acl_ruleset_lookup(struct mlxsw_sp *mlxsw_sp,
641 struct mlxsw_sp_acl_block *block, u32 chain_index,
642 enum mlxsw_sp_acl_profile profile);
643struct mlxsw_sp_acl_ruleset *
644mlxsw_sp_acl_ruleset_get(struct mlxsw_sp *mlxsw_sp,
645 struct mlxsw_sp_acl_block *block, u32 chain_index,
646 enum mlxsw_sp_acl_profile profile,
647 struct mlxsw_afk_element_usage *tmplt_elusage);
648void mlxsw_sp_acl_ruleset_put(struct mlxsw_sp *mlxsw_sp,
649 struct mlxsw_sp_acl_ruleset *ruleset);
650u16 mlxsw_sp_acl_ruleset_group_id(struct mlxsw_sp_acl_ruleset *ruleset);
651
652struct mlxsw_sp_acl_rule_info *
653mlxsw_sp_acl_rulei_create(struct mlxsw_sp_acl *acl,
654 struct mlxsw_afa_block *afa_block);
655void mlxsw_sp_acl_rulei_destroy(struct mlxsw_sp_acl_rule_info *rulei);
656int mlxsw_sp_acl_rulei_commit(struct mlxsw_sp_acl_rule_info *rulei);
657void mlxsw_sp_acl_rulei_priority(struct mlxsw_sp_acl_rule_info *rulei,
658 unsigned int priority);
659void mlxsw_sp_acl_rulei_keymask_u32(struct mlxsw_sp_acl_rule_info *rulei,
660 enum mlxsw_afk_element element,
661 u32 key_value, u32 mask_value);
662void mlxsw_sp_acl_rulei_keymask_buf(struct mlxsw_sp_acl_rule_info *rulei,
663 enum mlxsw_afk_element element,
664 const char *key_value,
665 const char *mask_value, unsigned int len);
666int mlxsw_sp_acl_rulei_act_continue(struct mlxsw_sp_acl_rule_info *rulei);
667int mlxsw_sp_acl_rulei_act_jump(struct mlxsw_sp_acl_rule_info *rulei,
668 u16 group_id);
669int mlxsw_sp_acl_rulei_act_terminate(struct mlxsw_sp_acl_rule_info *rulei);
670int mlxsw_sp_acl_rulei_act_drop(struct mlxsw_sp_acl_rule_info *rulei);
671int mlxsw_sp_acl_rulei_act_trap(struct mlxsw_sp_acl_rule_info *rulei);
672int mlxsw_sp_acl_rulei_act_mirror(struct mlxsw_sp *mlxsw_sp,
673 struct mlxsw_sp_acl_rule_info *rulei,
674 struct mlxsw_sp_acl_block *block,
675 struct net_device *out_dev,
676 struct netlink_ext_ack *extack);
677int mlxsw_sp_acl_rulei_act_fwd(struct mlxsw_sp *mlxsw_sp,
678 struct mlxsw_sp_acl_rule_info *rulei,
679 struct net_device *out_dev,
680 struct netlink_ext_ack *extack);
681int mlxsw_sp_acl_rulei_act_vlan(struct mlxsw_sp *mlxsw_sp,
682 struct mlxsw_sp_acl_rule_info *rulei,
683 u32 action, u16 vid, u16 proto, u8 prio,
684 struct netlink_ext_ack *extack);
685int mlxsw_sp_acl_rulei_act_count(struct mlxsw_sp *mlxsw_sp,
686 struct mlxsw_sp_acl_rule_info *rulei,
687 struct netlink_ext_ack *extack);
688int mlxsw_sp_acl_rulei_act_fid_set(struct mlxsw_sp *mlxsw_sp,
689 struct mlxsw_sp_acl_rule_info *rulei,
690 u16 fid, struct netlink_ext_ack *extack);
691
692struct mlxsw_sp_acl_rule;
693
694struct mlxsw_sp_acl_rule *
695mlxsw_sp_acl_rule_create(struct mlxsw_sp *mlxsw_sp,
696 struct mlxsw_sp_acl_ruleset *ruleset,
697 unsigned long cookie,
698 struct mlxsw_afa_block *afa_block,
699 struct netlink_ext_ack *extack);
700void mlxsw_sp_acl_rule_destroy(struct mlxsw_sp *mlxsw_sp,
701 struct mlxsw_sp_acl_rule *rule);
702int mlxsw_sp_acl_rule_add(struct mlxsw_sp *mlxsw_sp,
703 struct mlxsw_sp_acl_rule *rule);
704void mlxsw_sp_acl_rule_del(struct mlxsw_sp *mlxsw_sp,
705 struct mlxsw_sp_acl_rule *rule);
706int mlxsw_sp_acl_rule_action_replace(struct mlxsw_sp *mlxsw_sp,
707 struct mlxsw_sp_acl_rule *rule,
708 struct mlxsw_afa_block *afa_block);
709struct mlxsw_sp_acl_rule *
710mlxsw_sp_acl_rule_lookup(struct mlxsw_sp *mlxsw_sp,
711 struct mlxsw_sp_acl_ruleset *ruleset,
712 unsigned long cookie);
713struct mlxsw_sp_acl_rule_info *
714mlxsw_sp_acl_rule_rulei(struct mlxsw_sp_acl_rule *rule);
715int mlxsw_sp_acl_rule_get_stats(struct mlxsw_sp *mlxsw_sp,
716 struct mlxsw_sp_acl_rule *rule,
717 u64 *packets, u64 *bytes, u64 *last_use);
718
719struct mlxsw_sp_fid *mlxsw_sp_acl_dummy_fid(struct mlxsw_sp *mlxsw_sp);
720
721int mlxsw_sp_acl_init(struct mlxsw_sp *mlxsw_sp);
722void mlxsw_sp_acl_fini(struct mlxsw_sp *mlxsw_sp);
723u32 mlxsw_sp_acl_region_rehash_intrvl_get(struct mlxsw_sp *mlxsw_sp);
724int mlxsw_sp_acl_region_rehash_intrvl_set(struct mlxsw_sp *mlxsw_sp, u32 val);
725
726/* spectrum_acl_tcam.c */
727struct mlxsw_sp_acl_tcam;
728struct mlxsw_sp_acl_tcam_region;
729
730struct mlxsw_sp_acl_tcam_ops {
731 enum mlxsw_reg_ptar_key_type key_type;
732 size_t priv_size;
733 int (*init)(struct mlxsw_sp *mlxsw_sp, void *priv,
734 struct mlxsw_sp_acl_tcam *tcam);
735 void (*fini)(struct mlxsw_sp *mlxsw_sp, void *priv);
736 size_t region_priv_size;
737 int (*region_init)(struct mlxsw_sp *mlxsw_sp, void *region_priv,
738 void *tcam_priv,
739 struct mlxsw_sp_acl_tcam_region *region,
740 void *hints_priv);
741 void (*region_fini)(struct mlxsw_sp *mlxsw_sp, void *region_priv);
742 int (*region_associate)(struct mlxsw_sp *mlxsw_sp,
743 struct mlxsw_sp_acl_tcam_region *region);
744 void * (*region_rehash_hints_get)(void *region_priv);
745 void (*region_rehash_hints_put)(void *hints_priv);
746 size_t chunk_priv_size;
747 void (*chunk_init)(void *region_priv, void *chunk_priv,
748 unsigned int priority);
749 void (*chunk_fini)(void *chunk_priv);
750 size_t entry_priv_size;
751 int (*entry_add)(struct mlxsw_sp *mlxsw_sp,
752 void *region_priv, void *chunk_priv,
753 void *entry_priv,
754 struct mlxsw_sp_acl_rule_info *rulei);
755 void (*entry_del)(struct mlxsw_sp *mlxsw_sp,
756 void *region_priv, void *chunk_priv,
757 void *entry_priv);
758 int (*entry_action_replace)(struct mlxsw_sp *mlxsw_sp,
759 void *region_priv, void *entry_priv,
760 struct mlxsw_sp_acl_rule_info *rulei);
761 int (*entry_activity_get)(struct mlxsw_sp *mlxsw_sp,
762 void *region_priv, void *entry_priv,
763 bool *activity);
764};
765
766/* spectrum1_acl_tcam.c */
767extern const struct mlxsw_sp_acl_tcam_ops mlxsw_sp1_acl_tcam_ops;
768
769/* spectrum2_acl_tcam.c */
770extern const struct mlxsw_sp_acl_tcam_ops mlxsw_sp2_acl_tcam_ops;
771
772/* spectrum_acl_flex_actions.c */
773extern const struct mlxsw_afa_ops mlxsw_sp1_act_afa_ops;
774extern const struct mlxsw_afa_ops mlxsw_sp2_act_afa_ops;
775
776/* spectrum_acl_flex_keys.c */
777extern const struct mlxsw_afk_ops mlxsw_sp1_afk_ops;
778extern const struct mlxsw_afk_ops mlxsw_sp2_afk_ops;
779
780/* spectrum_flower.c */
781int mlxsw_sp_flower_replace(struct mlxsw_sp *mlxsw_sp,
782 struct mlxsw_sp_acl_block *block,
783 struct tc_cls_flower_offload *f);
784void mlxsw_sp_flower_destroy(struct mlxsw_sp *mlxsw_sp,
785 struct mlxsw_sp_acl_block *block,
786 struct tc_cls_flower_offload *f);
787int mlxsw_sp_flower_stats(struct mlxsw_sp *mlxsw_sp,
788 struct mlxsw_sp_acl_block *block,
789 struct tc_cls_flower_offload *f);
790int mlxsw_sp_flower_tmplt_create(struct mlxsw_sp *mlxsw_sp,
791 struct mlxsw_sp_acl_block *block,
792 struct tc_cls_flower_offload *f);
793void mlxsw_sp_flower_tmplt_destroy(struct mlxsw_sp *mlxsw_sp,
794 struct mlxsw_sp_acl_block *block,
795 struct tc_cls_flower_offload *f);
796
797/* spectrum_qdisc.c */
798int mlxsw_sp_tc_qdisc_init(struct mlxsw_sp_port *mlxsw_sp_port);
799void mlxsw_sp_tc_qdisc_fini(struct mlxsw_sp_port *mlxsw_sp_port);
800int mlxsw_sp_setup_tc_red(struct mlxsw_sp_port *mlxsw_sp_port,
801 struct tc_red_qopt_offload *p);
802int mlxsw_sp_setup_tc_prio(struct mlxsw_sp_port *mlxsw_sp_port,
803 struct tc_prio_qopt_offload *p);
804
805/* spectrum_fid.c */
806bool mlxsw_sp_fid_lag_vid_valid(const struct mlxsw_sp_fid *fid);
807struct mlxsw_sp_fid *mlxsw_sp_fid_lookup_by_index(struct mlxsw_sp *mlxsw_sp,
808 u16 fid_index);
809int mlxsw_sp_fid_nve_ifindex(const struct mlxsw_sp_fid *fid, int *nve_ifindex);
810int mlxsw_sp_fid_nve_type(const struct mlxsw_sp_fid *fid,
811 enum mlxsw_sp_nve_type *p_type);
812struct mlxsw_sp_fid *mlxsw_sp_fid_lookup_by_vni(struct mlxsw_sp *mlxsw_sp,
813 __be32 vni);
814int mlxsw_sp_fid_vni(const struct mlxsw_sp_fid *fid, __be32 *vni);
815int mlxsw_sp_fid_nve_flood_index_set(struct mlxsw_sp_fid *fid,
816 u32 nve_flood_index);
817void mlxsw_sp_fid_nve_flood_index_clear(struct mlxsw_sp_fid *fid);
818bool mlxsw_sp_fid_nve_flood_index_is_set(const struct mlxsw_sp_fid *fid);
819int mlxsw_sp_fid_vni_set(struct mlxsw_sp_fid *fid, enum mlxsw_sp_nve_type type,
820 __be32 vni, int nve_ifindex);
821void mlxsw_sp_fid_vni_clear(struct mlxsw_sp_fid *fid);
822bool mlxsw_sp_fid_vni_is_set(const struct mlxsw_sp_fid *fid);
823void mlxsw_sp_fid_fdb_clear_offload(const struct mlxsw_sp_fid *fid,
824 const struct net_device *nve_dev);
825int mlxsw_sp_fid_flood_set(struct mlxsw_sp_fid *fid,
826 enum mlxsw_sp_flood_type packet_type, u8 local_port,
827 bool member);
828int mlxsw_sp_fid_port_vid_map(struct mlxsw_sp_fid *fid,
829 struct mlxsw_sp_port *mlxsw_sp_port, u16 vid);
830void mlxsw_sp_fid_port_vid_unmap(struct mlxsw_sp_fid *fid,
831 struct mlxsw_sp_port *mlxsw_sp_port, u16 vid);
832u16 mlxsw_sp_fid_index(const struct mlxsw_sp_fid *fid);
833enum mlxsw_sp_fid_type mlxsw_sp_fid_type(const struct mlxsw_sp_fid *fid);
834void mlxsw_sp_fid_rif_set(struct mlxsw_sp_fid *fid, struct mlxsw_sp_rif *rif);
835struct mlxsw_sp_rif *mlxsw_sp_fid_rif(const struct mlxsw_sp_fid *fid);
836enum mlxsw_sp_rif_type
837mlxsw_sp_fid_type_rif_type(const struct mlxsw_sp *mlxsw_sp,
838 enum mlxsw_sp_fid_type type);
839u16 mlxsw_sp_fid_8021q_vid(const struct mlxsw_sp_fid *fid);
840struct mlxsw_sp_fid *mlxsw_sp_fid_8021q_get(struct mlxsw_sp *mlxsw_sp, u16 vid);
841struct mlxsw_sp_fid *mlxsw_sp_fid_8021d_get(struct mlxsw_sp *mlxsw_sp,
842 int br_ifindex);
843struct mlxsw_sp_fid *mlxsw_sp_fid_8021q_lookup(struct mlxsw_sp *mlxsw_sp,
844 u16 vid);
845struct mlxsw_sp_fid *mlxsw_sp_fid_8021d_lookup(struct mlxsw_sp *mlxsw_sp,
846 int br_ifindex);
847struct mlxsw_sp_fid *mlxsw_sp_fid_rfid_get(struct mlxsw_sp *mlxsw_sp,
848 u16 rif_index);
849struct mlxsw_sp_fid *mlxsw_sp_fid_dummy_get(struct mlxsw_sp *mlxsw_sp);
850void mlxsw_sp_fid_put(struct mlxsw_sp_fid *fid);
851int mlxsw_sp_port_fids_init(struct mlxsw_sp_port *mlxsw_sp_port);
852void mlxsw_sp_port_fids_fini(struct mlxsw_sp_port *mlxsw_sp_port);
853int mlxsw_sp_fids_init(struct mlxsw_sp *mlxsw_sp);
854void mlxsw_sp_fids_fini(struct mlxsw_sp *mlxsw_sp);
855
856/* spectrum_mr.c */
857enum mlxsw_sp_mr_route_prio {
858 MLXSW_SP_MR_ROUTE_PRIO_SG,
859 MLXSW_SP_MR_ROUTE_PRIO_STARG,
860 MLXSW_SP_MR_ROUTE_PRIO_CATCHALL,
861 __MLXSW_SP_MR_ROUTE_PRIO_MAX
862};
863
864#define MLXSW_SP_MR_ROUTE_PRIO_MAX (__MLXSW_SP_MR_ROUTE_PRIO_MAX - 1)
865
866struct mlxsw_sp_mr_route_key;
867
868struct mlxsw_sp_mr_tcam_ops {
869 size_t priv_size;
870 int (*init)(struct mlxsw_sp *mlxsw_sp, void *priv);
871 void (*fini)(void *priv);
872 size_t route_priv_size;
873 int (*route_create)(struct mlxsw_sp *mlxsw_sp, void *priv,
874 void *route_priv,
875 struct mlxsw_sp_mr_route_key *key,
876 struct mlxsw_afa_block *afa_block,
877 enum mlxsw_sp_mr_route_prio prio);
878 void (*route_destroy)(struct mlxsw_sp *mlxsw_sp, void *priv,
879 void *route_priv,
880 struct mlxsw_sp_mr_route_key *key);
881 int (*route_update)(struct mlxsw_sp *mlxsw_sp, void *route_priv,
882 struct mlxsw_sp_mr_route_key *key,
883 struct mlxsw_afa_block *afa_block);
884};
885
886/* spectrum1_mr_tcam.c */
887extern const struct mlxsw_sp_mr_tcam_ops mlxsw_sp1_mr_tcam_ops;
888
889/* spectrum2_mr_tcam.c */
890extern const struct mlxsw_sp_mr_tcam_ops mlxsw_sp2_mr_tcam_ops;
891
892/* spectrum_nve.c */
893struct mlxsw_sp_nve_params {
894 enum mlxsw_sp_nve_type type;
895 __be32 vni;
896 const struct net_device *dev;
897};
898
899extern const struct mlxsw_sp_nve_ops *mlxsw_sp1_nve_ops_arr[];
900extern const struct mlxsw_sp_nve_ops *mlxsw_sp2_nve_ops_arr[];
901
902int mlxsw_sp_nve_learned_ip_resolve(struct mlxsw_sp *mlxsw_sp, u32 uip,
903 enum mlxsw_sp_l3proto proto,
904 union mlxsw_sp_l3addr *addr);
905int mlxsw_sp_nve_flood_ip_add(struct mlxsw_sp *mlxsw_sp,
906 struct mlxsw_sp_fid *fid,
907 enum mlxsw_sp_l3proto proto,
908 union mlxsw_sp_l3addr *addr);
909void mlxsw_sp_nve_flood_ip_del(struct mlxsw_sp *mlxsw_sp,
910 struct mlxsw_sp_fid *fid,
911 enum mlxsw_sp_l3proto proto,
912 union mlxsw_sp_l3addr *addr);
913u32 mlxsw_sp_nve_decap_tunnel_index_get(const struct mlxsw_sp *mlxsw_sp);
914bool mlxsw_sp_nve_ipv4_route_is_decap(const struct mlxsw_sp *mlxsw_sp,
915 u32 tb_id, __be32 addr);
916int mlxsw_sp_nve_fid_enable(struct mlxsw_sp *mlxsw_sp, struct mlxsw_sp_fid *fid,
917 struct mlxsw_sp_nve_params *params,
918 struct netlink_ext_ack *extack);
919void mlxsw_sp_nve_fid_disable(struct mlxsw_sp *mlxsw_sp,
920 struct mlxsw_sp_fid *fid);
921int mlxsw_sp_port_nve_init(struct mlxsw_sp_port *mlxsw_sp_port);
922void mlxsw_sp_port_nve_fini(struct mlxsw_sp_port *mlxsw_sp_port);
923int mlxsw_sp_nve_init(struct mlxsw_sp *mlxsw_sp);
924void mlxsw_sp_nve_fini(struct mlxsw_sp *mlxsw_sp);
925
926#endif
927