Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'batadv-next-for-davem-20171220' of git://git.open-mesh.org/linux-merge

Simon Wunderlich says:

====================
This feature/cleanup patchset includes the following patches:

- bump version strings, by Simon Wunderlich

- de-inline hash functions to save memory footprint, by Denys Vlasenko

- Add License information to various files, by Sven Eckelmann (3 patches)

- Change batman_adv.h from ISC to MIT, by Sven Eckelmann

- Improve various includes, by Sven Eckelmann (5 patches)

- Lots of kernel-doc work by Sven Eckelmann (8 patches)
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+2852 -1353
+2
Documentation/networking/batman-adv.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 1 3 ========== 2 4 batman-adv 3 5 ==========
+17 -10
include/uapi/linux/batman_adv.h
··· 1 + /* SPDX-License-Identifier: MIT */ 1 2 /* Copyright (C) 2016-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Matthias Schiffer 4 5 * 5 - * Permission to use, copy, modify, and/or distribute this software for any 6 - * purpose with or without fee is hereby granted, provided that the above 7 - * copyright notice and this permission notice appear in all copies. 6 + * Permission is hereby granted, free of charge, to any person obtaining a 7 + * copy of this software and associated documentation files (the "Software"), 8 + * to deal in the Software without restriction, including without limitation 9 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 + * and/or sell copies of the Software, and to permit persons to whom the 11 + * Software is furnished to do so, subject to the following conditions: 8 12 * 9 - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 13 + * The above copyright notice and this permission notice shall be included in 14 + * all copies or substantial portions of the Software. 15 + * 16 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22 + * DEALINGS IN THE SOFTWARE. 16 23 */ 17 24 18 25 #ifndef _UAPI_LINUX_BATMAN_ADV_H_
+17
net/batman-adv/Kconfig
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + # Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 3 + # 4 + # Marek Lindner, Simon Wunderlich 5 + # 6 + # This program is free software; you can redistribute it and/or 7 + # modify it under the terms of version 2 of the GNU General Public 8 + # License as published by the Free Software Foundation. 9 + # 10 + # This program is distributed in the hope that it will be useful, but 11 + # WITHOUT ANY WARRANTY; without even the implied warranty of 12 + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 + # General Public License for more details. 14 + # 15 + # You should have received a copy of the GNU General Public License 16 + # along with this program; if not, see <http://www.gnu.org/licenses/>. 17 + 1 18 # 2 19 # B.A.T.M.A.N meshing protocol 3 20 #
+1 -1
net/batman-adv/Makefile
··· 1 - # 1 + # SPDX-License-Identifier: GPL-2.0 2 2 # Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 3 3 # 4 4 # Marek Lindner, Simon Wunderlich
+32 -3
net/batman-adv/bat_algo.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Simon Wunderlich ··· 38 37 static struct hlist_head batadv_algo_list; 39 38 40 39 /** 41 - * batadv_algo_init - Initialize batman-adv algorithm management data structures 40 + * batadv_algo_init() - Initialize batman-adv algorithm management data 41 + * structures 42 42 */ 43 43 void batadv_algo_init(void) 44 44 { ··· 61 59 return bat_algo_ops; 62 60 } 63 61 62 + /** 63 + * batadv_algo_register() - Register callbacks for a mesh algorithm 64 + * @bat_algo_ops: mesh algorithm callbacks to add 65 + * 66 + * Return: 0 on success or negative error number in case of failure 67 + */ 64 68 int batadv_algo_register(struct batadv_algo_ops *bat_algo_ops) 65 69 { 66 70 struct batadv_algo_ops *bat_algo_ops_tmp; ··· 96 88 return 0; 97 89 } 98 90 91 + /** 92 + * batadv_algo_select() - Select algorithm of soft interface 93 + * @bat_priv: the bat priv with all the soft interface information 94 + * @name: name of the algorithm to select 95 + * 96 + * The algorithm callbacks for the soft interface will be set when the algorithm 97 + * with the correct name was found. Any previous selected algorithm will not be 98 + * deinitialized and the new selected algorithm will also not be initialized. 99 + * It is therefore not allowed to call batadv_algo_select outside the creation 100 + * function of the soft interface. 101 + * 102 + * Return: 0 on success or negative error number in case of failure 103 + */ 99 104 int batadv_algo_select(struct batadv_priv *bat_priv, char *name) 100 105 { 101 106 struct batadv_algo_ops *bat_algo_ops; ··· 123 102 } 124 103 125 104 #ifdef CONFIG_BATMAN_ADV_DEBUGFS 105 + 106 + /** 107 + * batadv_algo_seq_print_text() - Print the supported algorithms in a seq file 108 + * @seq: seq file to print on 109 + * @offset: not used 110 + * 111 + * Return: always 0 112 + */ 126 113 int batadv_algo_seq_print_text(struct seq_file *seq, void *offset) 127 114 { 128 115 struct batadv_algo_ops *bat_algo_ops; ··· 177 148 0644); 178 149 179 150 /** 180 - * batadv_algo_dump_entry - fill in information about one supported routing 151 + * batadv_algo_dump_entry() - fill in information about one supported routing 181 152 * algorithm 182 153 * @msg: netlink message to be sent back 183 154 * @portid: Port to reply to ··· 208 179 } 209 180 210 181 /** 211 - * batadv_algo_dump - fill in information about supported routing 182 + * batadv_algo_dump() - fill in information about supported routing 212 183 * algorithms 213 184 * @msg: netlink message to be sent back 214 185 * @cb: Parameters to the netlink request
+1
net/batman-adv/bat_algo.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2011-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Linus Lüssing
+60 -45
net/batman-adv/bat_iv_ogm.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Simon Wunderlich ··· 27 26 #include <linux/cache.h> 28 27 #include <linux/errno.h> 29 28 #include <linux/etherdevice.h> 30 - #include <linux/fs.h> 29 + #include <linux/gfp.h> 31 30 #include <linux/if_ether.h> 32 31 #include <linux/init.h> 33 32 #include <linux/jiffies.h> ··· 73 72 74 73 /** 75 74 * enum batadv_dup_status - duplicate status 76 - * @BATADV_NO_DUP: the packet is no duplicate 77 - * @BATADV_ORIG_DUP: OGM is a duplicate in the originator (but not for the 78 - * neighbor) 79 - * @BATADV_NEIGH_DUP: OGM is a duplicate for the neighbor 80 - * @BATADV_PROTECTED: originator is currently protected (after reboot) 81 75 */ 82 76 enum batadv_dup_status { 77 + /** @BATADV_NO_DUP: the packet is no duplicate */ 83 78 BATADV_NO_DUP = 0, 79 + 80 + /** 81 + * @BATADV_ORIG_DUP: OGM is a duplicate in the originator (but not for 82 + * the neighbor) 83 + */ 84 84 BATADV_ORIG_DUP, 85 + 86 + /** @BATADV_NEIGH_DUP: OGM is a duplicate for the neighbor */ 85 87 BATADV_NEIGH_DUP, 88 + 89 + /** 90 + * @BATADV_PROTECTED: originator is currently protected (after reboot) 91 + */ 86 92 BATADV_PROTECTED, 87 93 }; 88 94 89 95 /** 90 - * batadv_ring_buffer_set - update the ring buffer with the given value 96 + * batadv_ring_buffer_set() - update the ring buffer with the given value 91 97 * @lq_recv: pointer to the ring buffer 92 98 * @lq_index: index to store the value at 93 99 * @value: value to store in the ring buffer ··· 106 98 } 107 99 108 100 /** 109 - * batadv_ring_buffer_avg - compute the average of all non-zero values stored 101 + * batadv_ring_buffer_avg() - compute the average of all non-zero values stored 110 102 * in the given ring buffer 111 103 * @lq_recv: pointer to the ring buffer 112 104 * ··· 138 130 } 139 131 140 132 /** 141 - * batadv_iv_ogm_orig_free - free the private resources allocated for this 133 + * batadv_iv_ogm_orig_free() - free the private resources allocated for this 142 134 * orig_node 143 135 * @orig_node: the orig_node for which the resources have to be free'd 144 136 */ ··· 149 141 } 150 142 151 143 /** 152 - * batadv_iv_ogm_orig_add_if - change the private structures of the orig_node to 153 - * include the new hard-interface 144 + * batadv_iv_ogm_orig_add_if() - change the private structures of the orig_node 145 + * to include the new hard-interface 154 146 * @orig_node: the orig_node that has to be changed 155 147 * @max_if_num: the current amount of interfaces 156 148 * ··· 194 186 } 195 187 196 188 /** 197 - * batadv_iv_ogm_drop_bcast_own_entry - drop section of bcast_own 189 + * batadv_iv_ogm_drop_bcast_own_entry() - drop section of bcast_own 198 190 * @orig_node: the orig_node that has to be changed 199 191 * @max_if_num: the current amount of interfaces 200 192 * @del_if_num: the index of the interface being removed ··· 232 224 } 233 225 234 226 /** 235 - * batadv_iv_ogm_drop_bcast_own_sum_entry - drop section of bcast_own_sum 227 + * batadv_iv_ogm_drop_bcast_own_sum_entry() - drop section of bcast_own_sum 236 228 * @orig_node: the orig_node that has to be changed 237 229 * @max_if_num: the current amount of interfaces 238 230 * @del_if_num: the index of the interface being removed ··· 267 259 } 268 260 269 261 /** 270 - * batadv_iv_ogm_orig_del_if - change the private structures of the orig_node to 271 - * exclude the removed interface 262 + * batadv_iv_ogm_orig_del_if() - change the private structures of the orig_node 263 + * to exclude the removed interface 272 264 * @orig_node: the orig_node that has to be changed 273 265 * @max_if_num: the current amount of interfaces 274 266 * @del_if_num: the index of the interface being removed ··· 298 290 } 299 291 300 292 /** 301 - * batadv_iv_ogm_orig_get - retrieve or create (if does not exist) an originator 293 + * batadv_iv_ogm_orig_get() - retrieve or create (if does not exist) an 294 + * originator 302 295 * @bat_priv: the bat priv with all the soft interface information 303 296 * @addr: mac address of the originator 304 297 * ··· 456 447 } 457 448 458 449 /** 459 - * batadv_iv_ogm_aggr_packet - checks if there is another OGM attached 450 + * batadv_iv_ogm_aggr_packet() - checks if there is another OGM attached 460 451 * @buff_pos: current position in the skb 461 452 * @packet_len: total length of the skb 462 453 * @tvlv_len: tvlv length of the previously considered OGM ··· 566 557 } 567 558 568 559 /** 569 - * batadv_iv_ogm_can_aggregate - find out if an OGM can be aggregated on an 560 + * batadv_iv_ogm_can_aggregate() - find out if an OGM can be aggregated on an 570 561 * existing forward packet 571 562 * @new_bat_ogm_packet: OGM packet to be aggregated 572 563 * @bat_priv: the bat priv with all the soft interface information ··· 669 660 } 670 661 671 662 /** 672 - * batadv_iv_ogm_aggregate_new - create a new aggregated packet and add this 663 + * batadv_iv_ogm_aggregate_new() - create a new aggregated packet and add this 673 664 * packet to it. 674 665 * @packet_buff: pointer to the OGM 675 666 * @packet_len: (total) length of the OGM ··· 752 743 } 753 744 754 745 /** 755 - * batadv_iv_ogm_queue_add - queue up an OGM for transmission 746 + * batadv_iv_ogm_queue_add() - queue up an OGM for transmission 756 747 * @bat_priv: the bat priv with all the soft interface information 757 748 * @packet_buff: pointer to the OGM 758 749 * @packet_len: (total) length of the OGM ··· 878 869 } 879 870 880 871 /** 881 - * batadv_iv_ogm_slide_own_bcast_window - bitshift own OGM broadcast windows for 882 - * the given interface 872 + * batadv_iv_ogm_slide_own_bcast_window() - bitshift own OGM broadcast windows 873 + * for the given interface 883 874 * @hard_iface: the interface for which the windows have to be shifted 884 875 */ 885 876 static void ··· 996 987 } 997 988 998 989 /** 999 - * batadv_iv_ogm_orig_update - use OGM to update corresponding data in an 990 + * batadv_iv_ogm_orig_update() - use OGM to update corresponding data in an 1000 991 * originator 1001 992 * @bat_priv: the bat priv with all the soft interface information 1002 993 * @orig_node: the orig node who originally emitted the ogm packet ··· 1161 1152 } 1162 1153 1163 1154 /** 1164 - * batadv_iv_ogm_calc_tq - calculate tq for current received ogm packet 1155 + * batadv_iv_ogm_calc_tq() - calculate tq for current received ogm packet 1165 1156 * @orig_node: the orig node who originally emitted the ogm packet 1166 1157 * @orig_neigh_node: the orig node struct of the neighbor who sent the packet 1167 1158 * @batadv_ogm_packet: the ogm packet ··· 1307 1298 } 1308 1299 1309 1300 /** 1310 - * batadv_iv_ogm_update_seqnos - process a batman packet for all interfaces, 1301 + * batadv_iv_ogm_update_seqnos() - process a batman packet for all interfaces, 1311 1302 * adjust the sequence number and find out whether it is a duplicate 1312 1303 * @ethhdr: ethernet header of the packet 1313 1304 * @batadv_ogm_packet: OGM packet to be considered ··· 1410 1401 } 1411 1402 1412 1403 /** 1413 - * batadv_iv_ogm_process_per_outif - process a batman iv OGM for an outgoing if 1404 + * batadv_iv_ogm_process_per_outif() - process a batman iv OGM for an outgoing 1405 + * interface 1414 1406 * @skb: the skb containing the OGM 1415 1407 * @ogm_offset: offset from skb->data to start of ogm header 1416 1408 * @orig_node: the (cached) orig node for the originator of this OGM ··· 1618 1608 } 1619 1609 1620 1610 /** 1621 - * batadv_iv_ogm_process - process an incoming batman iv OGM 1611 + * batadv_iv_ogm_process() - process an incoming batman iv OGM 1622 1612 * @skb: the skb containing the OGM 1623 1613 * @ogm_offset: offset to the OGM which should be processed (for aggregates) 1624 1614 * @if_incoming: the interface where this packet was receved ··· 1871 1861 1872 1862 #ifdef CONFIG_BATMAN_ADV_DEBUGFS 1873 1863 /** 1874 - * batadv_iv_ogm_orig_print_neigh - print neighbors for the originator table 1864 + * batadv_iv_ogm_orig_print_neigh() - print neighbors for the originator table 1875 1865 * @orig_node: the orig_node for which the neighbors are printed 1876 1866 * @if_outgoing: outgoing interface for these entries 1877 1867 * @seq: debugfs table seq_file struct ··· 1900 1890 } 1901 1891 1902 1892 /** 1903 - * batadv_iv_ogm_orig_print - print the originator table 1893 + * batadv_iv_ogm_orig_print() - print the originator table 1904 1894 * @bat_priv: the bat priv with all the soft interface information 1905 1895 * @seq: debugfs table seq_file struct 1906 1896 * @if_outgoing: the outgoing interface for which this should be printed ··· 1970 1960 #endif 1971 1961 1972 1962 /** 1973 - * batadv_iv_ogm_neigh_get_tq_avg - Get the TQ average for a neighbour on a 1963 + * batadv_iv_ogm_neigh_get_tq_avg() - Get the TQ average for a neighbour on a 1974 1964 * given outgoing interface. 1975 1965 * @neigh_node: Neighbour of interest 1976 1966 * @if_outgoing: Outgoing interface of interest ··· 1996 1986 } 1997 1987 1998 1988 /** 1999 - * batadv_iv_ogm_orig_dump_subentry - Dump an originator subentry into a 1989 + * batadv_iv_ogm_orig_dump_subentry() - Dump an originator subentry into a 2000 1990 * message 2001 1991 * @msg: Netlink message to dump into 2002 1992 * @portid: Port making netlink request ··· 2058 2048 } 2059 2049 2060 2050 /** 2061 - * batadv_iv_ogm_orig_dump_entry - Dump an originator entry into a message 2051 + * batadv_iv_ogm_orig_dump_entry() - Dump an originator entry into a message 2062 2052 * @msg: Netlink message to dump into 2063 2053 * @portid: Port making netlink request 2064 2054 * @seq: Sequence number of netlink message ··· 2120 2110 } 2121 2111 2122 2112 /** 2123 - * batadv_iv_ogm_orig_dump_bucket - Dump an originator bucket into a 2113 + * batadv_iv_ogm_orig_dump_bucket() - Dump an originator bucket into a 2124 2114 * message 2125 2115 * @msg: Netlink message to dump into 2126 2116 * @portid: Port making netlink request ··· 2163 2153 } 2164 2154 2165 2155 /** 2166 - * batadv_iv_ogm_orig_dump - Dump the originators into a message 2156 + * batadv_iv_ogm_orig_dump() - Dump the originators into a message 2167 2157 * @msg: Netlink message to dump into 2168 2158 * @cb: Control block containing additional options 2169 2159 * @bat_priv: The bat priv with all the soft interface information ··· 2200 2190 2201 2191 #ifdef CONFIG_BATMAN_ADV_DEBUGFS 2202 2192 /** 2203 - * batadv_iv_hardif_neigh_print - print a single hop neighbour node 2193 + * batadv_iv_hardif_neigh_print() - print a single hop neighbour node 2204 2194 * @seq: neighbour table seq_file struct 2205 2195 * @hardif_neigh: hardif neighbour information 2206 2196 */ ··· 2219 2209 } 2220 2210 2221 2211 /** 2222 - * batadv_iv_ogm_neigh_print - print the single hop neighbour list 2212 + * batadv_iv_ogm_neigh_print() - print the single hop neighbour list 2223 2213 * @bat_priv: the bat priv with all the soft interface information 2224 2214 * @seq: neighbour table seq_file struct 2225 2215 */ ··· 2252 2242 #endif 2253 2243 2254 2244 /** 2255 - * batadv_iv_ogm_neigh_diff - calculate tq difference of two neighbors 2245 + * batadv_iv_ogm_neigh_diff() - calculate tq difference of two neighbors 2256 2246 * @neigh1: the first neighbor object of the comparison 2257 2247 * @if_outgoing1: outgoing interface for the first neighbor 2258 2248 * @neigh2: the second neighbor object of the comparison ··· 2297 2287 } 2298 2288 2299 2289 /** 2300 - * batadv_iv_ogm_neigh_dump_neigh - Dump a neighbour into a netlink message 2290 + * batadv_iv_ogm_neigh_dump_neigh() - Dump a neighbour into a netlink message 2301 2291 * @msg: Netlink message to dump into 2302 2292 * @portid: Port making netlink request 2303 2293 * @seq: Sequence number of netlink message ··· 2336 2326 } 2337 2327 2338 2328 /** 2339 - * batadv_iv_ogm_neigh_dump_hardif - Dump the neighbours of a hard interface 2329 + * batadv_iv_ogm_neigh_dump_hardif() - Dump the neighbours of a hard interface 2340 2330 * into a message 2341 2331 * @msg: Netlink message to dump into 2342 2332 * @portid: Port making netlink request ··· 2375 2365 } 2376 2366 2377 2367 /** 2378 - * batadv_iv_ogm_neigh_dump - Dump the neighbours into a message 2368 + * batadv_iv_ogm_neigh_dump() - Dump the neighbours into a message 2379 2369 * @msg: Netlink message to dump into 2380 2370 * @cb: Control block containing additional options 2381 2371 * @bat_priv: The bat priv with all the soft interface information ··· 2427 2417 } 2428 2418 2429 2419 /** 2430 - * batadv_iv_ogm_neigh_cmp - compare the metrics of two neighbors 2420 + * batadv_iv_ogm_neigh_cmp() - compare the metrics of two neighbors 2431 2421 * @neigh1: the first neighbor object of the comparison 2432 2422 * @if_outgoing1: outgoing interface for the first neighbor 2433 2423 * @neigh2: the second neighbor object of the comparison ··· 2453 2443 } 2454 2444 2455 2445 /** 2456 - * batadv_iv_ogm_neigh_is_sob - check if neigh1 is similarly good or better 2446 + * batadv_iv_ogm_neigh_is_sob() - check if neigh1 is similarly good or better 2457 2447 * than neigh2 from the metric prospective 2458 2448 * @neigh1: the first neighbor object of the comparison 2459 2449 * @if_outgoing1: outgoing interface for the first neighbor ··· 2488 2478 } 2489 2479 2490 2480 /** 2491 - * batadv_iv_init_sel_class - initialize GW selection class 2481 + * batadv_iv_init_sel_class() - initialize GW selection class 2492 2482 * @bat_priv: the bat priv with all the soft interface information 2493 2483 */ 2494 2484 static void batadv_iv_init_sel_class(struct batadv_priv *bat_priv) ··· 2713 2703 #endif 2714 2704 2715 2705 /** 2716 - * batadv_iv_gw_dump_entry - Dump a gateway into a message 2706 + * batadv_iv_gw_dump_entry() - Dump a gateway into a message 2717 2707 * @msg: Netlink message to dump into 2718 2708 * @portid: Port making netlink request 2719 2709 * @seq: Sequence number of netlink message ··· 2784 2774 } 2785 2775 2786 2776 /** 2787 - * batadv_iv_gw_dump - Dump gateways into a message 2777 + * batadv_iv_gw_dump() - Dump gateways into a message 2788 2778 * @msg: Netlink message to dump into 2789 2779 * @cb: Control block containing additional options 2790 2780 * @bat_priv: The bat priv with all the soft interface information ··· 2853 2843 }, 2854 2844 }; 2855 2845 2846 + /** 2847 + * batadv_iv_init() - B.A.T.M.A.N. IV initialization function 2848 + * 2849 + * Return: 0 on success or negative error number in case of failure 2850 + */ 2856 2851 int __init batadv_iv_init(void) 2857 2852 { 2858 2853 int ret;
+1
net/batman-adv/bat_iv_ogm.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Simon Wunderlich
+24 -25
net/batman-adv/bat_v.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2013-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Linus Lüssing, Marek Lindner ··· 100 99 } 101 100 102 101 /** 103 - * batadv_v_iface_update_mac - react to hard-interface MAC address change 102 + * batadv_v_iface_update_mac() - react to hard-interface MAC address change 104 103 * @hard_iface: the modified interface 105 104 * 106 105 * If the modified interface is the primary one, update the originator ··· 131 130 132 131 #ifdef CONFIG_BATMAN_ADV_DEBUGFS 133 132 /** 134 - * batadv_v_orig_print_neigh - print neighbors for the originator table 133 + * batadv_v_orig_print_neigh() - print neighbors for the originator table 135 134 * @orig_node: the orig_node for which the neighbors are printed 136 135 * @if_outgoing: outgoing interface for these entries 137 136 * @seq: debugfs table seq_file struct ··· 161 160 } 162 161 163 162 /** 164 - * batadv_v_hardif_neigh_print - print a single ELP neighbour node 163 + * batadv_v_hardif_neigh_print() - print a single ELP neighbour node 165 164 * @seq: neighbour table seq_file struct 166 165 * @hardif_neigh: hardif neighbour information 167 166 */ ··· 182 181 } 183 182 184 183 /** 185 - * batadv_v_neigh_print - print the single hop neighbour list 184 + * batadv_v_neigh_print() - print the single hop neighbour list 186 185 * @bat_priv: the bat priv with all the soft interface information 187 186 * @seq: neighbour table seq_file struct 188 187 */ ··· 216 215 #endif 217 216 218 217 /** 219 - * batadv_v_neigh_dump_neigh - Dump a neighbour into a message 218 + * batadv_v_neigh_dump_neigh() - Dump a neighbour into a message 220 219 * @msg: Netlink message to dump into 221 220 * @portid: Port making netlink request 222 221 * @seq: Sequence number of netlink message ··· 259 258 } 260 259 261 260 /** 262 - * batadv_v_neigh_dump_hardif - Dump the neighbours of a hard interface into 261 + * batadv_v_neigh_dump_hardif() - Dump the neighbours of a hard interface into 263 262 * a message 264 263 * @msg: Netlink message to dump into 265 264 * @portid: Port making netlink request ··· 297 296 } 298 297 299 298 /** 300 - * batadv_v_neigh_dump - Dump the neighbours of a hard interface into a 299 + * batadv_v_neigh_dump() - Dump the neighbours of a hard interface into a 301 300 * message 302 301 * @msg: Netlink message to dump into 303 302 * @cb: Control block containing additional options ··· 349 348 350 349 #ifdef CONFIG_BATMAN_ADV_DEBUGFS 351 350 /** 352 - * batadv_v_orig_print - print the originator table 351 + * batadv_v_orig_print() - print the originator table 353 352 * @bat_priv: the bat priv with all the soft interface information 354 353 * @seq: debugfs table seq_file struct 355 354 * @if_outgoing: the outgoing interface for which this should be printed ··· 417 416 #endif 418 417 419 418 /** 420 - * batadv_v_orig_dump_subentry - Dump an originator subentry into a 421 - * message 419 + * batadv_v_orig_dump_subentry() - Dump an originator subentry into a message 422 420 * @msg: Netlink message to dump into 423 421 * @portid: Port making netlink request 424 422 * @seq: Sequence number of netlink message ··· 483 483 } 484 484 485 485 /** 486 - * batadv_v_orig_dump_entry - Dump an originator entry into a message 486 + * batadv_v_orig_dump_entry() - Dump an originator entry into a message 487 487 * @msg: Netlink message to dump into 488 488 * @portid: Port making netlink request 489 489 * @seq: Sequence number of netlink message ··· 536 536 } 537 537 538 538 /** 539 - * batadv_v_orig_dump_bucket - Dump an originator bucket into a 540 - * message 539 + * batadv_v_orig_dump_bucket() - Dump an originator bucket into a message 541 540 * @msg: Netlink message to dump into 542 541 * @portid: Port making netlink request 543 542 * @seq: Sequence number of netlink message ··· 577 578 } 578 579 579 580 /** 580 - * batadv_v_orig_dump - Dump the originators into a message 581 + * batadv_v_orig_dump() - Dump the originators into a message 581 582 * @msg: Netlink message to dump into 582 583 * @cb: Control block containing additional options 583 584 * @bat_priv: The bat priv with all the soft interface information ··· 667 668 } 668 669 669 670 /** 670 - * batadv_v_init_sel_class - initialize GW selection class 671 + * batadv_v_init_sel_class() - initialize GW selection class 671 672 * @bat_priv: the bat priv with all the soft interface information 672 673 */ 673 674 static void batadv_v_init_sel_class(struct batadv_priv *bat_priv) ··· 703 704 } 704 705 705 706 /** 706 - * batadv_v_gw_throughput_get - retrieve the GW-bandwidth for a given GW 707 + * batadv_v_gw_throughput_get() - retrieve the GW-bandwidth for a given GW 707 708 * @gw_node: the GW to retrieve the metric for 708 709 * @bw: the pointer where the metric will be stored. The metric is computed as 709 710 * the minimum between the GW advertised throughput and the path throughput to ··· 746 747 } 747 748 748 749 /** 749 - * batadv_v_gw_get_best_gw_node - retrieve the best GW node 750 + * batadv_v_gw_get_best_gw_node() - retrieve the best GW node 750 751 * @bat_priv: the bat priv with all the soft interface information 751 752 * 752 753 * Return: the GW node having the best GW-metric, NULL if no GW is known ··· 784 785 } 785 786 786 787 /** 787 - * batadv_v_gw_is_eligible - check if a originator would be selected as GW 788 + * batadv_v_gw_is_eligible() - check if a originator would be selected as GW 788 789 * @bat_priv: the bat priv with all the soft interface information 789 790 * @curr_gw_orig: originator representing the currently selected GW 790 791 * @orig_node: the originator representing the new candidate ··· 883 884 } 884 885 885 886 /** 886 - * batadv_v_gw_print - print the gateway list 887 + * batadv_v_gw_print() - print the gateway list 887 888 * @bat_priv: the bat priv with all the soft interface information 888 889 * @seq: gateway table seq_file struct 889 890 */ ··· 912 913 #endif 913 914 914 915 /** 915 - * batadv_v_gw_dump_entry - Dump a gateway into a message 916 + * batadv_v_gw_dump_entry() - Dump a gateway into a message 916 917 * @msg: Netlink message to dump into 917 918 * @portid: Port making netlink request 918 919 * @seq: Sequence number of netlink message ··· 1003 1004 } 1004 1005 1005 1006 /** 1006 - * batadv_v_gw_dump - Dump gateways into a message 1007 + * batadv_v_gw_dump() - Dump gateways into a message 1007 1008 * @msg: Netlink message to dump into 1008 1009 * @cb: Control block containing additional options 1009 1010 * @bat_priv: The bat priv with all the soft interface information ··· 1073 1074 }; 1074 1075 1075 1076 /** 1076 - * batadv_v_hardif_init - initialize the algorithm specific fields in the 1077 + * batadv_v_hardif_init() - initialize the algorithm specific fields in the 1077 1078 * hard-interface object 1078 1079 * @hard_iface: the hard-interface to initialize 1079 1080 */ ··· 1087 1088 } 1088 1089 1089 1090 /** 1090 - * batadv_v_mesh_init - initialize the B.A.T.M.A.N. V private resources for a 1091 + * batadv_v_mesh_init() - initialize the B.A.T.M.A.N. V private resources for a 1091 1092 * mesh 1092 1093 * @bat_priv: the object representing the mesh interface to initialise 1093 1094 * ··· 1105 1106 } 1106 1107 1107 1108 /** 1108 - * batadv_v_mesh_free - free the B.A.T.M.A.N. V private resources for a mesh 1109 + * batadv_v_mesh_free() - free the B.A.T.M.A.N. V private resources for a mesh 1109 1110 * @bat_priv: the object representing the mesh interface to free 1110 1111 */ 1111 1112 void batadv_v_mesh_free(struct batadv_priv *bat_priv) ··· 1114 1115 } 1115 1116 1116 1117 /** 1117 - * batadv_v_init - B.A.T.M.A.N. V initialization function 1118 + * batadv_v_init() - B.A.T.M.A.N. V initialization function 1118 1119 * 1119 1120 * Description: Takes care of initializing all the subcomponents. 1120 1121 * It is invoked upon module load only.
+1
net/batman-adv/bat_v.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2011-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Linus Lüssing
+14 -13
net/batman-adv/bat_v_elp.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2011-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Linus Lüssing, Marek Lindner ··· 25 24 #include <linux/errno.h> 26 25 #include <linux/etherdevice.h> 27 26 #include <linux/ethtool.h> 28 - #include <linux/fs.h> 27 + #include <linux/gfp.h> 29 28 #include <linux/if_ether.h> 30 29 #include <linux/jiffies.h> 31 30 #include <linux/kernel.h> ··· 53 52 #include "send.h" 54 53 55 54 /** 56 - * batadv_v_elp_start_timer - restart timer for ELP periodic work 55 + * batadv_v_elp_start_timer() - restart timer for ELP periodic work 57 56 * @hard_iface: the interface for which the timer has to be reset 58 57 */ 59 58 static void batadv_v_elp_start_timer(struct batadv_hard_iface *hard_iface) ··· 68 67 } 69 68 70 69 /** 71 - * batadv_v_elp_get_throughput - get the throughput towards a neighbour 70 + * batadv_v_elp_get_throughput() - get the throughput towards a neighbour 72 71 * @neigh: the neighbour for which the throughput has to be obtained 73 72 * 74 73 * Return: The throughput towards the given neighbour in multiples of 100kpbs ··· 154 153 } 155 154 156 155 /** 157 - * batadv_v_elp_throughput_metric_update - worker updating the throughput metric 158 - * of a single hop neighbour 156 + * batadv_v_elp_throughput_metric_update() - worker updating the throughput 157 + * metric of a single hop neighbour 159 158 * @work: the work queue item 160 159 */ 161 160 void batadv_v_elp_throughput_metric_update(struct work_struct *work) ··· 178 177 } 179 178 180 179 /** 181 - * batadv_v_elp_wifi_neigh_probe - send link probing packets to a neighbour 180 + * batadv_v_elp_wifi_neigh_probe() - send link probing packets to a neighbour 182 181 * @neigh: the neighbour to probe 183 182 * 184 183 * Sends a predefined number of unicast wifi packets to a given neighbour in ··· 241 240 } 242 241 243 242 /** 244 - * batadv_v_elp_periodic_work - ELP periodic task per interface 243 + * batadv_v_elp_periodic_work() - ELP periodic task per interface 245 244 * @work: work queue item 246 245 * 247 246 * Emits broadcast ELP message in regular intervals. ··· 328 327 } 329 328 330 329 /** 331 - * batadv_v_elp_iface_enable - setup the ELP interface private resources 330 + * batadv_v_elp_iface_enable() - setup the ELP interface private resources 332 331 * @hard_iface: interface for which the data has to be prepared 333 332 * 334 333 * Return: 0 on success or a -ENOMEM in case of failure. ··· 376 375 } 377 376 378 377 /** 379 - * batadv_v_elp_iface_disable - release ELP interface private resources 378 + * batadv_v_elp_iface_disable() - release ELP interface private resources 380 379 * @hard_iface: interface for which the resources have to be released 381 380 */ 382 381 void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface) ··· 388 387 } 389 388 390 389 /** 391 - * batadv_v_elp_iface_activate - update the ELP buffer belonging to the given 390 + * batadv_v_elp_iface_activate() - update the ELP buffer belonging to the given 392 391 * hard-interface 393 392 * @primary_iface: the new primary interface 394 393 * @hard_iface: interface holding the to-be-updated buffer ··· 409 408 } 410 409 411 410 /** 412 - * batadv_v_elp_primary_iface_set - change internal data to reflect the new 411 + * batadv_v_elp_primary_iface_set() - change internal data to reflect the new 413 412 * primary interface 414 413 * @primary_iface: the new primary interface 415 414 */ ··· 429 428 } 430 429 431 430 /** 432 - * batadv_v_elp_neigh_update - update an ELP neighbour node 431 + * batadv_v_elp_neigh_update() - update an ELP neighbour node 433 432 * @bat_priv: the bat priv with all the soft interface information 434 433 * @neigh_addr: the neighbour interface address 435 434 * @if_incoming: the interface the packet was received through ··· 489 488 } 490 489 491 490 /** 492 - * batadv_v_elp_packet_recv - main ELP packet handler 491 + * batadv_v_elp_packet_recv() - main ELP packet handler 493 492 * @skb: the received packet 494 493 * @if_incoming: the interface this packet was received through 495 494 *
+1
net/batman-adv/bat_v_elp.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2013-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Linus Lüssing, Marek Lindner
+19 -18
net/batman-adv/bat_v_ogm.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2013-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Antonio Quartulli ··· 23 22 #include <linux/byteorder/generic.h> 24 23 #include <linux/errno.h> 25 24 #include <linux/etherdevice.h> 26 - #include <linux/fs.h> 25 + #include <linux/gfp.h> 27 26 #include <linux/if_ether.h> 28 27 #include <linux/jiffies.h> 29 28 #include <linux/kernel.h> ··· 52 51 #include "tvlv.h" 53 52 54 53 /** 55 - * batadv_v_ogm_orig_get - retrieve and possibly create an originator node 54 + * batadv_v_ogm_orig_get() - retrieve and possibly create an originator node 56 55 * @bat_priv: the bat priv with all the soft interface information 57 56 * @addr: the address of the originator 58 57 * ··· 89 88 } 90 89 91 90 /** 92 - * batadv_v_ogm_start_timer - restart the OGM sending timer 91 + * batadv_v_ogm_start_timer() - restart the OGM sending timer 93 92 * @bat_priv: the bat priv with all the soft interface information 94 93 */ 95 94 static void batadv_v_ogm_start_timer(struct batadv_priv *bat_priv) ··· 108 107 } 109 108 110 109 /** 111 - * batadv_v_ogm_send_to_if - send a batman ogm using a given interface 110 + * batadv_v_ogm_send_to_if() - send a batman ogm using a given interface 112 111 * @skb: the OGM to send 113 112 * @hard_iface: the interface to use to send the OGM 114 113 */ ··· 128 127 } 129 128 130 129 /** 131 - * batadv_v_ogm_send - periodic worker broadcasting the own OGM 130 + * batadv_v_ogm_send() - periodic worker broadcasting the own OGM 132 131 * @work: work queue item 133 132 */ 134 133 static void batadv_v_ogm_send(struct work_struct *work) ··· 236 235 } 237 236 238 237 /** 239 - * batadv_v_ogm_iface_enable - prepare an interface for B.A.T.M.A.N. V 238 + * batadv_v_ogm_iface_enable() - prepare an interface for B.A.T.M.A.N. V 240 239 * @hard_iface: the interface to prepare 241 240 * 242 241 * Takes care of scheduling own OGM sending routine for this interface. ··· 253 252 } 254 253 255 254 /** 256 - * batadv_v_ogm_primary_iface_set - set a new primary interface 255 + * batadv_v_ogm_primary_iface_set() - set a new primary interface 257 256 * @primary_iface: the new primary interface 258 257 */ 259 258 void batadv_v_ogm_primary_iface_set(struct batadv_hard_iface *primary_iface) ··· 269 268 } 270 269 271 270 /** 272 - * batadv_v_forward_penalty - apply a penalty to the throughput metric forwarded 273 - * with B.A.T.M.A.N. V OGMs 271 + * batadv_v_forward_penalty() - apply a penalty to the throughput metric 272 + * forwarded with B.A.T.M.A.N. V OGMs 274 273 * @bat_priv: the bat priv with all the soft interface information 275 274 * @if_incoming: the interface where the OGM has been received 276 275 * @if_outgoing: the interface where the OGM has to be forwarded to ··· 315 314 } 316 315 317 316 /** 318 - * batadv_v_ogm_forward - check conditions and forward an OGM to the given 317 + * batadv_v_ogm_forward() - check conditions and forward an OGM to the given 319 318 * outgoing interface 320 319 * @bat_priv: the bat priv with all the soft interface information 321 320 * @ogm_received: previously received OGM to be forwarded ··· 406 405 } 407 406 408 407 /** 409 - * batadv_v_ogm_metric_update - update route metric based on OGM 408 + * batadv_v_ogm_metric_update() - update route metric based on OGM 410 409 * @bat_priv: the bat priv with all the soft interface information 411 410 * @ogm2: OGM2 structure 412 411 * @orig_node: Originator structure for which the OGM has been received ··· 491 490 } 492 491 493 492 /** 494 - * batadv_v_ogm_route_update - update routes based on OGM 493 + * batadv_v_ogm_route_update() - update routes based on OGM 495 494 * @bat_priv: the bat priv with all the soft interface information 496 495 * @ethhdr: the Ethernet header of the OGM2 497 496 * @ogm2: OGM2 structure ··· 591 590 } 592 591 593 592 /** 594 - * batadv_v_ogm_process_per_outif - process a batman v OGM for an outgoing if 593 + * batadv_v_ogm_process_per_outif() - process a batman v OGM for an outgoing if 595 594 * @bat_priv: the bat priv with all the soft interface information 596 595 * @ethhdr: the Ethernet header of the OGM2 597 596 * @ogm2: OGM2 structure ··· 640 639 } 641 640 642 641 /** 643 - * batadv_v_ogm_aggr_packet - checks if there is another OGM aggregated 642 + * batadv_v_ogm_aggr_packet() - checks if there is another OGM aggregated 644 643 * @buff_pos: current position in the skb 645 644 * @packet_len: total length of the skb 646 645 * @tvlv_len: tvlv length of the previously considered OGM ··· 660 659 } 661 660 662 661 /** 663 - * batadv_v_ogm_process - process an incoming batman v OGM 662 + * batadv_v_ogm_process() - process an incoming batman v OGM 664 663 * @skb: the skb containing the OGM 665 664 * @ogm_offset: offset to the OGM which should be processed (for aggregates) 666 665 * @if_incoming: the interface where this packet was receved ··· 788 787 } 789 788 790 789 /** 791 - * batadv_v_ogm_packet_recv - OGM2 receiving handler 790 + * batadv_v_ogm_packet_recv() - OGM2 receiving handler 792 791 * @skb: the received OGM 793 792 * @if_incoming: the interface where this OGM has been received 794 793 * ··· 852 851 } 853 852 854 853 /** 855 - * batadv_v_ogm_init - initialise the OGM2 engine 854 + * batadv_v_ogm_init() - initialise the OGM2 engine 856 855 * @bat_priv: the bat priv with all the soft interface information 857 856 * 858 857 * Return: 0 on success or a negative error code in case of failure ··· 885 884 } 886 885 887 886 /** 888 - * batadv_v_ogm_free - free OGM private resources 887 + * batadv_v_ogm_free() - free OGM private resources 889 888 * @bat_priv: the bat priv with all the soft interface information 890 889 */ 891 890 void batadv_v_ogm_free(struct batadv_priv *bat_priv)
+1
net/batman-adv/bat_v_ogm.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2013-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Antonio Quartulli
+2 -1
net/batman-adv/bitarray.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2006-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Simon Wunderlich, Marek Lindner ··· 33 32 } 34 33 35 34 /** 36 - * batadv_bit_get_packet - receive and process one packet within the sequence 35 + * batadv_bit_get_packet() - receive and process one packet within the sequence 37 36 * number window 38 37 * @priv: the bat priv with all the soft interface information 39 38 * @seq_bits: pointer to the sequence number receive packet
+8 -2
net/batman-adv/bitarray.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2006-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Simon Wunderlich, Marek Lindner ··· 27 26 #include <linux/types.h> 28 27 29 28 /** 30 - * batadv_test_bit - check if bit is set in the current window 29 + * batadv_test_bit() - check if bit is set in the current window 31 30 * 32 31 * @seq_bits: pointer to the sequence number receive packet 33 32 * @last_seqno: latest sequence number in seq_bits ··· 47 46 return test_bit(diff, seq_bits) != 0; 48 47 } 49 48 50 - /* turn corresponding bit on, so we can remember that we got the packet */ 49 + /** 50 + * batadv_set_bit() - Turn corresponding bit on, so we can remember that we got 51 + * the packet 52 + * @seq_bits: bitmap of the packet receive window 53 + * @n: relative sequence number of newly received packet 54 + */ 51 55 static inline void batadv_set_bit(unsigned long *seq_bits, s32 n) 52 56 { 53 57 /* if too old, just drop it */
+56 -56
net/batman-adv/bridge_loop_avoidance.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2011-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Simon Wunderlich ··· 25 24 #include <linux/crc16.h> 26 25 #include <linux/errno.h> 27 26 #include <linux/etherdevice.h> 28 - #include <linux/fs.h> 27 + #include <linux/gfp.h> 29 28 #include <linux/if_arp.h> 30 29 #include <linux/if_ether.h> 31 30 #include <linux/if_vlan.h> ··· 70 69 struct batadv_bla_backbone_gw *backbone_gw); 71 70 72 71 /** 73 - * batadv_choose_claim - choose the right bucket for a claim. 72 + * batadv_choose_claim() - choose the right bucket for a claim. 74 73 * @data: data to hash 75 74 * @size: size of the hash table 76 75 * ··· 88 87 } 89 88 90 89 /** 91 - * batadv_choose_backbone_gw - choose the right bucket for a backbone gateway. 90 + * batadv_choose_backbone_gw() - choose the right bucket for a backbone gateway. 92 91 * @data: data to hash 93 92 * @size: size of the hash table 94 93 * ··· 106 105 } 107 106 108 107 /** 109 - * batadv_compare_backbone_gw - compare address and vid of two backbone gws 108 + * batadv_compare_backbone_gw() - compare address and vid of two backbone gws 110 109 * @node: list node of the first entry to compare 111 110 * @data2: pointer to the second backbone gateway 112 111 * ··· 130 129 } 131 130 132 131 /** 133 - * batadv_compare_claim - compare address and vid of two claims 132 + * batadv_compare_claim() - compare address and vid of two claims 134 133 * @node: list node of the first entry to compare 135 134 * @data2: pointer to the second claims 136 135 * ··· 154 153 } 155 154 156 155 /** 157 - * batadv_backbone_gw_release - release backbone gw from lists and queue for 156 + * batadv_backbone_gw_release() - release backbone gw from lists and queue for 158 157 * free after rcu grace period 159 158 * @ref: kref pointer of the backbone gw 160 159 */ ··· 169 168 } 170 169 171 170 /** 172 - * batadv_backbone_gw_put - decrement the backbone gw refcounter and possibly 171 + * batadv_backbone_gw_put() - decrement the backbone gw refcounter and possibly 173 172 * release it 174 173 * @backbone_gw: backbone gateway to be free'd 175 174 */ ··· 179 178 } 180 179 181 180 /** 182 - * batadv_claim_release - release claim from lists and queue for free after rcu 183 - * grace period 181 + * batadv_claim_release() - release claim from lists and queue for free after 182 + * rcu grace period 184 183 * @ref: kref pointer of the claim 185 184 */ 186 185 static void batadv_claim_release(struct kref *ref) ··· 205 204 } 206 205 207 206 /** 208 - * batadv_claim_put - decrement the claim refcounter and possibly 209 - * release it 207 + * batadv_claim_put() - decrement the claim refcounter and possibly release it 210 208 * @claim: claim to be free'd 211 209 */ 212 210 static void batadv_claim_put(struct batadv_bla_claim *claim) ··· 214 214 } 215 215 216 216 /** 217 - * batadv_claim_hash_find - looks for a claim in the claim hash 217 + * batadv_claim_hash_find() - looks for a claim in the claim hash 218 218 * @bat_priv: the bat priv with all the soft interface information 219 219 * @data: search data (may be local/static data) 220 220 * ··· 253 253 } 254 254 255 255 /** 256 - * batadv_backbone_hash_find - looks for a backbone gateway in the hash 256 + * batadv_backbone_hash_find() - looks for a backbone gateway in the hash 257 257 * @bat_priv: the bat priv with all the soft interface information 258 258 * @addr: the address of the originator 259 259 * @vid: the VLAN ID ··· 297 297 } 298 298 299 299 /** 300 - * batadv_bla_del_backbone_claims - delete all claims for a backbone 300 + * batadv_bla_del_backbone_claims() - delete all claims for a backbone 301 301 * @backbone_gw: backbone gateway where the claims should be removed 302 302 */ 303 303 static void ··· 337 337 } 338 338 339 339 /** 340 - * batadv_bla_send_claim - sends a claim frame according to the provided info 340 + * batadv_bla_send_claim() - sends a claim frame according to the provided info 341 341 * @bat_priv: the bat priv with all the soft interface information 342 342 * @mac: the mac address to be announced within the claim 343 343 * @vid: the VLAN ID ··· 457 457 } 458 458 459 459 /** 460 - * batadv_bla_loopdetect_report - worker for reporting the loop 460 + * batadv_bla_loopdetect_report() - worker for reporting the loop 461 461 * @work: work queue item 462 462 * 463 463 * Throws an uevent, as the loopdetect check function can't do that itself ··· 487 487 } 488 488 489 489 /** 490 - * batadv_bla_get_backbone_gw - finds or creates a backbone gateway 490 + * batadv_bla_get_backbone_gw() - finds or creates a backbone gateway 491 491 * @bat_priv: the bat priv with all the soft interface information 492 492 * @orig: the mac address of the originator 493 493 * @vid: the VLAN ID ··· 560 560 } 561 561 562 562 /** 563 - * batadv_bla_update_own_backbone_gw - updates the own backbone gw for a VLAN 563 + * batadv_bla_update_own_backbone_gw() - updates the own backbone gw for a VLAN 564 564 * @bat_priv: the bat priv with all the soft interface information 565 565 * @primary_if: the selected primary interface 566 566 * @vid: VLAN identifier ··· 586 586 } 587 587 588 588 /** 589 - * batadv_bla_answer_request - answer a bla request by sending own claims 589 + * batadv_bla_answer_request() - answer a bla request by sending own claims 590 590 * @bat_priv: the bat priv with all the soft interface information 591 591 * @primary_if: interface where the request came on 592 592 * @vid: the vid where the request came on ··· 636 636 } 637 637 638 638 /** 639 - * batadv_bla_send_request - send a request to repeat claims 639 + * batadv_bla_send_request() - send a request to repeat claims 640 640 * @backbone_gw: the backbone gateway from whom we are out of sync 641 641 * 642 642 * When the crc is wrong, ask the backbone gateway for a full table update. ··· 663 663 } 664 664 665 665 /** 666 - * batadv_bla_send_announce - Send an announcement frame 666 + * batadv_bla_send_announce() - Send an announcement frame 667 667 * @bat_priv: the bat priv with all the soft interface information 668 668 * @backbone_gw: our backbone gateway which should be announced 669 669 */ ··· 684 684 } 685 685 686 686 /** 687 - * batadv_bla_add_claim - Adds a claim in the claim hash 687 + * batadv_bla_add_claim() - Adds a claim in the claim hash 688 688 * @bat_priv: the bat priv with all the soft interface information 689 689 * @mac: the mac address of the claim 690 690 * @vid: the VLAN ID of the frame ··· 774 774 } 775 775 776 776 /** 777 - * batadv_bla_claim_get_backbone_gw - Get valid reference for backbone_gw of 777 + * batadv_bla_claim_get_backbone_gw() - Get valid reference for backbone_gw of 778 778 * claim 779 779 * @claim: claim whose backbone_gw should be returned 780 780 * ··· 794 794 } 795 795 796 796 /** 797 - * batadv_bla_del_claim - delete a claim from the claim hash 797 + * batadv_bla_del_claim() - delete a claim from the claim hash 798 798 * @bat_priv: the bat priv with all the soft interface information 799 799 * @mac: mac address of the claim to be removed 800 800 * @vid: VLAN id for the claim to be removed ··· 822 822 } 823 823 824 824 /** 825 - * batadv_handle_announce - check for ANNOUNCE frame 825 + * batadv_handle_announce() - check for ANNOUNCE frame 826 826 * @bat_priv: the bat priv with all the soft interface information 827 827 * @an_addr: announcement mac address (ARP Sender HW address) 828 828 * @backbone_addr: originator address of the sender (Ethernet source MAC) ··· 880 880 } 881 881 882 882 /** 883 - * batadv_handle_request - check for REQUEST frame 883 + * batadv_handle_request() - check for REQUEST frame 884 884 * @bat_priv: the bat priv with all the soft interface information 885 885 * @primary_if: the primary hard interface of this batman soft interface 886 886 * @backbone_addr: backbone address to be requested (ARP sender HW MAC) ··· 913 913 } 914 914 915 915 /** 916 - * batadv_handle_unclaim - check for UNCLAIM frame 916 + * batadv_handle_unclaim() - check for UNCLAIM frame 917 917 * @bat_priv: the bat priv with all the soft interface information 918 918 * @primary_if: the primary hard interface of this batman soft interface 919 919 * @backbone_addr: originator address of the backbone (Ethernet source) ··· 951 951 } 952 952 953 953 /** 954 - * batadv_handle_claim - check for CLAIM frame 954 + * batadv_handle_claim() - check for CLAIM frame 955 955 * @bat_priv: the bat priv with all the soft interface information 956 956 * @primary_if: the primary hard interface of this batman soft interface 957 957 * @backbone_addr: originator address of the backbone (Ethernet Source) ··· 988 988 } 989 989 990 990 /** 991 - * batadv_check_claim_group - check for claim group membership 991 + * batadv_check_claim_group() - check for claim group membership 992 992 * @bat_priv: the bat priv with all the soft interface information 993 993 * @primary_if: the primary interface of this batman interface 994 994 * @hw_src: the Hardware source in the ARP Header ··· 1063 1063 } 1064 1064 1065 1065 /** 1066 - * batadv_bla_process_claim - Check if this is a claim frame, and process it 1066 + * batadv_bla_process_claim() - Check if this is a claim frame, and process it 1067 1067 * @bat_priv: the bat priv with all the soft interface information 1068 1068 * @primary_if: the primary hard interface of this batman soft interface 1069 1069 * @skb: the frame to be checked ··· 1205 1205 } 1206 1206 1207 1207 /** 1208 - * batadv_bla_purge_backbone_gw - Remove backbone gateways after a timeout or 1208 + * batadv_bla_purge_backbone_gw() - Remove backbone gateways after a timeout or 1209 1209 * immediately 1210 1210 * @bat_priv: the bat priv with all the soft interface information 1211 1211 * @now: whether the whole hash shall be wiped now ··· 1258 1258 } 1259 1259 1260 1260 /** 1261 - * batadv_bla_purge_claims - Remove claims after a timeout or immediately 1261 + * batadv_bla_purge_claims() - Remove claims after a timeout or immediately 1262 1262 * @bat_priv: the bat priv with all the soft interface information 1263 1263 * @primary_if: the selected primary interface, may be NULL if now is set 1264 1264 * @now: whether the whole hash shall be wiped now ··· 1316 1316 } 1317 1317 1318 1318 /** 1319 - * batadv_bla_update_orig_address - Update the backbone gateways when the own 1319 + * batadv_bla_update_orig_address() - Update the backbone gateways when the own 1320 1320 * originator address changes 1321 1321 * @bat_priv: the bat priv with all the soft interface information 1322 1322 * @primary_if: the new selected primary_if ··· 1372 1372 } 1373 1373 1374 1374 /** 1375 - * batadv_bla_send_loopdetect - send a loopdetect frame 1375 + * batadv_bla_send_loopdetect() - send a loopdetect frame 1376 1376 * @bat_priv: the bat priv with all the soft interface information 1377 1377 * @backbone_gw: the backbone gateway for which a loop should be detected 1378 1378 * ··· 1392 1392 } 1393 1393 1394 1394 /** 1395 - * batadv_bla_status_update - purge bla interfaces if necessary 1395 + * batadv_bla_status_update() - purge bla interfaces if necessary 1396 1396 * @net_dev: the soft interface net device 1397 1397 */ 1398 1398 void batadv_bla_status_update(struct net_device *net_dev) ··· 1412 1412 } 1413 1413 1414 1414 /** 1415 - * batadv_bla_periodic_work - performs periodic bla work 1415 + * batadv_bla_periodic_work() - performs periodic bla work 1416 1416 * @work: kernel work struct 1417 1417 * 1418 1418 * periodic work to do: ··· 1517 1517 static struct lock_class_key batadv_backbone_hash_lock_class_key; 1518 1518 1519 1519 /** 1520 - * batadv_bla_init - initialize all bla structures 1520 + * batadv_bla_init() - initialize all bla structures 1521 1521 * @bat_priv: the bat priv with all the soft interface information 1522 1522 * 1523 1523 * Return: 0 on success, < 0 on error. ··· 1579 1579 } 1580 1580 1581 1581 /** 1582 - * batadv_bla_check_bcast_duplist - Check if a frame is in the broadcast dup. 1582 + * batadv_bla_check_bcast_duplist() - Check if a frame is in the broadcast dup. 1583 1583 * @bat_priv: the bat priv with all the soft interface information 1584 1584 * @skb: contains the bcast_packet to be checked 1585 1585 * ··· 1652 1652 } 1653 1653 1654 1654 /** 1655 - * batadv_bla_is_backbone_gw_orig - Check if the originator is a gateway for 1655 + * batadv_bla_is_backbone_gw_orig() - Check if the originator is a gateway for 1656 1656 * the VLAN identified by vid. 1657 1657 * @bat_priv: the bat priv with all the soft interface information 1658 1658 * @orig: originator mac address ··· 1692 1692 } 1693 1693 1694 1694 /** 1695 - * batadv_bla_is_backbone_gw - check if originator is a backbone gw for a VLAN. 1695 + * batadv_bla_is_backbone_gw() - check if originator is a backbone gw for a VLAN 1696 1696 * @skb: the frame to be checked 1697 1697 * @orig_node: the orig_node of the frame 1698 1698 * @hdr_size: maximum length of the frame ··· 1726 1726 } 1727 1727 1728 1728 /** 1729 - * batadv_bla_free - free all bla structures 1729 + * batadv_bla_free() - free all bla structures 1730 1730 * @bat_priv: the bat priv with all the soft interface information 1731 1731 * 1732 1732 * for softinterface free or module unload ··· 1753 1753 } 1754 1754 1755 1755 /** 1756 - * batadv_bla_loopdetect_check - check and handle a detected loop 1756 + * batadv_bla_loopdetect_check() - check and handle a detected loop 1757 1757 * @bat_priv: the bat priv with all the soft interface information 1758 1758 * @skb: the packet to check 1759 1759 * @primary_if: interface where the request came on ··· 1802 1802 } 1803 1803 1804 1804 /** 1805 - * batadv_bla_rx - check packets coming from the mesh. 1805 + * batadv_bla_rx() - check packets coming from the mesh. 1806 1806 * @bat_priv: the bat priv with all the soft interface information 1807 1807 * @skb: the frame to be checked 1808 1808 * @vid: the VLAN ID of the frame ··· 1914 1914 } 1915 1915 1916 1916 /** 1917 - * batadv_bla_tx - check packets going into the mesh 1917 + * batadv_bla_tx() - check packets going into the mesh 1918 1918 * @bat_priv: the bat priv with all the soft interface information 1919 1919 * @skb: the frame to be checked 1920 1920 * @vid: the VLAN ID of the frame ··· 2022 2022 2023 2023 #ifdef CONFIG_BATMAN_ADV_DEBUGFS 2024 2024 /** 2025 - * batadv_bla_claim_table_seq_print_text - print the claim table in a seq file 2025 + * batadv_bla_claim_table_seq_print_text() - print the claim table in a seq file 2026 2026 * @seq: seq file to print on 2027 2027 * @offset: not used 2028 2028 * ··· 2084 2084 #endif 2085 2085 2086 2086 /** 2087 - * batadv_bla_claim_dump_entry - dump one entry of the claim table 2087 + * batadv_bla_claim_dump_entry() - dump one entry of the claim table 2088 2088 * to a netlink socket 2089 2089 * @msg: buffer for the message 2090 2090 * @portid: netlink port ··· 2143 2143 } 2144 2144 2145 2145 /** 2146 - * batadv_bla_claim_dump_bucket - dump one bucket of the claim table 2146 + * batadv_bla_claim_dump_bucket() - dump one bucket of the claim table 2147 2147 * to a netlink socket 2148 2148 * @msg: buffer for the message 2149 2149 * @portid: netlink port ··· 2180 2180 } 2181 2181 2182 2182 /** 2183 - * batadv_bla_claim_dump - dump claim table to a netlink socket 2183 + * batadv_bla_claim_dump() - dump claim table to a netlink socket 2184 2184 * @msg: buffer for the message 2185 2185 * @cb: callback structure containing arguments 2186 2186 * ··· 2247 2247 2248 2248 #ifdef CONFIG_BATMAN_ADV_DEBUGFS 2249 2249 /** 2250 - * batadv_bla_backbone_table_seq_print_text - print the backbone table in a seq 2251 - * file 2250 + * batadv_bla_backbone_table_seq_print_text() - print the backbone table in a 2251 + * seq file 2252 2252 * @seq: seq file to print on 2253 2253 * @offset: not used 2254 2254 * ··· 2312 2312 #endif 2313 2313 2314 2314 /** 2315 - * batadv_bla_backbone_dump_entry - dump one entry of the backbone table 2316 - * to a netlink socket 2315 + * batadv_bla_backbone_dump_entry() - dump one entry of the backbone table to a 2316 + * netlink socket 2317 2317 * @msg: buffer for the message 2318 2318 * @portid: netlink port 2319 2319 * @seq: Sequence number of netlink message ··· 2373 2373 } 2374 2374 2375 2375 /** 2376 - * batadv_bla_backbone_dump_bucket - dump one bucket of the backbone table 2377 - * to a netlink socket 2376 + * batadv_bla_backbone_dump_bucket() - dump one bucket of the backbone table to 2377 + * a netlink socket 2378 2378 * @msg: buffer for the message 2379 2379 * @portid: netlink port 2380 2380 * @seq: Sequence number of netlink message ··· 2410 2410 } 2411 2411 2412 2412 /** 2413 - * batadv_bla_backbone_dump - dump backbone table to a netlink socket 2413 + * batadv_bla_backbone_dump() - dump backbone table to a netlink socket 2414 2414 * @msg: buffer for the message 2415 2415 * @cb: callback structure containing arguments 2416 2416 * ··· 2477 2477 2478 2478 #ifdef CONFIG_BATMAN_ADV_DAT 2479 2479 /** 2480 - * batadv_bla_check_claim - check if address is claimed 2480 + * batadv_bla_check_claim() - check if address is claimed 2481 2481 * 2482 2482 * @bat_priv: the bat priv with all the soft interface information 2483 2483 * @addr: mac address of which the claim status is checked
+3 -2
net/batman-adv/bridge_loop_avoidance.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2011-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Simon Wunderlich ··· 31 30 struct sk_buff; 32 31 33 32 /** 34 - * batadv_bla_is_loopdetect_mac - check if the mac address is from a loop detect 35 - * frame sent by bridge loop avoidance 33 + * batadv_bla_is_loopdetect_mac() - check if the mac address is from a loop 34 + * detect frame sent by bridge loop avoidance 36 35 * @mac: mac address to check 37 36 * 38 37 * Return: true if the it looks like a loop detect frame
+23 -7
net/batman-adv/debugfs.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2010-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner ··· 26 25 #include <linux/fs.h> 27 26 #include <linux/netdevice.h> 28 27 #include <linux/printk.h> 29 - #include <linux/sched.h> /* for linux/wait.h */ 30 28 #include <linux/seq_file.h> 31 29 #include <linux/stat.h> 32 30 #include <linux/stddef.h> ··· 66 66 } 67 67 68 68 /** 69 - * batadv_originators_hardif_open - handles debugfs output for the 70 - * originator table of an hard interface 69 + * batadv_originators_hardif_open() - handles debugfs output for the originator 70 + * table of an hard interface 71 71 * @inode: inode pointer to debugfs file 72 72 * @file: pointer to the seq_file 73 73 * ··· 117 117 118 118 #ifdef CONFIG_BATMAN_ADV_DAT 119 119 /** 120 - * batadv_dat_cache_open - Prepare file handler for reads from dat_chache 120 + * batadv_dat_cache_open() - Prepare file handler for reads from dat_chache 121 121 * @inode: inode which was opened 122 122 * @file: file handle to be initialized 123 123 * ··· 154 154 155 155 #ifdef CONFIG_BATMAN_ADV_MCAST 156 156 /** 157 - * batadv_mcast_flags_open - prepare file handler for reads from mcast_flags 157 + * batadv_mcast_flags_open() - prepare file handler for reads from mcast_flags 158 158 * @inode: inode which was opened 159 159 * @file: file handle to be initialized 160 160 * ··· 259 259 NULL, 260 260 }; 261 261 262 + /** 263 + * batadv_debugfs_init() - Initialize soft interface independent debugfs entries 264 + */ 262 265 void batadv_debugfs_init(void) 263 266 { 264 267 struct batadv_debuginfo **bat_debug; ··· 292 289 batadv_debugfs = NULL; 293 290 } 294 291 292 + /** 293 + * batadv_debugfs_destroy() - Remove all debugfs entries 294 + */ 295 295 void batadv_debugfs_destroy(void) 296 296 { 297 297 debugfs_remove_recursive(batadv_debugfs); ··· 302 296 } 303 297 304 298 /** 305 - * batadv_debugfs_add_hardif - creates the base directory for a hard interface 299 + * batadv_debugfs_add_hardif() - creates the base directory for a hard interface 306 300 * in debugfs. 307 301 * @hard_iface: hard interface which should be added. 308 302 * ··· 344 338 } 345 339 346 340 /** 347 - * batadv_debugfs_del_hardif - delete the base directory for a hard interface 341 + * batadv_debugfs_del_hardif() - delete the base directory for a hard interface 348 342 * in debugfs. 349 343 * @hard_iface: hard interface which is deleted. 350 344 */ ··· 361 355 } 362 356 } 363 357 358 + /** 359 + * batadv_debugfs_add_meshif() - Initialize interface dependent debugfs entries 360 + * @dev: netdev struct of the soft interface 361 + * 362 + * Return: 0 on success or negative error number in case of failure 363 + */ 364 364 int batadv_debugfs_add_meshif(struct net_device *dev) 365 365 { 366 366 struct batadv_priv *bat_priv = netdev_priv(dev); ··· 413 401 return -ENOMEM; 414 402 } 415 403 404 + /** 405 + * batadv_debugfs_del_meshif() - Remove interface dependent debugfs entries 406 + * @dev: netdev struct of the soft interface 407 + */ 416 408 void batadv_debugfs_del_meshif(struct net_device *dev) 417 409 { 418 410 struct batadv_priv *bat_priv = netdev_priv(dev);
+1
net/batman-adv/debugfs.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2010-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner
+41 -39
net/batman-adv/distributed-arp-table.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2011-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Antonio Quartulli ··· 24 23 #include <linux/byteorder/generic.h> 25 24 #include <linux/errno.h> 26 25 #include <linux/etherdevice.h> 27 - #include <linux/fs.h> 26 + #include <linux/gfp.h> 28 27 #include <linux/if_arp.h> 29 28 #include <linux/if_ether.h> 30 29 #include <linux/if_vlan.h> ··· 56 55 static void batadv_dat_purge(struct work_struct *work); 57 56 58 57 /** 59 - * batadv_dat_start_timer - initialise the DAT periodic worker 58 + * batadv_dat_start_timer() - initialise the DAT periodic worker 60 59 * @bat_priv: the bat priv with all the soft interface information 61 60 */ 62 61 static void batadv_dat_start_timer(struct batadv_priv *bat_priv) ··· 67 66 } 68 67 69 68 /** 70 - * batadv_dat_entry_release - release dat_entry from lists and queue for free 69 + * batadv_dat_entry_release() - release dat_entry from lists and queue for free 71 70 * after rcu grace period 72 71 * @ref: kref pointer of the dat_entry 73 72 */ ··· 81 80 } 82 81 83 82 /** 84 - * batadv_dat_entry_put - decrement the dat_entry refcounter and possibly 83 + * batadv_dat_entry_put() - decrement the dat_entry refcounter and possibly 85 84 * release it 86 85 * @dat_entry: dat_entry to be free'd 87 86 */ ··· 91 90 } 92 91 93 92 /** 94 - * batadv_dat_to_purge - check whether a dat_entry has to be purged or not 93 + * batadv_dat_to_purge() - check whether a dat_entry has to be purged or not 95 94 * @dat_entry: the entry to check 96 95 * 97 96 * Return: true if the entry has to be purged now, false otherwise. ··· 103 102 } 104 103 105 104 /** 106 - * __batadv_dat_purge - delete entries from the DAT local storage 105 + * __batadv_dat_purge() - delete entries from the DAT local storage 107 106 * @bat_priv: the bat priv with all the soft interface information 108 107 * @to_purge: function in charge to decide whether an entry has to be purged or 109 108 * not. This function takes the dat_entry as argument and has to ··· 146 145 } 147 146 148 147 /** 149 - * batadv_dat_purge - periodic task that deletes old entries from the local DAT 150 - * hash table 148 + * batadv_dat_purge() - periodic task that deletes old entries from the local 149 + * DAT hash table 151 150 * @work: kernel work struct 152 151 */ 153 152 static void batadv_dat_purge(struct work_struct *work) ··· 165 164 } 166 165 167 166 /** 168 - * batadv_compare_dat - comparing function used in the local DAT hash table 167 + * batadv_compare_dat() - comparing function used in the local DAT hash table 169 168 * @node: node in the local table 170 169 * @data2: second object to compare the node to 171 170 * ··· 180 179 } 181 180 182 181 /** 183 - * batadv_arp_hw_src - extract the hw_src field from an ARP packet 182 + * batadv_arp_hw_src() - extract the hw_src field from an ARP packet 184 183 * @skb: ARP packet 185 184 * @hdr_size: size of the possible header before the ARP packet 186 185 * ··· 197 196 } 198 197 199 198 /** 200 - * batadv_arp_ip_src - extract the ip_src field from an ARP packet 199 + * batadv_arp_ip_src() - extract the ip_src field from an ARP packet 201 200 * @skb: ARP packet 202 201 * @hdr_size: size of the possible header before the ARP packet 203 202 * ··· 209 208 } 210 209 211 210 /** 212 - * batadv_arp_hw_dst - extract the hw_dst field from an ARP packet 211 + * batadv_arp_hw_dst() - extract the hw_dst field from an ARP packet 213 212 * @skb: ARP packet 214 213 * @hdr_size: size of the possible header before the ARP packet 215 214 * ··· 221 220 } 222 221 223 222 /** 224 - * batadv_arp_ip_dst - extract the ip_dst field from an ARP packet 223 + * batadv_arp_ip_dst() - extract the ip_dst field from an ARP packet 225 224 * @skb: ARP packet 226 225 * @hdr_size: size of the possible header before the ARP packet 227 226 * ··· 233 232 } 234 233 235 234 /** 236 - * batadv_hash_dat - compute the hash value for an IP address 235 + * batadv_hash_dat() - compute the hash value for an IP address 237 236 * @data: data to hash 238 237 * @size: size of the hash table 239 238 * ··· 268 267 } 269 268 270 269 /** 271 - * batadv_dat_entry_hash_find - look for a given dat_entry in the local hash 270 + * batadv_dat_entry_hash_find() - look for a given dat_entry in the local hash 272 271 * table 273 272 * @bat_priv: the bat priv with all the soft interface information 274 273 * @ip: search key ··· 311 310 } 312 311 313 312 /** 314 - * batadv_dat_entry_add - add a new dat entry or update it if already exists 313 + * batadv_dat_entry_add() - add a new dat entry or update it if already exists 315 314 * @bat_priv: the bat priv with all the soft interface information 316 315 * @ip: ipv4 to add/edit 317 316 * @mac_addr: mac address to assign to the given ipv4 ··· 368 367 #ifdef CONFIG_BATMAN_ADV_DEBUG 369 368 370 369 /** 371 - * batadv_dbg_arp - print a debug message containing all the ARP packet details 370 + * batadv_dbg_arp() - print a debug message containing all the ARP packet 371 + * details 372 372 * @bat_priv: the bat priv with all the soft interface information 373 373 * @skb: ARP packet 374 374 * @hdr_size: size of the possible header before the ARP packet ··· 450 448 #endif /* CONFIG_BATMAN_ADV_DEBUG */ 451 449 452 450 /** 453 - * batadv_is_orig_node_eligible - check whether a node can be a DHT candidate 451 + * batadv_is_orig_node_eligible() - check whether a node can be a DHT candidate 454 452 * @res: the array with the already selected candidates 455 453 * @select: number of already selected candidates 456 454 * @tmp_max: address of the currently evaluated node ··· 504 502 } 505 503 506 504 /** 507 - * batadv_choose_next_candidate - select the next DHT candidate 505 + * batadv_choose_next_candidate() - select the next DHT candidate 508 506 * @bat_priv: the bat priv with all the soft interface information 509 507 * @cands: candidates array 510 508 * @select: number of candidates already present in the array ··· 568 566 } 569 567 570 568 /** 571 - * batadv_dat_select_candidates - select the nodes which the DHT message has to 572 - * be sent to 569 + * batadv_dat_select_candidates() - select the nodes which the DHT message has 570 + * to be sent to 573 571 * @bat_priv: the bat priv with all the soft interface information 574 572 * @ip_dst: ipv4 to look up in the DHT 575 573 * @vid: VLAN identifier ··· 614 612 } 615 613 616 614 /** 617 - * batadv_dat_send_data - send a payload to the selected candidates 615 + * batadv_dat_send_data() - send a payload to the selected candidates 618 616 * @bat_priv: the bat priv with all the soft interface information 619 617 * @skb: payload to send 620 618 * @ip: the DHT key ··· 690 688 } 691 689 692 690 /** 693 - * batadv_dat_tvlv_container_update - update the dat tvlv container after dat 691 + * batadv_dat_tvlv_container_update() - update the dat tvlv container after dat 694 692 * setting change 695 693 * @bat_priv: the bat priv with all the soft interface information 696 694 */ ··· 712 710 } 713 711 714 712 /** 715 - * batadv_dat_status_update - update the dat tvlv container after dat 713 + * batadv_dat_status_update() - update the dat tvlv container after dat 716 714 * setting change 717 715 * @net_dev: the soft interface net device 718 716 */ ··· 724 722 } 725 723 726 724 /** 727 - * batadv_dat_tvlv_ogm_handler_v1 - process incoming dat tvlv container 725 + * batadv_dat_tvlv_ogm_handler_v1() - process incoming dat tvlv container 728 726 * @bat_priv: the bat priv with all the soft interface information 729 727 * @orig: the orig_node of the ogm 730 728 * @flags: flags indicating the tvlv state (see batadv_tvlv_handler_flags) ··· 743 741 } 744 742 745 743 /** 746 - * batadv_dat_hash_free - free the local DAT hash table 744 + * batadv_dat_hash_free() - free the local DAT hash table 747 745 * @bat_priv: the bat priv with all the soft interface information 748 746 */ 749 747 static void batadv_dat_hash_free(struct batadv_priv *bat_priv) ··· 759 757 } 760 758 761 759 /** 762 - * batadv_dat_init - initialise the DAT internals 760 + * batadv_dat_init() - initialise the DAT internals 763 761 * @bat_priv: the bat priv with all the soft interface information 764 762 * 765 763 * Return: 0 in case of success, a negative error code otherwise ··· 784 782 } 785 783 786 784 /** 787 - * batadv_dat_free - free the DAT internals 785 + * batadv_dat_free() - free the DAT internals 788 786 * @bat_priv: the bat priv with all the soft interface information 789 787 */ 790 788 void batadv_dat_free(struct batadv_priv *bat_priv) ··· 799 797 800 798 #ifdef CONFIG_BATMAN_ADV_DEBUGFS 801 799 /** 802 - * batadv_dat_cache_seq_print_text - print the local DAT hash table 800 + * batadv_dat_cache_seq_print_text() - print the local DAT hash table 803 801 * @seq: seq file to print on 804 802 * @offset: not used 805 803 * ··· 852 850 #endif 853 851 854 852 /** 855 - * batadv_arp_get_type - parse an ARP packet and gets the type 853 + * batadv_arp_get_type() - parse an ARP packet and gets the type 856 854 * @bat_priv: the bat priv with all the soft interface information 857 855 * @skb: packet to analyse 858 856 * @hdr_size: size of the possible header before the ARP packet in the skb ··· 926 924 } 927 925 928 926 /** 929 - * batadv_dat_get_vid - extract the VLAN identifier from skb if any 927 + * batadv_dat_get_vid() - extract the VLAN identifier from skb if any 930 928 * @skb: the buffer containing the packet to extract the VID from 931 929 * @hdr_size: the size of the batman-adv header encapsulating the packet 932 930 * ··· 952 950 } 953 951 954 952 /** 955 - * batadv_dat_arp_create_reply - create an ARP Reply 953 + * batadv_dat_arp_create_reply() - create an ARP Reply 956 954 * @bat_priv: the bat priv with all the soft interface information 957 955 * @ip_src: ARP sender IP 958 956 * @ip_dst: ARP target IP ··· 987 985 } 988 986 989 987 /** 990 - * batadv_dat_snoop_outgoing_arp_request - snoop the ARP request and try to 988 + * batadv_dat_snoop_outgoing_arp_request() - snoop the ARP request and try to 991 989 * answer using DAT 992 990 * @bat_priv: the bat priv with all the soft interface information 993 991 * @skb: packet to check ··· 1085 1083 } 1086 1084 1087 1085 /** 1088 - * batadv_dat_snoop_incoming_arp_request - snoop the ARP request and try to 1086 + * batadv_dat_snoop_incoming_arp_request() - snoop the ARP request and try to 1089 1087 * answer using the local DAT storage 1090 1088 * @bat_priv: the bat priv with all the soft interface information 1091 1089 * @skb: packet to check ··· 1155 1153 } 1156 1154 1157 1155 /** 1158 - * batadv_dat_snoop_outgoing_arp_reply - snoop the ARP reply and fill the DHT 1156 + * batadv_dat_snoop_outgoing_arp_reply() - snoop the ARP reply and fill the DHT 1159 1157 * @bat_priv: the bat priv with all the soft interface information 1160 1158 * @skb: packet to check 1161 1159 */ ··· 1195 1193 } 1196 1194 1197 1195 /** 1198 - * batadv_dat_snoop_incoming_arp_reply - snoop the ARP reply and fill the local 1199 - * DAT storage only 1196 + * batadv_dat_snoop_incoming_arp_reply() - snoop the ARP reply and fill the 1197 + * local DAT storage only 1200 1198 * @bat_priv: the bat priv with all the soft interface information 1201 1199 * @skb: packet to check 1202 1200 * @hdr_size: size of the encapsulation header ··· 1284 1282 } 1285 1283 1286 1284 /** 1287 - * batadv_dat_drop_broadcast_packet - check if an ARP request has to be dropped 1288 - * (because the node has already obtained the reply via DAT) or not 1285 + * batadv_dat_drop_broadcast_packet() - check if an ARP request has to be 1286 + * dropped (because the node has already obtained the reply via DAT) or not 1289 1287 * @bat_priv: the bat priv with all the soft interface information 1290 1288 * @forw_packet: the broadcast packet 1291 1289 *
+4 -3
net/batman-adv/distributed-arp-table.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2011-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Antonio Quartulli ··· 49 48 struct batadv_forw_packet *forw_packet); 50 49 51 50 /** 52 - * batadv_dat_init_orig_node_addr - assign a DAT address to the orig_node 51 + * batadv_dat_init_orig_node_addr() - assign a DAT address to the orig_node 53 52 * @orig_node: the node to assign the DAT address to 54 53 */ 55 54 static inline void ··· 62 61 } 63 62 64 63 /** 65 - * batadv_dat_init_own_addr - assign a DAT address to the node itself 64 + * batadv_dat_init_own_addr() - assign a DAT address to the node itself 66 65 * @bat_priv: the bat priv with all the soft interface information 67 66 * @primary_if: a pointer to the primary interface 68 67 */ ··· 83 82 int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset); 84 83 85 84 /** 86 - * batadv_dat_inc_counter - increment the correct DAT packet counter 85 + * batadv_dat_inc_counter() - increment the correct DAT packet counter 87 86 * @bat_priv: the bat priv with all the soft interface information 88 87 * @subtype: the 4addr subtype of the packet to be counted 89 88 *
+12 -11
net/batman-adv/fragmentation.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2013-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Martin Hundebøll <martin@hundeboll.net> ··· 23 22 #include <linux/byteorder/generic.h> 24 23 #include <linux/errno.h> 25 24 #include <linux/etherdevice.h> 26 - #include <linux/fs.h> 25 + #include <linux/gfp.h> 27 26 #include <linux/if_ether.h> 28 27 #include <linux/jiffies.h> 29 28 #include <linux/kernel.h> ··· 42 41 #include "soft-interface.h" 43 42 44 43 /** 45 - * batadv_frag_clear_chain - delete entries in the fragment buffer chain 44 + * batadv_frag_clear_chain() - delete entries in the fragment buffer chain 46 45 * @head: head of chain with entries. 47 46 * @dropped: whether the chain is cleared because all fragments are dropped 48 47 * ··· 66 65 } 67 66 68 67 /** 69 - * batadv_frag_purge_orig - free fragments associated to an orig 68 + * batadv_frag_purge_orig() - free fragments associated to an orig 70 69 * @orig_node: originator to free fragments from 71 70 * @check_cb: optional function to tell if an entry should be purged 72 71 */ ··· 90 89 } 91 90 92 91 /** 93 - * batadv_frag_size_limit - maximum possible size of packet to be fragmented 92 + * batadv_frag_size_limit() - maximum possible size of packet to be fragmented 94 93 * 95 94 * Return: the maximum size of payload that can be fragmented. 96 95 */ ··· 105 104 } 106 105 107 106 /** 108 - * batadv_frag_init_chain - check and prepare fragment chain for new fragment 107 + * batadv_frag_init_chain() - check and prepare fragment chain for new fragment 109 108 * @chain: chain in fragments table to init 110 109 * @seqno: sequence number of the received fragment 111 110 * ··· 135 134 } 136 135 137 136 /** 138 - * batadv_frag_insert_packet - insert a fragment into a fragment chain 137 + * batadv_frag_insert_packet() - insert a fragment into a fragment chain 139 138 * @orig_node: originator that the fragment was received from 140 139 * @skb: skb to insert 141 140 * @chain_out: list head to attach complete chains of fragments to ··· 249 248 } 250 249 251 250 /** 252 - * batadv_frag_merge_packets - merge a chain of fragments 251 + * batadv_frag_merge_packets() - merge a chain of fragments 253 252 * @chain: head of chain with fragments 254 253 * 255 254 * Expand the first skb in the chain and copy the content of the remaining ··· 307 306 } 308 307 309 308 /** 310 - * batadv_frag_skb_buffer - buffer fragment for later merge 309 + * batadv_frag_skb_buffer() - buffer fragment for later merge 311 310 * @skb: skb to buffer 312 311 * @orig_node_src: originator that the skb is received from 313 312 * ··· 347 346 } 348 347 349 348 /** 350 - * batadv_frag_skb_fwd - forward fragments that would exceed MTU when merged 349 + * batadv_frag_skb_fwd() - forward fragments that would exceed MTU when merged 351 350 * @skb: skb to forward 352 351 * @recv_if: interface that the skb is received on 353 352 * @orig_node_src: originator that the skb is received from ··· 401 400 } 402 401 403 402 /** 404 - * batadv_frag_create - create a fragment from skb 403 + * batadv_frag_create() - create a fragment from skb 405 404 * @skb: skb to create fragment from 406 405 * @frag_head: header to use in new fragment 407 406 * @fragment_size: size of new fragment ··· 439 438 } 440 439 441 440 /** 442 - * batadv_frag_send_packet - create up to 16 fragments from the passed skb 441 + * batadv_frag_send_packet() - create up to 16 fragments from the passed skb 443 442 * @skb: skb to create fragments from 444 443 * @orig_node: final destination of the created fragments 445 444 * @neigh_node: next-hop of the created fragments
+2 -1
net/batman-adv/fragmentation.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2013-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Martin Hundebøll <martin@hundeboll.net> ··· 40 39 struct batadv_neigh_node *neigh_node); 41 40 42 41 /** 43 - * batadv_frag_check_entry - check if a list of fragments has timed out 42 + * batadv_frag_check_entry() - check if a list of fragments has timed out 44 43 * @frags_entry: table entry to check 45 44 * 46 45 * Return: true if the frags entry has timed out, false otherwise.
+53 -12
net/batman-adv/gateway_client.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2009-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner ··· 23 22 #include <linux/byteorder/generic.h> 24 23 #include <linux/errno.h> 25 24 #include <linux/etherdevice.h> 26 - #include <linux/fs.h> 25 + #include <linux/gfp.h> 27 26 #include <linux/if_ether.h> 28 27 #include <linux/if_vlan.h> 29 28 #include <linux/in.h> ··· 69 68 #define BATADV_DHCP_CHADDR_OFFSET 28 70 69 71 70 /** 72 - * batadv_gw_node_release - release gw_node from lists and queue for free after 73 - * rcu grace period 71 + * batadv_gw_node_release() - release gw_node from lists and queue for free 72 + * after rcu grace period 74 73 * @ref: kref pointer of the gw_node 75 74 */ 76 75 static void batadv_gw_node_release(struct kref *ref) ··· 84 83 } 85 84 86 85 /** 87 - * batadv_gw_node_put - decrement the gw_node refcounter and possibly release it 86 + * batadv_gw_node_put() - decrement the gw_node refcounter and possibly release 87 + * it 88 88 * @gw_node: gateway node to free 89 89 */ 90 90 void batadv_gw_node_put(struct batadv_gw_node *gw_node) ··· 93 91 kref_put(&gw_node->refcount, batadv_gw_node_release); 94 92 } 95 93 94 + /** 95 + * batadv_gw_get_selected_gw_node() - Get currently selected gateway 96 + * @bat_priv: the bat priv with all the soft interface information 97 + * 98 + * Return: selected gateway (with increased refcnt), NULL on errors 99 + */ 96 100 struct batadv_gw_node * 97 101 batadv_gw_get_selected_gw_node(struct batadv_priv *bat_priv) 98 102 { ··· 117 109 return gw_node; 118 110 } 119 111 112 + /** 113 + * batadv_gw_get_selected_orig() - Get originator of currently selected gateway 114 + * @bat_priv: the bat priv with all the soft interface information 115 + * 116 + * Return: orig_node of selected gateway (with increased refcnt), NULL on errors 117 + */ 120 118 struct batadv_orig_node * 121 119 batadv_gw_get_selected_orig(struct batadv_priv *bat_priv) 122 120 { ··· 169 155 } 170 156 171 157 /** 172 - * batadv_gw_reselect - force a gateway reselection 158 + * batadv_gw_reselect() - force a gateway reselection 173 159 * @bat_priv: the bat priv with all the soft interface information 174 160 * 175 161 * Set a flag to remind the GW component to perform a new gateway reselection. ··· 185 171 } 186 172 187 173 /** 188 - * batadv_gw_check_client_stop - check if client mode has been switched off 174 + * batadv_gw_check_client_stop() - check if client mode has been switched off 189 175 * @bat_priv: the bat priv with all the soft interface information 190 176 * 191 177 * This function assumes the caller has checked that the gw state *is actually ··· 216 202 batadv_gw_node_put(curr_gw); 217 203 } 218 204 205 + /** 206 + * batadv_gw_election() - Elect the best gateway 207 + * @bat_priv: the bat priv with all the soft interface information 208 + */ 219 209 void batadv_gw_election(struct batadv_priv *bat_priv) 220 210 { 221 211 struct batadv_gw_node *curr_gw = NULL; ··· 308 290 batadv_neigh_ifinfo_put(router_ifinfo); 309 291 } 310 292 293 + /** 294 + * batadv_gw_check_election() - Elect orig node as best gateway when eligible 295 + * @bat_priv: the bat priv with all the soft interface information 296 + * @orig_node: orig node which is to be checked 297 + */ 311 298 void batadv_gw_check_election(struct batadv_priv *bat_priv, 312 299 struct batadv_orig_node *orig_node) 313 300 { ··· 344 321 } 345 322 346 323 /** 347 - * batadv_gw_node_add - add gateway node to list of available gateways 324 + * batadv_gw_node_add() - add gateway node to list of available gateways 348 325 * @bat_priv: the bat priv with all the soft interface information 349 326 * @orig_node: originator announcing gateway capabilities 350 327 * @gateway: announced bandwidth information ··· 387 364 } 388 365 389 366 /** 390 - * batadv_gw_node_get - retrieve gateway node from list of available gateways 367 + * batadv_gw_node_get() - retrieve gateway node from list of available gateways 391 368 * @bat_priv: the bat priv with all the soft interface information 392 369 * @orig_node: originator announcing gateway capabilities 393 370 * ··· 416 393 } 417 394 418 395 /** 419 - * batadv_gw_node_update - update list of available gateways with changed 396 + * batadv_gw_node_update() - update list of available gateways with changed 420 397 * bandwidth information 421 398 * @bat_priv: the bat priv with all the soft interface information 422 399 * @orig_node: originator announcing gateway capabilities ··· 481 458 batadv_gw_node_put(gw_node); 482 459 } 483 460 461 + /** 462 + * batadv_gw_node_delete() - Remove orig_node from gateway list 463 + * @bat_priv: the bat priv with all the soft interface information 464 + * @orig_node: orig node which is currently in process of being removed 465 + */ 484 466 void batadv_gw_node_delete(struct batadv_priv *bat_priv, 485 467 struct batadv_orig_node *orig_node) 486 468 { ··· 497 469 batadv_gw_node_update(bat_priv, orig_node, &gateway); 498 470 } 499 471 472 + /** 473 + * batadv_gw_node_free() - Free gateway information from soft interface 474 + * @bat_priv: the bat priv with all the soft interface information 475 + */ 500 476 void batadv_gw_node_free(struct batadv_priv *bat_priv) 501 477 { 502 478 struct batadv_gw_node *gw_node; ··· 516 484 } 517 485 518 486 #ifdef CONFIG_BATMAN_ADV_DEBUGFS 487 + 488 + /** 489 + * batadv_gw_client_seq_print_text() - Print the gateway table in a seq file 490 + * @seq: seq file to print on 491 + * @offset: not used 492 + * 493 + * Return: always 0 494 + */ 519 495 int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset) 520 496 { 521 497 struct net_device *net_dev = (struct net_device *)seq->private; ··· 554 514 #endif 555 515 556 516 /** 557 - * batadv_gw_dump - Dump gateways into a message 517 + * batadv_gw_dump() - Dump gateways into a message 558 518 * @msg: Netlink message to dump into 559 519 * @cb: Control block containing additional options 560 520 * ··· 607 567 } 608 568 609 569 /** 610 - * batadv_gw_dhcp_recipient_get - check if a packet is a DHCP message 570 + * batadv_gw_dhcp_recipient_get() - check if a packet is a DHCP message 611 571 * @skb: the packet to check 612 572 * @header_len: a pointer to the batman-adv header size 613 573 * @chaddr: buffer where the client address will be stored. Valid ··· 726 686 } 727 687 728 688 /** 729 - * batadv_gw_out_of_range - check if the dhcp request destination is the best gw 689 + * batadv_gw_out_of_range() - check if the dhcp request destination is the best 690 + * gateway 730 691 * @bat_priv: the bat priv with all the soft interface information 731 692 * @skb: the outgoing packet 732 693 *
+1
net/batman-adv/gateway_client.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2009-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner
+19 -9
net/batman-adv/gateway_common.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2009-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner ··· 34 33 #include "tvlv.h" 35 34 36 35 /** 37 - * batadv_parse_throughput - parse supplied string buffer to extract throughput 38 - * information 36 + * batadv_parse_throughput() - parse supplied string buffer to extract 37 + * throughput information 39 38 * @net_dev: the soft interface net device 40 39 * @buff: string buffer to parse 41 40 * @description: text shown when throughput string cannot be parsed ··· 101 100 } 102 101 103 102 /** 104 - * batadv_parse_gw_bandwidth - parse supplied string buffer to extract download 105 - * and upload bandwidth information 103 + * batadv_parse_gw_bandwidth() - parse supplied string buffer to extract 104 + * download and upload bandwidth information 106 105 * @net_dev: the soft interface net device 107 106 * @buff: string buffer to parse 108 107 * @down: pointer holding the returned download bandwidth information ··· 137 136 } 138 137 139 138 /** 140 - * batadv_gw_tvlv_container_update - update the gw tvlv container after gateway 141 - * setting change 139 + * batadv_gw_tvlv_container_update() - update the gw tvlv container after 140 + * gateway setting change 142 141 * @bat_priv: the bat priv with all the soft interface information 143 142 */ 144 143 void batadv_gw_tvlv_container_update(struct batadv_priv *bat_priv) ··· 165 164 } 166 165 } 167 166 167 + /** 168 + * batadv_gw_bandwidth_set() - Parse and set download/upload gateway bandwidth 169 + * from supplied string buffer 170 + * @net_dev: netdev struct of the soft interface 171 + * @buff: the buffer containing the user data 172 + * @count: number of bytes in the buffer 173 + * 174 + * Return: 'count' on success or a negative error code in case of failure 175 + */ 168 176 ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff, 169 177 size_t count) 170 178 { ··· 217 207 } 218 208 219 209 /** 220 - * batadv_gw_tvlv_ogm_handler_v1 - process incoming gateway tvlv container 210 + * batadv_gw_tvlv_ogm_handler_v1() - process incoming gateway tvlv container 221 211 * @bat_priv: the bat priv with all the soft interface information 222 212 * @orig: the orig_node of the ogm 223 213 * @flags: flags indicating the tvlv state (see batadv_tvlv_handler_flags) ··· 258 248 } 259 249 260 250 /** 261 - * batadv_gw_init - initialise the gateway handling internals 251 + * batadv_gw_init() - initialise the gateway handling internals 262 252 * @bat_priv: the bat priv with all the soft interface information 263 253 */ 264 254 void batadv_gw_init(struct batadv_priv *bat_priv) ··· 274 264 } 275 265 276 266 /** 277 - * batadv_gw_free - free the gateway handling internals 267 + * batadv_gw_free() - free the gateway handling internals 278 268 * @bat_priv: the bat priv with all the soft interface information 279 269 */ 280 270 void batadv_gw_free(struct batadv_priv *bat_priv)
+4 -2
net/batman-adv/gateway_common.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2009-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner ··· 33 32 34 33 /** 35 34 * enum batadv_bandwidth_units - bandwidth unit types 36 - * @BATADV_BW_UNIT_KBIT: unit type kbit 37 - * @BATADV_BW_UNIT_MBIT: unit type mbit 38 35 */ 39 36 enum batadv_bandwidth_units { 37 + /** @BATADV_BW_UNIT_KBIT: unit type kbit */ 40 38 BATADV_BW_UNIT_KBIT, 39 + 40 + /** @BATADV_BW_UNIT_MBIT: unit type mbit */ 41 41 BATADV_BW_UNIT_MBIT, 42 42 }; 43 43
+50 -15
net/batman-adv/hard-interface.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Simon Wunderlich ··· 23 22 #include <linux/bug.h> 24 23 #include <linux/byteorder/generic.h> 25 24 #include <linux/errno.h> 26 - #include <linux/fs.h> 25 + #include <linux/gfp.h> 27 26 #include <linux/if.h> 28 27 #include <linux/if_arp.h> 29 28 #include <linux/if_ether.h> ··· 53 52 #include "translation-table.h" 54 53 55 54 /** 56 - * batadv_hardif_release - release hard interface from lists and queue for 55 + * batadv_hardif_release() - release hard interface from lists and queue for 57 56 * free after rcu grace period 58 57 * @ref: kref pointer of the hard interface 59 58 */ ··· 67 66 kfree_rcu(hard_iface, rcu); 68 67 } 69 68 69 + /** 70 + * batadv_hardif_get_by_netdev() - Get hard interface object of a net_device 71 + * @net_dev: net_device to search for 72 + * 73 + * Return: batadv_hard_iface of net_dev (with increased refcnt), NULL on errors 74 + */ 70 75 struct batadv_hard_iface * 71 76 batadv_hardif_get_by_netdev(const struct net_device *net_dev) 72 77 { ··· 93 86 } 94 87 95 88 /** 96 - * batadv_getlink_net - return link net namespace (of use fallback) 89 + * batadv_getlink_net() - return link net namespace (of use fallback) 97 90 * @netdev: net_device to check 98 91 * @fallback_net: return in case get_link_net is not available for @netdev 99 92 * ··· 112 105 } 113 106 114 107 /** 115 - * batadv_mutual_parents - check if two devices are each others parent 108 + * batadv_mutual_parents() - check if two devices are each others parent 116 109 * @dev1: 1st net dev 117 110 * @net1: 1st devices netns 118 111 * @dev2: 2nd net dev ··· 145 138 } 146 139 147 140 /** 148 - * batadv_is_on_batman_iface - check if a device is a batman iface descendant 141 + * batadv_is_on_batman_iface() - check if a device is a batman iface descendant 149 142 * @net_dev: the device to check 150 143 * 151 144 * If the user creates any virtual device on top of a batman-adv interface, it ··· 209 202 } 210 203 211 204 /** 212 - * batadv_get_real_netdevice - check if the given netdev struct is a virtual 205 + * batadv_get_real_netdevice() - check if the given netdev struct is a virtual 213 206 * interface on top of another 'real' interface 214 207 * @netdev: the device to check 215 208 * ··· 253 246 } 254 247 255 248 /** 256 - * batadv_get_real_netdev - check if the given net_device struct is a virtual 249 + * batadv_get_real_netdev() - check if the given net_device struct is a virtual 257 250 * interface on top of another 'real' interface 258 251 * @net_device: the device to check 259 252 * ··· 272 265 } 273 266 274 267 /** 275 - * batadv_is_wext_netdev - check if the given net_device struct is a 268 + * batadv_is_wext_netdev() - check if the given net_device struct is a 276 269 * wext wifi interface 277 270 * @net_device: the device to check 278 271 * ··· 296 289 } 297 290 298 291 /** 299 - * batadv_is_cfg80211_netdev - check if the given net_device struct is a 292 + * batadv_is_cfg80211_netdev() - check if the given net_device struct is a 300 293 * cfg80211 wifi interface 301 294 * @net_device: the device to check 302 295 * ··· 316 309 } 317 310 318 311 /** 319 - * batadv_wifi_flags_evaluate - calculate wifi flags for net_device 312 + * batadv_wifi_flags_evaluate() - calculate wifi flags for net_device 320 313 * @net_device: the device to check 321 314 * 322 315 * Return: batadv_hard_iface_wifi_flags flags of the device ··· 351 344 } 352 345 353 346 /** 354 - * batadv_is_cfg80211_hardif - check if the given hardif is a cfg80211 wifi 347 + * batadv_is_cfg80211_hardif() - check if the given hardif is a cfg80211 wifi 355 348 * interface 356 349 * @hard_iface: the device to check 357 350 * ··· 369 362 } 370 363 371 364 /** 372 - * batadv_is_wifi_hardif - check if the given hardif is a wifi interface 365 + * batadv_is_wifi_hardif() - check if the given hardif is a wifi interface 373 366 * @hard_iface: the device to check 374 367 * 375 368 * Return: true if the net device is a 802.11 wireless device, false otherwise. ··· 383 376 } 384 377 385 378 /** 386 - * batadv_hardif_no_broadcast - check whether (re)broadcast is necessary 379 + * batadv_hardif_no_broadcast() - check whether (re)broadcast is necessary 387 380 * @if_outgoing: the outgoing interface checked and considered for (re)broadcast 388 381 * @orig_addr: the originator of this packet 389 382 * @orig_neigh: originator address of the forwarder we just got the packet from ··· 567 560 soft_iface->needed_tailroom = lower_tailroom; 568 561 } 569 562 563 + /** 564 + * batadv_hardif_min_mtu() - Calculate maximum MTU for soft interface 565 + * @soft_iface: netdev struct of the soft interface 566 + * 567 + * Return: MTU for the soft-interface (limited by the minimal MTU of all active 568 + * slave interfaces) 569 + */ 570 570 int batadv_hardif_min_mtu(struct net_device *soft_iface) 571 571 { 572 572 struct batadv_priv *bat_priv = netdev_priv(soft_iface); ··· 620 606 return min_t(int, min_mtu - batadv_max_header_len(), ETH_DATA_LEN); 621 607 } 622 608 623 - /* adjusts the MTU if a new interface with a smaller MTU appeared. */ 609 + /** 610 + * batadv_update_min_mtu() - Adjusts the MTU if a new interface with a smaller 611 + * MTU appeared 612 + * @soft_iface: netdev struct of the soft interface 613 + */ 624 614 void batadv_update_min_mtu(struct net_device *soft_iface) 625 615 { 626 616 soft_iface->mtu = batadv_hardif_min_mtu(soft_iface); ··· 685 667 } 686 668 687 669 /** 688 - * batadv_master_del_slave - remove hard_iface from the current master interface 670 + * batadv_master_del_slave() - remove hard_iface from the current master iface 689 671 * @slave: the interface enslaved in another master 690 672 * @master: the master from which slave has to be removed 691 673 * ··· 709 691 return ret; 710 692 } 711 693 694 + /** 695 + * batadv_hardif_enable_interface() - Enslave hard interface to soft interface 696 + * @hard_iface: hard interface to add to soft interface 697 + * @net: the applicable net namespace 698 + * @iface_name: name of the soft interface 699 + * 700 + * Return: 0 on success or negative error number in case of failure 701 + */ 712 702 int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, 713 703 struct net *net, const char *iface_name) 714 704 { ··· 828 802 return ret; 829 803 } 830 804 805 + /** 806 + * batadv_hardif_disable_interface() - Remove hard interface from soft interface 807 + * @hard_iface: hard interface to be removed 808 + * @autodel: whether to delete soft interface when it doesn't contain any other 809 + * slave interfaces 810 + */ 831 811 void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface, 832 812 enum batadv_hard_if_cleanup autodel) 833 813 { ··· 968 936 batadv_hardif_put(hard_iface); 969 937 } 970 938 939 + /** 940 + * batadv_hardif_remove_interfaces() - Remove all hard interfaces 941 + */ 971 942 void batadv_hardif_remove_interfaces(void) 972 943 { 973 944 struct batadv_hard_iface *hard_iface, *hard_iface_tmp;
+52 -7
net/batman-adv/hard-interface.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Simon Wunderlich ··· 31 30 struct net_device; 32 31 struct net; 33 32 33 + /** 34 + * enum batadv_hard_if_state - State of a hard interface 35 + */ 34 36 enum batadv_hard_if_state { 37 + /** 38 + * @BATADV_IF_NOT_IN_USE: interface is not used as slave interface of a 39 + * batman-adv soft interface 40 + */ 35 41 BATADV_IF_NOT_IN_USE, 42 + 43 + /** 44 + * @BATADV_IF_TO_BE_REMOVED: interface will be removed from soft 45 + * interface 46 + */ 36 47 BATADV_IF_TO_BE_REMOVED, 48 + 49 + /** @BATADV_IF_INACTIVE: interface is deactivated */ 37 50 BATADV_IF_INACTIVE, 51 + 52 + /** @BATADV_IF_ACTIVE: interface is used */ 38 53 BATADV_IF_ACTIVE, 54 + 55 + /** @BATADV_IF_TO_BE_ACTIVATED: interface is getting activated */ 39 56 BATADV_IF_TO_BE_ACTIVATED, 57 + 58 + /** 59 + * @BATADV_IF_I_WANT_YOU: interface is queued up (using sysfs) for being 60 + * added as slave interface of a batman-adv soft interface 61 + */ 40 62 BATADV_IF_I_WANT_YOU, 41 63 }; 42 64 43 65 /** 44 66 * enum batadv_hard_if_bcast - broadcast avoidance options 45 - * @BATADV_HARDIF_BCAST_OK: Do broadcast on according hard interface 46 - * @BATADV_HARDIF_BCAST_NORECIPIENT: Broadcast not needed, there is no recipient 47 - * @BATADV_HARDIF_BCAST_DUPFWD: There is just the neighbor we got it from 48 - * @BATADV_HARDIF_BCAST_DUPORIG: There is just the originator 49 67 */ 50 68 enum batadv_hard_if_bcast { 69 + /** @BATADV_HARDIF_BCAST_OK: Do broadcast on according hard interface */ 51 70 BATADV_HARDIF_BCAST_OK = 0, 71 + 72 + /** 73 + * @BATADV_HARDIF_BCAST_NORECIPIENT: Broadcast not needed, there is no 74 + * recipient 75 + */ 52 76 BATADV_HARDIF_BCAST_NORECIPIENT, 77 + 78 + /** 79 + * @BATADV_HARDIF_BCAST_DUPFWD: There is just the neighbor we got it 80 + * from 81 + */ 53 82 BATADV_HARDIF_BCAST_DUPFWD, 83 + 84 + /** @BATADV_HARDIF_BCAST_DUPORIG: There is just the originator */ 54 85 BATADV_HARDIF_BCAST_DUPORIG, 55 86 }; 56 87 57 88 /** 58 89 * enum batadv_hard_if_cleanup - Cleanup modi for soft_iface after slave removal 59 - * @BATADV_IF_CLEANUP_KEEP: Don't automatically delete soft-interface 60 - * @BATADV_IF_CLEANUP_AUTO: Delete soft-interface after last slave was removed 61 90 */ 62 91 enum batadv_hard_if_cleanup { 92 + /** 93 + * @BATADV_IF_CLEANUP_KEEP: Don't automatically delete soft-interface 94 + */ 63 95 BATADV_IF_CLEANUP_KEEP, 96 + 97 + /** 98 + * @BATADV_IF_CLEANUP_AUTO: Delete soft-interface after last slave was 99 + * removed 100 + */ 64 101 BATADV_IF_CLEANUP_AUTO, 65 102 }; 66 103 ··· 121 82 u8 *orig_addr, u8 *orig_neigh); 122 83 123 84 /** 124 - * batadv_hardif_put - decrement the hard interface refcounter and possibly 85 + * batadv_hardif_put() - decrement the hard interface refcounter and possibly 125 86 * release it 126 87 * @hard_iface: the hard interface to free 127 88 */ ··· 130 91 kref_put(&hard_iface->refcount, batadv_hardif_release); 131 92 } 132 93 94 + /** 95 + * batadv_primary_if_get_selected() - Get reference to primary interface 96 + * @bat_priv: the bat priv with all the soft interface information 97 + * 98 + * Return: primary interface (with increased refcnt), otherwise NULL 99 + */ 133 100 static inline struct batadv_hard_iface * 134 101 batadv_primary_if_get_selected(struct batadv_priv *bat_priv) 135 102 {
+17 -3
net/batman-adv/hash.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2006-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Simon Wunderlich, Marek Lindner ··· 19 18 #include "hash.h" 20 19 #include "main.h" 21 20 22 - #include <linux/fs.h> 21 + #include <linux/gfp.h> 23 22 #include <linux/lockdep.h> 24 23 #include <linux/slab.h> 25 24 ··· 34 33 } 35 34 } 36 35 37 - /* free only the hashtable and the hash itself. */ 36 + /** 37 + * batadv_hash_destroy() - Free only the hashtable and the hash itself 38 + * @hash: hash object to destroy 39 + */ 38 40 void batadv_hash_destroy(struct batadv_hashtable *hash) 39 41 { 40 42 kfree(hash->list_locks); ··· 45 41 kfree(hash); 46 42 } 47 43 48 - /* allocates and clears the hash */ 44 + /** 45 + * batadv_hash_new() - Allocates and clears the hashtable 46 + * @size: number of hash buckets to allocate 47 + * 48 + * Return: newly allocated hashtable, NULL on errors 49 + */ 49 50 struct batadv_hashtable *batadv_hash_new(u32 size) 50 51 { 51 52 struct batadv_hashtable *hash; ··· 79 70 return NULL; 80 71 } 81 72 73 + /** 74 + * batadv_hash_set_lock_class() - Set specific lockdep class for hash spinlocks 75 + * @hash: hash object to modify 76 + * @key: lockdep class key address 77 + */ 82 78 void batadv_hash_set_lock_class(struct batadv_hashtable *hash, 83 79 struct lock_class_key *key) 84 80 {
+22 -6
net/batman-adv/hash.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2006-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Simon Wunderlich, Marek Lindner ··· 46 45 typedef u32 (*batadv_hashdata_choose_cb)(const void *, u32); 47 46 typedef void (*batadv_hashdata_free_cb)(struct hlist_node *, void *); 48 47 48 + /** 49 + * struct batadv_hashtable - Wrapper of simple hlist based hashtable 50 + */ 49 51 struct batadv_hashtable { 50 - struct hlist_head *table; /* the hashtable itself with the buckets */ 51 - spinlock_t *list_locks; /* spinlock for each hash list entry */ 52 - u32 size; /* size of hashtable */ 52 + /** @table: the hashtable itself with the buckets */ 53 + struct hlist_head *table; 54 + 55 + /** @list_locks: spinlock for each hash list entry */ 56 + spinlock_t *list_locks; 57 + 58 + /** @size: size of hashtable */ 59 + u32 size; 53 60 }; 54 61 55 62 /* allocates and clears the hash */ ··· 71 62 void batadv_hash_destroy(struct batadv_hashtable *hash); 72 63 73 64 /** 74 - * batadv_hash_add - adds data to the hashtable 65 + * batadv_hash_add() - adds data to the hashtable 75 66 * @hash: storage hash table 76 67 * @compare: callback to determine if 2 hash elements are identical 77 68 * @choose: callback calculating the hash index ··· 121 112 return ret; 122 113 } 123 114 124 - /* removes data from hash, if found. data could be the structure you use with 125 - * just the key filled, we just need the key for comparing. 115 + /** 116 + * batadv_hash_remove() - Removes data from hash, if found 117 + * @hash: hash table 118 + * @compare: callback to determine if 2 hash elements are identical 119 + * @choose: callback calculating the hash index 120 + * @data: data passed to the aforementioned callbacks as argument 121 + * 122 + * ata could be the structure you use with just the key filled, we just need 123 + * the key for comparing. 126 124 * 127 125 * Return: returns pointer do data on success, so you can remove the used 128 126 * structure yourself, or NULL on error
+13 -2
net/batman-adv/icmp_socket.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner ··· 27 26 #include <linux/export.h> 28 27 #include <linux/fcntl.h> 29 28 #include <linux/fs.h> 29 + #include <linux/gfp.h> 30 30 #include <linux/if_ether.h> 31 31 #include <linux/kernel.h> 32 32 #include <linux/list.h> ··· 57 55 struct batadv_icmp_header *icmph, 58 56 size_t icmp_len); 59 57 58 + /** 59 + * batadv_socket_init() - Initialize soft interface independent socket data 60 + */ 60 61 void batadv_socket_init(void) 61 62 { 62 63 memset(batadv_socket_client_hash, 0, sizeof(batadv_socket_client_hash)); ··· 319 314 .llseek = no_llseek, 320 315 }; 321 316 317 + /** 318 + * batadv_socket_setup() - Create debugfs "socket" file 319 + * @bat_priv: the bat priv with all the soft interface information 320 + * 321 + * Return: 0 on success or negative error number in case of failure 322 + */ 322 323 int batadv_socket_setup(struct batadv_priv *bat_priv) 323 324 { 324 325 struct dentry *d; ··· 344 333 } 345 334 346 335 /** 347 - * batadv_socket_add_packet - schedule an icmp packet to be sent to 336 + * batadv_socket_add_packet() - schedule an icmp packet to be sent to 348 337 * userspace on an icmp socket. 349 338 * @socket_client: the socket this packet belongs to 350 339 * @icmph: pointer to the header of the icmp packet ··· 401 390 } 402 391 403 392 /** 404 - * batadv_socket_receive_packet - schedule an icmp packet to be received 393 + * batadv_socket_receive_packet() - schedule an icmp packet to be received 405 394 * locally and sent to userspace. 406 395 * @icmph: pointer to the header of the icmp packet 407 396 * @icmp_len: total length of the icmp packet
+1
net/batman-adv/icmp_socket.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner
+19
net/batman-adv/log.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2010-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner ··· 25 24 #include <linux/export.h> 26 25 #include <linux/fcntl.h> 27 26 #include <linux/fs.h> 27 + #include <linux/gfp.h> 28 28 #include <linux/jiffies.h> 29 29 #include <linux/kernel.h> 30 30 #include <linux/module.h> ··· 88 86 return 0; 89 87 } 90 88 89 + /** 90 + * batadv_debug_log() - Add debug log entry 91 + * @bat_priv: the bat priv with all the soft interface information 92 + * @fmt: format string 93 + * 94 + * Return: 0 on success or negative error number in case of failure 95 + */ 91 96 int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...) 92 97 { 93 98 va_list args; ··· 206 197 .llseek = no_llseek, 207 198 }; 208 199 200 + /** 201 + * batadv_debug_log_setup() - Initialize debug log 202 + * @bat_priv: the bat priv with all the soft interface information 203 + * 204 + * Return: 0 on success or negative error number in case of failure 205 + */ 209 206 int batadv_debug_log_setup(struct batadv_priv *bat_priv) 210 207 { 211 208 struct dentry *d; ··· 237 222 return -ENOMEM; 238 223 } 239 224 225 + /** 226 + * batadv_debug_log_cleanup() - Destroy debug log 227 + * @bat_priv: the bat priv with all the soft interface information 228 + */ 240 229 void batadv_debug_log_cleanup(struct batadv_priv *bat_priv) 241 230 { 242 231 kfree(bat_priv->debug_log);
+52 -10
net/batman-adv/log.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Simon Wunderlich ··· 45 44 46 45 /** 47 46 * enum batadv_dbg_level - available log levels 48 - * @BATADV_DBG_BATMAN: OGM and TQ computations related messages 49 - * @BATADV_DBG_ROUTES: route added / changed / deleted 50 - * @BATADV_DBG_TT: translation table messages 51 - * @BATADV_DBG_BLA: bridge loop avoidance messages 52 - * @BATADV_DBG_DAT: ARP snooping and DAT related messages 53 - * @BATADV_DBG_NC: network coding related messages 54 - * @BATADV_DBG_MCAST: multicast related messages 55 - * @BATADV_DBG_TP_METER: throughput meter messages 56 - * @BATADV_DBG_ALL: the union of all the above log levels 57 47 */ 58 48 enum batadv_dbg_level { 49 + /** @BATADV_DBG_BATMAN: OGM and TQ computations related messages */ 59 50 BATADV_DBG_BATMAN = BIT(0), 51 + 52 + /** @BATADV_DBG_ROUTES: route added / changed / deleted */ 60 53 BATADV_DBG_ROUTES = BIT(1), 54 + 55 + /** @BATADV_DBG_TT: translation table messages */ 61 56 BATADV_DBG_TT = BIT(2), 57 + 58 + /** @BATADV_DBG_BLA: bridge loop avoidance messages */ 62 59 BATADV_DBG_BLA = BIT(3), 60 + 61 + /** @BATADV_DBG_DAT: ARP snooping and DAT related messages */ 63 62 BATADV_DBG_DAT = BIT(4), 63 + 64 + /** @BATADV_DBG_NC: network coding related messages */ 64 65 BATADV_DBG_NC = BIT(5), 66 + 67 + /** @BATADV_DBG_MCAST: multicast related messages */ 65 68 BATADV_DBG_MCAST = BIT(6), 69 + 70 + /** @BATADV_DBG_TP_METER: throughput meter messages */ 66 71 BATADV_DBG_TP_METER = BIT(7), 72 + 73 + /** @BATADV_DBG_ALL: the union of all the above log levels */ 67 74 BATADV_DBG_ALL = 255, 68 75 }; 69 76 ··· 79 70 int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...) 80 71 __printf(2, 3); 81 72 82 - /* possibly ratelimited debug output */ 73 + /** 74 + * _batadv_dbg() - Store debug output with(out) ratelimiting 75 + * @type: type of debug message 76 + * @bat_priv: the bat priv with all the soft interface information 77 + * @ratelimited: whether output should be rate limited 78 + * @fmt: format string 79 + * @arg...: variable arguments 80 + */ 83 81 #define _batadv_dbg(type, bat_priv, ratelimited, fmt, arg...) \ 84 82 do { \ 85 83 struct batadv_priv *__batpriv = (bat_priv); \ ··· 105 89 } 106 90 #endif 107 91 92 + /** 93 + * batadv_dbg() - Store debug output without ratelimiting 94 + * @type: type of debug message 95 + * @bat_priv: the bat priv with all the soft interface information 96 + * @arg...: format string and variable arguments 97 + */ 108 98 #define batadv_dbg(type, bat_priv, arg...) \ 109 99 _batadv_dbg(type, bat_priv, 0, ## arg) 100 + 101 + /** 102 + * batadv_dbg_ratelimited() - Store debug output with ratelimiting 103 + * @type: type of debug message 104 + * @bat_priv: the bat priv with all the soft interface information 105 + * @arg...: format string and variable arguments 106 + */ 110 107 #define batadv_dbg_ratelimited(type, bat_priv, arg...) \ 111 108 _batadv_dbg(type, bat_priv, 1, ## arg) 112 109 110 + /** 111 + * batadv_info() - Store message in debug buffer and print it to kmsg buffer 112 + * @net_dev: the soft interface net device 113 + * @fmt: format string 114 + * @arg...: variable arguments 115 + */ 113 116 #define batadv_info(net_dev, fmt, arg...) \ 114 117 do { \ 115 118 struct net_device *_netdev = (net_dev); \ ··· 136 101 batadv_dbg(BATADV_DBG_ALL, _batpriv, fmt, ## arg); \ 137 102 pr_info("%s: " fmt, _netdev->name, ## arg); \ 138 103 } while (0) 104 + 105 + /** 106 + * batadv_err() - Store error in debug buffer and print it to kmsg buffer 107 + * @net_dev: the soft interface net device 108 + * @fmt: format string 109 + * @arg...: variable arguments 110 + */ 139 111 #define batadv_err(net_dev, fmt, arg...) \ 140 112 do { \ 141 113 struct net_device *_netdev = (net_dev); \
+42 -10
net/batman-adv/main.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Simon Wunderlich ··· 19 18 #include "main.h" 20 19 21 20 #include <linux/atomic.h> 22 - #include <linux/bug.h> 21 + #include <linux/build_bug.h> 23 22 #include <linux/byteorder/generic.h> 24 23 #include <linux/crc32c.h> 25 24 #include <linux/errno.h> 26 - #include <linux/fs.h> 27 25 #include <linux/genetlink.h> 26 + #include <linux/gfp.h> 28 27 #include <linux/if_ether.h> 29 28 #include <linux/if_vlan.h> 30 29 #include <linux/init.h> ··· 140 139 batadv_tt_cache_destroy(); 141 140 } 142 141 142 + /** 143 + * batadv_mesh_init() - Initialize soft interface 144 + * @soft_iface: netdev struct of the soft interface 145 + * 146 + * Return: 0 on success or negative error number in case of failure 147 + */ 143 148 int batadv_mesh_init(struct net_device *soft_iface) 144 149 { 145 150 struct batadv_priv *bat_priv = netdev_priv(soft_iface); ··· 223 216 return ret; 224 217 } 225 218 219 + /** 220 + * batadv_mesh_free() - Deinitialize soft interface 221 + * @soft_iface: netdev struct of the soft interface 222 + */ 226 223 void batadv_mesh_free(struct net_device *soft_iface) 227 224 { 228 225 struct batadv_priv *bat_priv = netdev_priv(soft_iface); ··· 266 255 } 267 256 268 257 /** 269 - * batadv_is_my_mac - check if the given mac address belongs to any of the real 270 - * interfaces in the current mesh 258 + * batadv_is_my_mac() - check if the given mac address belongs to any of the 259 + * real interfaces in the current mesh 271 260 * @bat_priv: the bat priv with all the soft interface information 272 261 * @addr: the address to check 273 262 * ··· 297 286 298 287 #ifdef CONFIG_BATMAN_ADV_DEBUGFS 299 288 /** 300 - * batadv_seq_print_text_primary_if_get - called from debugfs table printing 289 + * batadv_seq_print_text_primary_if_get() - called from debugfs table printing 301 290 * function that requires the primary interface 302 291 * @seq: debugfs table seq_file struct 303 292 * ··· 334 323 #endif 335 324 336 325 /** 337 - * batadv_max_header_len - calculate maximum encapsulation overhead for a 326 + * batadv_max_header_len() - calculate maximum encapsulation overhead for a 338 327 * payload packet 339 328 * 340 329 * Return: the maximum encapsulation overhead in bytes. ··· 359 348 } 360 349 361 350 /** 362 - * batadv_skb_set_priority - sets skb priority according to packet content 351 + * batadv_skb_set_priority() - sets skb priority according to packet content 363 352 * @skb: the packet to be sent 364 353 * @offset: offset to the packet content 365 354 * ··· 422 411 423 412 /* incoming packets with the batman ethertype received on any active hard 424 413 * interface 414 + */ 415 + 416 + /** 417 + * batadv_batman_skb_recv() - Handle incoming message from an hard interface 418 + * @skb: the received packet 419 + * @dev: the net device that the packet was received on 420 + * @ptype: packet type of incoming packet (ETH_P_BATMAN) 421 + * @orig_dev: the original receive net device (e.g. bonded device) 422 + * 423 + * Return: NET_RX_SUCCESS on success or NET_RX_DROP in case of failure 425 424 */ 426 425 int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev, 427 426 struct packet_type *ptype, ··· 556 535 batadv_rx_handler[BATADV_UNICAST_FRAG] = batadv_recv_frag_packet; 557 536 } 558 537 538 + /** 539 + * batadv_recv_handler_register() - Register handler for batman-adv packet type 540 + * @packet_type: batadv_packettype which should be handled 541 + * @recv_handler: receive handler for the packet type 542 + * 543 + * Return: 0 on success or negative error number in case of failure 544 + */ 559 545 int 560 546 batadv_recv_handler_register(u8 packet_type, 561 547 int (*recv_handler)(struct sk_buff *, ··· 580 552 return 0; 581 553 } 582 554 555 + /** 556 + * batadv_recv_handler_unregister() - Unregister handler for packet type 557 + * @packet_type: batadv_packettype which should no longer be handled 558 + */ 583 559 void batadv_recv_handler_unregister(u8 packet_type) 584 560 { 585 561 batadv_rx_handler[packet_type] = batadv_recv_unhandled_packet; 586 562 } 587 563 588 564 /** 589 - * batadv_skb_crc32 - calculate CRC32 of the whole packet and skip bytes in 565 + * batadv_skb_crc32() - calculate CRC32 of the whole packet and skip bytes in 590 566 * the header 591 567 * @skb: skb pointing to fragmented socket buffers 592 568 * @payload_ptr: Pointer to position inside the head buffer of the skb ··· 623 591 } 624 592 625 593 /** 626 - * batadv_get_vid - extract the VLAN identifier from skb if any 594 + * batadv_get_vid() - extract the VLAN identifier from skb if any 627 595 * @skb: the buffer containing the packet 628 596 * @header_len: length of the batman header preceding the ethernet header 629 597 * ··· 650 618 } 651 619 652 620 /** 653 - * batadv_vlan_ap_isola_get - return the AP isolation status for the given vlan 621 + * batadv_vlan_ap_isola_get() - return AP isolation status for the given vlan 654 622 * @bat_priv: the bat priv with all the soft interface information 655 623 * @vid: the VLAN identifier for which the AP isolation attributed as to be 656 624 * looked up
+106 -17
net/batman-adv/main.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Simon Wunderlich ··· 25 24 #define BATADV_DRIVER_DEVICE "batman-adv" 26 25 27 26 #ifndef BATADV_SOURCE_VERSION 28 - #define BATADV_SOURCE_VERSION "2017.4" 27 + #define BATADV_SOURCE_VERSION "2018.0" 29 28 #endif 30 29 31 30 /* B.A.T.M.A.N. parameters */ ··· 141 140 */ 142 141 #define BATADV_TP_MAX_NUM 5 143 142 143 + /** 144 + * enum batadv_mesh_state - State of a soft interface 145 + */ 144 146 enum batadv_mesh_state { 147 + /** @BATADV_MESH_INACTIVE: soft interface is not yet running */ 145 148 BATADV_MESH_INACTIVE, 149 + 150 + /** @BATADV_MESH_ACTIVE: interface is up and running */ 146 151 BATADV_MESH_ACTIVE, 152 + 153 + /** @BATADV_MESH_DEACTIVATING: interface is getting shut down */ 147 154 BATADV_MESH_DEACTIVATING, 148 155 }; 149 156 150 157 #define BATADV_BCAST_QUEUE_LEN 256 151 158 #define BATADV_BATMAN_QUEUE_LEN 256 152 159 160 + /** 161 + * enum batadv_uev_action - action type of uevent 162 + */ 153 163 enum batadv_uev_action { 164 + /** @BATADV_UEV_ADD: gateway was selected (after none was selected) */ 154 165 BATADV_UEV_ADD = 0, 166 + 167 + /** 168 + * @BATADV_UEV_DEL: selected gateway was removed and none is selected 169 + * anymore 170 + */ 155 171 BATADV_UEV_DEL, 172 + 173 + /** 174 + * @BATADV_UEV_CHANGE: a different gateway was selected as based gateway 175 + */ 156 176 BATADV_UEV_CHANGE, 177 + 178 + /** 179 + * @BATADV_UEV_LOOPDETECT: loop was detected which cannot be handled by 180 + * bridge loop avoidance 181 + */ 157 182 BATADV_UEV_LOOPDETECT, 158 183 }; 159 184 185 + /** 186 + * enum batadv_uev_type - Type of uevent 187 + */ 160 188 enum batadv_uev_type { 189 + /** @BATADV_UEV_GW: selected gateway was modified */ 161 190 BATADV_UEV_GW = 0, 191 + 192 + /** @BATADV_UEV_BLA: bridge loop avoidance event */ 162 193 BATADV_UEV_BLA, 163 194 }; 164 195 ··· 235 202 struct sk_buff; 236 203 237 204 /** 238 - * batadv_print_vid - return printable version of vid information 205 + * batadv_print_vid() - return printable version of vid information 239 206 * @vid: the VLAN identifier 240 207 * 241 208 * Return: -1 when no VLAN is used, VLAN id otherwise ··· 271 238 __be32 batadv_skb_crc32(struct sk_buff *skb, u8 *payload_ptr); 272 239 273 240 /** 274 - * batadv_compare_eth - Compare two not u16 aligned Ethernet addresses 241 + * batadv_compare_eth() - Compare two not u16 aligned Ethernet addresses 275 242 * @data1: Pointer to a six-byte array containing the Ethernet address 276 243 * @data2: Pointer other six-byte array containing the Ethernet address 277 244 * ··· 285 252 } 286 253 287 254 /** 288 - * batadv_has_timed_out - compares current time (jiffies) and timestamp + 255 + * batadv_has_timed_out() - compares current time (jiffies) and timestamp + 289 256 * timeout 290 257 * @timestamp: base value to compare with (in jiffies) 291 258 * @timeout: added to base value before comparing (in milliseconds) ··· 298 265 return time_is_before_jiffies(timestamp + msecs_to_jiffies(timeout)); 299 266 } 300 267 268 + /** 269 + * batadv_atomic_dec_not_zero() - Decrease unless the number is 0 270 + * @v: pointer of type atomic_t 271 + * 272 + * Return: non-zero if v was not 0, and zero otherwise. 273 + */ 301 274 #define batadv_atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0) 302 275 303 - /* Returns the smallest signed integer in two's complement with the sizeof x */ 276 + /** 277 + * batadv_smallest_signed_int() - Returns the smallest signed integer in two's 278 + * complement with the sizeof x 279 + * @x: type of integer 280 + * 281 + * Return: smallest signed integer of type 282 + */ 304 283 #define batadv_smallest_signed_int(x) (1u << (7u + 8u * (sizeof(x) - 1u))) 305 284 306 - /* Checks if a sequence number x is a predecessor/successor of y. 307 - * they handle overflows/underflows and can correctly check for a 308 - * predecessor/successor unless the variable sequence number has grown by 309 - * more then 2**(bitwidth(x)-1)-1. 285 + /** 286 + * batadv_seq_before() - Checks if a sequence number x is a predecessor of y 287 + * @x: potential predecessor of @y 288 + * @y: value to compare @x against 289 + * 290 + * It handles overflows/underflows and can correctly check for a predecessor 291 + * unless the variable sequence number has grown by more then 292 + * 2**(bitwidth(x)-1)-1. 293 + * 310 294 * This means that for a u8 with the maximum value 255, it would think: 311 - * - when adding nothing - it is neither a predecessor nor a successor 312 - * - before adding more than 127 to the starting value - it is a predecessor, 313 - * - when adding 128 - it is neither a predecessor nor a successor, 314 - * - after adding more than 127 to the starting value - it is a successor 295 + * 296 + * * when adding nothing - it is neither a predecessor nor a successor 297 + * * before adding more than 127 to the starting value - it is a predecessor, 298 + * * when adding 128 - it is neither a predecessor nor a successor, 299 + * * after adding more than 127 to the starting value - it is a successor 300 + * 301 + * Return: true when x is a predecessor of y, false otherwise 315 302 */ 316 303 #define batadv_seq_before(x, y) ({typeof(x)_d1 = (x); \ 317 304 typeof(y)_d2 = (y); \ 318 305 typeof(x)_dummy = (_d1 - _d2); \ 319 306 (void)(&_d1 == &_d2); \ 320 307 _dummy > batadv_smallest_signed_int(_dummy); }) 308 + 309 + /** 310 + * batadv_seq_after() - Checks if a sequence number x is a successor of y 311 + * @x: potential sucessor of @y 312 + * @y: value to compare @x against 313 + * 314 + * It handles overflows/underflows and can correctly check for a successor 315 + * unless the variable sequence number has grown by more then 316 + * 2**(bitwidth(x)-1)-1. 317 + * 318 + * This means that for a u8 with the maximum value 255, it would think: 319 + * 320 + * * when adding nothing - it is neither a predecessor nor a successor 321 + * * before adding more than 127 to the starting value - it is a predecessor, 322 + * * when adding 128 - it is neither a predecessor nor a successor, 323 + * * after adding more than 127 to the starting value - it is a successor 324 + * 325 + * Return: true when x is a successor of y, false otherwise 326 + */ 321 327 #define batadv_seq_after(x, y) batadv_seq_before(y, x) 322 328 323 - /* Stop preemption on local cpu while incrementing the counter */ 329 + /** 330 + * batadv_add_counter() - Add to per cpu statistics counter of soft interface 331 + * @bat_priv: the bat priv with all the soft interface information 332 + * @idx: counter index which should be modified 333 + * @count: value to increase counter by 334 + * 335 + * Stop preemption on local cpu while incrementing the counter 336 + */ 324 337 static inline void batadv_add_counter(struct batadv_priv *bat_priv, size_t idx, 325 338 size_t count) 326 339 { 327 340 this_cpu_add(bat_priv->bat_counters[idx], count); 328 341 } 329 342 343 + /** 344 + * batadv_inc_counter() - Increase per cpu statistics counter of soft interface 345 + * @b: the bat priv with all the soft interface information 346 + * @i: counter index which should be modified 347 + */ 330 348 #define batadv_inc_counter(b, i) batadv_add_counter(b, i, 1) 331 349 332 - /* Define a macro to reach the control buffer of the skb. The members of the 333 - * control buffer are defined in struct batadv_skb_cb in types.h. 334 - * The macro is inspired by the similar macro TCP_SKB_CB() in tcp.h. 350 + /** 351 + * BATADV_SKB_CB() - Get batadv_skb_cb from skb control buffer 352 + * @__skb: skb holding the control buffer 353 + * 354 + * The members of the control buffer are defined in struct batadv_skb_cb in 355 + * types.h. The macro is inspired by the similar macro TCP_SKB_CB() in tcp.h. 356 + * 357 + * Return: pointer to the batadv_skb_cb of the skb 335 358 */ 336 359 #define BATADV_SKB_CB(__skb) ((struct batadv_skb_cb *)&((__skb)->cb[0])) 337 360
+43 -38
net/batman-adv/multicast.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2014-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Linus Lüssing ··· 25 24 #include <linux/byteorder/generic.h> 26 25 #include <linux/errno.h> 27 26 #include <linux/etherdevice.h> 28 - #include <linux/fs.h> 27 + #include <linux/gfp.h> 29 28 #include <linux/icmpv6.h> 30 29 #include <linux/if_bridge.h> 31 30 #include <linux/if_ether.h> ··· 66 65 static void batadv_mcast_mla_update(struct work_struct *work); 67 66 68 67 /** 69 - * batadv_mcast_start_timer - schedule the multicast periodic worker 68 + * batadv_mcast_start_timer() - schedule the multicast periodic worker 70 69 * @bat_priv: the bat priv with all the soft interface information 71 70 */ 72 71 static void batadv_mcast_start_timer(struct batadv_priv *bat_priv) ··· 76 75 } 77 76 78 77 /** 79 - * batadv_mcast_get_bridge - get the bridge on top of the softif if it exists 78 + * batadv_mcast_get_bridge() - get the bridge on top of the softif if it exists 80 79 * @soft_iface: netdev struct of the mesh interface 81 80 * 82 81 * If the given soft interface has a bridge on top then the refcount ··· 102 101 } 103 102 104 103 /** 105 - * batadv_mcast_mla_softif_get - get softif multicast listeners 104 + * batadv_mcast_mla_softif_get() - get softif multicast listeners 106 105 * @dev: the device to collect multicast addresses from 107 106 * @mcast_list: a list to put found addresses into 108 107 * ··· 148 147 } 149 148 150 149 /** 151 - * batadv_mcast_mla_is_duplicate - check whether an address is in a list 150 + * batadv_mcast_mla_is_duplicate() - check whether an address is in a list 152 151 * @mcast_addr: the multicast address to check 153 152 * @mcast_list: the list with multicast addresses to search in 154 153 * ··· 168 167 } 169 168 170 169 /** 171 - * batadv_mcast_mla_br_addr_cpy - copy a bridge multicast address 170 + * batadv_mcast_mla_br_addr_cpy() - copy a bridge multicast address 172 171 * @dst: destination to write to - a multicast MAC address 173 172 * @src: source to read from - a multicast IP address 174 173 * ··· 192 191 } 193 192 194 193 /** 195 - * batadv_mcast_mla_bridge_get - get bridged-in multicast listeners 194 + * batadv_mcast_mla_bridge_get() - get bridged-in multicast listeners 196 195 * @dev: a bridge slave whose bridge to collect multicast addresses from 197 196 * @mcast_list: a list to put found addresses into 198 197 * ··· 245 244 } 246 245 247 246 /** 248 - * batadv_mcast_mla_list_free - free a list of multicast addresses 247 + * batadv_mcast_mla_list_free() - free a list of multicast addresses 249 248 * @mcast_list: the list to free 250 249 * 251 250 * Removes and frees all items in the given mcast_list. ··· 262 261 } 263 262 264 263 /** 265 - * batadv_mcast_mla_tt_retract - clean up multicast listener announcements 264 + * batadv_mcast_mla_tt_retract() - clean up multicast listener announcements 266 265 * @bat_priv: the bat priv with all the soft interface information 267 266 * @mcast_list: a list of addresses which should _not_ be removed 268 267 * ··· 298 297 } 299 298 300 299 /** 301 - * batadv_mcast_mla_tt_add - add multicast listener announcements 300 + * batadv_mcast_mla_tt_add() - add multicast listener announcements 302 301 * @bat_priv: the bat priv with all the soft interface information 303 302 * @mcast_list: a list of addresses which are going to get added 304 303 * ··· 334 333 } 335 334 336 335 /** 337 - * batadv_mcast_has_bridge - check whether the soft-iface is bridged 336 + * batadv_mcast_has_bridge() - check whether the soft-iface is bridged 338 337 * @bat_priv: the bat priv with all the soft interface information 339 338 * 340 339 * Checks whether there is a bridge on top of our soft interface. ··· 355 354 } 356 355 357 356 /** 358 - * batadv_mcast_querier_log - debug output regarding the querier status on link 357 + * batadv_mcast_querier_log() - debug output regarding the querier status on 358 + * link 359 359 * @bat_priv: the bat priv with all the soft interface information 360 360 * @str_proto: a string for the querier protocol (e.g. "IGMP" or "MLD") 361 361 * @old_state: the previous querier state on our link ··· 407 405 } 408 406 409 407 /** 410 - * batadv_mcast_bridge_log - debug output for topology changes in bridged setups 408 + * batadv_mcast_bridge_log() - debug output for topology changes in bridged 409 + * setups 411 410 * @bat_priv: the bat priv with all the soft interface information 412 411 * @bridged: a flag about whether the soft interface is currently bridged or not 413 412 * @querier_ipv4: (maybe) new status of a potential, selected IGMP querier ··· 447 444 } 448 445 449 446 /** 450 - * batadv_mcast_flags_logs - output debug information about mcast flag changes 447 + * batadv_mcast_flags_logs() - output debug information about mcast flag changes 451 448 * @bat_priv: the bat priv with all the soft interface information 452 449 * @flags: flags indicating the new multicast state 453 450 * ··· 473 470 } 474 471 475 472 /** 476 - * batadv_mcast_mla_tvlv_update - update multicast tvlv 473 + * batadv_mcast_mla_tvlv_update() - update multicast tvlv 477 474 * @bat_priv: the bat priv with all the soft interface information 478 475 * 479 476 * Updates the own multicast tvlv with our current multicast related settings, ··· 548 545 } 549 546 550 547 /** 551 - * __batadv_mcast_mla_update - update the own MLAs 548 + * __batadv_mcast_mla_update() - update the own MLAs 552 549 * @bat_priv: the bat priv with all the soft interface information 553 550 * 554 551 * Updates the own multicast listener announcements in the translation ··· 585 582 } 586 583 587 584 /** 588 - * batadv_mcast_mla_update - update the own MLAs 585 + * batadv_mcast_mla_update() - update the own MLAs 589 586 * @work: kernel work struct 590 587 * 591 588 * Updates the own multicast listener announcements in the translation ··· 608 605 } 609 606 610 607 /** 611 - * batadv_mcast_is_report_ipv4 - check for IGMP reports 608 + * batadv_mcast_is_report_ipv4() - check for IGMP reports 612 609 * @skb: the ethernet frame destined for the mesh 613 610 * 614 611 * This call might reallocate skb data. ··· 633 630 } 634 631 635 632 /** 636 - * batadv_mcast_forw_mode_check_ipv4 - check for optimized forwarding potential 633 + * batadv_mcast_forw_mode_check_ipv4() - check for optimized forwarding 634 + * potential 637 635 * @bat_priv: the bat priv with all the soft interface information 638 636 * @skb: the IPv4 packet to check 639 637 * @is_unsnoopable: stores whether the destination is snoopable ··· 675 671 } 676 672 677 673 /** 678 - * batadv_mcast_is_report_ipv6 - check for MLD reports 674 + * batadv_mcast_is_report_ipv6() - check for MLD reports 679 675 * @skb: the ethernet frame destined for the mesh 680 676 * 681 677 * This call might reallocate skb data. ··· 699 695 } 700 696 701 697 /** 702 - * batadv_mcast_forw_mode_check_ipv6 - check for optimized forwarding potential 698 + * batadv_mcast_forw_mode_check_ipv6() - check for optimized forwarding 699 + * potential 703 700 * @bat_priv: the bat priv with all the soft interface information 704 701 * @skb: the IPv6 packet to check 705 702 * @is_unsnoopable: stores whether the destination is snoopable ··· 741 736 } 742 737 743 738 /** 744 - * batadv_mcast_forw_mode_check - check for optimized forwarding potential 739 + * batadv_mcast_forw_mode_check() - check for optimized forwarding potential 745 740 * @bat_priv: the bat priv with all the soft interface information 746 741 * @skb: the multicast frame to check 747 742 * @is_unsnoopable: stores whether the destination is snoopable ··· 779 774 } 780 775 781 776 /** 782 - * batadv_mcast_forw_want_all_ip_count - count nodes with unspecific mcast 777 + * batadv_mcast_forw_want_all_ip_count() - count nodes with unspecific mcast 783 778 * interest 784 779 * @bat_priv: the bat priv with all the soft interface information 785 780 * @ethhdr: ethernet header of a packet ··· 803 798 } 804 799 805 800 /** 806 - * batadv_mcast_forw_tt_node_get - get a multicast tt node 801 + * batadv_mcast_forw_tt_node_get() - get a multicast tt node 807 802 * @bat_priv: the bat priv with all the soft interface information 808 803 * @ethhdr: the ether header containing the multicast destination 809 804 * ··· 819 814 } 820 815 821 816 /** 822 - * batadv_mcast_forw_ipv4_node_get - get a node with an ipv4 flag 817 + * batadv_mcast_forw_ipv4_node_get() - get a node with an ipv4 flag 823 818 * @bat_priv: the bat priv with all the soft interface information 824 819 * 825 820 * Return: an orig_node which has the BATADV_MCAST_WANT_ALL_IPV4 flag set and ··· 846 841 } 847 842 848 843 /** 849 - * batadv_mcast_forw_ipv6_node_get - get a node with an ipv6 flag 844 + * batadv_mcast_forw_ipv6_node_get() - get a node with an ipv6 flag 850 845 * @bat_priv: the bat priv with all the soft interface information 851 846 * 852 847 * Return: an orig_node which has the BATADV_MCAST_WANT_ALL_IPV6 flag set ··· 873 868 } 874 869 875 870 /** 876 - * batadv_mcast_forw_ip_node_get - get a node with an ipv4/ipv6 flag 871 + * batadv_mcast_forw_ip_node_get() - get a node with an ipv4/ipv6 flag 877 872 * @bat_priv: the bat priv with all the soft interface information 878 873 * @ethhdr: an ethernet header to determine the protocol family from 879 874 * ··· 897 892 } 898 893 899 894 /** 900 - * batadv_mcast_forw_unsnoop_node_get - get a node with an unsnoopable flag 895 + * batadv_mcast_forw_unsnoop_node_get() - get a node with an unsnoopable flag 901 896 * @bat_priv: the bat priv with all the soft interface information 902 897 * 903 898 * Return: an orig_node which has the BATADV_MCAST_WANT_ALL_UNSNOOPABLES flag ··· 924 919 } 925 920 926 921 /** 927 - * batadv_mcast_forw_mode - check on how to forward a multicast packet 922 + * batadv_mcast_forw_mode() - check on how to forward a multicast packet 928 923 * @bat_priv: the bat priv with all the soft interface information 929 924 * @skb: The multicast packet to check 930 925 * @orig: an originator to be set to forward the skb to ··· 978 973 } 979 974 980 975 /** 981 - * batadv_mcast_want_unsnoop_update - update unsnoop counter and list 976 + * batadv_mcast_want_unsnoop_update() - update unsnoop counter and list 982 977 * @bat_priv: the bat priv with all the soft interface information 983 978 * @orig: the orig_node which multicast state might have changed of 984 979 * @mcast_flags: flags indicating the new multicast state ··· 1023 1018 } 1024 1019 1025 1020 /** 1026 - * batadv_mcast_want_ipv4_update - update want-all-ipv4 counter and list 1021 + * batadv_mcast_want_ipv4_update() - update want-all-ipv4 counter and list 1027 1022 * @bat_priv: the bat priv with all the soft interface information 1028 1023 * @orig: the orig_node which multicast state might have changed of 1029 1024 * @mcast_flags: flags indicating the new multicast state ··· 1068 1063 } 1069 1064 1070 1065 /** 1071 - * batadv_mcast_want_ipv6_update - update want-all-ipv6 counter and list 1066 + * batadv_mcast_want_ipv6_update() - update want-all-ipv6 counter and list 1072 1067 * @bat_priv: the bat priv with all the soft interface information 1073 1068 * @orig: the orig_node which multicast state might have changed of 1074 1069 * @mcast_flags: flags indicating the new multicast state ··· 1113 1108 } 1114 1109 1115 1110 /** 1116 - * batadv_mcast_tvlv_ogm_handler - process incoming multicast tvlv container 1111 + * batadv_mcast_tvlv_ogm_handler() - process incoming multicast tvlv container 1117 1112 * @bat_priv: the bat priv with all the soft interface information 1118 1113 * @orig: the orig_node of the ogm 1119 1114 * @flags: flags indicating the tvlv state (see batadv_tvlv_handler_flags) ··· 1169 1164 } 1170 1165 1171 1166 /** 1172 - * batadv_mcast_init - initialize the multicast optimizations structures 1167 + * batadv_mcast_init() - initialize the multicast optimizations structures 1173 1168 * @bat_priv: the bat priv with all the soft interface information 1174 1169 */ 1175 1170 void batadv_mcast_init(struct batadv_priv *bat_priv) ··· 1184 1179 1185 1180 #ifdef CONFIG_BATMAN_ADV_DEBUGFS 1186 1181 /** 1187 - * batadv_mcast_flags_print_header - print own mcast flags to debugfs table 1182 + * batadv_mcast_flags_print_header() - print own mcast flags to debugfs table 1188 1183 * @bat_priv: the bat priv with all the soft interface information 1189 1184 * @seq: debugfs table seq_file struct 1190 1185 * ··· 1225 1220 } 1226 1221 1227 1222 /** 1228 - * batadv_mcast_flags_seq_print_text - print the mcast flags of other nodes 1223 + * batadv_mcast_flags_seq_print_text() - print the mcast flags of other nodes 1229 1224 * @seq: seq file to print on 1230 1225 * @offset: not used 1231 1226 * ··· 1286 1281 #endif 1287 1282 1288 1283 /** 1289 - * batadv_mcast_free - free the multicast optimizations structures 1284 + * batadv_mcast_free() - free the multicast optimizations structures 1290 1285 * @bat_priv: the bat priv with all the soft interface information 1291 1286 */ 1292 1287 void batadv_mcast_free(struct batadv_priv *bat_priv) ··· 1301 1296 } 1302 1297 1303 1298 /** 1304 - * batadv_mcast_purge_orig - reset originator global mcast state modifications 1299 + * batadv_mcast_purge_orig() - reset originator global mcast state modifications 1305 1300 * @orig: the originator which is going to get purged 1306 1301 */ 1307 1302 void batadv_mcast_purge_orig(struct batadv_orig_node *orig)
+12 -5
net/batman-adv/multicast.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2014-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Linus Lüssing ··· 26 25 27 26 /** 28 27 * enum batadv_forw_mode - the way a packet should be forwarded as 29 - * @BATADV_FORW_ALL: forward the packet to all nodes (currently via classic 30 - * flooding) 31 - * @BATADV_FORW_SINGLE: forward the packet to a single node (currently via the 32 - * BATMAN unicast routing protocol) 33 - * @BATADV_FORW_NONE: don't forward, drop it 34 28 */ 35 29 enum batadv_forw_mode { 30 + /** 31 + * @BATADV_FORW_ALL: forward the packet to all nodes (currently via 32 + * classic flooding) 33 + */ 36 34 BATADV_FORW_ALL, 35 + 36 + /** 37 + * @BATADV_FORW_SINGLE: forward the packet to a single node (currently 38 + * via the BATMAN unicast routing protocol) 39 + */ 37 40 BATADV_FORW_SINGLE, 41 + 42 + /** @BATADV_FORW_NONE: don't forward, drop it */ 38 43 BATADV_FORW_NONE, 39 44 }; 40 45
+13 -12
net/batman-adv/netlink.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2016-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Matthias Schiffer ··· 24 23 #include <linux/cache.h> 25 24 #include <linux/errno.h> 26 25 #include <linux/export.h> 27 - #include <linux/fs.h> 28 26 #include <linux/genetlink.h> 27 + #include <linux/gfp.h> 29 28 #include <linux/if_ether.h> 30 29 #include <linux/init.h> 31 30 #include <linux/kernel.h> ··· 100 99 }; 101 100 102 101 /** 103 - * batadv_netlink_get_ifindex - Extract an interface index from a message 102 + * batadv_netlink_get_ifindex() - Extract an interface index from a message 104 103 * @nlh: Message header 105 104 * @attrtype: Attribute which holds an interface index 106 105 * ··· 115 114 } 116 115 117 116 /** 118 - * batadv_netlink_mesh_info_put - fill in generic information about mesh 117 + * batadv_netlink_mesh_info_put() - fill in generic information about mesh 119 118 * interface 120 119 * @msg: netlink message to be sent back 121 120 * @soft_iface: interface for which the data should be taken ··· 170 169 } 171 170 172 171 /** 173 - * batadv_netlink_get_mesh_info - handle incoming BATADV_CMD_GET_MESH_INFO 172 + * batadv_netlink_get_mesh_info() - handle incoming BATADV_CMD_GET_MESH_INFO 174 173 * netlink request 175 174 * @skb: received netlink message 176 175 * @info: receiver information ··· 231 230 } 232 231 233 232 /** 234 - * batadv_netlink_tp_meter_put - Fill information of started tp_meter session 233 + * batadv_netlink_tp_meter_put() - Fill information of started tp_meter session 235 234 * @msg: netlink message to be sent back 236 235 * @cookie: tp meter session cookie 237 236 * ··· 247 246 } 248 247 249 248 /** 250 - * batadv_netlink_tpmeter_notify - send tp_meter result via netlink to client 249 + * batadv_netlink_tpmeter_notify() - send tp_meter result via netlink to client 251 250 * @bat_priv: the bat priv with all the soft interface information 252 251 * @dst: destination of tp_meter session 253 252 * @result: reason for tp meter session stop ··· 310 309 } 311 310 312 311 /** 313 - * batadv_netlink_tp_meter_start - Start a new tp_meter session 312 + * batadv_netlink_tp_meter_start() - Start a new tp_meter session 314 313 * @skb: received netlink message 315 314 * @info: receiver information 316 315 * ··· 387 386 } 388 387 389 388 /** 390 - * batadv_netlink_tp_meter_start - Cancel a running tp_meter session 389 + * batadv_netlink_tp_meter_start() - Cancel a running tp_meter session 391 390 * @skb: received netlink message 392 391 * @info: receiver information 393 392 * ··· 432 431 } 433 432 434 433 /** 435 - * batadv_netlink_dump_hardif_entry - Dump one hard interface into a message 434 + * batadv_netlink_dump_hardif_entry() - Dump one hard interface into a message 436 435 * @msg: Netlink message to dump into 437 436 * @portid: Port making netlink request 438 437 * @seq: Sequence number of netlink message ··· 474 473 } 475 474 476 475 /** 477 - * batadv_netlink_dump_hardifs - Dump all hard interface into a messages 476 + * batadv_netlink_dump_hardifs() - Dump all hard interface into a messages 478 477 * @msg: Netlink message to dump into 479 478 * @cb: Parameters from query 480 479 * ··· 621 620 }; 622 621 623 622 /** 624 - * batadv_netlink_register - register batadv genl netlink family 623 + * batadv_netlink_register() - register batadv genl netlink family 625 624 */ 626 625 void __init batadv_netlink_register(void) 627 626 { ··· 633 632 } 634 633 635 634 /** 636 - * batadv_netlink_unregister - unregister batadv genl netlink family 635 + * batadv_netlink_unregister() - unregister batadv genl netlink family 637 636 */ 638 637 void batadv_netlink_unregister(void) 639 638 {
+1
net/batman-adv/netlink.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2016-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Matthias Schiffer
+64 -60
net/batman-adv/network-coding.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2012-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Martin Hundebøll, Jeppe Ledet-Pedersen ··· 26 25 #include <linux/debugfs.h> 27 26 #include <linux/errno.h> 28 27 #include <linux/etherdevice.h> 29 - #include <linux/fs.h> 28 + #include <linux/gfp.h> 30 29 #include <linux/if_ether.h> 31 30 #include <linux/if_packet.h> 32 31 #include <linux/init.h> ··· 36 35 #include <linux/kref.h> 37 36 #include <linux/list.h> 38 37 #include <linux/lockdep.h> 38 + #include <linux/net.h> 39 39 #include <linux/netdevice.h> 40 40 #include <linux/printk.h> 41 41 #include <linux/random.h> ··· 67 65 struct batadv_hard_iface *recv_if); 68 66 69 67 /** 70 - * batadv_nc_init - one-time initialization for network coding 68 + * batadv_nc_init() - one-time initialization for network coding 71 69 * 72 70 * Return: 0 on success or negative error number in case of failure 73 71 */ ··· 83 81 } 84 82 85 83 /** 86 - * batadv_nc_start_timer - initialise the nc periodic worker 84 + * batadv_nc_start_timer() - initialise the nc periodic worker 87 85 * @bat_priv: the bat priv with all the soft interface information 88 86 */ 89 87 static void batadv_nc_start_timer(struct batadv_priv *bat_priv) ··· 93 91 } 94 92 95 93 /** 96 - * batadv_nc_tvlv_container_update - update the network coding tvlv container 94 + * batadv_nc_tvlv_container_update() - update the network coding tvlv container 97 95 * after network coding setting change 98 96 * @bat_priv: the bat priv with all the soft interface information 99 97 */ ··· 115 113 } 116 114 117 115 /** 118 - * batadv_nc_status_update - update the network coding tvlv container after 116 + * batadv_nc_status_update() - update the network coding tvlv container after 119 117 * network coding setting change 120 118 * @net_dev: the soft interface net device 121 119 */ ··· 127 125 } 128 126 129 127 /** 130 - * batadv_nc_tvlv_ogm_handler_v1 - process incoming nc tvlv container 128 + * batadv_nc_tvlv_ogm_handler_v1() - process incoming nc tvlv container 131 129 * @bat_priv: the bat priv with all the soft interface information 132 130 * @orig: the orig_node of the ogm 133 131 * @flags: flags indicating the tvlv state (see batadv_tvlv_handler_flags) ··· 146 144 } 147 145 148 146 /** 149 - * batadv_nc_mesh_init - initialise coding hash table and start house keeping 147 + * batadv_nc_mesh_init() - initialise coding hash table and start house keeping 150 148 * @bat_priv: the bat priv with all the soft interface information 151 149 * 152 150 * Return: 0 on success or negative error number in case of failure ··· 187 185 } 188 186 189 187 /** 190 - * batadv_nc_init_bat_priv - initialise the nc specific bat_priv variables 188 + * batadv_nc_init_bat_priv() - initialise the nc specific bat_priv variables 191 189 * @bat_priv: the bat priv with all the soft interface information 192 190 */ 193 191 void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv) ··· 199 197 } 200 198 201 199 /** 202 - * batadv_nc_init_orig - initialise the nc fields of an orig_node 200 + * batadv_nc_init_orig() - initialise the nc fields of an orig_node 203 201 * @orig_node: the orig_node which is going to be initialised 204 202 */ 205 203 void batadv_nc_init_orig(struct batadv_orig_node *orig_node) ··· 211 209 } 212 210 213 211 /** 214 - * batadv_nc_node_release - release nc_node from lists and queue for free after 215 - * rcu grace period 212 + * batadv_nc_node_release() - release nc_node from lists and queue for free 213 + * after rcu grace period 216 214 * @ref: kref pointer of the nc_node 217 215 */ 218 216 static void batadv_nc_node_release(struct kref *ref) ··· 226 224 } 227 225 228 226 /** 229 - * batadv_nc_node_put - decrement the nc_node refcounter and possibly 227 + * batadv_nc_node_put() - decrement the nc_node refcounter and possibly 230 228 * release it 231 229 * @nc_node: nc_node to be free'd 232 230 */ ··· 236 234 } 237 235 238 236 /** 239 - * batadv_nc_path_release - release nc_path from lists and queue for free after 240 - * rcu grace period 237 + * batadv_nc_path_release() - release nc_path from lists and queue for free 238 + * after rcu grace period 241 239 * @ref: kref pointer of the nc_path 242 240 */ 243 241 static void batadv_nc_path_release(struct kref *ref) ··· 250 248 } 251 249 252 250 /** 253 - * batadv_nc_path_put - decrement the nc_path refcounter and possibly 251 + * batadv_nc_path_put() - decrement the nc_path refcounter and possibly 254 252 * release it 255 253 * @nc_path: nc_path to be free'd 256 254 */ ··· 260 258 } 261 259 262 260 /** 263 - * batadv_nc_packet_free - frees nc packet 261 + * batadv_nc_packet_free() - frees nc packet 264 262 * @nc_packet: the nc packet to free 265 263 * @dropped: whether the packet is freed because is is dropped 266 264 */ ··· 277 275 } 278 276 279 277 /** 280 - * batadv_nc_to_purge_nc_node - checks whether an nc node has to be purged 278 + * batadv_nc_to_purge_nc_node() - checks whether an nc node has to be purged 281 279 * @bat_priv: the bat priv with all the soft interface information 282 280 * @nc_node: the nc node to check 283 281 * ··· 293 291 } 294 292 295 293 /** 296 - * batadv_nc_to_purge_nc_path_coding - checks whether an nc path has timed out 294 + * batadv_nc_to_purge_nc_path_coding() - checks whether an nc path has timed out 297 295 * @bat_priv: the bat priv with all the soft interface information 298 296 * @nc_path: the nc path to check 299 297 * ··· 313 311 } 314 312 315 313 /** 316 - * batadv_nc_to_purge_nc_path_decoding - checks whether an nc path has timed out 314 + * batadv_nc_to_purge_nc_path_decoding() - checks whether an nc path has timed 315 + * out 317 316 * @bat_priv: the bat priv with all the soft interface information 318 317 * @nc_path: the nc path to check 319 318 * ··· 334 331 } 335 332 336 333 /** 337 - * batadv_nc_purge_orig_nc_nodes - go through list of nc nodes and purge stale 334 + * batadv_nc_purge_orig_nc_nodes() - go through list of nc nodes and purge stale 338 335 * entries 339 336 * @bat_priv: the bat priv with all the soft interface information 340 337 * @list: list of nc nodes ··· 372 369 } 373 370 374 371 /** 375 - * batadv_nc_purge_orig - purges all nc node data attached of the given 372 + * batadv_nc_purge_orig() - purges all nc node data attached of the given 376 373 * originator 377 374 * @bat_priv: the bat priv with all the soft interface information 378 375 * @orig_node: orig_node with the nc node entries to be purged ··· 398 395 } 399 396 400 397 /** 401 - * batadv_nc_purge_orig_hash - traverse entire originator hash to check if they 402 - * have timed out nc nodes 398 + * batadv_nc_purge_orig_hash() - traverse entire originator hash to check if 399 + * they have timed out nc nodes 403 400 * @bat_priv: the bat priv with all the soft interface information 404 401 */ 405 402 static void batadv_nc_purge_orig_hash(struct batadv_priv *bat_priv) ··· 425 422 } 426 423 427 424 /** 428 - * batadv_nc_purge_paths - traverse all nc paths part of the hash and remove 425 + * batadv_nc_purge_paths() - traverse all nc paths part of the hash and remove 429 426 * unused ones 430 427 * @bat_priv: the bat priv with all the soft interface information 431 428 * @hash: hash table containing the nc paths to check ··· 484 481 } 485 482 486 483 /** 487 - * batadv_nc_hash_key_gen - computes the nc_path hash key 484 + * batadv_nc_hash_key_gen() - computes the nc_path hash key 488 485 * @key: buffer to hold the final hash key 489 486 * @src: source ethernet mac address going into the hash key 490 487 * @dst: destination ethernet mac address going into the hash key ··· 497 494 } 498 495 499 496 /** 500 - * batadv_nc_hash_choose - compute the hash value for an nc path 497 + * batadv_nc_hash_choose() - compute the hash value for an nc path 501 498 * @data: data to hash 502 499 * @size: size of the hash table 503 500 * ··· 515 512 } 516 513 517 514 /** 518 - * batadv_nc_hash_compare - comparing function used in the network coding hash 515 + * batadv_nc_hash_compare() - comparing function used in the network coding hash 519 516 * tables 520 517 * @node: node in the local table 521 518 * @data2: second object to compare the node to ··· 541 538 } 542 539 543 540 /** 544 - * batadv_nc_hash_find - search for an existing nc path and return it 541 + * batadv_nc_hash_find() - search for an existing nc path and return it 545 542 * @hash: hash table containing the nc path 546 543 * @data: search key 547 544 * ··· 578 575 } 579 576 580 577 /** 581 - * batadv_nc_send_packet - send non-coded packet and free nc_packet struct 578 + * batadv_nc_send_packet() - send non-coded packet and free nc_packet struct 582 579 * @nc_packet: the nc packet to send 583 580 */ 584 581 static void batadv_nc_send_packet(struct batadv_nc_packet *nc_packet) ··· 589 586 } 590 587 591 588 /** 592 - * batadv_nc_sniffed_purge - Checks timestamp of given sniffed nc_packet. 589 + * batadv_nc_sniffed_purge() - Checks timestamp of given sniffed nc_packet. 593 590 * @bat_priv: the bat priv with all the soft interface information 594 591 * @nc_path: the nc path the packet belongs to 595 592 * @nc_packet: the nc packet to be checked ··· 628 625 } 629 626 630 627 /** 631 - * batadv_nc_fwd_flush - Checks the timestamp of the given nc packet. 628 + * batadv_nc_fwd_flush() - Checks the timestamp of the given nc packet. 632 629 * @bat_priv: the bat priv with all the soft interface information 633 630 * @nc_path: the nc path the packet belongs to 634 631 * @nc_packet: the nc packet to be checked ··· 666 663 } 667 664 668 665 /** 669 - * batadv_nc_process_nc_paths - traverse given nc packet pool and free timed out 670 - * nc packets 666 + * batadv_nc_process_nc_paths() - traverse given nc packet pool and free timed 667 + * out nc packets 671 668 * @bat_priv: the bat priv with all the soft interface information 672 669 * @hash: to be processed hash table 673 670 * @process_fn: Function called to process given nc packet. Should return true ··· 712 709 } 713 710 714 711 /** 715 - * batadv_nc_worker - periodic task for house keeping related to network coding 712 + * batadv_nc_worker() - periodic task for house keeping related to network 713 + * coding 716 714 * @work: kernel work struct 717 715 */ 718 716 static void batadv_nc_worker(struct work_struct *work) ··· 753 749 } 754 750 755 751 /** 756 - * batadv_can_nc_with_orig - checks whether the given orig node is suitable for 757 - * coding or not 752 + * batadv_can_nc_with_orig() - checks whether the given orig node is suitable 753 + * for coding or not 758 754 * @bat_priv: the bat priv with all the soft interface information 759 755 * @orig_node: neighboring orig node which may be used as nc candidate 760 756 * @ogm_packet: incoming ogm packet also used for the checks ··· 794 790 } 795 791 796 792 /** 797 - * batadv_nc_find_nc_node - search for an existing nc node and return it 793 + * batadv_nc_find_nc_node() - search for an existing nc node and return it 798 794 * @orig_node: orig node originating the ogm packet 799 795 * @orig_neigh_node: neighboring orig node from which we received the ogm packet 800 796 * (can be equal to orig_node) ··· 834 830 } 835 831 836 832 /** 837 - * batadv_nc_get_nc_node - retrieves an nc node or creates the entry if it was 833 + * batadv_nc_get_nc_node() - retrieves an nc node or creates the entry if it was 838 834 * not found 839 835 * @bat_priv: the bat priv with all the soft interface information 840 836 * @orig_node: orig node originating the ogm packet ··· 894 890 } 895 891 896 892 /** 897 - * batadv_nc_update_nc_node - updates stored incoming and outgoing nc node 893 + * batadv_nc_update_nc_node() - updates stored incoming and outgoing nc node 898 894 * structs (best called on incoming OGMs) 899 895 * @bat_priv: the bat priv with all the soft interface information 900 896 * @orig_node: orig node originating the ogm packet ··· 949 945 } 950 946 951 947 /** 952 - * batadv_nc_get_path - get existing nc_path or allocate a new one 948 + * batadv_nc_get_path() - get existing nc_path or allocate a new one 953 949 * @bat_priv: the bat priv with all the soft interface information 954 950 * @hash: hash table containing the nc path 955 951 * @src: ethernet source address - first half of the nc path search key ··· 1010 1006 } 1011 1007 1012 1008 /** 1013 - * batadv_nc_random_weight_tq - scale the receivers TQ-value to avoid unfair 1009 + * batadv_nc_random_weight_tq() - scale the receivers TQ-value to avoid unfair 1014 1010 * selection of a receiver with slightly lower TQ than the other 1015 1011 * @tq: to be weighted tq value 1016 1012 * ··· 1033 1029 } 1034 1030 1035 1031 /** 1036 - * batadv_nc_memxor - XOR destination with source 1032 + * batadv_nc_memxor() - XOR destination with source 1037 1033 * @dst: byte array to XOR into 1038 1034 * @src: byte array to XOR from 1039 1035 * @len: length of destination array ··· 1047 1043 } 1048 1044 1049 1045 /** 1050 - * batadv_nc_code_packets - code a received unicast_packet with an nc packet 1046 + * batadv_nc_code_packets() - code a received unicast_packet with an nc packet 1051 1047 * into a coded_packet and send it 1052 1048 * @bat_priv: the bat priv with all the soft interface information 1053 1049 * @skb: data skb to forward ··· 1240 1236 } 1241 1237 1242 1238 /** 1243 - * batadv_nc_skb_coding_possible - true if a decoded skb is available at dst. 1239 + * batadv_nc_skb_coding_possible() - true if a decoded skb is available at dst. 1244 1240 * @skb: data skb to forward 1245 1241 * @dst: destination mac address of the other skb to code with 1246 1242 * @src: source mac address of skb ··· 1264 1260 } 1265 1261 1266 1262 /** 1267 - * batadv_nc_path_search - Find the coding path matching in_nc_node and 1263 + * batadv_nc_path_search() - Find the coding path matching in_nc_node and 1268 1264 * out_nc_node to retrieve a buffered packet that can be used for coding. 1269 1265 * @bat_priv: the bat priv with all the soft interface information 1270 1266 * @in_nc_node: pointer to skb next hop's neighbor nc node ··· 1332 1328 } 1333 1329 1334 1330 /** 1335 - * batadv_nc_skb_src_search - Loops through the list of neighoring nodes of the 1336 - * skb's sender (may be equal to the originator). 1331 + * batadv_nc_skb_src_search() - Loops through the list of neighoring nodes of 1332 + * the skb's sender (may be equal to the originator). 1337 1333 * @bat_priv: the bat priv with all the soft interface information 1338 1334 * @skb: data skb to forward 1339 1335 * @eth_dst: next hop mac address of skb ··· 1378 1374 } 1379 1375 1380 1376 /** 1381 - * batadv_nc_skb_store_before_coding - set the ethernet src and dst of the 1377 + * batadv_nc_skb_store_before_coding() - set the ethernet src and dst of the 1382 1378 * unicast skb before it is stored for use in later decoding 1383 1379 * @bat_priv: the bat priv with all the soft interface information 1384 1380 * @skb: data skb to store ··· 1413 1409 } 1414 1410 1415 1411 /** 1416 - * batadv_nc_skb_dst_search - Loops through list of neighboring nodes to dst. 1412 + * batadv_nc_skb_dst_search() - Loops through list of neighboring nodes to dst. 1417 1413 * @skb: data skb to forward 1418 1414 * @neigh_node: next hop to forward packet to 1419 1415 * @ethhdr: pointer to the ethernet header inside the skb ··· 1471 1467 } 1472 1468 1473 1469 /** 1474 - * batadv_nc_skb_add_to_path - buffer skb for later encoding / decoding 1470 + * batadv_nc_skb_add_to_path() - buffer skb for later encoding / decoding 1475 1471 * @skb: skb to add to path 1476 1472 * @nc_path: path to add skb to 1477 1473 * @neigh_node: next hop to forward packet to ··· 1506 1502 } 1507 1503 1508 1504 /** 1509 - * batadv_nc_skb_forward - try to code a packet or add it to the coding packet 1505 + * batadv_nc_skb_forward() - try to code a packet or add it to the coding packet 1510 1506 * buffer 1511 1507 * @skb: data skb to forward 1512 1508 * @neigh_node: next hop to forward packet to ··· 1563 1559 } 1564 1560 1565 1561 /** 1566 - * batadv_nc_skb_store_for_decoding - save a clone of the skb which can be used 1567 - * when decoding coded packets 1562 + * batadv_nc_skb_store_for_decoding() - save a clone of the skb which can be 1563 + * used when decoding coded packets 1568 1564 * @bat_priv: the bat priv with all the soft interface information 1569 1565 * @skb: data skb to store 1570 1566 */ ··· 1624 1620 } 1625 1621 1626 1622 /** 1627 - * batadv_nc_skb_store_sniffed_unicast - check if a received unicast packet 1623 + * batadv_nc_skb_store_sniffed_unicast() - check if a received unicast packet 1628 1624 * should be saved in the decoding buffer and, if so, store it there 1629 1625 * @bat_priv: the bat priv with all the soft interface information 1630 1626 * @skb: unicast skb to store ··· 1644 1640 } 1645 1641 1646 1642 /** 1647 - * batadv_nc_skb_decode_packet - decode given skb using the decode data stored 1643 + * batadv_nc_skb_decode_packet() - decode given skb using the decode data stored 1648 1644 * in nc_packet 1649 1645 * @bat_priv: the bat priv with all the soft interface information 1650 1646 * @skb: unicast skb to decode ··· 1738 1734 } 1739 1735 1740 1736 /** 1741 - * batadv_nc_find_decoding_packet - search through buffered decoding data to 1737 + * batadv_nc_find_decoding_packet() - search through buffered decoding data to 1742 1738 * find the data needed to decode the coded packet 1743 1739 * @bat_priv: the bat priv with all the soft interface information 1744 1740 * @ethhdr: pointer to the ethernet header inside the coded packet ··· 1803 1799 } 1804 1800 1805 1801 /** 1806 - * batadv_nc_recv_coded_packet - try to decode coded packet and enqueue the 1802 + * batadv_nc_recv_coded_packet() - try to decode coded packet and enqueue the 1807 1803 * resulting unicast packet 1808 1804 * @skb: incoming coded packet 1809 1805 * @recv_if: pointer to interface this packet was received on ··· 1878 1874 } 1879 1875 1880 1876 /** 1881 - * batadv_nc_mesh_free - clean up network coding memory 1877 + * batadv_nc_mesh_free() - clean up network coding memory 1882 1878 * @bat_priv: the bat priv with all the soft interface information 1883 1879 */ 1884 1880 void batadv_nc_mesh_free(struct batadv_priv *bat_priv) ··· 1895 1891 1896 1892 #ifdef CONFIG_BATMAN_ADV_DEBUGFS 1897 1893 /** 1898 - * batadv_nc_nodes_seq_print_text - print the nc node information 1894 + * batadv_nc_nodes_seq_print_text() - print the nc node information 1899 1895 * @seq: seq file to print on 1900 1896 * @offset: not used 1901 1897 * ··· 1958 1954 } 1959 1955 1960 1956 /** 1961 - * batadv_nc_init_debugfs - create nc folder and related files in debugfs 1957 + * batadv_nc_init_debugfs() - create nc folder and related files in debugfs 1962 1958 * @bat_priv: the bat priv with all the soft interface information 1963 1959 * 1964 1960 * Return: 0 on success or negative error number in case of failure
+1
net/batman-adv/network-coding.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2012-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Martin Hundebøll, Jeppe Ledet-Pedersen
+115 -39
net/batman-adv/originator.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2009-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Simon Wunderlich ··· 22 21 #include <linux/atomic.h> 23 22 #include <linux/errno.h> 24 23 #include <linux/etherdevice.h> 25 - #include <linux/fs.h> 24 + #include <linux/gfp.h> 26 25 #include <linux/jiffies.h> 27 26 #include <linux/kernel.h> 28 27 #include <linux/kref.h> ··· 31 30 #include <linux/netdevice.h> 32 31 #include <linux/netlink.h> 33 32 #include <linux/rculist.h> 33 + #include <linux/rcupdate.h> 34 34 #include <linux/seq_file.h> 35 35 #include <linux/skbuff.h> 36 36 #include <linux/slab.h> 37 37 #include <linux/spinlock.h> 38 + #include <linux/stddef.h> 38 39 #include <linux/workqueue.h> 39 40 #include <net/sock.h> 40 41 #include <uapi/linux/batman_adv.h> ··· 58 55 /* hash class keys */ 59 56 static struct lock_class_key batadv_orig_hash_lock_class_key; 60 57 58 + /** 59 + * batadv_orig_hash_find() - Find and return originator from orig_hash 60 + * @bat_priv: the bat priv with all the soft interface information 61 + * @data: mac address of the originator 62 + * 63 + * Return: orig_node (with increased refcnt), NULL on errors 64 + */ 65 + struct batadv_orig_node * 66 + batadv_orig_hash_find(struct batadv_priv *bat_priv, const void *data) 67 + { 68 + struct batadv_hashtable *hash = bat_priv->orig_hash; 69 + struct hlist_head *head; 70 + struct batadv_orig_node *orig_node, *orig_node_tmp = NULL; 71 + int index; 72 + 73 + if (!hash) 74 + return NULL; 75 + 76 + index = batadv_choose_orig(data, hash->size); 77 + head = &hash->table[index]; 78 + 79 + rcu_read_lock(); 80 + hlist_for_each_entry_rcu(orig_node, head, hash_entry) { 81 + if (!batadv_compare_eth(orig_node, data)) 82 + continue; 83 + 84 + if (!kref_get_unless_zero(&orig_node->refcount)) 85 + continue; 86 + 87 + orig_node_tmp = orig_node; 88 + break; 89 + } 90 + rcu_read_unlock(); 91 + 92 + return orig_node_tmp; 93 + } 94 + 61 95 static void batadv_purge_orig(struct work_struct *work); 62 96 63 97 /** 64 - * batadv_compare_orig - comparing function used in the originator hash table 98 + * batadv_compare_orig() - comparing function used in the originator hash table 65 99 * @node: node in the local table 66 100 * @data2: second object to compare the node to 67 101 * ··· 113 73 } 114 74 115 75 /** 116 - * batadv_orig_node_vlan_get - get an orig_node_vlan object 76 + * batadv_orig_node_vlan_get() - get an orig_node_vlan object 117 77 * @orig_node: the originator serving the VLAN 118 78 * @vid: the VLAN identifier 119 79 * ··· 144 104 } 145 105 146 106 /** 147 - * batadv_orig_node_vlan_new - search and possibly create an orig_node_vlan 107 + * batadv_orig_node_vlan_new() - search and possibly create an orig_node_vlan 148 108 * object 149 109 * @orig_node: the originator serving the VLAN 150 110 * @vid: the VLAN identifier ··· 185 145 } 186 146 187 147 /** 188 - * batadv_orig_node_vlan_release - release originator-vlan object from lists 148 + * batadv_orig_node_vlan_release() - release originator-vlan object from lists 189 149 * and queue for free after rcu grace period 190 150 * @ref: kref pointer of the originator-vlan object 191 151 */ ··· 199 159 } 200 160 201 161 /** 202 - * batadv_orig_node_vlan_put - decrement the refcounter and possibly release 162 + * batadv_orig_node_vlan_put() - decrement the refcounter and possibly release 203 163 * the originator-vlan object 204 164 * @orig_vlan: the originator-vlan object to release 205 165 */ ··· 208 168 kref_put(&orig_vlan->refcount, batadv_orig_node_vlan_release); 209 169 } 210 170 171 + /** 172 + * batadv_originator_init() - Initialize all originator structures 173 + * @bat_priv: the bat priv with all the soft interface information 174 + * 175 + * Return: 0 on success or negative error number in case of failure 176 + */ 211 177 int batadv_originator_init(struct batadv_priv *bat_priv) 212 178 { 213 179 if (bat_priv->orig_hash) ··· 239 193 } 240 194 241 195 /** 242 - * batadv_neigh_ifinfo_release - release neigh_ifinfo from lists and queue for 196 + * batadv_neigh_ifinfo_release() - release neigh_ifinfo from lists and queue for 243 197 * free after rcu grace period 244 198 * @ref: kref pointer of the neigh_ifinfo 245 199 */ ··· 256 210 } 257 211 258 212 /** 259 - * batadv_neigh_ifinfo_put - decrement the refcounter and possibly release 213 + * batadv_neigh_ifinfo_put() - decrement the refcounter and possibly release 260 214 * the neigh_ifinfo 261 215 * @neigh_ifinfo: the neigh_ifinfo object to release 262 216 */ ··· 266 220 } 267 221 268 222 /** 269 - * batadv_hardif_neigh_release - release hardif neigh node from lists and 223 + * batadv_hardif_neigh_release() - release hardif neigh node from lists and 270 224 * queue for free after rcu grace period 271 225 * @ref: kref pointer of the neigh_node 272 226 */ ··· 286 240 } 287 241 288 242 /** 289 - * batadv_hardif_neigh_put - decrement the hardif neighbors refcounter 243 + * batadv_hardif_neigh_put() - decrement the hardif neighbors refcounter 290 244 * and possibly release it 291 245 * @hardif_neigh: hardif neigh neighbor to free 292 246 */ ··· 296 250 } 297 251 298 252 /** 299 - * batadv_neigh_node_release - release neigh_node from lists and queue for 253 + * batadv_neigh_node_release() - release neigh_node from lists and queue for 300 254 * free after rcu grace period 301 255 * @ref: kref pointer of the neigh_node 302 256 */ ··· 321 275 } 322 276 323 277 /** 324 - * batadv_neigh_node_put - decrement the neighbors refcounter and possibly 278 + * batadv_neigh_node_put() - decrement the neighbors refcounter and possibly 325 279 * release it 326 280 * @neigh_node: neigh neighbor to free 327 281 */ ··· 331 285 } 332 286 333 287 /** 334 - * batadv_orig_router_get - router to the originator depending on iface 288 + * batadv_orig_router_get() - router to the originator depending on iface 335 289 * @orig_node: the orig node for the router 336 290 * @if_outgoing: the interface where the payload packet has been received or 337 291 * the OGM should be sent to ··· 364 318 } 365 319 366 320 /** 367 - * batadv_orig_ifinfo_get - find the ifinfo from an orig_node 321 + * batadv_orig_ifinfo_get() - find the ifinfo from an orig_node 368 322 * @orig_node: the orig node to be queried 369 323 * @if_outgoing: the interface for which the ifinfo should be acquired 370 324 * ··· 396 350 } 397 351 398 352 /** 399 - * batadv_orig_ifinfo_new - search and possibly create an orig_ifinfo object 353 + * batadv_orig_ifinfo_new() - search and possibly create an orig_ifinfo object 400 354 * @orig_node: the orig node to be queried 401 355 * @if_outgoing: the interface for which the ifinfo should be acquired 402 356 * ··· 442 396 } 443 397 444 398 /** 445 - * batadv_neigh_ifinfo_get - find the ifinfo from an neigh_node 399 + * batadv_neigh_ifinfo_get() - find the ifinfo from an neigh_node 446 400 * @neigh: the neigh node to be queried 447 401 * @if_outgoing: the interface for which the ifinfo should be acquired 448 402 * ··· 475 429 } 476 430 477 431 /** 478 - * batadv_neigh_ifinfo_new - search and possibly create an neigh_ifinfo object 432 + * batadv_neigh_ifinfo_new() - search and possibly create an neigh_ifinfo object 479 433 * @neigh: the neigh node to be queried 480 434 * @if_outgoing: the interface for which the ifinfo should be acquired 481 435 * ··· 518 472 } 519 473 520 474 /** 521 - * batadv_neigh_node_get - retrieve a neighbour from the list 475 + * batadv_neigh_node_get() - retrieve a neighbour from the list 522 476 * @orig_node: originator which the neighbour belongs to 523 477 * @hard_iface: the interface where this neighbour is connected to 524 478 * @addr: the address of the neighbour ··· 555 509 } 556 510 557 511 /** 558 - * batadv_hardif_neigh_create - create a hardif neighbour node 512 + * batadv_hardif_neigh_create() - create a hardif neighbour node 559 513 * @hard_iface: the interface this neighbour is connected to 560 514 * @neigh_addr: the interface address of the neighbour to retrieve 561 515 * @orig_node: originator object representing the neighbour ··· 601 555 } 602 556 603 557 /** 604 - * batadv_hardif_neigh_get_or_create - retrieve or create a hardif neighbour 558 + * batadv_hardif_neigh_get_or_create() - retrieve or create a hardif neighbour 605 559 * node 606 560 * @hard_iface: the interface this neighbour is connected to 607 561 * @neigh_addr: the interface address of the neighbour to retrieve ··· 625 579 } 626 580 627 581 /** 628 - * batadv_hardif_neigh_get - retrieve a hardif neighbour from the list 582 + * batadv_hardif_neigh_get() - retrieve a hardif neighbour from the list 629 583 * @hard_iface: the interface where this neighbour is connected to 630 584 * @neigh_addr: the address of the neighbour 631 585 * ··· 657 611 } 658 612 659 613 /** 660 - * batadv_neigh_node_create - create a neigh node object 614 + * batadv_neigh_node_create() - create a neigh node object 661 615 * @orig_node: originator object representing the neighbour 662 616 * @hard_iface: the interface where the neighbour is connected to 663 617 * @neigh_addr: the mac address of the neighbour interface ··· 722 676 } 723 677 724 678 /** 725 - * batadv_neigh_node_get_or_create - retrieve or create a neigh node object 679 + * batadv_neigh_node_get_or_create() - retrieve or create a neigh node object 726 680 * @orig_node: originator object representing the neighbour 727 681 * @hard_iface: the interface where the neighbour is connected to 728 682 * @neigh_addr: the mac address of the neighbour interface ··· 746 700 747 701 #ifdef CONFIG_BATMAN_ADV_DEBUGFS 748 702 /** 749 - * batadv_hardif_neigh_seq_print_text - print the single hop neighbour list 703 + * batadv_hardif_neigh_seq_print_text() - print the single hop neighbour list 750 704 * @seq: neighbour table seq_file struct 751 705 * @offset: not used 752 706 * ··· 781 735 #endif 782 736 783 737 /** 784 - * batadv_hardif_neigh_dump - Dump to netlink the neighbor infos for a specific 785 - * outgoing interface 738 + * batadv_hardif_neigh_dump() - Dump to netlink the neighbor infos for a 739 + * specific outgoing interface 786 740 * @msg: message to dump into 787 741 * @cb: parameters for the dump 788 742 * ··· 858 812 } 859 813 860 814 /** 861 - * batadv_orig_ifinfo_release - release orig_ifinfo from lists and queue for 815 + * batadv_orig_ifinfo_release() - release orig_ifinfo from lists and queue for 862 816 * free after rcu grace period 863 817 * @ref: kref pointer of the orig_ifinfo 864 818 */ ··· 881 835 } 882 836 883 837 /** 884 - * batadv_orig_ifinfo_put - decrement the refcounter and possibly release 838 + * batadv_orig_ifinfo_put() - decrement the refcounter and possibly release 885 839 * the orig_ifinfo 886 840 * @orig_ifinfo: the orig_ifinfo object to release 887 841 */ ··· 891 845 } 892 846 893 847 /** 894 - * batadv_orig_node_free_rcu - free the orig_node 848 + * batadv_orig_node_free_rcu() - free the orig_node 895 849 * @rcu: rcu pointer of the orig_node 896 850 */ 897 851 static void batadv_orig_node_free_rcu(struct rcu_head *rcu) ··· 912 866 } 913 867 914 868 /** 915 - * batadv_orig_node_release - release orig_node from lists and queue for 869 + * batadv_orig_node_release() - release orig_node from lists and queue for 916 870 * free after rcu grace period 917 871 * @ref: kref pointer of the orig_node 918 872 */ ··· 963 917 } 964 918 965 919 /** 966 - * batadv_orig_node_put - decrement the orig node refcounter and possibly 920 + * batadv_orig_node_put() - decrement the orig node refcounter and possibly 967 921 * release it 968 922 * @orig_node: the orig node to free 969 923 */ ··· 972 926 kref_put(&orig_node->refcount, batadv_orig_node_release); 973 927 } 974 928 929 + /** 930 + * batadv_originator_free() - Free all originator structures 931 + * @bat_priv: the bat priv with all the soft interface information 932 + */ 975 933 void batadv_originator_free(struct batadv_priv *bat_priv) 976 934 { 977 935 struct batadv_hashtable *hash = bat_priv->orig_hash; ··· 1009 959 } 1010 960 1011 961 /** 1012 - * batadv_orig_node_new - creates a new orig_node 962 + * batadv_orig_node_new() - creates a new orig_node 1013 963 * @bat_priv: the bat priv with all the soft interface information 1014 964 * @addr: the mac address of the originator 1015 965 * ··· 1088 1038 } 1089 1039 1090 1040 /** 1091 - * batadv_purge_neigh_ifinfo - purge obsolete ifinfo entries from neighbor 1041 + * batadv_purge_neigh_ifinfo() - purge obsolete ifinfo entries from neighbor 1092 1042 * @bat_priv: the bat priv with all the soft interface information 1093 1043 * @neigh: orig node which is to be checked 1094 1044 */ ··· 1129 1079 } 1130 1080 1131 1081 /** 1132 - * batadv_purge_orig_ifinfo - purge obsolete ifinfo entries from originator 1082 + * batadv_purge_orig_ifinfo() - purge obsolete ifinfo entries from originator 1133 1083 * @bat_priv: the bat priv with all the soft interface information 1134 1084 * @orig_node: orig node which is to be checked 1135 1085 * ··· 1181 1131 } 1182 1132 1183 1133 /** 1184 - * batadv_purge_orig_neighbors - purges neighbors from originator 1134 + * batadv_purge_orig_neighbors() - purges neighbors from originator 1185 1135 * @bat_priv: the bat priv with all the soft interface information 1186 1136 * @orig_node: orig node which is to be checked 1187 1137 * ··· 1239 1189 } 1240 1190 1241 1191 /** 1242 - * batadv_find_best_neighbor - finds the best neighbor after purging 1192 + * batadv_find_best_neighbor() - finds the best neighbor after purging 1243 1193 * @bat_priv: the bat priv with all the soft interface information 1244 1194 * @orig_node: orig node which is to be checked 1245 1195 * @if_outgoing: the interface for which the metric should be compared ··· 1274 1224 } 1275 1225 1276 1226 /** 1277 - * batadv_purge_orig_node - purges obsolete information from an orig_node 1227 + * batadv_purge_orig_node() - purges obsolete information from an orig_node 1278 1228 * @bat_priv: the bat priv with all the soft interface information 1279 1229 * @orig_node: orig node which is to be checked 1280 1230 * ··· 1391 1341 msecs_to_jiffies(BATADV_ORIG_WORK_PERIOD)); 1392 1342 } 1393 1343 1344 + /** 1345 + * batadv_purge_orig_ref() - Purge all outdated originators 1346 + * @bat_priv: the bat priv with all the soft interface information 1347 + */ 1394 1348 void batadv_purge_orig_ref(struct batadv_priv *bat_priv) 1395 1349 { 1396 1350 _batadv_purge_orig(bat_priv); 1397 1351 } 1398 1352 1399 1353 #ifdef CONFIG_BATMAN_ADV_DEBUGFS 1354 + 1355 + /** 1356 + * batadv_orig_seq_print_text() - Print the originator table in a seq file 1357 + * @seq: seq file to print on 1358 + * @offset: not used 1359 + * 1360 + * Return: always 0 1361 + */ 1400 1362 int batadv_orig_seq_print_text(struct seq_file *seq, void *offset) 1401 1363 { 1402 1364 struct net_device *net_dev = (struct net_device *)seq->private; ··· 1438 1376 } 1439 1377 1440 1378 /** 1441 - * batadv_orig_hardif_seq_print_text - writes originator infos for a specific 1379 + * batadv_orig_hardif_seq_print_text() - writes originator infos for a specific 1442 1380 * outgoing interface 1443 1381 * @seq: debugfs table seq_file struct 1444 1382 * @offset: not used ··· 1485 1423 #endif 1486 1424 1487 1425 /** 1488 - * batadv_orig_dump - Dump to netlink the originator infos for a specific 1426 + * batadv_orig_dump() - Dump to netlink the originator infos for a specific 1489 1427 * outgoing interface 1490 1428 * @msg: message to dump into 1491 1429 * @cb: parameters for the dump ··· 1561 1499 return ret; 1562 1500 } 1563 1501 1502 + /** 1503 + * batadv_orig_hash_add_if() - Add interface to originators in orig_hash 1504 + * @hard_iface: hard interface to add (already slave of the soft interface) 1505 + * @max_if_num: new number of interfaces 1506 + * 1507 + * Return: 0 on success or negative error number in case of failure 1508 + */ 1564 1509 int batadv_orig_hash_add_if(struct batadv_hard_iface *hard_iface, 1565 1510 int max_if_num) 1566 1511 { ··· 1603 1534 return -ENOMEM; 1604 1535 } 1605 1536 1537 + /** 1538 + * batadv_orig_hash_del_if() - Remove interface from originators in orig_hash 1539 + * @hard_iface: hard interface to remove (still slave of the soft interface) 1540 + * @max_if_num: new number of interfaces 1541 + * 1542 + * Return: 0 on success or negative error number in case of failure 1543 + */ 1606 1544 int batadv_orig_hash_del_if(struct batadv_hard_iface *hard_iface, 1607 1545 int max_if_num) 1608 1546 {
+10 -37
net/batman-adv/originator.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Simon Wunderlich ··· 24 23 #include <linux/compiler.h> 25 24 #include <linux/if_ether.h> 26 25 #include <linux/jhash.h> 27 - #include <linux/kref.h> 28 - #include <linux/rculist.h> 29 - #include <linux/rcupdate.h> 30 - #include <linux/stddef.h> 31 26 #include <linux/types.h> 32 - 33 - #include "hash.h" 34 27 35 28 struct netlink_callback; 36 29 struct seq_file; ··· 84 89 unsigned short vid); 85 90 void batadv_orig_node_vlan_put(struct batadv_orig_node_vlan *orig_vlan); 86 91 87 - /* hashfunction to choose an entry in a hash table of given size 88 - * hash algorithm from http://en.wikipedia.org/wiki/Hash_table 92 + /** 93 + * batadv_choose_orig() - Return the index of the orig entry in the hash table 94 + * @data: mac address of the originator node 95 + * @size: the size of the hash table 96 + * 97 + * Return: the hash index where the object represented by @data should be 98 + * stored at. 89 99 */ 90 100 static inline u32 batadv_choose_orig(const void *data, u32 size) 91 101 { ··· 100 100 return hash % size; 101 101 } 102 102 103 - static inline struct batadv_orig_node * 104 - batadv_orig_hash_find(struct batadv_priv *bat_priv, const void *data) 105 - { 106 - struct batadv_hashtable *hash = bat_priv->orig_hash; 107 - struct hlist_head *head; 108 - struct batadv_orig_node *orig_node, *orig_node_tmp = NULL; 109 - int index; 110 - 111 - if (!hash) 112 - return NULL; 113 - 114 - index = batadv_choose_orig(data, hash->size); 115 - head = &hash->table[index]; 116 - 117 - rcu_read_lock(); 118 - hlist_for_each_entry_rcu(orig_node, head, hash_entry) { 119 - if (!batadv_compare_eth(orig_node, data)) 120 - continue; 121 - 122 - if (!kref_get_unless_zero(&orig_node->refcount)) 123 - continue; 124 - 125 - orig_node_tmp = orig_node; 126 - break; 127 - } 128 - rcu_read_unlock(); 129 - 130 - return orig_node_tmp; 131 - } 103 + struct batadv_orig_node * 104 + batadv_orig_hash_find(struct batadv_priv *bat_priv, const void *data); 132 105 133 106 #endif /* _NET_BATMAN_ADV_ORIGINATOR_H_ */
+24 -2
net/batman-adv/packet.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Simon Wunderlich ··· 22 21 #include <asm/byteorder.h> 23 22 #include <linux/types.h> 24 23 24 + /** 25 + * batadv_tp_is_error() - Check throughput meter return code for error 26 + * @n: throughput meter return code 27 + * 28 + * Return: 0 when not error was detected, != 0 otherwise 29 + */ 25 30 #define batadv_tp_is_error(n) ((u8)(n) > 127 ? 1 : 0) 26 31 27 32 /** ··· 95 88 BATADV_DIRECTLINK = BIT(2), 96 89 }; 97 90 98 - /* ICMP message types */ 91 + /** 92 + * enum batadv_icmp_packettype - ICMP message types 93 + * @BATADV_ECHO_REPLY: success reply to BATADV_ECHO_REQUEST 94 + * @BATADV_DESTINATION_UNREACHABLE: failure when route to destination not found 95 + * @BATADV_ECHO_REQUEST: request BATADV_ECHO_REPLY from destination 96 + * @BATADV_TTL_EXCEEDED: error after BATADV_ECHO_REQUEST traversed too many hops 97 + * @BATADV_PARAMETER_PROBLEM: return code for malformed messages 98 + * @BATADV_TP: throughput meter packet 99 + */ 99 100 enum batadv_icmp_packettype { 100 101 BATADV_ECHO_REPLY = 0, 101 102 BATADV_DESTINATION_UNREACHABLE = 3, ··· 151 136 BATADV_VLAN_HAS_TAG = BIT(15), 152 137 }; 153 138 154 - /* claim frame types for the bridge loop avoidance */ 139 + /** 140 + * enum batadv_bla_claimframe - claim frame types for the bridge loop avoidance 141 + * @BATADV_CLAIM_TYPE_CLAIM: claim of a client mac address 142 + * @BATADV_CLAIM_TYPE_UNCLAIM: unclaim of a client mac address 143 + * @BATADV_CLAIM_TYPE_ANNOUNCE: announcement of backbone with current crc 144 + * @BATADV_CLAIM_TYPE_REQUEST: request of full claim table 145 + * @BATADV_CLAIM_TYPE_LOOPDETECT: mesh-traversing loop detect packet 146 + */ 155 147 enum batadv_bla_claimframe { 156 148 BATADV_CLAIM_TYPE_CLAIM = 0x00, 157 149 BATADV_CLAIM_TYPE_UNCLAIM = 0x01,
+42 -12
net/batman-adv/routing.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Simon Wunderlich ··· 55 54 struct batadv_hard_iface *recv_if); 56 55 57 56 /** 58 - * _batadv_update_route - set the router for this originator 57 + * _batadv_update_route() - set the router for this originator 59 58 * @bat_priv: the bat priv with all the soft interface information 60 59 * @orig_node: orig node which is to be configured 61 60 * @recv_if: the receive interface for which this route is set ··· 119 118 } 120 119 121 120 /** 122 - * batadv_update_route - set the router for this originator 121 + * batadv_update_route() - set the router for this originator 123 122 * @bat_priv: the bat priv with all the soft interface information 124 123 * @orig_node: orig node which is to be configured 125 124 * @recv_if: the receive interface for which this route is set ··· 146 145 } 147 146 148 147 /** 149 - * batadv_window_protected - checks whether the host restarted and is in the 148 + * batadv_window_protected() - checks whether the host restarted and is in the 150 149 * protection time. 151 150 * @bat_priv: the bat priv with all the soft interface information 152 151 * @seq_num_diff: difference between the current/received sequence number and ··· 181 180 return false; 182 181 } 183 182 183 + /** 184 + * batadv_check_management_packet() - Check preconditions for management packets 185 + * @skb: incoming packet buffer 186 + * @hard_iface: incoming hard interface 187 + * @header_len: minimal header length of packet type 188 + * 189 + * Return: true when management preconditions are met, false otherwise 190 + */ 184 191 bool batadv_check_management_packet(struct sk_buff *skb, 185 192 struct batadv_hard_iface *hard_iface, 186 193 int header_len) ··· 221 212 } 222 213 223 214 /** 224 - * batadv_recv_my_icmp_packet - receive an icmp packet locally 215 + * batadv_recv_my_icmp_packet() - receive an icmp packet locally 225 216 * @bat_priv: the bat priv with all the soft interface information 226 217 * @skb: icmp packet to process 227 218 * ··· 356 347 return ret; 357 348 } 358 349 350 + /** 351 + * batadv_recv_icmp_packet() - Process incoming icmp packet 352 + * @skb: incoming packet buffer 353 + * @recv_if: incoming hard interface 354 + * 355 + * Return: NET_RX_SUCCESS on success or NET_RX_DROP in case of failure 356 + */ 359 357 int batadv_recv_icmp_packet(struct sk_buff *skb, 360 358 struct batadv_hard_iface *recv_if) 361 359 { ··· 456 440 } 457 441 458 442 /** 459 - * batadv_check_unicast_packet - Check for malformed unicast packets 443 + * batadv_check_unicast_packet() - Check for malformed unicast packets 460 444 * @bat_priv: the bat priv with all the soft interface information 461 445 * @skb: packet to check 462 446 * @hdr_size: size of header to pull ··· 494 478 } 495 479 496 480 /** 497 - * batadv_last_bonding_get - Get last_bonding_candidate of orig_node 481 + * batadv_last_bonding_get() - Get last_bonding_candidate of orig_node 498 482 * @orig_node: originator node whose last bonding candidate should be retrieved 499 483 * 500 484 * Return: last bonding candidate of router or NULL if not found ··· 517 501 } 518 502 519 503 /** 520 - * batadv_last_bonding_replace - Replace last_bonding_candidate of orig_node 504 + * batadv_last_bonding_replace() - Replace last_bonding_candidate of orig_node 521 505 * @orig_node: originator node whose bonding candidates should be replaced 522 506 * @new_candidate: new bonding candidate or NULL 523 507 */ ··· 540 524 } 541 525 542 526 /** 543 - * batadv_find_router - find a suitable router for this originator 527 + * batadv_find_router() - find a suitable router for this originator 544 528 * @bat_priv: the bat priv with all the soft interface information 545 529 * @orig_node: the destination node 546 530 * @recv_if: pointer to interface this packet was received on ··· 757 741 } 758 742 759 743 /** 760 - * batadv_reroute_unicast_packet - update the unicast header for re-routing 744 + * batadv_reroute_unicast_packet() - update the unicast header for re-routing 761 745 * @bat_priv: the bat priv with all the soft interface information 762 746 * @unicast_packet: the unicast header to be updated 763 747 * @dst_addr: the payload destination ··· 920 904 } 921 905 922 906 /** 923 - * batadv_recv_unhandled_unicast_packet - receive and process packets which 907 + * batadv_recv_unhandled_unicast_packet() - receive and process packets which 924 908 * are in the unicast number space but not yet known to the implementation 925 909 * @skb: unicast tvlv packet to process 926 910 * @recv_if: pointer to interface this packet was received on ··· 951 935 return NET_RX_DROP; 952 936 } 953 937 938 + /** 939 + * batadv_recv_unicast_packet() - Process incoming unicast packet 940 + * @skb: incoming packet buffer 941 + * @recv_if: incoming hard interface 942 + * 943 + * Return: NET_RX_SUCCESS on success or NET_RX_DROP in case of failure 944 + */ 954 945 int batadv_recv_unicast_packet(struct sk_buff *skb, 955 946 struct batadv_hard_iface *recv_if) 956 947 { ··· 1059 1036 } 1060 1037 1061 1038 /** 1062 - * batadv_recv_unicast_tvlv - receive and process unicast tvlv packets 1039 + * batadv_recv_unicast_tvlv() - receive and process unicast tvlv packets 1063 1040 * @skb: unicast tvlv packet to process 1064 1041 * @recv_if: pointer to interface this packet was received on 1065 1042 * ··· 1113 1090 } 1114 1091 1115 1092 /** 1116 - * batadv_recv_frag_packet - process received fragment 1093 + * batadv_recv_frag_packet() - process received fragment 1117 1094 * @skb: the received fragment 1118 1095 * @recv_if: interface that the skb is received on 1119 1096 * ··· 1178 1155 return ret; 1179 1156 } 1180 1157 1158 + /** 1159 + * batadv_recv_bcast_packet() - Process incoming broadcast packet 1160 + * @skb: incoming packet buffer 1161 + * @recv_if: incoming hard interface 1162 + * 1163 + * Return: NET_RX_SUCCESS on success or NET_RX_DROP in case of failure 1164 + */ 1181 1165 int batadv_recv_bcast_packet(struct sk_buff *skb, 1182 1166 struct batadv_hard_iface *recv_if) 1183 1167 {
+1
net/batman-adv/routing.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Simon Wunderlich
+43 -23
net/batman-adv/send.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Simon Wunderlich ··· 24 23 #include <linux/byteorder/generic.h> 25 24 #include <linux/errno.h> 26 25 #include <linux/etherdevice.h> 27 - #include <linux/fs.h> 26 + #include <linux/gfp.h> 28 27 #include <linux/if.h> 29 28 #include <linux/if_ether.h> 30 29 #include <linux/jiffies.h> ··· 55 54 static void batadv_send_outstanding_bcast_packet(struct work_struct *work); 56 55 57 56 /** 58 - * batadv_send_skb_packet - send an already prepared packet 57 + * batadv_send_skb_packet() - send an already prepared packet 59 58 * @skb: the packet to send 60 59 * @hard_iface: the interface to use to send the broadcast packet 61 60 * @dst_addr: the payload destination ··· 124 123 return NET_XMIT_DROP; 125 124 } 126 125 126 + /** 127 + * batadv_send_broadcast_skb() - Send broadcast packet via hard interface 128 + * @skb: packet to be transmitted (with batadv header and no outer eth header) 129 + * @hard_iface: outgoing interface 130 + * 131 + * Return: A negative errno code is returned on a failure. A success does not 132 + * guarantee the frame will be transmitted as it may be dropped due 133 + * to congestion or traffic shaping. 134 + */ 127 135 int batadv_send_broadcast_skb(struct sk_buff *skb, 128 136 struct batadv_hard_iface *hard_iface) 129 137 { 130 138 return batadv_send_skb_packet(skb, hard_iface, batadv_broadcast_addr); 131 139 } 132 140 141 + /** 142 + * batadv_send_unicast_skb() - Send unicast packet to neighbor 143 + * @skb: packet to be transmitted (with batadv header and no outer eth header) 144 + * @neigh: neighbor which is used as next hop to destination 145 + * 146 + * Return: A negative errno code is returned on a failure. A success does not 147 + * guarantee the frame will be transmitted as it may be dropped due 148 + * to congestion or traffic shaping. 149 + */ 133 150 int batadv_send_unicast_skb(struct sk_buff *skb, 134 151 struct batadv_neigh_node *neigh) 135 152 { ··· 172 153 } 173 154 174 155 /** 175 - * batadv_send_skb_to_orig - Lookup next-hop and transmit skb. 156 + * batadv_send_skb_to_orig() - Lookup next-hop and transmit skb. 176 157 * @skb: Packet to be transmitted. 177 158 * @orig_node: Final destination of the packet. 178 159 * @recv_if: Interface used when receiving the packet (can be NULL). ··· 235 216 } 236 217 237 218 /** 238 - * batadv_send_skb_push_fill_unicast - extend the buffer and initialize the 219 + * batadv_send_skb_push_fill_unicast() - extend the buffer and initialize the 239 220 * common fields for unicast packets 240 221 * @skb: the skb carrying the unicast header to initialize 241 222 * @hdr_size: amount of bytes to push at the beginning of the skb ··· 268 249 } 269 250 270 251 /** 271 - * batadv_send_skb_prepare_unicast - encapsulate an skb with a unicast header 252 + * batadv_send_skb_prepare_unicast() - encapsulate an skb with a unicast header 272 253 * @skb: the skb containing the payload to encapsulate 273 254 * @orig_node: the destination node 274 255 * ··· 283 264 } 284 265 285 266 /** 286 - * batadv_send_skb_prepare_unicast_4addr - encapsulate an skb with a 267 + * batadv_send_skb_prepare_unicast_4addr() - encapsulate an skb with a 287 268 * unicast 4addr header 288 269 * @bat_priv: the bat priv with all the soft interface information 289 270 * @skb: the skb containing the payload to encapsulate ··· 327 308 } 328 309 329 310 /** 330 - * batadv_send_skb_unicast - encapsulate and send an skb via unicast 311 + * batadv_send_skb_unicast() - encapsulate and send an skb via unicast 331 312 * @bat_priv: the bat priv with all the soft interface information 332 313 * @skb: payload to send 333 314 * @packet_type: the batman unicast packet type to use ··· 397 378 } 398 379 399 380 /** 400 - * batadv_send_skb_via_tt_generic - send an skb via TT lookup 381 + * batadv_send_skb_via_tt_generic() - send an skb via TT lookup 401 382 * @bat_priv: the bat priv with all the soft interface information 402 383 * @skb: payload to send 403 384 * @packet_type: the batman unicast packet type to use ··· 444 425 } 445 426 446 427 /** 447 - * batadv_send_skb_via_gw - send an skb via gateway lookup 428 + * batadv_send_skb_via_gw() - send an skb via gateway lookup 448 429 * @bat_priv: the bat priv with all the soft interface information 449 430 * @skb: payload to send 450 431 * @vid: the vid to be used to search the translation table ··· 471 452 } 472 453 473 454 /** 474 - * batadv_forw_packet_free - free a forwarding packet 455 + * batadv_forw_packet_free() - free a forwarding packet 475 456 * @forw_packet: The packet to free 476 457 * @dropped: whether the packet is freed because is is dropped 477 458 * ··· 496 477 } 497 478 498 479 /** 499 - * batadv_forw_packet_alloc - allocate a forwarding packet 480 + * batadv_forw_packet_alloc() - allocate a forwarding packet 500 481 * @if_incoming: The (optional) if_incoming to be grabbed 501 482 * @if_outgoing: The (optional) if_outgoing to be grabbed 502 483 * @queue_left: The (optional) queue counter to decrease ··· 562 543 } 563 544 564 545 /** 565 - * batadv_forw_packet_was_stolen - check whether someone stole this packet 546 + * batadv_forw_packet_was_stolen() - check whether someone stole this packet 566 547 * @forw_packet: the forwarding packet to check 567 548 * 568 549 * This function checks whether the given forwarding packet was claimed by ··· 577 558 } 578 559 579 560 /** 580 - * batadv_forw_packet_steal - claim a forw_packet for free() 561 + * batadv_forw_packet_steal() - claim a forw_packet for free() 581 562 * @forw_packet: the forwarding packet to steal 582 563 * @lock: a key to the store to steal from (e.g. forw_{bat,bcast}_list_lock) 583 564 * ··· 608 589 } 609 590 610 591 /** 611 - * batadv_forw_packet_list_steal - claim a list of forward packets for free() 592 + * batadv_forw_packet_list_steal() - claim a list of forward packets for free() 612 593 * @forw_list: the to be stolen forward packets 613 594 * @cleanup_list: a backup pointer, to be able to dispose the packet later 614 595 * @hard_iface: the interface to steal forward packets from ··· 644 625 } 645 626 646 627 /** 647 - * batadv_forw_packet_list_free - free a list of forward packets 628 + * batadv_forw_packet_list_free() - free a list of forward packets 648 629 * @head: a list of to be freed forw_packets 649 630 * 650 631 * This function cancels the scheduling of any packet in the provided list, ··· 668 649 } 669 650 670 651 /** 671 - * batadv_forw_packet_queue - try to queue a forwarding packet 652 + * batadv_forw_packet_queue() - try to queue a forwarding packet 672 653 * @forw_packet: the forwarding packet to queue 673 654 * @lock: a key to the store (e.g. forw_{bat,bcast}_list_lock) 674 655 * @head: the shelve to queue it on (e.g. forw_{bat,bcast}_list) ··· 712 693 } 713 694 714 695 /** 715 - * batadv_forw_packet_bcast_queue - try to queue a broadcast packet 696 + * batadv_forw_packet_bcast_queue() - try to queue a broadcast packet 716 697 * @bat_priv: the bat priv with all the soft interface information 717 698 * @forw_packet: the forwarding packet to queue 718 699 * @send_time: timestamp (jiffies) when the packet is to be sent ··· 731 712 } 732 713 733 714 /** 734 - * batadv_forw_packet_ogmv1_queue - try to queue an OGMv1 packet 715 + * batadv_forw_packet_ogmv1_queue() - try to queue an OGMv1 packet 735 716 * @bat_priv: the bat priv with all the soft interface information 736 717 * @forw_packet: the forwarding packet to queue 737 718 * @send_time: timestamp (jiffies) when the packet is to be sent ··· 749 730 } 750 731 751 732 /** 752 - * batadv_add_bcast_packet_to_list - queue broadcast packet for multiple sends 733 + * batadv_add_bcast_packet_to_list() - queue broadcast packet for multiple sends 753 734 * @bat_priv: the bat priv with all the soft interface information 754 735 * @skb: broadcast packet to add 755 736 * @delay: number of jiffies to wait before sending ··· 809 790 } 810 791 811 792 /** 812 - * batadv_forw_packet_bcasts_left - check if a retransmission is necessary 793 + * batadv_forw_packet_bcasts_left() - check if a retransmission is necessary 813 794 * @forw_packet: the forwarding packet to check 814 795 * @hard_iface: the interface to check on 815 796 * ··· 837 818 } 838 819 839 820 /** 840 - * batadv_forw_packet_bcasts_inc - increment retransmission counter of a packet 821 + * batadv_forw_packet_bcasts_inc() - increment retransmission counter of a 822 + * packet 841 823 * @forw_packet: the packet to increase the counter for 842 824 */ 843 825 static void ··· 848 828 } 849 829 850 830 /** 851 - * batadv_forw_packet_is_rebroadcast - check packet for previous transmissions 831 + * batadv_forw_packet_is_rebroadcast() - check packet for previous transmissions 852 832 * @forw_packet: the packet to check 853 833 * 854 834 * Return: True if this packet was transmitted before, false otherwise. ··· 973 953 } 974 954 975 955 /** 976 - * batadv_purge_outstanding_packets - stop/purge scheduled bcast/OGMv1 packets 956 + * batadv_purge_outstanding_packets() - stop/purge scheduled bcast/OGMv1 packets 977 957 * @bat_priv: the bat priv with all the soft interface information 978 958 * @hard_iface: the hard interface to cancel and purge bcast/ogm packets on 979 959 *
+3 -2
net/batman-adv/send.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Simon Wunderlich ··· 77 76 unsigned short vid); 78 77 79 78 /** 80 - * batadv_send_skb_via_tt - send an skb via TT lookup 79 + * batadv_send_skb_via_tt() - send an skb via TT lookup 81 80 * @bat_priv: the bat priv with all the soft interface information 82 81 * @skb: the payload to send 83 82 * @dst_hint: can be used to override the destination contained in the skb ··· 98 97 } 99 98 100 99 /** 101 - * batadv_send_skb_via_tt_4addr - send an skb via TT lookup 100 + * batadv_send_skb_via_tt_4addr() - send an skb via TT lookup 102 101 * @bat_priv: the bat priv with all the soft interface information 103 102 * @skb: the payload to send 104 103 * @packet_subtype: the unicast 4addr packet subtype to use
+43 -21
net/batman-adv/soft-interface.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Simon Wunderlich ··· 27 26 #include <linux/errno.h> 28 27 #include <linux/etherdevice.h> 29 28 #include <linux/ethtool.h> 30 - #include <linux/fs.h> 29 + #include <linux/gfp.h> 31 30 #include <linux/if_ether.h> 32 31 #include <linux/if_vlan.h> 33 32 #include <linux/jiffies.h> ··· 65 64 #include "sysfs.h" 66 65 #include "translation-table.h" 67 66 67 + /** 68 + * batadv_skb_head_push() - Increase header size and move (push) head pointer 69 + * @skb: packet buffer which should be modified 70 + * @len: number of bytes to add 71 + * 72 + * Return: 0 on success or negative error number in case of failure 73 + */ 68 74 int batadv_skb_head_push(struct sk_buff *skb, unsigned int len) 69 75 { 70 76 int result; ··· 104 96 } 105 97 106 98 /** 107 - * batadv_sum_counter - Sum the cpu-local counters for index 'idx' 99 + * batadv_sum_counter() - Sum the cpu-local counters for index 'idx' 108 100 * @bat_priv: the bat priv with all the soft interface information 109 101 * @idx: index of counter to sum up 110 102 * ··· 177 169 } 178 170 179 171 /** 180 - * batadv_interface_set_rx_mode - set the rx mode of a device 172 + * batadv_interface_set_rx_mode() - set the rx mode of a device 181 173 * @dev: registered network device to modify 182 174 * 183 175 * We do not actually need to set any rx filters for the virtual batman ··· 397 389 } 398 390 399 391 /** 400 - * batadv_interface_rx - receive ethernet frame on local batman-adv interface 392 + * batadv_interface_rx() - receive ethernet frame on local batman-adv interface 401 393 * @soft_iface: local interface which will receive the ethernet frame 402 394 * @skb: ethernet frame for @soft_iface 403 395 * @hdr_size: size of already parsed batman-adv header ··· 509 501 } 510 502 511 503 /** 512 - * batadv_softif_vlan_release - release vlan from lists and queue for free after 513 - * rcu grace period 504 + * batadv_softif_vlan_release() - release vlan from lists and queue for free 505 + * after rcu grace period 514 506 * @ref: kref pointer of the vlan object 515 507 */ 516 508 static void batadv_softif_vlan_release(struct kref *ref) ··· 527 519 } 528 520 529 521 /** 530 - * batadv_softif_vlan_put - decrease the vlan object refcounter and 522 + * batadv_softif_vlan_put() - decrease the vlan object refcounter and 531 523 * possibly release it 532 524 * @vlan: the vlan object to release 533 525 */ ··· 540 532 } 541 533 542 534 /** 543 - * batadv_softif_vlan_get - get the vlan object for a specific vid 535 + * batadv_softif_vlan_get() - get the vlan object for a specific vid 544 536 * @bat_priv: the bat priv with all the soft interface information 545 537 * @vid: the identifier of the vlan object to retrieve 546 538 * ··· 569 561 } 570 562 571 563 /** 572 - * batadv_softif_create_vlan - allocate the needed resources for a new vlan 564 + * batadv_softif_create_vlan() - allocate the needed resources for a new vlan 573 565 * @bat_priv: the bat priv with all the soft interface information 574 566 * @vid: the VLAN identifier 575 567 * ··· 621 613 } 622 614 623 615 /** 624 - * batadv_softif_destroy_vlan - remove and destroy a softif_vlan object 616 + * batadv_softif_destroy_vlan() - remove and destroy a softif_vlan object 625 617 * @bat_priv: the bat priv with all the soft interface information 626 618 * @vlan: the object to remove 627 619 */ ··· 639 631 } 640 632 641 633 /** 642 - * batadv_interface_add_vid - ndo_add_vid API implementation 634 + * batadv_interface_add_vid() - ndo_add_vid API implementation 643 635 * @dev: the netdev of the mesh interface 644 636 * @proto: protocol of the the vlan id 645 637 * @vid: identifier of the new vlan ··· 697 689 } 698 690 699 691 /** 700 - * batadv_interface_kill_vid - ndo_kill_vid API implementation 692 + * batadv_interface_kill_vid() - ndo_kill_vid API implementation 701 693 * @dev: the netdev of the mesh interface 702 694 * @proto: protocol of the the vlan id 703 695 * @vid: identifier of the deleted vlan ··· 740 732 static struct lock_class_key batadv_netdev_addr_lock_key; 741 733 742 734 /** 743 - * batadv_set_lockdep_class_one - Set lockdep class for a single tx queue 735 + * batadv_set_lockdep_class_one() - Set lockdep class for a single tx queue 744 736 * @dev: device which owns the tx queue 745 737 * @txq: tx queue to modify 746 738 * @_unused: always NULL ··· 753 745 } 754 746 755 747 /** 756 - * batadv_set_lockdep_class - Set txq and addr_list lockdep class 748 + * batadv_set_lockdep_class() - Set txq and addr_list lockdep class 757 749 * @dev: network device to modify 758 750 */ 759 751 static void batadv_set_lockdep_class(struct net_device *dev) ··· 763 755 } 764 756 765 757 /** 766 - * batadv_softif_init_late - late stage initialization of soft interface 758 + * batadv_softif_init_late() - late stage initialization of soft interface 767 759 * @dev: registered network device to modify 768 760 * 769 761 * Return: error code on failures ··· 868 860 } 869 861 870 862 /** 871 - * batadv_softif_slave_add - Add a slave interface to a batadv_soft_interface 863 + * batadv_softif_slave_add() - Add a slave interface to a batadv_soft_interface 872 864 * @dev: batadv_soft_interface used as master interface 873 865 * @slave_dev: net_device which should become the slave interface 874 866 * @extack: extended ACK report struct ··· 896 888 } 897 889 898 890 /** 899 - * batadv_softif_slave_del - Delete a slave iface from a batadv_soft_interface 891 + * batadv_softif_slave_del() - Delete a slave iface from a batadv_soft_interface 900 892 * @dev: batadv_soft_interface used as master interface 901 893 * @slave_dev: net_device which should be removed from the master interface 902 894 * ··· 1031 1023 }; 1032 1024 1033 1025 /** 1034 - * batadv_softif_free - Deconstructor of batadv_soft_interface 1026 + * batadv_softif_free() - Deconstructor of batadv_soft_interface 1035 1027 * @dev: Device to cleanup and remove 1036 1028 */ 1037 1029 static void batadv_softif_free(struct net_device *dev) ··· 1047 1039 } 1048 1040 1049 1041 /** 1050 - * batadv_softif_init_early - early stage initialization of soft interface 1042 + * batadv_softif_init_early() - early stage initialization of soft interface 1051 1043 * @dev: registered network device to modify 1052 1044 */ 1053 1045 static void batadv_softif_init_early(struct net_device *dev) ··· 1071 1063 dev->ethtool_ops = &batadv_ethtool_ops; 1072 1064 } 1073 1065 1066 + /** 1067 + * batadv_softif_create() - Create and register soft interface 1068 + * @net: the applicable net namespace 1069 + * @name: name of the new soft interface 1070 + * 1071 + * Return: newly allocated soft_interface, NULL on errors 1072 + */ 1074 1073 struct net_device *batadv_softif_create(struct net *net, const char *name) 1075 1074 { 1076 1075 struct net_device *soft_iface; ··· 1104 1089 } 1105 1090 1106 1091 /** 1107 - * batadv_softif_destroy_sysfs - deletion of batadv_soft_interface via sysfs 1092 + * batadv_softif_destroy_sysfs() - deletion of batadv_soft_interface via sysfs 1108 1093 * @soft_iface: the to-be-removed batman-adv interface 1109 1094 */ 1110 1095 void batadv_softif_destroy_sysfs(struct net_device *soft_iface) ··· 1126 1111 } 1127 1112 1128 1113 /** 1129 - * batadv_softif_destroy_netlink - deletion of batadv_soft_interface via netlink 1114 + * batadv_softif_destroy_netlink() - deletion of batadv_soft_interface via 1115 + * netlink 1130 1116 * @soft_iface: the to-be-removed batman-adv interface 1131 1117 * @head: list pointer 1132 1118 */ ··· 1155 1139 unregister_netdevice_queue(soft_iface, head); 1156 1140 } 1157 1141 1142 + /** 1143 + * batadv_softif_is_valid() - Check whether device is a batadv soft interface 1144 + * @net_dev: device which should be checked 1145 + * 1146 + * Return: true when net_dev is a batman-adv interface, false otherwise 1147 + */ 1158 1148 bool batadv_softif_is_valid(const struct net_device *net_dev) 1159 1149 { 1160 1150 if (net_dev->netdev_ops->ndo_start_xmit == batadv_interface_tx)
+1
net/batman-adv/soft-interface.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner
+45 -11
net/batman-adv/sysfs.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2010-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner ··· 23 22 #include <linux/compiler.h> 24 23 #include <linux/device.h> 25 24 #include <linux/errno.h> 26 - #include <linux/fs.h> 25 + #include <linux/gfp.h> 27 26 #include <linux/if.h> 28 27 #include <linux/if_vlan.h> 29 28 #include <linux/kernel.h> 29 + #include <linux/kobject.h> 30 30 #include <linux/kref.h> 31 31 #include <linux/netdevice.h> 32 32 #include <linux/printk.h> ··· 65 63 } 66 64 67 65 /** 68 - * batadv_vlan_kobj_to_batpriv - convert a vlan kobj in the associated batpriv 66 + * batadv_vlan_kobj_to_batpriv() - convert a vlan kobj in the associated batpriv 69 67 * @obj: kobject to covert 70 68 * 71 69 * Return: the associated batadv_priv struct. ··· 85 83 } 86 84 87 85 /** 88 - * batadv_kobj_to_vlan - convert a kobj in the associated softif_vlan struct 86 + * batadv_kobj_to_vlan() - convert a kobj in the associated softif_vlan struct 89 87 * @bat_priv: the bat priv with all the soft interface information 90 88 * @obj: kobject to covert 91 89 * ··· 600 598 } 601 599 602 600 /** 603 - * batadv_show_isolation_mark - print the current isolation mark/mask 601 + * batadv_show_isolation_mark() - print the current isolation mark/mask 604 602 * @kobj: kobject representing the private mesh sysfs directory 605 603 * @attr: the batman-adv attribute the user is interacting with 606 604 * @buff: the buffer that will contain the data to send back to the user ··· 618 616 } 619 617 620 618 /** 621 - * batadv_store_isolation_mark - parse and store the isolation mark/mask entered 622 - * by the user 619 + * batadv_store_isolation_mark() - parse and store the isolation mark/mask 620 + * entered by the user 623 621 * @kobj: kobject representing the private mesh sysfs directory 624 622 * @attr: the batman-adv attribute the user is interacting with 625 623 * @buff: the buffer containing the user data ··· 735 733 NULL, 736 734 }; 737 735 736 + /** 737 + * batadv_sysfs_add_meshif() - Add soft interface specific sysfs entries 738 + * @dev: netdev struct of the soft interface 739 + * 740 + * Return: 0 on success or negative error number in case of failure 741 + */ 738 742 int batadv_sysfs_add_meshif(struct net_device *dev) 739 743 { 740 744 struct kobject *batif_kobject = &dev->dev.kobj; ··· 781 773 return -ENOMEM; 782 774 } 783 775 776 + /** 777 + * batadv_sysfs_del_meshif() - Remove soft interface specific sysfs entries 778 + * @dev: netdev struct of the soft interface 779 + */ 784 780 void batadv_sysfs_del_meshif(struct net_device *dev) 785 781 { 786 782 struct batadv_priv *bat_priv = netdev_priv(dev); ··· 800 788 } 801 789 802 790 /** 803 - * batadv_sysfs_add_vlan - add all the needed sysfs objects for the new vlan 791 + * batadv_sysfs_add_vlan() - add all the needed sysfs objects for the new vlan 804 792 * @dev: netdev of the mesh interface 805 793 * @vlan: private data of the newly added VLAN interface 806 794 * ··· 861 849 } 862 850 863 851 /** 864 - * batadv_sysfs_del_vlan - remove all the sysfs objects for a given VLAN 852 + * batadv_sysfs_del_vlan() - remove all the sysfs objects for a given VLAN 865 853 * @bat_priv: the bat priv with all the soft interface information 866 854 * @vlan: the private data of the VLAN to destroy 867 855 */ ··· 906 894 } 907 895 908 896 /** 909 - * batadv_store_mesh_iface_finish - store new hardif mesh_iface state 897 + * batadv_store_mesh_iface_finish() - store new hardif mesh_iface state 910 898 * @net_dev: netdevice to add/remove to/from batman-adv soft-interface 911 899 * @ifname: name of soft-interface to modify 912 900 * ··· 959 947 } 960 948 961 949 /** 962 - * batadv_store_mesh_iface_work - store new hardif mesh_iface state 950 + * batadv_store_mesh_iface_work() - store new hardif mesh_iface state 963 951 * @work: work queue item 964 952 * 965 953 * Changes the parts of the hard+soft interface which can not be modified under ··· 1055 1043 #ifdef CONFIG_BATMAN_ADV_BATMAN_V 1056 1044 1057 1045 /** 1058 - * batadv_store_throughput_override - parse and store throughput override 1046 + * batadv_store_throughput_override() - parse and store throughput override 1059 1047 * entered by the user 1060 1048 * @kobj: kobject representing the private mesh sysfs directory 1061 1049 * @attr: the batman-adv attribute the user is interacting with ··· 1142 1130 NULL, 1143 1131 }; 1144 1132 1133 + /** 1134 + * batadv_sysfs_add_hardif() - Add hard interface specific sysfs entries 1135 + * @hardif_obj: address where to store the pointer to new sysfs folder 1136 + * @dev: netdev struct of the hard interface 1137 + * 1138 + * Return: 0 on success or negative error number in case of failure 1139 + */ 1145 1140 int batadv_sysfs_add_hardif(struct kobject **hardif_obj, struct net_device *dev) 1146 1141 { 1147 1142 struct kobject *hardif_kobject = &dev->dev.kobj; ··· 1183 1164 return -ENOMEM; 1184 1165 } 1185 1166 1167 + /** 1168 + * batadv_sysfs_del_hardif() - Remove hard interface specific sysfs entries 1169 + * @hardif_obj: address to the pointer to which stores batman-adv sysfs folder 1170 + * of the hard interface 1171 + */ 1186 1172 void batadv_sysfs_del_hardif(struct kobject **hardif_obj) 1187 1173 { 1188 1174 kobject_uevent(*hardif_obj, KOBJ_REMOVE); ··· 1196 1172 *hardif_obj = NULL; 1197 1173 } 1198 1174 1175 + /** 1176 + * batadv_throw_uevent() - Send an uevent with batman-adv specific env data 1177 + * @bat_priv: the bat priv with all the soft interface information 1178 + * @type: subsystem type of event. Stored in uevent's BATTYPE 1179 + * @action: action type of event. Stored in uevent's BATACTION 1180 + * @data: string with additional information to the event (ignored for 1181 + * BATADV_UEV_DEL). Stored in uevent's BATDATA 1182 + * 1183 + * Return: 0 on success or negative error number in case of failure 1184 + */ 1199 1185 int batadv_throw_uevent(struct batadv_priv *bat_priv, enum batadv_uev_type type, 1200 1186 enum batadv_uev_action action, const char *data) 1201 1187 {
+14
net/batman-adv/sysfs.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2010-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner ··· 36 35 */ 37 36 #define BATADV_SYSFS_VLAN_SUBDIR_PREFIX "vlan" 38 37 38 + /** 39 + * struct batadv_attribute - sysfs export helper for batman-adv attributes 40 + */ 39 41 struct batadv_attribute { 42 + /** @attr: sysfs attribute file */ 40 43 struct attribute attr; 44 + 45 + /** 46 + * @show: function to export the current attribute's content to sysfs 47 + */ 41 48 ssize_t (*show)(struct kobject *kobj, struct attribute *attr, 42 49 char *buf); 50 + 51 + /** 52 + * @store: function to load new value from character buffer and save it 53 + * in batman-adv attribute 54 + */ 43 55 ssize_t (*store)(struct kobject *kobj, struct attribute *attr, 44 56 char *buf, size_t count); 45 57 };
+39 -36
net/batman-adv/tp_meter.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2012-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Edo Monticelli, Antonio Quartulli ··· 20 19 #include "main.h" 21 20 22 21 #include <linux/atomic.h> 23 - #include <linux/bug.h> 22 + #include <linux/build_bug.h> 24 23 #include <linux/byteorder/generic.h> 25 24 #include <linux/cache.h> 26 25 #include <linux/compiler.h> 27 26 #include <linux/err.h> 28 27 #include <linux/etherdevice.h> 29 - #include <linux/fs.h> 28 + #include <linux/gfp.h> 30 29 #include <linux/if_ether.h> 31 30 #include <linux/init.h> 32 31 #include <linux/jiffies.h> ··· 98 97 static u8 batadv_tp_prerandom[4096] __read_mostly; 99 98 100 99 /** 101 - * batadv_tp_session_cookie - generate session cookie based on session ids 100 + * batadv_tp_session_cookie() - generate session cookie based on session ids 102 101 * @session: TP session identifier 103 102 * @icmp_uid: icmp pseudo uid of the tp session 104 103 * ··· 116 115 } 117 116 118 117 /** 119 - * batadv_tp_cwnd - compute the new cwnd size 118 + * batadv_tp_cwnd() - compute the new cwnd size 120 119 * @base: base cwnd size value 121 120 * @increment: the value to add to base to get the new size 122 121 * @min: minumim cwnd value (usually MSS) ··· 141 140 } 142 141 143 142 /** 144 - * batadv_tp_updated_cwnd - update the Congestion Windows 143 + * batadv_tp_updated_cwnd() - update the Congestion Windows 145 144 * @tp_vars: the private data of the current TP meter session 146 145 * @mss: maximum segment size of transmission 147 146 * ··· 177 176 } 178 177 179 178 /** 180 - * batadv_tp_update_rto - calculate new retransmission timeout 179 + * batadv_tp_update_rto() - calculate new retransmission timeout 181 180 * @tp_vars: the private data of the current TP meter session 182 181 * @new_rtt: new roundtrip time in msec 183 182 */ ··· 213 212 } 214 213 215 214 /** 216 - * batadv_tp_batctl_notify - send client status result to client 215 + * batadv_tp_batctl_notify() - send client status result to client 217 216 * @reason: reason for tp meter session stop 218 217 * @dst: destination of tp_meter session 219 218 * @bat_priv: the bat priv with all the soft interface information ··· 245 244 } 246 245 247 246 /** 248 - * batadv_tp_batctl_error_notify - send client error result to client 247 + * batadv_tp_batctl_error_notify() - send client error result to client 249 248 * @reason: reason for tp meter session stop 250 249 * @dst: destination of tp_meter session 251 250 * @bat_priv: the bat priv with all the soft interface information ··· 260 259 } 261 260 262 261 /** 263 - * batadv_tp_list_find - find a tp_vars object in the global list 262 + * batadv_tp_list_find() - find a tp_vars object in the global list 264 263 * @bat_priv: the bat priv with all the soft interface information 265 264 * @dst: the other endpoint MAC address to look for 266 265 * ··· 295 294 } 296 295 297 296 /** 298 - * batadv_tp_list_find_session - find tp_vars session object in the global list 297 + * batadv_tp_list_find_session() - find tp_vars session object in the global 298 + * list 299 299 * @bat_priv: the bat priv with all the soft interface information 300 300 * @dst: the other endpoint MAC address to look for 301 301 * @session: session identifier ··· 337 335 } 338 336 339 337 /** 340 - * batadv_tp_vars_release - release batadv_tp_vars from lists and queue for 338 + * batadv_tp_vars_release() - release batadv_tp_vars from lists and queue for 341 339 * free after rcu grace period 342 340 * @ref: kref pointer of the batadv_tp_vars 343 341 */ ··· 362 360 } 363 361 364 362 /** 365 - * batadv_tp_vars_put - decrement the batadv_tp_vars refcounter and possibly 363 + * batadv_tp_vars_put() - decrement the batadv_tp_vars refcounter and possibly 366 364 * release it 367 365 * @tp_vars: the private data of the current TP meter session to be free'd 368 366 */ ··· 372 370 } 373 371 374 372 /** 375 - * batadv_tp_sender_cleanup - cleanup sender data and drop and timer 373 + * batadv_tp_sender_cleanup() - cleanup sender data and drop and timer 376 374 * @bat_priv: the bat priv with all the soft interface information 377 375 * @tp_vars: the private data of the current TP meter session to cleanup 378 376 */ ··· 402 400 } 403 401 404 402 /** 405 - * batadv_tp_sender_end - print info about ended session and inform client 403 + * batadv_tp_sender_end() - print info about ended session and inform client 406 404 * @bat_priv: the bat priv with all the soft interface information 407 405 * @tp_vars: the private data of the current TP meter session 408 406 */ ··· 435 433 } 436 434 437 435 /** 438 - * batadv_tp_sender_shutdown - let sender thread/timer stop gracefully 436 + * batadv_tp_sender_shutdown() - let sender thread/timer stop gracefully 439 437 * @tp_vars: the private data of the current TP meter session 440 438 * @reason: reason for tp meter session stop 441 439 */ ··· 449 447 } 450 448 451 449 /** 452 - * batadv_tp_sender_finish - stop sender session after test_length was reached 450 + * batadv_tp_sender_finish() - stop sender session after test_length was reached 453 451 * @work: delayed work reference of the related tp_vars 454 452 */ 455 453 static void batadv_tp_sender_finish(struct work_struct *work) ··· 465 463 } 466 464 467 465 /** 468 - * batadv_tp_reset_sender_timer - reschedule the sender timer 466 + * batadv_tp_reset_sender_timer() - reschedule the sender timer 469 467 * @tp_vars: the private TP meter data for this session 470 468 * 471 469 * Reschedule the timer using tp_vars->rto as delay ··· 483 481 } 484 482 485 483 /** 486 - * batadv_tp_sender_timeout - timer that fires in case of packet loss 484 + * batadv_tp_sender_timeout() - timer that fires in case of packet loss 487 485 * @t: address to timer_list inside tp_vars 488 486 * 489 487 * If fired it means that there was packet loss. ··· 533 531 } 534 532 535 533 /** 536 - * batadv_tp_fill_prerandom - Fill buffer with prefetched random bytes 534 + * batadv_tp_fill_prerandom() - Fill buffer with prefetched random bytes 537 535 * @tp_vars: the private TP meter data for this session 538 536 * @buf: Buffer to fill with bytes 539 537 * @nbytes: amount of pseudorandom bytes ··· 565 563 } 566 564 567 565 /** 568 - * batadv_tp_send_msg - send a single message 566 + * batadv_tp_send_msg() - send a single message 569 567 * @tp_vars: the private TP meter data for this session 570 568 * @src: source mac address 571 569 * @orig_node: the originator of the destination ··· 625 623 } 626 624 627 625 /** 628 - * batadv_tp_recv_ack - ACK receiving function 626 + * batadv_tp_recv_ack() - ACK receiving function 629 627 * @bat_priv: the bat priv with all the soft interface information 630 628 * @skb: the buffer containing the received packet 631 629 * ··· 767 765 } 768 766 769 767 /** 770 - * batadv_tp_avail - check if congestion window is not full 768 + * batadv_tp_avail() - check if congestion window is not full 771 769 * @tp_vars: the private data of the current TP meter session 772 770 * @payload_len: size of the payload of a single message 773 771 * ··· 785 783 } 786 784 787 785 /** 788 - * batadv_tp_wait_available - wait until congestion window becomes free or 786 + * batadv_tp_wait_available() - wait until congestion window becomes free or 789 787 * timeout is reached 790 788 * @tp_vars: the private data of the current TP meter session 791 789 * @plen: size of the payload of a single message ··· 807 805 } 808 806 809 807 /** 810 - * batadv_tp_send - main sending thread of a tp meter session 808 + * batadv_tp_send() - main sending thread of a tp meter session 811 809 * @arg: address of the related tp_vars 812 810 * 813 811 * Return: nothing, this function never returns ··· 906 904 } 907 905 908 906 /** 909 - * batadv_tp_start_kthread - start new thread which manages the tp meter sender 907 + * batadv_tp_start_kthread() - start new thread which manages the tp meter 908 + * sender 910 909 * @tp_vars: the private data of the current TP meter session 911 910 */ 912 911 static void batadv_tp_start_kthread(struct batadv_tp_vars *tp_vars) ··· 938 935 } 939 936 940 937 /** 941 - * batadv_tp_start - start a new tp meter session 938 + * batadv_tp_start() - start a new tp meter session 942 939 * @bat_priv: the bat priv with all the soft interface information 943 940 * @dst: the receiver MAC address 944 941 * @test_length: test length in milliseconds ··· 1063 1060 } 1064 1061 1065 1062 /** 1066 - * batadv_tp_stop - stop currently running tp meter session 1063 + * batadv_tp_stop() - stop currently running tp meter session 1067 1064 * @bat_priv: the bat priv with all the soft interface information 1068 1065 * @dst: the receiver MAC address 1069 1066 * @return_value: reason for tp meter session stop ··· 1095 1092 } 1096 1093 1097 1094 /** 1098 - * batadv_tp_reset_receiver_timer - reset the receiver shutdown timer 1095 + * batadv_tp_reset_receiver_timer() - reset the receiver shutdown timer 1099 1096 * @tp_vars: the private data of the current TP meter session 1100 1097 * 1101 1098 * start the receiver shutdown timer or reset it if already started ··· 1107 1104 } 1108 1105 1109 1106 /** 1110 - * batadv_tp_receiver_shutdown - stop a tp meter receiver when timeout is 1107 + * batadv_tp_receiver_shutdown() - stop a tp meter receiver when timeout is 1111 1108 * reached without received ack 1112 1109 * @t: address to timer_list inside tp_vars 1113 1110 */ ··· 1152 1149 } 1153 1150 1154 1151 /** 1155 - * batadv_tp_send_ack - send an ACK packet 1152 + * batadv_tp_send_ack() - send an ACK packet 1156 1153 * @bat_priv: the bat priv with all the soft interface information 1157 1154 * @dst: the mac address of the destination originator 1158 1155 * @seq: the sequence number to ACK ··· 1224 1221 } 1225 1222 1226 1223 /** 1227 - * batadv_tp_handle_out_of_order - store an out of order packet 1224 + * batadv_tp_handle_out_of_order() - store an out of order packet 1228 1225 * @tp_vars: the private data of the current TP meter session 1229 1226 * @skb: the buffer containing the received packet 1230 1227 * ··· 1300 1297 } 1301 1298 1302 1299 /** 1303 - * batadv_tp_ack_unordered - update number received bytes in current stream 1300 + * batadv_tp_ack_unordered() - update number received bytes in current stream 1304 1301 * without gaps 1305 1302 * @tp_vars: the private data of the current TP meter session 1306 1303 */ ··· 1333 1330 } 1334 1331 1335 1332 /** 1336 - * batadv_tp_init_recv - return matching or create new receiver tp_vars 1333 + * batadv_tp_init_recv() - return matching or create new receiver tp_vars 1337 1334 * @bat_priv: the bat priv with all the soft interface information 1338 1335 * @icmp: received icmp tp msg 1339 1336 * ··· 1386 1383 } 1387 1384 1388 1385 /** 1389 - * batadv_tp_recv_msg - process a single data message 1386 + * batadv_tp_recv_msg() - process a single data message 1390 1387 * @bat_priv: the bat priv with all the soft interface information 1391 1388 * @skb: the buffer containing the received packet 1392 1389 * ··· 1471 1468 } 1472 1469 1473 1470 /** 1474 - * batadv_tp_meter_recv - main TP Meter receiving function 1471 + * batadv_tp_meter_recv() - main TP Meter receiving function 1475 1472 * @bat_priv: the bat priv with all the soft interface information 1476 1473 * @skb: the buffer containing the received packet 1477 1474 */ ··· 1497 1494 } 1498 1495 1499 1496 /** 1500 - * batadv_tp_meter_init - initialize global tp_meter structures 1497 + * batadv_tp_meter_init() - initialize global tp_meter structures 1501 1498 */ 1502 1499 void __init batadv_tp_meter_init(void) 1503 1500 {
+1
net/batman-adv/tp_meter.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2012-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Edo Monticelli, Antonio Quartulli
+136 -96
net/batman-adv/translation-table.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Simon Wunderlich, Antonio Quartulli ··· 21 20 22 21 #include <linux/atomic.h> 23 22 #include <linux/bitops.h> 24 - #include <linux/bug.h> 23 + #include <linux/build_bug.h> 25 24 #include <linux/byteorder/generic.h> 26 25 #include <linux/cache.h> 27 26 #include <linux/compiler.h> 28 27 #include <linux/crc32c.h> 29 28 #include <linux/errno.h> 30 29 #include <linux/etherdevice.h> 31 - #include <linux/fs.h> 30 + #include <linux/gfp.h> 32 31 #include <linux/if_ether.h> 33 32 #include <linux/init.h> 34 33 #include <linux/jhash.h> ··· 37 36 #include <linux/kref.h> 38 37 #include <linux/list.h> 39 38 #include <linux/lockdep.h> 39 + #include <linux/net.h> 40 40 #include <linux/netdevice.h> 41 41 #include <linux/netlink.h> 42 42 #include <linux/rculist.h> ··· 88 86 bool roaming); 89 87 90 88 /** 91 - * batadv_compare_tt - check if two TT entries are the same 89 + * batadv_compare_tt() - check if two TT entries are the same 92 90 * @node: the list element pointer of the first TT entry 93 91 * @data2: pointer to the tt_common_entry of the second TT entry 94 92 * ··· 107 105 } 108 106 109 107 /** 110 - * batadv_choose_tt - return the index of the tt entry in the hash table 108 + * batadv_choose_tt() - return the index of the tt entry in the hash table 111 109 * @data: pointer to the tt_common_entry object to map 112 110 * @size: the size of the hash table 113 111 * ··· 127 125 } 128 126 129 127 /** 130 - * batadv_tt_hash_find - look for a client in the given hash table 128 + * batadv_tt_hash_find() - look for a client in the given hash table 131 129 * @hash: the hash table to search 132 130 * @addr: the mac address of the client to look for 133 131 * @vid: VLAN identifier ··· 172 170 } 173 171 174 172 /** 175 - * batadv_tt_local_hash_find - search the local table for a given client 173 + * batadv_tt_local_hash_find() - search the local table for a given client 176 174 * @bat_priv: the bat priv with all the soft interface information 177 175 * @addr: the mac address of the client to look for 178 176 * @vid: VLAN identifier ··· 197 195 } 198 196 199 197 /** 200 - * batadv_tt_global_hash_find - search the global table for a given client 198 + * batadv_tt_global_hash_find() - search the global table for a given client 201 199 * @bat_priv: the bat priv with all the soft interface information 202 200 * @addr: the mac address of the client to look for 203 201 * @vid: VLAN identifier ··· 222 220 } 223 221 224 222 /** 225 - * batadv_tt_local_entry_free_rcu - free the tt_local_entry 223 + * batadv_tt_local_entry_free_rcu() - free the tt_local_entry 226 224 * @rcu: rcu pointer of the tt_local_entry 227 225 */ 228 226 static void batadv_tt_local_entry_free_rcu(struct rcu_head *rcu) ··· 236 234 } 237 235 238 236 /** 239 - * batadv_tt_local_entry_release - release tt_local_entry from lists and queue 237 + * batadv_tt_local_entry_release() - release tt_local_entry from lists and queue 240 238 * for free after rcu grace period 241 239 * @ref: kref pointer of the nc_node 242 240 */ ··· 253 251 } 254 252 255 253 /** 256 - * batadv_tt_local_entry_put - decrement the tt_local_entry refcounter and 254 + * batadv_tt_local_entry_put() - decrement the tt_local_entry refcounter and 257 255 * possibly release it 258 256 * @tt_local_entry: tt_local_entry to be free'd 259 257 */ ··· 265 263 } 266 264 267 265 /** 268 - * batadv_tt_global_entry_free_rcu - free the tt_global_entry 266 + * batadv_tt_global_entry_free_rcu() - free the tt_global_entry 269 267 * @rcu: rcu pointer of the tt_global_entry 270 268 */ 271 269 static void batadv_tt_global_entry_free_rcu(struct rcu_head *rcu) ··· 279 277 } 280 278 281 279 /** 282 - * batadv_tt_global_entry_release - release tt_global_entry from lists and queue 283 - * for free after rcu grace period 280 + * batadv_tt_global_entry_release() - release tt_global_entry from lists and 281 + * queue for free after rcu grace period 284 282 * @ref: kref pointer of the nc_node 285 283 */ 286 284 static void batadv_tt_global_entry_release(struct kref *ref) ··· 296 294 } 297 295 298 296 /** 299 - * batadv_tt_global_entry_put - decrement the tt_global_entry refcounter and 297 + * batadv_tt_global_entry_put() - decrement the tt_global_entry refcounter and 300 298 * possibly release it 301 299 * @tt_global_entry: tt_global_entry to be free'd 302 300 */ ··· 308 306 } 309 307 310 308 /** 311 - * batadv_tt_global_hash_count - count the number of orig entries 309 + * batadv_tt_global_hash_count() - count the number of orig entries 312 310 * @bat_priv: the bat priv with all the soft interface information 313 311 * @addr: the mac address of the client to count entries for 314 312 * @vid: VLAN identifier ··· 333 331 } 334 332 335 333 /** 336 - * batadv_tt_local_size_mod - change the size by v of the local table identified 337 - * by vid 334 + * batadv_tt_local_size_mod() - change the size by v of the local table 335 + * identified by vid 338 336 * @bat_priv: the bat priv with all the soft interface information 339 337 * @vid: the VLAN identifier of the sub-table to change 340 338 * @v: the amount to sum to the local table size ··· 354 352 } 355 353 356 354 /** 357 - * batadv_tt_local_size_inc - increase by one the local table size for the given 358 - * vid 355 + * batadv_tt_local_size_inc() - increase by one the local table size for the 356 + * given vid 359 357 * @bat_priv: the bat priv with all the soft interface information 360 358 * @vid: the VLAN identifier 361 359 */ ··· 366 364 } 367 365 368 366 /** 369 - * batadv_tt_local_size_dec - decrease by one the local table size for the given 370 - * vid 367 + * batadv_tt_local_size_dec() - decrease by one the local table size for the 368 + * given vid 371 369 * @bat_priv: the bat priv with all the soft interface information 372 370 * @vid: the VLAN identifier 373 371 */ ··· 378 376 } 379 377 380 378 /** 381 - * batadv_tt_global_size_mod - change the size by v of the global table 379 + * batadv_tt_global_size_mod() - change the size by v of the global table 382 380 * for orig_node identified by vid 383 381 * @orig_node: the originator for which the table has to be modified 384 382 * @vid: the VLAN identifier ··· 406 404 } 407 405 408 406 /** 409 - * batadv_tt_global_size_inc - increase by one the global table size for the 407 + * batadv_tt_global_size_inc() - increase by one the global table size for the 410 408 * given vid 411 409 * @orig_node: the originator which global table size has to be decreased 412 410 * @vid: the vlan identifier ··· 418 416 } 419 417 420 418 /** 421 - * batadv_tt_global_size_dec - decrease by one the global table size for the 419 + * batadv_tt_global_size_dec() - decrease by one the global table size for the 422 420 * given vid 423 421 * @orig_node: the originator which global table size has to be decreased 424 422 * @vid: the vlan identifier ··· 430 428 } 431 429 432 430 /** 433 - * batadv_tt_orig_list_entry_free_rcu - free the orig_entry 431 + * batadv_tt_orig_list_entry_free_rcu() - free the orig_entry 434 432 * @rcu: rcu pointer of the orig_entry 435 433 */ 436 434 static void batadv_tt_orig_list_entry_free_rcu(struct rcu_head *rcu) ··· 443 441 } 444 442 445 443 /** 446 - * batadv_tt_orig_list_entry_release - release tt orig entry from lists and 444 + * batadv_tt_orig_list_entry_release() - release tt orig entry from lists and 447 445 * queue for free after rcu grace period 448 446 * @ref: kref pointer of the tt orig entry 449 447 */ ··· 459 457 } 460 458 461 459 /** 462 - * batadv_tt_orig_list_entry_put - decrement the tt orig entry refcounter and 460 + * batadv_tt_orig_list_entry_put() - decrement the tt orig entry refcounter and 463 461 * possibly release it 464 462 * @orig_entry: tt orig entry to be free'd 465 463 */ ··· 470 468 } 471 469 472 470 /** 473 - * batadv_tt_local_event - store a local TT event (ADD/DEL) 471 + * batadv_tt_local_event() - store a local TT event (ADD/DEL) 474 472 * @bat_priv: the bat priv with all the soft interface information 475 473 * @tt_local_entry: the TT entry involved in the event 476 474 * @event_flags: flags to store in the event structure ··· 545 543 } 546 544 547 545 /** 548 - * batadv_tt_len - compute length in bytes of given number of tt changes 546 + * batadv_tt_len() - compute length in bytes of given number of tt changes 549 547 * @changes_num: number of tt changes 550 548 * 551 549 * Return: computed length in bytes. ··· 556 554 } 557 555 558 556 /** 559 - * batadv_tt_entries - compute the number of entries fitting in tt_len bytes 557 + * batadv_tt_entries() - compute the number of entries fitting in tt_len bytes 560 558 * @tt_len: available space 561 559 * 562 560 * Return: the number of entries. ··· 567 565 } 568 566 569 567 /** 570 - * batadv_tt_local_table_transmit_size - calculates the local translation table 571 - * size when transmitted over the air 568 + * batadv_tt_local_table_transmit_size() - calculates the local translation 569 + * table size when transmitted over the air 572 570 * @bat_priv: the bat priv with all the soft interface information 573 571 * 574 572 * Return: local translation table size in bytes. ··· 627 625 } 628 626 629 627 /** 630 - * batadv_tt_local_add - add a new client to the local table or update an 628 + * batadv_tt_local_add() - add a new client to the local table or update an 631 629 * existing client 632 630 * @soft_iface: netdev struct of the mesh interface 633 631 * @addr: the mac address of the client to add ··· 832 830 } 833 831 834 832 /** 835 - * batadv_tt_prepare_tvlv_global_data - prepare the TVLV TT header to send 833 + * batadv_tt_prepare_tvlv_global_data() - prepare the TVLV TT header to send 836 834 * within a TT Response directed to another node 837 835 * @orig_node: originator for which the TT data has to be prepared 838 836 * @tt_data: uninitialised pointer to the address of the TVLV buffer ··· 905 903 } 906 904 907 905 /** 908 - * batadv_tt_prepare_tvlv_local_data - allocate and prepare the TT TVLV for this 909 - * node 906 + * batadv_tt_prepare_tvlv_local_data() - allocate and prepare the TT TVLV for 907 + * this node 910 908 * @bat_priv: the bat priv with all the soft interface information 911 909 * @tt_data: uninitialised pointer to the address of the TVLV buffer 912 910 * @tt_change: uninitialised pointer to the address of the area where the TT ··· 979 977 } 980 978 981 979 /** 982 - * batadv_tt_tvlv_container_update - update the translation table tvlv container 983 - * after local tt changes have been committed 980 + * batadv_tt_tvlv_container_update() - update the translation table tvlv 981 + * container after local tt changes have been committed 984 982 * @bat_priv: the bat priv with all the soft interface information 985 983 */ 986 984 static void batadv_tt_tvlv_container_update(struct batadv_priv *bat_priv) ··· 1055 1053 } 1056 1054 1057 1055 #ifdef CONFIG_BATMAN_ADV_DEBUGFS 1056 + 1057 + /** 1058 + * batadv_tt_local_seq_print_text() - Print the local tt table in a seq file 1059 + * @seq: seq file to print on 1060 + * @offset: not used 1061 + * 1062 + * Return: always 0 1063 + */ 1058 1064 int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset) 1059 1065 { 1060 1066 struct net_device *net_dev = (struct net_device *)seq->private; ··· 1133 1123 #endif 1134 1124 1135 1125 /** 1136 - * batadv_tt_local_dump_entry - Dump one TT local entry into a message 1126 + * batadv_tt_local_dump_entry() - Dump one TT local entry into a message 1137 1127 * @msg :Netlink message to dump into 1138 1128 * @portid: Port making netlink request 1139 1129 * @seq: Sequence number of netlink message ··· 1189 1179 } 1190 1180 1191 1181 /** 1192 - * batadv_tt_local_dump_bucket - Dump one TT local bucket into a message 1182 + * batadv_tt_local_dump_bucket() - Dump one TT local bucket into a message 1193 1183 * @msg: Netlink message to dump into 1194 1184 * @portid: Port making netlink request 1195 1185 * @seq: Sequence number of netlink message ··· 1226 1216 } 1227 1217 1228 1218 /** 1229 - * batadv_tt_local_dump - Dump TT local entries into a message 1219 + * batadv_tt_local_dump() - Dump TT local entries into a message 1230 1220 * @msg: Netlink message to dump into 1231 1221 * @cb: Parameters from query 1232 1222 * ··· 1310 1300 } 1311 1301 1312 1302 /** 1313 - * batadv_tt_local_remove - logically remove an entry from the local table 1303 + * batadv_tt_local_remove() - logically remove an entry from the local table 1314 1304 * @bat_priv: the bat priv with all the soft interface information 1315 1305 * @addr: the MAC address of the client to remove 1316 1306 * @vid: VLAN identifier ··· 1372 1362 } 1373 1363 1374 1364 /** 1375 - * batadv_tt_local_purge_list - purge inactive tt local entries 1365 + * batadv_tt_local_purge_list() - purge inactive tt local entries 1376 1366 * @bat_priv: the bat priv with all the soft interface information 1377 1367 * @head: pointer to the list containing the local tt entries 1378 1368 * @timeout: parameter deciding whether a given tt local entry is considered ··· 1407 1397 } 1408 1398 1409 1399 /** 1410 - * batadv_tt_local_purge - purge inactive tt local entries 1400 + * batadv_tt_local_purge() - purge inactive tt local entries 1411 1401 * @bat_priv: the bat priv with all the soft interface information 1412 1402 * @timeout: parameter deciding whether a given tt local entry is considered 1413 1403 * inactive or not ··· 1500 1490 } 1501 1491 1502 1492 /** 1503 - * batadv_tt_global_orig_entry_find - find a TT orig_list_entry 1493 + * batadv_tt_global_orig_entry_find() - find a TT orig_list_entry 1504 1494 * @entry: the TT global entry where the orig_list_entry has to be 1505 1495 * extracted from 1506 1496 * @orig_node: the originator for which the orig_list_entry has to be found ··· 1534 1524 } 1535 1525 1536 1526 /** 1537 - * batadv_tt_global_entry_has_orig - check if a TT global entry is also handled 1538 - * by a given originator 1527 + * batadv_tt_global_entry_has_orig() - check if a TT global entry is also 1528 + * handled by a given originator 1539 1529 * @entry: the TT global entry to check 1540 1530 * @orig_node: the originator to search in the list 1541 1531 * ··· 1560 1550 } 1561 1551 1562 1552 /** 1563 - * batadv_tt_global_sync_flags - update TT sync flags 1553 + * batadv_tt_global_sync_flags() - update TT sync flags 1564 1554 * @tt_global: the TT global entry to update sync flags in 1565 1555 * 1566 1556 * Updates the sync flag bits in the tt_global flag attribute with a logical ··· 1584 1574 } 1585 1575 1586 1576 /** 1587 - * batadv_tt_global_orig_entry_add - add or update a TT orig entry 1577 + * batadv_tt_global_orig_entry_add() - add or update a TT orig entry 1588 1578 * @tt_global: the TT global entry to add an orig entry in 1589 1579 * @orig_node: the originator to add an orig entry for 1590 1580 * @ttvn: translation table version number of this changeset ··· 1634 1624 } 1635 1625 1636 1626 /** 1637 - * batadv_tt_global_add - add a new TT global entry or update an existing one 1627 + * batadv_tt_global_add() - add a new TT global entry or update an existing one 1638 1628 * @bat_priv: the bat priv with all the soft interface information 1639 1629 * @orig_node: the originator announcing the client 1640 1630 * @tt_addr: the mac address of the non-mesh client ··· 1806 1796 } 1807 1797 1808 1798 /** 1809 - * batadv_transtable_best_orig - Get best originator list entry from tt entry 1799 + * batadv_transtable_best_orig() - Get best originator list entry from tt entry 1810 1800 * @bat_priv: the bat priv with all the soft interface information 1811 1801 * @tt_global_entry: global translation table entry to be analyzed 1812 1802 * ··· 1852 1842 1853 1843 #ifdef CONFIG_BATMAN_ADV_DEBUGFS 1854 1844 /** 1855 - * batadv_tt_global_print_entry - print all orig nodes who announce the address 1856 - * for this global entry 1845 + * batadv_tt_global_print_entry() - print all orig nodes who announce the 1846 + * address for this global entry 1857 1847 * @bat_priv: the bat priv with all the soft interface information 1858 1848 * @tt_global_entry: global translation table entry to be printed 1859 1849 * @seq: debugfs table seq_file struct ··· 1935 1925 } 1936 1926 } 1937 1927 1928 + /** 1929 + * batadv_tt_global_seq_print_text() - Print the global tt table in a seq file 1930 + * @seq: seq file to print on 1931 + * @offset: not used 1932 + * 1933 + * Return: always 0 1934 + */ 1938 1935 int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset) 1939 1936 { 1940 1937 struct net_device *net_dev = (struct net_device *)seq->private; ··· 1984 1967 #endif 1985 1968 1986 1969 /** 1987 - * batadv_tt_global_dump_subentry - Dump all TT local entries into a message 1970 + * batadv_tt_global_dump_subentry() - Dump all TT local entries into a message 1988 1971 * @msg: Netlink message to dump into 1989 1972 * @portid: Port making netlink request 1990 1973 * @seq: Sequence number of netlink message ··· 2045 2028 } 2046 2029 2047 2030 /** 2048 - * batadv_tt_global_dump_entry - Dump one TT global entry into a message 2031 + * batadv_tt_global_dump_entry() - Dump one TT global entry into a message 2049 2032 * @msg: Netlink message to dump into 2050 2033 * @portid: Port making netlink request 2051 2034 * @seq: Sequence number of netlink message ··· 2090 2073 } 2091 2074 2092 2075 /** 2093 - * batadv_tt_global_dump_bucket - Dump one TT local bucket into a message 2076 + * batadv_tt_global_dump_bucket() - Dump one TT local bucket into a message 2094 2077 * @msg: Netlink message to dump into 2095 2078 * @portid: Port making netlink request 2096 2079 * @seq: Sequence number of netlink message ··· 2129 2112 } 2130 2113 2131 2114 /** 2132 - * batadv_tt_global_dump - Dump TT global entries into a message 2115 + * batadv_tt_global_dump() - Dump TT global entries into a message 2133 2116 * @msg: Netlink message to dump into 2134 2117 * @cb: Parameters from query 2135 2118 * ··· 2197 2180 } 2198 2181 2199 2182 /** 2200 - * _batadv_tt_global_del_orig_entry - remove and free an orig_entry 2183 + * _batadv_tt_global_del_orig_entry() - remove and free an orig_entry 2201 2184 * @tt_global_entry: the global entry to remove the orig_entry from 2202 2185 * @orig_entry: the orig entry to remove and free 2203 2186 * ··· 2239 2222 } 2240 2223 2241 2224 /** 2242 - * batadv_tt_global_del_orig_node - remove orig_node from a global tt entry 2225 + * batadv_tt_global_del_orig_node() - remove orig_node from a global tt entry 2243 2226 * @bat_priv: the bat priv with all the soft interface information 2244 2227 * @tt_global_entry: the global entry to remove the orig_node from 2245 2228 * @orig_node: the originator announcing the client ··· 2318 2301 } 2319 2302 2320 2303 /** 2321 - * batadv_tt_global_del - remove a client from the global table 2304 + * batadv_tt_global_del() - remove a client from the global table 2322 2305 * @bat_priv: the bat priv with all the soft interface information 2323 2306 * @orig_node: an originator serving this client 2324 2307 * @addr: the mac address of the client ··· 2384 2367 } 2385 2368 2386 2369 /** 2387 - * batadv_tt_global_del_orig - remove all the TT global entries belonging to the 2388 - * given originator matching the provided vid 2370 + * batadv_tt_global_del_orig() - remove all the TT global entries belonging to 2371 + * the given originator matching the provided vid 2389 2372 * @bat_priv: the bat priv with all the soft interface information 2390 2373 * @orig_node: the originator owning the entries to remove 2391 2374 * @match_vid: the VLAN identifier to match. If negative all the entries will be ··· 2556 2539 } 2557 2540 2558 2541 /** 2559 - * batadv_transtable_search - get the mesh destination for a given client 2542 + * batadv_transtable_search() - get the mesh destination for a given client 2560 2543 * @bat_priv: the bat priv with all the soft interface information 2561 2544 * @src: mac address of the source client 2562 2545 * @addr: mac address of the destination client ··· 2616 2599 } 2617 2600 2618 2601 /** 2619 - * batadv_tt_global_crc - calculates the checksum of the local table belonging 2602 + * batadv_tt_global_crc() - calculates the checksum of the local table belonging 2620 2603 * to the given orig_node 2621 2604 * @bat_priv: the bat priv with all the soft interface information 2622 2605 * @orig_node: originator for which the CRC should be computed ··· 2711 2694 } 2712 2695 2713 2696 /** 2714 - * batadv_tt_local_crc - calculates the checksum of the local table 2697 + * batadv_tt_local_crc() - calculates the checksum of the local table 2715 2698 * @bat_priv: the bat priv with all the soft interface information 2716 2699 * @vid: VLAN identifier for which the CRC32 has to be computed 2717 2700 * ··· 2768 2751 } 2769 2752 2770 2753 /** 2771 - * batadv_tt_req_node_release - free tt_req node entry 2754 + * batadv_tt_req_node_release() - free tt_req node entry 2772 2755 * @ref: kref pointer of the tt req_node entry 2773 2756 */ 2774 2757 static void batadv_tt_req_node_release(struct kref *ref) ··· 2781 2764 } 2782 2765 2783 2766 /** 2784 - * batadv_tt_req_node_put - decrement the tt_req_node refcounter and 2767 + * batadv_tt_req_node_put() - decrement the tt_req_node refcounter and 2785 2768 * possibly release it 2786 2769 * @tt_req_node: tt_req_node to be free'd 2787 2770 */ ··· 2843 2826 } 2844 2827 2845 2828 /** 2846 - * batadv_tt_req_node_new - search and possibly create a tt_req_node object 2829 + * batadv_tt_req_node_new() - search and possibly create a tt_req_node object 2847 2830 * @bat_priv: the bat priv with all the soft interface information 2848 2831 * @orig_node: orig node this request is being issued for 2849 2832 * ··· 2880 2863 } 2881 2864 2882 2865 /** 2883 - * batadv_tt_local_valid - verify that given tt entry is a valid one 2866 + * batadv_tt_local_valid() - verify that given tt entry is a valid one 2884 2867 * @entry_ptr: to be checked local tt entry 2885 2868 * @data_ptr: not used but definition required to satisfy the callback prototype 2886 2869 * ··· 2914 2897 } 2915 2898 2916 2899 /** 2917 - * batadv_tt_tvlv_generate - fill the tvlv buff with the tt entries from the 2900 + * batadv_tt_tvlv_generate() - fill the tvlv buff with the tt entries from the 2918 2901 * specified tt hash 2919 2902 * @bat_priv: the bat priv with all the soft interface information 2920 2903 * @hash: hash table containing the tt entries ··· 2965 2948 } 2966 2949 2967 2950 /** 2968 - * batadv_tt_global_check_crc - check if all the CRCs are correct 2951 + * batadv_tt_global_check_crc() - check if all the CRCs are correct 2969 2952 * @orig_node: originator for which the CRCs have to be checked 2970 2953 * @tt_vlan: pointer to the first tvlv VLAN entry 2971 2954 * @num_vlan: number of tvlv VLAN entries ··· 3022 3005 } 3023 3006 3024 3007 /** 3025 - * batadv_tt_local_update_crc - update all the local CRCs 3008 + * batadv_tt_local_update_crc() - update all the local CRCs 3026 3009 * @bat_priv: the bat priv with all the soft interface information 3027 3010 */ 3028 3011 static void batadv_tt_local_update_crc(struct batadv_priv *bat_priv) ··· 3038 3021 } 3039 3022 3040 3023 /** 3041 - * batadv_tt_global_update_crc - update all the global CRCs for this orig_node 3024 + * batadv_tt_global_update_crc() - update all the global CRCs for this orig_node 3042 3025 * @bat_priv: the bat priv with all the soft interface information 3043 3026 * @orig_node: the orig_node for which the CRCs have to be updated 3044 3027 */ ··· 3065 3048 } 3066 3049 3067 3050 /** 3068 - * batadv_send_tt_request - send a TT Request message to a given node 3051 + * batadv_send_tt_request() - send a TT Request message to a given node 3069 3052 * @bat_priv: the bat priv with all the soft interface information 3070 3053 * @dst_orig_node: the destination of the message 3071 3054 * @ttvn: the version number that the source of the message is looking for ··· 3154 3137 } 3155 3138 3156 3139 /** 3157 - * batadv_send_other_tt_response - send reply to tt request concerning another 3140 + * batadv_send_other_tt_response() - send reply to tt request concerning another 3158 3141 * node's translation table 3159 3142 * @bat_priv: the bat priv with all the soft interface information 3160 3143 * @tt_data: tt data containing the tt request information ··· 3287 3270 } 3288 3271 3289 3272 /** 3290 - * batadv_send_my_tt_response - send reply to tt request concerning this node's 3291 - * translation table 3273 + * batadv_send_my_tt_response() - send reply to tt request concerning this 3274 + * node's translation table 3292 3275 * @bat_priv: the bat priv with all the soft interface information 3293 3276 * @tt_data: tt data containing the tt request information 3294 3277 * @req_src: mac address of tt request sender ··· 3405 3388 } 3406 3389 3407 3390 /** 3408 - * batadv_send_tt_response - send reply to tt request 3391 + * batadv_send_tt_response() - send reply to tt request 3409 3392 * @bat_priv: the bat priv with all the soft interface information 3410 3393 * @tt_data: tt data containing the tt request information 3411 3394 * @req_src: mac address of tt request sender ··· 3501 3484 } 3502 3485 3503 3486 /** 3504 - * batadv_is_my_client - check if a client is served by the local node 3487 + * batadv_is_my_client() - check if a client is served by the local node 3505 3488 * @bat_priv: the bat priv with all the soft interface information 3506 3489 * @addr: the mac address of the client to check 3507 3490 * @vid: VLAN identifier ··· 3531 3514 } 3532 3515 3533 3516 /** 3534 - * batadv_handle_tt_response - process incoming tt reply 3517 + * batadv_handle_tt_response() - process incoming tt reply 3535 3518 * @bat_priv: the bat priv with all the soft interface information 3536 3519 * @tt_data: tt data containing the tt request information 3537 3520 * @resp_src: mac address of tt reply sender ··· 3624 3607 } 3625 3608 3626 3609 /** 3627 - * batadv_tt_check_roam_count - check if a client has roamed too frequently 3610 + * batadv_tt_check_roam_count() - check if a client has roamed too frequently 3628 3611 * @bat_priv: the bat priv with all the soft interface information 3629 3612 * @client: mac address of the roaming client 3630 3613 * ··· 3679 3662 } 3680 3663 3681 3664 /** 3682 - * batadv_send_roam_adv - send a roaming advertisement message 3665 + * batadv_send_roam_adv() - send a roaming advertisement message 3683 3666 * @bat_priv: the bat priv with all the soft interface information 3684 3667 * @client: mac address of the roaming client 3685 3668 * @vid: VLAN identifier ··· 3744 3727 msecs_to_jiffies(BATADV_TT_WORK_PERIOD)); 3745 3728 } 3746 3729 3730 + /** 3731 + * batadv_tt_free() - Free translation table of soft interface 3732 + * @bat_priv: the bat priv with all the soft interface information 3733 + */ 3747 3734 void batadv_tt_free(struct batadv_priv *bat_priv) 3748 3735 { 3749 3736 batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_TT, 1); ··· 3765 3744 } 3766 3745 3767 3746 /** 3768 - * batadv_tt_local_set_flags - set or unset the specified flags on the local 3747 + * batadv_tt_local_set_flags() - set or unset the specified flags on the local 3769 3748 * table and possibly count them in the TT size 3770 3749 * @bat_priv: the bat priv with all the soft interface information 3771 3750 * @flags: the flag to switch ··· 3851 3830 } 3852 3831 3853 3832 /** 3854 - * batadv_tt_local_commit_changes_nolock - commit all pending local tt changes 3833 + * batadv_tt_local_commit_changes_nolock() - commit all pending local tt changes 3855 3834 * which have been queued in the time since the last commit 3856 3835 * @bat_priv: the bat priv with all the soft interface information 3857 3836 * ··· 3884 3863 } 3885 3864 3886 3865 /** 3887 - * batadv_tt_local_commit_changes - commit all pending local tt changes which 3866 + * batadv_tt_local_commit_changes() - commit all pending local tt changes which 3888 3867 * have been queued in the time since the last commit 3889 3868 * @bat_priv: the bat priv with all the soft interface information 3890 3869 */ ··· 3895 3874 spin_unlock_bh(&bat_priv->tt.commit_lock); 3896 3875 } 3897 3876 3877 + /** 3878 + * batadv_is_ap_isolated() - Check if packet from upper layer should be dropped 3879 + * @bat_priv: the bat priv with all the soft interface information 3880 + * @src: source mac address of packet 3881 + * @dst: destination mac address of packet 3882 + * @vid: vlan id of packet 3883 + * 3884 + * Return: true when src+dst(+vid) pair should be isolated, false otherwise 3885 + */ 3898 3886 bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst, 3899 3887 unsigned short vid) 3900 3888 { ··· 3939 3909 } 3940 3910 3941 3911 /** 3942 - * batadv_tt_update_orig - update global translation table with new tt 3912 + * batadv_tt_update_orig() - update global translation table with new tt 3943 3913 * information received via ogms 3944 3914 * @bat_priv: the bat priv with all the soft interface information 3945 3915 * @orig_node: the orig_node of the ogm ··· 4024 3994 } 4025 3995 4026 3996 /** 4027 - * batadv_tt_global_client_is_roaming - check if a client is marked as roaming 3997 + * batadv_tt_global_client_is_roaming() - check if a client is marked as roaming 4028 3998 * @bat_priv: the bat priv with all the soft interface information 4029 3999 * @addr: the mac address of the client to check 4030 4000 * @vid: VLAN identifier ··· 4050 4020 } 4051 4021 4052 4022 /** 4053 - * batadv_tt_local_client_is_roaming - tells whether the client is roaming 4023 + * batadv_tt_local_client_is_roaming() - tells whether the client is roaming 4054 4024 * @bat_priv: the bat priv with all the soft interface information 4055 4025 * @addr: the mac address of the local client to query 4056 4026 * @vid: VLAN identifier ··· 4075 4045 return ret; 4076 4046 } 4077 4047 4048 + /** 4049 + * batadv_tt_add_temporary_global_entry() - Add temporary entry to global TT 4050 + * @bat_priv: the bat priv with all the soft interface information 4051 + * @orig_node: orig node which the temporary entry should be associated with 4052 + * @addr: mac address of the client 4053 + * @vid: VLAN id of the new temporary global translation table 4054 + * 4055 + * Return: true when temporary tt entry could be added, false otherwise 4056 + */ 4078 4057 bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv, 4079 4058 struct batadv_orig_node *orig_node, 4080 4059 const unsigned char *addr, ··· 4108 4069 } 4109 4070 4110 4071 /** 4111 - * batadv_tt_local_resize_to_mtu - resize the local translation table fit the 4072 + * batadv_tt_local_resize_to_mtu() - resize the local translation table fit the 4112 4073 * maximum packet size that can be transported through the mesh 4113 4074 * @soft_iface: netdev struct of the mesh interface 4114 4075 * ··· 4149 4110 } 4150 4111 4151 4112 /** 4152 - * batadv_tt_tvlv_ogm_handler_v1 - process incoming tt tvlv container 4113 + * batadv_tt_tvlv_ogm_handler_v1() - process incoming tt tvlv container 4153 4114 * @bat_priv: the bat priv with all the soft interface information 4154 4115 * @orig: the orig_node of the ogm 4155 4116 * @flags: flags indicating the tvlv state (see batadv_tvlv_handler_flags) ··· 4188 4149 } 4189 4150 4190 4151 /** 4191 - * batadv_tt_tvlv_unicast_handler_v1 - process incoming (unicast) tt tvlv 4152 + * batadv_tt_tvlv_unicast_handler_v1() - process incoming (unicast) tt tvlv 4192 4153 * container 4193 4154 * @bat_priv: the bat priv with all the soft interface information 4194 4155 * @src: mac address of tt tvlv sender ··· 4270 4231 } 4271 4232 4272 4233 /** 4273 - * batadv_roam_tvlv_unicast_handler_v1 - process incoming tt roam tvlv container 4234 + * batadv_roam_tvlv_unicast_handler_v1() - process incoming tt roam tvlv 4235 + * container 4274 4236 * @bat_priv: the bat priv with all the soft interface information 4275 4237 * @src: mac address of tt tvlv sender 4276 4238 * @dst: mac address of tt tvlv recipient ··· 4321 4281 } 4322 4282 4323 4283 /** 4324 - * batadv_tt_init - initialise the translation table internals 4284 + * batadv_tt_init() - initialise the translation table internals 4325 4285 * @bat_priv: the bat priv with all the soft interface information 4326 4286 * 4327 4287 * Return: 0 on success or negative error number in case of failure. ··· 4357 4317 } 4358 4318 4359 4319 /** 4360 - * batadv_tt_global_is_isolated - check if a client is marked as isolated 4320 + * batadv_tt_global_is_isolated() - check if a client is marked as isolated 4361 4321 * @bat_priv: the bat priv with all the soft interface information 4362 4322 * @addr: the mac address of the client 4363 4323 * @vid: the identifier of the VLAN where this client is connected ··· 4383 4343 } 4384 4344 4385 4345 /** 4386 - * batadv_tt_cache_init - Initialize tt memory object cache 4346 + * batadv_tt_cache_init() - Initialize tt memory object cache 4387 4347 * 4388 4348 * Return: 0 on success or negative error number in case of failure. 4389 4349 */ ··· 4452 4412 } 4453 4413 4454 4414 /** 4455 - * batadv_tt_cache_destroy - Destroy tt memory object cache 4415 + * batadv_tt_cache_destroy() - Destroy tt memory object cache 4456 4416 */ 4457 4417 void batadv_tt_cache_destroy(void) 4458 4418 {
+1
net/batman-adv/translation-table.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Simon Wunderlich, Antonio Quartulli
+21 -20
net/batman-adv/tvlv.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Simon Wunderlich ··· 20 19 21 20 #include <linux/byteorder/generic.h> 22 21 #include <linux/etherdevice.h> 23 - #include <linux/fs.h> 22 + #include <linux/gfp.h> 24 23 #include <linux/if_ether.h> 25 24 #include <linux/kernel.h> 26 25 #include <linux/kref.h> ··· 43 42 #include "tvlv.h" 44 43 45 44 /** 46 - * batadv_tvlv_handler_release - release tvlv handler from lists and queue for 45 + * batadv_tvlv_handler_release() - release tvlv handler from lists and queue for 47 46 * free after rcu grace period 48 47 * @ref: kref pointer of the tvlv 49 48 */ ··· 56 55 } 57 56 58 57 /** 59 - * batadv_tvlv_handler_put - decrement the tvlv container refcounter and 58 + * batadv_tvlv_handler_put() - decrement the tvlv container refcounter and 60 59 * possibly release it 61 60 * @tvlv_handler: the tvlv handler to free 62 61 */ ··· 66 65 } 67 66 68 67 /** 69 - * batadv_tvlv_handler_get - retrieve tvlv handler from the tvlv handler list 68 + * batadv_tvlv_handler_get() - retrieve tvlv handler from the tvlv handler list 70 69 * based on the provided type and version (both need to match) 71 70 * @bat_priv: the bat priv with all the soft interface information 72 71 * @type: tvlv handler type to look for ··· 100 99 } 101 100 102 101 /** 103 - * batadv_tvlv_container_release - release tvlv from lists and free 102 + * batadv_tvlv_container_release() - release tvlv from lists and free 104 103 * @ref: kref pointer of the tvlv 105 104 */ 106 105 static void batadv_tvlv_container_release(struct kref *ref) ··· 112 111 } 113 112 114 113 /** 115 - * batadv_tvlv_container_put - decrement the tvlv container refcounter and 114 + * batadv_tvlv_container_put() - decrement the tvlv container refcounter and 116 115 * possibly release it 117 116 * @tvlv: the tvlv container to free 118 117 */ ··· 122 121 } 123 122 124 123 /** 125 - * batadv_tvlv_container_get - retrieve tvlv container from the tvlv container 124 + * batadv_tvlv_container_get() - retrieve tvlv container from the tvlv container 126 125 * list based on the provided type and version (both need to match) 127 126 * @bat_priv: the bat priv with all the soft interface information 128 127 * @type: tvlv container type to look for ··· 156 155 } 157 156 158 157 /** 159 - * batadv_tvlv_container_list_size - calculate the size of the tvlv container 158 + * batadv_tvlv_container_list_size() - calculate the size of the tvlv container 160 159 * list entries 161 160 * @bat_priv: the bat priv with all the soft interface information 162 161 * ··· 181 180 } 182 181 183 182 /** 184 - * batadv_tvlv_container_remove - remove tvlv container from the tvlv container 185 - * list 183 + * batadv_tvlv_container_remove() - remove tvlv container from the tvlv 184 + * container list 186 185 * @bat_priv: the bat priv with all the soft interface information 187 186 * @tvlv: the to be removed tvlv container 188 187 * ··· 205 204 } 206 205 207 206 /** 208 - * batadv_tvlv_container_unregister - unregister tvlv container based on the 207 + * batadv_tvlv_container_unregister() - unregister tvlv container based on the 209 208 * provided type and version (both need to match) 210 209 * @bat_priv: the bat priv with all the soft interface information 211 210 * @type: tvlv container type to unregister ··· 223 222 } 224 223 225 224 /** 226 - * batadv_tvlv_container_register - register tvlv type, version and content 225 + * batadv_tvlv_container_register() - register tvlv type, version and content 227 226 * to be propagated with each (primary interface) OGM 228 227 * @bat_priv: the bat priv with all the soft interface information 229 228 * @type: tvlv container type ··· 268 267 } 269 268 270 269 /** 271 - * batadv_tvlv_realloc_packet_buff - reallocate packet buffer to accommodate 270 + * batadv_tvlv_realloc_packet_buff() - reallocate packet buffer to accommodate 272 271 * requested packet size 273 272 * @packet_buff: packet buffer 274 273 * @packet_buff_len: packet buffer size ··· 301 300 } 302 301 303 302 /** 304 - * batadv_tvlv_container_ogm_append - append tvlv container content to given 303 + * batadv_tvlv_container_ogm_append() - append tvlv container content to given 305 304 * OGM packet buffer 306 305 * @bat_priv: the bat priv with all the soft interface information 307 306 * @packet_buff: ogm packet buffer ··· 354 353 } 355 354 356 355 /** 357 - * batadv_tvlv_call_handler - parse the given tvlv buffer to call the 356 + * batadv_tvlv_call_handler() - parse the given tvlv buffer to call the 358 357 * appropriate handlers 359 358 * @bat_priv: the bat priv with all the soft interface information 360 359 * @tvlv_handler: tvlv callback function handling the tvlv content ··· 408 407 } 409 408 410 409 /** 411 - * batadv_tvlv_containers_process - parse the given tvlv buffer to call the 410 + * batadv_tvlv_containers_process() - parse the given tvlv buffer to call the 412 411 * appropriate handlers 413 412 * @bat_priv: the bat priv with all the soft interface information 414 413 * @ogm_source: flag indicating whether the tvlv is an ogm or a unicast packet ··· 475 474 } 476 475 477 476 /** 478 - * batadv_tvlv_ogm_receive - process an incoming ogm and call the appropriate 477 + * batadv_tvlv_ogm_receive() - process an incoming ogm and call the appropriate 479 478 * handlers 480 479 * @bat_priv: the bat priv with all the soft interface information 481 480 * @batadv_ogm_packet: ogm packet containing the tvlv containers ··· 502 501 } 503 502 504 503 /** 505 - * batadv_tvlv_handler_register - register tvlv handler based on the provided 504 + * batadv_tvlv_handler_register() - register tvlv handler based on the provided 506 505 * type and version (both need to match) for ogm tvlv payload and/or unicast 507 506 * payload 508 507 * @bat_priv: the bat priv with all the soft interface information ··· 557 556 } 558 557 559 558 /** 560 - * batadv_tvlv_handler_unregister - unregister tvlv handler based on the 559 + * batadv_tvlv_handler_unregister() - unregister tvlv handler based on the 561 560 * provided type and version (both need to match) 562 561 * @bat_priv: the bat priv with all the soft interface information 563 562 * @type: tvlv handler type to be unregistered ··· 580 579 } 581 580 582 581 /** 583 - * batadv_tvlv_unicast_send - send a unicast packet with tvlv payload to the 582 + * batadv_tvlv_unicast_send() - send a unicast packet with tvlv payload to the 584 583 * specified host 585 584 * @bat_priv: the bat priv with all the soft interface information 586 585 * @src: source mac address of the unicast packet
+1
net/batman-adv/tvlv.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Simon Wunderlich
+1384 -609
net/batman-adv/types.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: 2 3 * 3 4 * Marek Lindner, Simon Wunderlich ··· 55 54 56 55 /** 57 56 * enum batadv_dhcp_recipient - dhcp destination 58 - * @BATADV_DHCP_NO: packet is not a dhcp message 59 - * @BATADV_DHCP_TO_SERVER: dhcp message is directed to a server 60 - * @BATADV_DHCP_TO_CLIENT: dhcp message is directed to a client 61 57 */ 62 58 enum batadv_dhcp_recipient { 59 + /** @BATADV_DHCP_NO: packet is not a dhcp message */ 63 60 BATADV_DHCP_NO = 0, 61 + 62 + /** @BATADV_DHCP_TO_SERVER: dhcp message is directed to a server */ 64 63 BATADV_DHCP_TO_SERVER, 64 + 65 + /** @BATADV_DHCP_TO_CLIENT: dhcp message is directed to a client */ 65 66 BATADV_DHCP_TO_CLIENT, 66 67 }; 67 68 ··· 81 78 82 79 /** 83 80 * struct batadv_hard_iface_bat_iv - per hard-interface B.A.T.M.A.N. IV data 84 - * @ogm_buff: buffer holding the OGM packet 85 - * @ogm_buff_len: length of the OGM packet buffer 86 - * @ogm_seqno: OGM sequence number - used to identify each OGM 87 81 */ 88 82 struct batadv_hard_iface_bat_iv { 83 + /** @ogm_buff: buffer holding the OGM packet */ 89 84 unsigned char *ogm_buff; 85 + 86 + /** @ogm_buff_len: length of the OGM packet buffer */ 90 87 int ogm_buff_len; 88 + 89 + /** @ogm_seqno: OGM sequence number - used to identify each OGM */ 91 90 atomic_t ogm_seqno; 92 91 }; 93 92 94 93 /** 95 94 * enum batadv_v_hard_iface_flags - interface flags useful to B.A.T.M.A.N. V 96 - * @BATADV_FULL_DUPLEX: tells if the connection over this link is full-duplex 97 - * @BATADV_WARNING_DEFAULT: tells whether we have warned the user that no 98 - * throughput data is available for this interface and that default values are 99 - * assumed. 100 95 */ 101 96 enum batadv_v_hard_iface_flags { 97 + /** 98 + * @BATADV_FULL_DUPLEX: tells if the connection over this link is 99 + * full-duplex 100 + */ 102 101 BATADV_FULL_DUPLEX = BIT(0), 102 + 103 + /** 104 + * @BATADV_WARNING_DEFAULT: tells whether we have warned the user that 105 + * no throughput data is available for this interface and that default 106 + * values are assumed. 107 + */ 103 108 BATADV_WARNING_DEFAULT = BIT(1), 104 109 }; 105 110 106 111 /** 107 112 * struct batadv_hard_iface_bat_v - per hard-interface B.A.T.M.A.N. V data 108 - * @elp_interval: time interval between two ELP transmissions 109 - * @elp_seqno: current ELP sequence number 110 - * @elp_skb: base skb containing the ELP message to send 111 - * @elp_wq: workqueue used to schedule ELP transmissions 112 - * @throughput_override: throughput override to disable link auto-detection 113 - * @flags: interface specific flags 114 113 */ 115 114 struct batadv_hard_iface_bat_v { 115 + /** @elp_interval: time interval between two ELP transmissions */ 116 116 atomic_t elp_interval; 117 + 118 + /** @elp_seqno: current ELP sequence number */ 117 119 atomic_t elp_seqno; 120 + 121 + /** @elp_skb: base skb containing the ELP message to send */ 118 122 struct sk_buff *elp_skb; 123 + 124 + /** @elp_wq: workqueue used to schedule ELP transmissions */ 119 125 struct delayed_work elp_wq; 126 + 127 + /** 128 + * @throughput_override: throughput override to disable link 129 + * auto-detection 130 + */ 120 131 atomic_t throughput_override; 132 + 133 + /** @flags: interface specific flags */ 121 134 u8 flags; 122 135 }; 123 136 124 137 /** 125 138 * enum batadv_hard_iface_wifi_flags - Flags describing the wifi configuration 126 139 * of a batadv_hard_iface 127 - * @BATADV_HARDIF_WIFI_WEXT_DIRECT: it is a wext wifi device 128 - * @BATADV_HARDIF_WIFI_CFG80211_DIRECT: it is a cfg80211 wifi device 129 - * @BATADV_HARDIF_WIFI_WEXT_INDIRECT: link device is a wext wifi device 130 - * @BATADV_HARDIF_WIFI_CFG80211_INDIRECT: link device is a cfg80211 wifi device 131 140 */ 132 141 enum batadv_hard_iface_wifi_flags { 142 + /** @BATADV_HARDIF_WIFI_WEXT_DIRECT: it is a wext wifi device */ 133 143 BATADV_HARDIF_WIFI_WEXT_DIRECT = BIT(0), 144 + 145 + /** @BATADV_HARDIF_WIFI_CFG80211_DIRECT: it is a cfg80211 wifi device */ 134 146 BATADV_HARDIF_WIFI_CFG80211_DIRECT = BIT(1), 147 + 148 + /** 149 + * @BATADV_HARDIF_WIFI_WEXT_INDIRECT: link device is a wext wifi device 150 + */ 135 151 BATADV_HARDIF_WIFI_WEXT_INDIRECT = BIT(2), 152 + 153 + /** 154 + * @BATADV_HARDIF_WIFI_CFG80211_INDIRECT: link device is a cfg80211 wifi 155 + * device 156 + */ 136 157 BATADV_HARDIF_WIFI_CFG80211_INDIRECT = BIT(3), 137 158 }; 138 159 139 160 /** 140 161 * struct batadv_hard_iface - network device known to batman-adv 141 - * @list: list node for batadv_hardif_list 142 - * @if_num: identificator of the interface 143 - * @if_status: status of the interface for batman-adv 144 - * @num_bcasts: number of payload re-broadcasts on this interface (ARQ) 145 - * @wifi_flags: flags whether this is (directly or indirectly) a wifi interface 146 - * @net_dev: pointer to the net_device 147 - * @hardif_obj: kobject of the per interface sysfs "mesh" directory 148 - * @refcount: number of contexts the object is used 149 - * @batman_adv_ptype: packet type describing packets that should be processed by 150 - * batman-adv for this interface 151 - * @soft_iface: the batman-adv interface which uses this network interface 152 - * @rcu: struct used for freeing in an RCU-safe manner 153 - * @bat_iv: per hard-interface B.A.T.M.A.N. IV data 154 - * @bat_v: per hard-interface B.A.T.M.A.N. V data 155 - * @debug_dir: dentry for nc subdir in batman-adv directory in debugfs 156 - * @neigh_list: list of unique single hop neighbors via this interface 157 - * @neigh_list_lock: lock protecting neigh_list 158 162 */ 159 163 struct batadv_hard_iface { 164 + /** @list: list node for batadv_hardif_list */ 160 165 struct list_head list; 166 + 167 + /** @if_num: identificator of the interface */ 161 168 s16 if_num; 169 + 170 + /** @if_status: status of the interface for batman-adv */ 162 171 char if_status; 172 + 173 + /** 174 + * @num_bcasts: number of payload re-broadcasts on this interface (ARQ) 175 + */ 163 176 u8 num_bcasts; 177 + 178 + /** 179 + * @wifi_flags: flags whether this is (directly or indirectly) a wifi 180 + * interface 181 + */ 164 182 u32 wifi_flags; 183 + 184 + /** @net_dev: pointer to the net_device */ 165 185 struct net_device *net_dev; 186 + 187 + /** @hardif_obj: kobject of the per interface sysfs "mesh" directory */ 166 188 struct kobject *hardif_obj; 189 + 190 + /** @refcount: number of contexts the object is used */ 167 191 struct kref refcount; 192 + 193 + /** 194 + * @batman_adv_ptype: packet type describing packets that should be 195 + * processed by batman-adv for this interface 196 + */ 168 197 struct packet_type batman_adv_ptype; 198 + 199 + /** 200 + * @soft_iface: the batman-adv interface which uses this network 201 + * interface 202 + */ 169 203 struct net_device *soft_iface; 204 + 205 + /** @rcu: struct used for freeing in an RCU-safe manner */ 170 206 struct rcu_head rcu; 207 + 208 + /** @bat_iv: per hard-interface B.A.T.M.A.N. IV data */ 171 209 struct batadv_hard_iface_bat_iv bat_iv; 210 + 172 211 #ifdef CONFIG_BATMAN_ADV_BATMAN_V 212 + /** @bat_v: per hard-interface B.A.T.M.A.N. V data */ 173 213 struct batadv_hard_iface_bat_v bat_v; 174 214 #endif 215 + 216 + /** 217 + * @debug_dir: dentry for nc subdir in batman-adv directory in debugfs 218 + */ 175 219 struct dentry *debug_dir; 220 + 221 + /** 222 + * @neigh_list: list of unique single hop neighbors via this interface 223 + */ 176 224 struct hlist_head neigh_list; 177 - /* neigh_list_lock protects: neigh_list */ 225 + 226 + /** @neigh_list_lock: lock protecting neigh_list */ 178 227 spinlock_t neigh_list_lock; 179 228 }; 180 229 181 230 /** 182 231 * struct batadv_orig_ifinfo - originator info per outgoing interface 183 - * @list: list node for orig_node::ifinfo_list 184 - * @if_outgoing: pointer to outgoing hard-interface 185 - * @router: router that should be used to reach this originator 186 - * @last_real_seqno: last and best known sequence number 187 - * @last_ttl: ttl of last received packet 188 - * @last_seqno_forwarded: seqno of the OGM which was forwarded last 189 - * @batman_seqno_reset: time when the batman seqno window was reset 190 - * @refcount: number of contexts the object is used 191 - * @rcu: struct used for freeing in an RCU-safe manner 192 232 */ 193 233 struct batadv_orig_ifinfo { 234 + /** @list: list node for &batadv_orig_node.ifinfo_list */ 194 235 struct hlist_node list; 236 + 237 + /** @if_outgoing: pointer to outgoing hard-interface */ 195 238 struct batadv_hard_iface *if_outgoing; 196 - struct batadv_neigh_node __rcu *router; /* rcu protected pointer */ 239 + 240 + /** @router: router that should be used to reach this originator */ 241 + struct batadv_neigh_node __rcu *router; 242 + 243 + /** @last_real_seqno: last and best known sequence number */ 197 244 u32 last_real_seqno; 245 + 246 + /** @last_ttl: ttl of last received packet */ 198 247 u8 last_ttl; 248 + 249 + /** @last_seqno_forwarded: seqno of the OGM which was forwarded last */ 199 250 u32 last_seqno_forwarded; 251 + 252 + /** @batman_seqno_reset: time when the batman seqno window was reset */ 200 253 unsigned long batman_seqno_reset; 254 + 255 + /** @refcount: number of contexts the object is used */ 201 256 struct kref refcount; 257 + 258 + /** @rcu: struct used for freeing in an RCU-safe manner */ 202 259 struct rcu_head rcu; 203 260 }; 204 261 205 262 /** 206 263 * struct batadv_frag_table_entry - head in the fragment buffer table 207 - * @fragment_list: head of list with fragments 208 - * @lock: lock to protect the list of fragments 209 - * @timestamp: time (jiffie) of last received fragment 210 - * @seqno: sequence number of the fragments in the list 211 - * @size: accumulated size of packets in list 212 - * @total_size: expected size of the assembled packet 213 264 */ 214 265 struct batadv_frag_table_entry { 266 + /** @fragment_list: head of list with fragments */ 215 267 struct hlist_head fragment_list; 216 - spinlock_t lock; /* protects fragment_list */ 268 + 269 + /** @lock: lock to protect the list of fragments */ 270 + spinlock_t lock; 271 + 272 + /** @timestamp: time (jiffie) of last received fragment */ 217 273 unsigned long timestamp; 274 + 275 + /** @seqno: sequence number of the fragments in the list */ 218 276 u16 seqno; 277 + 278 + /** @size: accumulated size of packets in list */ 219 279 u16 size; 280 + 281 + /** @total_size: expected size of the assembled packet */ 220 282 u16 total_size; 221 283 }; 222 284 223 285 /** 224 286 * struct batadv_frag_list_entry - entry in a list of fragments 225 - * @list: list node information 226 - * @skb: fragment 227 - * @no: fragment number in the set 228 287 */ 229 288 struct batadv_frag_list_entry { 289 + /** @list: list node information */ 230 290 struct hlist_node list; 291 + 292 + /** @skb: fragment */ 231 293 struct sk_buff *skb; 294 + 295 + /** @no: fragment number in the set */ 232 296 u8 no; 233 297 }; 234 298 235 299 /** 236 300 * struct batadv_vlan_tt - VLAN specific TT attributes 237 - * @crc: CRC32 checksum of the entries belonging to this vlan 238 - * @num_entries: number of TT entries for this VLAN 239 301 */ 240 302 struct batadv_vlan_tt { 303 + /** @crc: CRC32 checksum of the entries belonging to this vlan */ 241 304 u32 crc; 305 + 306 + /** @num_entries: number of TT entries for this VLAN */ 242 307 atomic_t num_entries; 243 308 }; 244 309 245 310 /** 246 311 * struct batadv_orig_node_vlan - VLAN specific data per orig_node 247 - * @vid: the VLAN identifier 248 - * @tt: VLAN specific TT attributes 249 - * @list: list node for orig_node::vlan_list 250 - * @refcount: number of context where this object is currently in use 251 - * @rcu: struct used for freeing in a RCU-safe manner 252 312 */ 253 313 struct batadv_orig_node_vlan { 314 + /** @vid: the VLAN identifier */ 254 315 unsigned short vid; 316 + 317 + /** @tt: VLAN specific TT attributes */ 255 318 struct batadv_vlan_tt tt; 319 + 320 + /** @list: list node for &batadv_orig_node.vlan_list */ 256 321 struct hlist_node list; 322 + 323 + /** 324 + * @refcount: number of context where this object is currently in use 325 + */ 257 326 struct kref refcount; 327 + 328 + /** @rcu: struct used for freeing in a RCU-safe manner */ 258 329 struct rcu_head rcu; 259 330 }; 260 331 261 332 /** 262 333 * struct batadv_orig_bat_iv - B.A.T.M.A.N. IV private orig_node members 263 - * @bcast_own: set of bitfields (one per hard-interface) where each one counts 264 - * the number of our OGMs this orig_node rebroadcasted "back" to us (relative 265 - * to last_real_seqno). Every bitfield is BATADV_TQ_LOCAL_WINDOW_SIZE bits long. 266 - * @bcast_own_sum: sum of bcast_own 267 - * @ogm_cnt_lock: lock protecting bcast_own, bcast_own_sum, 268 - * neigh_node->bat_iv.real_bits & neigh_node->bat_iv.real_packet_count 269 334 */ 270 335 struct batadv_orig_bat_iv { 336 + /** 337 + * @bcast_own: set of bitfields (one per hard-interface) where each one 338 + * counts the number of our OGMs this orig_node rebroadcasted "back" to 339 + * us (relative to last_real_seqno). Every bitfield is 340 + * BATADV_TQ_LOCAL_WINDOW_SIZE bits long. 341 + */ 271 342 unsigned long *bcast_own; 343 + 344 + /** @bcast_own_sum: sum of bcast_own */ 272 345 u8 *bcast_own_sum; 273 - /* ogm_cnt_lock protects: bcast_own, bcast_own_sum, 346 + 347 + /** 348 + * @ogm_cnt_lock: lock protecting bcast_own, bcast_own_sum, 274 349 * neigh_node->bat_iv.real_bits & neigh_node->bat_iv.real_packet_count 275 350 */ 276 351 spinlock_t ogm_cnt_lock; ··· 356 275 357 276 /** 358 277 * struct batadv_orig_node - structure for orig_list maintaining nodes of mesh 359 - * @orig: originator ethernet address 360 - * @ifinfo_list: list for routers per outgoing interface 361 - * @last_bonding_candidate: pointer to last ifinfo of last used router 362 - * @dat_addr: address of the orig node in the distributed hash 363 - * @last_seen: time when last packet from this node was received 364 - * @bcast_seqno_reset: time when the broadcast seqno window was reset 365 - * @mcast_handler_lock: synchronizes mcast-capability and -flag changes 366 - * @mcast_flags: multicast flags announced by the orig node 367 - * @mcast_want_all_unsnoopables_node: a list node for the 368 - * mcast.want_all_unsnoopables list 369 - * @mcast_want_all_ipv4_node: a list node for the mcast.want_all_ipv4 list 370 - * @mcast_want_all_ipv6_node: a list node for the mcast.want_all_ipv6 list 371 - * @capabilities: announced capabilities of this originator 372 - * @capa_initialized: bitfield to remember whether a capability was initialized 373 - * @last_ttvn: last seen translation table version number 374 - * @tt_buff: last tt changeset this node received from the orig node 375 - * @tt_buff_len: length of the last tt changeset this node received from the 376 - * orig node 377 - * @tt_buff_lock: lock that protects tt_buff and tt_buff_len 378 - * @tt_lock: prevents from updating the table while reading it. Table update is 379 - * made up by two operations (data structure update and metdata -CRC/TTVN- 380 - * recalculation) and they have to be executed atomically in order to avoid 381 - * another thread to read the table/metadata between those. 382 - * @bcast_bits: bitfield containing the info which payload broadcast originated 383 - * from this orig node this host already has seen (relative to 384 - * last_bcast_seqno) 385 - * @last_bcast_seqno: last broadcast sequence number received by this host 386 - * @neigh_list: list of potential next hop neighbor towards this orig node 387 - * @neigh_list_lock: lock protecting neigh_list and router 388 - * @hash_entry: hlist node for batadv_priv::orig_hash 389 - * @bat_priv: pointer to soft_iface this orig node belongs to 390 - * @bcast_seqno_lock: lock protecting bcast_bits & last_bcast_seqno 391 - * @refcount: number of contexts the object is used 392 - * @rcu: struct used for freeing in an RCU-safe manner 393 - * @in_coding_list: list of nodes this orig can hear 394 - * @out_coding_list: list of nodes that can hear this orig 395 - * @in_coding_list_lock: protects in_coding_list 396 - * @out_coding_list_lock: protects out_coding_list 397 - * @fragments: array with heads for fragment chains 398 - * @vlan_list: a list of orig_node_vlan structs, one per VLAN served by the 399 - * originator represented by this object 400 - * @vlan_list_lock: lock protecting vlan_list 401 - * @bat_iv: B.A.T.M.A.N. IV private structure 402 278 */ 403 279 struct batadv_orig_node { 280 + /** @orig: originator ethernet address */ 404 281 u8 orig[ETH_ALEN]; 282 + 283 + /** @ifinfo_list: list for routers per outgoing interface */ 405 284 struct hlist_head ifinfo_list; 285 + 286 + /** 287 + * @last_bonding_candidate: pointer to last ifinfo of last used router 288 + */ 406 289 struct batadv_orig_ifinfo *last_bonding_candidate; 290 + 407 291 #ifdef CONFIG_BATMAN_ADV_DAT 292 + /** @dat_addr: address of the orig node in the distributed hash */ 408 293 batadv_dat_addr_t dat_addr; 409 294 #endif 295 + 296 + /** @last_seen: time when last packet from this node was received */ 410 297 unsigned long last_seen; 298 + 299 + /** 300 + * @bcast_seqno_reset: time when the broadcast seqno window was reset 301 + */ 411 302 unsigned long bcast_seqno_reset; 303 + 412 304 #ifdef CONFIG_BATMAN_ADV_MCAST 413 - /* synchronizes mcast tvlv specific orig changes */ 305 + /** 306 + * @mcast_handler_lock: synchronizes mcast-capability and -flag changes 307 + */ 414 308 spinlock_t mcast_handler_lock; 309 + 310 + /** @mcast_flags: multicast flags announced by the orig node */ 415 311 u8 mcast_flags; 312 + 313 + /** 314 + * @mcast_want_all_unsnoopables_node: a list node for the 315 + * mcast.want_all_unsnoopables list 316 + */ 416 317 struct hlist_node mcast_want_all_unsnoopables_node; 318 + 319 + /** 320 + * @mcast_want_all_ipv4_node: a list node for the mcast.want_all_ipv4 321 + * list 322 + */ 417 323 struct hlist_node mcast_want_all_ipv4_node; 324 + /** 325 + * @mcast_want_all_ipv6_node: a list node for the mcast.want_all_ipv6 326 + * list 327 + */ 418 328 struct hlist_node mcast_want_all_ipv6_node; 419 329 #endif 330 + 331 + /** @capabilities: announced capabilities of this originator */ 420 332 unsigned long capabilities; 333 + 334 + /** 335 + * @capa_initialized: bitfield to remember whether a capability was 336 + * initialized 337 + */ 421 338 unsigned long capa_initialized; 339 + 340 + /** @last_ttvn: last seen translation table version number */ 422 341 atomic_t last_ttvn; 342 + 343 + /** @tt_buff: last tt changeset this node received from the orig node */ 423 344 unsigned char *tt_buff; 345 + 346 + /** 347 + * @tt_buff_len: length of the last tt changeset this node received 348 + * from the orig node 349 + */ 424 350 s16 tt_buff_len; 425 - spinlock_t tt_buff_lock; /* protects tt_buff & tt_buff_len */ 426 - /* prevents from changing the table while reading it */ 351 + 352 + /** @tt_buff_lock: lock that protects tt_buff and tt_buff_len */ 353 + spinlock_t tt_buff_lock; 354 + 355 + /** 356 + * @tt_lock: prevents from updating the table while reading it. Table 357 + * update is made up by two operations (data structure update and 358 + * metdata -CRC/TTVN-recalculation) and they have to be executed 359 + * atomically in order to avoid another thread to read the 360 + * table/metadata between those. 361 + */ 427 362 spinlock_t tt_lock; 363 + 364 + /** 365 + * @bcast_bits: bitfield containing the info which payload broadcast 366 + * originated from this orig node this host already has seen (relative 367 + * to last_bcast_seqno) 368 + */ 428 369 DECLARE_BITMAP(bcast_bits, BATADV_TQ_LOCAL_WINDOW_SIZE); 370 + 371 + /** 372 + * @last_bcast_seqno: last broadcast sequence number received by this 373 + * host 374 + */ 429 375 u32 last_bcast_seqno; 376 + 377 + /** 378 + * @neigh_list: list of potential next hop neighbor towards this orig 379 + * node 380 + */ 430 381 struct hlist_head neigh_list; 431 - /* neigh_list_lock protects: neigh_list, ifinfo_list, 432 - * last_bonding_candidate and router 382 + 383 + /** 384 + * @neigh_list_lock: lock protecting neigh_list, ifinfo_list, 385 + * last_bonding_candidate and router 433 386 */ 434 387 spinlock_t neigh_list_lock; 388 + 389 + /** @hash_entry: hlist node for &batadv_priv.orig_hash */ 435 390 struct hlist_node hash_entry; 391 + 392 + /** @bat_priv: pointer to soft_iface this orig node belongs to */ 436 393 struct batadv_priv *bat_priv; 437 - /* bcast_seqno_lock protects: bcast_bits & last_bcast_seqno */ 394 + 395 + /** @bcast_seqno_lock: lock protecting bcast_bits & last_bcast_seqno */ 438 396 spinlock_t bcast_seqno_lock; 397 + 398 + /** @refcount: number of contexts the object is used */ 439 399 struct kref refcount; 400 + 401 + /** @rcu: struct used for freeing in an RCU-safe manner */ 440 402 struct rcu_head rcu; 403 + 441 404 #ifdef CONFIG_BATMAN_ADV_NC 405 + /** @in_coding_list: list of nodes this orig can hear */ 442 406 struct list_head in_coding_list; 407 + 408 + /** @out_coding_list: list of nodes that can hear this orig */ 443 409 struct list_head out_coding_list; 444 - spinlock_t in_coding_list_lock; /* Protects in_coding_list */ 445 - spinlock_t out_coding_list_lock; /* Protects out_coding_list */ 410 + 411 + /** @in_coding_list_lock: protects in_coding_list */ 412 + spinlock_t in_coding_list_lock; 413 + 414 + /** @out_coding_list_lock: protects out_coding_list */ 415 + spinlock_t out_coding_list_lock; 446 416 #endif 417 + 418 + /** @fragments: array with heads for fragment chains */ 447 419 struct batadv_frag_table_entry fragments[BATADV_FRAG_BUFFER_COUNT]; 420 + 421 + /** 422 + * @vlan_list: a list of orig_node_vlan structs, one per VLAN served by 423 + * the originator represented by this object 424 + */ 448 425 struct hlist_head vlan_list; 449 - spinlock_t vlan_list_lock; /* protects vlan_list */ 426 + 427 + /** @vlan_list_lock: lock protecting vlan_list */ 428 + spinlock_t vlan_list_lock; 429 + 430 + /** @bat_iv: B.A.T.M.A.N. IV private structure */ 450 431 struct batadv_orig_bat_iv bat_iv; 451 432 }; 452 433 453 434 /** 454 435 * enum batadv_orig_capabilities - orig node capabilities 455 - * @BATADV_ORIG_CAPA_HAS_DAT: orig node has distributed arp table enabled 456 - * @BATADV_ORIG_CAPA_HAS_NC: orig node has network coding enabled 457 - * @BATADV_ORIG_CAPA_HAS_TT: orig node has tt capability 458 - * @BATADV_ORIG_CAPA_HAS_MCAST: orig node has some multicast capability 459 - * (= orig node announces a tvlv of type BATADV_TVLV_MCAST) 460 436 */ 461 437 enum batadv_orig_capabilities { 438 + /** 439 + * @BATADV_ORIG_CAPA_HAS_DAT: orig node has distributed arp table 440 + * enabled 441 + */ 462 442 BATADV_ORIG_CAPA_HAS_DAT, 443 + 444 + /** @BATADV_ORIG_CAPA_HAS_NC: orig node has network coding enabled */ 463 445 BATADV_ORIG_CAPA_HAS_NC, 446 + 447 + /** @BATADV_ORIG_CAPA_HAS_TT: orig node has tt capability */ 464 448 BATADV_ORIG_CAPA_HAS_TT, 449 + 450 + /** 451 + * @BATADV_ORIG_CAPA_HAS_MCAST: orig node has some multicast capability 452 + * (= orig node announces a tvlv of type BATADV_TVLV_MCAST) 453 + */ 465 454 BATADV_ORIG_CAPA_HAS_MCAST, 466 455 }; 467 456 468 457 /** 469 458 * struct batadv_gw_node - structure for orig nodes announcing gw capabilities 470 - * @list: list node for batadv_priv_gw::list 471 - * @orig_node: pointer to corresponding orig node 472 - * @bandwidth_down: advertised uplink download bandwidth 473 - * @bandwidth_up: advertised uplink upload bandwidth 474 - * @refcount: number of contexts the object is used 475 - * @rcu: struct used for freeing in an RCU-safe manner 476 459 */ 477 460 struct batadv_gw_node { 461 + /** @list: list node for &batadv_priv_gw.list */ 478 462 struct hlist_node list; 463 + 464 + /** @orig_node: pointer to corresponding orig node */ 479 465 struct batadv_orig_node *orig_node; 466 + 467 + /** @bandwidth_down: advertised uplink download bandwidth */ 480 468 u32 bandwidth_down; 469 + 470 + /** @bandwidth_up: advertised uplink upload bandwidth */ 481 471 u32 bandwidth_up; 472 + 473 + /** @refcount: number of contexts the object is used */ 482 474 struct kref refcount; 475 + 476 + /** @rcu: struct used for freeing in an RCU-safe manner */ 483 477 struct rcu_head rcu; 484 478 }; 485 479 ··· 563 407 /** 564 408 * struct batadv_hardif_neigh_node_bat_v - B.A.T.M.A.N. V private neighbor 565 409 * information 566 - * @throughput: ewma link throughput towards this neighbor 567 - * @elp_interval: time interval between two ELP transmissions 568 - * @elp_latest_seqno: latest and best known ELP sequence number 569 - * @last_unicast_tx: when the last unicast packet has been sent to this neighbor 570 - * @metric_work: work queue callback item for metric update 571 410 */ 572 411 struct batadv_hardif_neigh_node_bat_v { 412 + /** @throughput: ewma link throughput towards this neighbor */ 573 413 struct ewma_throughput throughput; 414 + 415 + /** @elp_interval: time interval between two ELP transmissions */ 574 416 u32 elp_interval; 417 + 418 + /** @elp_latest_seqno: latest and best known ELP sequence number */ 575 419 u32 elp_latest_seqno; 420 + 421 + /** 422 + * @last_unicast_tx: when the last unicast packet has been sent to this 423 + * neighbor 424 + */ 576 425 unsigned long last_unicast_tx; 426 + 427 + /** @metric_work: work queue callback item for metric update */ 577 428 struct work_struct metric_work; 578 429 }; 579 430 580 431 /** 581 432 * struct batadv_hardif_neigh_node - unique neighbor per hard-interface 582 - * @list: list node for batadv_hard_iface::neigh_list 583 - * @addr: the MAC address of the neighboring interface 584 - * @orig: the address of the originator this neighbor node belongs to 585 - * @if_incoming: pointer to incoming hard-interface 586 - * @last_seen: when last packet via this neighbor was received 587 - * @bat_v: B.A.T.M.A.N. V private data 588 - * @refcount: number of contexts the object is used 589 - * @rcu: struct used for freeing in a RCU-safe manner 590 433 */ 591 434 struct batadv_hardif_neigh_node { 435 + /** @list: list node for &batadv_hard_iface.neigh_list */ 592 436 struct hlist_node list; 437 + 438 + /** @addr: the MAC address of the neighboring interface */ 593 439 u8 addr[ETH_ALEN]; 440 + 441 + /** 442 + * @orig: the address of the originator this neighbor node belongs to 443 + */ 594 444 u8 orig[ETH_ALEN]; 445 + 446 + /** @if_incoming: pointer to incoming hard-interface */ 595 447 struct batadv_hard_iface *if_incoming; 448 + 449 + /** @last_seen: when last packet via this neighbor was received */ 596 450 unsigned long last_seen; 451 + 597 452 #ifdef CONFIG_BATMAN_ADV_BATMAN_V 453 + /** @bat_v: B.A.T.M.A.N. V private data */ 598 454 struct batadv_hardif_neigh_node_bat_v bat_v; 599 455 #endif 456 + 457 + /** @refcount: number of contexts the object is used */ 600 458 struct kref refcount; 459 + 460 + /** @rcu: struct used for freeing in a RCU-safe manner */ 601 461 struct rcu_head rcu; 602 462 }; 603 463 604 464 /** 605 465 * struct batadv_neigh_node - structure for single hops neighbors 606 - * @list: list node for batadv_orig_node::neigh_list 607 - * @orig_node: pointer to corresponding orig_node 608 - * @addr: the MAC address of the neighboring interface 609 - * @ifinfo_list: list for routing metrics per outgoing interface 610 - * @ifinfo_lock: lock protecting private ifinfo members and list 611 - * @if_incoming: pointer to incoming hard-interface 612 - * @last_seen: when last packet via this neighbor was received 613 - * @hardif_neigh: hardif_neigh of this neighbor 614 - * @refcount: number of contexts the object is used 615 - * @rcu: struct used for freeing in an RCU-safe manner 616 466 */ 617 467 struct batadv_neigh_node { 468 + /** @list: list node for &batadv_orig_node.neigh_list */ 618 469 struct hlist_node list; 470 + 471 + /** @orig_node: pointer to corresponding orig_node */ 619 472 struct batadv_orig_node *orig_node; 473 + 474 + /** @addr: the MAC address of the neighboring interface */ 620 475 u8 addr[ETH_ALEN]; 476 + 477 + /** @ifinfo_list: list for routing metrics per outgoing interface */ 621 478 struct hlist_head ifinfo_list; 622 - spinlock_t ifinfo_lock; /* protects ifinfo_list and its members */ 479 + 480 + /** @ifinfo_lock: lock protecting ifinfo_list and its members */ 481 + spinlock_t ifinfo_lock; 482 + 483 + /** @if_incoming: pointer to incoming hard-interface */ 623 484 struct batadv_hard_iface *if_incoming; 485 + 486 + /** @last_seen: when last packet via this neighbor was received */ 624 487 unsigned long last_seen; 488 + 489 + /** @hardif_neigh: hardif_neigh of this neighbor */ 625 490 struct batadv_hardif_neigh_node *hardif_neigh; 491 + 492 + /** @refcount: number of contexts the object is used */ 626 493 struct kref refcount; 494 + 495 + /** @rcu: struct used for freeing in an RCU-safe manner */ 627 496 struct rcu_head rcu; 628 497 }; 629 498 630 499 /** 631 500 * struct batadv_neigh_ifinfo_bat_iv - neighbor information per outgoing 632 501 * interface for B.A.T.M.A.N. IV 633 - * @tq_recv: ring buffer of received TQ values from this neigh node 634 - * @tq_index: ring buffer index 635 - * @tq_avg: averaged tq of all tq values in the ring buffer (tq_recv) 636 - * @real_bits: bitfield containing the number of OGMs received from this neigh 637 - * node (relative to orig_node->last_real_seqno) 638 - * @real_packet_count: counted result of real_bits 639 502 */ 640 503 struct batadv_neigh_ifinfo_bat_iv { 504 + /** @tq_recv: ring buffer of received TQ values from this neigh node */ 641 505 u8 tq_recv[BATADV_TQ_GLOBAL_WINDOW_SIZE]; 506 + 507 + /** @tq_index: ring buffer index */ 642 508 u8 tq_index; 509 + 510 + /** 511 + * @tq_avg: averaged tq of all tq values in the ring buffer (tq_recv) 512 + */ 643 513 u8 tq_avg; 514 + 515 + /** 516 + * @real_bits: bitfield containing the number of OGMs received from this 517 + * neigh node (relative to orig_node->last_real_seqno) 518 + */ 644 519 DECLARE_BITMAP(real_bits, BATADV_TQ_LOCAL_WINDOW_SIZE); 520 + 521 + /** @real_packet_count: counted result of real_bits */ 645 522 u8 real_packet_count; 646 523 }; 647 524 648 525 /** 649 526 * struct batadv_neigh_ifinfo_bat_v - neighbor information per outgoing 650 527 * interface for B.A.T.M.A.N. V 651 - * @throughput: last throughput metric received from originator via this neigh 652 - * @last_seqno: last sequence number known for this neighbor 653 528 */ 654 529 struct batadv_neigh_ifinfo_bat_v { 530 + /** 531 + * @throughput: last throughput metric received from originator via this 532 + * neigh 533 + */ 655 534 u32 throughput; 535 + 536 + /** @last_seqno: last sequence number known for this neighbor */ 656 537 u32 last_seqno; 657 538 }; 658 539 659 540 /** 660 541 * struct batadv_neigh_ifinfo - neighbor information per outgoing interface 661 - * @list: list node for batadv_neigh_node::ifinfo_list 662 - * @if_outgoing: pointer to outgoing hard-interface 663 - * @bat_iv: B.A.T.M.A.N. IV private structure 664 - * @bat_v: B.A.T.M.A.N. V private data 665 - * @last_ttl: last received ttl from this neigh node 666 - * @refcount: number of contexts the object is used 667 - * @rcu: struct used for freeing in a RCU-safe manner 668 542 */ 669 543 struct batadv_neigh_ifinfo { 544 + /** @list: list node for &batadv_neigh_node.ifinfo_list */ 670 545 struct hlist_node list; 546 + 547 + /** @if_outgoing: pointer to outgoing hard-interface */ 671 548 struct batadv_hard_iface *if_outgoing; 549 + 550 + /** @bat_iv: B.A.T.M.A.N. IV private structure */ 672 551 struct batadv_neigh_ifinfo_bat_iv bat_iv; 552 + 673 553 #ifdef CONFIG_BATMAN_ADV_BATMAN_V 554 + /** @bat_v: B.A.T.M.A.N. V private data */ 674 555 struct batadv_neigh_ifinfo_bat_v bat_v; 675 556 #endif 557 + 558 + /** @last_ttl: last received ttl from this neigh node */ 676 559 u8 last_ttl; 560 + 561 + /** @refcount: number of contexts the object is used */ 677 562 struct kref refcount; 563 + 564 + /** @rcu: struct used for freeing in a RCU-safe manner */ 678 565 struct rcu_head rcu; 679 566 }; 680 567 ··· 725 526 726 527 /** 727 528 * struct batadv_bcast_duplist_entry - structure for LAN broadcast suppression 728 - * @orig: mac address of orig node orginating the broadcast 729 - * @crc: crc32 checksum of broadcast payload 730 - * @entrytime: time when the broadcast packet was received 731 529 */ 732 530 struct batadv_bcast_duplist_entry { 531 + /** @orig: mac address of orig node orginating the broadcast */ 733 532 u8 orig[ETH_ALEN]; 533 + 534 + /** @crc: crc32 checksum of broadcast payload */ 734 535 __be32 crc; 536 + 537 + /** @entrytime: time when the broadcast packet was received */ 735 538 unsigned long entrytime; 736 539 }; 737 540 #endif 738 541 739 542 /** 740 543 * enum batadv_counters - indices for traffic counters 741 - * @BATADV_CNT_TX: transmitted payload traffic packet counter 742 - * @BATADV_CNT_TX_BYTES: transmitted payload traffic bytes counter 743 - * @BATADV_CNT_TX_DROPPED: dropped transmission payload traffic packet counter 744 - * @BATADV_CNT_RX: received payload traffic packet counter 745 - * @BATADV_CNT_RX_BYTES: received payload traffic bytes counter 746 - * @BATADV_CNT_FORWARD: forwarded payload traffic packet counter 747 - * @BATADV_CNT_FORWARD_BYTES: forwarded payload traffic bytes counter 748 - * @BATADV_CNT_MGMT_TX: transmitted routing protocol traffic packet counter 749 - * @BATADV_CNT_MGMT_TX_BYTES: transmitted routing protocol traffic bytes counter 750 - * @BATADV_CNT_MGMT_RX: received routing protocol traffic packet counter 751 - * @BATADV_CNT_MGMT_RX_BYTES: received routing protocol traffic bytes counter 752 - * @BATADV_CNT_FRAG_TX: transmitted fragment traffic packet counter 753 - * @BATADV_CNT_FRAG_TX_BYTES: transmitted fragment traffic bytes counter 754 - * @BATADV_CNT_FRAG_RX: received fragment traffic packet counter 755 - * @BATADV_CNT_FRAG_RX_BYTES: received fragment traffic bytes counter 756 - * @BATADV_CNT_FRAG_FWD: forwarded fragment traffic packet counter 757 - * @BATADV_CNT_FRAG_FWD_BYTES: forwarded fragment traffic bytes counter 758 - * @BATADV_CNT_TT_REQUEST_TX: transmitted tt req traffic packet counter 759 - * @BATADV_CNT_TT_REQUEST_RX: received tt req traffic packet counter 760 - * @BATADV_CNT_TT_RESPONSE_TX: transmitted tt resp traffic packet counter 761 - * @BATADV_CNT_TT_RESPONSE_RX: received tt resp traffic packet counter 762 - * @BATADV_CNT_TT_ROAM_ADV_TX: transmitted tt roam traffic packet counter 763 - * @BATADV_CNT_TT_ROAM_ADV_RX: received tt roam traffic packet counter 764 - * @BATADV_CNT_DAT_GET_TX: transmitted dht GET traffic packet counter 765 - * @BATADV_CNT_DAT_GET_RX: received dht GET traffic packet counter 766 - * @BATADV_CNT_DAT_PUT_TX: transmitted dht PUT traffic packet counter 767 - * @BATADV_CNT_DAT_PUT_RX: received dht PUT traffic packet counter 768 - * @BATADV_CNT_DAT_CACHED_REPLY_TX: transmitted dat cache reply traffic packet 769 - * counter 770 - * @BATADV_CNT_NC_CODE: transmitted nc-combined traffic packet counter 771 - * @BATADV_CNT_NC_CODE_BYTES: transmitted nc-combined traffic bytes counter 772 - * @BATADV_CNT_NC_RECODE: transmitted nc-recombined traffic packet counter 773 - * @BATADV_CNT_NC_RECODE_BYTES: transmitted nc-recombined traffic bytes counter 774 - * @BATADV_CNT_NC_BUFFER: counter for packets buffered for later nc decoding 775 - * @BATADV_CNT_NC_DECODE: received and nc-decoded traffic packet counter 776 - * @BATADV_CNT_NC_DECODE_BYTES: received and nc-decoded traffic bytes counter 777 - * @BATADV_CNT_NC_DECODE_FAILED: received and decode-failed traffic packet 778 - * counter 779 - * @BATADV_CNT_NC_SNIFFED: counter for nc-decoded packets received in promisc 780 - * mode. 781 - * @BATADV_CNT_NUM: number of traffic counters 782 544 */ 783 545 enum batadv_counters { 546 + /** @BATADV_CNT_TX: transmitted payload traffic packet counter */ 784 547 BATADV_CNT_TX, 548 + 549 + /** @BATADV_CNT_TX_BYTES: transmitted payload traffic bytes counter */ 785 550 BATADV_CNT_TX_BYTES, 551 + 552 + /** 553 + * @BATADV_CNT_TX_DROPPED: dropped transmission payload traffic packet 554 + * counter 555 + */ 786 556 BATADV_CNT_TX_DROPPED, 557 + 558 + /** @BATADV_CNT_RX: received payload traffic packet counter */ 787 559 BATADV_CNT_RX, 560 + 561 + /** @BATADV_CNT_RX_BYTES: received payload traffic bytes counter */ 788 562 BATADV_CNT_RX_BYTES, 563 + 564 + /** @BATADV_CNT_FORWARD: forwarded payload traffic packet counter */ 789 565 BATADV_CNT_FORWARD, 566 + 567 + /** 568 + * @BATADV_CNT_FORWARD_BYTES: forwarded payload traffic bytes counter 569 + */ 790 570 BATADV_CNT_FORWARD_BYTES, 571 + 572 + /** 573 + * @BATADV_CNT_MGMT_TX: transmitted routing protocol traffic packet 574 + * counter 575 + */ 791 576 BATADV_CNT_MGMT_TX, 577 + 578 + /** 579 + * @BATADV_CNT_MGMT_TX_BYTES: transmitted routing protocol traffic bytes 580 + * counter 581 + */ 792 582 BATADV_CNT_MGMT_TX_BYTES, 583 + 584 + /** 585 + * @BATADV_CNT_MGMT_RX: received routing protocol traffic packet counter 586 + */ 793 587 BATADV_CNT_MGMT_RX, 588 + 589 + /** 590 + * @BATADV_CNT_MGMT_RX_BYTES: received routing protocol traffic bytes 591 + * counter 592 + */ 794 593 BATADV_CNT_MGMT_RX_BYTES, 594 + 595 + /** @BATADV_CNT_FRAG_TX: transmitted fragment traffic packet counter */ 795 596 BATADV_CNT_FRAG_TX, 597 + 598 + /** 599 + * @BATADV_CNT_FRAG_TX_BYTES: transmitted fragment traffic bytes counter 600 + */ 796 601 BATADV_CNT_FRAG_TX_BYTES, 602 + 603 + /** @BATADV_CNT_FRAG_RX: received fragment traffic packet counter */ 797 604 BATADV_CNT_FRAG_RX, 605 + 606 + /** 607 + * @BATADV_CNT_FRAG_RX_BYTES: received fragment traffic bytes counter 608 + */ 798 609 BATADV_CNT_FRAG_RX_BYTES, 610 + 611 + /** @BATADV_CNT_FRAG_FWD: forwarded fragment traffic packet counter */ 799 612 BATADV_CNT_FRAG_FWD, 613 + 614 + /** 615 + * @BATADV_CNT_FRAG_FWD_BYTES: forwarded fragment traffic bytes counter 616 + */ 800 617 BATADV_CNT_FRAG_FWD_BYTES, 618 + 619 + /** 620 + * @BATADV_CNT_TT_REQUEST_TX: transmitted tt req traffic packet counter 621 + */ 801 622 BATADV_CNT_TT_REQUEST_TX, 623 + 624 + /** @BATADV_CNT_TT_REQUEST_RX: received tt req traffic packet counter */ 802 625 BATADV_CNT_TT_REQUEST_RX, 626 + 627 + /** 628 + * @BATADV_CNT_TT_RESPONSE_TX: transmitted tt resp traffic packet 629 + * counter 630 + */ 803 631 BATADV_CNT_TT_RESPONSE_TX, 632 + 633 + /** 634 + * @BATADV_CNT_TT_RESPONSE_RX: received tt resp traffic packet counter 635 + */ 804 636 BATADV_CNT_TT_RESPONSE_RX, 637 + 638 + /** 639 + * @BATADV_CNT_TT_ROAM_ADV_TX: transmitted tt roam traffic packet 640 + * counter 641 + */ 805 642 BATADV_CNT_TT_ROAM_ADV_TX, 643 + 644 + /** 645 + * @BATADV_CNT_TT_ROAM_ADV_RX: received tt roam traffic packet counter 646 + */ 806 647 BATADV_CNT_TT_ROAM_ADV_RX, 648 + 807 649 #ifdef CONFIG_BATMAN_ADV_DAT 650 + /** 651 + * @BATADV_CNT_DAT_GET_TX: transmitted dht GET traffic packet counter 652 + */ 808 653 BATADV_CNT_DAT_GET_TX, 654 + 655 + /** @BATADV_CNT_DAT_GET_RX: received dht GET traffic packet counter */ 809 656 BATADV_CNT_DAT_GET_RX, 657 + 658 + /** 659 + * @BATADV_CNT_DAT_PUT_TX: transmitted dht PUT traffic packet counter 660 + */ 810 661 BATADV_CNT_DAT_PUT_TX, 662 + 663 + /** @BATADV_CNT_DAT_PUT_RX: received dht PUT traffic packet counter */ 811 664 BATADV_CNT_DAT_PUT_RX, 665 + 666 + /** 667 + * @BATADV_CNT_DAT_CACHED_REPLY_TX: transmitted dat cache reply traffic 668 + * packet counter 669 + */ 812 670 BATADV_CNT_DAT_CACHED_REPLY_TX, 813 671 #endif 672 + 814 673 #ifdef CONFIG_BATMAN_ADV_NC 674 + /** 675 + * @BATADV_CNT_NC_CODE: transmitted nc-combined traffic packet counter 676 + */ 815 677 BATADV_CNT_NC_CODE, 678 + 679 + /** 680 + * @BATADV_CNT_NC_CODE_BYTES: transmitted nc-combined traffic bytes 681 + * counter 682 + */ 816 683 BATADV_CNT_NC_CODE_BYTES, 684 + 685 + /** 686 + * @BATADV_CNT_NC_RECODE: transmitted nc-recombined traffic packet 687 + * counter 688 + */ 817 689 BATADV_CNT_NC_RECODE, 690 + 691 + /** 692 + * @BATADV_CNT_NC_RECODE_BYTES: transmitted nc-recombined traffic bytes 693 + * counter 694 + */ 818 695 BATADV_CNT_NC_RECODE_BYTES, 696 + 697 + /** 698 + * @BATADV_CNT_NC_BUFFER: counter for packets buffered for later nc 699 + * decoding 700 + */ 819 701 BATADV_CNT_NC_BUFFER, 702 + 703 + /** 704 + * @BATADV_CNT_NC_DECODE: received and nc-decoded traffic packet counter 705 + */ 820 706 BATADV_CNT_NC_DECODE, 707 + 708 + /** 709 + * @BATADV_CNT_NC_DECODE_BYTES: received and nc-decoded traffic bytes 710 + * counter 711 + */ 821 712 BATADV_CNT_NC_DECODE_BYTES, 713 + 714 + /** 715 + * @BATADV_CNT_NC_DECODE_FAILED: received and decode-failed traffic 716 + * packet counter 717 + */ 822 718 BATADV_CNT_NC_DECODE_FAILED, 719 + 720 + /** 721 + * @BATADV_CNT_NC_SNIFFED: counter for nc-decoded packets received in 722 + * promisc mode. 723 + */ 823 724 BATADV_CNT_NC_SNIFFED, 824 725 #endif 726 + 727 + /** @BATADV_CNT_NUM: number of traffic counters */ 825 728 BATADV_CNT_NUM, 826 729 }; 827 730 828 731 /** 829 732 * struct batadv_priv_tt - per mesh interface translation table data 830 - * @vn: translation table version number 831 - * @ogm_append_cnt: counter of number of OGMs containing the local tt diff 832 - * @local_changes: changes registered in an originator interval 833 - * @changes_list: tracks tt local changes within an originator interval 834 - * @local_hash: local translation table hash table 835 - * @global_hash: global translation table hash table 836 - * @req_list: list of pending & unanswered tt_requests 837 - * @roam_list: list of the last roaming events of each client limiting the 838 - * number of roaming events to avoid route flapping 839 - * @changes_list_lock: lock protecting changes_list 840 - * @req_list_lock: lock protecting req_list 841 - * @roam_list_lock: lock protecting roam_list 842 - * @last_changeset: last tt changeset this host has generated 843 - * @last_changeset_len: length of last tt changeset this host has generated 844 - * @last_changeset_lock: lock protecting last_changeset & last_changeset_len 845 - * @commit_lock: prevents from executing a local TT commit while reading the 846 - * local table. The local TT commit is made up by two operations (data 847 - * structure update and metdata -CRC/TTVN- recalculation) and they have to be 848 - * executed atomically in order to avoid another thread to read the 849 - * table/metadata between those. 850 - * @work: work queue callback item for translation table purging 851 733 */ 852 734 struct batadv_priv_tt { 735 + /** @vn: translation table version number */ 853 736 atomic_t vn; 737 + 738 + /** 739 + * @ogm_append_cnt: counter of number of OGMs containing the local tt 740 + * diff 741 + */ 854 742 atomic_t ogm_append_cnt; 743 + 744 + /** @local_changes: changes registered in an originator interval */ 855 745 atomic_t local_changes; 746 + 747 + /** 748 + * @changes_list: tracks tt local changes within an originator interval 749 + */ 856 750 struct list_head changes_list; 751 + 752 + /** @local_hash: local translation table hash table */ 857 753 struct batadv_hashtable *local_hash; 754 + 755 + /** @global_hash: global translation table hash table */ 858 756 struct batadv_hashtable *global_hash; 757 + 758 + /** @req_list: list of pending & unanswered tt_requests */ 859 759 struct hlist_head req_list; 760 + 761 + /** 762 + * @roam_list: list of the last roaming events of each client limiting 763 + * the number of roaming events to avoid route flapping 764 + */ 860 765 struct list_head roam_list; 861 - spinlock_t changes_list_lock; /* protects changes */ 862 - spinlock_t req_list_lock; /* protects req_list */ 863 - spinlock_t roam_list_lock; /* protects roam_list */ 766 + 767 + /** @changes_list_lock: lock protecting changes_list */ 768 + spinlock_t changes_list_lock; 769 + 770 + /** @req_list_lock: lock protecting req_list */ 771 + spinlock_t req_list_lock; 772 + 773 + /** @roam_list_lock: lock protecting roam_list */ 774 + spinlock_t roam_list_lock; 775 + 776 + /** @last_changeset: last tt changeset this host has generated */ 864 777 unsigned char *last_changeset; 778 + 779 + /** 780 + * @last_changeset_len: length of last tt changeset this host has 781 + * generated 782 + */ 865 783 s16 last_changeset_len; 866 - /* protects last_changeset & last_changeset_len */ 784 + 785 + /** 786 + * @last_changeset_lock: lock protecting last_changeset & 787 + * last_changeset_len 788 + */ 867 789 spinlock_t last_changeset_lock; 868 - /* prevents from executing a commit while reading the table */ 790 + 791 + /** 792 + * @commit_lock: prevents from executing a local TT commit while reading 793 + * the local table. The local TT commit is made up by two operations 794 + * (data structure update and metdata -CRC/TTVN- recalculation) and 795 + * they have to be executed atomically in order to avoid another thread 796 + * to read the table/metadata between those. 797 + */ 869 798 spinlock_t commit_lock; 799 + 800 + /** @work: work queue callback item for translation table purging */ 870 801 struct delayed_work work; 871 802 }; 872 803 ··· 1004 675 1005 676 /** 1006 677 * struct batadv_priv_bla - per mesh interface bridge loope avoidance data 1007 - * @num_requests: number of bla requests in flight 1008 - * @claim_hash: hash table containing mesh nodes this host has claimed 1009 - * @backbone_hash: hash table containing all detected backbone gateways 1010 - * @loopdetect_addr: MAC address used for own loopdetection frames 1011 - * @loopdetect_lasttime: time when the loopdetection frames were sent 1012 - * @loopdetect_next: how many periods to wait for the next loopdetect process 1013 - * @bcast_duplist: recently received broadcast packets array (for broadcast 1014 - * duplicate suppression) 1015 - * @bcast_duplist_curr: index of last broadcast packet added to bcast_duplist 1016 - * @bcast_duplist_lock: lock protecting bcast_duplist & bcast_duplist_curr 1017 - * @claim_dest: local claim data (e.g. claim group) 1018 - * @work: work queue callback item for cleanups & bla announcements 1019 678 */ 1020 679 struct batadv_priv_bla { 680 + /** @num_requests: number of bla requests in flight */ 1021 681 atomic_t num_requests; 682 + 683 + /** 684 + * @claim_hash: hash table containing mesh nodes this host has claimed 685 + */ 1022 686 struct batadv_hashtable *claim_hash; 687 + 688 + /** 689 + * @backbone_hash: hash table containing all detected backbone gateways 690 + */ 1023 691 struct batadv_hashtable *backbone_hash; 692 + 693 + /** @loopdetect_addr: MAC address used for own loopdetection frames */ 1024 694 u8 loopdetect_addr[ETH_ALEN]; 695 + 696 + /** 697 + * @loopdetect_lasttime: time when the loopdetection frames were sent 698 + */ 1025 699 unsigned long loopdetect_lasttime; 700 + 701 + /** 702 + * @loopdetect_next: how many periods to wait for the next loopdetect 703 + * process 704 + */ 1026 705 atomic_t loopdetect_next; 706 + 707 + /** 708 + * @bcast_duplist: recently received broadcast packets array (for 709 + * broadcast duplicate suppression) 710 + */ 1027 711 struct batadv_bcast_duplist_entry bcast_duplist[BATADV_DUPLIST_SIZE]; 712 + 713 + /** 714 + * @bcast_duplist_curr: index of last broadcast packet added to 715 + * bcast_duplist 716 + */ 1028 717 int bcast_duplist_curr; 1029 - /* protects bcast_duplist & bcast_duplist_curr */ 718 + 719 + /** 720 + * @bcast_duplist_lock: lock protecting bcast_duplist & 721 + * bcast_duplist_curr 722 + */ 1030 723 spinlock_t bcast_duplist_lock; 724 + 725 + /** @claim_dest: local claim data (e.g. claim group) */ 1031 726 struct batadv_bla_claim_dst claim_dest; 727 + 728 + /** @work: work queue callback item for cleanups & bla announcements */ 1032 729 struct delayed_work work; 1033 730 }; 1034 731 #endif ··· 1063 708 1064 709 /** 1065 710 * struct batadv_priv_debug_log - debug logging data 1066 - * @log_buff: buffer holding the logs (ring bufer) 1067 - * @log_start: index of next character to read 1068 - * @log_end: index of next character to write 1069 - * @lock: lock protecting log_buff, log_start & log_end 1070 - * @queue_wait: log reader's wait queue 1071 711 */ 1072 712 struct batadv_priv_debug_log { 713 + /** @log_buff: buffer holding the logs (ring bufer) */ 1073 714 char log_buff[BATADV_LOG_BUF_LEN]; 715 + 716 + /** @log_start: index of next character to read */ 1074 717 unsigned long log_start; 718 + 719 + /** @log_end: index of next character to write */ 1075 720 unsigned long log_end; 1076 - spinlock_t lock; /* protects log_buff, log_start and log_end */ 721 + 722 + /** @lock: lock protecting log_buff, log_start & log_end */ 723 + spinlock_t lock; 724 + 725 + /** @queue_wait: log reader's wait queue */ 1077 726 wait_queue_head_t queue_wait; 1078 727 }; 1079 728 #endif 1080 729 1081 730 /** 1082 731 * struct batadv_priv_gw - per mesh interface gateway data 1083 - * @gateway_list: list of available gateway nodes 1084 - * @list_lock: lock protecting gateway_list & curr_gw 1085 - * @curr_gw: pointer to currently selected gateway node 1086 - * @mode: gateway operation: off, client or server (see batadv_gw_modes) 1087 - * @sel_class: gateway selection class (applies if gw_mode client) 1088 - * @bandwidth_down: advertised uplink download bandwidth (if gw_mode server) 1089 - * @bandwidth_up: advertised uplink upload bandwidth (if gw_mode server) 1090 - * @reselect: bool indicating a gateway re-selection is in progress 1091 732 */ 1092 733 struct batadv_priv_gw { 734 + /** @gateway_list: list of available gateway nodes */ 1093 735 struct hlist_head gateway_list; 1094 - spinlock_t list_lock; /* protects gateway_list & curr_gw */ 1095 - struct batadv_gw_node __rcu *curr_gw; /* rcu protected pointer */ 736 + 737 + /** @list_lock: lock protecting gateway_list & curr_gw */ 738 + spinlock_t list_lock; 739 + 740 + /** @curr_gw: pointer to currently selected gateway node */ 741 + struct batadv_gw_node __rcu *curr_gw; 742 + 743 + /** 744 + * @mode: gateway operation: off, client or server (see batadv_gw_modes) 745 + */ 1096 746 atomic_t mode; 747 + 748 + /** @sel_class: gateway selection class (applies if gw_mode client) */ 1097 749 atomic_t sel_class; 750 + 751 + /** 752 + * @bandwidth_down: advertised uplink download bandwidth (if gw_mode 753 + * server) 754 + */ 1098 755 atomic_t bandwidth_down; 756 + 757 + /** 758 + * @bandwidth_up: advertised uplink upload bandwidth (if gw_mode server) 759 + */ 1099 760 atomic_t bandwidth_up; 761 + 762 + /** @reselect: bool indicating a gateway re-selection is in progress */ 1100 763 atomic_t reselect; 1101 764 }; 1102 765 1103 766 /** 1104 767 * struct batadv_priv_tvlv - per mesh interface tvlv data 1105 - * @container_list: list of registered tvlv containers to be sent with each OGM 1106 - * @handler_list: list of the various tvlv content handlers 1107 - * @container_list_lock: protects tvlv container list access 1108 - * @handler_list_lock: protects handler list access 1109 768 */ 1110 769 struct batadv_priv_tvlv { 770 + /** 771 + * @container_list: list of registered tvlv containers to be sent with 772 + * each OGM 773 + */ 1111 774 struct hlist_head container_list; 775 + 776 + /** @handler_list: list of the various tvlv content handlers */ 1112 777 struct hlist_head handler_list; 1113 - spinlock_t container_list_lock; /* protects container_list */ 1114 - spinlock_t handler_list_lock; /* protects handler_list */ 778 + 779 + /** @container_list_lock: protects tvlv container list access */ 780 + spinlock_t container_list_lock; 781 + 782 + /** @handler_list_lock: protects handler list access */ 783 + spinlock_t handler_list_lock; 1115 784 }; 1116 785 1117 786 #ifdef CONFIG_BATMAN_ADV_DAT 1118 787 1119 788 /** 1120 789 * struct batadv_priv_dat - per mesh interface DAT private data 1121 - * @addr: node DAT address 1122 - * @hash: hashtable representing the local ARP cache 1123 - * @work: work queue callback item for cache purging 1124 790 */ 1125 791 struct batadv_priv_dat { 792 + /** @addr: node DAT address */ 1126 793 batadv_dat_addr_t addr; 794 + 795 + /** @hash: hashtable representing the local ARP cache */ 1127 796 struct batadv_hashtable *hash; 797 + 798 + /** @work: work queue callback item for cache purging */ 1128 799 struct delayed_work work; 1129 800 }; 1130 801 #endif ··· 1158 777 #ifdef CONFIG_BATMAN_ADV_MCAST 1159 778 /** 1160 779 * struct batadv_mcast_querier_state - IGMP/MLD querier state when bridged 1161 - * @exists: whether a querier exists in the mesh 1162 - * @shadowing: if a querier exists, whether it is potentially shadowing 1163 - * multicast listeners (i.e. querier is behind our own bridge segment) 1164 780 */ 1165 781 struct batadv_mcast_querier_state { 782 + /** @exists: whether a querier exists in the mesh */ 1166 783 bool exists; 784 + 785 + /** 786 + * @shadowing: if a querier exists, whether it is potentially shadowing 787 + * multicast listeners (i.e. querier is behind our own bridge segment) 788 + */ 1167 789 bool shadowing; 1168 790 }; 1169 791 1170 792 /** 1171 793 * struct batadv_priv_mcast - per mesh interface mcast data 1172 - * @mla_list: list of multicast addresses we are currently announcing via TT 1173 - * @want_all_unsnoopables_list: a list of orig_nodes wanting all unsnoopable 1174 - * multicast traffic 1175 - * @want_all_ipv4_list: a list of orig_nodes wanting all IPv4 multicast traffic 1176 - * @want_all_ipv6_list: a list of orig_nodes wanting all IPv6 multicast traffic 1177 - * @querier_ipv4: the current state of an IGMP querier in the mesh 1178 - * @querier_ipv6: the current state of an MLD querier in the mesh 1179 - * @flags: the flags we have last sent in our mcast tvlv 1180 - * @enabled: whether the multicast tvlv is currently enabled 1181 - * @bridged: whether the soft interface has a bridge on top 1182 - * @num_disabled: number of nodes that have no mcast tvlv 1183 - * @num_want_all_unsnoopables: number of nodes wanting unsnoopable IP traffic 1184 - * @num_want_all_ipv4: counter for items in want_all_ipv4_list 1185 - * @num_want_all_ipv6: counter for items in want_all_ipv6_list 1186 - * @want_lists_lock: lock for protecting modifications to mcast want lists 1187 - * (traversals are rcu-locked) 1188 - * @work: work queue callback item for multicast TT and TVLV updates 1189 794 */ 1190 795 struct batadv_priv_mcast { 796 + /** 797 + * @mla_list: list of multicast addresses we are currently announcing 798 + * via TT 799 + */ 1191 800 struct hlist_head mla_list; /* see __batadv_mcast_mla_update() */ 801 + 802 + /** 803 + * @want_all_unsnoopables_list: a list of orig_nodes wanting all 804 + * unsnoopable multicast traffic 805 + */ 1192 806 struct hlist_head want_all_unsnoopables_list; 807 + 808 + /** 809 + * @want_all_ipv4_list: a list of orig_nodes wanting all IPv4 multicast 810 + * traffic 811 + */ 1193 812 struct hlist_head want_all_ipv4_list; 813 + 814 + /** 815 + * @want_all_ipv6_list: a list of orig_nodes wanting all IPv6 multicast 816 + * traffic 817 + */ 1194 818 struct hlist_head want_all_ipv6_list; 819 + 820 + /** @querier_ipv4: the current state of an IGMP querier in the mesh */ 1195 821 struct batadv_mcast_querier_state querier_ipv4; 822 + 823 + /** @querier_ipv6: the current state of an MLD querier in the mesh */ 1196 824 struct batadv_mcast_querier_state querier_ipv6; 825 + 826 + /** @flags: the flags we have last sent in our mcast tvlv */ 1197 827 u8 flags; 828 + 829 + /** @enabled: whether the multicast tvlv is currently enabled */ 1198 830 bool enabled; 831 + 832 + /** @bridged: whether the soft interface has a bridge on top */ 1199 833 bool bridged; 834 + 835 + /** @num_disabled: number of nodes that have no mcast tvlv */ 1200 836 atomic_t num_disabled; 837 + 838 + /** 839 + * @num_want_all_unsnoopables: number of nodes wanting unsnoopable IP 840 + * traffic 841 + */ 1201 842 atomic_t num_want_all_unsnoopables; 843 + 844 + /** @num_want_all_ipv4: counter for items in want_all_ipv4_list */ 1202 845 atomic_t num_want_all_ipv4; 846 + 847 + /** @num_want_all_ipv6: counter for items in want_all_ipv6_list */ 1203 848 atomic_t num_want_all_ipv6; 1204 - /* protects want_all_{unsnoopables,ipv4,ipv6}_list */ 849 + 850 + /** 851 + * @want_lists_lock: lock for protecting modifications to mcasts 852 + * want_all_{unsnoopables,ipv4,ipv6}_list (traversals are rcu-locked) 853 + */ 1205 854 spinlock_t want_lists_lock; 855 + 856 + /** @work: work queue callback item for multicast TT and TVLV updates */ 1206 857 struct delayed_work work; 1207 858 }; 1208 859 #endif 1209 860 1210 861 /** 1211 862 * struct batadv_priv_nc - per mesh interface network coding private data 1212 - * @work: work queue callback item for cleanup 1213 - * @debug_dir: dentry for nc subdir in batman-adv directory in debugfs 1214 - * @min_tq: only consider neighbors for encoding if neigh_tq > min_tq 1215 - * @max_fwd_delay: maximum packet forward delay to allow coding of packets 1216 - * @max_buffer_time: buffer time for sniffed packets used to decoding 1217 - * @timestamp_fwd_flush: timestamp of last forward packet queue flush 1218 - * @timestamp_sniffed_purge: timestamp of last sniffed packet queue purge 1219 - * @coding_hash: Hash table used to buffer skbs while waiting for another 1220 - * incoming skb to code it with. Skbs are added to the buffer just before being 1221 - * forwarded in routing.c 1222 - * @decoding_hash: Hash table used to buffer skbs that might be needed to decode 1223 - * a received coded skb. The buffer is used for 1) skbs arriving on the 1224 - * soft-interface; 2) skbs overheard on the hard-interface; and 3) skbs 1225 - * forwarded by batman-adv. 1226 863 */ 1227 864 struct batadv_priv_nc { 865 + /** @work: work queue callback item for cleanup */ 1228 866 struct delayed_work work; 867 + 868 + /** 869 + * @debug_dir: dentry for nc subdir in batman-adv directory in debugfs 870 + */ 1229 871 struct dentry *debug_dir; 872 + 873 + /** 874 + * @min_tq: only consider neighbors for encoding if neigh_tq > min_tq 875 + */ 1230 876 u8 min_tq; 877 + 878 + /** 879 + * @max_fwd_delay: maximum packet forward delay to allow coding of 880 + * packets 881 + */ 1231 882 u32 max_fwd_delay; 883 + 884 + /** 885 + * @max_buffer_time: buffer time for sniffed packets used to decoding 886 + */ 1232 887 u32 max_buffer_time; 888 + 889 + /** 890 + * @timestamp_fwd_flush: timestamp of last forward packet queue flush 891 + */ 1233 892 unsigned long timestamp_fwd_flush; 893 + 894 + /** 895 + * @timestamp_sniffed_purge: timestamp of last sniffed packet queue 896 + * purge 897 + */ 1234 898 unsigned long timestamp_sniffed_purge; 899 + 900 + /** 901 + * @coding_hash: Hash table used to buffer skbs while waiting for 902 + * another incoming skb to code it with. Skbs are added to the buffer 903 + * just before being forwarded in routing.c 904 + */ 1235 905 struct batadv_hashtable *coding_hash; 906 + 907 + /** 908 + * @decoding_hash: Hash table used to buffer skbs that might be needed 909 + * to decode a received coded skb. The buffer is used for 1) skbs 910 + * arriving on the soft-interface; 2) skbs overheard on the 911 + * hard-interface; and 3) skbs forwarded by batman-adv. 912 + */ 1236 913 struct batadv_hashtable *decoding_hash; 1237 914 }; 1238 915 1239 916 /** 1240 917 * struct batadv_tp_unacked - unacked packet meta-information 1241 - * @seqno: seqno of the unacked packet 1242 - * @len: length of the packet 1243 - * @list: list node for batadv_tp_vars::unacked_list 1244 918 * 1245 919 * This struct is supposed to represent a buffer unacked packet. However, since 1246 920 * the purpose of the TP meter is to count the traffic only, there is no need to 1247 921 * store the entire sk_buff, the starting offset and the length are enough 1248 922 */ 1249 923 struct batadv_tp_unacked { 924 + /** @seqno: seqno of the unacked packet */ 1250 925 u32 seqno; 926 + 927 + /** @len: length of the packet */ 1251 928 u16 len; 929 + 930 + /** @list: list node for &batadv_tp_vars.unacked_list */ 1252 931 struct list_head list; 1253 932 }; 1254 933 1255 934 /** 1256 935 * enum batadv_tp_meter_role - Modus in tp meter session 1257 - * @BATADV_TP_RECEIVER: Initialized as receiver 1258 - * @BATADV_TP_SENDER: Initialized as sender 1259 936 */ 1260 937 enum batadv_tp_meter_role { 938 + /** @BATADV_TP_RECEIVER: Initialized as receiver */ 1261 939 BATADV_TP_RECEIVER, 940 + 941 + /** @BATADV_TP_SENDER: Initialized as sender */ 1262 942 BATADV_TP_SENDER 1263 943 }; 1264 944 1265 945 /** 1266 946 * struct batadv_tp_vars - tp meter private variables per session 1267 - * @list: list node for bat_priv::tp_list 1268 - * @timer: timer for ack (receiver) and retry (sender) 1269 - * @bat_priv: pointer to the mesh object 1270 - * @start_time: start time in jiffies 1271 - * @other_end: mac address of remote 1272 - * @role: receiver/sender modi 1273 - * @sending: sending binary semaphore: 1 if sending, 0 is not 1274 - * @reason: reason for a stopped session 1275 - * @finish_work: work item for the finishing procedure 1276 - * @test_length: test length in milliseconds 1277 - * @session: TP session identifier 1278 - * @icmp_uid: local ICMP "socket" index 1279 - * @dec_cwnd: decimal part of the cwnd used during linear growth 1280 - * @cwnd: current size of the congestion window 1281 - * @cwnd_lock: lock do protect @cwnd & @dec_cwnd 1282 - * @ss_threshold: Slow Start threshold. Once cwnd exceeds this value the 1283 - * connection switches to the Congestion Avoidance state 1284 - * @last_acked: last acked byte 1285 - * @last_sent: last sent byte, not yet acked 1286 - * @tot_sent: amount of data sent/ACKed so far 1287 - * @dup_acks: duplicate ACKs counter 1288 - * @fast_recovery: true if in Fast Recovery mode 1289 - * @recover: last sent seqno when entering Fast Recovery 1290 - * @rto: sender timeout 1291 - * @srtt: smoothed RTT scaled by 2^3 1292 - * @rttvar: RTT variation scaled by 2^2 1293 - * @more_bytes: waiting queue anchor when waiting for more ack/retry timeout 1294 - * @prerandom_offset: offset inside the prerandom buffer 1295 - * @prerandom_lock: spinlock protecting access to prerandom_offset 1296 - * @last_recv: last in-order received packet 1297 - * @unacked_list: list of unacked packets (meta-info only) 1298 - * @unacked_lock: protect unacked_list 1299 - * @last_recv_time: time time (jiffies) a msg was received 1300 - * @refcount: number of context where the object is used 1301 - * @rcu: struct used for freeing in an RCU-safe manner 1302 947 */ 1303 948 struct batadv_tp_vars { 949 + /** @list: list node for &bat_priv.tp_list */ 1304 950 struct hlist_node list; 951 + 952 + /** @timer: timer for ack (receiver) and retry (sender) */ 1305 953 struct timer_list timer; 954 + 955 + /** @bat_priv: pointer to the mesh object */ 1306 956 struct batadv_priv *bat_priv; 957 + 958 + /** @start_time: start time in jiffies */ 1307 959 unsigned long start_time; 960 + 961 + /** @other_end: mac address of remote */ 1308 962 u8 other_end[ETH_ALEN]; 963 + 964 + /** @role: receiver/sender modi */ 1309 965 enum batadv_tp_meter_role role; 966 + 967 + /** @sending: sending binary semaphore: 1 if sending, 0 is not */ 1310 968 atomic_t sending; 969 + 970 + /** @reason: reason for a stopped session */ 1311 971 enum batadv_tp_meter_reason reason; 972 + 973 + /** @finish_work: work item for the finishing procedure */ 1312 974 struct delayed_work finish_work; 975 + 976 + /** @test_length: test length in milliseconds */ 1313 977 u32 test_length; 978 + 979 + /** @session: TP session identifier */ 1314 980 u8 session[2]; 981 + 982 + /** @icmp_uid: local ICMP "socket" index */ 1315 983 u8 icmp_uid; 1316 984 1317 985 /* sender variables */ 986 + 987 + /** @dec_cwnd: decimal part of the cwnd used during linear growth */ 1318 988 u16 dec_cwnd; 989 + 990 + /** @cwnd: current size of the congestion window */ 1319 991 u32 cwnd; 1320 - spinlock_t cwnd_lock; /* Protects cwnd & dec_cwnd */ 992 + 993 + /** @cwnd_lock: lock do protect @cwnd & @dec_cwnd */ 994 + spinlock_t cwnd_lock; 995 + 996 + /** 997 + * @ss_threshold: Slow Start threshold. Once cwnd exceeds this value the 998 + * connection switches to the Congestion Avoidance state 999 + */ 1321 1000 u32 ss_threshold; 1001 + 1002 + /** @last_acked: last acked byte */ 1322 1003 atomic_t last_acked; 1004 + 1005 + /** @last_sent: last sent byte, not yet acked */ 1323 1006 u32 last_sent; 1007 + 1008 + /** @tot_sent: amount of data sent/ACKed so far */ 1324 1009 atomic64_t tot_sent; 1010 + 1011 + /** @dup_acks: duplicate ACKs counter */ 1325 1012 atomic_t dup_acks; 1013 + 1014 + /** @fast_recovery: true if in Fast Recovery mode */ 1326 1015 bool fast_recovery; 1016 + 1017 + /** @recover: last sent seqno when entering Fast Recovery */ 1327 1018 u32 recover; 1019 + 1020 + /** @rto: sender timeout */ 1328 1021 u32 rto; 1022 + 1023 + /** @srtt: smoothed RTT scaled by 2^3 */ 1329 1024 u32 srtt; 1025 + 1026 + /** @rttvar: RTT variation scaled by 2^2 */ 1330 1027 u32 rttvar; 1028 + 1029 + /** 1030 + * @more_bytes: waiting queue anchor when waiting for more ack/retry 1031 + * timeout 1032 + */ 1331 1033 wait_queue_head_t more_bytes; 1034 + 1035 + /** @prerandom_offset: offset inside the prerandom buffer */ 1332 1036 u32 prerandom_offset; 1333 - spinlock_t prerandom_lock; /* Protects prerandom_offset */ 1037 + 1038 + /** @prerandom_lock: spinlock protecting access to prerandom_offset */ 1039 + spinlock_t prerandom_lock; 1334 1040 1335 1041 /* receiver variables */ 1042 + 1043 + /** @last_recv: last in-order received packet */ 1336 1044 u32 last_recv; 1045 + 1046 + /** @unacked_list: list of unacked packets (meta-info only) */ 1337 1047 struct list_head unacked_list; 1338 - spinlock_t unacked_lock; /* Protects unacked_list */ 1048 + 1049 + /** @unacked_lock: protect unacked_list */ 1050 + spinlock_t unacked_lock; 1051 + 1052 + /** @last_recv_time: time time (jiffies) a msg was received */ 1339 1053 unsigned long last_recv_time; 1054 + 1055 + /** @refcount: number of context where the object is used */ 1340 1056 struct kref refcount; 1057 + 1058 + /** @rcu: struct used for freeing in an RCU-safe manner */ 1341 1059 struct rcu_head rcu; 1342 1060 }; 1343 1061 1344 1062 /** 1345 1063 * struct batadv_softif_vlan - per VLAN attributes set 1346 - * @bat_priv: pointer to the mesh object 1347 - * @vid: VLAN identifier 1348 - * @kobj: kobject for sysfs vlan subdirectory 1349 - * @ap_isolation: AP isolation state 1350 - * @tt: TT private attributes (VLAN specific) 1351 - * @list: list node for bat_priv::softif_vlan_list 1352 - * @refcount: number of context where this object is currently in use 1353 - * @rcu: struct used for freeing in a RCU-safe manner 1354 1064 */ 1355 1065 struct batadv_softif_vlan { 1066 + /** @bat_priv: pointer to the mesh object */ 1356 1067 struct batadv_priv *bat_priv; 1068 + 1069 + /** @vid: VLAN identifier */ 1357 1070 unsigned short vid; 1071 + 1072 + /** @kobj: kobject for sysfs vlan subdirectory */ 1358 1073 struct kobject *kobj; 1074 + 1075 + /** @ap_isolation: AP isolation state */ 1359 1076 atomic_t ap_isolation; /* boolean */ 1077 + 1078 + /** @tt: TT private attributes (VLAN specific) */ 1360 1079 struct batadv_vlan_tt tt; 1080 + 1081 + /** @list: list node for &bat_priv.softif_vlan_list */ 1361 1082 struct hlist_node list; 1083 + 1084 + /** 1085 + * @refcount: number of context where this object is currently in use 1086 + */ 1362 1087 struct kref refcount; 1088 + 1089 + /** @rcu: struct used for freeing in a RCU-safe manner */ 1363 1090 struct rcu_head rcu; 1364 1091 }; 1365 1092 1366 1093 /** 1367 1094 * struct batadv_priv_bat_v - B.A.T.M.A.N. V per soft-interface private data 1368 - * @ogm_buff: buffer holding the OGM packet 1369 - * @ogm_buff_len: length of the OGM packet buffer 1370 - * @ogm_seqno: OGM sequence number - used to identify each OGM 1371 - * @ogm_wq: workqueue used to schedule OGM transmissions 1372 1095 */ 1373 1096 struct batadv_priv_bat_v { 1097 + /** @ogm_buff: buffer holding the OGM packet */ 1374 1098 unsigned char *ogm_buff; 1099 + 1100 + /** @ogm_buff_len: length of the OGM packet buffer */ 1375 1101 int ogm_buff_len; 1102 + 1103 + /** @ogm_seqno: OGM sequence number - used to identify each OGM */ 1376 1104 atomic_t ogm_seqno; 1105 + 1106 + /** @ogm_wq: workqueue used to schedule OGM transmissions */ 1377 1107 struct delayed_work ogm_wq; 1378 1108 }; 1379 1109 1380 1110 /** 1381 1111 * struct batadv_priv - per mesh interface data 1382 - * @mesh_state: current status of the mesh (inactive/active/deactivating) 1383 - * @soft_iface: net device which holds this struct as private data 1384 - * @bat_counters: mesh internal traffic statistic counters (see batadv_counters) 1385 - * @aggregated_ogms: bool indicating whether OGM aggregation is enabled 1386 - * @bonding: bool indicating whether traffic bonding is enabled 1387 - * @fragmentation: bool indicating whether traffic fragmentation is enabled 1388 - * @packet_size_max: max packet size that can be transmitted via 1389 - * multiple fragmented skbs or a single frame if fragmentation is disabled 1390 - * @frag_seqno: incremental counter to identify chains of egress fragments 1391 - * @bridge_loop_avoidance: bool indicating whether bridge loop avoidance is 1392 - * enabled 1393 - * @distributed_arp_table: bool indicating whether distributed ARP table is 1394 - * enabled 1395 - * @multicast_mode: Enable or disable multicast optimizations on this node's 1396 - * sender/originating side 1397 - * @orig_interval: OGM broadcast interval in milliseconds 1398 - * @hop_penalty: penalty which will be applied to an OGM's tq-field on every hop 1399 - * @log_level: configured log level (see batadv_dbg_level) 1400 - * @isolation_mark: the skb->mark value used to match packets for AP isolation 1401 - * @isolation_mark_mask: bitmask identifying the bits in skb->mark to be used 1402 - * for the isolation mark 1403 - * @bcast_seqno: last sent broadcast packet sequence number 1404 - * @bcast_queue_left: number of remaining buffered broadcast packet slots 1405 - * @batman_queue_left: number of remaining OGM packet slots 1406 - * @num_ifaces: number of interfaces assigned to this mesh interface 1407 - * @mesh_obj: kobject for sysfs mesh subdirectory 1408 - * @debug_dir: dentry for debugfs batman-adv subdirectory 1409 - * @forw_bat_list: list of aggregated OGMs that will be forwarded 1410 - * @forw_bcast_list: list of broadcast packets that will be rebroadcasted 1411 - * @tp_list: list of tp sessions 1412 - * @tp_num: number of currently active tp sessions 1413 - * @orig_hash: hash table containing mesh participants (orig nodes) 1414 - * @forw_bat_list_lock: lock protecting forw_bat_list 1415 - * @forw_bcast_list_lock: lock protecting forw_bcast_list 1416 - * @tp_list_lock: spinlock protecting @tp_list 1417 - * @orig_work: work queue callback item for orig node purging 1418 - * @primary_if: one of the hard-interfaces assigned to this mesh interface 1419 - * becomes the primary interface 1420 - * @algo_ops: routing algorithm used by this mesh interface 1421 - * @softif_vlan_list: a list of softif_vlan structs, one per VLAN created on top 1422 - * of the mesh interface represented by this object 1423 - * @softif_vlan_list_lock: lock protecting softif_vlan_list 1424 - * @bla: bridge loope avoidance data 1425 - * @debug_log: holding debug logging relevant data 1426 - * @gw: gateway data 1427 - * @tt: translation table data 1428 - * @tvlv: type-version-length-value data 1429 - * @dat: distributed arp table data 1430 - * @mcast: multicast data 1431 - * @network_coding: bool indicating whether network coding is enabled 1432 - * @nc: network coding data 1433 - * @bat_v: B.A.T.M.A.N. V per soft-interface private data 1434 1112 */ 1435 1113 struct batadv_priv { 1114 + /** 1115 + * @mesh_state: current status of the mesh 1116 + * (inactive/active/deactivating) 1117 + */ 1436 1118 atomic_t mesh_state; 1119 + 1120 + /** @soft_iface: net device which holds this struct as private data */ 1437 1121 struct net_device *soft_iface; 1122 + 1123 + /** 1124 + * @bat_counters: mesh internal traffic statistic counters (see 1125 + * batadv_counters) 1126 + */ 1438 1127 u64 __percpu *bat_counters; /* Per cpu counters */ 1128 + 1129 + /** 1130 + * @aggregated_ogms: bool indicating whether OGM aggregation is enabled 1131 + */ 1439 1132 atomic_t aggregated_ogms; 1133 + 1134 + /** @bonding: bool indicating whether traffic bonding is enabled */ 1440 1135 atomic_t bonding; 1136 + 1137 + /** 1138 + * @fragmentation: bool indicating whether traffic fragmentation is 1139 + * enabled 1140 + */ 1441 1141 atomic_t fragmentation; 1142 + 1143 + /** 1144 + * @packet_size_max: max packet size that can be transmitted via 1145 + * multiple fragmented skbs or a single frame if fragmentation is 1146 + * disabled 1147 + */ 1442 1148 atomic_t packet_size_max; 1149 + 1150 + /** 1151 + * @frag_seqno: incremental counter to identify chains of egress 1152 + * fragments 1153 + */ 1443 1154 atomic_t frag_seqno; 1155 + 1444 1156 #ifdef CONFIG_BATMAN_ADV_BLA 1157 + /** 1158 + * @bridge_loop_avoidance: bool indicating whether bridge loop 1159 + * avoidance is enabled 1160 + */ 1445 1161 atomic_t bridge_loop_avoidance; 1446 1162 #endif 1163 + 1447 1164 #ifdef CONFIG_BATMAN_ADV_DAT 1165 + /** 1166 + * @distributed_arp_table: bool indicating whether distributed ARP table 1167 + * is enabled 1168 + */ 1448 1169 atomic_t distributed_arp_table; 1449 1170 #endif 1171 + 1450 1172 #ifdef CONFIG_BATMAN_ADV_MCAST 1173 + /** 1174 + * @multicast_mode: Enable or disable multicast optimizations on this 1175 + * node's sender/originating side 1176 + */ 1451 1177 atomic_t multicast_mode; 1452 1178 #endif 1179 + 1180 + /** @orig_interval: OGM broadcast interval in milliseconds */ 1453 1181 atomic_t orig_interval; 1182 + 1183 + /** 1184 + * @hop_penalty: penalty which will be applied to an OGM's tq-field on 1185 + * every hop 1186 + */ 1454 1187 atomic_t hop_penalty; 1188 + 1455 1189 #ifdef CONFIG_BATMAN_ADV_DEBUG 1190 + /** @log_level: configured log level (see batadv_dbg_level) */ 1456 1191 atomic_t log_level; 1457 1192 #endif 1193 + 1194 + /** 1195 + * @isolation_mark: the skb->mark value used to match packets for AP 1196 + * isolation 1197 + */ 1458 1198 u32 isolation_mark; 1199 + 1200 + /** 1201 + * @isolation_mark_mask: bitmask identifying the bits in skb->mark to be 1202 + * used for the isolation mark 1203 + */ 1459 1204 u32 isolation_mark_mask; 1205 + 1206 + /** @bcast_seqno: last sent broadcast packet sequence number */ 1460 1207 atomic_t bcast_seqno; 1208 + 1209 + /** 1210 + * @bcast_queue_left: number of remaining buffered broadcast packet 1211 + * slots 1212 + */ 1461 1213 atomic_t bcast_queue_left; 1214 + 1215 + /** @batman_queue_left: number of remaining OGM packet slots */ 1462 1216 atomic_t batman_queue_left; 1217 + 1218 + /** @num_ifaces: number of interfaces assigned to this mesh interface */ 1463 1219 char num_ifaces; 1220 + 1221 + /** @mesh_obj: kobject for sysfs mesh subdirectory */ 1464 1222 struct kobject *mesh_obj; 1223 + 1224 + /** @debug_dir: dentry for debugfs batman-adv subdirectory */ 1465 1225 struct dentry *debug_dir; 1226 + 1227 + /** @forw_bat_list: list of aggregated OGMs that will be forwarded */ 1466 1228 struct hlist_head forw_bat_list; 1229 + 1230 + /** 1231 + * @forw_bcast_list: list of broadcast packets that will be 1232 + * rebroadcasted 1233 + */ 1467 1234 struct hlist_head forw_bcast_list; 1235 + 1236 + /** @tp_list: list of tp sessions */ 1468 1237 struct hlist_head tp_list; 1238 + 1239 + /** @tp_num: number of currently active tp sessions */ 1469 1240 struct batadv_hashtable *orig_hash; 1470 - spinlock_t forw_bat_list_lock; /* protects forw_bat_list */ 1471 - spinlock_t forw_bcast_list_lock; /* protects forw_bcast_list */ 1472 - spinlock_t tp_list_lock; /* protects tp_list */ 1241 + 1242 + /** @orig_hash: hash table containing mesh participants (orig nodes) */ 1243 + spinlock_t forw_bat_list_lock; 1244 + 1245 + /** @forw_bat_list_lock: lock protecting forw_bat_list */ 1246 + spinlock_t forw_bcast_list_lock; 1247 + 1248 + /** @forw_bcast_list_lock: lock protecting forw_bcast_list */ 1249 + spinlock_t tp_list_lock; 1250 + 1251 + /** @tp_list_lock: spinlock protecting @tp_list */ 1473 1252 atomic_t tp_num; 1253 + 1254 + /** @orig_work: work queue callback item for orig node purging */ 1474 1255 struct delayed_work orig_work; 1256 + 1257 + /** 1258 + * @primary_if: one of the hard-interfaces assigned to this mesh 1259 + * interface becomes the primary interface 1260 + */ 1475 1261 struct batadv_hard_iface __rcu *primary_if; /* rcu protected pointer */ 1262 + 1263 + /** @algo_ops: routing algorithm used by this mesh interface */ 1476 1264 struct batadv_algo_ops *algo_ops; 1265 + 1266 + /** 1267 + * @softif_vlan_list: a list of softif_vlan structs, one per VLAN 1268 + * created on top of the mesh interface represented by this object 1269 + */ 1477 1270 struct hlist_head softif_vlan_list; 1478 - spinlock_t softif_vlan_list_lock; /* protects softif_vlan_list */ 1271 + 1272 + /** @softif_vlan_list_lock: lock protecting softif_vlan_list */ 1273 + spinlock_t softif_vlan_list_lock; 1274 + 1479 1275 #ifdef CONFIG_BATMAN_ADV_BLA 1276 + /** @bla: bridge loope avoidance data */ 1480 1277 struct batadv_priv_bla bla; 1481 1278 #endif 1279 + 1482 1280 #ifdef CONFIG_BATMAN_ADV_DEBUG 1281 + /** @debug_log: holding debug logging relevant data */ 1483 1282 struct batadv_priv_debug_log *debug_log; 1484 1283 #endif 1284 + 1285 + /** @gw: gateway data */ 1485 1286 struct batadv_priv_gw gw; 1287 + 1288 + /** @tt: translation table data */ 1486 1289 struct batadv_priv_tt tt; 1290 + 1291 + /** @tvlv: type-version-length-value data */ 1487 1292 struct batadv_priv_tvlv tvlv; 1293 + 1488 1294 #ifdef CONFIG_BATMAN_ADV_DAT 1295 + /** @dat: distributed arp table data */ 1489 1296 struct batadv_priv_dat dat; 1490 1297 #endif 1298 + 1491 1299 #ifdef CONFIG_BATMAN_ADV_MCAST 1300 + /** @mcast: multicast data */ 1492 1301 struct batadv_priv_mcast mcast; 1493 1302 #endif 1303 + 1494 1304 #ifdef CONFIG_BATMAN_ADV_NC 1305 + /** 1306 + * @network_coding: bool indicating whether network coding is enabled 1307 + */ 1495 1308 atomic_t network_coding; 1309 + 1310 + /** @nc: network coding data */ 1496 1311 struct batadv_priv_nc nc; 1497 1312 #endif /* CONFIG_BATMAN_ADV_NC */ 1313 + 1498 1314 #ifdef CONFIG_BATMAN_ADV_BATMAN_V 1315 + /** @bat_v: B.A.T.M.A.N. V per soft-interface private data */ 1499 1316 struct batadv_priv_bat_v bat_v; 1500 1317 #endif 1501 1318 }; 1502 1319 1503 1320 /** 1504 1321 * struct batadv_socket_client - layer2 icmp socket client data 1505 - * @queue_list: packet queue for packets destined for this socket client 1506 - * @queue_len: number of packets in the packet queue (queue_list) 1507 - * @index: socket client's index in the batadv_socket_client_hash 1508 - * @lock: lock protecting queue_list, queue_len & index 1509 - * @queue_wait: socket client's wait queue 1510 - * @bat_priv: pointer to soft_iface this client belongs to 1511 1322 */ 1512 1323 struct batadv_socket_client { 1324 + /** 1325 + * @queue_list: packet queue for packets destined for this socket client 1326 + */ 1513 1327 struct list_head queue_list; 1328 + 1329 + /** @queue_len: number of packets in the packet queue (queue_list) */ 1514 1330 unsigned int queue_len; 1331 + 1332 + /** @index: socket client's index in the batadv_socket_client_hash */ 1515 1333 unsigned char index; 1516 - spinlock_t lock; /* protects queue_list, queue_len & index */ 1334 + 1335 + /** @lock: lock protecting queue_list, queue_len & index */ 1336 + spinlock_t lock; 1337 + 1338 + /** @queue_wait: socket client's wait queue */ 1517 1339 wait_queue_head_t queue_wait; 1340 + 1341 + /** @bat_priv: pointer to soft_iface this client belongs to */ 1518 1342 struct batadv_priv *bat_priv; 1519 1343 }; 1520 1344 1521 1345 /** 1522 1346 * struct batadv_socket_packet - layer2 icmp packet for socket client 1523 - * @list: list node for batadv_socket_client::queue_list 1524 - * @icmp_len: size of the layer2 icmp packet 1525 - * @icmp_packet: layer2 icmp packet 1526 1347 */ 1527 1348 struct batadv_socket_packet { 1349 + /** @list: list node for &batadv_socket_client.queue_list */ 1528 1350 struct list_head list; 1351 + 1352 + /** @icmp_len: size of the layer2 icmp packet */ 1529 1353 size_t icmp_len; 1354 + 1355 + /** @icmp_packet: layer2 icmp packet */ 1530 1356 u8 icmp_packet[BATADV_ICMP_MAX_PACKET_SIZE]; 1531 1357 }; 1532 1358 ··· 1741 1153 1742 1154 /** 1743 1155 * struct batadv_bla_backbone_gw - batman-adv gateway bridged into the LAN 1744 - * @orig: originator address of backbone node (mac address of primary iface) 1745 - * @vid: vlan id this gateway was detected on 1746 - * @hash_entry: hlist node for batadv_priv_bla::backbone_hash 1747 - * @bat_priv: pointer to soft_iface this backbone gateway belongs to 1748 - * @lasttime: last time we heard of this backbone gw 1749 - * @wait_periods: grace time for bridge forward delays and bla group forming at 1750 - * bootup phase - no bcast traffic is formwared until it has elapsed 1751 - * @request_sent: if this bool is set to true we are out of sync with this 1752 - * backbone gateway - no bcast traffic is formwared until the situation was 1753 - * resolved 1754 - * @crc: crc16 checksum over all claims 1755 - * @crc_lock: lock protecting crc 1756 - * @report_work: work struct for reporting detected loops 1757 - * @refcount: number of contexts the object is used 1758 - * @rcu: struct used for freeing in an RCU-safe manner 1759 1156 */ 1760 1157 struct batadv_bla_backbone_gw { 1158 + /** 1159 + * @orig: originator address of backbone node (mac address of primary 1160 + * iface) 1161 + */ 1761 1162 u8 orig[ETH_ALEN]; 1163 + 1164 + /** @vid: vlan id this gateway was detected on */ 1762 1165 unsigned short vid; 1166 + 1167 + /** @hash_entry: hlist node for &batadv_priv_bla.backbone_hash */ 1763 1168 struct hlist_node hash_entry; 1169 + 1170 + /** @bat_priv: pointer to soft_iface this backbone gateway belongs to */ 1764 1171 struct batadv_priv *bat_priv; 1172 + 1173 + /** @lasttime: last time we heard of this backbone gw */ 1765 1174 unsigned long lasttime; 1175 + 1176 + /** 1177 + * @wait_periods: grace time for bridge forward delays and bla group 1178 + * forming at bootup phase - no bcast traffic is formwared until it has 1179 + * elapsed 1180 + */ 1766 1181 atomic_t wait_periods; 1182 + 1183 + /** 1184 + * @request_sent: if this bool is set to true we are out of sync with 1185 + * this backbone gateway - no bcast traffic is formwared until the 1186 + * situation was resolved 1187 + */ 1767 1188 atomic_t request_sent; 1189 + 1190 + /** @crc: crc16 checksum over all claims */ 1768 1191 u16 crc; 1769 - spinlock_t crc_lock; /* protects crc */ 1192 + 1193 + /** @crc_lock: lock protecting crc */ 1194 + spinlock_t crc_lock; 1195 + 1196 + /** @report_work: work struct for reporting detected loops */ 1770 1197 struct work_struct report_work; 1198 + 1199 + /** @refcount: number of contexts the object is used */ 1771 1200 struct kref refcount; 1201 + 1202 + /** @rcu: struct used for freeing in an RCU-safe manner */ 1772 1203 struct rcu_head rcu; 1773 1204 }; 1774 1205 1775 1206 /** 1776 1207 * struct batadv_bla_claim - claimed non-mesh client structure 1777 - * @addr: mac address of claimed non-mesh client 1778 - * @vid: vlan id this client was detected on 1779 - * @backbone_gw: pointer to backbone gw claiming this client 1780 - * @backbone_lock: lock protecting backbone_gw pointer 1781 - * @lasttime: last time we heard of claim (locals only) 1782 - * @hash_entry: hlist node for batadv_priv_bla::claim_hash 1783 - * @refcount: number of contexts the object is used 1784 - * @rcu: struct used for freeing in an RCU-safe manner 1785 1208 */ 1786 1209 struct batadv_bla_claim { 1210 + /** @addr: mac address of claimed non-mesh client */ 1787 1211 u8 addr[ETH_ALEN]; 1212 + 1213 + /** @vid: vlan id this client was detected on */ 1788 1214 unsigned short vid; 1215 + 1216 + /** @backbone_gw: pointer to backbone gw claiming this client */ 1789 1217 struct batadv_bla_backbone_gw *backbone_gw; 1790 - spinlock_t backbone_lock; /* protects backbone_gw */ 1218 + 1219 + /** @backbone_lock: lock protecting backbone_gw pointer */ 1220 + spinlock_t backbone_lock; 1221 + 1222 + /** @lasttime: last time we heard of claim (locals only) */ 1791 1223 unsigned long lasttime; 1224 + 1225 + /** @hash_entry: hlist node for &batadv_priv_bla.claim_hash */ 1792 1226 struct hlist_node hash_entry; 1227 + 1228 + /** @refcount: number of contexts the object is used */ 1793 1229 struct rcu_head rcu; 1230 + 1231 + /** @rcu: struct used for freeing in an RCU-safe manner */ 1794 1232 struct kref refcount; 1795 1233 }; 1796 1234 #endif 1797 1235 1798 1236 /** 1799 1237 * struct batadv_tt_common_entry - tt local & tt global common data 1800 - * @addr: mac address of non-mesh client 1801 - * @vid: VLAN identifier 1802 - * @hash_entry: hlist node for batadv_priv_tt::local_hash or for 1803 - * batadv_priv_tt::global_hash 1804 - * @flags: various state handling flags (see batadv_tt_client_flags) 1805 - * @added_at: timestamp used for purging stale tt common entries 1806 - * @refcount: number of contexts the object is used 1807 - * @rcu: struct used for freeing in an RCU-safe manner 1808 1238 */ 1809 1239 struct batadv_tt_common_entry { 1240 + /** @addr: mac address of non-mesh client */ 1810 1241 u8 addr[ETH_ALEN]; 1242 + 1243 + /** @vid: VLAN identifier */ 1811 1244 unsigned short vid; 1245 + 1246 + /** 1247 + * @hash_entry: hlist node for &batadv_priv_tt.local_hash or for 1248 + * &batadv_priv_tt.global_hash 1249 + */ 1812 1250 struct hlist_node hash_entry; 1251 + 1252 + /** @flags: various state handling flags (see batadv_tt_client_flags) */ 1813 1253 u16 flags; 1254 + 1255 + /** @added_at: timestamp used for purging stale tt common entries */ 1814 1256 unsigned long added_at; 1257 + 1258 + /** @refcount: number of contexts the object is used */ 1815 1259 struct kref refcount; 1260 + 1261 + /** @rcu: struct used for freeing in an RCU-safe manner */ 1816 1262 struct rcu_head rcu; 1817 1263 }; 1818 1264 1819 1265 /** 1820 1266 * struct batadv_tt_local_entry - translation table local entry data 1821 - * @common: general translation table data 1822 - * @last_seen: timestamp used for purging stale tt local entries 1823 - * @vlan: soft-interface vlan of the entry 1824 1267 */ 1825 1268 struct batadv_tt_local_entry { 1269 + /** @common: general translation table data */ 1826 1270 struct batadv_tt_common_entry common; 1271 + 1272 + /** @last_seen: timestamp used for purging stale tt local entries */ 1827 1273 unsigned long last_seen; 1274 + 1275 + /** @vlan: soft-interface vlan of the entry */ 1828 1276 struct batadv_softif_vlan *vlan; 1829 1277 }; 1830 1278 1831 1279 /** 1832 1280 * struct batadv_tt_global_entry - translation table global entry data 1833 - * @common: general translation table data 1834 - * @orig_list: list of orig nodes announcing this non-mesh client 1835 - * @orig_list_count: number of items in the orig_list 1836 - * @list_lock: lock protecting orig_list 1837 - * @roam_at: time at which TT_GLOBAL_ROAM was set 1838 1281 */ 1839 1282 struct batadv_tt_global_entry { 1283 + /** @common: general translation table data */ 1840 1284 struct batadv_tt_common_entry common; 1285 + 1286 + /** @orig_list: list of orig nodes announcing this non-mesh client */ 1841 1287 struct hlist_head orig_list; 1288 + 1289 + /** @orig_list_count: number of items in the orig_list */ 1842 1290 atomic_t orig_list_count; 1843 - spinlock_t list_lock; /* protects orig_list */ 1291 + 1292 + /** @list_lock: lock protecting orig_list */ 1293 + spinlock_t list_lock; 1294 + 1295 + /** @roam_at: time at which TT_GLOBAL_ROAM was set */ 1844 1296 unsigned long roam_at; 1845 1297 }; 1846 1298 1847 1299 /** 1848 1300 * struct batadv_tt_orig_list_entry - orig node announcing a non-mesh client 1849 - * @orig_node: pointer to orig node announcing this non-mesh client 1850 - * @ttvn: translation table version number which added the non-mesh client 1851 - * @flags: per orig entry TT sync flags 1852 - * @list: list node for batadv_tt_global_entry::orig_list 1853 - * @refcount: number of contexts the object is used 1854 - * @rcu: struct used for freeing in an RCU-safe manner 1855 1301 */ 1856 1302 struct batadv_tt_orig_list_entry { 1303 + /** @orig_node: pointer to orig node announcing this non-mesh client */ 1857 1304 struct batadv_orig_node *orig_node; 1305 + 1306 + /** 1307 + * @ttvn: translation table version number which added the non-mesh 1308 + * client 1309 + */ 1858 1310 u8 ttvn; 1311 + 1312 + /** @flags: per orig entry TT sync flags */ 1859 1313 u8 flags; 1314 + 1315 + /** @list: list node for &batadv_tt_global_entry.orig_list */ 1860 1316 struct hlist_node list; 1317 + 1318 + /** @refcount: number of contexts the object is used */ 1861 1319 struct kref refcount; 1320 + 1321 + /** @rcu: struct used for freeing in an RCU-safe manner */ 1862 1322 struct rcu_head rcu; 1863 1323 }; 1864 1324 1865 1325 /** 1866 1326 * struct batadv_tt_change_node - structure for tt changes occurred 1867 - * @list: list node for batadv_priv_tt::changes_list 1868 - * @change: holds the actual translation table diff data 1869 1327 */ 1870 1328 struct batadv_tt_change_node { 1329 + /** @list: list node for &batadv_priv_tt.changes_list */ 1871 1330 struct list_head list; 1331 + 1332 + /** @change: holds the actual translation table diff data */ 1872 1333 struct batadv_tvlv_tt_change change; 1873 1334 }; 1874 1335 1875 1336 /** 1876 1337 * struct batadv_tt_req_node - data to keep track of the tt requests in flight 1877 - * @addr: mac address address of the originator this request was sent to 1878 - * @issued_at: timestamp used for purging stale tt requests 1879 - * @refcount: number of contexts the object is used by 1880 - * @list: list node for batadv_priv_tt::req_list 1881 1338 */ 1882 1339 struct batadv_tt_req_node { 1340 + /** 1341 + * @addr: mac address address of the originator this request was sent to 1342 + */ 1883 1343 u8 addr[ETH_ALEN]; 1344 + 1345 + /** @issued_at: timestamp used for purging stale tt requests */ 1884 1346 unsigned long issued_at; 1347 + 1348 + /** @refcount: number of contexts the object is used by */ 1885 1349 struct kref refcount; 1350 + 1351 + /** @list: list node for &batadv_priv_tt.req_list */ 1886 1352 struct hlist_node list; 1887 1353 }; 1888 1354 1889 1355 /** 1890 1356 * struct batadv_tt_roam_node - roaming client data 1891 - * @addr: mac address of the client in the roaming phase 1892 - * @counter: number of allowed roaming events per client within a single 1893 - * OGM interval (changes are committed with each OGM) 1894 - * @first_time: timestamp used for purging stale roaming node entries 1895 - * @list: list node for batadv_priv_tt::roam_list 1896 1357 */ 1897 1358 struct batadv_tt_roam_node { 1359 + /** @addr: mac address of the client in the roaming phase */ 1898 1360 u8 addr[ETH_ALEN]; 1361 + 1362 + /** 1363 + * @counter: number of allowed roaming events per client within a single 1364 + * OGM interval (changes are committed with each OGM) 1365 + */ 1899 1366 atomic_t counter; 1367 + 1368 + /** 1369 + * @first_time: timestamp used for purging stale roaming node entries 1370 + */ 1900 1371 unsigned long first_time; 1372 + 1373 + /** @list: list node for &batadv_priv_tt.roam_list */ 1901 1374 struct list_head list; 1902 1375 }; 1903 1376 1904 1377 /** 1905 1378 * struct batadv_nc_node - network coding node 1906 - * @list: next and prev pointer for the list handling 1907 - * @addr: the node's mac address 1908 - * @refcount: number of contexts the object is used by 1909 - * @rcu: struct used for freeing in an RCU-safe manner 1910 - * @orig_node: pointer to corresponding orig node struct 1911 - * @last_seen: timestamp of last ogm received from this node 1912 1379 */ 1913 1380 struct batadv_nc_node { 1381 + /** @list: next and prev pointer for the list handling */ 1914 1382 struct list_head list; 1383 + 1384 + /** @addr: the node's mac address */ 1915 1385 u8 addr[ETH_ALEN]; 1386 + 1387 + /** @refcount: number of contexts the object is used by */ 1916 1388 struct kref refcount; 1389 + 1390 + /** @rcu: struct used for freeing in an RCU-safe manner */ 1917 1391 struct rcu_head rcu; 1392 + 1393 + /** @orig_node: pointer to corresponding orig node struct */ 1918 1394 struct batadv_orig_node *orig_node; 1395 + 1396 + /** @last_seen: timestamp of last ogm received from this node */ 1919 1397 unsigned long last_seen; 1920 1398 }; 1921 1399 1922 1400 /** 1923 1401 * struct batadv_nc_path - network coding path 1924 - * @hash_entry: next and prev pointer for the list handling 1925 - * @rcu: struct used for freeing in an RCU-safe manner 1926 - * @refcount: number of contexts the object is used by 1927 - * @packet_list: list of buffered packets for this path 1928 - * @packet_list_lock: access lock for packet list 1929 - * @next_hop: next hop (destination) of path 1930 - * @prev_hop: previous hop (source) of path 1931 - * @last_valid: timestamp for last validation of path 1932 1402 */ 1933 1403 struct batadv_nc_path { 1404 + /** @hash_entry: next and prev pointer for the list handling */ 1934 1405 struct hlist_node hash_entry; 1406 + 1407 + /** @rcu: struct used for freeing in an RCU-safe manner */ 1935 1408 struct rcu_head rcu; 1409 + 1410 + /** @refcount: number of contexts the object is used by */ 1936 1411 struct kref refcount; 1412 + 1413 + /** @packet_list: list of buffered packets for this path */ 1937 1414 struct list_head packet_list; 1938 - spinlock_t packet_list_lock; /* Protects packet_list */ 1415 + 1416 + /** @packet_list_lock: access lock for packet list */ 1417 + spinlock_t packet_list_lock; 1418 + 1419 + /** @next_hop: next hop (destination) of path */ 1939 1420 u8 next_hop[ETH_ALEN]; 1421 + 1422 + /** @prev_hop: previous hop (source) of path */ 1940 1423 u8 prev_hop[ETH_ALEN]; 1424 + 1425 + /** @last_valid: timestamp for last validation of path */ 1941 1426 unsigned long last_valid; 1942 1427 }; 1943 1428 1944 1429 /** 1945 1430 * struct batadv_nc_packet - network coding packet used when coding and 1946 1431 * decoding packets 1947 - * @list: next and prev pointer for the list handling 1948 - * @packet_id: crc32 checksum of skb data 1949 - * @timestamp: field containing the info when the packet was added to path 1950 - * @neigh_node: pointer to original next hop neighbor of skb 1951 - * @skb: skb which can be encoded or used for decoding 1952 - * @nc_path: pointer to path this nc packet is attached to 1953 1432 */ 1954 1433 struct batadv_nc_packet { 1434 + /** @list: next and prev pointer for the list handling */ 1955 1435 struct list_head list; 1436 + 1437 + /** @packet_id: crc32 checksum of skb data */ 1956 1438 __be32 packet_id; 1439 + 1440 + /** 1441 + * @timestamp: field containing the info when the packet was added to 1442 + * path 1443 + */ 1957 1444 unsigned long timestamp; 1445 + 1446 + /** @neigh_node: pointer to original next hop neighbor of skb */ 1958 1447 struct batadv_neigh_node *neigh_node; 1448 + 1449 + /** @skb: skb which can be encoded or used for decoding */ 1959 1450 struct sk_buff *skb; 1451 + 1452 + /** @nc_path: pointer to path this nc packet is attached to */ 1960 1453 struct batadv_nc_path *nc_path; 1961 1454 }; 1962 1455 1963 1456 /** 1964 1457 * struct batadv_skb_cb - control buffer structure used to store private data 1965 1458 * relevant to batman-adv in the skb->cb buffer in skbs. 1966 - * @decoded: Marks a skb as decoded, which is checked when searching for coding 1967 - * opportunities in network-coding.c 1968 - * @num_bcasts: Counter for broadcast packet retransmissions 1969 1459 */ 1970 1460 struct batadv_skb_cb { 1461 + /** 1462 + * @decoded: Marks a skb as decoded, which is checked when searching for 1463 + * coding opportunities in network-coding.c 1464 + */ 1971 1465 bool decoded; 1466 + 1467 + /** @num_bcasts: Counter for broadcast packet retransmissions */ 1972 1468 unsigned int num_bcasts; 1973 1469 }; 1974 1470 1975 1471 /** 1976 1472 * struct batadv_forw_packet - structure for bcast packets to be sent/forwarded 1977 - * @list: list node for batadv_priv::forw_{bat,bcast}_list 1978 - * @cleanup_list: list node for purging functions 1979 - * @send_time: execution time for delayed_work (packet sending) 1980 - * @own: bool for locally generated packets (local OGMs are re-scheduled after 1981 - * sending) 1982 - * @skb: bcast packet's skb buffer 1983 - * @packet_len: size of aggregated OGM packet inside the skb buffer 1984 - * @direct_link_flags: direct link flags for aggregated OGM packets 1985 - * @num_packets: counter for aggregated OGMv1 packets 1986 - * @delayed_work: work queue callback item for packet sending 1987 - * @if_incoming: pointer to incoming hard-iface or primary iface if 1988 - * locally generated packet 1989 - * @if_outgoing: packet where the packet should be sent to, or NULL if 1990 - * unspecified 1991 - * @queue_left: The queue (counter) this packet was applied to 1992 1473 */ 1993 1474 struct batadv_forw_packet { 1475 + /** 1476 + * @list: list node for &batadv_priv.forw.bcast_list and 1477 + * &batadv_priv.forw.bat_list 1478 + */ 1994 1479 struct hlist_node list; 1480 + 1481 + /** @cleanup_list: list node for purging functions */ 1995 1482 struct hlist_node cleanup_list; 1483 + 1484 + /** @send_time: execution time for delayed_work (packet sending) */ 1996 1485 unsigned long send_time; 1486 + 1487 + /** 1488 + * @own: bool for locally generated packets (local OGMs are re-scheduled 1489 + * after sending) 1490 + */ 1997 1491 u8 own; 1492 + 1493 + /** @skb: bcast packet's skb buffer */ 1998 1494 struct sk_buff *skb; 1495 + 1496 + /** @packet_len: size of aggregated OGM packet inside the skb buffer */ 1999 1497 u16 packet_len; 1498 + 1499 + /** @direct_link_flags: direct link flags for aggregated OGM packets */ 2000 1500 u32 direct_link_flags; 1501 + 1502 + /** @num_packets: counter for aggregated OGMv1 packets */ 2001 1503 u8 num_packets; 1504 + 1505 + /** @delayed_work: work queue callback item for packet sending */ 2002 1506 struct delayed_work delayed_work; 1507 + 1508 + /** 1509 + * @if_incoming: pointer to incoming hard-iface or primary iface if 1510 + * locally generated packet 1511 + */ 2003 1512 struct batadv_hard_iface *if_incoming; 1513 + 1514 + /** 1515 + * @if_outgoing: packet where the packet should be sent to, or NULL if 1516 + * unspecified 1517 + */ 2004 1518 struct batadv_hard_iface *if_outgoing; 1519 + 1520 + /** @queue_left: The queue (counter) this packet was applied to */ 2005 1521 atomic_t *queue_left; 2006 1522 }; 2007 1523 2008 1524 /** 2009 1525 * struct batadv_algo_iface_ops - mesh algorithm callbacks (interface specific) 2010 - * @activate: start routing mechanisms when hard-interface is brought up 2011 - * (optional) 2012 - * @enable: init routing info when hard-interface is enabled 2013 - * @disable: de-init routing info when hard-interface is disabled 2014 - * @update_mac: (re-)init mac addresses of the protocol information 2015 - * belonging to this hard-interface 2016 - * @primary_set: called when primary interface is selected / changed 2017 1526 */ 2018 1527 struct batadv_algo_iface_ops { 1528 + /** 1529 + * @activate: start routing mechanisms when hard-interface is brought up 1530 + * (optional) 1531 + */ 2019 1532 void (*activate)(struct batadv_hard_iface *hard_iface); 1533 + 1534 + /** @enable: init routing info when hard-interface is enabled */ 2020 1535 int (*enable)(struct batadv_hard_iface *hard_iface); 1536 + 1537 + /** @disable: de-init routing info when hard-interface is disabled */ 2021 1538 void (*disable)(struct batadv_hard_iface *hard_iface); 1539 + 1540 + /** 1541 + * @update_mac: (re-)init mac addresses of the protocol information 1542 + * belonging to this hard-interface 1543 + */ 2022 1544 void (*update_mac)(struct batadv_hard_iface *hard_iface); 1545 + 1546 + /** @primary_set: called when primary interface is selected / changed */ 2023 1547 void (*primary_set)(struct batadv_hard_iface *hard_iface); 2024 1548 }; 2025 1549 2026 1550 /** 2027 1551 * struct batadv_algo_neigh_ops - mesh algorithm callbacks (neighbour specific) 2028 - * @hardif_init: called on creation of single hop entry 2029 - * (optional) 2030 - * @cmp: compare the metrics of two neighbors for their respective outgoing 2031 - * interfaces 2032 - * @is_similar_or_better: check if neigh1 is equally similar or better than 2033 - * neigh2 for their respective outgoing interface from the metric prospective 2034 - * @print: print the single hop neighbor list (optional) 2035 - * @dump: dump neighbors to a netlink socket (optional) 2036 1552 */ 2037 1553 struct batadv_algo_neigh_ops { 1554 + /** @hardif_init: called on creation of single hop entry (optional) */ 2038 1555 void (*hardif_init)(struct batadv_hardif_neigh_node *neigh); 1556 + 1557 + /** 1558 + * @cmp: compare the metrics of two neighbors for their respective 1559 + * outgoing interfaces 1560 + */ 2039 1561 int (*cmp)(struct batadv_neigh_node *neigh1, 2040 1562 struct batadv_hard_iface *if_outgoing1, 2041 1563 struct batadv_neigh_node *neigh2, 2042 1564 struct batadv_hard_iface *if_outgoing2); 1565 + 1566 + /** 1567 + * @is_similar_or_better: check if neigh1 is equally similar or better 1568 + * than neigh2 for their respective outgoing interface from the metric 1569 + * prospective 1570 + */ 2043 1571 bool (*is_similar_or_better)(struct batadv_neigh_node *neigh1, 2044 1572 struct batadv_hard_iface *if_outgoing1, 2045 1573 struct batadv_neigh_node *neigh2, 2046 1574 struct batadv_hard_iface *if_outgoing2); 1575 + 2047 1576 #ifdef CONFIG_BATMAN_ADV_DEBUGFS 1577 + /** @print: print the single hop neighbor list (optional) */ 2048 1578 void (*print)(struct batadv_priv *priv, struct seq_file *seq); 2049 1579 #endif 1580 + 1581 + /** @dump: dump neighbors to a netlink socket (optional) */ 2050 1582 void (*dump)(struct sk_buff *msg, struct netlink_callback *cb, 2051 1583 struct batadv_priv *priv, 2052 1584 struct batadv_hard_iface *hard_iface); ··· 2174 1466 2175 1467 /** 2176 1468 * struct batadv_algo_orig_ops - mesh algorithm callbacks (originator specific) 2177 - * @free: free the resources allocated by the routing algorithm for an orig_node 2178 - * object (optional) 2179 - * @add_if: ask the routing algorithm to apply the needed changes to the 2180 - * orig_node due to a new hard-interface being added into the mesh (optional) 2181 - * @del_if: ask the routing algorithm to apply the needed changes to the 2182 - * orig_node due to an hard-interface being removed from the mesh (optional) 2183 - * @print: print the originator table (optional) 2184 - * @dump: dump originators to a netlink socket (optional) 2185 1469 */ 2186 1470 struct batadv_algo_orig_ops { 1471 + /** 1472 + * @free: free the resources allocated by the routing algorithm for an 1473 + * orig_node object (optional) 1474 + */ 2187 1475 void (*free)(struct batadv_orig_node *orig_node); 1476 + 1477 + /** 1478 + * @add_if: ask the routing algorithm to apply the needed changes to the 1479 + * orig_node due to a new hard-interface being added into the mesh 1480 + * (optional) 1481 + */ 2188 1482 int (*add_if)(struct batadv_orig_node *orig_node, int max_if_num); 1483 + 1484 + /** 1485 + * @del_if: ask the routing algorithm to apply the needed changes to the 1486 + * orig_node due to an hard-interface being removed from the mesh 1487 + * (optional) 1488 + */ 2189 1489 int (*del_if)(struct batadv_orig_node *orig_node, int max_if_num, 2190 1490 int del_if_num); 1491 + 2191 1492 #ifdef CONFIG_BATMAN_ADV_DEBUGFS 1493 + /** @print: print the originator table (optional) */ 2192 1494 void (*print)(struct batadv_priv *priv, struct seq_file *seq, 2193 1495 struct batadv_hard_iface *hard_iface); 2194 1496 #endif 1497 + 1498 + /** @dump: dump originators to a netlink socket (optional) */ 2195 1499 void (*dump)(struct sk_buff *msg, struct netlink_callback *cb, 2196 1500 struct batadv_priv *priv, 2197 1501 struct batadv_hard_iface *hard_iface); ··· 2211 1491 2212 1492 /** 2213 1493 * struct batadv_algo_gw_ops - mesh algorithm callbacks (GW specific) 2214 - * @init_sel_class: initialize GW selection class (optional) 2215 - * @store_sel_class: parse and stores a new GW selection class (optional) 2216 - * @show_sel_class: prints the current GW selection class (optional) 2217 - * @get_best_gw_node: select the best GW from the list of available nodes 2218 - * (optional) 2219 - * @is_eligible: check if a newly discovered GW is a potential candidate for 2220 - * the election as best GW (optional) 2221 - * @print: print the gateway table (optional) 2222 - * @dump: dump gateways to a netlink socket (optional) 2223 1494 */ 2224 1495 struct batadv_algo_gw_ops { 1496 + /** @init_sel_class: initialize GW selection class (optional) */ 2225 1497 void (*init_sel_class)(struct batadv_priv *bat_priv); 1498 + 1499 + /** 1500 + * @store_sel_class: parse and stores a new GW selection class 1501 + * (optional) 1502 + */ 2226 1503 ssize_t (*store_sel_class)(struct batadv_priv *bat_priv, char *buff, 2227 1504 size_t count); 1505 + 1506 + /** @show_sel_class: prints the current GW selection class (optional) */ 2228 1507 ssize_t (*show_sel_class)(struct batadv_priv *bat_priv, char *buff); 1508 + 1509 + /** 1510 + * @get_best_gw_node: select the best GW from the list of available 1511 + * nodes (optional) 1512 + */ 2229 1513 struct batadv_gw_node *(*get_best_gw_node) 2230 1514 (struct batadv_priv *bat_priv); 1515 + 1516 + /** 1517 + * @is_eligible: check if a newly discovered GW is a potential candidate 1518 + * for the election as best GW (optional) 1519 + */ 2231 1520 bool (*is_eligible)(struct batadv_priv *bat_priv, 2232 1521 struct batadv_orig_node *curr_gw_orig, 2233 1522 struct batadv_orig_node *orig_node); 1523 + 2234 1524 #ifdef CONFIG_BATMAN_ADV_DEBUGFS 1525 + /** @print: print the gateway table (optional) */ 2235 1526 void (*print)(struct batadv_priv *bat_priv, struct seq_file *seq); 2236 1527 #endif 1528 + 1529 + /** @dump: dump gateways to a netlink socket (optional) */ 2237 1530 void (*dump)(struct sk_buff *msg, struct netlink_callback *cb, 2238 1531 struct batadv_priv *priv); 2239 1532 }; 2240 1533 2241 1534 /** 2242 1535 * struct batadv_algo_ops - mesh algorithm callbacks 2243 - * @list: list node for the batadv_algo_list 2244 - * @name: name of the algorithm 2245 - * @iface: callbacks related to interface handling 2246 - * @neigh: callbacks related to neighbors handling 2247 - * @orig: callbacks related to originators handling 2248 - * @gw: callbacks related to GW mode 2249 1536 */ 2250 1537 struct batadv_algo_ops { 1538 + /** @list: list node for the batadv_algo_list */ 2251 1539 struct hlist_node list; 1540 + 1541 + /** @name: name of the algorithm */ 2252 1542 char *name; 1543 + 1544 + /** @iface: callbacks related to interface handling */ 2253 1545 struct batadv_algo_iface_ops iface; 1546 + 1547 + /** @neigh: callbacks related to neighbors handling */ 2254 1548 struct batadv_algo_neigh_ops neigh; 1549 + 1550 + /** @orig: callbacks related to originators handling */ 2255 1551 struct batadv_algo_orig_ops orig; 1552 + 1553 + /** @gw: callbacks related to GW mode */ 2256 1554 struct batadv_algo_gw_ops gw; 2257 1555 }; 2258 1556 2259 1557 /** 2260 1558 * struct batadv_dat_entry - it is a single entry of batman-adv ARP backend. It 2261 1559 * is used to stored ARP entries needed for the global DAT cache 2262 - * @ip: the IPv4 corresponding to this DAT/ARP entry 2263 - * @mac_addr: the MAC address associated to the stored IPv4 2264 - * @vid: the vlan ID associated to this entry 2265 - * @last_update: time in jiffies when this entry was refreshed last time 2266 - * @hash_entry: hlist node for batadv_priv_dat::hash 2267 - * @refcount: number of contexts the object is used 2268 - * @rcu: struct used for freeing in an RCU-safe manner 2269 1560 */ 2270 1561 struct batadv_dat_entry { 1562 + /** @ip: the IPv4 corresponding to this DAT/ARP entry */ 2271 1563 __be32 ip; 1564 + 1565 + /** @mac_addr: the MAC address associated to the stored IPv4 */ 2272 1566 u8 mac_addr[ETH_ALEN]; 1567 + 1568 + /** @vid: the vlan ID associated to this entry */ 2273 1569 unsigned short vid; 1570 + 1571 + /** 1572 + * @last_update: time in jiffies when this entry was refreshed last time 1573 + */ 2274 1574 unsigned long last_update; 1575 + 1576 + /** @hash_entry: hlist node for &batadv_priv_dat.hash */ 2275 1577 struct hlist_node hash_entry; 1578 + 1579 + /** @refcount: number of contexts the object is used */ 2276 1580 struct kref refcount; 1581 + 1582 + /** @rcu: struct used for freeing in an RCU-safe manner */ 2277 1583 struct rcu_head rcu; 2278 1584 }; 2279 1585 2280 1586 /** 2281 1587 * struct batadv_hw_addr - a list entry for a MAC address 2282 - * @list: list node for the linking of entries 2283 - * @addr: the MAC address of this list entry 2284 1588 */ 2285 1589 struct batadv_hw_addr { 1590 + /** @list: list node for the linking of entries */ 2286 1591 struct hlist_node list; 1592 + 1593 + /** @addr: the MAC address of this list entry */ 2287 1594 unsigned char addr[ETH_ALEN]; 2288 1595 }; 2289 1596 2290 1597 /** 2291 1598 * struct batadv_dat_candidate - candidate destination for DAT operations 2292 - * @type: the type of the selected candidate. It can one of the following: 2293 - * - BATADV_DAT_CANDIDATE_NOT_FOUND 2294 - * - BATADV_DAT_CANDIDATE_ORIG 2295 - * @orig_node: if type is BATADV_DAT_CANDIDATE_ORIG this field points to the 2296 - * corresponding originator node structure 2297 1599 */ 2298 1600 struct batadv_dat_candidate { 1601 + /** 1602 + * @type: the type of the selected candidate. It can one of the 1603 + * following: 1604 + * - BATADV_DAT_CANDIDATE_NOT_FOUND 1605 + * - BATADV_DAT_CANDIDATE_ORIG 1606 + */ 2299 1607 int type; 1608 + 1609 + /** 1610 + * @orig_node: if type is BATADV_DAT_CANDIDATE_ORIG this field points to 1611 + * the corresponding originator node structure 1612 + */ 2300 1613 struct batadv_orig_node *orig_node; 2301 1614 }; 2302 1615 2303 1616 /** 2304 1617 * struct batadv_tvlv_container - container for tvlv appended to OGMs 2305 - * @list: hlist node for batadv_priv_tvlv::container_list 2306 - * @tvlv_hdr: tvlv header information needed to construct the tvlv 2307 - * @refcount: number of contexts the object is used 2308 1618 */ 2309 1619 struct batadv_tvlv_container { 1620 + /** @list: hlist node for &batadv_priv_tvlv.container_list */ 2310 1621 struct hlist_node list; 1622 + 1623 + /** @tvlv_hdr: tvlv header information needed to construct the tvlv */ 2311 1624 struct batadv_tvlv_hdr tvlv_hdr; 1625 + 1626 + /** @refcount: number of contexts the object is used */ 2312 1627 struct kref refcount; 2313 1628 }; 2314 1629 2315 1630 /** 2316 1631 * struct batadv_tvlv_handler - handler for specific tvlv type and version 2317 - * @list: hlist node for batadv_priv_tvlv::handler_list 2318 - * @ogm_handler: handler callback which is given the tvlv payload to process on 2319 - * incoming OGM packets 2320 - * @unicast_handler: handler callback which is given the tvlv payload to process 2321 - * on incoming unicast tvlv packets 2322 - * @type: tvlv type this handler feels responsible for 2323 - * @version: tvlv version this handler feels responsible for 2324 - * @flags: tvlv handler flags 2325 - * @refcount: number of contexts the object is used 2326 - * @rcu: struct used for freeing in an RCU-safe manner 2327 1632 */ 2328 1633 struct batadv_tvlv_handler { 1634 + /** @list: hlist node for &batadv_priv_tvlv.handler_list */ 2329 1635 struct hlist_node list; 1636 + 1637 + /** 1638 + * @ogm_handler: handler callback which is given the tvlv payload to 1639 + * process on incoming OGM packets 1640 + */ 2330 1641 void (*ogm_handler)(struct batadv_priv *bat_priv, 2331 1642 struct batadv_orig_node *orig, 2332 1643 u8 flags, void *tvlv_value, u16 tvlv_value_len); 1644 + 1645 + /** 1646 + * @unicast_handler: handler callback which is given the tvlv payload to 1647 + * process on incoming unicast tvlv packets 1648 + */ 2333 1649 int (*unicast_handler)(struct batadv_priv *bat_priv, 2334 1650 u8 *src, u8 *dst, 2335 1651 void *tvlv_value, u16 tvlv_value_len); 1652 + 1653 + /** @type: tvlv type this handler feels responsible for */ 2336 1654 u8 type; 1655 + 1656 + /** @version: tvlv version this handler feels responsible for */ 2337 1657 u8 version; 1658 + 1659 + /** @flags: tvlv handler flags */ 2338 1660 u8 flags; 1661 + 1662 + /** @refcount: number of contexts the object is used */ 2339 1663 struct kref refcount; 1664 + 1665 + /** @rcu: struct used for freeing in an RCU-safe manner */ 2340 1666 struct rcu_head rcu; 2341 1667 }; 2342 1668 2343 1669 /** 2344 1670 * enum batadv_tvlv_handler_flags - tvlv handler flags definitions 2345 - * @BATADV_TVLV_HANDLER_OGM_CIFNOTFND: tvlv ogm processing function will call 2346 - * this handler even if its type was not found (with no data) 2347 - * @BATADV_TVLV_HANDLER_OGM_CALLED: interval tvlv handling flag - the API marks 2348 - * a handler as being called, so it won't be called if the 2349 - * BATADV_TVLV_HANDLER_OGM_CIFNOTFND flag was set 2350 1671 */ 2351 1672 enum batadv_tvlv_handler_flags { 1673 + /** 1674 + * @BATADV_TVLV_HANDLER_OGM_CIFNOTFND: tvlv ogm processing function 1675 + * will call this handler even if its type was not found (with no data) 1676 + */ 2352 1677 BATADV_TVLV_HANDLER_OGM_CIFNOTFND = BIT(1), 1678 + 1679 + /** 1680 + * @BATADV_TVLV_HANDLER_OGM_CALLED: interval tvlv handling flag - the 1681 + * API marks a handler as being called, so it won't be called if the 1682 + * BATADV_TVLV_HANDLER_OGM_CIFNOTFND flag was set 1683 + */ 2353 1684 BATADV_TVLV_HANDLER_OGM_CALLED = BIT(2), 2354 1685 }; 2355 1686 2356 1687 /** 2357 1688 * struct batadv_store_mesh_work - Work queue item to detach add/del interface 2358 1689 * from sysfs locks 2359 - * @net_dev: netdevice to add/remove to/from batman-adv soft-interface 2360 - * @soft_iface_name: name of soft-interface to modify 2361 - * @work: work queue item 2362 1690 */ 2363 1691 struct batadv_store_mesh_work { 1692 + /** 1693 + * @net_dev: netdevice to add/remove to/from batman-adv soft-interface 1694 + */ 2364 1695 struct net_device *net_dev; 1696 + 1697 + /** @soft_iface_name: name of soft-interface to modify */ 2365 1698 char soft_iface_name[IFNAMSIZ]; 1699 + 1700 + /** @work: work queue item */ 2366 1701 struct work_struct work; 2367 1702 }; 2368 1703