Skip to content

Commit

Permalink
batman-adv: Reformat multiline comments to consistent style
Browse files Browse the repository at this point in the history
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: Sven Eckelmann <[email protected]>
  • Loading branch information
ecsv authored and Antonio Quartulli committed Jun 20, 2012
1 parent 3193e8f commit 9cfc7bd
Show file tree
Hide file tree
Showing 40 changed files with 349 additions and 388 deletions.
4 changes: 1 addition & 3 deletions net/batman-adv/bat_algo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
* Copyright (C) 2011-2012 B.A.T.M.A.N. contributors:
/* Copyright (C) 2011-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner
*
Expand All @@ -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_
Expand Down
4 changes: 1 addition & 3 deletions net/batman-adv/bat_debugfs.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors:
/* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner
*
Expand All @@ -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"
Expand Down
5 changes: 1 addition & 4 deletions net/batman-adv/bat_debugfs.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors:
/* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner
*
Expand All @@ -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_

Expand Down
75 changes: 42 additions & 33 deletions net/batman-adv/bat_iv_ogm.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
* 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
*
Expand All @@ -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"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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))) {

Expand Down Expand Up @@ -292,56 +292,56 @@ 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;
goto out;
}

/* 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))) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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))
Expand Down Expand Up @@ -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
Expand All @@ -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;

Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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));
Expand All @@ -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");
Expand All @@ -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)) &&
Expand Down
13 changes: 7 additions & 6 deletions net/batman-adv/bat_sysfs.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors:
/* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner
*
Expand All @@ -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"
Expand Down Expand Up @@ -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) \
Expand All @@ -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) \
Expand Down Expand Up @@ -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) \
Expand Down
5 changes: 1 addition & 4 deletions net/batman-adv/bat_sysfs.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors:
/* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors:
*
* Marek Lindner
*
Expand All @@ -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_

Expand Down
Loading

0 comments on commit 9cfc7bd

Please sign in to comment.