1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/if_ether.h>
6 #include <linux/types.h>
9 #define GARP_PROTOCOL_ID 0x1
10 #define GARP_END_MARK 0x0
20 enum garp_attr_event
{
29 struct garp_attr_hdr
{
39 static inline struct garp_skb_cb
*garp_cb(struct sk_buff
*skb
)
41 BUILD_BUG_ON(sizeof(struct garp_skb_cb
) >
42 sizeof_field(struct sk_buff
, cb
));
43 return (struct garp_skb_cb
*)skb
->cb
;
46 enum garp_applicant_state
{
47 GARP_APPLICANT_INVALID
,
60 #define GARP_APPLICANT_MAX (__GARP_APPLICANT_MAX - 1)
66 GARP_EVENT_R_JOIN_EMPTY
,
68 GARP_EVENT_R_LEAVE_IN
,
69 GARP_EVENT_R_LEAVE_EMPTY
,
70 GARP_EVENT_TRANSMIT_PDU
,
73 #define GARP_EVENT_MAX (__GARP_EVENT_MAX - 1)
77 GARP_ACTION_S_JOIN_IN
,
78 GARP_ACTION_S_LEAVE_EMPTY
,
83 enum garp_applicant_state state
;
89 enum garp_applications
{
90 GARP_APPLICATION_GVRP
,
91 __GARP_APPLICATION_MAX
93 #define GARP_APPLICATION_MAX (__GARP_APPLICATION_MAX - 1)
95 struct garp_application
{
96 enum garp_applications type
;
98 struct stp_proto proto
;
101 struct garp_applicant
{
102 struct garp_application
*app
;
103 struct net_device
*dev
;
104 struct timer_list join_timer
;
107 struct sk_buff_head queue
;
114 struct garp_applicant __rcu
*applicants
[GARP_APPLICATION_MAX
+ 1];
118 int garp_register_application(struct garp_application
*app
);
119 void garp_unregister_application(struct garp_application
*app
);
121 int garp_init_applicant(struct net_device
*dev
, struct garp_application
*app
);
122 void garp_uninit_applicant(struct net_device
*dev
,
123 struct garp_application
*app
);
125 int garp_request_join(const struct net_device
*dev
,
126 const struct garp_application
*app
, const void *data
,
128 void garp_request_leave(const struct net_device
*dev
,
129 const struct garp_application
*app
,
130 const void *data
, u8 len
, u8 type
);
132 #endif /* _NET_GARP_H */