1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #ifndef _BR_PRIVATE_MRP_H_
4 #define _BR_PRIVATE_MRP_H_
6 #include "br_private.h"
7 #include <uapi/linux/mrp_bridge.h>
10 /* list of mrp instances */
11 struct hlist_node list
;
13 struct net_bridge_port __rcu
*p_port
;
14 struct net_bridge_port __rcu
*s_port
;
15 struct net_bridge_port __rcu
*i_port
;
21 enum br_mrp_ring_role_type ring_role
;
22 u8 ring_role_offloaded
;
23 enum br_mrp_ring_state_type ring_state
;
26 enum br_mrp_in_role_type in_role
;
28 enum br_mrp_in_state_type in_state
;
31 struct delayed_work test_work
;
33 unsigned long test_end
;
38 struct delayed_work in_test_work
;
40 unsigned long in_test_end
;
41 u32 in_test_count_miss
;
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
);
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
,
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
);
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
);
91 #endif /* _BR_PRIVATE_MRP_H */