Merge tag 'gpio-v5.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux...
[linux-2.6-block.git] / net / batman-adv / multicast.h
CommitLineData
7db7d9f3 1/* SPDX-License-Identifier: GPL-2.0 */
68e039f9 2/* Copyright (C) 2014-2020 B.A.T.M.A.N. contributors:
c5caf4ef
LL
3 *
4 * Linus Lüssing
c5caf4ef
LL
5 */
6
7#ifndef _NET_BATMAN_ADV_MULTICAST_H_
8#define _NET_BATMAN_ADV_MULTICAST_H_
9
1e2c2a4f
SE
10#include "main.h"
11
68a600de
SE
12#include <linux/netlink.h>
13#include <linux/seq_file.h>
14#include <linux/skbuff.h>
1e2c2a4f 15
1d8ab8d3 16/**
6f68b002 17 * enum batadv_forw_mode - the way a packet should be forwarded as
1d8ab8d3
LL
18 */
19enum batadv_forw_mode {
8b84cc4f
SE
20 /**
21 * @BATADV_FORW_ALL: forward the packet to all nodes (currently via
22 * classic flooding)
23 */
1d8ab8d3 24 BATADV_FORW_ALL,
8b84cc4f 25
32e72744
LL
26 /**
27 * @BATADV_FORW_SOME: forward the packet to some nodes (currently via
28 * a multicast-to-unicast conversion and the BATMAN unicast routing
29 * protocol)
30 */
31 BATADV_FORW_SOME,
32
8b84cc4f
SE
33 /**
34 * @BATADV_FORW_SINGLE: forward the packet to a single node (currently
35 * via the BATMAN unicast routing protocol)
36 */
1d8ab8d3 37 BATADV_FORW_SINGLE,
8b84cc4f
SE
38
39 /** @BATADV_FORW_NONE: don't forward, drop it */
1d8ab8d3
LL
40 BATADV_FORW_NONE,
41};
42
c5caf4ef
LL
43#ifdef CONFIG_BATMAN_ADV_MCAST
44
1d8ab8d3
LL
45enum batadv_forw_mode
46batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
47 struct batadv_orig_node **mcast_single_orig);
48
3236d215
LL
49int batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv,
50 struct sk_buff *skb,
51 unsigned short vid,
52 struct batadv_orig_node *orig_node);
53
32e72744
LL
54int batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,
55 unsigned short vid);
56
60432d75
LL
57void batadv_mcast_init(struct batadv_priv *bat_priv);
58
4e3e823b
LL
59int batadv_mcast_flags_seq_print_text(struct seq_file *seq, void *offset);
60
53dd9a68
LL
61int batadv_mcast_mesh_info_put(struct sk_buff *msg,
62 struct batadv_priv *bat_priv);
63
64int batadv_mcast_flags_dump(struct sk_buff *msg, struct netlink_callback *cb);
65
c5caf4ef
LL
66void batadv_mcast_free(struct batadv_priv *bat_priv);
67
60432d75
LL
68void batadv_mcast_purge_orig(struct batadv_orig_node *orig_node);
69
c5caf4ef
LL
70#else
71
1d8ab8d3
LL
72static inline enum batadv_forw_mode
73batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
74 struct batadv_orig_node **mcast_single_orig)
75{
76 return BATADV_FORW_ALL;
77}
78
3236d215
LL
79static inline int
80batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv,
81 struct sk_buff *skb,
82 unsigned short vid,
83 struct batadv_orig_node *orig_node)
84{
85 kfree_skb(skb);
86 return NET_XMIT_DROP;
87}
88
32e72744
LL
89static inline int
90batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,
91 unsigned short vid)
92{
93 kfree_skb(skb);
94 return NET_XMIT_DROP;
95}
96
60432d75
LL
97static inline int batadv_mcast_init(struct batadv_priv *bat_priv)
98{
99 return 0;
100}
101
53dd9a68
LL
102static inline int
103batadv_mcast_mesh_info_put(struct sk_buff *msg, struct batadv_priv *bat_priv)
104{
105 return 0;
106}
107
108static inline int batadv_mcast_flags_dump(struct sk_buff *msg,
109 struct netlink_callback *cb)
110{
111 return -EOPNOTSUPP;
112}
113
c5caf4ef
LL
114static inline void batadv_mcast_free(struct batadv_priv *bat_priv)
115{
c5caf4ef
LL
116}
117
60432d75
LL
118static inline void batadv_mcast_purge_orig(struct batadv_orig_node *orig_node)
119{
60432d75
LL
120}
121
c5caf4ef
LL
122#endif /* CONFIG_BATMAN_ADV_MCAST */
123
124#endif /* _NET_BATMAN_ADV_MULTICAST_H_ */