1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 3 #ifndef _BR_PRIVATE_MRP_H_ 4 #define _BR_PRIVATE_MRP_H_ 5 6 #include "br_private.h" 7 #include <uapi/linux/mrp_bridge.h> 8 9 struct br_mrp { 10 /* list of mrp instances */ 11 struct hlist_node list; 12 13 struct net_bridge_port __rcu *p_port; 14 struct net_bridge_port __rcu *s_port; 15 struct net_bridge_port __rcu *i_port; 16 17 u32 ring_id; 18 u16 in_id; 19 u16 prio; 20 21 enum br_mrp_ring_role_type ring_role; 22 u8 ring_role_offloaded; 23 enum br_mrp_ring_state_type ring_state; 24 u32 ring_transitions; 25 26 enum br_mrp_in_role_type in_role; 27 u8 in_role_offloaded; 28 enum br_mrp_in_state_type in_state; 29 u32 in_transitions; 30 31 struct delayed_work test_work; 32 u32 test_interval; 33 unsigned long test_end; 34 u32 test_count_miss; 35 u32 test_max_miss; 36 bool test_monitor; 37 38 struct delayed_work in_test_work; 39 u32 in_test_interval; 40 unsigned long in_test_end; 41 u32 in_test_count_miss; 42 u32 in_test_max_miss; 43 44 u32 seq_id; 45 46 struct rcu_head rcu; 47 }; 48 49 /* br_mrp.c */ 50 int br_mrp_add(struct net_bridge *br, struct br_mrp_instance *instance); 51 int br_mrp_del(struct net_bridge *br, struct br_mrp_instance *instance); 52 int br_mrp_set_port_state(struct net_bridge_port *p, 53 enum br_mrp_port_state_type state); 54 int br_mrp_set_port_role(struct net_bridge_port *p, 55 enum br_mrp_port_role_type role); 56 int br_mrp_set_ring_state(struct net_bridge *br, 57 struct br_mrp_ring_state *state); 58 int br_mrp_set_ring_role(struct net_bridge *br, struct br_mrp_ring_role *role); 59 int br_mrp_start_test(struct net_bridge *br, struct br_mrp_start_test *test); 60 int br_mrp_set_in_state(struct net_bridge *br, struct br_mrp_in_state *state); 61 int br_mrp_set_in_role(struct net_bridge *br, struct br_mrp_in_role *role); 62 int br_mrp_start_in_test(struct net_bridge *br, 63 struct br_mrp_start_in_test *test); 64 65 /* br_mrp_switchdev.c */ 66 int br_mrp_switchdev_add(struct net_bridge *br, struct br_mrp *mrp); 67 int br_mrp_switchdev_del(struct net_bridge *br, struct br_mrp *mrp); 68 int br_mrp_switchdev_set_ring_role(struct net_bridge *br, struct br_mrp *mrp, 69 enum br_mrp_ring_role_type role); 70 int br_mrp_switchdev_set_ring_state(struct net_bridge *br, struct br_mrp *mrp, 71 enum br_mrp_ring_state_type state); 72 int br_mrp_switchdev_send_ring_test(struct net_bridge *br, struct br_mrp *mrp, 73 u32 interval, u8 max_miss, u32 period, 74 bool monitor); 75 int br_mrp_port_switchdev_set_state(struct net_bridge_port *p, 76 enum br_mrp_port_state_type state); 77 int br_mrp_port_switchdev_set_role(struct net_bridge_port *p, 78 enum br_mrp_port_role_type role); 79 int br_mrp_switchdev_set_in_role(struct net_bridge *br, struct br_mrp *mrp, 80 u16 in_id, u32 ring_id, 81 enum br_mrp_in_role_type role); 82 int br_mrp_switchdev_set_in_state(struct net_bridge *br, struct br_mrp *mrp, 83 enum br_mrp_in_state_type state); 84 int br_mrp_switchdev_send_in_test(struct net_bridge *br, struct br_mrp *mrp, 85 u32 interval, u8 max_miss, u32 period); 86 87 /* br_mrp_netlink.c */ 88 int br_mrp_ring_port_open(struct net_device *dev, u8 loc); 89 int br_mrp_in_port_open(struct net_device *dev, u8 loc); 90 91 #endif /* _BR_PRIVATE_MRP_H */ 92