1 /* SPDX-License-Identifier: GPL-2.0 */
5 #define MRP_END_MARK 0x0
16 struct mrp_vecattr_hdr {
18 unsigned char firstattrvalue[];
19 #define MRP_VECATTR_HDR_LEN_MASK cpu_to_be16(0x1FFF)
20 #define MRP_VECATTR_HDR_FLAG_LA cpu_to_be16(0x2000)
23 enum mrp_vecattr_event {
24 MRP_VECATTR_EVENT_NEW,
25 MRP_VECATTR_EVENT_JOIN_IN,
27 MRP_VECATTR_EVENT_JOIN_MT,
30 __MRP_VECATTR_EVENT_MAX
34 struct mrp_msg_hdr *mh;
35 struct mrp_vecattr_hdr *vah;
36 unsigned char attrvalue[];
39 static inline struct mrp_skb_cb *mrp_cb(struct sk_buff *skb)
41 BUILD_BUG_ON(sizeof(struct mrp_skb_cb) >
42 FIELD_SIZEOF(struct sk_buff, cb));
43 return (struct mrp_skb_cb *)skb->cb;
46 enum mrp_applicant_state {
47 MRP_APPLICANT_INVALID,
61 #define MRP_APPLICANT_MAX (__MRP_APPLICANT_MAX - 1)
79 #define MRP_EVENT_MAX (__MRP_EVENT_MAX - 1)
84 MRP_TX_ACTION_S_JOIN_IN,
85 MRP_TX_ACTION_S_JOIN_IN_OPTIONAL,
86 MRP_TX_ACTION_S_IN_OPTIONAL,
92 enum mrp_applicant_state state;
95 unsigned char value[];
98 enum mrp_applications {
100 __MRP_APPLICATION_MAX
102 #define MRP_APPLICATION_MAX (__MRP_APPLICATION_MAX - 1)
104 struct mrp_application {
105 enum mrp_applications type;
106 unsigned int maxattr;
107 struct packet_type pkttype;
108 unsigned char group_address[ETH_ALEN];
112 struct mrp_applicant {
113 struct mrp_application *app;
114 struct net_device *dev;
115 struct timer_list join_timer;
116 struct timer_list periodic_timer;
119 struct sk_buff_head queue;
126 struct mrp_applicant __rcu *applicants[MRP_APPLICATION_MAX + 1];
130 int mrp_register_application(struct mrp_application *app);
131 void mrp_unregister_application(struct mrp_application *app);
133 int mrp_init_applicant(struct net_device *dev, struct mrp_application *app);
134 void mrp_uninit_applicant(struct net_device *dev, struct mrp_application *app);
136 int mrp_request_join(const struct net_device *dev,
137 const struct mrp_application *app,
138 const void *value, u8 len, u8 type);
139 void mrp_request_leave(const struct net_device *dev,
140 const struct mrp_application *app,
141 const void *value, u8 len, u8 type);
143 #endif /* _NET_MRP_H */