1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* Copyright (C) 2023, Intel Corporation. */ 3 4 #ifndef _ICE_ESWITCH_BR_H_ 5 #define _ICE_ESWITCH_BR_H_ 6 7 #include <linux/rhashtable.h> 8 9 struct ice_esw_br_fdb_data { 10 unsigned char addr[ETH_ALEN]; 11 u16 vid; 12 }; 13 14 struct ice_esw_br_flow { 15 struct ice_rule_query_data *fwd_rule; 16 }; 17 18 enum { 19 ICE_ESWITCH_BR_FDB_ADDED_BY_USER = BIT(0), 20 }; 21 22 struct ice_esw_br_fdb_entry { 23 struct ice_esw_br_fdb_data data; 24 struct rhash_head ht_node; 25 struct list_head list; 26 27 int flags; 28 29 struct net_device *dev; 30 struct ice_esw_br_port *br_port; 31 struct ice_esw_br_flow *flow; 32 }; 33 34 enum ice_esw_br_port_type { 35 ICE_ESWITCH_BR_UPLINK_PORT = 0, 36 ICE_ESWITCH_BR_VF_REPR_PORT = 1, 37 }; 38 39 struct ice_esw_br_port { 40 struct ice_esw_br *bridge; 41 struct ice_vsi *vsi; 42 enum ice_esw_br_port_type type; 43 u16 vsi_idx; 44 }; 45 46 struct ice_esw_br { 47 struct ice_esw_br_offloads *br_offloads; 48 struct xarray ports; 49 50 struct rhashtable fdb_ht; 51 struct list_head fdb_list; 52 53 int ifindex; 54 }; 55 56 struct ice_esw_br_offloads { 57 struct ice_pf *pf; 58 struct ice_esw_br *bridge; 59 struct notifier_block netdev_nb; 60 struct notifier_block switchdev_nb; 61 62 struct workqueue_struct *wq; 63 }; 64 65 struct ice_esw_br_fdb_work { 66 struct work_struct work; 67 struct switchdev_notifier_fdb_info fdb_info; 68 struct net_device *dev; 69 unsigned long event; 70 }; 71 72 #define ice_nb_to_br_offloads(nb, nb_name) \ 73 container_of(nb, \ 74 struct ice_esw_br_offloads, \ 75 nb_name) 76 77 #define ice_work_to_fdb_work(w) \ 78 container_of(w, \ 79 struct ice_esw_br_fdb_work, \ 80 work) 81 82 void 83 ice_eswitch_br_offloads_deinit(struct ice_pf *pf); 84 int 85 ice_eswitch_br_offloads_init(struct ice_pf *pf); 86 87 #endif /* _ICE_ESWITCH_BR_H_ */ 88