1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/netdevice.h>
6 #include <linux/skbuff.h>
7 #include <linux/types.h>
9 #define MRP_END_MARK 0x0
20 struct mrp_vecattr_hdr
{
22 unsigned char firstattrvalue
[];
23 #define MRP_VECATTR_HDR_LEN_MASK cpu_to_be16(0x1FFF)
24 #define MRP_VECATTR_HDR_FLAG_LA cpu_to_be16(0x2000)
27 enum mrp_vecattr_event
{
28 MRP_VECATTR_EVENT_NEW
,
29 MRP_VECATTR_EVENT_JOIN_IN
,
31 MRP_VECATTR_EVENT_JOIN_MT
,
34 __MRP_VECATTR_EVENT_MAX
38 struct mrp_msg_hdr
*mh
;
39 struct mrp_vecattr_hdr
*vah
;
40 unsigned char attrvalue
[];
43 static inline struct mrp_skb_cb
*mrp_cb(struct sk_buff
*skb
)
45 BUILD_BUG_ON(sizeof(struct mrp_skb_cb
) >
46 sizeof_field(struct sk_buff
, cb
));
47 return (struct mrp_skb_cb
*)skb
->cb
;
50 enum mrp_applicant_state
{
51 MRP_APPLICANT_INVALID
,
65 #define MRP_APPLICANT_MAX (__MRP_APPLICANT_MAX - 1)
83 #define MRP_EVENT_MAX (__MRP_EVENT_MAX - 1)
88 MRP_TX_ACTION_S_JOIN_IN
,
89 MRP_TX_ACTION_S_JOIN_IN_OPTIONAL
,
90 MRP_TX_ACTION_S_IN_OPTIONAL
,
96 enum mrp_applicant_state state
;
99 unsigned char value
[];
102 enum mrp_applications
{
103 MRP_APPLICATION_MVRP
,
104 __MRP_APPLICATION_MAX
106 #define MRP_APPLICATION_MAX (__MRP_APPLICATION_MAX - 1)
108 struct mrp_application
{
109 enum mrp_applications type
;
110 unsigned int maxattr
;
111 struct packet_type pkttype
;
112 unsigned char group_address
[ETH_ALEN
];
116 struct mrp_applicant
{
117 struct mrp_application
*app
;
118 struct net_device
*dev
;
119 struct timer_list join_timer
;
120 struct timer_list periodic_timer
;
123 struct sk_buff_head queue
;
131 struct mrp_applicant __rcu
*applicants
[MRP_APPLICATION_MAX
+ 1];
135 int mrp_register_application(struct mrp_application
*app
);
136 void mrp_unregister_application(struct mrp_application
*app
);
138 int mrp_init_applicant(struct net_device
*dev
, struct mrp_application
*app
);
139 void mrp_uninit_applicant(struct net_device
*dev
, struct mrp_application
*app
);
141 int mrp_request_join(const struct net_device
*dev
,
142 const struct mrp_application
*app
,
143 const void *value
, u8 len
, u8 type
);
144 void mrp_request_leave(const struct net_device
*dev
,
145 const struct mrp_application
*app
,
146 const void *value
, u8 len
, u8 type
);
148 #endif /* _NET_MRP_H */