1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2021 Mellanox Technologies. */
4 #ifndef __MLX5_ESW_BRIDGE_H__
5 #define __MLX5_ESW_BRIDGE_H__
7 #include <linux/notifier.h>
8 #include <linux/list.h>
9 #include <linux/workqueue.h>
10 #include <linux/xarray.h>
13 struct mlx5_flow_table;
14 struct mlx5_flow_group;
16 struct mlx5_esw_bridge_offloads {
17 struct mlx5_eswitch *esw;
18 struct list_head bridges;
21 struct notifier_block netdev_nb;
22 struct notifier_block nb_blk;
23 struct notifier_block nb;
24 struct workqueue_struct *wq;
25 struct delayed_work update_work;
27 struct mlx5_flow_table *ingress_ft;
28 struct mlx5_flow_group *ingress_vlan_fg;
29 struct mlx5_flow_group *ingress_filter_fg;
30 struct mlx5_flow_group *ingress_mac_fg;
32 struct mlx5_flow_table *skip_ft;
35 struct mlx5_esw_bridge_offloads *mlx5_esw_bridge_init(struct mlx5_eswitch *esw);
36 void mlx5_esw_bridge_cleanup(struct mlx5_eswitch *esw);
37 int mlx5_esw_bridge_vport_link(int ifindex, u16 vport_num, u16 esw_owner_vhca_id,
38 struct mlx5_esw_bridge_offloads *br_offloads,
39 struct netlink_ext_ack *extack);
40 int mlx5_esw_bridge_vport_unlink(int ifindex, u16 vport_num, u16 esw_owner_vhca_id,
41 struct mlx5_esw_bridge_offloads *br_offloads,
42 struct netlink_ext_ack *extack);
43 int mlx5_esw_bridge_vport_peer_link(int ifindex, u16 vport_num, u16 esw_owner_vhca_id,
44 struct mlx5_esw_bridge_offloads *br_offloads,
45 struct netlink_ext_ack *extack);
46 int mlx5_esw_bridge_vport_peer_unlink(int ifindex, u16 vport_num, u16 esw_owner_vhca_id,
47 struct mlx5_esw_bridge_offloads *br_offloads,
48 struct netlink_ext_ack *extack);
49 void mlx5_esw_bridge_fdb_create(struct net_device *dev, u16 vport_num, u16 esw_owner_vhca_id,
50 struct mlx5_esw_bridge_offloads *br_offloads,
51 struct switchdev_notifier_fdb_info *fdb_info);
52 void mlx5_esw_bridge_fdb_remove(struct net_device *dev, u16 vport_num, u16 esw_owner_vhca_id,
53 struct mlx5_esw_bridge_offloads *br_offloads,
54 struct switchdev_notifier_fdb_info *fdb_info);
55 void mlx5_esw_bridge_update(struct mlx5_esw_bridge_offloads *br_offloads);
56 int mlx5_esw_bridge_ageing_time_set(u16 vport_num, u16 esw_owner_vhca_id, unsigned long ageing_time,
57 struct mlx5_esw_bridge_offloads *br_offloads);
58 int mlx5_esw_bridge_vlan_filtering_set(u16 vport_num, u16 esw_owner_vhca_id, bool enable,
59 struct mlx5_esw_bridge_offloads *br_offloads);
60 int mlx5_esw_bridge_port_vlan_add(u16 vport_num, u16 esw_owner_vhca_id, u16 vid, u16 flags,
61 struct mlx5_esw_bridge_offloads *br_offloads,
62 struct netlink_ext_ack *extack);
63 void mlx5_esw_bridge_port_vlan_del(u16 vport_num, u16 esw_owner_vhca_id, u16 vid,
64 struct mlx5_esw_bridge_offloads *br_offloads);
66 #endif /* __MLX5_ESW_BRIDGE_H__ */