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