Skip to content

Commit

Permalink
batman-adv: rename everything from *hna* into *tt* (translation table)
Browse files Browse the repository at this point in the history
To be coherent, all the functions/variables/constants have been renamed
to the TranslationTable style

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
  • Loading branch information
Antonio Quartulli authored and Sven Eckelmann committed May 8, 2011
1 parent 01df2b6 commit 2dafb49
Show file tree
Hide file tree
Showing 19 changed files with 332 additions and 330 deletions.
11 changes: 6 additions & 5 deletions Documentation/networking/batman-adv.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[state: 27-01-2011]
[state: 17-04-2011]

BATMAN-ADV
----------
Expand All @@ -19,6 +19,7 @@ duce the overhead to a minimum. It does not depend on any (other)
network driver, and can be used on wifi as well as ethernet lan,
vpn, etc ... (anything with ethernet-style layer 2).


CONFIGURATION
-------------

Expand Down Expand Up @@ -160,13 +161,13 @@ face. Each entry can/has to have the following values:
-> "TQ mac value" - src mac's link quality towards mac address
of a neighbor originator's interface which
is being used for routing
-> "HNA mac" - HNA announced by source mac
-> "TT mac" - TT announced by source mac
-> "PRIMARY" - this is a primary interface
-> "SEC mac" - secondary mac address of source
(requires preceding PRIMARY)

The TQ value has a range from 4 to 255 with 255 being the best.
The HNA entries are showing which hosts are connected to the mesh
The TT entries are showing which hosts are connected to the mesh
via bat0 or being bridged into the mesh network. The PRIMARY/SEC
values are only applied on primary interfaces

Expand Down Expand Up @@ -199,15 +200,15 @@ abled during run time. Following log_levels are defined:

0 - All debug output disabled
1 - Enable messages related to routing / flooding / broadcasting
2 - Enable route or hna added / changed / deleted
2 - Enable route or tt entry added / changed / deleted
3 - Enable all messages

The debug output can be changed at runtime using the file
/sys/class/net/bat0/mesh/log_level. e.g.

# echo 2 > /sys/class/net/bat0/mesh/log_level

will enable debug messages for when routes or HNAs change.
will enable debug messages for when routes or TTs change.


BATCTL
Expand Down
16 changes: 8 additions & 8 deletions net/batman-adv/aggregation.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
#include "send.h"
#include "routing.h"

/* calculate the size of the hna information for a given packet */
static int hna_len(struct batman_packet *batman_packet)
/* calculate the size of the tt information for a given packet */
static int tt_len(struct batman_packet *batman_packet)
{
return batman_packet->num_hna * ETH_ALEN;
return batman_packet->num_tt * ETH_ALEN;
}

/* return true if new_packet can be aggregated with forw_packet */
Expand Down Expand Up @@ -250,7 +250,7 @@ void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff,
{
struct batman_packet *batman_packet;
int buff_pos = 0;
unsigned char *hna_buff;
unsigned char *tt_buff;

batman_packet = (struct batman_packet *)packet_buff;

Expand All @@ -259,14 +259,14 @@ void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff,
orig_interval. */
batman_packet->seqno = ntohl(batman_packet->seqno);

hna_buff = packet_buff + buff_pos + BAT_PACKET_LEN;
tt_buff = packet_buff + buff_pos + BAT_PACKET_LEN;
receive_bat_packet(ethhdr, batman_packet,
hna_buff, hna_len(batman_packet),
tt_buff, tt_len(batman_packet),
if_incoming);

buff_pos += BAT_PACKET_LEN + hna_len(batman_packet);
buff_pos += BAT_PACKET_LEN + tt_len(batman_packet);
batman_packet = (struct batman_packet *)
(packet_buff + buff_pos);
} while (aggregated_packet(buff_pos, packet_len,
batman_packet->num_hna));
batman_packet->num_tt));
}
4 changes: 2 additions & 2 deletions net/batman-adv/aggregation.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
#include "main.h"

/* is there another aggregated packet here? */
static inline int aggregated_packet(int buff_pos, int packet_len, int num_hna)
static inline int aggregated_packet(int buff_pos, int packet_len, int num_tt)
{
int next_buff_pos = buff_pos + BAT_PACKET_LEN + (num_hna * ETH_ALEN);
int next_buff_pos = buff_pos + BAT_PACKET_LEN + (num_tt * ETH_ALEN);

return (next_buff_pos <= packet_len) &&
(next_buff_pos <= MAX_AGGREGATION_BYTES);
Expand Down
4 changes: 2 additions & 2 deletions net/batman-adv/bat_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,13 @@ static int softif_neigh_open(struct inode *inode, struct file *file)
static int transtable_global_open(struct inode *inode, struct file *file)
{
struct net_device *net_dev = (struct net_device *)inode->i_private;
return single_open(file, hna_global_seq_print_text, net_dev);
return single_open(file, tt_global_seq_print_text, net_dev);
}

static int transtable_local_open(struct inode *inode, struct file *file)
{
struct net_device *net_dev = (struct net_device *)inode->i_private;
return single_open(file, hna_local_seq_print_text, net_dev);
return single_open(file, tt_local_seq_print_text, net_dev);
}

static int vis_data_open(struct inode *inode, struct file *file)
Expand Down
6 changes: 3 additions & 3 deletions net/batman-adv/hard-interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ static void primary_if_select(struct bat_priv *bat_priv,
primary_if_update_addr(bat_priv);

/***
* hacky trick to make sure that we send the HNA information via
* hacky trick to make sure that we send the TT information via
* our new primary interface
*/
atomic_set(&bat_priv->hna_local_changed, 1);
atomic_set(&bat_priv->tt_local_changed, 1);
}

static bool hardif_is_iface_up(struct hard_iface *hard_iface)
Expand Down Expand Up @@ -339,7 +339,7 @@ int hardif_enable_interface(struct hard_iface *hard_iface, char *iface_name)
batman_packet->flags = 0;
batman_packet->ttl = 2;
batman_packet->tq = TQ_MAX_VALUE;
batman_packet->num_hna = 0;
batman_packet->num_tt = 0;

hard_iface->if_num = bat_priv->num_ifaces;
bat_priv->num_ifaces++;
Expand Down
14 changes: 7 additions & 7 deletions net/batman-adv/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ int mesh_init(struct net_device *soft_iface)

spin_lock_init(&bat_priv->forw_bat_list_lock);
spin_lock_init(&bat_priv->forw_bcast_list_lock);
spin_lock_init(&bat_priv->hna_lhash_lock);
spin_lock_init(&bat_priv->hna_ghash_lock);
spin_lock_init(&bat_priv->tt_lhash_lock);
spin_lock_init(&bat_priv->tt_ghash_lock);
spin_lock_init(&bat_priv->gw_list_lock);
spin_lock_init(&bat_priv->vis_hash_lock);
spin_lock_init(&bat_priv->vis_list_lock);
Expand All @@ -100,13 +100,13 @@ int mesh_init(struct net_device *soft_iface)
if (originator_init(bat_priv) < 1)
goto err;

if (hna_local_init(bat_priv) < 1)
if (tt_local_init(bat_priv) < 1)
goto err;

if (hna_global_init(bat_priv) < 1)
if (tt_global_init(bat_priv) < 1)
goto err;

hna_local_add(soft_iface, soft_iface->dev_addr);
tt_local_add(soft_iface, soft_iface->dev_addr);

if (vis_init(bat_priv) < 1)
goto err;
Expand Down Expand Up @@ -137,8 +137,8 @@ void mesh_free(struct net_device *soft_iface)
gw_node_purge(bat_priv);
originator_free(bat_priv);

hna_local_free(bat_priv);
hna_global_free(bat_priv);
tt_local_free(bat_priv);
tt_global_free(bat_priv);

softif_neigh_purge(bat_priv);

Expand Down
4 changes: 2 additions & 2 deletions net/batman-adv/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#define PURGE_TIMEOUT 200 /* purge originators after time in seconds if no
* valid packet comes in -> TODO: check
* influence on TQ_LOCAL_WINDOW_SIZE */
#define LOCAL_HNA_TIMEOUT 3600 /* in seconds */
#define TT_LOCAL_TIMEOUT 3600 /* in seconds */

#define TQ_LOCAL_WINDOW_SIZE 64 /* sliding packet range of received originator
* messages in squence numbers (should be a
Expand Down Expand Up @@ -89,7 +89,7 @@

#define DBG_BATMAN 1 /* all messages related to routing / flooding /
* broadcasting / etc */
#define DBG_ROUTES 2 /* route or hna added / changed / deleted */
#define DBG_ROUTES 2 /* route or tt entry added / changed / deleted */
#define DBG_ALL 3


Expand Down
8 changes: 4 additions & 4 deletions net/batman-adv/originator.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ static void orig_node_free_rcu(struct rcu_head *rcu)
spin_unlock_bh(&orig_node->neigh_list_lock);

frag_list_free(&orig_node->frag_list);
hna_global_del_orig(orig_node->bat_priv, orig_node,
tt_global_del_orig(orig_node->bat_priv, orig_node,
"originator timed out");

kfree(orig_node->bcast_own);
Expand Down Expand Up @@ -220,7 +220,7 @@ struct orig_node *get_orig_node(struct bat_priv *bat_priv, uint8_t *addr)
orig_node->bat_priv = bat_priv;
memcpy(orig_node->orig, addr, ETH_ALEN);
orig_node->router = NULL;
orig_node->hna_buff = NULL;
orig_node->tt_buff = NULL;
orig_node->bcast_seqno_reset = jiffies - 1
- msecs_to_jiffies(RESET_PROTECTION_MS);
orig_node->batman_seqno_reset = jiffies - 1
Expand Down Expand Up @@ -331,8 +331,8 @@ static bool purge_orig_node(struct bat_priv *bat_priv,
&best_neigh_node)) {
update_routes(bat_priv, orig_node,
best_neigh_node,
orig_node->hna_buff,
orig_node->hna_buff_len);
orig_node->tt_buff,
orig_node->tt_buff_len);
}
}

Expand Down
2 changes: 1 addition & 1 deletion net/batman-adv/packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct batman_packet {
uint8_t orig[6];
uint8_t prev_sender[6];
uint8_t ttl;
uint8_t num_hna;
uint8_t num_tt;
uint8_t gw_flags; /* flags related to gateway class */
uint8_t align;
} __packed;
Expand Down
Loading

0 comments on commit 2dafb49

Please sign in to comment.