PM / Domains: Validate cases of a non-bound driver in genpd governor
[linux/fpc-iii.git] / include / net / mrp.h
blob31912c3be772bfa5971e3f31a11f982cdd22ad2d
1 #ifndef _NET_MRP_H
2 #define _NET_MRP_H
4 #define MRP_END_MARK 0x0
6 struct mrp_pdu_hdr {
7 u8 version;
8 };
10 struct mrp_msg_hdr {
11 u8 attrtype;
12 u8 attrlen;
15 struct mrp_vecattr_hdr {
16 __be16 lenflags;
17 unsigned char firstattrvalue[];
18 #define MRP_VECATTR_HDR_LEN_MASK cpu_to_be16(0x1FFF)
19 #define MRP_VECATTR_HDR_FLAG_LA cpu_to_be16(0x2000)
22 enum mrp_vecattr_event {
23 MRP_VECATTR_EVENT_NEW,
24 MRP_VECATTR_EVENT_JOIN_IN,
25 MRP_VECATTR_EVENT_IN,
26 MRP_VECATTR_EVENT_JOIN_MT,
27 MRP_VECATTR_EVENT_MT,
28 MRP_VECATTR_EVENT_LV,
29 __MRP_VECATTR_EVENT_MAX
32 struct mrp_skb_cb {
33 struct mrp_msg_hdr *mh;
34 struct mrp_vecattr_hdr *vah;
35 unsigned char attrvalue[];
38 static inline struct mrp_skb_cb *mrp_cb(struct sk_buff *skb)
40 BUILD_BUG_ON(sizeof(struct mrp_skb_cb) >
41 FIELD_SIZEOF(struct sk_buff, cb));
42 return (struct mrp_skb_cb *)skb->cb;
45 enum mrp_applicant_state {
46 MRP_APPLICANT_INVALID,
47 MRP_APPLICANT_VO,
48 MRP_APPLICANT_VP,
49 MRP_APPLICANT_VN,
50 MRP_APPLICANT_AN,
51 MRP_APPLICANT_AA,
52 MRP_APPLICANT_QA,
53 MRP_APPLICANT_LA,
54 MRP_APPLICANT_AO,
55 MRP_APPLICANT_QO,
56 MRP_APPLICANT_AP,
57 MRP_APPLICANT_QP,
58 __MRP_APPLICANT_MAX
60 #define MRP_APPLICANT_MAX (__MRP_APPLICANT_MAX - 1)
62 enum mrp_event {
63 MRP_EVENT_NEW,
64 MRP_EVENT_JOIN,
65 MRP_EVENT_LV,
66 MRP_EVENT_TX,
67 MRP_EVENT_R_NEW,
68 MRP_EVENT_R_JOIN_IN,
69 MRP_EVENT_R_IN,
70 MRP_EVENT_R_JOIN_MT,
71 MRP_EVENT_R_MT,
72 MRP_EVENT_R_LV,
73 MRP_EVENT_R_LA,
74 MRP_EVENT_REDECLARE,
75 MRP_EVENT_PERIODIC,
76 __MRP_EVENT_MAX
78 #define MRP_EVENT_MAX (__MRP_EVENT_MAX - 1)
80 enum mrp_tx_action {
81 MRP_TX_ACTION_NONE,
82 MRP_TX_ACTION_S_NEW,
83 MRP_TX_ACTION_S_JOIN_IN,
84 MRP_TX_ACTION_S_JOIN_IN_OPTIONAL,
85 MRP_TX_ACTION_S_IN_OPTIONAL,
86 MRP_TX_ACTION_S_LV,
89 struct mrp_attr {
90 struct rb_node node;
91 enum mrp_applicant_state state;
92 u8 type;
93 u8 len;
94 unsigned char value[];
97 enum mrp_applications {
98 MRP_APPLICATION_MVRP,
99 __MRP_APPLICATION_MAX
101 #define MRP_APPLICATION_MAX (__MRP_APPLICATION_MAX - 1)
103 struct mrp_application {
104 enum mrp_applications type;
105 unsigned int maxattr;
106 struct packet_type pkttype;
107 unsigned char group_address[ETH_ALEN];
108 u8 version;
111 struct mrp_applicant {
112 struct mrp_application *app;
113 struct net_device *dev;
114 struct timer_list join_timer;
115 struct timer_list periodic_timer;
117 spinlock_t lock;
118 struct sk_buff_head queue;
119 struct sk_buff *pdu;
120 struct rb_root mad;
121 struct rcu_head rcu;
124 struct mrp_port {
125 struct mrp_applicant __rcu *applicants[MRP_APPLICATION_MAX + 1];
126 struct rcu_head rcu;
129 int mrp_register_application(struct mrp_application *app);
130 void mrp_unregister_application(struct mrp_application *app);
132 int mrp_init_applicant(struct net_device *dev, struct mrp_application *app);
133 void mrp_uninit_applicant(struct net_device *dev, struct mrp_application *app);
135 int mrp_request_join(const struct net_device *dev,
136 const struct mrp_application *app,
137 const void *value, u8 len, u8 type);
138 void mrp_request_leave(const struct net_device *dev,
139 const struct mrp_application *app,
140 const void *value, u8 len, u8 type);
142 #endif /* _NET_MRP_H */