Commit 9cfc7bd6 authored by Sven Eckelmann's avatar Sven Eckelmann Committed by Antonio Quartulli
Browse files

batman-adv: Reformat multiline comments to consistent style



batman-adv doesn't follow the style for multiline comments that David S. Miller
prefers. All comments should be reformatted to follow this consistent style to
make the code slightly more readable.
Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
parent 3193e8fd
/*
* Copyright (C) 2011-2012 B.A.T.M.A.N. contributors:
/* Copyright (C) 2011-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner
*
......@@ -16,7 +15,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA
*
*/
#ifndef _NET_BATMAN_ADV_BAT_ALGO_H_
......
/*
* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors:
/* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner
*
......@@ -16,7 +15,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA
*
*/
#include "main.h"
......
/*
* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors:
/* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner
*
......@@ -16,10 +15,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA
*
*/
#ifndef _NET_BATMAN_ADV_DEBUGFS_H_
#define _NET_BATMAN_ADV_DEBUGFS_H_
......
/*
* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner, Simon Wunderlich
*
......@@ -16,7 +15,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA
*
*/
#include "main.h"
......@@ -170,7 +168,8 @@ static void bat_iv_ogm_send_to_if(struct forw_packet *forw_packet,
batman_ogm_packet->tt_num_changes)) {
/* we might have aggregated direct link packets with an
* ordinary base packet */
* ordinary base packet
*/
if ((forw_packet->direct_link_flags & (1 << packet_num)) &&
(forw_packet->if_incoming == hard_iface))
batman_ogm_packet->flags |= DIRECTLINK;
......@@ -237,8 +236,9 @@ static void bat_iv_ogm_emit(struct forw_packet *forw_packet)
if (!primary_if)
goto out;
/* multihomed peer assumed */
/* non-primary OGMs are only broadcasted on their interface */
/* multihomed peer assumed
* non-primary OGMs are only broadcasted on their interface
*/
if ((directlink && (batman_ogm_packet->header.ttl == 1)) ||
(forw_packet->own && (forw_packet->if_incoming != primary_if))) {
......@@ -292,41 +292,39 @@ static bool bat_iv_ogm_can_aggregate(const struct batman_ogm_packet
batman_ogm_packet = (struct batman_ogm_packet *)forw_packet->skb->data;
/**
* we can aggregate the current packet to this aggregated packet
/* we can aggregate the current packet to this aggregated packet
* if:
*
* - the send time is within our MAX_AGGREGATION_MS time
* - the resulting packet wont be bigger than
* MAX_AGGREGATION_BYTES
*/
if (time_before(send_time, forw_packet->send_time) &&
time_after_eq(send_time + msecs_to_jiffies(MAX_AGGREGATION_MS),
forw_packet->send_time) &&
(aggregated_bytes <= MAX_AGGREGATION_BYTES)) {
/**
* check aggregation compatibility
/* check aggregation compatibility
* -> direct link packets are broadcasted on
* their interface only
* -> aggregate packet if the current packet is
* a "global" packet as well as the base
* packet
*/
primary_if = primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;
/* packets without direct link flag and high TTL
* are flooded through the net */
* are flooded through the net
*/
if ((!directlink) &&
(!(batman_ogm_packet->flags & DIRECTLINK)) &&
(batman_ogm_packet->header.ttl != 1) &&
/* own packets originating non-primary
* interfaces leave only that interface */
* interfaces leave only that interface
*/
((!forw_packet->own) ||
(forw_packet->if_incoming == primary_if))) {
res = true;
......@@ -334,14 +332,16 @@ static bool bat_iv_ogm_can_aggregate(const struct batman_ogm_packet
}
/* if the incoming packet is sent via this one
* interface only - we still can aggregate */
* interface only - we still can aggregate
*/
if ((directlink) &&
(new_batman_ogm_packet->header.ttl == 1) &&
(forw_packet->if_incoming == if_incoming) &&
/* packets from direct neighbors or
* own secondary interface packets
* (= secondary interface packets in general) */
* (= secondary interface packets in general)
*/
(batman_ogm_packet->flags & DIRECTLINK ||
(forw_packet->own &&
forw_packet->if_incoming != primary_if))) {
......@@ -457,8 +457,7 @@ static void bat_iv_ogm_queue_add(struct bat_priv *bat_priv,
int packet_len, struct hard_iface *if_incoming,
int own_packet, unsigned long send_time)
{
/**
* _aggr -> pointer to the packet we want to aggregate with
/* _aggr -> pointer to the packet we want to aggregate with
* _pos -> pointer to the position in the queue
*/
struct forw_packet *forw_packet_aggr = NULL, *forw_packet_pos = NULL;
......@@ -487,13 +486,13 @@ static void bat_iv_ogm_queue_add(struct bat_priv *bat_priv,
}
/* nothing to aggregate with - either aggregation disabled or no
* suitable aggregation packet found */
* suitable aggregation packet found
*/
if (!forw_packet_aggr) {
/* the following section can run without the lock */
spin_unlock_bh(&bat_priv->forw_bat_list_lock);
/**
* if we could not aggregate this packet with one of the others
/* if we could not aggregate this packet with one of the others
* we hold it back for a while, so that it might be aggregated
* later on
*/
......@@ -691,7 +690,8 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv,
batadv_bonding_candidate_add(orig_node, neigh_node);
/* if this neighbor already is our next hop there is nothing
* to change */
* to change
*/
router = batadv_orig_node_get_router(orig_node);
if (router == neigh_node)
goto update_tt;
......@@ -701,7 +701,8 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv,
goto update_tt;
/* if the TQ is the same and the link not more symmetric we
* won't consider it either */
* won't consider it either
*/
if (router && (neigh_node->tq_avg == router->tq_avg)) {
orig_node_tmp = router->orig_node;
spin_lock_bh(&orig_node_tmp->ogm_cnt_lock);
......@@ -723,7 +724,8 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv,
update_tt:
/* I have to check for transtable changes only if the OGM has been
* sent through a primary interface */
* sent through a primary interface
*/
if (((batman_ogm_packet->orig != ethhdr->h_source) &&
(batman_ogm_packet->header.ttl > 2)) ||
(batman_ogm_packet->flags & PRIMARIES_FIRST_HOP))
......@@ -812,15 +814,17 @@ static int bat_iv_ogm_calc_tq(struct orig_node *orig_node,
total_count = (orig_eq_count > neigh_rq_count ?
neigh_rq_count : orig_eq_count);
/* if we have too few packets (too less data) we set tq_own to zero */
/* if we receive too few packets it is not considered bidirectional */
/* if we have too few packets (too less data) we set tq_own to zero
* if we receive too few packets it is not considered bidirectional
*/
if ((total_count < TQ_LOCAL_BIDRECT_SEND_MINIMUM) ||
(neigh_rq_count < TQ_LOCAL_BIDRECT_RECV_MINIMUM))
tq_own = 0;
else
/* neigh_node->real_packet_count is never zero as we
* only purge old information when getting new
* information */
* information
*/
tq_own = (TQ_MAX_VALUE * total_count) / neigh_rq_count;
/* 1 - ((1-x) ** 3), normalized to TQ_MAX_VALUE this does
......@@ -846,7 +850,8 @@ static int bat_iv_ogm_calc_tq(struct orig_node *orig_node,
neigh_rq_count, tq_own, tq_asym_penalty, batman_ogm_packet->tq);
/* if link has the minimum required transmission quality
* consider it bidirectional */
* consider it bidirectional
*/
if (batman_ogm_packet->tq >= TQ_TOTAL_BIDRECT_LIMIT)
ret = 1;
......@@ -1039,8 +1044,9 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr,
return;
/* neighbor has to indicate direct link and it has to
* come via the corresponding interface */
/* save packet seqno for bidirectional check */
* come via the corresponding interface
* save packet seqno for bidirectional check
*/
if (has_directlink_flag &&
compare_eth(if_incoming->net_dev->dev_addr,
batman_ogm_packet->orig)) {
......@@ -1117,7 +1123,8 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr,
}
/* if sender is a direct neighbor the sender mac equals
* originator mac */
* originator mac
*/
orig_neigh_node = (is_single_hop_neigh ?
orig_node :
batadv_get_orig_node(bat_priv, ethhdr->h_source));
......@@ -1127,7 +1134,8 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr,
orig_neigh_router = batadv_orig_node_get_router(orig_neigh_node);
/* drop packet if sender is not a direct neighbor and if we
* don't route towards it */
* don't route towards it
*/
if (!is_single_hop_neigh && (!orig_neigh_router)) {
bat_dbg(DBG_BATMAN, bat_priv,
"Drop packet: OGM via unknown neighbor!\n");
......@@ -1141,7 +1149,8 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr,
batman_ogm_packet);
/* update ranking if it is not a duplicate or has the same
* seqno and similar ttl as the non-duplicate */
* seqno and similar ttl as the non-duplicate
*/
if (is_bidirectional &&
(!is_duplicate ||
((orig_node->last_real_seqno == ntohl(batman_ogm_packet->seqno)) &&
......
/*
* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors:
/* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner
*
......@@ -16,7 +15,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA
*
*/
#include "main.h"
......@@ -84,7 +82,8 @@ ssize_t show_##_name(struct kobject *kobj, \
} \
/* Use this, if you are going to turn a [name] in the soft-interface
* (bat_priv) on or off */
* (bat_priv) on or off
*/
#define BAT_ATTR_SIF_BOOL(_name, _mode, _post_func) \
static BAT_ATTR_SIF_STORE_BOOL(_name, _post_func) \
static BAT_ATTR_SIF_SHOW_BOOL(_name) \
......@@ -110,7 +109,8 @@ ssize_t show_##_name(struct kobject *kobj, \
} \
/* Use this, if you are going to set [name] in the soft-interface
* (bat_priv) to an unsigned integer value */
* (bat_priv) to an unsigned integer value
*/
#define BAT_ATTR_SIF_UINT(_name, _mode, _min, _max, _post_func) \
static BAT_ATTR_SIF_STORE_UINT(_name, _min, _max, _post_func) \
static BAT_ATTR_SIF_SHOW_UINT(_name) \
......@@ -155,7 +155,8 @@ ssize_t show_##_name(struct kobject *kobj, \
}
/* Use this, if you are going to set [name] in hard_iface to an
* unsigned integer value*/
* unsigned integer value
*/
#define BAT_ATTR_HIF_UINT(_name, _mode, _min, _max, _post_func) \
static BAT_ATTR_HIF_STORE_UINT(_name, _min, _max, _post_func) \
static BAT_ATTR_HIF_SHOW_UINT(_name) \
......
/*
* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors:
/* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner
*
......@@ -16,10 +15,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA
*
*/
#ifndef _NET_BATMAN_ADV_SYSFS_H_
#define _NET_BATMAN_ADV_SYSFS_H_
......
/*
* Copyright (C) 2006-2012 B.A.T.M.A.N. contributors:
/* Copyright (C) 2006-2012 B.A.T.M.A.N. contributors:
*
* Simon Wunderlich, Marek Lindner
*
......@@ -16,7 +15,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA
*
*/
#include "main.h"
......@@ -46,8 +44,8 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits,
struct bat_priv *bat_priv = priv;
/* sequence number is slightly older. We already got a sequence number
* higher than this one, so we just mark it. */
* higher than this one, so we just mark it.
*/
if ((seq_num_diff <= 0) && (seq_num_diff > -TQ_LOCAL_WINDOW_SIZE)) {
if (set_mark)
bat_set_bit(seq_bits, -seq_num_diff);
......@@ -55,8 +53,8 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits,
}
/* sequence number is slightly newer, so we shift the window and
* set the mark if required */
* set the mark if required
*/
if ((seq_num_diff > 0) && (seq_num_diff < TQ_LOCAL_WINDOW_SIZE)) {
batadv_bitmap_shift_left(seq_bits, seq_num_diff);
......@@ -66,7 +64,6 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits,
}
/* sequence number is much newer, probably missed a lot of packets */
if ((seq_num_diff >= TQ_LOCAL_WINDOW_SIZE) &&
(seq_num_diff < EXPECTED_SEQNO_RANGE)) {
bat_dbg(DBG_BATMAN, bat_priv,
......@@ -81,8 +78,8 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits,
/* received a much older packet. The other host either restarted
* or the old packet got delayed somewhere in the network. The
* packet should be dropped without calling this function if the
* seqno window is protected. */
* seqno window is protected.
*/
if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE) ||
(seq_num_diff >= EXPECTED_SEQNO_RANGE)) {
......
/*
* Copyright (C) 2006-2012 B.A.T.M.A.N. contributors:
/* Copyright (C) 2006-2012 B.A.T.M.A.N. contributors:
*
* Simon Wunderlich, Marek Lindner
*
......@@ -16,14 +15,14 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA
*
*/
#ifndef _NET_BATMAN_ADV_BITARRAY_H_
#define _NET_BATMAN_ADV_BITARRAY_H_
/* returns true if the corresponding bit in the given seq_bits indicates true
* and curr_seqno is within range of last_seqno */
* and curr_seqno is within range of last_seqno
*/
static inline int bat_test_bit(const unsigned long *seq_bits,
uint32_t last_seqno, uint32_t curr_seqno)
{
......@@ -47,7 +46,8 @@ static inline void bat_set_bit(unsigned long *seq_bits, int32_t n)
}
/* receive and process one packet, returns 1 if received seq_num is considered
* new, 0 if old */
* new, 0 if old
*/
int batadv_bit_get_packet(void *priv, unsigned long *seq_bits,
int32_t seq_num_diff, int set_mark);
......
/*
* Copyright (C) 2011-2012 B.A.T.M.A.N. contributors:
/* Copyright (C) 2011-2012 B.A.T.M.A.N. contributors:
*
* Simon Wunderlich
*
......@@ -16,7 +15,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA
*
*/
#include "main.h"
......@@ -123,8 +121,7 @@ static void claim_free_ref(struct claim *claim)
call_rcu(&claim->rcu, claim_free_rcu);
}
/**
* @bat_priv: the bat priv with all the soft interface information
/* @bat_priv: the bat priv with all the soft interface information
* @data: search data (may be local/static data)
*
* looks for a claim in the hash, and returns it if found
......@@ -162,8 +159,7 @@ static struct claim *claim_hash_find(struct bat_priv *bat_priv,
return claim_tmp;
}
/**
* @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
* @vid: the VLAN ID
*
......@@ -241,8 +237,7 @@ static void bla_del_backbone_claims(struct backbone_gw *backbone_gw)
backbone_gw->crc = BLA_CRC_INIT;
}
/**
* @bat_priv: the bat priv with all the soft interface information
/* @bat_priv: the bat priv with all the soft interface information
* @orig: the mac address to be announced within the claim
* @vid: the VLAN ID
* @claimtype: the type of the claim (CLAIM, UNCLAIM, ANNOUNCE, ...)
......@@ -347,8 +342,7 @@ out:
hardif_free_ref(primary_if);
}
/**
* @bat_priv: the bat priv with all the soft interface information
/* @bat_priv: the bat priv with all the soft interface information
* @orig: the mac address of the originator
* @vid: the VLAN ID
*
......@@ -422,8 +416,7 @@ static void bla_update_own_backbone_gw(struct bat_priv *bat_priv,
backbone_gw_free_ref(backbone_gw);
}
/**
* @bat_priv: the bat priv with all the soft interface information
/* @bat_priv: the bat priv with all the soft interface information
* @vid: the vid where the request came on
*
* Repeat all of our own claims, and finally send an ANNOUNCE frame
......@@ -468,8 +461,7 @@ static void bla_answer_request(struct bat_priv *bat_priv,
backbone_gw_free_ref(backbone_gw);
}
/**
* @backbone_gw: the backbone gateway from whom we are out of sync
/* @backbone_gw: the backbone gateway from whom we are out of sync
*
* When the crc is wrong, ask the backbone gateway for a full table update.
* After the request, it will repeat all of his own claims and finally
......@@ -495,8 +487,7 @@ static void bla_send_request(struct backbone_gw *backbone_gw)
}
}
/**
* @bat_priv: the bat priv with all the soft interface information
/* @bat_priv: the bat priv with all the soft interface information
* @backbone_gw: our backbone gateway which should be announced
*
* This function sends an announcement. It is called from multiple
......@@ -516,8 +507,7 @@ static void bla_send_announce(struct bat_priv *bat_priv,
}
/**
* @bat_priv: the bat priv with all the soft interface information
/* @bat_priv: the bat priv with all the soft interface information
* @mac: the mac address of the claim
* @vid: the VLAN ID of the frame
* @backbone_gw: the backbone gateway which claims it
......@@ -731,8 +721,7 @@ static int handle_claim(struct bat_priv *bat_priv,
return 1;
}
/**
* @bat_priv: the bat priv with all the soft interface information
/* @bat_priv: the bat priv with all the soft interface information
* @hw_src: the Hardware source in the ARP Header
* @hw_dst: the Hardware destination in the ARP Header
* @ethhdr: pointer to the Ethernet header of the claim frame
......@@ -810,8 +799,7 @@ static int check_claim_group(struct bat_priv *bat_priv,
}
/**
* @bat_priv: the bat priv with all the soft interface information
/* @bat_priv: the bat priv with all the soft interface information
* @skb: the frame to be checked
*
* Check if this is a claim frame, and process it accordingly.
......@@ -860,7 +848,6 @@ static int bla_process_claim(struct bat_priv *bat_priv,
/* Check whether the ARP frame carries a valid
* IP information
*/
if (arphdr->ar_hrd != htons(ARPHRD_ETHER))
return 0;
if (arphdr->ar_pro != htons(ETH_P_IP))
......@@ -963,8 +950,7 @@ purge_now:
}
}
/**
* @bat_priv: the bat priv with all the soft interface information
/* @bat_priv: the bat priv with all the soft interface information
* @primary_if: the selected primary interface, may be NULL if now is set
* @now: whether the whole hash shall be wiped now
*
......@@ -1011,13 +997,11 @@ purge_now:
}
}
/**
* @bat_priv: the bat priv with all the soft interface information
/* @bat_priv: the bat priv with all the soft interface information
* @primary_if: the new selected primary_if
* @oldif: the old primary interface, may be NULL
*
* Update the backbone gateways when the own orig address changes.
*
*/
void batadv_bla_update_orig_address(struct bat_priv *bat_priv,
struct hard_iface *primary_if,
......@@ -1183,8 +1167,7 @@ int batadv_bla_init(struct bat_priv *bat_priv)
return 0;
}
/**
* @bat_priv: the bat priv with all the soft interface information
/* @bat_priv: the bat priv with all the soft interface information
* @bcast_packet: originator mac address
* @hdr_size: maximum length of the frame
*
......@@ -1196,9 +1179,7 @@ int batadv_bla_init(struct bat_priv *bat_priv)
* with a good chance that it is the same packet. If it is furthermore
* sent by another host, drop it. We allow equal packets from
* the same host however as this might be intended.
*
**/
*/
int batadv_bla_check_bcast_duplist(struct bat_priv *bat_priv,
struct bcast_packet *bcast_packet,
int hdr_size)
......@@ -1250,16 +1231,13 @@ int batadv_bla_check_bcast_duplist(struct bat_priv *bat_priv,
/**
* @bat_priv: the bat priv with all the soft interface information
/* @bat_priv: the bat priv with all the soft interface information
* @orig: originator mac address
*
* check if the originator is a gateway for any VLAN ID.
*
* returns 1 if it is found, 0 otherwise
*
*/
int batadv_bla_is_backbone_gw_orig(struct bat_priv *bat_priv, uint8_t *orig)
{
struct hashtable_t *hash = bat_priv->backbone_hash;
......@@ -1291,15 +1269,13 @@ int batadv_bla_is_backbone_gw_orig(struct bat_priv *bat_priv, uint8_t *orig)
}
/**
* @skb: the frame to be checked
/* @skb: the frame to be checked
* @orig_node: the orig_node of the frame
* @hdr_size: maximum length of the frame
*
* bla_is_backbone_gw inspects the skb for the VLAN ID and returns 1
* if the orig_node is also a gateway on the soft interface, otherwise it
* returns 0.
*
*/
int batadv_bla_is_backbone_gw(struct sk_buff *skb,
struct orig_node *orig_node, int hdr_size)
......@@ -1328,7 +1304,6 @@ int batadv_bla_is_backbone_gw(struct sk_buff *skb,
}
/* see if this originator is a backbone gw for this VLAN */
backbone_gw = backbone_hash_find(orig_node->bat_priv,
orig_node->orig, vid);
if (!backbone_gw)
......@@ -1360,8 +1335,7 @@ void batadv_bla_free(struct bat_priv *bat_priv)
hardif_free_ref(primary_if);
}
/**
* @bat_priv: the bat priv with all the soft interface information
/* @bat_priv: the bat priv with all the soft interface information
* @skb: the frame to be checked
* @vid: the VLAN ID of the frame
*
......@@ -1372,7 +1346,6 @@ void batadv_bla_free(struct bat_priv *bat_priv)
* in these cases, the skb is further handled by this function and
* returns 1, otherwise it returns 0 and the caller shall further
* process the skb.
*
*/
int batadv_bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid)
{
......@@ -1449,8 +1422,7 @@ out:
return ret;
}
/**
* @bat_priv: the bat priv with all the soft interface information
/* @bat_priv: the bat priv with all the soft interface information
* @skb: the frame to be checked
* @vid: the VLAN ID of the frame
*
......@@ -1461,7