2 * drivers/net/ethernet/mellanox/mlxsw/spectrum.h
3 * Copyright (c) 2015-2017 Mellanox Technologies. All rights reserved.
4 * Copyright (c) 2015-2017 Jiri Pirko <jiri@mellanox.com>
5 * Copyright (c) 2015 Ido Schimmel <idosch@mellanox.com>
6 * Copyright (c) 2015 Elad Raz <eladr@mellanox.com>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the names of the copyright holders nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
20 * Alternatively, this software may be distributed under the terms of the
21 * GNU General Public License ("GPL") version 2 as published by the Free
22 * Software Foundation.
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
37 #ifndef _MLXSW_SPECTRUM_H
38 #define _MLXSW_SPECTRUM_H
40 #include <linux/types.h>
41 #include <linux/netdevice.h>
42 #include <linux/rhashtable.h>
43 #include <linux/bitops.h>
44 #include <linux/if_vlan.h>
45 #include <linux/list.h>
46 #include <linux/dcbnl.h>
47 #include <linux/in6.h>
48 #include <linux/notifier.h>
49 #include <net/psample.h>
50 #include <net/pkt_cls.h>
55 #include "core_acl_flex_keys.h"
56 #include "core_acl_flex_actions.h"
58 #define MLXSW_SP_FID_8021D_MAX 1024
60 #define MLXSW_SP_MID_MAX 7000
62 #define MLXSW_SP_PORTS_PER_CLUSTER_MAX 4
64 #define MLXSW_SP_PORT_BASE_SPEED 25000 /* Mb/s */
66 #define MLXSW_SP_KVD_LINEAR_SIZE 98304 /* entries */
67 #define MLXSW_SP_KVD_GRANULARITY 128
72 struct mlxsw_sp_upper {
73 struct net_device *dev;
74 unsigned int ref_count;
77 enum mlxsw_sp_rif_type {
78 MLXSW_SP_RIF_TYPE_SUBPORT,
79 MLXSW_SP_RIF_TYPE_VLAN,
80 MLXSW_SP_RIF_TYPE_FID,
81 MLXSW_SP_RIF_TYPE_IPIP_LB, /* IP-in-IP loopback. */
82 MLXSW_SP_RIF_TYPE_MAX,
85 enum mlxsw_sp_fid_type {
86 MLXSW_SP_FID_TYPE_8021Q,
87 MLXSW_SP_FID_TYPE_8021D,
88 MLXSW_SP_FID_TYPE_RFID,
89 MLXSW_SP_FID_TYPE_DUMMY,
90 MLXSW_SP_FID_TYPE_MAX,
94 struct list_head list;
95 unsigned char addr[ETH_ALEN];
99 unsigned long *ports_in_mid; /* bits array */
102 enum mlxsw_sp_span_type {
103 MLXSW_SP_SPAN_EGRESS,
104 MLXSW_SP_SPAN_INGRESS
107 struct mlxsw_sp_span_inspected_port {
108 struct list_head list;
109 enum mlxsw_sp_span_type type;
113 struct mlxsw_sp_span_entry {
116 struct list_head bound_ports_list;
121 enum mlxsw_sp_port_mall_action_type {
122 MLXSW_SP_PORT_MALL_MIRROR,
123 MLXSW_SP_PORT_MALL_SAMPLE,
126 struct mlxsw_sp_port_mall_mirror_tc_entry {
131 struct mlxsw_sp_port_mall_tc_entry {
132 struct list_head list;
133 unsigned long cookie;
134 enum mlxsw_sp_port_mall_action_type type;
136 struct mlxsw_sp_port_mall_mirror_tc_entry mirror;
141 struct mlxsw_sp_bridge;
142 struct mlxsw_sp_router;
145 struct mlxsw_sp_counter_pool;
146 struct mlxsw_sp_fid_core;
147 struct mlxsw_sp_kvdl;
150 struct mlxsw_sp_port **ports;
151 struct mlxsw_core *core;
152 const struct mlxsw_bus_info *bus_info;
153 unsigned char base_mac[ETH_ALEN];
154 struct mlxsw_sp_upper *lags;
156 struct mlxsw_sp_sb *sb;
157 struct mlxsw_sp_bridge *bridge;
158 struct mlxsw_sp_router *router;
159 struct mlxsw_sp_mr *mr;
160 struct mlxsw_afa *afa;
161 struct mlxsw_sp_acl *acl;
162 struct mlxsw_sp_fid_core *fid_core;
163 struct mlxsw_sp_kvdl *kvdl;
164 struct notifier_block netdevice_nb;
166 struct mlxsw_sp_counter_pool *counter_pool;
168 struct mlxsw_sp_span_entry *entries;
173 static inline struct mlxsw_sp_upper *
174 mlxsw_sp_lag_get(struct mlxsw_sp *mlxsw_sp, u16 lag_id)
176 return &mlxsw_sp->lags[lag_id];
179 struct mlxsw_sp_port_pcpu_stats {
184 struct u64_stats_sync syncp;
188 struct mlxsw_sp_port_sample {
189 struct psample_group __rcu *psample_group;
195 struct mlxsw_sp_bridge_port;
198 struct mlxsw_sp_port_vlan {
199 struct list_head list;
200 struct mlxsw_sp_port *mlxsw_sp_port;
201 struct mlxsw_sp_fid *fid;
203 struct mlxsw_sp_bridge_port *bridge_port;
204 struct list_head bridge_vlan_node;
207 enum mlxsw_sp_qdisc_type {
208 MLXSW_SP_QDISC_NO_QDISC,
212 struct mlxsw_sp_qdisc {
214 enum mlxsw_sp_qdisc_type type;
215 struct red_stats xstats_base;
230 /* No need an internal lock; At worse - miss a single periodic iteration */
231 struct mlxsw_sp_port_xstats {
233 u64 wred_drop[TC_MAX_QUEUE];
234 u64 tail_drop[TC_MAX_QUEUE];
235 u64 backlog[TC_MAX_QUEUE];
238 struct mlxsw_sp_port {
239 struct net_device *dev;
240 struct mlxsw_sp_port_pcpu_stats __percpu *pcpu_stats;
241 struct mlxsw_sp *mlxsw_sp;
253 struct ieee_ets *ets;
254 struct ieee_maxrate *maxrate;
255 struct ieee_pfc *pfc;
263 struct list_head mall_tc_list;
265 #define MLXSW_HW_STATS_UPDATE_TIME HZ
266 struct rtnl_link_stats64 stats;
267 struct mlxsw_sp_port_xstats xstats;
268 struct delayed_work update_dw;
270 struct mlxsw_sp_port_sample *sample;
271 struct list_head vlans_list;
272 struct mlxsw_sp_qdisc root_qdisc;
276 mlxsw_sp_port_is_pause_en(const struct mlxsw_sp_port *mlxsw_sp_port)
278 return mlxsw_sp_port->link.tx_pause || mlxsw_sp_port->link.rx_pause;
281 static inline struct mlxsw_sp_port *
282 mlxsw_sp_port_lagged_get(struct mlxsw_sp *mlxsw_sp, u16 lag_id, u8 port_index)
284 struct mlxsw_sp_port *mlxsw_sp_port;
287 local_port = mlxsw_core_lag_mapping_get(mlxsw_sp->core,
289 mlxsw_sp_port = mlxsw_sp->ports[local_port];
290 return mlxsw_sp_port && mlxsw_sp_port->lagged ? mlxsw_sp_port : NULL;
293 static inline struct mlxsw_sp_port_vlan *
294 mlxsw_sp_port_vlan_find_by_vid(const struct mlxsw_sp_port *mlxsw_sp_port,
297 struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
299 list_for_each_entry(mlxsw_sp_port_vlan, &mlxsw_sp_port->vlans_list,
301 if (mlxsw_sp_port_vlan->vid == vid)
302 return mlxsw_sp_port_vlan;
308 enum mlxsw_sp_flood_type {
309 MLXSW_SP_FLOOD_TYPE_UC,
310 MLXSW_SP_FLOOD_TYPE_BC,
311 MLXSW_SP_FLOOD_TYPE_MC,
314 /* spectrum_buffers.c */
315 int mlxsw_sp_buffers_init(struct mlxsw_sp *mlxsw_sp);
316 void mlxsw_sp_buffers_fini(struct mlxsw_sp *mlxsw_sp);
317 int mlxsw_sp_port_buffers_init(struct mlxsw_sp_port *mlxsw_sp_port);
318 int mlxsw_sp_sb_pool_get(struct mlxsw_core *mlxsw_core,
319 unsigned int sb_index, u16 pool_index,
320 struct devlink_sb_pool_info *pool_info);
321 int mlxsw_sp_sb_pool_set(struct mlxsw_core *mlxsw_core,
322 unsigned int sb_index, u16 pool_index, u32 size,
323 enum devlink_sb_threshold_type threshold_type);
324 int mlxsw_sp_sb_port_pool_get(struct mlxsw_core_port *mlxsw_core_port,
325 unsigned int sb_index, u16 pool_index,
327 int mlxsw_sp_sb_port_pool_set(struct mlxsw_core_port *mlxsw_core_port,
328 unsigned int sb_index, u16 pool_index,
330 int mlxsw_sp_sb_tc_pool_bind_get(struct mlxsw_core_port *mlxsw_core_port,
331 unsigned int sb_index, u16 tc_index,
332 enum devlink_sb_pool_type pool_type,
333 u16 *p_pool_index, u32 *p_threshold);
334 int mlxsw_sp_sb_tc_pool_bind_set(struct mlxsw_core_port *mlxsw_core_port,
335 unsigned int sb_index, u16 tc_index,
336 enum devlink_sb_pool_type pool_type,
337 u16 pool_index, u32 threshold);
338 int mlxsw_sp_sb_occ_snapshot(struct mlxsw_core *mlxsw_core,
339 unsigned int sb_index);
340 int mlxsw_sp_sb_occ_max_clear(struct mlxsw_core *mlxsw_core,
341 unsigned int sb_index);
342 int mlxsw_sp_sb_occ_port_pool_get(struct mlxsw_core_port *mlxsw_core_port,
343 unsigned int sb_index, u16 pool_index,
344 u32 *p_cur, u32 *p_max);
345 int mlxsw_sp_sb_occ_tc_port_bind_get(struct mlxsw_core_port *mlxsw_core_port,
346 unsigned int sb_index, u16 tc_index,
347 enum devlink_sb_pool_type pool_type,
348 u32 *p_cur, u32 *p_max);
349 u32 mlxsw_sp_cells_bytes(const struct mlxsw_sp *mlxsw_sp, u32 cells);
350 u32 mlxsw_sp_bytes_cells(const struct mlxsw_sp *mlxsw_sp, u32 bytes);
352 /* spectrum_switchdev.c */
353 int mlxsw_sp_switchdev_init(struct mlxsw_sp *mlxsw_sp);
354 void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp);
355 void mlxsw_sp_port_switchdev_init(struct mlxsw_sp_port *mlxsw_sp_port);
356 void mlxsw_sp_port_switchdev_fini(struct mlxsw_sp_port *mlxsw_sp_port);
357 int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid,
360 mlxsw_sp_port_vlan_bridge_leave(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan);
361 int mlxsw_sp_port_bridge_join(struct mlxsw_sp_port *mlxsw_sp_port,
362 struct net_device *brport_dev,
363 struct net_device *br_dev,
364 struct netlink_ext_ack *extack);
365 void mlxsw_sp_port_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_port,
366 struct net_device *brport_dev,
367 struct net_device *br_dev);
368 bool mlxsw_sp_bridge_device_is_offloaded(const struct mlxsw_sp *mlxsw_sp,
369 const struct net_device *br_dev);
372 int mlxsw_sp_port_ets_set(struct mlxsw_sp_port *mlxsw_sp_port,
373 enum mlxsw_reg_qeec_hr hr, u8 index, u8 next_index,
374 bool dwrr, u8 dwrr_weight);
375 int mlxsw_sp_port_prio_tc_set(struct mlxsw_sp_port *mlxsw_sp_port,
376 u8 switch_prio, u8 tclass);
377 int __mlxsw_sp_port_headroom_set(struct mlxsw_sp_port *mlxsw_sp_port, int mtu,
378 u8 *prio_tc, bool pause_en,
379 struct ieee_pfc *my_pfc);
380 int mlxsw_sp_port_ets_maxrate_set(struct mlxsw_sp_port *mlxsw_sp_port,
381 enum mlxsw_reg_qeec_hr hr, u8 index,
382 u8 next_index, u32 maxrate);
383 int mlxsw_sp_port_vid_stp_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid,
385 int mlxsw_sp_port_vp_mode_set(struct mlxsw_sp_port *mlxsw_sp_port, bool enable);
386 int mlxsw_sp_port_vid_learning_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid,
388 int mlxsw_sp_port_pvid_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid);
389 struct mlxsw_sp_port_vlan *
390 mlxsw_sp_port_vlan_get(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid);
391 void mlxsw_sp_port_vlan_put(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan);
392 int mlxsw_sp_port_vlan_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid_begin,
393 u16 vid_end, bool is_member, bool untagged);
394 int mlxsw_sp_flow_counter_get(struct mlxsw_sp *mlxsw_sp,
395 unsigned int counter_index, u64 *packets,
397 int mlxsw_sp_flow_counter_alloc(struct mlxsw_sp *mlxsw_sp,
398 unsigned int *p_counter_index);
399 void mlxsw_sp_flow_counter_free(struct mlxsw_sp *mlxsw_sp,
400 unsigned int counter_index);
401 bool mlxsw_sp_port_dev_check(const struct net_device *dev);
402 struct mlxsw_sp *mlxsw_sp_lower_get(struct net_device *dev);
403 struct mlxsw_sp_port *mlxsw_sp_port_dev_lower_find(struct net_device *dev);
404 struct mlxsw_sp_port *mlxsw_sp_port_lower_dev_hold(struct net_device *dev);
405 void mlxsw_sp_port_dev_put(struct mlxsw_sp_port *mlxsw_sp_port);
406 struct mlxsw_sp_port *mlxsw_sp_port_dev_lower_find_rcu(struct net_device *dev);
409 #ifdef CONFIG_MLXSW_SPECTRUM_DCB
410 int mlxsw_sp_port_dcb_init(struct mlxsw_sp_port *mlxsw_sp_port);
411 void mlxsw_sp_port_dcb_fini(struct mlxsw_sp_port *mlxsw_sp_port);
413 static inline int mlxsw_sp_port_dcb_init(struct mlxsw_sp_port *mlxsw_sp_port)
417 static inline void mlxsw_sp_port_dcb_fini(struct mlxsw_sp_port *mlxsw_sp_port)
421 /* spectrum_router.c */
422 int mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp);
423 void mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp);
424 int mlxsw_sp_netdevice_router_port_event(struct net_device *dev);
425 int mlxsw_sp_inetaddr_event(struct notifier_block *unused,
426 unsigned long event, void *ptr);
427 int mlxsw_sp_inetaddr_valid_event(struct notifier_block *unused,
428 unsigned long event, void *ptr);
429 int mlxsw_sp_inet6addr_event(struct notifier_block *unused,
430 unsigned long event, void *ptr);
431 int mlxsw_sp_inet6addr_valid_event(struct notifier_block *unused,
432 unsigned long event, void *ptr);
433 int mlxsw_sp_netdevice_vrf_event(struct net_device *l3_dev, unsigned long event,
434 struct netdev_notifier_changeupper_info *info);
435 bool mlxsw_sp_netdev_is_ipip_ol(const struct mlxsw_sp *mlxsw_sp,
436 const struct net_device *dev);
437 bool mlxsw_sp_netdev_is_ipip_ul(const struct mlxsw_sp *mlxsw_sp,
438 const struct net_device *dev);
439 int mlxsw_sp_netdevice_ipip_ol_event(struct mlxsw_sp *mlxsw_sp,
440 struct net_device *l3_dev,
442 struct netdev_notifier_info *info);
444 mlxsw_sp_netdevice_ipip_ul_event(struct mlxsw_sp *mlxsw_sp,
445 struct net_device *l3_dev,
447 struct netdev_notifier_info *info);
449 mlxsw_sp_port_vlan_router_leave(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan);
450 void mlxsw_sp_rif_destroy(struct mlxsw_sp_rif *rif);
452 /* spectrum_kvdl.c */
453 int mlxsw_sp_kvdl_init(struct mlxsw_sp *mlxsw_sp);
454 void mlxsw_sp_kvdl_fini(struct mlxsw_sp *mlxsw_sp);
455 int mlxsw_sp_kvdl_alloc(struct mlxsw_sp *mlxsw_sp, unsigned int entry_count,
457 void mlxsw_sp_kvdl_free(struct mlxsw_sp *mlxsw_sp, int entry_index);
458 int mlxsw_sp_kvdl_alloc_size_query(struct mlxsw_sp *mlxsw_sp,
459 unsigned int entry_count,
460 unsigned int *p_alloc_size);
462 struct mlxsw_sp_acl_rule_info {
463 unsigned int priority;
464 struct mlxsw_afk_element_values values;
465 struct mlxsw_afa_block *act_block;
466 unsigned int counter_index;
470 enum mlxsw_sp_acl_profile {
471 MLXSW_SP_ACL_PROFILE_FLOWER,
474 struct mlxsw_sp_acl_profile_ops {
475 size_t ruleset_priv_size;
476 int (*ruleset_add)(struct mlxsw_sp *mlxsw_sp,
477 void *priv, void *ruleset_priv);
478 void (*ruleset_del)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv);
479 int (*ruleset_bind)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv,
480 struct net_device *dev, bool ingress);
481 void (*ruleset_unbind)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv);
482 u16 (*ruleset_group_id)(void *ruleset_priv);
483 size_t rule_priv_size;
484 int (*rule_add)(struct mlxsw_sp *mlxsw_sp,
485 void *ruleset_priv, void *rule_priv,
486 struct mlxsw_sp_acl_rule_info *rulei);
487 void (*rule_del)(struct mlxsw_sp *mlxsw_sp, void *rule_priv);
488 int (*rule_activity_get)(struct mlxsw_sp *mlxsw_sp, void *rule_priv,
492 struct mlxsw_sp_acl_ops {
494 int (*init)(struct mlxsw_sp *mlxsw_sp, void *priv);
495 void (*fini)(struct mlxsw_sp *mlxsw_sp, void *priv);
496 const struct mlxsw_sp_acl_profile_ops *
497 (*profile_ops)(struct mlxsw_sp *mlxsw_sp,
498 enum mlxsw_sp_acl_profile profile);
501 struct mlxsw_sp_acl_ruleset;
504 struct mlxsw_afk *mlxsw_sp_acl_afk(struct mlxsw_sp_acl *acl);
505 struct mlxsw_sp_acl_ruleset *
506 mlxsw_sp_acl_ruleset_lookup(struct mlxsw_sp *mlxsw_sp, struct net_device *dev,
507 bool ingress, u32 chain_index,
508 enum mlxsw_sp_acl_profile profile);
509 struct mlxsw_sp_acl_ruleset *
510 mlxsw_sp_acl_ruleset_get(struct mlxsw_sp *mlxsw_sp, struct net_device *dev,
511 bool ingress, u32 chain_index,
512 enum mlxsw_sp_acl_profile profile);
513 void mlxsw_sp_acl_ruleset_put(struct mlxsw_sp *mlxsw_sp,
514 struct mlxsw_sp_acl_ruleset *ruleset);
515 u16 mlxsw_sp_acl_ruleset_group_id(struct mlxsw_sp_acl_ruleset *ruleset);
517 struct mlxsw_sp_acl_rule_info *
518 mlxsw_sp_acl_rulei_create(struct mlxsw_sp_acl *acl);
519 void mlxsw_sp_acl_rulei_destroy(struct mlxsw_sp_acl_rule_info *rulei);
520 int mlxsw_sp_acl_rulei_commit(struct mlxsw_sp_acl_rule_info *rulei);
521 void mlxsw_sp_acl_rulei_priority(struct mlxsw_sp_acl_rule_info *rulei,
522 unsigned int priority);
523 void mlxsw_sp_acl_rulei_keymask_u32(struct mlxsw_sp_acl_rule_info *rulei,
524 enum mlxsw_afk_element element,
525 u32 key_value, u32 mask_value);
526 void mlxsw_sp_acl_rulei_keymask_buf(struct mlxsw_sp_acl_rule_info *rulei,
527 enum mlxsw_afk_element element,
528 const char *key_value,
529 const char *mask_value, unsigned int len);
530 int mlxsw_sp_acl_rulei_act_continue(struct mlxsw_sp_acl_rule_info *rulei);
531 int mlxsw_sp_acl_rulei_act_jump(struct mlxsw_sp_acl_rule_info *rulei,
533 int mlxsw_sp_acl_rulei_act_drop(struct mlxsw_sp_acl_rule_info *rulei);
534 int mlxsw_sp_acl_rulei_act_trap(struct mlxsw_sp_acl_rule_info *rulei);
535 int mlxsw_sp_acl_rulei_act_fwd(struct mlxsw_sp *mlxsw_sp,
536 struct mlxsw_sp_acl_rule_info *rulei,
537 struct net_device *out_dev);
538 int mlxsw_sp_acl_rulei_act_vlan(struct mlxsw_sp *mlxsw_sp,
539 struct mlxsw_sp_acl_rule_info *rulei,
540 u32 action, u16 vid, u16 proto, u8 prio);
541 int mlxsw_sp_acl_rulei_act_count(struct mlxsw_sp *mlxsw_sp,
542 struct mlxsw_sp_acl_rule_info *rulei);
543 int mlxsw_sp_acl_rulei_act_fid_set(struct mlxsw_sp *mlxsw_sp,
544 struct mlxsw_sp_acl_rule_info *rulei,
547 struct mlxsw_sp_acl_rule;
549 struct mlxsw_sp_acl_rule *
550 mlxsw_sp_acl_rule_create(struct mlxsw_sp *mlxsw_sp,
551 struct mlxsw_sp_acl_ruleset *ruleset,
552 unsigned long cookie);
553 void mlxsw_sp_acl_rule_destroy(struct mlxsw_sp *mlxsw_sp,
554 struct mlxsw_sp_acl_rule *rule);
555 int mlxsw_sp_acl_rule_add(struct mlxsw_sp *mlxsw_sp,
556 struct mlxsw_sp_acl_rule *rule);
557 void mlxsw_sp_acl_rule_del(struct mlxsw_sp *mlxsw_sp,
558 struct mlxsw_sp_acl_rule *rule);
559 struct mlxsw_sp_acl_rule *
560 mlxsw_sp_acl_rule_lookup(struct mlxsw_sp *mlxsw_sp,
561 struct mlxsw_sp_acl_ruleset *ruleset,
562 unsigned long cookie);
563 struct mlxsw_sp_acl_rule_info *
564 mlxsw_sp_acl_rule_rulei(struct mlxsw_sp_acl_rule *rule);
565 int mlxsw_sp_acl_rule_get_stats(struct mlxsw_sp *mlxsw_sp,
566 struct mlxsw_sp_acl_rule *rule,
567 u64 *packets, u64 *bytes, u64 *last_use);
569 struct mlxsw_sp_fid *mlxsw_sp_acl_dummy_fid(struct mlxsw_sp *mlxsw_sp);
571 int mlxsw_sp_acl_init(struct mlxsw_sp *mlxsw_sp);
572 void mlxsw_sp_acl_fini(struct mlxsw_sp *mlxsw_sp);
574 /* spectrum_acl_tcam.c */
575 extern const struct mlxsw_sp_acl_ops mlxsw_sp_acl_tcam_ops;
577 /* spectrum_flower.c */
578 int mlxsw_sp_flower_replace(struct mlxsw_sp_port *mlxsw_sp_port, bool ingress,
579 struct tc_cls_flower_offload *f);
580 void mlxsw_sp_flower_destroy(struct mlxsw_sp_port *mlxsw_sp_port, bool ingress,
581 struct tc_cls_flower_offload *f);
582 int mlxsw_sp_flower_stats(struct mlxsw_sp_port *mlxsw_sp_port, bool ingress,
583 struct tc_cls_flower_offload *f);
585 /* spectrum_qdisc.c */
586 int mlxsw_sp_setup_tc_red(struct mlxsw_sp_port *mlxsw_sp_port,
587 struct tc_red_qopt_offload *p);
590 int mlxsw_sp_fid_flood_set(struct mlxsw_sp_fid *fid,
591 enum mlxsw_sp_flood_type packet_type, u8 local_port,
593 int mlxsw_sp_fid_port_vid_map(struct mlxsw_sp_fid *fid,
594 struct mlxsw_sp_port *mlxsw_sp_port, u16 vid);
595 void mlxsw_sp_fid_port_vid_unmap(struct mlxsw_sp_fid *fid,
596 struct mlxsw_sp_port *mlxsw_sp_port, u16 vid);
597 enum mlxsw_sp_rif_type mlxsw_sp_fid_rif_type(const struct mlxsw_sp_fid *fid);
598 u16 mlxsw_sp_fid_index(const struct mlxsw_sp_fid *fid);
599 enum mlxsw_sp_fid_type mlxsw_sp_fid_type(const struct mlxsw_sp_fid *fid);
600 void mlxsw_sp_fid_rif_set(struct mlxsw_sp_fid *fid, struct mlxsw_sp_rif *rif);
601 enum mlxsw_sp_rif_type
602 mlxsw_sp_fid_type_rif_type(const struct mlxsw_sp *mlxsw_sp,
603 enum mlxsw_sp_fid_type type);
604 u16 mlxsw_sp_fid_8021q_vid(const struct mlxsw_sp_fid *fid);
605 struct mlxsw_sp_fid *mlxsw_sp_fid_8021q_get(struct mlxsw_sp *mlxsw_sp, u16 vid);
606 struct mlxsw_sp_fid *mlxsw_sp_fid_8021d_get(struct mlxsw_sp *mlxsw_sp,
608 struct mlxsw_sp_fid *mlxsw_sp_fid_rfid_get(struct mlxsw_sp *mlxsw_sp,
610 struct mlxsw_sp_fid *mlxsw_sp_fid_dummy_get(struct mlxsw_sp *mlxsw_sp);
611 void mlxsw_sp_fid_put(struct mlxsw_sp_fid *fid);
612 int mlxsw_sp_port_fids_init(struct mlxsw_sp_port *mlxsw_sp_port);
613 void mlxsw_sp_port_fids_fini(struct mlxsw_sp_port *mlxsw_sp_port);
614 int mlxsw_sp_fids_init(struct mlxsw_sp *mlxsw_sp);
615 void mlxsw_sp_fids_fini(struct mlxsw_sp *mlxsw_sp);