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 dentry; 14 struct mlx5_flow_table; 15 struct mlx5_flow_group; 16 17 struct mlx5_esw_bridge_offloads { 18 struct mlx5_eswitch *esw; 19 struct list_head bridges; 20 struct xarray ports; 21 struct dentry *debugfs_root; 22 23 struct notifier_block netdev_nb; 24 struct notifier_block nb_blk; 25 struct notifier_block nb; 26 struct workqueue_struct *wq; 27 struct delayed_work update_work; 28 29 struct mlx5_flow_table *ingress_ft; 30 struct mlx5_flow_group *ingress_igmp_fg; 31 struct mlx5_flow_group *ingress_mld_fg; 32 struct mlx5_flow_group *ingress_vlan_fg; 33 struct mlx5_flow_group *ingress_vlan_filter_fg; 34 struct mlx5_flow_group *ingress_qinq_fg; 35 struct mlx5_flow_group *ingress_qinq_filter_fg; 36 struct mlx5_flow_group *ingress_mac_fg; 37 38 struct mlx5_flow_handle *igmp_handle; 39 struct mlx5_flow_handle *mld_query_handle; 40 struct mlx5_flow_handle *mld_report_handle; 41 struct mlx5_flow_handle *mld_done_handle; 42 43 struct mlx5_flow_table *skip_ft; 44 }; 45 46 struct mlx5_esw_bridge_offloads *mlx5_esw_bridge_init(struct mlx5_eswitch *esw); 47 void mlx5_esw_bridge_cleanup(struct mlx5_eswitch *esw); 48 int mlx5_esw_bridge_vport_link(struct net_device *br_netdev, u16 vport_num, u16 esw_owner_vhca_id, 49 struct mlx5_esw_bridge_offloads *br_offloads, 50 struct netlink_ext_ack *extack); 51 int mlx5_esw_bridge_vport_unlink(struct net_device *br_netdev, u16 vport_num, u16 esw_owner_vhca_id, 52 struct mlx5_esw_bridge_offloads *br_offloads, 53 struct netlink_ext_ack *extack); 54 int mlx5_esw_bridge_vport_peer_link(struct net_device *br_netdev, u16 vport_num, 55 u16 esw_owner_vhca_id, 56 struct mlx5_esw_bridge_offloads *br_offloads, 57 struct netlink_ext_ack *extack); 58 int mlx5_esw_bridge_vport_peer_unlink(struct net_device *br_netdev, u16 vport_num, 59 u16 esw_owner_vhca_id, 60 struct mlx5_esw_bridge_offloads *br_offloads, 61 struct netlink_ext_ack *extack); 62 void mlx5_esw_bridge_fdb_update_used(struct net_device *dev, u16 vport_num, u16 esw_owner_vhca_id, 63 struct mlx5_esw_bridge_offloads *br_offloads, 64 struct switchdev_notifier_fdb_info *fdb_info); 65 void mlx5_esw_bridge_fdb_mark_deleted(struct net_device *dev, u16 vport_num, u16 esw_owner_vhca_id, 66 struct mlx5_esw_bridge_offloads *br_offloads, 67 struct switchdev_notifier_fdb_info *fdb_info); 68 void mlx5_esw_bridge_fdb_create(struct net_device *dev, u16 vport_num, u16 esw_owner_vhca_id, 69 struct mlx5_esw_bridge_offloads *br_offloads, 70 struct switchdev_notifier_fdb_info *fdb_info); 71 void mlx5_esw_bridge_fdb_remove(struct net_device *dev, u16 vport_num, u16 esw_owner_vhca_id, 72 struct mlx5_esw_bridge_offloads *br_offloads, 73 struct switchdev_notifier_fdb_info *fdb_info); 74 void mlx5_esw_bridge_update(struct mlx5_esw_bridge_offloads *br_offloads); 75 int mlx5_esw_bridge_ageing_time_set(u16 vport_num, u16 esw_owner_vhca_id, unsigned long ageing_time, 76 struct mlx5_esw_bridge_offloads *br_offloads); 77 int mlx5_esw_bridge_vlan_filtering_set(u16 vport_num, u16 esw_owner_vhca_id, bool enable, 78 struct mlx5_esw_bridge_offloads *br_offloads); 79 int mlx5_esw_bridge_vlan_proto_set(u16 vport_num, u16 esw_owner_vhca_id, u16 proto, 80 struct mlx5_esw_bridge_offloads *br_offloads); 81 int mlx5_esw_bridge_mcast_set(u16 vport_num, u16 esw_owner_vhca_id, bool enable, 82 struct mlx5_esw_bridge_offloads *br_offloads); 83 int mlx5_esw_bridge_port_vlan_add(u16 vport_num, u16 esw_owner_vhca_id, u16 vid, u16 flags, 84 struct mlx5_esw_bridge_offloads *br_offloads, 85 struct netlink_ext_ack *extack); 86 void mlx5_esw_bridge_port_vlan_del(u16 vport_num, u16 esw_owner_vhca_id, u16 vid, 87 struct mlx5_esw_bridge_offloads *br_offloads); 88 89 int mlx5_esw_bridge_port_mdb_add(struct net_device *dev, u16 vport_num, u16 esw_owner_vhca_id, 90 const unsigned char *addr, u16 vid, 91 struct mlx5_esw_bridge_offloads *br_offloads, 92 struct netlink_ext_ack *extack); 93 void mlx5_esw_bridge_port_mdb_del(struct net_device *dev, u16 vport_num, u16 esw_owner_vhca_id, 94 const unsigned char *addr, u16 vid, 95 struct mlx5_esw_bridge_offloads *br_offloads); 96 97 #endif /* __MLX5_ESW_BRIDGE_H__ */ 98