Commit a943e8bc authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents b2597f78 ff15c27c
.. SPDX-License-Identifier: GPL-2.0
========== ==========
batman-adv batman-adv
========== ==========
......
/* SPDX-License-Identifier: MIT */
/* Copyright (C) 2016-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2016-2017 B.A.T.M.A.N. contributors:
* *
* Matthias Schiffer * Matthias Schiffer
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission is hereby granted, free of charge, to any person obtaining a
* purpose with or without fee is hereby granted, provided that the above * copy of this software and associated documentation files (the "Software"),
* copyright notice and this permission notice appear in all copies. * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
* *
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * The above copyright notice and this permission notice shall be included in
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * all copies or substantial portions of the Software.
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR *
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _UAPI_LINUX_BATMAN_ADV_H_ #ifndef _UAPI_LINUX_BATMAN_ADV_H_
......
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
#
# Marek Lindner, Simon Wunderlich
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
# #
# B.A.T.M.A.N meshing protocol # B.A.T.M.A.N meshing protocol
# #
......
# # SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: # Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
# #
# Marek Lindner, Simon Wunderlich # Marek Lindner, Simon Wunderlich
......
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
...@@ -37,7 +38,8 @@ char batadv_routing_algo[20] = "BATMAN_IV"; ...@@ -37,7 +38,8 @@ char batadv_routing_algo[20] = "BATMAN_IV";
static struct hlist_head batadv_algo_list; static struct hlist_head batadv_algo_list;
/** /**
* batadv_algo_init - Initialize batman-adv algorithm management data structures * batadv_algo_init() - Initialize batman-adv algorithm management data
* structures
*/ */
void batadv_algo_init(void) void batadv_algo_init(void)
{ {
...@@ -59,6 +61,12 @@ static struct batadv_algo_ops *batadv_algo_get(char *name) ...@@ -59,6 +61,12 @@ static struct batadv_algo_ops *batadv_algo_get(char *name)
return bat_algo_ops; return bat_algo_ops;
} }
/**
* batadv_algo_register() - Register callbacks for a mesh algorithm
* @bat_algo_ops: mesh algorithm callbacks to add
*
* Return: 0 on success or negative error number in case of failure
*/
int batadv_algo_register(struct batadv_algo_ops *bat_algo_ops) int batadv_algo_register(struct batadv_algo_ops *bat_algo_ops)
{ {
struct batadv_algo_ops *bat_algo_ops_tmp; struct batadv_algo_ops *bat_algo_ops_tmp;
...@@ -88,6 +96,19 @@ int batadv_algo_register(struct batadv_algo_ops *bat_algo_ops) ...@@ -88,6 +96,19 @@ int batadv_algo_register(struct batadv_algo_ops *bat_algo_ops)
return 0; return 0;
} }
/**
* batadv_algo_select() - Select algorithm of soft interface
* @bat_priv: the bat priv with all the soft interface information
* @name: name of the algorithm to select
*
* The algorithm callbacks for the soft interface will be set when the algorithm
* with the correct name was found. Any previous selected algorithm will not be
* deinitialized and the new selected algorithm will also not be initialized.
* It is therefore not allowed to call batadv_algo_select outside the creation
* function of the soft interface.
*
* Return: 0 on success or negative error number in case of failure
*/
int batadv_algo_select(struct batadv_priv *bat_priv, char *name) int batadv_algo_select(struct batadv_priv *bat_priv, char *name)
{ {
struct batadv_algo_ops *bat_algo_ops; struct batadv_algo_ops *bat_algo_ops;
...@@ -102,6 +123,14 @@ int batadv_algo_select(struct batadv_priv *bat_priv, char *name) ...@@ -102,6 +123,14 @@ int batadv_algo_select(struct batadv_priv *bat_priv, char *name)
} }
#ifdef CONFIG_BATMAN_ADV_DEBUGFS #ifdef CONFIG_BATMAN_ADV_DEBUGFS
/**
* batadv_algo_seq_print_text() - Print the supported algorithms in a seq file
* @seq: seq file to print on
* @offset: not used
*
* Return: always 0
*/
int batadv_algo_seq_print_text(struct seq_file *seq, void *offset) int batadv_algo_seq_print_text(struct seq_file *seq, void *offset)
{ {
struct batadv_algo_ops *bat_algo_ops; struct batadv_algo_ops *bat_algo_ops;
...@@ -148,7 +177,7 @@ module_param_cb(routing_algo, &batadv_param_ops_ra, &batadv_param_string_ra, ...@@ -148,7 +177,7 @@ module_param_cb(routing_algo, &batadv_param_ops_ra, &batadv_param_string_ra,
0644); 0644);
/** /**
* batadv_algo_dump_entry - fill in information about one supported routing * batadv_algo_dump_entry() - fill in information about one supported routing
* algorithm * algorithm
* @msg: netlink message to be sent back * @msg: netlink message to be sent back
* @portid: Port to reply to * @portid: Port to reply to
...@@ -179,7 +208,7 @@ static int batadv_algo_dump_entry(struct sk_buff *msg, u32 portid, u32 seq, ...@@ -179,7 +208,7 @@ static int batadv_algo_dump_entry(struct sk_buff *msg, u32 portid, u32 seq,
} }
/** /**
* batadv_algo_dump - fill in information about supported routing * batadv_algo_dump() - fill in information about supported routing
* algorithms * algorithms
* @msg: netlink message to be sent back * @msg: netlink message to be sent back
* @cb: Parameters to the netlink request * @cb: Parameters to the netlink request
......
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2011-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2011-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Linus Lüssing * Marek Lindner, Linus Lüssing
......
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
......
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2013-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2013-2017 B.A.T.M.A.N. contributors:
* *
* Linus Lüssing, Marek Lindner * Linus Lüssing, Marek Lindner
...@@ -99,7 +100,7 @@ static void batadv_v_primary_iface_set(struct batadv_hard_iface *hard_iface) ...@@ -99,7 +100,7 @@ static void batadv_v_primary_iface_set(struct batadv_hard_iface *hard_iface)
} }
/** /**
* batadv_v_iface_update_mac - react to hard-interface MAC address change * batadv_v_iface_update_mac() - react to hard-interface MAC address change
* @hard_iface: the modified interface * @hard_iface: the modified interface
* *
* If the modified interface is the primary one, update the originator * If the modified interface is the primary one, update the originator
...@@ -130,7 +131,7 @@ batadv_v_hardif_neigh_init(struct batadv_hardif_neigh_node *hardif_neigh) ...@@ -130,7 +131,7 @@ batadv_v_hardif_neigh_init(struct batadv_hardif_neigh_node *hardif_neigh)
#ifdef CONFIG_BATMAN_ADV_DEBUGFS #ifdef CONFIG_BATMAN_ADV_DEBUGFS
/** /**
* batadv_v_orig_print_neigh - print neighbors for the originator table * batadv_v_orig_print_neigh() - print neighbors for the originator table
* @orig_node: the orig_node for which the neighbors are printed * @orig_node: the orig_node for which the neighbors are printed
* @if_outgoing: outgoing interface for these entries * @if_outgoing: outgoing interface for these entries
* @seq: debugfs table seq_file struct * @seq: debugfs table seq_file struct
...@@ -160,7 +161,7 @@ batadv_v_orig_print_neigh(struct batadv_orig_node *orig_node, ...@@ -160,7 +161,7 @@ batadv_v_orig_print_neigh(struct batadv_orig_node *orig_node,
} }
/** /**
* batadv_v_hardif_neigh_print - print a single ELP neighbour node * batadv_v_hardif_neigh_print() - print a single ELP neighbour node
* @seq: neighbour table seq_file struct * @seq: neighbour table seq_file struct
* @hardif_neigh: hardif neighbour information * @hardif_neigh: hardif neighbour information
*/ */
...@@ -181,7 +182,7 @@ batadv_v_hardif_neigh_print(struct seq_file *seq, ...@@ -181,7 +182,7 @@ batadv_v_hardif_neigh_print(struct seq_file *seq,
} }
/** /**
* batadv_v_neigh_print - print the single hop neighbour list * batadv_v_neigh_print() - print the single hop neighbour list
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @seq: neighbour table seq_file struct * @seq: neighbour table seq_file struct
*/ */
...@@ -215,7 +216,7 @@ static void batadv_v_neigh_print(struct batadv_priv *bat_priv, ...@@ -215,7 +216,7 @@ static void batadv_v_neigh_print(struct batadv_priv *bat_priv,
#endif #endif
/** /**
* batadv_v_neigh_dump_neigh - Dump a neighbour into a message * batadv_v_neigh_dump_neigh() - Dump a neighbour into a message
* @msg: Netlink message to dump into * @msg: Netlink message to dump into
* @portid: Port making netlink request * @portid: Port making netlink request
* @seq: Sequence number of netlink message * @seq: Sequence number of netlink message
...@@ -258,7 +259,7 @@ batadv_v_neigh_dump_neigh(struct sk_buff *msg, u32 portid, u32 seq, ...@@ -258,7 +259,7 @@ batadv_v_neigh_dump_neigh(struct sk_buff *msg, u32 portid, u32 seq,
} }
/** /**
* batadv_v_neigh_dump_hardif - Dump the neighbours of a hard interface into * batadv_v_neigh_dump_hardif() - Dump the neighbours of a hard interface into
* a message * a message
* @msg: Netlink message to dump into * @msg: Netlink message to dump into
* @portid: Port making netlink request * @portid: Port making netlink request
...@@ -296,7 +297,7 @@ batadv_v_neigh_dump_hardif(struct sk_buff *msg, u32 portid, u32 seq, ...@@ -296,7 +297,7 @@ batadv_v_neigh_dump_hardif(struct sk_buff *msg, u32 portid, u32 seq,
} }
/** /**
* batadv_v_neigh_dump - Dump the neighbours of a hard interface into a * batadv_v_neigh_dump() - Dump the neighbours of a hard interface into a
* message * message
* @msg: Netlink message to dump into * @msg: Netlink message to dump into
* @cb: Control block containing additional options * @cb: Control block containing additional options
...@@ -348,7 +349,7 @@ batadv_v_neigh_dump(struct sk_buff *msg, struct netlink_callback *cb, ...@@ -348,7 +349,7 @@ batadv_v_neigh_dump(struct sk_buff *msg, struct netlink_callback *cb,
#ifdef CONFIG_BATMAN_ADV_DEBUGFS #ifdef CONFIG_BATMAN_ADV_DEBUGFS
/** /**
* batadv_v_orig_print - print the originator table * batadv_v_orig_print() - print the originator table
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @seq: debugfs table seq_file struct * @seq: debugfs table seq_file struct
* @if_outgoing: the outgoing interface for which this should be printed * @if_outgoing: the outgoing interface for which this should be printed
...@@ -416,8 +417,7 @@ static void batadv_v_orig_print(struct batadv_priv *bat_priv, ...@@ -416,8 +417,7 @@ static void batadv_v_orig_print(struct batadv_priv *bat_priv,
#endif #endif
/** /**
* batadv_v_orig_dump_subentry - Dump an originator subentry into a * batadv_v_orig_dump_subentry() - Dump an originator subentry into a message
* message
* @msg: Netlink message to dump into * @msg: Netlink message to dump into
* @portid: Port making netlink request * @portid: Port making netlink request
* @seq: Sequence number of netlink message * @seq: Sequence number of netlink message
...@@ -483,7 +483,7 @@ batadv_v_orig_dump_subentry(struct sk_buff *msg, u32 portid, u32 seq, ...@@ -483,7 +483,7 @@ batadv_v_orig_dump_subentry(struct sk_buff *msg, u32 portid, u32 seq,
} }
/** /**
* batadv_v_orig_dump_entry - Dump an originator entry into a message * batadv_v_orig_dump_entry() - Dump an originator entry into a message
* @msg: Netlink message to dump into * @msg: Netlink message to dump into
* @portid: Port making netlink request * @portid: Port making netlink request
* @seq: Sequence number of netlink message * @seq: Sequence number of netlink message
...@@ -536,8 +536,7 @@ batadv_v_orig_dump_entry(struct sk_buff *msg, u32 portid, u32 seq, ...@@ -536,8 +536,7 @@ batadv_v_orig_dump_entry(struct sk_buff *msg, u32 portid, u32 seq,
} }
/** /**
* batadv_v_orig_dump_bucket - Dump an originator bucket into a * batadv_v_orig_dump_bucket() - Dump an originator bucket into a message
* message
* @msg: Netlink message to dump into * @msg: Netlink message to dump into
* @portid: Port making netlink request * @portid: Port making netlink request
* @seq: Sequence number of netlink message * @seq: Sequence number of netlink message
...@@ -578,7 +577,7 @@ batadv_v_orig_dump_bucket(struct sk_buff *msg, u32 portid, u32 seq, ...@@ -578,7 +577,7 @@ batadv_v_orig_dump_bucket(struct sk_buff *msg, u32 portid, u32 seq,
} }
/** /**
* batadv_v_orig_dump - Dump the originators into a message * batadv_v_orig_dump() - Dump the originators into a message
* @msg: Netlink message to dump into * @msg: Netlink message to dump into
* @cb: Control block containing additional options * @cb: Control block containing additional options
* @bat_priv: The bat priv with all the soft interface information * @bat_priv: The bat priv with all the soft interface information
...@@ -668,7 +667,7 @@ static bool batadv_v_neigh_is_sob(struct batadv_neigh_node *neigh1, ...@@ -668,7 +667,7 @@ static bool batadv_v_neigh_is_sob(struct batadv_neigh_node *neigh1,
} }
/** /**
* batadv_v_init_sel_class - initialize GW selection class * batadv_v_init_sel_class() - initialize GW selection class
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
*/ */
static void batadv_v_init_sel_class(struct batadv_priv *bat_priv) static void batadv_v_init_sel_class(struct batadv_priv *bat_priv)
...@@ -704,7 +703,7 @@ static ssize_t batadv_v_show_sel_class(struct batadv_priv *bat_priv, char *buff) ...@@ -704,7 +703,7 @@ static ssize_t batadv_v_show_sel_class(struct batadv_priv *bat_priv, char *buff)
} }
/** /**
* batadv_v_gw_throughput_get - retrieve the GW-bandwidth for a given GW * batadv_v_gw_throughput_get() - retrieve the GW-bandwidth for a given GW
* @gw_node: the GW to retrieve the metric for * @gw_node: the GW to retrieve the metric for
* @bw: the pointer where the metric will be stored. The metric is computed as * @bw: the pointer where the metric will be stored. The metric is computed as
* the minimum between the GW advertised throughput and the path throughput to * the minimum between the GW advertised throughput and the path throughput to
...@@ -747,7 +746,7 @@ static int batadv_v_gw_throughput_get(struct batadv_gw_node *gw_node, u32 *bw) ...@@ -747,7 +746,7 @@ static int batadv_v_gw_throughput_get(struct batadv_gw_node *gw_node, u32 *bw)
} }
/** /**
* batadv_v_gw_get_best_gw_node - retrieve the best GW node * batadv_v_gw_get_best_gw_node() - retrieve the best GW node
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* *
* Return: the GW node having the best GW-metric, NULL if no GW is known * Return: the GW node having the best GW-metric, NULL if no GW is known
...@@ -785,7 +784,7 @@ batadv_v_gw_get_best_gw_node(struct batadv_priv *bat_priv) ...@@ -785,7 +784,7 @@ batadv_v_gw_get_best_gw_node(struct batadv_priv *bat_priv)
} }
/** /**
* batadv_v_gw_is_eligible - check if a originator would be selected as GW * batadv_v_gw_is_eligible() - check if a originator would be selected as GW
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @curr_gw_orig: originator representing the currently selected GW * @curr_gw_orig: originator representing the currently selected GW
* @orig_node: the originator representing the new candidate * @orig_node: the originator representing the new candidate
...@@ -884,7 +883,7 @@ static int batadv_v_gw_write_buffer_text(struct batadv_priv *bat_priv, ...@@ -884,7 +883,7 @@ static int batadv_v_gw_write_buffer_text(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_v_gw_print - print the gateway list * batadv_v_gw_print() - print the gateway list
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @seq: gateway table seq_file struct * @seq: gateway table seq_file struct
*/ */
...@@ -913,7 +912,7 @@ static void batadv_v_gw_print(struct batadv_priv *bat_priv, ...@@ -913,7 +912,7 @@ static void batadv_v_gw_print(struct batadv_priv *bat_priv,
#endif #endif
/** /**
* batadv_v_gw_dump_entry - Dump a gateway into a message * batadv_v_gw_dump_entry() - Dump a gateway into a message
* @msg: Netlink message to dump into * @msg: Netlink message to dump into
* @portid: Port making netlink request * @portid: Port making netlink request
* @seq: Sequence number of netlink message * @seq: Sequence number of netlink message
...@@ -1004,7 +1003,7 @@ static int batadv_v_gw_dump_entry(struct sk_buff *msg, u32 portid, u32 seq, ...@@ -1004,7 +1003,7 @@ static int batadv_v_gw_dump_entry(struct sk_buff *msg, u32 portid, u32 seq,
} }
/** /**
* batadv_v_gw_dump - Dump gateways into a message * batadv_v_gw_dump() - Dump gateways into a message
* @msg: Netlink message to dump into * @msg: Netlink message to dump into
* @cb: Control block containing additional options * @cb: Control block containing additional options
* @bat_priv: The bat priv with all the soft interface information * @bat_priv: The bat priv with all the soft interface information
...@@ -1074,7 +1073,7 @@ static struct batadv_algo_ops batadv_batman_v __read_mostly = { ...@@ -1074,7 +1073,7 @@ static struct batadv_algo_ops batadv_batman_v __read_mostly = {
}; };
/** /**
* batadv_v_hardif_init - initialize the algorithm specific fields in the * batadv_v_hardif_init() - initialize the algorithm specific fields in the
* hard-interface object * hard-interface object
* @hard_iface: the hard-interface to initialize * @hard_iface: the hard-interface to initialize
*/ */
...@@ -1088,7 +1087,7 @@ void batadv_v_hardif_init(struct batadv_hard_iface *hard_iface) ...@@ -1088,7 +1087,7 @@ void batadv_v_hardif_init(struct batadv_hard_iface *hard_iface)
} }
/** /**
* batadv_v_mesh_init - initialize the B.A.T.M.A.N. V private resources for a * batadv_v_mesh_init() - initialize the B.A.T.M.A.N. V private resources for a
* mesh * mesh
* @bat_priv: the object representing the mesh interface to initialise * @bat_priv: the object representing the mesh interface to initialise
* *
...@@ -1106,7 +1105,7 @@ int batadv_v_mesh_init(struct batadv_priv *bat_priv) ...@@ -1106,7 +1105,7 @@ int batadv_v_mesh_init(struct batadv_priv *bat_priv)
} }
/** /**
* batadv_v_mesh_free - free the B.A.T.M.A.N. V private resources for a mesh * batadv_v_mesh_free() - free the B.A.T.M.A.N. V private resources for a mesh
* @bat_priv: the object representing the mesh interface to free * @bat_priv: the object representing the mesh interface to free
*/ */
void batadv_v_mesh_free(struct batadv_priv *bat_priv) void batadv_v_mesh_free(struct batadv_priv *bat_priv)
...@@ -1115,7 +1114,7 @@ void batadv_v_mesh_free(struct batadv_priv *bat_priv) ...@@ -1115,7 +1114,7 @@ void batadv_v_mesh_free(struct batadv_priv *bat_priv)
} }
/** /**
* batadv_v_init - B.A.T.M.A.N. V initialization function * batadv_v_init() - B.A.T.M.A.N. V initialization function
* *
* Description: Takes care of initializing all the subcomponents. * Description: Takes care of initializing all the subcomponents.
* It is invoked upon module load only. * It is invoked upon module load only.
......
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2011-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2011-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Linus Lüssing * Marek Lindner, Linus Lüssing
......
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2011-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2011-2017 B.A.T.M.A.N. contributors:
* *
* Linus Lüssing, Marek Lindner * Linus Lüssing, Marek Lindner
...@@ -24,7 +25,7 @@ ...@@ -24,7 +25,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <linux/fs.h> #include <linux/gfp.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -52,7 +53,7 @@ ...@@ -52,7 +53,7 @@
#include "send.h" #include "send.h"
/** /**
* batadv_v_elp_start_timer - restart timer for ELP periodic work * batadv_v_elp_start_timer() - restart timer for ELP periodic work
* @hard_iface: the interface for which the timer has to be reset * @hard_iface: the interface for which the timer has to be reset
*/ */
static void batadv_v_elp_start_timer(struct batadv_hard_iface *hard_iface) static void batadv_v_elp_start_timer(struct batadv_hard_iface *hard_iface)
...@@ -67,7 +68,7 @@ static void batadv_v_elp_start_timer(struct batadv_hard_iface *hard_iface) ...@@ -67,7 +68,7 @@ static void batadv_v_elp_start_timer(struct batadv_hard_iface *hard_iface)
} }
/** /**
* batadv_v_elp_get_throughput - get the throughput towards a neighbour * batadv_v_elp_get_throughput() - get the throughput towards a neighbour
* @neigh: the neighbour for which the throughput has to be obtained * @neigh: the neighbour for which the throughput has to be obtained
* *
* Return: The throughput towards the given neighbour in multiples of 100kpbs * Return: The throughput towards the given neighbour in multiples of 100kpbs
...@@ -153,8 +154,8 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh) ...@@ -153,8 +154,8 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh)
} }
/** /**
* batadv_v_elp_throughput_metric_update - worker updating the throughput metric * batadv_v_elp_throughput_metric_update() - worker updating the throughput
* of a single hop neighbour * metric of a single hop neighbour
* @work: the work queue item * @work: the work queue item
*/ */
void batadv_v_elp_throughput_metric_update(struct work_struct *work) void batadv_v_elp_throughput_metric_update(struct work_struct *work)
...@@ -177,7 +178,7 @@ void batadv_v_elp_throughput_metric_update(struct work_struct *work) ...@@ -177,7 +178,7 @@ void batadv_v_elp_throughput_metric_update(struct work_struct *work)
} }
/** /**
* batadv_v_elp_wifi_neigh_probe - send link probing packets to a neighbour * batadv_v_elp_wifi_neigh_probe() - send link probing packets to a neighbour
* @neigh: the neighbour to probe * @neigh: the neighbour to probe
* *
* Sends a predefined number of unicast wifi packets to a given neighbour in * Sends a predefined number of unicast wifi packets to a given neighbour in
...@@ -240,7 +241,7 @@ batadv_v_elp_wifi_neigh_probe(struct batadv_hardif_neigh_node *neigh) ...@@ -240,7 +241,7 @@ batadv_v_elp_wifi_neigh_probe(struct batadv_hardif_neigh_node *neigh)
} }
/** /**
* batadv_v_elp_periodic_work - ELP periodic task per interface * batadv_v_elp_periodic_work() - ELP periodic task per interface
* @work: work queue item * @work: work queue item
* *
* Emits broadcast ELP message in regular intervals. * Emits broadcast ELP message in regular intervals.
...@@ -327,7 +328,7 @@ static void batadv_v_elp_periodic_work(struct work_struct *work) ...@@ -327,7 +328,7 @@ static void batadv_v_elp_periodic_work(struct work_struct *work)
} }
/** /**
* batadv_v_elp_iface_enable - setup the ELP interface private resources * batadv_v_elp_iface_enable() - setup the ELP interface private resources
* @hard_iface: interface for which the data has to be prepared * @hard_iface: interface for which the data has to be prepared
* *
* Return: 0 on success or a -ENOMEM in case of failure. * Return: 0 on success or a -ENOMEM in case of failure.
...@@ -375,7 +376,7 @@ int batadv_v_elp_iface_enable(struct batadv_hard_iface *hard_iface) ...@@ -375,7 +376,7 @@ int batadv_v_elp_iface_enable(struct batadv_hard_iface *hard_iface)
} }
/** /**
* batadv_v_elp_iface_disable - release ELP interface private resources * batadv_v_elp_iface_disable() - release ELP interface private resources
* @hard_iface: interface for which the resources have to be released * @hard_iface: interface for which the resources have to be released
*/ */
void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface) void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface)
...@@ -387,7 +388,7 @@ void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface) ...@@ -387,7 +388,7 @@ void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface)
} }
/** /**
* batadv_v_elp_iface_activate - update the ELP buffer belonging to the given * batadv_v_elp_iface_activate() - update the ELP buffer belonging to the given
* hard-interface * hard-interface
* @primary_iface: the new primary interface * @primary_iface: the new primary interface
* @hard_iface: interface holding the to-be-updated buffer * @hard_iface: interface holding the to-be-updated buffer
...@@ -408,7 +409,7 @@ void batadv_v_elp_iface_activate(struct batadv_hard_iface *primary_iface, ...@@ -408,7 +409,7 @@ void batadv_v_elp_iface_activate(struct batadv_hard_iface *primary_iface,
} }
/** /**
* batadv_v_elp_primary_iface_set - change internal data to reflect the new * batadv_v_elp_primary_iface_set() - change internal data to reflect the new
* primary interface * primary interface
* @primary_iface: the new primary interface * @primary_iface: the new primary interface
*/ */
...@@ -428,7 +429,7 @@ void batadv_v_elp_primary_iface_set(struct batadv_hard_iface *primary_iface) ...@@ -428,7 +429,7 @@ void batadv_v_elp_primary_iface_set(struct batadv_hard_iface *primary_iface)
} }
/** /**
* batadv_v_elp_neigh_update - update an ELP neighbour node * batadv_v_elp_neigh_update() - update an ELP neighbour node
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @neigh_addr: the neighbour interface address * @neigh_addr: the neighbour interface address
* @if_incoming: the interface the packet was received through * @if_incoming: the interface the packet was received through
...@@ -488,7 +489,7 @@ static void batadv_v_elp_neigh_update(struct batadv_priv *bat_priv, ...@@ -488,7 +489,7 @@ static void batadv_v_elp_neigh_update(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_v_elp_packet_recv - main ELP packet handler * batadv_v_elp_packet_recv() - main ELP packet handler
* @skb: the received packet * @skb: the received packet
* @if_incoming: the interface this packet was received through * @if_incoming: the interface this packet was received through
* *
......
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2013-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2013-2017 B.A.T.M.A.N. contributors:
* *
* Linus Lüssing, Marek Lindner * Linus Lüssing, Marek Lindner
......
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2013-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2013-2017 B.A.T.M.A.N. contributors:
* *
* Antonio Quartulli * Antonio Quartulli
...@@ -22,7 +23,7 @@ ...@@ -22,7 +23,7 @@
#include <linux/byteorder/generic.h> #include <linux/byteorder/generic.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/fs.h> #include <linux/gfp.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -51,7 +52,7 @@ ...@@ -51,7 +52,7 @@
#include "tvlv.h" #include "tvlv.h"
/** /**
* batadv_v_ogm_orig_get - retrieve and possibly create an originator node * batadv_v_ogm_orig_get() - retrieve and possibly create an originator node
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @addr: the address of the originator * @addr: the address of the originator
* *
...@@ -88,7 +89,7 @@ struct batadv_orig_node *batadv_v_ogm_orig_get(struct batadv_priv *bat_priv, ...@@ -88,7 +89,7 @@ struct batadv_orig_node *batadv_v_ogm_orig_get(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_v_ogm_start_timer - restart the OGM sending timer * batadv_v_ogm_start_timer() - restart the OGM sending timer
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
*/ */
static void batadv_v_ogm_start_timer(struct batadv_priv *bat_priv) static void batadv_v_ogm_start_timer(struct batadv_priv *bat_priv)
...@@ -107,7 +108,7 @@ static void batadv_v_ogm_start_timer(struct batadv_priv *bat_priv) ...@@ -107,7 +108,7 @@ static void batadv_v_ogm_start_timer(struct batadv_priv *bat_priv)
} }
/** /**
* batadv_v_ogm_send_to_if - send a batman ogm using a given interface * batadv_v_ogm_send_to_if() - send a batman ogm using a given interface
* @skb: the OGM to send * @skb: the OGM to send
* @hard_iface: the interface to use to send the OGM * @hard_iface: the interface to use to send the OGM
*/ */
...@@ -127,7 +128,7 @@ static void batadv_v_ogm_send_to_if(struct sk_buff *skb, ...@@ -127,7 +128,7 @@ static void batadv_v_ogm_send_to_if(struct sk_buff *skb,
} }
/** /**
* batadv_v_ogm_send - periodic worker broadcasting the own OGM * batadv_v_ogm_send() - periodic worker broadcasting the own OGM
* @work: work queue item * @work: work queue item
*/ */
static void batadv_v_ogm_send(struct work_struct *work) static void batadv_v_ogm_send(struct work_struct *work)
...@@ -235,7 +236,7 @@ static void batadv_v_ogm_send(struct work_struct *work) ...@@ -235,7 +236,7 @@ static void batadv_v_ogm_send(struct work_struct *work)
} }
/** /**
* batadv_v_ogm_iface_enable - prepare an interface for B.A.T.M.A.N. V * batadv_v_ogm_iface_enable() - prepare an interface for B.A.T.M.A.N. V
* @hard_iface: the interface to prepare * @hard_iface: the interface to prepare
* *
* Takes care of scheduling own OGM sending routine for this interface. * Takes care of scheduling own OGM sending routine for this interface.
...@@ -252,7 +253,7 @@ int batadv_v_ogm_iface_enable(struct batadv_hard_iface *hard_iface) ...@@ -252,7 +253,7 @@ int batadv_v_ogm_iface_enable(struct batadv_hard_iface *hard_iface)
} }
/** /**
* batadv_v_ogm_primary_iface_set - set a new primary interface * batadv_v_ogm_primary_iface_set() - set a new primary interface
* @primary_iface: the new primary interface * @primary_iface: the new primary interface
*/ */
void batadv_v_ogm_primary_iface_set(struct batadv_hard_iface *primary_iface) void batadv_v_ogm_primary_iface_set(struct batadv_hard_iface *primary_iface)
...@@ -268,8 +269,8 @@ void batadv_v_ogm_primary_iface_set(struct batadv_hard_iface *primary_iface) ...@@ -268,8 +269,8 @@ void batadv_v_ogm_primary_iface_set(struct batadv_hard_iface *primary_iface)
} }
/** /**
* batadv_v_forward_penalty - apply a penalty to the throughput metric forwarded * batadv_v_forward_penalty() - apply a penalty to the throughput metric
* with B.A.T.M.A.N. V OGMs * forwarded with B.A.T.M.A.N. V OGMs
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @if_incoming: the interface where the OGM has been received * @if_incoming: the interface where the OGM has been received
* @if_outgoing: the interface where the OGM has to be forwarded to * @if_outgoing: the interface where the OGM has to be forwarded to
...@@ -314,7 +315,7 @@ static u32 batadv_v_forward_penalty(struct batadv_priv *bat_priv, ...@@ -314,7 +315,7 @@ static u32 batadv_v_forward_penalty(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_v_ogm_forward - check conditions and forward an OGM to the given * batadv_v_ogm_forward() - check conditions and forward an OGM to the given
* outgoing interface * outgoing interface
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @ogm_received: previously received OGM to be forwarded * @ogm_received: previously received OGM to be forwarded
...@@ -405,7 +406,7 @@ static void batadv_v_ogm_forward(struct batadv_priv *bat_priv, ...@@ -405,7 +406,7 @@ static void batadv_v_ogm_forward(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_v_ogm_metric_update - update route metric based on OGM * batadv_v_ogm_metric_update() - update route metric based on OGM
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @ogm2: OGM2 structure * @ogm2: OGM2 structure
* @orig_node: Originator structure for which the OGM has been received * @orig_node: Originator structure for which the OGM has been received
...@@ -490,7 +491,7 @@ static int batadv_v_ogm_metric_update(struct batadv_priv *bat_priv, ...@@ -490,7 +491,7 @@ static int batadv_v_ogm_metric_update(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_v_ogm_route_update - update routes based on OGM * batadv_v_ogm_route_update() - update routes based on OGM
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @ethhdr: the Ethernet header of the OGM2 * @ethhdr: the Ethernet header of the OGM2
* @ogm2: OGM2 structure * @ogm2: OGM2 structure
...@@ -590,7 +591,7 @@ static bool batadv_v_ogm_route_update(struct batadv_priv *bat_priv, ...@@ -590,7 +591,7 @@ static bool batadv_v_ogm_route_update(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_v_ogm_process_per_outif - process a batman v OGM for an outgoing if * batadv_v_ogm_process_per_outif() - process a batman v OGM for an outgoing if
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @ethhdr: the Ethernet header of the OGM2 * @ethhdr: the Ethernet header of the OGM2
* @ogm2: OGM2 structure * @ogm2: OGM2 structure
...@@ -639,7 +640,7 @@ batadv_v_ogm_process_per_outif(struct batadv_priv *bat_priv, ...@@ -639,7 +640,7 @@ batadv_v_ogm_process_per_outif(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_v_ogm_aggr_packet - checks if there is another OGM aggregated * batadv_v_ogm_aggr_packet() - checks if there is another OGM aggregated
* @buff_pos: current position in the skb * @buff_pos: current position in the skb
* @packet_len: total length of the skb * @packet_len: total length of the skb
* @tvlv_len: tvlv length of the previously considered OGM * @tvlv_len: tvlv length of the previously considered OGM
...@@ -659,7 +660,7 @@ static bool batadv_v_ogm_aggr_packet(int buff_pos, int packet_len, ...@@ -659,7 +660,7 @@ static bool batadv_v_ogm_aggr_packet(int buff_pos, int packet_len,
} }
/** /**
* batadv_v_ogm_process - process an incoming batman v OGM * batadv_v_ogm_process() - process an incoming batman v OGM
* @skb: the skb containing the OGM * @skb: the skb containing the OGM
* @ogm_offset: offset to the OGM which should be processed (for aggregates) * @ogm_offset: offset to the OGM which should be processed (for aggregates)
* @if_incoming: the interface where this packet was receved * @if_incoming: the interface where this packet was receved
...@@ -787,7 +788,7 @@ static void batadv_v_ogm_process(const struct sk_buff *skb, int ogm_offset, ...@@ -787,7 +788,7 @@ static void batadv_v_ogm_process(const struct sk_buff *skb, int ogm_offset,
} }
/** /**
* batadv_v_ogm_packet_recv - OGM2 receiving handler * batadv_v_ogm_packet_recv() - OGM2 receiving handler
* @skb: the received OGM * @skb: the received OGM
* @if_incoming: the interface where this OGM has been received * @if_incoming: the interface where this OGM has been received
* *
...@@ -851,7 +852,7 @@ int batadv_v_ogm_packet_recv(struct sk_buff *skb, ...@@ -851,7 +852,7 @@ int batadv_v_ogm_packet_recv(struct sk_buff *skb,
} }
/** /**
* batadv_v_ogm_init - initialise the OGM2 engine * batadv_v_ogm_init() - initialise the OGM2 engine
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* *
* Return: 0 on success or a negative error code in case of failure * Return: 0 on success or a negative error code in case of failure
...@@ -884,7 +885,7 @@ int batadv_v_ogm_init(struct batadv_priv *bat_priv) ...@@ -884,7 +885,7 @@ int batadv_v_ogm_init(struct batadv_priv *bat_priv)
} }
/** /**
* batadv_v_ogm_free - free OGM private resources * batadv_v_ogm_free() - free OGM private resources
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
*/ */
void batadv_v_ogm_free(struct batadv_priv *bat_priv) void batadv_v_ogm_free(struct batadv_priv *bat_priv)
......
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2013-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2013-2017 B.A.T.M.A.N. contributors:
* *
* Antonio Quartulli * Antonio Quartulli
......
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2006-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2006-2017 B.A.T.M.A.N. contributors:
* *
* Simon Wunderlich, Marek Lindner * Simon Wunderlich, Marek Lindner
...@@ -32,7 +33,7 @@ static void batadv_bitmap_shift_left(unsigned long *seq_bits, s32 n) ...@@ -32,7 +33,7 @@ static void batadv_bitmap_shift_left(unsigned long *seq_bits, s32 n)
} }
/** /**
* batadv_bit_get_packet - receive and process one packet within the sequence * batadv_bit_get_packet() - receive and process one packet within the sequence
* number window * number window
* @priv: the bat priv with all the soft interface information * @priv: the bat priv with all the soft interface information
* @seq_bits: pointer to the sequence number receive packet * @seq_bits: pointer to the sequence number receive packet
......
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2006-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2006-2017 B.A.T.M.A.N. contributors:
* *
* Simon Wunderlich, Marek Lindner * Simon Wunderlich, Marek Lindner
...@@ -26,7 +27,7 @@ ...@@ -26,7 +27,7 @@
#include <linux/types.h> #include <linux/types.h>
/** /**
* batadv_test_bit - check if bit is set in the current window * batadv_test_bit() - check if bit is set in the current window
* *
* @seq_bits: pointer to the sequence number receive packet * @seq_bits: pointer to the sequence number receive packet
* @last_seqno: latest sequence number in seq_bits * @last_seqno: latest sequence number in seq_bits
...@@ -46,7 +47,12 @@ static inline bool batadv_test_bit(const unsigned long *seq_bits, ...@@ -46,7 +47,12 @@ static inline bool batadv_test_bit(const unsigned long *seq_bits,
return test_bit(diff, seq_bits) != 0; return test_bit(diff, seq_bits) != 0;
} }
/* turn corresponding bit on, so we can remember that we got the packet */ /**
* batadv_set_bit() - Turn corresponding bit on, so we can remember that we got
* the packet
* @seq_bits: bitmap of the packet receive window
* @n: relative sequence number of newly received packet
*/
static inline void batadv_set_bit(unsigned long *seq_bits, s32 n) static inline void batadv_set_bit(unsigned long *seq_bits, s32 n)
{ {
/* if too old, just drop it */ /* if too old, just drop it */
......
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2011-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2011-2017 B.A.T.M.A.N. contributors:
* *
* Simon Wunderlich * Simon Wunderlich
...@@ -30,8 +31,8 @@ struct seq_file; ...@@ -30,8 +31,8 @@ struct seq_file;
struct sk_buff; struct sk_buff;
/** /**
* batadv_bla_is_loopdetect_mac - check if the mac address is from a loop detect * batadv_bla_is_loopdetect_mac() - check if the mac address is from a loop
* frame sent by bridge loop avoidance * detect frame sent by bridge loop avoidance
* @mac: mac address to check * @mac: mac address to check
* *
* Return: true if the it looks like a loop detect frame * Return: true if the it looks like a loop detect frame
......
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2010-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2010-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
...@@ -25,7 +26,6 @@ ...@@ -25,7 +26,6 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/printk.h> #include <linux/printk.h>
#include <linux/sched.h> /* for linux/wait.h */
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/stat.h> #include <linux/stat.h>
#include <linux/stddef.h> #include <linux/stddef.h>
...@@ -66,8 +66,8 @@ static int batadv_originators_open(struct inode *inode, struct file *file) ...@@ -66,8 +66,8 @@ static int batadv_originators_open(struct inode *inode, struct file *file)
} }
/** /**
* batadv_originators_hardif_open - handles debugfs output for the * batadv_originators_hardif_open() - handles debugfs output for the originator
* originator table of an hard interface * table of an hard interface
* @inode: inode pointer to debugfs file * @inode: inode pointer to debugfs file
* @file: pointer to the seq_file * @file: pointer to the seq_file
* *
...@@ -117,7 +117,7 @@ static int batadv_bla_backbone_table_open(struct inode *inode, ...@@ -117,7 +117,7 @@ static int batadv_bla_backbone_table_open(struct inode *inode,
#ifdef CONFIG_BATMAN_ADV_DAT #ifdef CONFIG_BATMAN_ADV_DAT
/** /**
* batadv_dat_cache_open - Prepare file handler for reads from dat_chache * batadv_dat_cache_open() - Prepare file handler for reads from dat_chache
* @inode: inode which was opened * @inode: inode which was opened
* @file: file handle to be initialized * @file: file handle to be initialized
* *
...@@ -154,7 +154,7 @@ static int batadv_nc_nodes_open(struct inode *inode, struct file *file) ...@@ -154,7 +154,7 @@ static int batadv_nc_nodes_open(struct inode *inode, struct file *file)
#ifdef CONFIG_BATMAN_ADV_MCAST #ifdef CONFIG_BATMAN_ADV_MCAST
/** /**
* batadv_mcast_flags_open - prepare file handler for reads from mcast_flags * batadv_mcast_flags_open() - prepare file handler for reads from mcast_flags
* @inode: inode which was opened * @inode: inode which was opened
* @file: file handle to be initialized * @file: file handle to be initialized
* *
...@@ -259,6 +259,9 @@ static struct batadv_debuginfo *batadv_hardif_debuginfos[] = { ...@@ -259,6 +259,9 @@ static struct batadv_debuginfo *batadv_hardif_debuginfos[] = {
NULL, NULL,
}; };
/**
* batadv_debugfs_init() - Initialize soft interface independent debugfs entries
*/
void batadv_debugfs_init(void) void batadv_debugfs_init(void)
{ {
struct batadv_debuginfo **bat_debug; struct batadv_debuginfo **bat_debug;
...@@ -289,6 +292,9 @@ void batadv_debugfs_init(void) ...@@ -289,6 +292,9 @@ void batadv_debugfs_init(void)
batadv_debugfs = NULL; batadv_debugfs = NULL;
} }
/**
* batadv_debugfs_destroy() - Remove all debugfs entries
*/
void batadv_debugfs_destroy(void) void batadv_debugfs_destroy(void)
{ {
debugfs_remove_recursive(batadv_debugfs); debugfs_remove_recursive(batadv_debugfs);
...@@ -296,7 +302,7 @@ void batadv_debugfs_destroy(void) ...@@ -296,7 +302,7 @@ void batadv_debugfs_destroy(void)
} }
/** /**
* batadv_debugfs_add_hardif - creates the base directory for a hard interface * batadv_debugfs_add_hardif() - creates the base directory for a hard interface
* in debugfs. * in debugfs.
* @hard_iface: hard interface which should be added. * @hard_iface: hard interface which should be added.
* *
...@@ -338,7 +344,7 @@ int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface) ...@@ -338,7 +344,7 @@ int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface)
} }
/** /**
* batadv_debugfs_del_hardif - delete the base directory for a hard interface * batadv_debugfs_del_hardif() - delete the base directory for a hard interface
* in debugfs. * in debugfs.
* @hard_iface: hard interface which is deleted. * @hard_iface: hard interface which is deleted.
*/ */
...@@ -355,6 +361,12 @@ void batadv_debugfs_del_hardif(struct batadv_hard_iface *hard_iface) ...@@ -355,6 +361,12 @@ void batadv_debugfs_del_hardif(struct batadv_hard_iface *hard_iface)
} }
} }
/**
* batadv_debugfs_add_meshif() - Initialize interface dependent debugfs entries
* @dev: netdev struct of the soft interface
*
* Return: 0 on success or negative error number in case of failure
*/
int batadv_debugfs_add_meshif(struct net_device *dev) int batadv_debugfs_add_meshif(struct net_device *dev)
{ {
struct batadv_priv *bat_priv = netdev_priv(dev); struct batadv_priv *bat_priv = netdev_priv(dev);
...@@ -401,6 +413,10 @@ int batadv_debugfs_add_meshif(struct net_device *dev) ...@@ -401,6 +413,10 @@ int batadv_debugfs_add_meshif(struct net_device *dev)
return -ENOMEM; return -ENOMEM;
} }
/**
* batadv_debugfs_del_meshif() - Remove interface dependent debugfs entries
* @dev: netdev struct of the soft interface
*/
void batadv_debugfs_del_meshif(struct net_device *dev) void batadv_debugfs_del_meshif(struct net_device *dev)
{ {
struct batadv_priv *bat_priv = netdev_priv(dev); struct batadv_priv *bat_priv = netdev_priv(dev);
......
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2010-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2010-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
......
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2011-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2011-2017 B.A.T.M.A.N. contributors:
* *
* Antonio Quartulli * Antonio Quartulli
...@@ -48,7 +49,7 @@ bool batadv_dat_drop_broadcast_packet(struct batadv_priv *bat_priv, ...@@ -48,7 +49,7 @@ bool batadv_dat_drop_broadcast_packet(struct batadv_priv *bat_priv,
struct batadv_forw_packet *forw_packet); struct batadv_forw_packet *forw_packet);
/** /**
* batadv_dat_init_orig_node_addr - assign a DAT address to the orig_node * batadv_dat_init_orig_node_addr() - assign a DAT address to the orig_node
* @orig_node: the node to assign the DAT address to * @orig_node: the node to assign the DAT address to
*/ */
static inline void static inline void
...@@ -61,7 +62,7 @@ batadv_dat_init_orig_node_addr(struct batadv_orig_node *orig_node) ...@@ -61,7 +62,7 @@ batadv_dat_init_orig_node_addr(struct batadv_orig_node *orig_node)
} }
/** /**
* batadv_dat_init_own_addr - assign a DAT address to the node itself * batadv_dat_init_own_addr() - assign a DAT address to the node itself
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @primary_if: a pointer to the primary interface * @primary_if: a pointer to the primary interface
*/ */
...@@ -82,7 +83,7 @@ void batadv_dat_free(struct batadv_priv *bat_priv); ...@@ -82,7 +83,7 @@ void batadv_dat_free(struct batadv_priv *bat_priv);
int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset); int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset);
/** /**
* batadv_dat_inc_counter - increment the correct DAT packet counter * batadv_dat_inc_counter() - increment the correct DAT packet counter
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @subtype: the 4addr subtype of the packet to be counted * @subtype: the 4addr subtype of the packet to be counted
* *
......
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2013-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2013-2017 B.A.T.M.A.N. contributors:
* *
* Martin Hundebøll <martin@hundeboll.net> * Martin Hundebøll <martin@hundeboll.net>
...@@ -22,7 +23,7 @@ ...@@ -22,7 +23,7 @@
#include <linux/byteorder/generic.h> #include <linux/byteorder/generic.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/fs.h> #include <linux/gfp.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -41,7 +42,7 @@ ...@@ -41,7 +42,7 @@
#include "soft-interface.h" #include "soft-interface.h"
/** /**
* batadv_frag_clear_chain - delete entries in the fragment buffer chain * batadv_frag_clear_chain() - delete entries in the fragment buffer chain
* @head: head of chain with entries. * @head: head of chain with entries.
* @dropped: whether the chain is cleared because all fragments are dropped * @dropped: whether the chain is cleared because all fragments are dropped
* *
...@@ -65,7 +66,7 @@ static void batadv_frag_clear_chain(struct hlist_head *head, bool dropped) ...@@ -65,7 +66,7 @@ static void batadv_frag_clear_chain(struct hlist_head *head, bool dropped)
} }
/** /**
* batadv_frag_purge_orig - free fragments associated to an orig * batadv_frag_purge_orig() - free fragments associated to an orig
* @orig_node: originator to free fragments from * @orig_node: originator to free fragments from
* @check_cb: optional function to tell if an entry should be purged * @check_cb: optional function to tell if an entry should be purged
*/ */
...@@ -89,7 +90,7 @@ void batadv_frag_purge_orig(struct batadv_orig_node *orig_node, ...@@ -89,7 +90,7 @@ void batadv_frag_purge_orig(struct batadv_orig_node *orig_node,
} }
/** /**
* batadv_frag_size_limit - maximum possible size of packet to be fragmented * batadv_frag_size_limit() - maximum possible size of packet to be fragmented
* *
* Return: the maximum size of payload that can be fragmented. * Return: the maximum size of payload that can be fragmented.
*/ */
...@@ -104,7 +105,7 @@ static int batadv_frag_size_limit(void) ...@@ -104,7 +105,7 @@ static int batadv_frag_size_limit(void)
} }
/** /**
* batadv_frag_init_chain - check and prepare fragment chain for new fragment * batadv_frag_init_chain() - check and prepare fragment chain for new fragment
* @chain: chain in fragments table to init * @chain: chain in fragments table to init
* @seqno: sequence number of the received fragment * @seqno: sequence number of the received fragment
* *
...@@ -134,7 +135,7 @@ static bool batadv_frag_init_chain(struct batadv_frag_table_entry *chain, ...@@ -134,7 +135,7 @@ static bool batadv_frag_init_chain(struct batadv_frag_table_entry *chain,
} }
/** /**
* batadv_frag_insert_packet - insert a fragment into a fragment chain * batadv_frag_insert_packet() - insert a fragment into a fragment chain
* @orig_node: originator that the fragment was received from * @orig_node: originator that the fragment was received from
* @skb: skb to insert * @skb: skb to insert
* @chain_out: list head to attach complete chains of fragments to * @chain_out: list head to attach complete chains of fragments to
...@@ -248,7 +249,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node, ...@@ -248,7 +249,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
} }
/** /**
* batadv_frag_merge_packets - merge a chain of fragments * batadv_frag_merge_packets() - merge a chain of fragments
* @chain: head of chain with fragments * @chain: head of chain with fragments
* *
* Expand the first skb in the chain and copy the content of the remaining * Expand the first skb in the chain and copy the content of the remaining
...@@ -306,7 +307,7 @@ batadv_frag_merge_packets(struct hlist_head *chain) ...@@ -306,7 +307,7 @@ batadv_frag_merge_packets(struct hlist_head *chain)
} }
/** /**
* batadv_frag_skb_buffer - buffer fragment for later merge * batadv_frag_skb_buffer() - buffer fragment for later merge
* @skb: skb to buffer * @skb: skb to buffer
* @orig_node_src: originator that the skb is received from * @orig_node_src: originator that the skb is received from
* *
...@@ -346,7 +347,7 @@ bool batadv_frag_skb_buffer(struct sk_buff **skb, ...@@ -346,7 +347,7 @@ bool batadv_frag_skb_buffer(struct sk_buff **skb,
} }
/** /**
* batadv_frag_skb_fwd - forward fragments that would exceed MTU when merged * batadv_frag_skb_fwd() - forward fragments that would exceed MTU when merged
* @skb: skb to forward * @skb: skb to forward
* @recv_if: interface that the skb is received on * @recv_if: interface that the skb is received on
* @orig_node_src: originator that the skb is received from * @orig_node_src: originator that the skb is received from
...@@ -400,7 +401,7 @@ bool batadv_frag_skb_fwd(struct sk_buff *skb, ...@@ -400,7 +401,7 @@ bool batadv_frag_skb_fwd(struct sk_buff *skb,
} }
/** /**
* batadv_frag_create - create a fragment from skb * batadv_frag_create() - create a fragment from skb
* @skb: skb to create fragment from * @skb: skb to create fragment from
* @frag_head: header to use in new fragment * @frag_head: header to use in new fragment
* @fragment_size: size of new fragment * @fragment_size: size of new fragment
...@@ -438,7 +439,7 @@ static struct sk_buff *batadv_frag_create(struct sk_buff *skb, ...@@ -438,7 +439,7 @@ static struct sk_buff *batadv_frag_create(struct sk_buff *skb,
} }
/** /**
* batadv_frag_send_packet - create up to 16 fragments from the passed skb * batadv_frag_send_packet() - create up to 16 fragments from the passed skb
* @skb: skb to create fragments from * @skb: skb to create fragments from
* @orig_node: final destination of the created fragments * @orig_node: final destination of the created fragments
* @neigh_node: next-hop of the created fragments * @neigh_node: next-hop of the created fragments
......
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2013-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2013-2017 B.A.T.M.A.N. contributors:
* *
* Martin Hundebøll <martin@hundeboll.net> * Martin Hundebøll <martin@hundeboll.net>
...@@ -39,7 +40,7 @@ int batadv_frag_send_packet(struct sk_buff *skb, ...@@ -39,7 +40,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
struct batadv_neigh_node *neigh_node); struct batadv_neigh_node *neigh_node);
/** /**
* batadv_frag_check_entry - check if a list of fragments has timed out * batadv_frag_check_entry() - check if a list of fragments has timed out
* @frags_entry: table entry to check * @frags_entry: table entry to check
* *
* Return: true if the frags entry has timed out, false otherwise. * Return: true if the frags entry has timed out, false otherwise.
......
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2009-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2009-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
...@@ -22,7 +23,7 @@ ...@@ -22,7 +23,7 @@
#include <linux/byteorder/generic.h> #include <linux/byteorder/generic.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/fs.h> #include <linux/gfp.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/if_vlan.h> #include <linux/if_vlan.h>
#include <linux/in.h> #include <linux/in.h>
...@@ -68,8 +69,8 @@ ...@@ -68,8 +69,8 @@
#define BATADV_DHCP_CHADDR_OFFSET 28 #define BATADV_DHCP_CHADDR_OFFSET 28
/** /**
* batadv_gw_node_release - release gw_node from lists and queue for free after * batadv_gw_node_release() - release gw_node from lists and queue for free
* rcu grace period * after rcu grace period
* @ref: kref pointer of the gw_node * @ref: kref pointer of the gw_node
*/ */
static void batadv_gw_node_release(struct kref *ref) static void batadv_gw_node_release(struct kref *ref)
...@@ -83,7 +84,8 @@ static void batadv_gw_node_release(struct kref *ref) ...@@ -83,7 +84,8 @@ static void batadv_gw_node_release(struct kref *ref)
} }
/** /**
* batadv_gw_node_put - decrement the gw_node refcounter and possibly release it * batadv_gw_node_put() - decrement the gw_node refcounter and possibly release
* it
* @gw_node: gateway node to free * @gw_node: gateway node to free
*/ */
void batadv_gw_node_put(struct batadv_gw_node *gw_node) void batadv_gw_node_put(struct batadv_gw_node *gw_node)
...@@ -91,6 +93,12 @@ void batadv_gw_node_put(struct batadv_gw_node *gw_node) ...@@ -91,6 +93,12 @@ void batadv_gw_node_put(struct batadv_gw_node *gw_node)
kref_put(&gw_node->refcount, batadv_gw_node_release); kref_put(&gw_node->refcount, batadv_gw_node_release);
} }
/**
* batadv_gw_get_selected_gw_node() - Get currently selected gateway
* @bat_priv: the bat priv with all the soft interface information
*
* Return: selected gateway (with increased refcnt), NULL on errors
*/
struct batadv_gw_node * struct batadv_gw_node *
batadv_gw_get_selected_gw_node(struct batadv_priv *bat_priv) batadv_gw_get_selected_gw_node(struct batadv_priv *bat_priv)
{ {
...@@ -109,6 +117,12 @@ batadv_gw_get_selected_gw_node(struct batadv_priv *bat_priv) ...@@ -109,6 +117,12 @@ batadv_gw_get_selected_gw_node(struct batadv_priv *bat_priv)
return gw_node; return gw_node;
} }
/**
* batadv_gw_get_selected_orig() - Get originator of currently selected gateway
* @bat_priv: the bat priv with all the soft interface information
*
* Return: orig_node of selected gateway (with increased refcnt), NULL on errors
*/
struct batadv_orig_node * struct batadv_orig_node *
batadv_gw_get_selected_orig(struct batadv_priv *bat_priv) batadv_gw_get_selected_orig(struct batadv_priv *bat_priv)
{ {
...@@ -155,7 +169,7 @@ static void batadv_gw_select(struct batadv_priv *bat_priv, ...@@ -155,7 +169,7 @@ static void batadv_gw_select(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_gw_reselect - force a gateway reselection * batadv_gw_reselect() - force a gateway reselection
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* *
* Set a flag to remind the GW component to perform a new gateway reselection. * Set a flag to remind the GW component to perform a new gateway reselection.
...@@ -171,7 +185,7 @@ void batadv_gw_reselect(struct batadv_priv *bat_priv) ...@@ -171,7 +185,7 @@ void batadv_gw_reselect(struct batadv_priv *bat_priv)
} }
/** /**
* batadv_gw_check_client_stop - check if client mode has been switched off * batadv_gw_check_client_stop() - check if client mode has been switched off
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* *
* This function assumes the caller has checked that the gw state *is actually * This function assumes the caller has checked that the gw state *is actually
...@@ -202,6 +216,10 @@ void batadv_gw_check_client_stop(struct batadv_priv *bat_priv) ...@@ -202,6 +216,10 @@ void batadv_gw_check_client_stop(struct batadv_priv *bat_priv)
batadv_gw_node_put(curr_gw); batadv_gw_node_put(curr_gw);
} }
/**
* batadv_gw_election() - Elect the best gateway
* @bat_priv: the bat priv with all the soft interface information
*/
void batadv_gw_election(struct batadv_priv *bat_priv) void batadv_gw_election(struct batadv_priv *bat_priv)
{ {
struct batadv_gw_node *curr_gw = NULL; struct batadv_gw_node *curr_gw = NULL;
...@@ -290,6 +308,11 @@ void batadv_gw_election(struct batadv_priv *bat_priv) ...@@ -290,6 +308,11 @@ void batadv_gw_election(struct batadv_priv *bat_priv)
batadv_neigh_ifinfo_put(router_ifinfo); batadv_neigh_ifinfo_put(router_ifinfo);
} }
/**
* batadv_gw_check_election() - Elect orig node as best gateway when eligible
* @bat_priv: the bat priv with all the soft interface information
* @orig_node: orig node which is to be checked
*/
void batadv_gw_check_election(struct batadv_priv *bat_priv, void batadv_gw_check_election(struct batadv_priv *bat_priv,
struct batadv_orig_node *orig_node) struct batadv_orig_node *orig_node)
{ {
...@@ -321,7 +344,7 @@ void batadv_gw_check_election(struct batadv_priv *bat_priv, ...@@ -321,7 +344,7 @@ void batadv_gw_check_election(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_gw_node_add - add gateway node to list of available gateways * batadv_gw_node_add() - add gateway node to list of available gateways
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @orig_node: originator announcing gateway capabilities * @orig_node: originator announcing gateway capabilities
* @gateway: announced bandwidth information * @gateway: announced bandwidth information
...@@ -364,7 +387,7 @@ static void batadv_gw_node_add(struct batadv_priv *bat_priv, ...@@ -364,7 +387,7 @@ static void batadv_gw_node_add(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_gw_node_get - retrieve gateway node from list of available gateways * batadv_gw_node_get() - retrieve gateway node from list of available gateways
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @orig_node: originator announcing gateway capabilities * @orig_node: originator announcing gateway capabilities
* *
...@@ -393,7 +416,7 @@ struct batadv_gw_node *batadv_gw_node_get(struct batadv_priv *bat_priv, ...@@ -393,7 +416,7 @@ struct batadv_gw_node *batadv_gw_node_get(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_gw_node_update - update list of available gateways with changed * batadv_gw_node_update() - update list of available gateways with changed
* bandwidth information * bandwidth information
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @orig_node: originator announcing gateway capabilities * @orig_node: originator announcing gateway capabilities
...@@ -458,6 +481,11 @@ void batadv_gw_node_update(struct batadv_priv *bat_priv, ...@@ -458,6 +481,11 @@ void batadv_gw_node_update(struct batadv_priv *bat_priv,
batadv_gw_node_put(gw_node); batadv_gw_node_put(gw_node);
} }
/**
* batadv_gw_node_delete() - Remove orig_node from gateway list
* @bat_priv: the bat priv with all the soft interface information
* @orig_node: orig node which is currently in process of being removed
*/
void batadv_gw_node_delete(struct batadv_priv *bat_priv, void batadv_gw_node_delete(struct batadv_priv *bat_priv,
struct batadv_orig_node *orig_node) struct batadv_orig_node *orig_node)
{ {
...@@ -469,6 +497,10 @@ void batadv_gw_node_delete(struct batadv_priv *bat_priv, ...@@ -469,6 +497,10 @@ void batadv_gw_node_delete(struct batadv_priv *bat_priv,
batadv_gw_node_update(bat_priv, orig_node, &gateway); batadv_gw_node_update(bat_priv, orig_node, &gateway);
} }
/**
* batadv_gw_node_free() - Free gateway information from soft interface
* @bat_priv: the bat priv with all the soft interface information
*/
void batadv_gw_node_free(struct batadv_priv *bat_priv) void batadv_gw_node_free(struct batadv_priv *bat_priv)
{ {
struct batadv_gw_node *gw_node; struct batadv_gw_node *gw_node;
...@@ -484,6 +516,14 @@ void batadv_gw_node_free(struct batadv_priv *bat_priv) ...@@ -484,6 +516,14 @@ void batadv_gw_node_free(struct batadv_priv *bat_priv)
} }
#ifdef CONFIG_BATMAN_ADV_DEBUGFS #ifdef CONFIG_BATMAN_ADV_DEBUGFS
/**
* batadv_gw_client_seq_print_text() - Print the gateway table in a seq file
* @seq: seq file to print on
* @offset: not used
*
* Return: always 0
*/
int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset) int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
{ {
struct net_device *net_dev = (struct net_device *)seq->private; struct net_device *net_dev = (struct net_device *)seq->private;
...@@ -514,7 +554,7 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset) ...@@ -514,7 +554,7 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
#endif #endif
/** /**
* batadv_gw_dump - Dump gateways into a message * batadv_gw_dump() - Dump gateways into a message
* @msg: Netlink message to dump into * @msg: Netlink message to dump into
* @cb: Control block containing additional options * @cb: Control block containing additional options
* *
...@@ -567,7 +607,7 @@ int batadv_gw_dump(struct sk_buff *msg, struct netlink_callback *cb) ...@@ -567,7 +607,7 @@ int batadv_gw_dump(struct sk_buff *msg, struct netlink_callback *cb)
} }
/** /**
* batadv_gw_dhcp_recipient_get - check if a packet is a DHCP message * batadv_gw_dhcp_recipient_get() - check if a packet is a DHCP message
* @skb: the packet to check * @skb: the packet to check
* @header_len: a pointer to the batman-adv header size * @header_len: a pointer to the batman-adv header size
* @chaddr: buffer where the client address will be stored. Valid * @chaddr: buffer where the client address will be stored. Valid
...@@ -686,7 +726,8 @@ batadv_gw_dhcp_recipient_get(struct sk_buff *skb, unsigned int *header_len, ...@@ -686,7 +726,8 @@ batadv_gw_dhcp_recipient_get(struct sk_buff *skb, unsigned int *header_len,
} }
/** /**
* batadv_gw_out_of_range - check if the dhcp request destination is the best gw * batadv_gw_out_of_range() - check if the dhcp request destination is the best
* gateway
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @skb: the outgoing packet * @skb: the outgoing packet
* *
......
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2009-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2009-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
......
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2009-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2009-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
...@@ -33,8 +34,8 @@ ...@@ -33,8 +34,8 @@
#include "tvlv.h" #include "tvlv.h"
/** /**
* batadv_parse_throughput - parse supplied string buffer to extract throughput * batadv_parse_throughput() - parse supplied string buffer to extract
* information * throughput information
* @net_dev: the soft interface net device * @net_dev: the soft interface net device
* @buff: string buffer to parse * @buff: string buffer to parse
* @description: text shown when throughput string cannot be parsed * @description: text shown when throughput string cannot be parsed
...@@ -100,8 +101,8 @@ bool batadv_parse_throughput(struct net_device *net_dev, char *buff, ...@@ -100,8 +101,8 @@ bool batadv_parse_throughput(struct net_device *net_dev, char *buff,
} }
/** /**
* batadv_parse_gw_bandwidth - parse supplied string buffer to extract download * batadv_parse_gw_bandwidth() - parse supplied string buffer to extract
* and upload bandwidth information * download and upload bandwidth information
* @net_dev: the soft interface net device * @net_dev: the soft interface net device
* @buff: string buffer to parse * @buff: string buffer to parse
* @down: pointer holding the returned download bandwidth information * @down: pointer holding the returned download bandwidth information
...@@ -136,8 +137,8 @@ static bool batadv_parse_gw_bandwidth(struct net_device *net_dev, char *buff, ...@@ -136,8 +137,8 @@ static bool batadv_parse_gw_bandwidth(struct net_device *net_dev, char *buff,
} }
/** /**
* batadv_gw_tvlv_container_update - update the gw tvlv container after gateway * batadv_gw_tvlv_container_update() - update the gw tvlv container after
* setting change * gateway setting change
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
*/ */
void batadv_gw_tvlv_container_update(struct batadv_priv *bat_priv) void batadv_gw_tvlv_container_update(struct batadv_priv *bat_priv)
...@@ -164,6 +165,15 @@ void batadv_gw_tvlv_container_update(struct batadv_priv *bat_priv) ...@@ -164,6 +165,15 @@ void batadv_gw_tvlv_container_update(struct batadv_priv *bat_priv)
} }
} }
/**
* batadv_gw_bandwidth_set() - Parse and set download/upload gateway bandwidth
* from supplied string buffer
* @net_dev: netdev struct of the soft interface
* @buff: the buffer containing the user data
* @count: number of bytes in the buffer
*
* Return: 'count' on success or a negative error code in case of failure
*/
ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff, ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff,
size_t count) size_t count)
{ {
...@@ -207,7 +217,7 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff, ...@@ -207,7 +217,7 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff,
} }
/** /**
* batadv_gw_tvlv_ogm_handler_v1 - process incoming gateway tvlv container * batadv_gw_tvlv_ogm_handler_v1() - process incoming gateway tvlv container
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @orig: the orig_node of the ogm * @orig: the orig_node of the ogm
* @flags: flags indicating the tvlv state (see batadv_tvlv_handler_flags) * @flags: flags indicating the tvlv state (see batadv_tvlv_handler_flags)
...@@ -248,7 +258,7 @@ static void batadv_gw_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv, ...@@ -248,7 +258,7 @@ static void batadv_gw_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_gw_init - initialise the gateway handling internals * batadv_gw_init() - initialise the gateway handling internals
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
*/ */
void batadv_gw_init(struct batadv_priv *bat_priv) void batadv_gw_init(struct batadv_priv *bat_priv)
...@@ -264,7 +274,7 @@ void batadv_gw_init(struct batadv_priv *bat_priv) ...@@ -264,7 +274,7 @@ void batadv_gw_init(struct batadv_priv *bat_priv)
} }
/** /**
* batadv_gw_free - free the gateway handling internals * batadv_gw_free() - free the gateway handling internals
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
*/ */
void batadv_gw_free(struct batadv_priv *bat_priv) void batadv_gw_free(struct batadv_priv *bat_priv)
......
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2009-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2009-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
...@@ -32,11 +33,12 @@ enum batadv_gw_modes { ...@@ -32,11 +33,12 @@ enum batadv_gw_modes {
/** /**
* enum batadv_bandwidth_units - bandwidth unit types * enum batadv_bandwidth_units - bandwidth unit types
* @BATADV_BW_UNIT_KBIT: unit type kbit
* @BATADV_BW_UNIT_MBIT: unit type mbit
*/ */
enum batadv_bandwidth_units { enum batadv_bandwidth_units {
/** @BATADV_BW_UNIT_KBIT: unit type kbit */
BATADV_BW_UNIT_KBIT, BATADV_BW_UNIT_KBIT,
/** @BATADV_BW_UNIT_MBIT: unit type mbit */
BATADV_BW_UNIT_MBIT, BATADV_BW_UNIT_MBIT,
}; };
......
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
...@@ -22,7 +23,7 @@ ...@@ -22,7 +23,7 @@
#include <linux/bug.h> #include <linux/bug.h>
#include <linux/byteorder/generic.h> #include <linux/byteorder/generic.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/fs.h> #include <linux/gfp.h>
#include <linux/if.h> #include <linux/if.h>
#include <linux/if_arp.h> #include <linux/if_arp.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
...@@ -52,7 +53,7 @@ ...@@ -52,7 +53,7 @@
#include "translation-table.h" #include "translation-table.h"
/** /**
* batadv_hardif_release - release hard interface from lists and queue for * batadv_hardif_release() - release hard interface from lists and queue for
* free after rcu grace period * free after rcu grace period
* @ref: kref pointer of the hard interface * @ref: kref pointer of the hard interface
*/ */
...@@ -66,6 +67,12 @@ void batadv_hardif_release(struct kref *ref) ...@@ -66,6 +67,12 @@ void batadv_hardif_release(struct kref *ref)
kfree_rcu(hard_iface, rcu); kfree_rcu(hard_iface, rcu);
} }
/**
* batadv_hardif_get_by_netdev() - Get hard interface object of a net_device
* @net_dev: net_device to search for
*
* Return: batadv_hard_iface of net_dev (with increased refcnt), NULL on errors
*/
struct batadv_hard_iface * struct batadv_hard_iface *
batadv_hardif_get_by_netdev(const struct net_device *net_dev) batadv_hardif_get_by_netdev(const struct net_device *net_dev)
{ {
...@@ -86,7 +93,7 @@ batadv_hardif_get_by_netdev(const struct net_device *net_dev) ...@@ -86,7 +93,7 @@ batadv_hardif_get_by_netdev(const struct net_device *net_dev)
} }
/** /**
* batadv_getlink_net - return link net namespace (of use fallback) * batadv_getlink_net() - return link net namespace (of use fallback)
* @netdev: net_device to check * @netdev: net_device to check
* @fallback_net: return in case get_link_net is not available for @netdev * @fallback_net: return in case get_link_net is not available for @netdev
* *
...@@ -105,7 +112,7 @@ static struct net *batadv_getlink_net(const struct net_device *netdev, ...@@ -105,7 +112,7 @@ static struct net *batadv_getlink_net(const struct net_device *netdev,
} }
/** /**
* batadv_mutual_parents - check if two devices are each others parent * batadv_mutual_parents() - check if two devices are each others parent
* @dev1: 1st net dev * @dev1: 1st net dev
* @net1: 1st devices netns * @net1: 1st devices netns
* @dev2: 2nd net dev * @dev2: 2nd net dev
...@@ -138,7 +145,7 @@ static bool batadv_mutual_parents(const struct net_device *dev1, ...@@ -138,7 +145,7 @@ static bool batadv_mutual_parents(const struct net_device *dev1,
} }
/** /**
* batadv_is_on_batman_iface - check if a device is a batman iface descendant * batadv_is_on_batman_iface() - check if a device is a batman iface descendant
* @net_dev: the device to check * @net_dev: the device to check
* *
* If the user creates any virtual device on top of a batman-adv interface, it * If the user creates any virtual device on top of a batman-adv interface, it
...@@ -202,7 +209,7 @@ static bool batadv_is_valid_iface(const struct net_device *net_dev) ...@@ -202,7 +209,7 @@ static bool batadv_is_valid_iface(const struct net_device *net_dev)
} }
/** /**
* batadv_get_real_netdevice - check if the given netdev struct is a virtual * batadv_get_real_netdevice() - check if the given netdev struct is a virtual
* interface on top of another 'real' interface * interface on top of another 'real' interface
* @netdev: the device to check * @netdev: the device to check
* *
...@@ -246,7 +253,7 @@ static struct net_device *batadv_get_real_netdevice(struct net_device *netdev) ...@@ -246,7 +253,7 @@ static struct net_device *batadv_get_real_netdevice(struct net_device *netdev)
} }
/** /**
* batadv_get_real_netdev - check if the given net_device struct is a virtual * batadv_get_real_netdev() - check if the given net_device struct is a virtual
* interface on top of another 'real' interface * interface on top of another 'real' interface
* @net_device: the device to check * @net_device: the device to check
* *
...@@ -265,7 +272,7 @@ struct net_device *batadv_get_real_netdev(struct net_device *net_device) ...@@ -265,7 +272,7 @@ struct net_device *batadv_get_real_netdev(struct net_device *net_device)
} }
/** /**
* batadv_is_wext_netdev - check if the given net_device struct is a * batadv_is_wext_netdev() - check if the given net_device struct is a
* wext wifi interface * wext wifi interface
* @net_device: the device to check * @net_device: the device to check
* *
...@@ -289,7 +296,7 @@ static bool batadv_is_wext_netdev(struct net_device *net_device) ...@@ -289,7 +296,7 @@ static bool batadv_is_wext_netdev(struct net_device *net_device)
} }
/** /**
* batadv_is_cfg80211_netdev - check if the given net_device struct is a * batadv_is_cfg80211_netdev() - check if the given net_device struct is a
* cfg80211 wifi interface * cfg80211 wifi interface
* @net_device: the device to check * @net_device: the device to check
* *
...@@ -309,7 +316,7 @@ static bool batadv_is_cfg80211_netdev(struct net_device *net_device) ...@@ -309,7 +316,7 @@ static bool batadv_is_cfg80211_netdev(struct net_device *net_device)
} }
/** /**
* batadv_wifi_flags_evaluate - calculate wifi flags for net_device * batadv_wifi_flags_evaluate() - calculate wifi flags for net_device
* @net_device: the device to check * @net_device: the device to check
* *
* Return: batadv_hard_iface_wifi_flags flags of the device * Return: batadv_hard_iface_wifi_flags flags of the device
...@@ -344,7 +351,7 @@ static u32 batadv_wifi_flags_evaluate(struct net_device *net_device) ...@@ -344,7 +351,7 @@ static u32 batadv_wifi_flags_evaluate(struct net_device *net_device)
} }
/** /**
* batadv_is_cfg80211_hardif - check if the given hardif is a cfg80211 wifi * batadv_is_cfg80211_hardif() - check if the given hardif is a cfg80211 wifi
* interface * interface
* @hard_iface: the device to check * @hard_iface: the device to check
* *
...@@ -362,7 +369,7 @@ bool batadv_is_cfg80211_hardif(struct batadv_hard_iface *hard_iface) ...@@ -362,7 +369,7 @@ bool batadv_is_cfg80211_hardif(struct batadv_hard_iface *hard_iface)
} }
/** /**
* batadv_is_wifi_hardif - check if the given hardif is a wifi interface * batadv_is_wifi_hardif() - check if the given hardif is a wifi interface
* @hard_iface: the device to check * @hard_iface: the device to check
* *
* Return: true if the net device is a 802.11 wireless device, false otherwise. * Return: true if the net device is a 802.11 wireless device, false otherwise.
...@@ -376,7 +383,7 @@ bool batadv_is_wifi_hardif(struct batadv_hard_iface *hard_iface) ...@@ -376,7 +383,7 @@ bool batadv_is_wifi_hardif(struct batadv_hard_iface *hard_iface)
} }
/** /**
* batadv_hardif_no_broadcast - check whether (re)broadcast is necessary * batadv_hardif_no_broadcast() - check whether (re)broadcast is necessary
* @if_outgoing: the outgoing interface checked and considered for (re)broadcast * @if_outgoing: the outgoing interface checked and considered for (re)broadcast
* @orig_addr: the originator of this packet * @orig_addr: the originator of this packet
* @orig_neigh: originator address of the forwarder we just got the packet from * @orig_neigh: originator address of the forwarder we just got the packet from
...@@ -560,6 +567,13 @@ static void batadv_hardif_recalc_extra_skbroom(struct net_device *soft_iface) ...@@ -560,6 +567,13 @@ static void batadv_hardif_recalc_extra_skbroom(struct net_device *soft_iface)
soft_iface->needed_tailroom = lower_tailroom; soft_iface->needed_tailroom = lower_tailroom;
} }
/**
* batadv_hardif_min_mtu() - Calculate maximum MTU for soft interface
* @soft_iface: netdev struct of the soft interface
*
* Return: MTU for the soft-interface (limited by the minimal MTU of all active
* slave interfaces)
*/
int batadv_hardif_min_mtu(struct net_device *soft_iface) int batadv_hardif_min_mtu(struct net_device *soft_iface)
{ {
struct batadv_priv *bat_priv = netdev_priv(soft_iface); struct batadv_priv *bat_priv = netdev_priv(soft_iface);
...@@ -606,7 +620,11 @@ int batadv_hardif_min_mtu(struct net_device *soft_iface) ...@@ -606,7 +620,11 @@ int batadv_hardif_min_mtu(struct net_device *soft_iface)
return min_t(int, min_mtu - batadv_max_header_len(), ETH_DATA_LEN); return min_t(int, min_mtu - batadv_max_header_len(), ETH_DATA_LEN);
} }
/* adjusts the MTU if a new interface with a smaller MTU appeared. */ /**
* batadv_update_min_mtu() - Adjusts the MTU if a new interface with a smaller
* MTU appeared
* @soft_iface: netdev struct of the soft interface
*/
void batadv_update_min_mtu(struct net_device *soft_iface) void batadv_update_min_mtu(struct net_device *soft_iface)
{ {
soft_iface->mtu = batadv_hardif_min_mtu(soft_iface); soft_iface->mtu = batadv_hardif_min_mtu(soft_iface);
...@@ -667,7 +685,7 @@ batadv_hardif_deactivate_interface(struct batadv_hard_iface *hard_iface) ...@@ -667,7 +685,7 @@ batadv_hardif_deactivate_interface(struct batadv_hard_iface *hard_iface)
} }
/** /**
* batadv_master_del_slave - remove hard_iface from the current master interface * batadv_master_del_slave() - remove hard_iface from the current master iface
* @slave: the interface enslaved in another master * @slave: the interface enslaved in another master
* @master: the master from which slave has to be removed * @master: the master from which slave has to be removed
* *
...@@ -691,6 +709,14 @@ static int batadv_master_del_slave(struct batadv_hard_iface *slave, ...@@ -691,6 +709,14 @@ static int batadv_master_del_slave(struct batadv_hard_iface *slave,
return ret; return ret;
} }
/**
* batadv_hardif_enable_interface() - Enslave hard interface to soft interface
* @hard_iface: hard interface to add to soft interface
* @net: the applicable net namespace
* @iface_name: name of the soft interface
*
* Return: 0 on success or negative error number in case of failure
*/
int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
struct net *net, const char *iface_name) struct net *net, const char *iface_name)
{ {
...@@ -802,6 +828,12 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, ...@@ -802,6 +828,12 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
return ret; return ret;
} }
/**
* batadv_hardif_disable_interface() - Remove hard interface from soft interface
* @hard_iface: hard interface to be removed
* @autodel: whether to delete soft interface when it doesn't contain any other
* slave interfaces
*/
void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface, void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
enum batadv_hard_if_cleanup autodel) enum batadv_hard_if_cleanup autodel)
{ {
...@@ -936,6 +968,9 @@ static void batadv_hardif_remove_interface(struct batadv_hard_iface *hard_iface) ...@@ -936,6 +968,9 @@ static void batadv_hardif_remove_interface(struct batadv_hard_iface *hard_iface)
batadv_hardif_put(hard_iface); batadv_hardif_put(hard_iface);
} }
/**
* batadv_hardif_remove_interfaces() - Remove all hard interfaces
*/
void batadv_hardif_remove_interfaces(void) void batadv_hardif_remove_interfaces(void)
{ {
struct batadv_hard_iface *hard_iface, *hard_iface_tmp; struct batadv_hard_iface *hard_iface, *hard_iface_tmp;
......
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
...@@ -30,36 +31,74 @@ ...@@ -30,36 +31,74 @@
struct net_device; struct net_device;
struct net; struct net;
/**
* enum batadv_hard_if_state - State of a hard interface
*/
enum batadv_hard_if_state { enum batadv_hard_if_state {
/**
* @BATADV_IF_NOT_IN_USE: interface is not used as slave interface of a
* batman-adv soft interface
*/
BATADV_IF_NOT_IN_USE, BATADV_IF_NOT_IN_USE,
/**
* @BATADV_IF_TO_BE_REMOVED: interface will be removed from soft
* interface
*/
BATADV_IF_TO_BE_REMOVED, BATADV_IF_TO_BE_REMOVED,
/** @BATADV_IF_INACTIVE: interface is deactivated */
BATADV_IF_INACTIVE, BATADV_IF_INACTIVE,
/** @BATADV_IF_ACTIVE: interface is used */
BATADV_IF_ACTIVE, BATADV_IF_ACTIVE,
/** @BATADV_IF_TO_BE_ACTIVATED: interface is getting activated */
BATADV_IF_TO_BE_ACTIVATED, BATADV_IF_TO_BE_ACTIVATED,
/**
* @BATADV_IF_I_WANT_YOU: interface is queued up (using sysfs) for being
* added as slave interface of a batman-adv soft interface
*/
BATADV_IF_I_WANT_YOU, BATADV_IF_I_WANT_YOU,
}; };
/** /**
* enum batadv_hard_if_bcast - broadcast avoidance options * enum batadv_hard_if_bcast - broadcast avoidance options
* @BATADV_HARDIF_BCAST_OK: Do broadcast on according hard interface
* @BATADV_HARDIF_BCAST_NORECIPIENT: Broadcast not needed, there is no recipient
* @BATADV_HARDIF_BCAST_DUPFWD: There is just the neighbor we got it from
* @BATADV_HARDIF_BCAST_DUPORIG: There is just the originator
*/ */
enum batadv_hard_if_bcast { enum batadv_hard_if_bcast {
/** @BATADV_HARDIF_BCAST_OK: Do broadcast on according hard interface */
BATADV_HARDIF_BCAST_OK = 0, BATADV_HARDIF_BCAST_OK = 0,
/**
* @BATADV_HARDIF_BCAST_NORECIPIENT: Broadcast not needed, there is no
* recipient
*/
BATADV_HARDIF_BCAST_NORECIPIENT, BATADV_HARDIF_BCAST_NORECIPIENT,
/**
* @BATADV_HARDIF_BCAST_DUPFWD: There is just the neighbor we got it
* from
*/
BATADV_HARDIF_BCAST_DUPFWD, BATADV_HARDIF_BCAST_DUPFWD,
/** @BATADV_HARDIF_BCAST_DUPORIG: There is just the originator */
BATADV_HARDIF_BCAST_DUPORIG, BATADV_HARDIF_BCAST_DUPORIG,
}; };
/** /**
* enum batadv_hard_if_cleanup - Cleanup modi for soft_iface after slave removal * enum batadv_hard_if_cleanup - Cleanup modi for soft_iface after slave removal
* @BATADV_IF_CLEANUP_KEEP: Don't automatically delete soft-interface
* @BATADV_IF_CLEANUP_AUTO: Delete soft-interface after last slave was removed
*/ */
enum batadv_hard_if_cleanup { enum batadv_hard_if_cleanup {
/**
* @BATADV_IF_CLEANUP_KEEP: Don't automatically delete soft-interface
*/
BATADV_IF_CLEANUP_KEEP, BATADV_IF_CLEANUP_KEEP,
/**
* @BATADV_IF_CLEANUP_AUTO: Delete soft-interface after last slave was
* removed
*/
BATADV_IF_CLEANUP_AUTO, BATADV_IF_CLEANUP_AUTO,
}; };
...@@ -82,7 +121,7 @@ int batadv_hardif_no_broadcast(struct batadv_hard_iface *if_outgoing, ...@@ -82,7 +121,7 @@ int batadv_hardif_no_broadcast(struct batadv_hard_iface *if_outgoing,
u8 *orig_addr, u8 *orig_neigh); u8 *orig_addr, u8 *orig_neigh);
/** /**
* batadv_hardif_put - decrement the hard interface refcounter and possibly * batadv_hardif_put() - decrement the hard interface refcounter and possibly
* release it * release it
* @hard_iface: the hard interface to free * @hard_iface: the hard interface to free
*/ */
...@@ -91,6 +130,12 @@ static inline void batadv_hardif_put(struct batadv_hard_iface *hard_iface) ...@@ -91,6 +130,12 @@ static inline void batadv_hardif_put(struct batadv_hard_iface *hard_iface)
kref_put(&hard_iface->refcount, batadv_hardif_release); kref_put(&hard_iface->refcount, batadv_hardif_release);
} }
/**
* batadv_primary_if_get_selected() - Get reference to primary interface
* @bat_priv: the bat priv with all the soft interface information
*
* Return: primary interface (with increased refcnt), otherwise NULL
*/
static inline struct batadv_hard_iface * static inline struct batadv_hard_iface *
batadv_primary_if_get_selected(struct batadv_priv *bat_priv) batadv_primary_if_get_selected(struct batadv_priv *bat_priv)
{ {
......
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2006-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2006-2017 B.A.T.M.A.N. contributors:
* *
* Simon Wunderlich, Marek Lindner * Simon Wunderlich, Marek Lindner
...@@ -18,7 +19,7 @@ ...@@ -18,7 +19,7 @@
#include "hash.h" #include "hash.h"
#include "main.h" #include "main.h"
#include <linux/fs.h> #include <linux/gfp.h>
#include <linux/lockdep.h> #include <linux/lockdep.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -33,7 +34,10 @@ static void batadv_hash_init(struct batadv_hashtable *hash) ...@@ -33,7 +34,10 @@ static void batadv_hash_init(struct batadv_hashtable *hash)
} }
} }
/* free only the hashtable and the hash itself. */ /**
* batadv_hash_destroy() - Free only the hashtable and the hash itself
* @hash: hash object to destroy
*/
void batadv_hash_destroy(struct batadv_hashtable *hash) void batadv_hash_destroy(struct batadv_hashtable *hash)
{ {
kfree(hash->list_locks); kfree(hash->list_locks);
...@@ -41,7 +45,12 @@ void batadv_hash_destroy(struct batadv_hashtable *hash) ...@@ -41,7 +45,12 @@ void batadv_hash_destroy(struct batadv_hashtable *hash)
kfree(hash); kfree(hash);
} }
/* allocates and clears the hash */ /**
* batadv_hash_new() - Allocates and clears the hashtable
* @size: number of hash buckets to allocate
*
* Return: newly allocated hashtable, NULL on errors
*/
struct batadv_hashtable *batadv_hash_new(u32 size) struct batadv_hashtable *batadv_hash_new(u32 size)
{ {
struct batadv_hashtable *hash; struct batadv_hashtable *hash;
...@@ -70,6 +79,11 @@ struct batadv_hashtable *batadv_hash_new(u32 size) ...@@ -70,6 +79,11 @@ struct batadv_hashtable *batadv_hash_new(u32 size)
return NULL; return NULL;
} }
/**
* batadv_hash_set_lock_class() - Set specific lockdep class for hash spinlocks
* @hash: hash object to modify
* @key: lockdep class key address
*/
void batadv_hash_set_lock_class(struct batadv_hashtable *hash, void batadv_hash_set_lock_class(struct batadv_hashtable *hash,
struct lock_class_key *key) struct lock_class_key *key)
{ {
......
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2006-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2006-2017 B.A.T.M.A.N. contributors:
* *
* Simon Wunderlich, Marek Lindner * Simon Wunderlich, Marek Lindner
...@@ -45,10 +46,18 @@ typedef bool (*batadv_hashdata_compare_cb)(const struct hlist_node *, ...@@ -45,10 +46,18 @@ typedef bool (*batadv_hashdata_compare_cb)(const struct hlist_node *,
typedef u32 (*batadv_hashdata_choose_cb)(const void *, u32); typedef u32 (*batadv_hashdata_choose_cb)(const void *, u32);
typedef void (*batadv_hashdata_free_cb)(struct hlist_node *, void *); typedef void (*batadv_hashdata_free_cb)(struct hlist_node *, void *);
/**
* struct batadv_hashtable - Wrapper of simple hlist based hashtable
*/
struct batadv_hashtable { struct batadv_hashtable {
struct hlist_head *table; /* the hashtable itself with the buckets */ /** @table: the hashtable itself with the buckets */
spinlock_t *list_locks; /* spinlock for each hash list entry */ struct hlist_head *table;
u32 size; /* size of hashtable */
/** @list_locks: spinlock for each hash list entry */
spinlock_t *list_locks;
/** @size: size of hashtable */
u32 size;
}; };
/* allocates and clears the hash */ /* allocates and clears the hash */
...@@ -62,7 +71,7 @@ void batadv_hash_set_lock_class(struct batadv_hashtable *hash, ...@@ -62,7 +71,7 @@ void batadv_hash_set_lock_class(struct batadv_hashtable *hash,
void batadv_hash_destroy(struct batadv_hashtable *hash); void batadv_hash_destroy(struct batadv_hashtable *hash);
/** /**
* batadv_hash_add - adds data to the hashtable * batadv_hash_add() - adds data to the hashtable
* @hash: storage hash table * @hash: storage hash table
* @compare: callback to determine if 2 hash elements are identical * @compare: callback to determine if 2 hash elements are identical
* @choose: callback calculating the hash index * @choose: callback calculating the hash index
...@@ -112,8 +121,15 @@ static inline int batadv_hash_add(struct batadv_hashtable *hash, ...@@ -112,8 +121,15 @@ static inline int batadv_hash_add(struct batadv_hashtable *hash,
return ret; return ret;
} }
/* removes data from hash, if found. data could be the structure you use with /**
* just the key filled, we just need the key for comparing. * batadv_hash_remove() - Removes data from hash, if found
* @hash: hash table
* @compare: callback to determine if 2 hash elements are identical
* @choose: callback calculating the hash index
* @data: data passed to the aforementioned callbacks as argument
*
* ata could be the structure you use with just the key filled, we just need
* the key for comparing.
* *
* Return: returns pointer do data on success, so you can remove the used * Return: returns pointer do data on success, so you can remove the used
* structure yourself, or NULL on error * structure yourself, or NULL on error
......
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
...@@ -26,6 +27,7 @@ ...@@ -26,6 +27,7 @@
#include <linux/export.h> #include <linux/export.h>
#include <linux/fcntl.h> #include <linux/fcntl.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/gfp.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/list.h> #include <linux/list.h>
...@@ -55,6 +57,9 @@ static void batadv_socket_add_packet(struct batadv_socket_client *socket_client, ...@@ -55,6 +57,9 @@ static void batadv_socket_add_packet(struct batadv_socket_client *socket_client,
struct batadv_icmp_header *icmph, struct batadv_icmp_header *icmph,
size_t icmp_len); size_t icmp_len);
/**
* batadv_socket_init() - Initialize soft interface independent socket data
*/
void batadv_socket_init(void) void batadv_socket_init(void)
{ {
memset(batadv_socket_client_hash, 0, sizeof(batadv_socket_client_hash)); memset(batadv_socket_client_hash, 0, sizeof(batadv_socket_client_hash));
...@@ -314,6 +319,12 @@ static const struct file_operations batadv_fops = { ...@@ -314,6 +319,12 @@ static const struct file_operations batadv_fops = {
.llseek = no_llseek, .llseek = no_llseek,
}; };
/**
* batadv_socket_setup() - Create debugfs "socket" file
* @bat_priv: the bat priv with all the soft interface information
*
* Return: 0 on success or negative error number in case of failure
*/
int batadv_socket_setup(struct batadv_priv *bat_priv) int batadv_socket_setup(struct batadv_priv *bat_priv)
{ {
struct dentry *d; struct dentry *d;
...@@ -333,7 +344,7 @@ int batadv_socket_setup(struct batadv_priv *bat_priv) ...@@ -333,7 +344,7 @@ int batadv_socket_setup(struct batadv_priv *bat_priv)
} }
/** /**
* batadv_socket_add_packet - schedule an icmp packet to be sent to * batadv_socket_add_packet() - schedule an icmp packet to be sent to
* userspace on an icmp socket. * userspace on an icmp socket.
* @socket_client: the socket this packet belongs to * @socket_client: the socket this packet belongs to
* @icmph: pointer to the header of the icmp packet * @icmph: pointer to the header of the icmp packet
...@@ -390,7 +401,7 @@ static void batadv_socket_add_packet(struct batadv_socket_client *socket_client, ...@@ -390,7 +401,7 @@ static void batadv_socket_add_packet(struct batadv_socket_client *socket_client,
} }
/** /**
* batadv_socket_receive_packet - schedule an icmp packet to be received * batadv_socket_receive_packet() - schedule an icmp packet to be received
* locally and sent to userspace. * locally and sent to userspace.
* @icmph: pointer to the header of the icmp packet * @icmph: pointer to the header of the icmp packet
* @icmp_len: total length of the icmp packet * @icmp_len: total length of the icmp packet
......
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
......
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2010-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2010-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
...@@ -24,6 +25,7 @@ ...@@ -24,6 +25,7 @@
#include <linux/export.h> #include <linux/export.h>
#include <linux/fcntl.h> #include <linux/fcntl.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/gfp.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -86,6 +88,13 @@ static int batadv_fdebug_log(struct batadv_priv_debug_log *debug_log, ...@@ -86,6 +88,13 @@ static int batadv_fdebug_log(struct batadv_priv_debug_log *debug_log,
return 0; return 0;
} }
/**
* batadv_debug_log() - Add debug log entry
* @bat_priv: the bat priv with all the soft interface information
* @fmt: format string
*
* Return: 0 on success or negative error number in case of failure
*/
int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...) int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...)
{ {
va_list args; va_list args;
...@@ -197,6 +206,12 @@ static const struct file_operations batadv_log_fops = { ...@@ -197,6 +206,12 @@ static const struct file_operations batadv_log_fops = {
.llseek = no_llseek, .llseek = no_llseek,
}; };
/**
* batadv_debug_log_setup() - Initialize debug log
* @bat_priv: the bat priv with all the soft interface information
*
* Return: 0 on success or negative error number in case of failure
*/
int batadv_debug_log_setup(struct batadv_priv *bat_priv) int batadv_debug_log_setup(struct batadv_priv *bat_priv)
{ {
struct dentry *d; struct dentry *d;
...@@ -222,6 +237,10 @@ int batadv_debug_log_setup(struct batadv_priv *bat_priv) ...@@ -222,6 +237,10 @@ int batadv_debug_log_setup(struct batadv_priv *bat_priv)
return -ENOMEM; return -ENOMEM;
} }
/**
* batadv_debug_log_cleanup() - Destroy debug log
* @bat_priv: the bat priv with all the soft interface information
*/
void batadv_debug_log_cleanup(struct batadv_priv *bat_priv) void batadv_debug_log_cleanup(struct batadv_priv *bat_priv)
{ {
kfree(bat_priv->debug_log); kfree(bat_priv->debug_log);
......
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
...@@ -44,25 +45,33 @@ static inline void batadv_debug_log_cleanup(struct batadv_priv *bat_priv) ...@@ -44,25 +45,33 @@ static inline void batadv_debug_log_cleanup(struct batadv_priv *bat_priv)
/** /**
* enum batadv_dbg_level - available log levels * enum batadv_dbg_level - available log levels
* @BATADV_DBG_BATMAN: OGM and TQ computations related messages
* @BATADV_DBG_ROUTES: route added / changed / deleted
* @BATADV_DBG_TT: translation table messages
* @BATADV_DBG_BLA: bridge loop avoidance messages
* @BATADV_DBG_DAT: ARP snooping and DAT related messages
* @BATADV_DBG_NC: network coding related messages
* @BATADV_DBG_MCAST: multicast related messages
* @BATADV_DBG_TP_METER: throughput meter messages
* @BATADV_DBG_ALL: the union of all the above log levels
*/ */
enum batadv_dbg_level { enum batadv_dbg_level {
/** @BATADV_DBG_BATMAN: OGM and TQ computations related messages */
BATADV_DBG_BATMAN = BIT(0), BATADV_DBG_BATMAN = BIT(0),
/** @BATADV_DBG_ROUTES: route added / changed / deleted */
BATADV_DBG_ROUTES = BIT(1), BATADV_DBG_ROUTES = BIT(1),
/** @BATADV_DBG_TT: translation table messages */
BATADV_DBG_TT = BIT(2), BATADV_DBG_TT = BIT(2),
/** @BATADV_DBG_BLA: bridge loop avoidance messages */
BATADV_DBG_BLA = BIT(3), BATADV_DBG_BLA = BIT(3),
/** @BATADV_DBG_DAT: ARP snooping and DAT related messages */
BATADV_DBG_DAT = BIT(4), BATADV_DBG_DAT = BIT(4),
/** @BATADV_DBG_NC: network coding related messages */
BATADV_DBG_NC = BIT(5), BATADV_DBG_NC = BIT(5),
/** @BATADV_DBG_MCAST: multicast related messages */
BATADV_DBG_MCAST = BIT(6), BATADV_DBG_MCAST = BIT(6),
/** @BATADV_DBG_TP_METER: throughput meter messages */
BATADV_DBG_TP_METER = BIT(7), BATADV_DBG_TP_METER = BIT(7),
/** @BATADV_DBG_ALL: the union of all the above log levels */
BATADV_DBG_ALL = 255, BATADV_DBG_ALL = 255,
}; };
...@@ -70,7 +79,14 @@ enum batadv_dbg_level { ...@@ -70,7 +79,14 @@ enum batadv_dbg_level {
int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...) int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...)
__printf(2, 3); __printf(2, 3);
/* possibly ratelimited debug output */ /**
* _batadv_dbg() - Store debug output with(out) ratelimiting
* @type: type of debug message
* @bat_priv: the bat priv with all the soft interface information
* @ratelimited: whether output should be rate limited
* @fmt: format string
* @arg...: variable arguments
*/
#define _batadv_dbg(type, bat_priv, ratelimited, fmt, arg...) \ #define _batadv_dbg(type, bat_priv, ratelimited, fmt, arg...) \
do { \ do { \
struct batadv_priv *__batpriv = (bat_priv); \ struct batadv_priv *__batpriv = (bat_priv); \
...@@ -89,11 +105,30 @@ static inline void _batadv_dbg(int type __always_unused, ...@@ -89,11 +105,30 @@ static inline void _batadv_dbg(int type __always_unused,
} }
#endif #endif
/**
* batadv_dbg() - Store debug output without ratelimiting
* @type: type of debug message
* @bat_priv: the bat priv with all the soft interface information
* @arg...: format string and variable arguments
*/
#define batadv_dbg(type, bat_priv, arg...) \ #define batadv_dbg(type, bat_priv, arg...) \
_batadv_dbg(type, bat_priv, 0, ## arg) _batadv_dbg(type, bat_priv, 0, ## arg)
/**
* batadv_dbg_ratelimited() - Store debug output with ratelimiting
* @type: type of debug message
* @bat_priv: the bat priv with all the soft interface information
* @arg...: format string and variable arguments
*/
#define batadv_dbg_ratelimited(type, bat_priv, arg...) \ #define batadv_dbg_ratelimited(type, bat_priv, arg...) \
_batadv_dbg(type, bat_priv, 1, ## arg) _batadv_dbg(type, bat_priv, 1, ## arg)
/**
* batadv_info() - Store message in debug buffer and print it to kmsg buffer
* @net_dev: the soft interface net device
* @fmt: format string
* @arg...: variable arguments
*/
#define batadv_info(net_dev, fmt, arg...) \ #define batadv_info(net_dev, fmt, arg...) \
do { \ do { \
struct net_device *_netdev = (net_dev); \ struct net_device *_netdev = (net_dev); \
...@@ -101,6 +136,13 @@ static inline void _batadv_dbg(int type __always_unused, ...@@ -101,6 +136,13 @@ static inline void _batadv_dbg(int type __always_unused,
batadv_dbg(BATADV_DBG_ALL, _batpriv, fmt, ## arg); \ batadv_dbg(BATADV_DBG_ALL, _batpriv, fmt, ## arg); \
pr_info("%s: " fmt, _netdev->name, ## arg); \ pr_info("%s: " fmt, _netdev->name, ## arg); \
} while (0) } while (0)
/**
* batadv_err() - Store error in debug buffer and print it to kmsg buffer
* @net_dev: the soft interface net device
* @fmt: format string
* @arg...: variable arguments
*/
#define batadv_err(net_dev, fmt, arg...) \ #define batadv_err(net_dev, fmt, arg...) \
do { \ do { \
struct net_device *_netdev = (net_dev); \ struct net_device *_netdev = (net_dev); \
......
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
...@@ -18,12 +19,12 @@ ...@@ -18,12 +19,12 @@
#include "main.h" #include "main.h"
#include <linux/atomic.h> #include <linux/atomic.h>
#include <linux/bug.h> #include <linux/build_bug.h>
#include <linux/byteorder/generic.h> #include <linux/byteorder/generic.h>
#include <linux/crc32c.h> #include <linux/crc32c.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/fs.h>
#include <linux/genetlink.h> #include <linux/genetlink.h>
#include <linux/gfp.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/if_vlan.h> #include <linux/if_vlan.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -139,6 +140,12 @@ static void __exit batadv_exit(void) ...@@ -139,6 +140,12 @@ static void __exit batadv_exit(void)
batadv_tt_cache_destroy(); batadv_tt_cache_destroy();
} }
/**
* batadv_mesh_init() - Initialize soft interface
* @soft_iface: netdev struct of the soft interface
*
* Return: 0 on success or negative error number in case of failure
*/
int batadv_mesh_init(struct net_device *soft_iface) int batadv_mesh_init(struct net_device *soft_iface)
{ {
struct batadv_priv *bat_priv = netdev_priv(soft_iface); struct batadv_priv *bat_priv = netdev_priv(soft_iface);
...@@ -216,6 +223,10 @@ int batadv_mesh_init(struct net_device *soft_iface) ...@@ -216,6 +223,10 @@ int batadv_mesh_init(struct net_device *soft_iface)
return ret; return ret;
} }
/**
* batadv_mesh_free() - Deinitialize soft interface
* @soft_iface: netdev struct of the soft interface
*/
void batadv_mesh_free(struct net_device *soft_iface) void batadv_mesh_free(struct net_device *soft_iface)
{ {
struct batadv_priv *bat_priv = netdev_priv(soft_iface); struct batadv_priv *bat_priv = netdev_priv(soft_iface);
...@@ -255,8 +266,8 @@ void batadv_mesh_free(struct net_device *soft_iface) ...@@ -255,8 +266,8 @@ void batadv_mesh_free(struct net_device *soft_iface)
} }
/** /**
* batadv_is_my_mac - check if the given mac address belongs to any of the real * batadv_is_my_mac() - check if the given mac address belongs to any of the
* interfaces in the current mesh * real interfaces in the current mesh
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @addr: the address to check * @addr: the address to check
* *
...@@ -286,7 +297,7 @@ bool batadv_is_my_mac(struct batadv_priv *bat_priv, const u8 *addr) ...@@ -286,7 +297,7 @@ bool batadv_is_my_mac(struct batadv_priv *bat_priv, const u8 *addr)
#ifdef CONFIG_BATMAN_ADV_DEBUGFS #ifdef CONFIG_BATMAN_ADV_DEBUGFS
/** /**
* batadv_seq_print_text_primary_if_get - called from debugfs table printing * batadv_seq_print_text_primary_if_get() - called from debugfs table printing
* function that requires the primary interface * function that requires the primary interface
* @seq: debugfs table seq_file struct * @seq: debugfs table seq_file struct
* *
...@@ -323,7 +334,7 @@ batadv_seq_print_text_primary_if_get(struct seq_file *seq) ...@@ -323,7 +334,7 @@ batadv_seq_print_text_primary_if_get(struct seq_file *seq)
#endif #endif
/** /**
* batadv_max_header_len - calculate maximum encapsulation overhead for a * batadv_max_header_len() - calculate maximum encapsulation overhead for a
* payload packet * payload packet
* *
* Return: the maximum encapsulation overhead in bytes. * Return: the maximum encapsulation overhead in bytes.
...@@ -348,7 +359,7 @@ int batadv_max_header_len(void) ...@@ -348,7 +359,7 @@ int batadv_max_header_len(void)
} }
/** /**
* batadv_skb_set_priority - sets skb priority according to packet content * batadv_skb_set_priority() - sets skb priority according to packet content
* @skb: the packet to be sent * @skb: the packet to be sent
* @offset: offset to the packet content * @offset: offset to the packet content
* *
...@@ -412,6 +423,16 @@ static int batadv_recv_unhandled_packet(struct sk_buff *skb, ...@@ -412,6 +423,16 @@ static int batadv_recv_unhandled_packet(struct sk_buff *skb,
/* incoming packets with the batman ethertype received on any active hard /* incoming packets with the batman ethertype received on any active hard
* interface * interface
*/ */
/**
* batadv_batman_skb_recv() - Handle incoming message from an hard interface
* @skb: the received packet
* @dev: the net device that the packet was received on
* @ptype: packet type of incoming packet (ETH_P_BATMAN)
* @orig_dev: the original receive net device (e.g. bonded device)
*
* Return: NET_RX_SUCCESS on success or NET_RX_DROP in case of failure
*/
int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev, int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *ptype, struct packet_type *ptype,
struct net_device *orig_dev) struct net_device *orig_dev)
...@@ -535,6 +556,13 @@ static void batadv_recv_handler_init(void) ...@@ -535,6 +556,13 @@ static void batadv_recv_handler_init(void)
batadv_rx_handler[BATADV_UNICAST_FRAG] = batadv_recv_frag_packet; batadv_rx_handler[BATADV_UNICAST_FRAG] = batadv_recv_frag_packet;
} }
/**
* batadv_recv_handler_register() - Register handler for batman-adv packet type
* @packet_type: batadv_packettype which should be handled
* @recv_handler: receive handler for the packet type
*
* Return: 0 on success or negative error number in case of failure
*/
int int
batadv_recv_handler_register(u8 packet_type, batadv_recv_handler_register(u8 packet_type,
int (*recv_handler)(struct sk_buff *, int (*recv_handler)(struct sk_buff *,
...@@ -552,13 +580,17 @@ batadv_recv_handler_register(u8 packet_type, ...@@ -552,13 +580,17 @@ batadv_recv_handler_register(u8 packet_type,
return 0; return 0;
} }
/**
* batadv_recv_handler_unregister() - Unregister handler for packet type
* @packet_type: batadv_packettype which should no longer be handled
*/
void batadv_recv_handler_unregister(u8 packet_type) void batadv_recv_handler_unregister(u8 packet_type)
{ {
batadv_rx_handler[packet_type] = batadv_recv_unhandled_packet; batadv_rx_handler[packet_type] = batadv_recv_unhandled_packet;
} }
/** /**
* batadv_skb_crc32 - calculate CRC32 of the whole packet and skip bytes in * batadv_skb_crc32() - calculate CRC32 of the whole packet and skip bytes in
* the header * the header
* @skb: skb pointing to fragmented socket buffers * @skb: skb pointing to fragmented socket buffers
* @payload_ptr: Pointer to position inside the head buffer of the skb * @payload_ptr: Pointer to position inside the head buffer of the skb
...@@ -591,7 +623,7 @@ __be32 batadv_skb_crc32(struct sk_buff *skb, u8 *payload_ptr) ...@@ -591,7 +623,7 @@ __be32 batadv_skb_crc32(struct sk_buff *skb, u8 *payload_ptr)
} }
/** /**
* batadv_get_vid - extract the VLAN identifier from skb if any * batadv_get_vid() - extract the VLAN identifier from skb if any
* @skb: the buffer containing the packet * @skb: the buffer containing the packet
* @header_len: length of the batman header preceding the ethernet header * @header_len: length of the batman header preceding the ethernet header
* *
...@@ -618,7 +650,7 @@ unsigned short batadv_get_vid(struct sk_buff *skb, size_t header_len) ...@@ -618,7 +650,7 @@ unsigned short batadv_get_vid(struct sk_buff *skb, size_t header_len)
} }
/** /**
* batadv_vlan_ap_isola_get - return the AP isolation status for the given vlan * batadv_vlan_ap_isola_get() - return AP isolation status for the given vlan
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @vid: the VLAN identifier for which the AP isolation attributed as to be * @vid: the VLAN identifier for which the AP isolation attributed as to be
* looked up * looked up
......
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
...@@ -24,7 +25,7 @@ ...@@ -24,7 +25,7 @@
#define BATADV_DRIVER_DEVICE "batman-adv" #define BATADV_DRIVER_DEVICE "batman-adv"
#ifndef BATADV_SOURCE_VERSION #ifndef BATADV_SOURCE_VERSION
#define BATADV_SOURCE_VERSION "2017.4" #define BATADV_SOURCE_VERSION "2018.0"
#endif #endif
/* B.A.T.M.A.N. parameters */ /* B.A.T.M.A.N. parameters */
...@@ -140,24 +141,56 @@ ...@@ -140,24 +141,56 @@
*/ */
#define BATADV_TP_MAX_NUM 5 #define BATADV_TP_MAX_NUM 5
/**
* enum batadv_mesh_state - State of a soft interface
*/
enum batadv_mesh_state { enum batadv_mesh_state {
/** @BATADV_MESH_INACTIVE: soft interface is not yet running */
BATADV_MESH_INACTIVE, BATADV_MESH_INACTIVE,
/** @BATADV_MESH_ACTIVE: interface is up and running */
BATADV_MESH_ACTIVE, BATADV_MESH_ACTIVE,
/** @BATADV_MESH_DEACTIVATING: interface is getting shut down */
BATADV_MESH_DEACTIVATING, BATADV_MESH_DEACTIVATING,
}; };
#define BATADV_BCAST_QUEUE_LEN 256 #define BATADV_BCAST_QUEUE_LEN 256
#define BATADV_BATMAN_QUEUE_LEN 256 #define BATADV_BATMAN_QUEUE_LEN 256
/**
* enum batadv_uev_action - action type of uevent
*/
enum batadv_uev_action { enum batadv_uev_action {
/** @BATADV_UEV_ADD: gateway was selected (after none was selected) */
BATADV_UEV_ADD = 0, BATADV_UEV_ADD = 0,
/**
* @BATADV_UEV_DEL: selected gateway was removed and none is selected
* anymore
*/
BATADV_UEV_DEL, BATADV_UEV_DEL,
/**
* @BATADV_UEV_CHANGE: a different gateway was selected as based gateway
*/
BATADV_UEV_CHANGE, BATADV_UEV_CHANGE,
/**
* @BATADV_UEV_LOOPDETECT: loop was detected which cannot be handled by
* bridge loop avoidance
*/
BATADV_UEV_LOOPDETECT, BATADV_UEV_LOOPDETECT,
}; };
/**
* enum batadv_uev_type - Type of uevent
*/
enum batadv_uev_type { enum batadv_uev_type {
/** @BATADV_UEV_GW: selected gateway was modified */
BATADV_UEV_GW = 0, BATADV_UEV_GW = 0,
/** @BATADV_UEV_BLA: bridge loop avoidance event */
BATADV_UEV_BLA, BATADV_UEV_BLA,
}; };
...@@ -202,7 +235,7 @@ struct seq_file; ...@@ -202,7 +235,7 @@ struct seq_file;
struct sk_buff; struct sk_buff;
/** /**
* batadv_print_vid - return printable version of vid information * batadv_print_vid() - return printable version of vid information
* @vid: the VLAN identifier * @vid: the VLAN identifier
* *
* Return: -1 when no VLAN is used, VLAN id otherwise * Return: -1 when no VLAN is used, VLAN id otherwise
...@@ -238,7 +271,7 @@ void batadv_recv_handler_unregister(u8 packet_type); ...@@ -238,7 +271,7 @@ void batadv_recv_handler_unregister(u8 packet_type);
__be32 batadv_skb_crc32(struct sk_buff *skb, u8 *payload_ptr); __be32 batadv_skb_crc32(struct sk_buff *skb, u8 *payload_ptr);
/** /**
* batadv_compare_eth - Compare two not u16 aligned Ethernet addresses * batadv_compare_eth() - Compare two not u16 aligned Ethernet addresses
* @data1: Pointer to a six-byte array containing the Ethernet address * @data1: Pointer to a six-byte array containing the Ethernet address
* @data2: Pointer other six-byte array containing the Ethernet address * @data2: Pointer other six-byte array containing the Ethernet address
* *
...@@ -252,7 +285,7 @@ static inline bool batadv_compare_eth(const void *data1, const void *data2) ...@@ -252,7 +285,7 @@ static inline bool batadv_compare_eth(const void *data1, const void *data2)
} }
/** /**
* batadv_has_timed_out - compares current time (jiffies) and timestamp + * batadv_has_timed_out() - compares current time (jiffies) and timestamp +
* timeout * timeout
* @timestamp: base value to compare with (in jiffies) * @timestamp: base value to compare with (in jiffies)
* @timeout: added to base value before comparing (in milliseconds) * @timeout: added to base value before comparing (in milliseconds)
...@@ -265,40 +298,96 @@ static inline bool batadv_has_timed_out(unsigned long timestamp, ...@@ -265,40 +298,96 @@ static inline bool batadv_has_timed_out(unsigned long timestamp,
return time_is_before_jiffies(timestamp + msecs_to_jiffies(timeout)); return time_is_before_jiffies(timestamp + msecs_to_jiffies(timeout));
} }
/**
* batadv_atomic_dec_not_zero() - Decrease unless the number is 0
* @v: pointer of type atomic_t
*
* Return: non-zero if v was not 0, and zero otherwise.
*/
#define batadv_atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0) #define batadv_atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0)
/* Returns the smallest signed integer in two's complement with the sizeof x */ /**
* batadv_smallest_signed_int() - Returns the smallest signed integer in two's
* complement with the sizeof x
* @x: type of integer
*
* Return: smallest signed integer of type
*/
#define batadv_smallest_signed_int(x) (1u << (7u + 8u * (sizeof(x) - 1u))) #define batadv_smallest_signed_int(x) (1u << (7u + 8u * (sizeof(x) - 1u)))
/* Checks if a sequence number x is a predecessor/successor of y. /**
* they handle overflows/underflows and can correctly check for a * batadv_seq_before() - Checks if a sequence number x is a predecessor of y
* predecessor/successor unless the variable sequence number has grown by * @x: potential predecessor of @y
* more then 2**(bitwidth(x)-1)-1. * @y: value to compare @x against
*
* It handles overflows/underflows and can correctly check for a predecessor
* unless the variable sequence number has grown by more then
* 2**(bitwidth(x)-1)-1.
*
* This means that for a u8 with the maximum value 255, it would think: * This means that for a u8 with the maximum value 255, it would think:
* - when adding nothing - it is neither a predecessor nor a successor *
* - before adding more than 127 to the starting value - it is a predecessor, * * when adding nothing - it is neither a predecessor nor a successor
* - when adding 128 - it is neither a predecessor nor a successor, * * before adding more than 127 to the starting value - it is a predecessor,
* - after adding more than 127 to the starting value - it is a successor * * when adding 128 - it is neither a predecessor nor a successor,
* * after adding more than 127 to the starting value - it is a successor
*
* Return: true when x is a predecessor of y, false otherwise
*/ */
#define batadv_seq_before(x, y) ({typeof(x)_d1 = (x); \ #define batadv_seq_before(x, y) ({typeof(x)_d1 = (x); \
typeof(y)_d2 = (y); \ typeof(y)_d2 = (y); \
typeof(x)_dummy = (_d1 - _d2); \ typeof(x)_dummy = (_d1 - _d2); \
(void)(&_d1 == &_d2); \ (void)(&_d1 == &_d2); \
_dummy > batadv_smallest_signed_int(_dummy); }) _dummy > batadv_smallest_signed_int(_dummy); })
/**
* batadv_seq_after() - Checks if a sequence number x is a successor of y
* @x: potential sucessor of @y
* @y: value to compare @x against
*
* It handles overflows/underflows and can correctly check for a successor
* unless the variable sequence number has grown by more then
* 2**(bitwidth(x)-1)-1.
*
* This means that for a u8 with the maximum value 255, it would think:
*
* * when adding nothing - it is neither a predecessor nor a successor
* * before adding more than 127 to the starting value - it is a predecessor,
* * when adding 128 - it is neither a predecessor nor a successor,
* * after adding more than 127 to the starting value - it is a successor
*
* Return: true when x is a successor of y, false otherwise
*/
#define batadv_seq_after(x, y) batadv_seq_before(y, x) #define batadv_seq_after(x, y) batadv_seq_before(y, x)
/* Stop preemption on local cpu while incrementing the counter */ /**
* batadv_add_counter() - Add to per cpu statistics counter of soft interface
* @bat_priv: the bat priv with all the soft interface information
* @idx: counter index which should be modified
* @count: value to increase counter by
*
* Stop preemption on local cpu while incrementing the counter
*/
static inline void batadv_add_counter(struct batadv_priv *bat_priv, size_t idx, static inline void batadv_add_counter(struct batadv_priv *bat_priv, size_t idx,
size_t count) size_t count)
{ {
this_cpu_add(bat_priv->bat_counters[idx], count); this_cpu_add(bat_priv->bat_counters[idx], count);
} }
/**
* batadv_inc_counter() - Increase per cpu statistics counter of soft interface
* @b: the bat priv with all the soft interface information
* @i: counter index which should be modified
*/
#define batadv_inc_counter(b, i) batadv_add_counter(b, i, 1) #define batadv_inc_counter(b, i) batadv_add_counter(b, i, 1)
/* Define a macro to reach the control buffer of the skb. The members of the /**
* control buffer are defined in struct batadv_skb_cb in types.h. * BATADV_SKB_CB() - Get batadv_skb_cb from skb control buffer
* The macro is inspired by the similar macro TCP_SKB_CB() in tcp.h. * @__skb: skb holding the control buffer
*
* The members of the control buffer are defined in struct batadv_skb_cb in
* types.h. The macro is inspired by the similar macro TCP_SKB_CB() in tcp.h.
*
* Return: pointer to the batadv_skb_cb of the skb
*/ */
#define BATADV_SKB_CB(__skb) ((struct batadv_skb_cb *)&((__skb)->cb[0])) #define BATADV_SKB_CB(__skb) ((struct batadv_skb_cb *)&((__skb)->cb[0]))
......
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2014-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2014-2017 B.A.T.M.A.N. contributors:
* *
* Linus Lüssing * Linus Lüssing
...@@ -25,15 +26,21 @@ struct sk_buff; ...@@ -25,15 +26,21 @@ struct sk_buff;
/** /**
* enum batadv_forw_mode - the way a packet should be forwarded as * enum batadv_forw_mode - the way a packet should be forwarded as
* @BATADV_FORW_ALL: forward the packet to all nodes (currently via classic
* flooding)
* @BATADV_FORW_SINGLE: forward the packet to a single node (currently via the
* BATMAN unicast routing protocol)
* @BATADV_FORW_NONE: don't forward, drop it
*/ */
enum batadv_forw_mode { enum batadv_forw_mode {
/**
* @BATADV_FORW_ALL: forward the packet to all nodes (currently via
* classic flooding)
*/
BATADV_FORW_ALL, BATADV_FORW_ALL,
/**
* @BATADV_FORW_SINGLE: forward the packet to a single node (currently
* via the BATMAN unicast routing protocol)
*/
BATADV_FORW_SINGLE, BATADV_FORW_SINGLE,
/** @BATADV_FORW_NONE: don't forward, drop it */
BATADV_FORW_NONE, BATADV_FORW_NONE,
}; };
......
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2016-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2016-2017 B.A.T.M.A.N. contributors:
* *
* Matthias Schiffer * Matthias Schiffer
...@@ -23,8 +24,8 @@ ...@@ -23,8 +24,8 @@
#include <linux/cache.h> #include <linux/cache.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/export.h> #include <linux/export.h>
#include <linux/fs.h>
#include <linux/genetlink.h> #include <linux/genetlink.h>
#include <linux/gfp.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -99,7 +100,7 @@ static const struct nla_policy batadv_netlink_policy[NUM_BATADV_ATTR] = { ...@@ -99,7 +100,7 @@ static const struct nla_policy batadv_netlink_policy[NUM_BATADV_ATTR] = {
}; };
/** /**
* batadv_netlink_get_ifindex - Extract an interface index from a message * batadv_netlink_get_ifindex() - Extract an interface index from a message
* @nlh: Message header * @nlh: Message header
* @attrtype: Attribute which holds an interface index * @attrtype: Attribute which holds an interface index
* *
...@@ -114,7 +115,7 @@ batadv_netlink_get_ifindex(const struct nlmsghdr *nlh, int attrtype) ...@@ -114,7 +115,7 @@ batadv_netlink_get_ifindex(const struct nlmsghdr *nlh, int attrtype)
} }
/** /**
* batadv_netlink_mesh_info_put - fill in generic information about mesh * batadv_netlink_mesh_info_put() - fill in generic information about mesh
* interface * interface
* @msg: netlink message to be sent back * @msg: netlink message to be sent back
* @soft_iface: interface for which the data should be taken * @soft_iface: interface for which the data should be taken
...@@ -169,7 +170,7 @@ batadv_netlink_mesh_info_put(struct sk_buff *msg, struct net_device *soft_iface) ...@@ -169,7 +170,7 @@ batadv_netlink_mesh_info_put(struct sk_buff *msg, struct net_device *soft_iface)
} }
/** /**
* batadv_netlink_get_mesh_info - handle incoming BATADV_CMD_GET_MESH_INFO * batadv_netlink_get_mesh_info() - handle incoming BATADV_CMD_GET_MESH_INFO
* netlink request * netlink request
* @skb: received netlink message * @skb: received netlink message
* @info: receiver information * @info: receiver information
...@@ -230,7 +231,7 @@ batadv_netlink_get_mesh_info(struct sk_buff *skb, struct genl_info *info) ...@@ -230,7 +231,7 @@ batadv_netlink_get_mesh_info(struct sk_buff *skb, struct genl_info *info)
} }
/** /**
* batadv_netlink_tp_meter_put - Fill information of started tp_meter session * batadv_netlink_tp_meter_put() - Fill information of started tp_meter session
* @msg: netlink message to be sent back * @msg: netlink message to be sent back
* @cookie: tp meter session cookie * @cookie: tp meter session cookie
* *
...@@ -246,7 +247,7 @@ batadv_netlink_tp_meter_put(struct sk_buff *msg, u32 cookie) ...@@ -246,7 +247,7 @@ batadv_netlink_tp_meter_put(struct sk_buff *msg, u32 cookie)
} }
/** /**
* batadv_netlink_tpmeter_notify - send tp_meter result via netlink to client * batadv_netlink_tpmeter_notify() - send tp_meter result via netlink to client
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @dst: destination of tp_meter session * @dst: destination of tp_meter session
* @result: reason for tp meter session stop * @result: reason for tp meter session stop
...@@ -309,7 +310,7 @@ int batadv_netlink_tpmeter_notify(struct batadv_priv *bat_priv, const u8 *dst, ...@@ -309,7 +310,7 @@ int batadv_netlink_tpmeter_notify(struct batadv_priv *bat_priv, const u8 *dst,
} }
/** /**
* batadv_netlink_tp_meter_start - Start a new tp_meter session * batadv_netlink_tp_meter_start() - Start a new tp_meter session
* @skb: received netlink message * @skb: received netlink message
* @info: receiver information * @info: receiver information
* *
...@@ -386,7 +387,7 @@ batadv_netlink_tp_meter_start(struct sk_buff *skb, struct genl_info *info) ...@@ -386,7 +387,7 @@ batadv_netlink_tp_meter_start(struct sk_buff *skb, struct genl_info *info)
} }
/** /**
* batadv_netlink_tp_meter_start - Cancel a running tp_meter session * batadv_netlink_tp_meter_start() - Cancel a running tp_meter session
* @skb: received netlink message * @skb: received netlink message
* @info: receiver information * @info: receiver information
* *
...@@ -431,7 +432,7 @@ batadv_netlink_tp_meter_cancel(struct sk_buff *skb, struct genl_info *info) ...@@ -431,7 +432,7 @@ batadv_netlink_tp_meter_cancel(struct sk_buff *skb, struct genl_info *info)
} }
/** /**
* batadv_netlink_dump_hardif_entry - Dump one hard interface into a message * batadv_netlink_dump_hardif_entry() - Dump one hard interface into a message
* @msg: Netlink message to dump into * @msg: Netlink message to dump into
* @portid: Port making netlink request * @portid: Port making netlink request
* @seq: Sequence number of netlink message * @seq: Sequence number of netlink message
...@@ -473,7 +474,7 @@ batadv_netlink_dump_hardif_entry(struct sk_buff *msg, u32 portid, u32 seq, ...@@ -473,7 +474,7 @@ batadv_netlink_dump_hardif_entry(struct sk_buff *msg, u32 portid, u32 seq,
} }
/** /**
* batadv_netlink_dump_hardifs - Dump all hard interface into a messages * batadv_netlink_dump_hardifs() - Dump all hard interface into a messages
* @msg: Netlink message to dump into * @msg: Netlink message to dump into
* @cb: Parameters from query * @cb: Parameters from query
* *
...@@ -620,7 +621,7 @@ struct genl_family batadv_netlink_family __ro_after_init = { ...@@ -620,7 +621,7 @@ struct genl_family batadv_netlink_family __ro_after_init = {
}; };
/** /**
* batadv_netlink_register - register batadv genl netlink family * batadv_netlink_register() - register batadv genl netlink family
*/ */
void __init batadv_netlink_register(void) void __init batadv_netlink_register(void)
{ {
...@@ -632,7 +633,7 @@ void __init batadv_netlink_register(void) ...@@ -632,7 +633,7 @@ void __init batadv_netlink_register(void)
} }
/** /**
* batadv_netlink_unregister - unregister batadv genl netlink family * batadv_netlink_unregister() - unregister batadv genl netlink family
*/ */
void batadv_netlink_unregister(void) void batadv_netlink_unregister(void)
{ {
......
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2016-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2016-2017 B.A.T.M.A.N. contributors:
* *
* Matthias Schiffer * Matthias Schiffer
......
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2012-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2012-2017 B.A.T.M.A.N. contributors:
* *
* Martin Hundebøll, Jeppe Ledet-Pedersen * Martin Hundebøll, Jeppe Ledet-Pedersen
......
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
...@@ -23,14 +24,8 @@ ...@@ -23,14 +24,8 @@
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/jhash.h> #include <linux/jhash.h>
#include <linux/kref.h>
#include <linux/rculist.h>
#include <linux/rcupdate.h>
#include <linux/stddef.h>
#include <linux/types.h> #include <linux/types.h>
#include "hash.h"
struct netlink_callback; struct netlink_callback;
struct seq_file; struct seq_file;
struct sk_buff; struct sk_buff;
...@@ -89,8 +84,13 @@ batadv_orig_node_vlan_get(struct batadv_orig_node *orig_node, ...@@ -89,8 +84,13 @@ batadv_orig_node_vlan_get(struct batadv_orig_node *orig_node,
unsigned short vid); unsigned short vid);
void batadv_orig_node_vlan_put(struct batadv_orig_node_vlan *orig_vlan); void batadv_orig_node_vlan_put(struct batadv_orig_node_vlan *orig_vlan);
/* hashfunction to choose an entry in a hash table of given size /**
* hash algorithm from http://en.wikipedia.org/wiki/Hash_table * batadv_choose_orig() - Return the index of the orig entry in the hash table
* @data: mac address of the originator node
* @size: the size of the hash table
*
* Return: the hash index where the object represented by @data should be
* stored at.
*/ */
static inline u32 batadv_choose_orig(const void *data, u32 size) static inline u32 batadv_choose_orig(const void *data, u32 size)
{ {
...@@ -100,34 +100,7 @@ static inline u32 batadv_choose_orig(const void *data, u32 size) ...@@ -100,34 +100,7 @@ static inline u32 batadv_choose_orig(const void *data, u32 size)
return hash % size; return hash % size;
} }
static inline struct batadv_orig_node * struct batadv_orig_node *
batadv_orig_hash_find(struct batadv_priv *bat_priv, const void *data) batadv_orig_hash_find(struct batadv_priv *bat_priv, const void *data);
{
struct batadv_hashtable *hash = bat_priv->orig_hash;
struct hlist_head *head;
struct batadv_orig_node *orig_node, *orig_node_tmp = NULL;
int index;
if (!hash)
return NULL;
index = batadv_choose_orig(data, hash->size);
head = &hash->table[index];
rcu_read_lock();
hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
if (!batadv_compare_eth(orig_node, data))
continue;
if (!kref_get_unless_zero(&orig_node->refcount))
continue;
orig_node_tmp = orig_node;
break;
}
rcu_read_unlock();
return orig_node_tmp;
}
#endif /* _NET_BATMAN_ADV_ORIGINATOR_H_ */ #endif /* _NET_BATMAN_ADV_ORIGINATOR_H_ */
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
...@@ -21,6 +22,12 @@ ...@@ -21,6 +22,12 @@
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <linux/types.h> #include <linux/types.h>
/**
* batadv_tp_is_error() - Check throughput meter return code for error
* @n: throughput meter return code
*
* Return: 0 when not error was detected, != 0 otherwise
*/
#define batadv_tp_is_error(n) ((u8)(n) > 127 ? 1 : 0) #define batadv_tp_is_error(n) ((u8)(n) > 127 ? 1 : 0)
/** /**
...@@ -88,7 +95,15 @@ enum batadv_iv_flags { ...@@ -88,7 +95,15 @@ enum batadv_iv_flags {
BATADV_DIRECTLINK = BIT(2), BATADV_DIRECTLINK = BIT(2),
}; };
/* ICMP message types */ /**
* enum batadv_icmp_packettype - ICMP message types
* @BATADV_ECHO_REPLY: success reply to BATADV_ECHO_REQUEST
* @BATADV_DESTINATION_UNREACHABLE: failure when route to destination not found
* @BATADV_ECHO_REQUEST: request BATADV_ECHO_REPLY from destination
* @BATADV_TTL_EXCEEDED: error after BATADV_ECHO_REQUEST traversed too many hops
* @BATADV_PARAMETER_PROBLEM: return code for malformed messages
* @BATADV_TP: throughput meter packet
*/
enum batadv_icmp_packettype { enum batadv_icmp_packettype {
BATADV_ECHO_REPLY = 0, BATADV_ECHO_REPLY = 0,
BATADV_DESTINATION_UNREACHABLE = 3, BATADV_DESTINATION_UNREACHABLE = 3,
...@@ -136,7 +151,14 @@ enum batadv_vlan_flags { ...@@ -136,7 +151,14 @@ enum batadv_vlan_flags {
BATADV_VLAN_HAS_TAG = BIT(15), BATADV_VLAN_HAS_TAG = BIT(15),
}; };
/* claim frame types for the bridge loop avoidance */ /**
* enum batadv_bla_claimframe - claim frame types for the bridge loop avoidance
* @BATADV_CLAIM_TYPE_CLAIM: claim of a client mac address
* @BATADV_CLAIM_TYPE_UNCLAIM: unclaim of a client mac address
* @BATADV_CLAIM_TYPE_ANNOUNCE: announcement of backbone with current crc
* @BATADV_CLAIM_TYPE_REQUEST: request of full claim table
* @BATADV_CLAIM_TYPE_LOOPDETECT: mesh-traversing loop detect packet
*/
enum batadv_bla_claimframe { enum batadv_bla_claimframe {
BATADV_CLAIM_TYPE_CLAIM = 0x00, BATADV_CLAIM_TYPE_CLAIM = 0x00,
BATADV_CLAIM_TYPE_UNCLAIM = 0x01, BATADV_CLAIM_TYPE_UNCLAIM = 0x01,
......
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
...@@ -54,7 +55,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb, ...@@ -54,7 +55,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
struct batadv_hard_iface *recv_if); struct batadv_hard_iface *recv_if);
/** /**
* _batadv_update_route - set the router for this originator * _batadv_update_route() - set the router for this originator
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @orig_node: orig node which is to be configured * @orig_node: orig node which is to be configured
* @recv_if: the receive interface for which this route is set * @recv_if: the receive interface for which this route is set
...@@ -118,7 +119,7 @@ static void _batadv_update_route(struct batadv_priv *bat_priv, ...@@ -118,7 +119,7 @@ static void _batadv_update_route(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_update_route - set the router for this originator * batadv_update_route() - set the router for this originator
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @orig_node: orig node which is to be configured * @orig_node: orig node which is to be configured
* @recv_if: the receive interface for which this route is set * @recv_if: the receive interface for which this route is set
...@@ -145,7 +146,7 @@ void batadv_update_route(struct batadv_priv *bat_priv, ...@@ -145,7 +146,7 @@ void batadv_update_route(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_window_protected - checks whether the host restarted and is in the * batadv_window_protected() - checks whether the host restarted and is in the
* protection time. * protection time.
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @seq_num_diff: difference between the current/received sequence number and * @seq_num_diff: difference between the current/received sequence number and
...@@ -180,6 +181,14 @@ bool batadv_window_protected(struct batadv_priv *bat_priv, s32 seq_num_diff, ...@@ -180,6 +181,14 @@ bool batadv_window_protected(struct batadv_priv *bat_priv, s32 seq_num_diff,
return false; return false;
} }
/**
* batadv_check_management_packet() - Check preconditions for management packets
* @skb: incoming packet buffer
* @hard_iface: incoming hard interface
* @header_len: minimal header length of packet type
*
* Return: true when management preconditions are met, false otherwise
*/
bool batadv_check_management_packet(struct sk_buff *skb, bool batadv_check_management_packet(struct sk_buff *skb,
struct batadv_hard_iface *hard_iface, struct batadv_hard_iface *hard_iface,
int header_len) int header_len)
...@@ -212,7 +221,7 @@ bool batadv_check_management_packet(struct sk_buff *skb, ...@@ -212,7 +221,7 @@ bool batadv_check_management_packet(struct sk_buff *skb,
} }
/** /**
* batadv_recv_my_icmp_packet - receive an icmp packet locally * batadv_recv_my_icmp_packet() - receive an icmp packet locally
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @skb: icmp packet to process * @skb: icmp packet to process
* *
...@@ -347,6 +356,13 @@ static int batadv_recv_icmp_ttl_exceeded(struct batadv_priv *bat_priv, ...@@ -347,6 +356,13 @@ static int batadv_recv_icmp_ttl_exceeded(struct batadv_priv *bat_priv,
return ret; return ret;
} }
/**
* batadv_recv_icmp_packet() - Process incoming icmp packet
* @skb: incoming packet buffer
* @recv_if: incoming hard interface
*
* Return: NET_RX_SUCCESS on success or NET_RX_DROP in case of failure
*/
int batadv_recv_icmp_packet(struct sk_buff *skb, int batadv_recv_icmp_packet(struct sk_buff *skb,
struct batadv_hard_iface *recv_if) struct batadv_hard_iface *recv_if)
{ {
...@@ -440,7 +456,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb, ...@@ -440,7 +456,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb,
} }
/** /**
* batadv_check_unicast_packet - Check for malformed unicast packets * batadv_check_unicast_packet() - Check for malformed unicast packets
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @skb: packet to check * @skb: packet to check
* @hdr_size: size of header to pull * @hdr_size: size of header to pull
...@@ -478,7 +494,7 @@ static int batadv_check_unicast_packet(struct batadv_priv *bat_priv, ...@@ -478,7 +494,7 @@ static int batadv_check_unicast_packet(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_last_bonding_get - Get last_bonding_candidate of orig_node * batadv_last_bonding_get() - Get last_bonding_candidate of orig_node
* @orig_node: originator node whose last bonding candidate should be retrieved * @orig_node: originator node whose last bonding candidate should be retrieved
* *
* Return: last bonding candidate of router or NULL if not found * Return: last bonding candidate of router or NULL if not found
...@@ -501,7 +517,7 @@ batadv_last_bonding_get(struct batadv_orig_node *orig_node) ...@@ -501,7 +517,7 @@ batadv_last_bonding_get(struct batadv_orig_node *orig_node)
} }
/** /**
* batadv_last_bonding_replace - Replace last_bonding_candidate of orig_node * batadv_last_bonding_replace() - Replace last_bonding_candidate of orig_node
* @orig_node: originator node whose bonding candidates should be replaced * @orig_node: originator node whose bonding candidates should be replaced
* @new_candidate: new bonding candidate or NULL * @new_candidate: new bonding candidate or NULL
*/ */
...@@ -524,7 +540,7 @@ batadv_last_bonding_replace(struct batadv_orig_node *orig_node, ...@@ -524,7 +540,7 @@ batadv_last_bonding_replace(struct batadv_orig_node *orig_node,
} }
/** /**
* batadv_find_router - find a suitable router for this originator * batadv_find_router() - find a suitable router for this originator
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @orig_node: the destination node * @orig_node: the destination node
* @recv_if: pointer to interface this packet was received on * @recv_if: pointer to interface this packet was received on
...@@ -741,7 +757,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb, ...@@ -741,7 +757,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
} }
/** /**
* batadv_reroute_unicast_packet - update the unicast header for re-routing * batadv_reroute_unicast_packet() - update the unicast header for re-routing
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @unicast_packet: the unicast header to be updated * @unicast_packet: the unicast header to be updated
* @dst_addr: the payload destination * @dst_addr: the payload destination
...@@ -904,7 +920,7 @@ static bool batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, ...@@ -904,7 +920,7 @@ static bool batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_recv_unhandled_unicast_packet - receive and process packets which * batadv_recv_unhandled_unicast_packet() - receive and process packets which
* are in the unicast number space but not yet known to the implementation * are in the unicast number space but not yet known to the implementation
* @skb: unicast tvlv packet to process * @skb: unicast tvlv packet to process
* @recv_if: pointer to interface this packet was received on * @recv_if: pointer to interface this packet was received on
...@@ -935,6 +951,13 @@ int batadv_recv_unhandled_unicast_packet(struct sk_buff *skb, ...@@ -935,6 +951,13 @@ int batadv_recv_unhandled_unicast_packet(struct sk_buff *skb,
return NET_RX_DROP; return NET_RX_DROP;
} }
/**
* batadv_recv_unicast_packet() - Process incoming unicast packet
* @skb: incoming packet buffer
* @recv_if: incoming hard interface
*
* Return: NET_RX_SUCCESS on success or NET_RX_DROP in case of failure
*/
int batadv_recv_unicast_packet(struct sk_buff *skb, int batadv_recv_unicast_packet(struct sk_buff *skb,
struct batadv_hard_iface *recv_if) struct batadv_hard_iface *recv_if)
{ {
...@@ -1036,7 +1059,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, ...@@ -1036,7 +1059,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb,
} }
/** /**
* batadv_recv_unicast_tvlv - receive and process unicast tvlv packets * batadv_recv_unicast_tvlv() - receive and process unicast tvlv packets
* @skb: unicast tvlv packet to process * @skb: unicast tvlv packet to process
* @recv_if: pointer to interface this packet was received on * @recv_if: pointer to interface this packet was received on
* *
...@@ -1090,7 +1113,7 @@ int batadv_recv_unicast_tvlv(struct sk_buff *skb, ...@@ -1090,7 +1113,7 @@ int batadv_recv_unicast_tvlv(struct sk_buff *skb,
} }
/** /**
* batadv_recv_frag_packet - process received fragment * batadv_recv_frag_packet() - process received fragment
* @skb: the received fragment * @skb: the received fragment
* @recv_if: interface that the skb is received on * @recv_if: interface that the skb is received on
* *
...@@ -1155,6 +1178,13 @@ int batadv_recv_frag_packet(struct sk_buff *skb, ...@@ -1155,6 +1178,13 @@ int batadv_recv_frag_packet(struct sk_buff *skb,
return ret; return ret;
} }
/**
* batadv_recv_bcast_packet() - Process incoming broadcast packet
* @skb: incoming packet buffer
* @recv_if: incoming hard interface
*
* Return: NET_RX_SUCCESS on success or NET_RX_DROP in case of failure
*/
int batadv_recv_bcast_packet(struct sk_buff *skb, int batadv_recv_bcast_packet(struct sk_buff *skb,
struct batadv_hard_iface *recv_if) struct batadv_hard_iface *recv_if)
{ {
......
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
......
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
...@@ -23,7 +24,7 @@ ...@@ -23,7 +24,7 @@
#include <linux/byteorder/generic.h> #include <linux/byteorder/generic.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/fs.h> #include <linux/gfp.h>
#include <linux/if.h> #include <linux/if.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
...@@ -54,7 +55,7 @@ ...@@ -54,7 +55,7 @@
static void batadv_send_outstanding_bcast_packet(struct work_struct *work); static void batadv_send_outstanding_bcast_packet(struct work_struct *work);
/** /**
* batadv_send_skb_packet - send an already prepared packet * batadv_send_skb_packet() - send an already prepared packet
* @skb: the packet to send * @skb: the packet to send
* @hard_iface: the interface to use to send the broadcast packet * @hard_iface: the interface to use to send the broadcast packet
* @dst_addr: the payload destination * @dst_addr: the payload destination
...@@ -123,12 +124,30 @@ int batadv_send_skb_packet(struct sk_buff *skb, ...@@ -123,12 +124,30 @@ int batadv_send_skb_packet(struct sk_buff *skb,
return NET_XMIT_DROP; return NET_XMIT_DROP;
} }
/**
* batadv_send_broadcast_skb() - Send broadcast packet via hard interface
* @skb: packet to be transmitted (with batadv header and no outer eth header)
* @hard_iface: outgoing interface
*
* Return: A negative errno code is returned on a failure. A success does not
* guarantee the frame will be transmitted as it may be dropped due
* to congestion or traffic shaping.
*/
int batadv_send_broadcast_skb(struct sk_buff *skb, int batadv_send_broadcast_skb(struct sk_buff *skb,
struct batadv_hard_iface *hard_iface) struct batadv_hard_iface *hard_iface)
{ {
return batadv_send_skb_packet(skb, hard_iface, batadv_broadcast_addr); return batadv_send_skb_packet(skb, hard_iface, batadv_broadcast_addr);
} }
/**
* batadv_send_unicast_skb() - Send unicast packet to neighbor
* @skb: packet to be transmitted (with batadv header and no outer eth header)
* @neigh: neighbor which is used as next hop to destination
*
* Return: A negative errno code is returned on a failure. A success does not
* guarantee the frame will be transmitted as it may be dropped due
* to congestion or traffic shaping.
*/
int batadv_send_unicast_skb(struct sk_buff *skb, int batadv_send_unicast_skb(struct sk_buff *skb,
struct batadv_neigh_node *neigh) struct batadv_neigh_node *neigh)
{ {
...@@ -153,7 +172,7 @@ int batadv_send_unicast_skb(struct sk_buff *skb, ...@@ -153,7 +172,7 @@ int batadv_send_unicast_skb(struct sk_buff *skb,
} }
/** /**
* batadv_send_skb_to_orig - Lookup next-hop and transmit skb. * batadv_send_skb_to_orig() - Lookup next-hop and transmit skb.
* @skb: Packet to be transmitted. * @skb: Packet to be transmitted.
* @orig_node: Final destination of the packet. * @orig_node: Final destination of the packet.
* @recv_if: Interface used when receiving the packet (can be NULL). * @recv_if: Interface used when receiving the packet (can be NULL).
...@@ -216,7 +235,7 @@ int batadv_send_skb_to_orig(struct sk_buff *skb, ...@@ -216,7 +235,7 @@ int batadv_send_skb_to_orig(struct sk_buff *skb,
} }
/** /**
* batadv_send_skb_push_fill_unicast - extend the buffer and initialize the * batadv_send_skb_push_fill_unicast() - extend the buffer and initialize the
* common fields for unicast packets * common fields for unicast packets
* @skb: the skb carrying the unicast header to initialize * @skb: the skb carrying the unicast header to initialize
* @hdr_size: amount of bytes to push at the beginning of the skb * @hdr_size: amount of bytes to push at the beginning of the skb
...@@ -249,7 +268,7 @@ batadv_send_skb_push_fill_unicast(struct sk_buff *skb, int hdr_size, ...@@ -249,7 +268,7 @@ batadv_send_skb_push_fill_unicast(struct sk_buff *skb, int hdr_size,
} }
/** /**
* batadv_send_skb_prepare_unicast - encapsulate an skb with a unicast header * batadv_send_skb_prepare_unicast() - encapsulate an skb with a unicast header
* @skb: the skb containing the payload to encapsulate * @skb: the skb containing the payload to encapsulate
* @orig_node: the destination node * @orig_node: the destination node
* *
...@@ -264,7 +283,7 @@ static bool batadv_send_skb_prepare_unicast(struct sk_buff *skb, ...@@ -264,7 +283,7 @@ static bool batadv_send_skb_prepare_unicast(struct sk_buff *skb,
} }
/** /**
* batadv_send_skb_prepare_unicast_4addr - encapsulate an skb with a * batadv_send_skb_prepare_unicast_4addr() - encapsulate an skb with a
* unicast 4addr header * unicast 4addr header
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @skb: the skb containing the payload to encapsulate * @skb: the skb containing the payload to encapsulate
...@@ -308,7 +327,7 @@ bool batadv_send_skb_prepare_unicast_4addr(struct batadv_priv *bat_priv, ...@@ -308,7 +327,7 @@ bool batadv_send_skb_prepare_unicast_4addr(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_send_skb_unicast - encapsulate and send an skb via unicast * batadv_send_skb_unicast() - encapsulate and send an skb via unicast
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @skb: payload to send * @skb: payload to send
* @packet_type: the batman unicast packet type to use * @packet_type: the batman unicast packet type to use
...@@ -378,7 +397,7 @@ int batadv_send_skb_unicast(struct batadv_priv *bat_priv, ...@@ -378,7 +397,7 @@ int batadv_send_skb_unicast(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_send_skb_via_tt_generic - send an skb via TT lookup * batadv_send_skb_via_tt_generic() - send an skb via TT lookup
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @skb: payload to send * @skb: payload to send
* @packet_type: the batman unicast packet type to use * @packet_type: the batman unicast packet type to use
...@@ -425,7 +444,7 @@ int batadv_send_skb_via_tt_generic(struct batadv_priv *bat_priv, ...@@ -425,7 +444,7 @@ int batadv_send_skb_via_tt_generic(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_send_skb_via_gw - send an skb via gateway lookup * batadv_send_skb_via_gw() - send an skb via gateway lookup
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @skb: payload to send * @skb: payload to send
* @vid: the vid to be used to search the translation table * @vid: the vid to be used to search the translation table
...@@ -452,7 +471,7 @@ int batadv_send_skb_via_gw(struct batadv_priv *bat_priv, struct sk_buff *skb, ...@@ -452,7 +471,7 @@ int batadv_send_skb_via_gw(struct batadv_priv *bat_priv, struct sk_buff *skb,
} }
/** /**
* batadv_forw_packet_free - free a forwarding packet * batadv_forw_packet_free() - free a forwarding packet
* @forw_packet: The packet to free * @forw_packet: The packet to free
* @dropped: whether the packet is freed because is is dropped * @dropped: whether the packet is freed because is is dropped
* *
...@@ -477,7 +496,7 @@ void batadv_forw_packet_free(struct batadv_forw_packet *forw_packet, ...@@ -477,7 +496,7 @@ void batadv_forw_packet_free(struct batadv_forw_packet *forw_packet,
} }
/** /**
* batadv_forw_packet_alloc - allocate a forwarding packet * batadv_forw_packet_alloc() - allocate a forwarding packet
* @if_incoming: The (optional) if_incoming to be grabbed * @if_incoming: The (optional) if_incoming to be grabbed
* @if_outgoing: The (optional) if_outgoing to be grabbed * @if_outgoing: The (optional) if_outgoing to be grabbed
* @queue_left: The (optional) queue counter to decrease * @queue_left: The (optional) queue counter to decrease
...@@ -543,7 +562,7 @@ batadv_forw_packet_alloc(struct batadv_hard_iface *if_incoming, ...@@ -543,7 +562,7 @@ batadv_forw_packet_alloc(struct batadv_hard_iface *if_incoming,
} }
/** /**
* batadv_forw_packet_was_stolen - check whether someone stole this packet * batadv_forw_packet_was_stolen() - check whether someone stole this packet
* @forw_packet: the forwarding packet to check * @forw_packet: the forwarding packet to check
* *
* This function checks whether the given forwarding packet was claimed by * This function checks whether the given forwarding packet was claimed by
...@@ -558,7 +577,7 @@ batadv_forw_packet_was_stolen(struct batadv_forw_packet *forw_packet) ...@@ -558,7 +577,7 @@ batadv_forw_packet_was_stolen(struct batadv_forw_packet *forw_packet)
} }
/** /**
* batadv_forw_packet_steal - claim a forw_packet for free() * batadv_forw_packet_steal() - claim a forw_packet for free()
* @forw_packet: the forwarding packet to steal * @forw_packet: the forwarding packet to steal
* @lock: a key to the store to steal from (e.g. forw_{bat,bcast}_list_lock) * @lock: a key to the store to steal from (e.g. forw_{bat,bcast}_list_lock)
* *
...@@ -589,7 +608,7 @@ bool batadv_forw_packet_steal(struct batadv_forw_packet *forw_packet, ...@@ -589,7 +608,7 @@ bool batadv_forw_packet_steal(struct batadv_forw_packet *forw_packet,
} }
/** /**
* batadv_forw_packet_list_steal - claim a list of forward packets for free() * batadv_forw_packet_list_steal() - claim a list of forward packets for free()
* @forw_list: the to be stolen forward packets * @forw_list: the to be stolen forward packets
* @cleanup_list: a backup pointer, to be able to dispose the packet later * @cleanup_list: a backup pointer, to be able to dispose the packet later
* @hard_iface: the interface to steal forward packets from * @hard_iface: the interface to steal forward packets from
...@@ -625,7 +644,7 @@ batadv_forw_packet_list_steal(struct hlist_head *forw_list, ...@@ -625,7 +644,7 @@ batadv_forw_packet_list_steal(struct hlist_head *forw_list,
} }
/** /**
* batadv_forw_packet_list_free - free a list of forward packets * batadv_forw_packet_list_free() - free a list of forward packets
* @head: a list of to be freed forw_packets * @head: a list of to be freed forw_packets
* *
* This function cancels the scheduling of any packet in the provided list, * This function cancels the scheduling of any packet in the provided list,
...@@ -649,7 +668,7 @@ static void batadv_forw_packet_list_free(struct hlist_head *head) ...@@ -649,7 +668,7 @@ static void batadv_forw_packet_list_free(struct hlist_head *head)
} }
/** /**
* batadv_forw_packet_queue - try to queue a forwarding packet * batadv_forw_packet_queue() - try to queue a forwarding packet
* @forw_packet: the forwarding packet to queue * @forw_packet: the forwarding packet to queue
* @lock: a key to the store (e.g. forw_{bat,bcast}_list_lock) * @lock: a key to the store (e.g. forw_{bat,bcast}_list_lock)
* @head: the shelve to queue it on (e.g. forw_{bat,bcast}_list) * @head: the shelve to queue it on (e.g. forw_{bat,bcast}_list)
...@@ -693,7 +712,7 @@ static void batadv_forw_packet_queue(struct batadv_forw_packet *forw_packet, ...@@ -693,7 +712,7 @@ static void batadv_forw_packet_queue(struct batadv_forw_packet *forw_packet,
} }
/** /**
* batadv_forw_packet_bcast_queue - try to queue a broadcast packet * batadv_forw_packet_bcast_queue() - try to queue a broadcast packet
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @forw_packet: the forwarding packet to queue * @forw_packet: the forwarding packet to queue
* @send_time: timestamp (jiffies) when the packet is to be sent * @send_time: timestamp (jiffies) when the packet is to be sent
...@@ -712,7 +731,7 @@ batadv_forw_packet_bcast_queue(struct batadv_priv *bat_priv, ...@@ -712,7 +731,7 @@ batadv_forw_packet_bcast_queue(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_forw_packet_ogmv1_queue - try to queue an OGMv1 packet * batadv_forw_packet_ogmv1_queue() - try to queue an OGMv1 packet
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @forw_packet: the forwarding packet to queue * @forw_packet: the forwarding packet to queue
* @send_time: timestamp (jiffies) when the packet is to be sent * @send_time: timestamp (jiffies) when the packet is to be sent
...@@ -730,7 +749,7 @@ void batadv_forw_packet_ogmv1_queue(struct batadv_priv *bat_priv, ...@@ -730,7 +749,7 @@ void batadv_forw_packet_ogmv1_queue(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_add_bcast_packet_to_list - queue broadcast packet for multiple sends * batadv_add_bcast_packet_to_list() - queue broadcast packet for multiple sends
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @skb: broadcast packet to add * @skb: broadcast packet to add
* @delay: number of jiffies to wait before sending * @delay: number of jiffies to wait before sending
...@@ -790,7 +809,7 @@ int batadv_add_bcast_packet_to_list(struct batadv_priv *bat_priv, ...@@ -790,7 +809,7 @@ int batadv_add_bcast_packet_to_list(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_forw_packet_bcasts_left - check if a retransmission is necessary * batadv_forw_packet_bcasts_left() - check if a retransmission is necessary
* @forw_packet: the forwarding packet to check * @forw_packet: the forwarding packet to check
* @hard_iface: the interface to check on * @hard_iface: the interface to check on
* *
...@@ -818,7 +837,8 @@ batadv_forw_packet_bcasts_left(struct batadv_forw_packet *forw_packet, ...@@ -818,7 +837,8 @@ batadv_forw_packet_bcasts_left(struct batadv_forw_packet *forw_packet,
} }
/** /**
* batadv_forw_packet_bcasts_inc - increment retransmission counter of a packet * batadv_forw_packet_bcasts_inc() - increment retransmission counter of a
* packet
* @forw_packet: the packet to increase the counter for * @forw_packet: the packet to increase the counter for
*/ */
static void static void
...@@ -828,7 +848,7 @@ batadv_forw_packet_bcasts_inc(struct batadv_forw_packet *forw_packet) ...@@ -828,7 +848,7 @@ batadv_forw_packet_bcasts_inc(struct batadv_forw_packet *forw_packet)
} }
/** /**
* batadv_forw_packet_is_rebroadcast - check packet for previous transmissions * batadv_forw_packet_is_rebroadcast() - check packet for previous transmissions
* @forw_packet: the packet to check * @forw_packet: the packet to check
* *
* Return: True if this packet was transmitted before, false otherwise. * Return: True if this packet was transmitted before, false otherwise.
...@@ -953,7 +973,7 @@ static void batadv_send_outstanding_bcast_packet(struct work_struct *work) ...@@ -953,7 +973,7 @@ static void batadv_send_outstanding_bcast_packet(struct work_struct *work)
} }
/** /**
* batadv_purge_outstanding_packets - stop/purge scheduled bcast/OGMv1 packets * batadv_purge_outstanding_packets() - stop/purge scheduled bcast/OGMv1 packets
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @hard_iface: the hard interface to cancel and purge bcast/ogm packets on * @hard_iface: the hard interface to cancel and purge bcast/ogm packets on
* *
......
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
...@@ -76,7 +77,7 @@ int batadv_send_skb_via_gw(struct batadv_priv *bat_priv, struct sk_buff *skb, ...@@ -76,7 +77,7 @@ int batadv_send_skb_via_gw(struct batadv_priv *bat_priv, struct sk_buff *skb,
unsigned short vid); unsigned short vid);
/** /**
* batadv_send_skb_via_tt - send an skb via TT lookup * batadv_send_skb_via_tt() - send an skb via TT lookup
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @skb: the payload to send * @skb: the payload to send
* @dst_hint: can be used to override the destination contained in the skb * @dst_hint: can be used to override the destination contained in the skb
...@@ -97,7 +98,7 @@ static inline int batadv_send_skb_via_tt(struct batadv_priv *bat_priv, ...@@ -97,7 +98,7 @@ static inline int batadv_send_skb_via_tt(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_send_skb_via_tt_4addr - send an skb via TT lookup * batadv_send_skb_via_tt_4addr() - send an skb via TT lookup
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @skb: the payload to send * @skb: the payload to send
* @packet_subtype: the unicast 4addr packet subtype to use * @packet_subtype: the unicast 4addr packet subtype to use
......
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2012-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2012-2017 B.A.T.M.A.N. contributors:
* *
* Edo Monticelli, Antonio Quartulli * Edo Monticelli, Antonio Quartulli
......
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich, Antonio Quartulli * Marek Lindner, Simon Wunderlich, Antonio Quartulli
......
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment