xref: /openbmc/linux/net/bridge/br_private_mrp.h (revision 55fd7e02)
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 list_head		__rcu list;
12 
13 	struct net_bridge_port __rcu	*p_port;
14 	struct net_bridge_port __rcu	*s_port;
15 
16 	u32				ring_id;
17 	u16				prio;
18 
19 	enum br_mrp_ring_role_type	ring_role;
20 	u8				ring_role_offloaded;
21 	enum br_mrp_ring_state_type	ring_state;
22 	u32				ring_transitions;
23 
24 	struct delayed_work		test_work;
25 	u32				test_interval;
26 	unsigned long			test_end;
27 	u32				test_count_miss;
28 	u32				test_max_miss;
29 	bool				test_monitor;
30 
31 	u32				seq_id;
32 
33 	struct rcu_head			rcu;
34 };
35 
36 /* br_mrp.c */
37 int br_mrp_add(struct net_bridge *br, struct br_mrp_instance *instance);
38 int br_mrp_del(struct net_bridge *br, struct br_mrp_instance *instance);
39 int br_mrp_set_port_state(struct net_bridge_port *p,
40 			  enum br_mrp_port_state_type state);
41 int br_mrp_set_port_role(struct net_bridge_port *p,
42 			 enum br_mrp_port_role_type role);
43 int br_mrp_set_ring_state(struct net_bridge *br,
44 			  struct br_mrp_ring_state *state);
45 int br_mrp_set_ring_role(struct net_bridge *br, struct br_mrp_ring_role *role);
46 int br_mrp_start_test(struct net_bridge *br, struct br_mrp_start_test *test);
47 
48 /* br_mrp_switchdev.c */
49 int br_mrp_switchdev_add(struct net_bridge *br, struct br_mrp *mrp);
50 int br_mrp_switchdev_del(struct net_bridge *br, struct br_mrp *mrp);
51 int br_mrp_switchdev_set_ring_role(struct net_bridge *br, struct br_mrp *mrp,
52 				   enum br_mrp_ring_role_type role);
53 int br_mrp_switchdev_set_ring_state(struct net_bridge *br, struct br_mrp *mrp,
54 				    enum br_mrp_ring_state_type state);
55 int br_mrp_switchdev_send_ring_test(struct net_bridge *br, struct br_mrp *mrp,
56 				    u32 interval, u8 max_miss, u32 period,
57 				    bool monitor);
58 int br_mrp_port_switchdev_set_state(struct net_bridge_port *p,
59 				    enum br_mrp_port_state_type state);
60 int br_mrp_port_switchdev_set_role(struct net_bridge_port *p,
61 				   enum br_mrp_port_role_type role);
62 
63 /* br_mrp_netlink.c  */
64 int br_mrp_port_open(struct net_device *dev, u8 loc);
65 
66 #endif /* _BR_PRIVATE_MRP_H */
67