1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ 2 /* Copyright (c) 2021 Mellanox Technologies. */ 3 4 #ifndef __MLX5_ESW_BRIDGE_H__ 5 #define __MLX5_ESW_BRIDGE_H__ 6 7 #include <linux/notifier.h> 8 #include <linux/list.h> 9 #include <linux/workqueue.h> 10 #include <linux/xarray.h> 11 #include "eswitch.h" 12 13 struct mlx5_flow_table; 14 struct mlx5_flow_group; 15 16 struct mlx5_esw_bridge_offloads { 17 struct mlx5_eswitch *esw; 18 struct list_head bridges; 19 struct xarray ports; 20 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; 26 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; 31 32 struct mlx5_flow_table *skip_ft; 33 }; 34 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_update_used(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_create(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_fdb_remove(struct net_device *dev, u16 vport_num, u16 esw_owner_vhca_id, 56 struct mlx5_esw_bridge_offloads *br_offloads, 57 struct switchdev_notifier_fdb_info *fdb_info); 58 void mlx5_esw_bridge_update(struct mlx5_esw_bridge_offloads *br_offloads); 59 int mlx5_esw_bridge_ageing_time_set(u16 vport_num, u16 esw_owner_vhca_id, unsigned long ageing_time, 60 struct mlx5_esw_bridge_offloads *br_offloads); 61 int mlx5_esw_bridge_vlan_filtering_set(u16 vport_num, u16 esw_owner_vhca_id, bool enable, 62 struct mlx5_esw_bridge_offloads *br_offloads); 63 int mlx5_esw_bridge_port_vlan_add(u16 vport_num, u16 esw_owner_vhca_id, u16 vid, u16 flags, 64 struct mlx5_esw_bridge_offloads *br_offloads, 65 struct netlink_ext_ack *extack); 66 void mlx5_esw_bridge_port_vlan_del(u16 vport_num, u16 esw_owner_vhca_id, u16 vid, 67 struct mlx5_esw_bridge_offloads *br_offloads); 68 69 #endif /* __MLX5_ESW_BRIDGE_H__ */ 70