zram: use __bio_add_page for adding single page to bio
[linux-block.git] / net / batman-adv / multicast.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) B.A.T.M.A.N. contributors:
3  *
4  * Linus Lüssing
5  */
6
7 #ifndef _NET_BATMAN_ADV_MULTICAST_H_
8 #define _NET_BATMAN_ADV_MULTICAST_H_
9
10 #include "main.h"
11
12 #include <linux/netlink.h>
13 #include <linux/skbuff.h>
14
15 /**
16  * enum batadv_forw_mode - the way a packet should be forwarded as
17  */
18 enum batadv_forw_mode {
19         /**
20          * @BATADV_FORW_BCAST: forward the packet to all nodes via a batman-adv
21          *  broadcast packet
22          */
23         BATADV_FORW_BCAST,
24
25         /**
26          * @BATADV_FORW_UCASTS: forward the packet to some nodes via one
27          *  or more batman-adv unicast packets
28          */
29         BATADV_FORW_UCASTS,
30
31         /** @BATADV_FORW_NONE: don't forward, drop it */
32         BATADV_FORW_NONE,
33 };
34
35 #ifdef CONFIG_BATMAN_ADV_MCAST
36
37 enum batadv_forw_mode
38 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
39                        int *is_routable);
40
41 int batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,
42                            unsigned short vid, int is_routable);
43
44 void batadv_mcast_init(struct batadv_priv *bat_priv);
45
46 int batadv_mcast_mesh_info_put(struct sk_buff *msg,
47                                struct batadv_priv *bat_priv);
48
49 int batadv_mcast_flags_dump(struct sk_buff *msg, struct netlink_callback *cb);
50
51 void batadv_mcast_free(struct batadv_priv *bat_priv);
52
53 void batadv_mcast_purge_orig(struct batadv_orig_node *orig_node);
54
55 #else
56
57 static inline enum batadv_forw_mode
58 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
59                        int *is_routable)
60 {
61         return BATADV_FORW_BCAST;
62 }
63
64 static inline int
65 batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,
66                        unsigned short vid, int is_routable)
67 {
68         kfree_skb(skb);
69         return NET_XMIT_DROP;
70 }
71
72 static inline int batadv_mcast_init(struct batadv_priv *bat_priv)
73 {
74         return 0;
75 }
76
77 static inline int
78 batadv_mcast_mesh_info_put(struct sk_buff *msg, struct batadv_priv *bat_priv)
79 {
80         return 0;
81 }
82
83 static inline int batadv_mcast_flags_dump(struct sk_buff *msg,
84                                           struct netlink_callback *cb)
85 {
86         return -EOPNOTSUPP;
87 }
88
89 static inline void batadv_mcast_free(struct batadv_priv *bat_priv)
90 {
91 }
92
93 static inline void batadv_mcast_purge_orig(struct batadv_orig_node *orig_node)
94 {
95 }
96
97 #endif /* CONFIG_BATMAN_ADV_MCAST */
98
99 #endif /* _NET_BATMAN_ADV_MULTICAST_H_ */