summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2017-12-02 13:51:53 -0500
committerSimon Wunderlich <sw@simonwunderlich.de>2017-12-15 11:29:24 -0500
commitff15c27c97303fbe5abc49c25c73ea299ab72d31 (patch)
treeec78240c800bdf7a1ef3322175c5648a9ffa6d41
parente57acf8e93fb65715af7595066d99d4c0c3f0235 (diff)
batman-adv: Add kernel-doc to externally visible functions
According to the kernel-doc documentation, externally visible functions should be documented. This refers to all all non-static function which can (and will) be used by functions in other sources files. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
-rw-r--r--net/batman-adv/bat_algo.c27
-rw-r--r--net/batman-adv/bat_iv_ogm.c5
-rw-r--r--net/batman-adv/debugfs.c16
-rw-r--r--net/batman-adv/gateway_client.c38
-rw-r--r--net/batman-adv/gateway_common.c9
-rw-r--r--net/batman-adv/hard-interface.c36
-rw-r--r--net/batman-adv/hash.c17
-rw-r--r--net/batman-adv/icmp_socket.c9
-rw-r--r--net/batman-adv/log.c17
-rw-r--r--net/batman-adv/main.c31
-rw-r--r--net/batman-adv/originator.c43
-rw-r--r--net/batman-adv/routing.c29
-rw-r--r--net/batman-adv/send.c18
-rw-r--r--net/batman-adv/soft-interface.c20
-rw-r--r--net/batman-adv/sysfs.c32
-rw-r--r--net/batman-adv/translation-table.c37
16 files changed, 381 insertions, 3 deletions
diff --git a/net/batman-adv/bat_algo.c b/net/batman-adv/bat_algo.c
index aed7ced059df..80c72c7d3cad 100644
--- a/net/batman-adv/bat_algo.c
+++ b/net/batman-adv/bat_algo.c
@@ -61,6 +61,12 @@ static struct batadv_algo_ops *batadv_algo_get(char *name)
61 return bat_algo_ops; 61 return bat_algo_ops;
62} 62}
63 63
64/**
65 * batadv_algo_register() - Register callbacks for a mesh algorithm
66 * @bat_algo_ops: mesh algorithm callbacks to add
67 *
68 * Return: 0 on success or negative error number in case of failure
69 */
64int batadv_algo_register(struct batadv_algo_ops *bat_algo_ops) 70int batadv_algo_register(struct batadv_algo_ops *bat_algo_ops)
65{ 71{
66 struct batadv_algo_ops *bat_algo_ops_tmp; 72 struct batadv_algo_ops *bat_algo_ops_tmp;
@@ -90,6 +96,19 @@ int batadv_algo_register(struct batadv_algo_ops *bat_algo_ops)
90 return 0; 96 return 0;
91} 97}
92 98
99/**
100 * batadv_algo_select() - Select algorithm of soft interface
101 * @bat_priv: the bat priv with all the soft interface information
102 * @name: name of the algorithm to select
103 *
104 * The algorithm callbacks for the soft interface will be set when the algorithm
105 * with the correct name was found. Any previous selected algorithm will not be
106 * deinitialized and the new selected algorithm will also not be initialized.
107 * It is therefore not allowed to call batadv_algo_select outside the creation
108 * function of the soft interface.
109 *
110 * Return: 0 on success or negative error number in case of failure
111 */
93int batadv_algo_select(struct batadv_priv *bat_priv, char *name) 112int batadv_algo_select(struct batadv_priv *bat_priv, char *name)
94{ 113{
95 struct batadv_algo_ops *bat_algo_ops; 114 struct batadv_algo_ops *bat_algo_ops;
@@ -104,6 +123,14 @@ int batadv_algo_select(struct batadv_priv *bat_priv, char *name)
104} 123}
105 124
106#ifdef CONFIG_BATMAN_ADV_DEBUGFS 125#ifdef CONFIG_BATMAN_ADV_DEBUGFS
126
127/**
128 * batadv_algo_seq_print_text() - Print the supported algorithms in a seq file
129 * @seq: seq file to print on
130 * @offset: not used
131 *
132 * Return: always 0
133 */
107int batadv_algo_seq_print_text(struct seq_file *seq, void *offset) 134int batadv_algo_seq_print_text(struct seq_file *seq, void *offset)
108{ 135{
109 struct batadv_algo_ops *bat_algo_ops; 136 struct batadv_algo_ops *bat_algo_ops;
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 0973e8c5a063..c9955f29a2bf 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -2853,6 +2853,11 @@ static struct batadv_algo_ops batadv_batman_iv __read_mostly = {
2853 }, 2853 },
2854}; 2854};
2855 2855
2856/**
2857 * batadv_iv_init() - B.A.T.M.A.N. IV initialization function
2858 *
2859 * Return: 0 on success or negative error number in case of failure
2860 */
2856int __init batadv_iv_init(void) 2861int __init batadv_iv_init(void)
2857{ 2862{
2858 int ret; 2863 int ret;
diff --git a/net/batman-adv/debugfs.c b/net/batman-adv/debugfs.c
index 97d6eb45cbf2..21d1189957a7 100644
--- a/net/batman-adv/debugfs.c
+++ b/net/batman-adv/debugfs.c
@@ -259,6 +259,9 @@ static struct batadv_debuginfo *batadv_hardif_debuginfos[] = {
259 NULL, 259 NULL,
260}; 260};
261 261
262/**
263 * batadv_debugfs_init() - Initialize soft interface independent debugfs entries
264 */
262void batadv_debugfs_init(void) 265void batadv_debugfs_init(void)
263{ 266{
264 struct batadv_debuginfo **bat_debug; 267 struct batadv_debuginfo **bat_debug;
@@ -289,6 +292,9 @@ err:
289 batadv_debugfs = NULL; 292 batadv_debugfs = NULL;
290} 293}
291 294
295/**
296 * batadv_debugfs_destroy() - Remove all debugfs entries
297 */
292void batadv_debugfs_destroy(void) 298void batadv_debugfs_destroy(void)
293{ 299{
294 debugfs_remove_recursive(batadv_debugfs); 300 debugfs_remove_recursive(batadv_debugfs);
@@ -355,6 +361,12 @@ void batadv_debugfs_del_hardif(struct batadv_hard_iface *hard_iface)
355 } 361 }
356} 362}
357 363
364/**
365 * batadv_debugfs_add_meshif() - Initialize interface dependent debugfs entries
366 * @dev: netdev struct of the soft interface
367 *
368 * Return: 0 on success or negative error number in case of failure
369 */
358int batadv_debugfs_add_meshif(struct net_device *dev) 370int batadv_debugfs_add_meshif(struct net_device *dev)
359{ 371{
360 struct batadv_priv *bat_priv = netdev_priv(dev); 372 struct batadv_priv *bat_priv = netdev_priv(dev);
@@ -401,6 +413,10 @@ out:
401 return -ENOMEM; 413 return -ENOMEM;
402} 414}
403 415
416/**
417 * batadv_debugfs_del_meshif() - Remove interface dependent debugfs entries
418 * @dev: netdev struct of the soft interface
419 */
404void batadv_debugfs_del_meshif(struct net_device *dev) 420void batadv_debugfs_del_meshif(struct net_device *dev)
405{ 421{
406 struct batadv_priv *bat_priv = netdev_priv(dev); 422 struct batadv_priv *bat_priv = netdev_priv(dev);
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 6731f7dabeb9..2488e25d0eef 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -93,6 +93,12 @@ void batadv_gw_node_put(struct batadv_gw_node *gw_node)
93 kref_put(&gw_node->refcount, batadv_gw_node_release); 93 kref_put(&gw_node->refcount, batadv_gw_node_release);
94} 94}
95 95
96/**
97 * batadv_gw_get_selected_gw_node() - Get currently selected gateway
98 * @bat_priv: the bat priv with all the soft interface information
99 *
100 * Return: selected gateway (with increased refcnt), NULL on errors
101 */
96struct batadv_gw_node * 102struct batadv_gw_node *
97batadv_gw_get_selected_gw_node(struct batadv_priv *bat_priv) 103batadv_gw_get_selected_gw_node(struct batadv_priv *bat_priv)
98{ 104{
@@ -111,6 +117,12 @@ out:
111 return gw_node; 117 return gw_node;
112} 118}
113 119
120/**
121 * batadv_gw_get_selected_orig() - Get originator of currently selected gateway
122 * @bat_priv: the bat priv with all the soft interface information
123 *
124 * Return: orig_node of selected gateway (with increased refcnt), NULL on errors
125 */
114struct batadv_orig_node * 126struct batadv_orig_node *
115batadv_gw_get_selected_orig(struct batadv_priv *bat_priv) 127batadv_gw_get_selected_orig(struct batadv_priv *bat_priv)
116{ 128{
@@ -204,6 +216,10 @@ void batadv_gw_check_client_stop(struct batadv_priv *bat_priv)
204 batadv_gw_node_put(curr_gw); 216 batadv_gw_node_put(curr_gw);
205} 217}
206 218
219/**
220 * batadv_gw_election() - Elect the best gateway
221 * @bat_priv: the bat priv with all the soft interface information
222 */
207void batadv_gw_election(struct batadv_priv *bat_priv) 223void batadv_gw_election(struct batadv_priv *bat_priv)
208{ 224{
209 struct batadv_gw_node *curr_gw = NULL; 225 struct batadv_gw_node *curr_gw = NULL;
@@ -292,6 +308,11 @@ out:
292 batadv_neigh_ifinfo_put(router_ifinfo); 308 batadv_neigh_ifinfo_put(router_ifinfo);
293} 309}
294 310
311/**
312 * batadv_gw_check_election() - Elect orig node as best gateway when eligible
313 * @bat_priv: the bat priv with all the soft interface information
314 * @orig_node: orig node which is to be checked
315 */
295void batadv_gw_check_election(struct batadv_priv *bat_priv, 316void batadv_gw_check_election(struct batadv_priv *bat_priv,
296 struct batadv_orig_node *orig_node) 317 struct batadv_orig_node *orig_node)
297{ 318{
@@ -460,6 +481,11 @@ out:
460 batadv_gw_node_put(gw_node); 481 batadv_gw_node_put(gw_node);
461} 482}
462 483
484/**
485 * batadv_gw_node_delete() - Remove orig_node from gateway list
486 * @bat_priv: the bat priv with all the soft interface information
487 * @orig_node: orig node which is currently in process of being removed
488 */
463void batadv_gw_node_delete(struct batadv_priv *bat_priv, 489void batadv_gw_node_delete(struct batadv_priv *bat_priv,
464 struct batadv_orig_node *orig_node) 490 struct batadv_orig_node *orig_node)
465{ 491{
@@ -471,6 +497,10 @@ void batadv_gw_node_delete(struct batadv_priv *bat_priv,
471 batadv_gw_node_update(bat_priv, orig_node, &gateway); 497 batadv_gw_node_update(bat_priv, orig_node, &gateway);
472} 498}
473 499
500/**
501 * batadv_gw_node_free() - Free gateway information from soft interface
502 * @bat_priv: the bat priv with all the soft interface information
503 */
474void batadv_gw_node_free(struct batadv_priv *bat_priv) 504void batadv_gw_node_free(struct batadv_priv *bat_priv)
475{ 505{
476 struct batadv_gw_node *gw_node; 506 struct batadv_gw_node *gw_node;
@@ -486,6 +516,14 @@ void batadv_gw_node_free(struct batadv_priv *bat_priv)
486} 516}
487 517
488#ifdef CONFIG_BATMAN_ADV_DEBUGFS 518#ifdef CONFIG_BATMAN_ADV_DEBUGFS
519
520/**
521 * batadv_gw_client_seq_print_text() - Print the gateway table in a seq file
522 * @seq: seq file to print on
523 * @offset: not used
524 *
525 * Return: always 0
526 */
489int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset) 527int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
490{ 528{
491 struct net_device *net_dev = (struct net_device *)seq->private; 529 struct net_device *net_dev = (struct net_device *)seq->private;
diff --git a/net/batman-adv/gateway_common.c b/net/batman-adv/gateway_common.c
index 1c58727835ca..83bfeecf661c 100644
--- a/net/batman-adv/gateway_common.c
+++ b/net/batman-adv/gateway_common.c
@@ -165,6 +165,15 @@ void batadv_gw_tvlv_container_update(struct batadv_priv *bat_priv)
165 } 165 }
166} 166}
167 167
168/**
169 * batadv_gw_bandwidth_set() - Parse and set download/upload gateway bandwidth
170 * from supplied string buffer
171 * @net_dev: netdev struct of the soft interface
172 * @buff: the buffer containing the user data
173 * @count: number of bytes in the buffer
174 *
175 * Return: 'count' on success or a negative error code in case of failure
176 */
168ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff, 177ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff,
169 size_t count) 178 size_t count)
170{ 179{
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 33425a022026..13d04dba0b3a 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -67,6 +67,12 @@ void batadv_hardif_release(struct kref *ref)
67 kfree_rcu(hard_iface, rcu); 67 kfree_rcu(hard_iface, rcu);
68} 68}
69 69
70/**
71 * batadv_hardif_get_by_netdev() - Get hard interface object of a net_device
72 * @net_dev: net_device to search for
73 *
74 * Return: batadv_hard_iface of net_dev (with increased refcnt), NULL on errors
75 */
70struct batadv_hard_iface * 76struct batadv_hard_iface *
71batadv_hardif_get_by_netdev(const struct net_device *net_dev) 77batadv_hardif_get_by_netdev(const struct net_device *net_dev)
72{ 78{
@@ -561,6 +567,13 @@ static void batadv_hardif_recalc_extra_skbroom(struct net_device *soft_iface)
561 soft_iface->needed_tailroom = lower_tailroom; 567 soft_iface->needed_tailroom = lower_tailroom;
562} 568}
563 569
570/**
571 * batadv_hardif_min_mtu() - Calculate maximum MTU for soft interface
572 * @soft_iface: netdev struct of the soft interface
573 *
574 * Return: MTU for the soft-interface (limited by the minimal MTU of all active
575 * slave interfaces)
576 */
564int batadv_hardif_min_mtu(struct net_device *soft_iface) 577int batadv_hardif_min_mtu(struct net_device *soft_iface)
565{ 578{
566 struct batadv_priv *bat_priv = netdev_priv(soft_iface); 579 struct batadv_priv *bat_priv = netdev_priv(soft_iface);
@@ -607,7 +620,11 @@ out:
607 return min_t(int, min_mtu - batadv_max_header_len(), ETH_DATA_LEN); 620 return min_t(int, min_mtu - batadv_max_header_len(), ETH_DATA_LEN);
608} 621}
609 622
610/* adjusts the MTU if a new interface with a smaller MTU appeared. */ 623/**
624 * batadv_update_min_mtu() - Adjusts the MTU if a new interface with a smaller
625 * MTU appeared
626 * @soft_iface: netdev struct of the soft interface
627 */
611void batadv_update_min_mtu(struct net_device *soft_iface) 628void batadv_update_min_mtu(struct net_device *soft_iface)
612{ 629{
613 soft_iface->mtu = batadv_hardif_min_mtu(soft_iface); 630 soft_iface->mtu = batadv_hardif_min_mtu(soft_iface);
@@ -692,6 +709,14 @@ static int batadv_master_del_slave(struct batadv_hard_iface *slave,
692 return ret; 709 return ret;
693} 710}
694 711
712/**
713 * batadv_hardif_enable_interface() - Enslave hard interface to soft interface
714 * @hard_iface: hard interface to add to soft interface
715 * @net: the applicable net namespace
716 * @iface_name: name of the soft interface
717 *
718 * Return: 0 on success or negative error number in case of failure
719 */
695int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, 720int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
696 struct net *net, const char *iface_name) 721 struct net *net, const char *iface_name)
697{ 722{
@@ -803,6 +828,12 @@ err:
803 return ret; 828 return ret;
804} 829}
805 830
831/**
832 * batadv_hardif_disable_interface() - Remove hard interface from soft interface
833 * @hard_iface: hard interface to be removed
834 * @autodel: whether to delete soft interface when it doesn't contain any other
835 * slave interfaces
836 */
806void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface, 837void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
807 enum batadv_hard_if_cleanup autodel) 838 enum batadv_hard_if_cleanup autodel)
808{ 839{
@@ -937,6 +968,9 @@ static void batadv_hardif_remove_interface(struct batadv_hard_iface *hard_iface)
937 batadv_hardif_put(hard_iface); 968 batadv_hardif_put(hard_iface);
938} 969}
939 970
971/**
972 * batadv_hardif_remove_interfaces() - Remove all hard interfaces
973 */
940void batadv_hardif_remove_interfaces(void) 974void batadv_hardif_remove_interfaces(void)
941{ 975{
942 struct batadv_hard_iface *hard_iface, *hard_iface_tmp; 976 struct batadv_hard_iface *hard_iface, *hard_iface_tmp;
diff --git a/net/batman-adv/hash.c b/net/batman-adv/hash.c
index 2ce0d5673f40..04d964358c98 100644
--- a/net/batman-adv/hash.c
+++ b/net/batman-adv/hash.c
@@ -34,7 +34,10 @@ static void batadv_hash_init(struct batadv_hashtable *hash)
34 } 34 }
35} 35}
36 36
37/* free only the hashtable and the hash itself. */ 37/**
38 * batadv_hash_destroy() - Free only the hashtable and the hash itself
39 * @hash: hash object to destroy
40 */
38void batadv_hash_destroy(struct batadv_hashtable *hash) 41void batadv_hash_destroy(struct batadv_hashtable *hash)
39{ 42{
40 kfree(hash->list_locks); 43 kfree(hash->list_locks);
@@ -42,7 +45,12 @@ void batadv_hash_destroy(struct batadv_hashtable *hash)
42 kfree(hash); 45 kfree(hash);
43} 46}
44 47
45/* allocates and clears the hash */ 48/**
49 * batadv_hash_new() - Allocates and clears the hashtable
50 * @size: number of hash buckets to allocate
51 *
52 * Return: newly allocated hashtable, NULL on errors
53 */
46struct batadv_hashtable *batadv_hash_new(u32 size) 54struct batadv_hashtable *batadv_hash_new(u32 size)
47{ 55{
48 struct batadv_hashtable *hash; 56 struct batadv_hashtable *hash;
@@ -71,6 +79,11 @@ free_hash:
71 return NULL; 79 return NULL;
72} 80}
73 81
82/**
83 * batadv_hash_set_lock_class() - Set specific lockdep class for hash spinlocks
84 * @hash: hash object to modify
85 * @key: lockdep class key address
86 */
74void batadv_hash_set_lock_class(struct batadv_hashtable *hash, 87void batadv_hash_set_lock_class(struct batadv_hashtable *hash,
75 struct lock_class_key *key) 88 struct lock_class_key *key)
76{ 89{
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c
index 8af5d30e59b1..f2ef75b7fa73 100644
--- a/net/batman-adv/icmp_socket.c
+++ b/net/batman-adv/icmp_socket.c
@@ -57,6 +57,9 @@ static void batadv_socket_add_packet(struct batadv_socket_client *socket_client,
57 struct batadv_icmp_header *icmph, 57 struct batadv_icmp_header *icmph,
58 size_t icmp_len); 58 size_t icmp_len);
59 59
60/**
61 * batadv_socket_init() - Initialize soft interface independent socket data
62 */
60void batadv_socket_init(void) 63void batadv_socket_init(void)
61{ 64{
62 memset(batadv_socket_client_hash, 0, sizeof(batadv_socket_client_hash)); 65 memset(batadv_socket_client_hash, 0, sizeof(batadv_socket_client_hash));
@@ -316,6 +319,12 @@ static const struct file_operations batadv_fops = {
316 .llseek = no_llseek, 319 .llseek = no_llseek,
317}; 320};
318 321
322/**
323 * batadv_socket_setup() - Create debugfs "socket" file
324 * @bat_priv: the bat priv with all the soft interface information
325 *
326 * Return: 0 on success or negative error number in case of failure
327 */
319int batadv_socket_setup(struct batadv_priv *bat_priv) 328int batadv_socket_setup(struct batadv_priv *bat_priv)
320{ 329{
321 struct dentry *d; 330 struct dentry *d;
diff --git a/net/batman-adv/log.c b/net/batman-adv/log.c
index 6fbcdd40a332..da004980ab8b 100644
--- a/net/batman-adv/log.c
+++ b/net/batman-adv/log.c
@@ -88,6 +88,13 @@ static int batadv_fdebug_log(struct batadv_priv_debug_log *debug_log,
88 return 0; 88 return 0;
89} 89}
90 90
91/**
92 * batadv_debug_log() - Add debug log entry
93 * @bat_priv: the bat priv with all the soft interface information
94 * @fmt: format string
95 *
96 * Return: 0 on success or negative error number in case of failure
97 */
91int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...) 98int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...)
92{ 99{
93 va_list args; 100 va_list args;
@@ -199,6 +206,12 @@ static const struct file_operations batadv_log_fops = {
199 .llseek = no_llseek, 206 .llseek = no_llseek,
200}; 207};
201 208
209/**
210 * batadv_debug_log_setup() - Initialize debug log
211 * @bat_priv: the bat priv with all the soft interface information
212 *
213 * Return: 0 on success or negative error number in case of failure
214 */
202int batadv_debug_log_setup(struct batadv_priv *bat_priv) 215int batadv_debug_log_setup(struct batadv_priv *bat_priv)
203{ 216{
204 struct dentry *d; 217 struct dentry *d;
@@ -224,6 +237,10 @@ err:
224 return -ENOMEM; 237 return -ENOMEM;
225} 238}
226 239
240/**
241 * batadv_debug_log_cleanup() - Destroy debug log
242 * @bat_priv: the bat priv with all the soft interface information
243 */
227void batadv_debug_log_cleanup(struct batadv_priv *bat_priv) 244void batadv_debug_log_cleanup(struct batadv_priv *bat_priv)
228{ 245{
229 kfree(bat_priv->debug_log); 246 kfree(bat_priv->debug_log);
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index e6e1f5eae494..8bee4279d579 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -140,6 +140,12 @@ static void __exit batadv_exit(void)
140 batadv_tt_cache_destroy(); 140 batadv_tt_cache_destroy();
141} 141}
142 142
143/**
144 * batadv_mesh_init() - Initialize soft interface
145 * @soft_iface: netdev struct of the soft interface
146 *
147 * Return: 0 on success or negative error number in case of failure
148 */
143int batadv_mesh_init(struct net_device *soft_iface) 149int batadv_mesh_init(struct net_device *soft_iface)
144{ 150{
145 struct batadv_priv *bat_priv = netdev_priv(soft_iface); 151 struct batadv_priv *bat_priv = netdev_priv(soft_iface);
@@ -217,6 +223,10 @@ err:
217 return ret; 223 return ret;
218} 224}
219 225
226/**
227 * batadv_mesh_free() - Deinitialize soft interface
228 * @soft_iface: netdev struct of the soft interface
229 */
220void batadv_mesh_free(struct net_device *soft_iface) 230void batadv_mesh_free(struct net_device *soft_iface)
221{ 231{
222 struct batadv_priv *bat_priv = netdev_priv(soft_iface); 232 struct batadv_priv *bat_priv = netdev_priv(soft_iface);
@@ -413,6 +423,16 @@ static int batadv_recv_unhandled_packet(struct sk_buff *skb,
413/* incoming packets with the batman ethertype received on any active hard 423/* incoming packets with the batman ethertype received on any active hard
414 * interface 424 * interface
415 */ 425 */
426
427/**
428 * batadv_batman_skb_recv() - Handle incoming message from an hard interface
429 * @skb: the received packet
430 * @dev: the net device that the packet was received on
431 * @ptype: packet type of incoming packet (ETH_P_BATMAN)
432 * @orig_dev: the original receive net device (e.g. bonded device)
433 *
434 * Return: NET_RX_SUCCESS on success or NET_RX_DROP in case of failure
435 */
416int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev, 436int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
417 struct packet_type *ptype, 437 struct packet_type *ptype,
418 struct net_device *orig_dev) 438 struct net_device *orig_dev)
@@ -536,6 +556,13 @@ static void batadv_recv_handler_init(void)
536 batadv_rx_handler[BATADV_UNICAST_FRAG] = batadv_recv_frag_packet; 556 batadv_rx_handler[BATADV_UNICAST_FRAG] = batadv_recv_frag_packet;
537} 557}
538 558
559/**
560 * batadv_recv_handler_register() - Register handler for batman-adv packet type
561 * @packet_type: batadv_packettype which should be handled
562 * @recv_handler: receive handler for the packet type
563 *
564 * Return: 0 on success or negative error number in case of failure
565 */
539int 566int
540batadv_recv_handler_register(u8 packet_type, 567batadv_recv_handler_register(u8 packet_type,
541 int (*recv_handler)(struct sk_buff *, 568 int (*recv_handler)(struct sk_buff *,
@@ -553,6 +580,10 @@ batadv_recv_handler_register(u8 packet_type,
553 return 0; 580 return 0;
554} 581}
555 582
583/**
584 * batadv_recv_handler_unregister() - Unregister handler for packet type
585 * @packet_type: batadv_packettype which should no longer be handled
586 */
556void batadv_recv_handler_unregister(u8 packet_type) 587void batadv_recv_handler_unregister(u8 packet_type)
557{ 588{
558 batadv_rx_handler[packet_type] = batadv_recv_unhandled_packet; 589 batadv_rx_handler[packet_type] = batadv_recv_unhandled_packet;
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 412a603b2fda..58a7d9274435 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -58,6 +58,13 @@
58/* hash class keys */ 58/* hash class keys */
59static struct lock_class_key batadv_orig_hash_lock_class_key; 59static struct lock_class_key batadv_orig_hash_lock_class_key;
60 60
61/**
62 * batadv_orig_hash_find() - Find and return originator from orig_hash
63 * @bat_priv: the bat priv with all the soft interface information
64 * @data: mac address of the originator
65 *
66 * Return: orig_node (with increased refcnt), NULL on errors
67 */
61struct batadv_orig_node * 68struct batadv_orig_node *
62batadv_orig_hash_find(struct batadv_priv *bat_priv, const void *data) 69batadv_orig_hash_find(struct batadv_priv *bat_priv, const void *data)
63{ 70{
@@ -201,6 +208,12 @@ void batadv_orig_node_vlan_put(struct batadv_orig_node_vlan *orig_vlan)
201 kref_put(&orig_vlan->refcount, batadv_orig_node_vlan_release); 208 kref_put(&orig_vlan->refcount, batadv_orig_node_vlan_release);
202} 209}
203 210
211/**
212 * batadv_originator_init() - Initialize all originator structures
213 * @bat_priv: the bat priv with all the soft interface information
214 *
215 * Return: 0 on success or negative error number in case of failure
216 */
204int batadv_originator_init(struct batadv_priv *bat_priv) 217int batadv_originator_init(struct batadv_priv *bat_priv)
205{ 218{
206 if (bat_priv->orig_hash) 219 if (bat_priv->orig_hash)
@@ -959,6 +972,10 @@ void batadv_orig_node_put(struct batadv_orig_node *orig_node)
959 kref_put(&orig_node->refcount, batadv_orig_node_release); 972 kref_put(&orig_node->refcount, batadv_orig_node_release);
960} 973}
961 974
975/**
976 * batadv_originator_free() - Free all originator structures
977 * @bat_priv: the bat priv with all the soft interface information
978 */
962void batadv_originator_free(struct batadv_priv *bat_priv) 979void batadv_originator_free(struct batadv_priv *bat_priv)
963{ 980{
964 struct batadv_hashtable *hash = bat_priv->orig_hash; 981 struct batadv_hashtable *hash = bat_priv->orig_hash;
@@ -1374,12 +1391,24 @@ static void batadv_purge_orig(struct work_struct *work)
1374 msecs_to_jiffies(BATADV_ORIG_WORK_PERIOD)); 1391 msecs_to_jiffies(BATADV_ORIG_WORK_PERIOD));
1375} 1392}
1376 1393
1394/**
1395 * batadv_purge_orig_ref() - Purge all outdated originators
1396 * @bat_priv: the bat priv with all the soft interface information
1397 */
1377void batadv_purge_orig_ref(struct batadv_priv *bat_priv) 1398void batadv_purge_orig_ref(struct batadv_priv *bat_priv)
1378{ 1399{
1379 _batadv_purge_orig(bat_priv); 1400 _batadv_purge_orig(bat_priv);
1380} 1401}
1381 1402
1382#ifdef CONFIG_BATMAN_ADV_DEBUGFS 1403#ifdef CONFIG_BATMAN_ADV_DEBUGFS
1404
1405/**
1406 * batadv_orig_seq_print_text() - Print the originator table in a seq file
1407 * @seq: seq file to print on
1408 * @offset: not used
1409 *
1410 * Return: always 0
1411 */
1383int batadv_orig_seq_print_text(struct seq_file *seq, void *offset) 1412int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
1384{ 1413{
1385 struct net_device *net_dev = (struct net_device *)seq->private; 1414 struct net_device *net_dev = (struct net_device *)seq->private;
@@ -1532,6 +1561,13 @@ int batadv_orig_dump(struct sk_buff *msg, struct netlink_callback *cb)
1532 return ret; 1561 return ret;
1533} 1562}
1534 1563
1564/**
1565 * batadv_orig_hash_add_if() - Add interface to originators in orig_hash
1566 * @hard_iface: hard interface to add (already slave of the soft interface)
1567 * @max_if_num: new number of interfaces
1568 *
1569 * Return: 0 on success or negative error number in case of failure
1570 */
1535int batadv_orig_hash_add_if(struct batadv_hard_iface *hard_iface, 1571int batadv_orig_hash_add_if(struct batadv_hard_iface *hard_iface,
1536 int max_if_num) 1572 int max_if_num)
1537{ 1573{
@@ -1567,6 +1603,13 @@ err:
1567 return -ENOMEM; 1603 return -ENOMEM;
1568} 1604}
1569 1605
1606/**
1607 * batadv_orig_hash_del_if() - Remove interface from originators in orig_hash
1608 * @hard_iface: hard interface to remove (still slave of the soft interface)
1609 * @max_if_num: new number of interfaces
1610 *
1611 * Return: 0 on success or negative error number in case of failure
1612 */
1570int batadv_orig_hash_del_if(struct batadv_hard_iface *hard_iface, 1613int batadv_orig_hash_del_if(struct batadv_hard_iface *hard_iface,
1571 int max_if_num) 1614 int max_if_num)
1572{ 1615{
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 01820be4ae5a..eb835bde502a 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -181,6 +181,14 @@ bool batadv_window_protected(struct batadv_priv *bat_priv, s32 seq_num_diff,
181 return false; 181 return false;
182} 182}
183 183
184/**
185 * batadv_check_management_packet() - Check preconditions for management packets
186 * @skb: incoming packet buffer
187 * @hard_iface: incoming hard interface
188 * @header_len: minimal header length of packet type
189 *
190 * Return: true when management preconditions are met, false otherwise
191 */
184bool batadv_check_management_packet(struct sk_buff *skb, 192bool batadv_check_management_packet(struct sk_buff *skb,
185 struct batadv_hard_iface *hard_iface, 193 struct batadv_hard_iface *hard_iface,
186 int header_len) 194 int header_len)
@@ -348,6 +356,13 @@ out:
348 return ret; 356 return ret;
349} 357}
350 358
359/**
360 * batadv_recv_icmp_packet() - Process incoming icmp packet
361 * @skb: incoming packet buffer
362 * @recv_if: incoming hard interface
363 *
364 * Return: NET_RX_SUCCESS on success or NET_RX_DROP in case of failure
365 */
351int batadv_recv_icmp_packet(struct sk_buff *skb, 366int batadv_recv_icmp_packet(struct sk_buff *skb,
352 struct batadv_hard_iface *recv_if) 367 struct batadv_hard_iface *recv_if)
353{ 368{
@@ -936,6 +951,13 @@ free_skb:
936 return NET_RX_DROP; 951 return NET_RX_DROP;
937} 952}
938 953
954/**
955 * batadv_recv_unicast_packet() - Process incoming unicast packet
956 * @skb: incoming packet buffer
957 * @recv_if: incoming hard interface
958 *
959 * Return: NET_RX_SUCCESS on success or NET_RX_DROP in case of failure
960 */
939int batadv_recv_unicast_packet(struct sk_buff *skb, 961int batadv_recv_unicast_packet(struct sk_buff *skb,
940 struct batadv_hard_iface *recv_if) 962 struct batadv_hard_iface *recv_if)
941{ 963{
@@ -1156,6 +1178,13 @@ free_skb:
1156 return ret; 1178 return ret;
1157} 1179}
1158 1180
1181/**
1182 * batadv_recv_bcast_packet() - Process incoming broadcast packet
1183 * @skb: incoming packet buffer
1184 * @recv_if: incoming hard interface
1185 *
1186 * Return: NET_RX_SUCCESS on success or NET_RX_DROP in case of failure
1187 */
1159int batadv_recv_bcast_packet(struct sk_buff *skb, 1188int batadv_recv_bcast_packet(struct sk_buff *skb,
1160 struct batadv_hard_iface *recv_if) 1189 struct batadv_hard_iface *recv_if)
1161{ 1190{
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index 0700b3dfb595..2a5ab6f1076d 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -124,12 +124,30 @@ send_skb_err:
124 return NET_XMIT_DROP; 124 return NET_XMIT_DROP;
125} 125}
126 126
127/**
128 * batadv_send_broadcast_skb() - Send broadcast packet via hard interface
129 * @skb: packet to be transmitted (with batadv header and no outer eth header)
130 * @hard_iface: outgoing interface
131 *
132 * Return: A negative errno code is returned on a failure. A success does not
133 * guarantee the frame will be transmitted as it may be dropped due
134 * to congestion or traffic shaping.
135 */
127int batadv_send_broadcast_skb(struct sk_buff *skb, 136int batadv_send_broadcast_skb(struct sk_buff *skb,
128 struct batadv_hard_iface *hard_iface) 137 struct batadv_hard_iface *hard_iface)
129{ 138{
130 return batadv_send_skb_packet(skb, hard_iface, batadv_broadcast_addr); 139 return batadv_send_skb_packet(skb, hard_iface, batadv_broadcast_addr);
131} 140}
132 141
142/**
143 * batadv_send_unicast_skb() - Send unicast packet to neighbor
144 * @skb: packet to be transmitted (with batadv header and no outer eth header)
145 * @neigh: neighbor which is used as next hop to destination
146 *
147 * Return: A negative errno code is returned on a failure. A success does not
148 * guarantee the frame will be transmitted as it may be dropped due
149 * to congestion or traffic shaping.
150 */
133int batadv_send_unicast_skb(struct sk_buff *skb, 151int batadv_send_unicast_skb(struct sk_buff *skb,
134 struct batadv_neigh_node *neigh) 152 struct batadv_neigh_node *neigh)
135{ 153{
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 9b66e0edc741..1eb5555c5fe4 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -65,6 +65,13 @@
65#include "sysfs.h" 65#include "sysfs.h"
66#include "translation-table.h" 66#include "translation-table.h"
67 67
68/**
69 * batadv_skb_head_push() - Increase header size and move (push) head pointer
70 * @skb: packet buffer which should be modified
71 * @len: number of bytes to add
72 *
73 * Return: 0 on success or negative error number in case of failure
74 */
68int batadv_skb_head_push(struct sk_buff *skb, unsigned int len) 75int batadv_skb_head_push(struct sk_buff *skb, unsigned int len)
69{ 76{
70 int result; 77 int result;
@@ -1064,6 +1071,13 @@ static void batadv_softif_init_early(struct net_device *dev)
1064 dev->ethtool_ops = &batadv_ethtool_ops; 1071 dev->ethtool_ops = &batadv_ethtool_ops;
1065} 1072}
1066 1073
1074/**
1075 * batadv_softif_create() - Create and register soft interface
1076 * @net: the applicable net namespace
1077 * @name: name of the new soft interface
1078 *
1079 * Return: newly allocated soft_interface, NULL on errors
1080 */
1067struct net_device *batadv_softif_create(struct net *net, const char *name) 1081struct net_device *batadv_softif_create(struct net *net, const char *name)
1068{ 1082{
1069 struct net_device *soft_iface; 1083 struct net_device *soft_iface;
@@ -1141,6 +1155,12 @@ static void batadv_softif_destroy_netlink(struct net_device *soft_iface,
1141 unregister_netdevice_queue(soft_iface, head); 1155 unregister_netdevice_queue(soft_iface, head);
1142} 1156}
1143 1157
1158/**
1159 * batadv_softif_is_valid() - Check whether device is a batadv soft interface
1160 * @net_dev: device which should be checked
1161 *
1162 * Return: true when net_dev is a batman-adv interface, false otherwise
1163 */
1144bool batadv_softif_is_valid(const struct net_device *net_dev) 1164bool batadv_softif_is_valid(const struct net_device *net_dev)
1145{ 1165{
1146 if (net_dev->netdev_ops->ndo_start_xmit == batadv_interface_tx) 1166 if (net_dev->netdev_ops->ndo_start_xmit == batadv_interface_tx)
diff --git a/net/batman-adv/sysfs.c b/net/batman-adv/sysfs.c
index 8e2b7c7d2358..56fb42551453 100644
--- a/net/batman-adv/sysfs.c
+++ b/net/batman-adv/sysfs.c
@@ -735,6 +735,12 @@ static struct batadv_attribute *batadv_vlan_attrs[] = {
735 NULL, 735 NULL,
736}; 736};
737 737
738/**
739 * batadv_sysfs_add_meshif() - Add soft interface specific sysfs entries
740 * @dev: netdev struct of the soft interface
741 *
742 * Return: 0 on success or negative error number in case of failure
743 */
738int batadv_sysfs_add_meshif(struct net_device *dev) 744int batadv_sysfs_add_meshif(struct net_device *dev)
739{ 745{
740 struct kobject *batif_kobject = &dev->dev.kobj; 746 struct kobject *batif_kobject = &dev->dev.kobj;
@@ -775,6 +781,10 @@ out:
775 return -ENOMEM; 781 return -ENOMEM;
776} 782}
777 783
784/**
785 * batadv_sysfs_del_meshif() - Remove soft interface specific sysfs entries
786 * @dev: netdev struct of the soft interface
787 */
778void batadv_sysfs_del_meshif(struct net_device *dev) 788void batadv_sysfs_del_meshif(struct net_device *dev)
779{ 789{
780 struct batadv_priv *bat_priv = netdev_priv(dev); 790 struct batadv_priv *bat_priv = netdev_priv(dev);
@@ -1132,6 +1142,13 @@ static struct batadv_attribute *batadv_batman_attrs[] = {
1132 NULL, 1142 NULL,
1133}; 1143};
1134 1144
1145/**
1146 * batadv_sysfs_add_hardif() - Add hard interface specific sysfs entries
1147 * @hardif_obj: address where to store the pointer to new sysfs folder
1148 * @dev: netdev struct of the hard interface
1149 *
1150 * Return: 0 on success or negative error number in case of failure
1151 */
1135int batadv_sysfs_add_hardif(struct kobject **hardif_obj, struct net_device *dev) 1152int batadv_sysfs_add_hardif(struct kobject **hardif_obj, struct net_device *dev)
1136{ 1153{
1137 struct kobject *hardif_kobject = &dev->dev.kobj; 1154 struct kobject *hardif_kobject = &dev->dev.kobj;
@@ -1166,6 +1183,11 @@ out:
1166 return -ENOMEM; 1183 return -ENOMEM;
1167} 1184}
1168 1185
1186/**
1187 * batadv_sysfs_del_hardif() - Remove hard interface specific sysfs entries
1188 * @hardif_obj: address to the pointer to which stores batman-adv sysfs folder
1189 * of the hard interface
1190 */
1169void batadv_sysfs_del_hardif(struct kobject **hardif_obj) 1191void batadv_sysfs_del_hardif(struct kobject **hardif_obj)
1170{ 1192{
1171 kobject_uevent(*hardif_obj, KOBJ_REMOVE); 1193 kobject_uevent(*hardif_obj, KOBJ_REMOVE);
@@ -1174,6 +1196,16 @@ void batadv_sysfs_del_hardif(struct kobject **hardif_obj)
1174 *hardif_obj = NULL; 1196 *hardif_obj = NULL;
1175} 1197}
1176 1198
1199/**
1200 * batadv_throw_uevent() - Send an uevent with batman-adv specific env data
1201 * @bat_priv: the bat priv with all the soft interface information
1202 * @type: subsystem type of event. Stored in uevent's BATTYPE
1203 * @action: action type of event. Stored in uevent's BATACTION
1204 * @data: string with additional information to the event (ignored for
1205 * BATADV_UEV_DEL). Stored in uevent's BATDATA
1206 *
1207 * Return: 0 on success or negative error number in case of failure
1208 */
1177int batadv_throw_uevent(struct batadv_priv *bat_priv, enum batadv_uev_type type, 1209int batadv_throw_uevent(struct batadv_priv *bat_priv, enum batadv_uev_type type,
1178 enum batadv_uev_action action, const char *data) 1210 enum batadv_uev_action action, const char *data)
1179{ 1211{
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 8b583d3e86e6..0e53be3f8df0 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -1055,6 +1055,14 @@ container_register:
1055} 1055}
1056 1056
1057#ifdef CONFIG_BATMAN_ADV_DEBUGFS 1057#ifdef CONFIG_BATMAN_ADV_DEBUGFS
1058
1059/**
1060 * batadv_tt_local_seq_print_text() - Print the local tt table in a seq file
1061 * @seq: seq file to print on
1062 * @offset: not used
1063 *
1064 * Return: always 0
1065 */
1058int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset) 1066int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
1059{ 1067{
1060 struct net_device *net_dev = (struct net_device *)seq->private; 1068 struct net_device *net_dev = (struct net_device *)seq->private;
@@ -1927,6 +1935,13 @@ print_list:
1927 } 1935 }
1928} 1936}
1929 1937
1938/**
1939 * batadv_tt_global_seq_print_text() - Print the global tt table in a seq file
1940 * @seq: seq file to print on
1941 * @offset: not used
1942 *
1943 * Return: always 0
1944 */
1930int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset) 1945int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset)
1931{ 1946{
1932 struct net_device *net_dev = (struct net_device *)seq->private; 1947 struct net_device *net_dev = (struct net_device *)seq->private;
@@ -3729,6 +3744,10 @@ static void batadv_tt_purge(struct work_struct *work)
3729 msecs_to_jiffies(BATADV_TT_WORK_PERIOD)); 3744 msecs_to_jiffies(BATADV_TT_WORK_PERIOD));
3730} 3745}
3731 3746
3747/**
3748 * batadv_tt_free() - Free translation table of soft interface
3749 * @bat_priv: the bat priv with all the soft interface information
3750 */
3732void batadv_tt_free(struct batadv_priv *bat_priv) 3751void batadv_tt_free(struct batadv_priv *bat_priv)
3733{ 3752{
3734 batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_TT, 1); 3753 batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_TT, 1);
@@ -3876,6 +3895,15 @@ void batadv_tt_local_commit_changes(struct batadv_priv *bat_priv)
3876 spin_unlock_bh(&bat_priv->tt.commit_lock); 3895 spin_unlock_bh(&bat_priv->tt.commit_lock);
3877} 3896}
3878 3897
3898/**
3899 * batadv_is_ap_isolated() - Check if packet from upper layer should be dropped
3900 * @bat_priv: the bat priv with all the soft interface information
3901 * @src: source mac address of packet
3902 * @dst: destination mac address of packet
3903 * @vid: vlan id of packet
3904 *
3905 * Return: true when src+dst(+vid) pair should be isolated, false otherwise
3906 */
3879bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst, 3907bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst,
3880 unsigned short vid) 3908 unsigned short vid)
3881{ 3909{
@@ -4047,6 +4075,15 @@ out:
4047 return ret; 4075 return ret;
4048} 4076}
4049 4077
4078/**
4079 * batadv_tt_add_temporary_global_entry() - Add temporary entry to global TT
4080 * @bat_priv: the bat priv with all the soft interface information
4081 * @orig_node: orig node which the temporary entry should be associated with
4082 * @addr: mac address of the client
4083 * @vid: VLAN id of the new temporary global translation table
4084 *
4085 * Return: true when temporary tt entry could be added, false otherwise
4086 */
4050bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv, 4087bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv,
4051 struct batadv_orig_node *orig_node, 4088 struct batadv_orig_node *orig_node,
4052 const unsigned char *addr, 4089 const unsigned char *addr,