1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2023, Intel Corporation. */
4 #ifndef _ICE_ESWITCH_BR_H_
5 #define _ICE_ESWITCH_BR_H_
7 #include <linux/rhashtable.h>
8 #include <linux/workqueue.h>
10 struct ice_esw_br_fdb_data {
11 unsigned char addr[ETH_ALEN];
15 struct ice_esw_br_flow {
16 struct ice_rule_query_data *fwd_rule;
17 struct ice_rule_query_data *guard_rule;
21 ICE_ESWITCH_BR_FDB_ADDED_BY_USER = BIT(0),
24 struct ice_esw_br_fdb_entry {
25 struct ice_esw_br_fdb_data data;
26 struct rhash_head ht_node;
27 struct list_head list;
31 struct net_device *dev;
32 struct ice_esw_br_port *br_port;
33 struct ice_esw_br_flow *flow;
35 unsigned long last_use;
38 enum ice_esw_br_port_type {
39 ICE_ESWITCH_BR_UPLINK_PORT = 0,
40 ICE_ESWITCH_BR_VF_REPR_PORT = 1,
43 struct ice_esw_br_port {
44 struct ice_esw_br *bridge;
46 enum ice_esw_br_port_type type;
54 ICE_ESWITCH_BR_VLAN_FILTERING = BIT(0),
58 struct ice_esw_br_offloads *br_offloads;
61 struct rhashtable fdb_ht;
62 struct list_head fdb_list;
66 unsigned long ageing_time;
69 struct ice_esw_br_offloads {
71 struct ice_esw_br *bridge;
72 struct notifier_block netdev_nb;
73 struct notifier_block switchdev_blk;
74 struct notifier_block switchdev_nb;
76 struct workqueue_struct *wq;
77 struct delayed_work update_work;
80 struct ice_esw_br_fdb_work {
81 struct work_struct work;
82 struct switchdev_notifier_fdb_info fdb_info;
83 struct net_device *dev;
87 struct ice_esw_br_vlan {
92 #define ice_nb_to_br_offloads(nb, nb_name) \
94 struct ice_esw_br_offloads, \
97 #define ice_work_to_br_offloads(w) \
99 struct ice_esw_br_offloads, \
102 #define ice_work_to_fdb_work(w) \
104 struct ice_esw_br_fdb_work, \
107 static inline bool ice_eswitch_br_is_vid_valid(u16 vid)
109 /* In trunk VLAN mode, for untagged traffic the bridge sends requests
110 * to offload VLAN 1 with pvid and untagged flags set. Since these
111 * flags are not supported, add a MAC filter instead.
117 ice_eswitch_br_offloads_deinit(struct ice_pf *pf);
119 ice_eswitch_br_offloads_init(struct ice_pf *pf);
121 #endif /* _ICE_ESWITCH_BR_H_ */