The following commit has been merged in the merge/master branch:
commit 42f5d8917ac5dd3541cda17a0a56ae583ee21686
Merge: af8026ac43c637496fedb0d3873d504a9f798925 f80413a252ab6f8c29bb761115cb75f9eb3089a5
Author: Antonio Quartulli <ordex(a)autistici.org>
Date: Sun Jun 24 18:32:39 2012 +0200
Merge remote-tracking branch 'origin/standalone/next' into merge/master
Conflicts:
net/batman-adv/compat.h
diff --combined net/batman-adv/bat_iv_ogm.c
index 1dfe0e4,e877af8..e877af8
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@@ -145,7 -145,7 +145,7 @@@ static uint8_t batadv_hop_penalty(uint8
/* is there another aggregated packet here? */
static int batadv_iv_ogm_aggr_packet(int buff_pos, int packet_len,
- int tt_num_changes)
+ int tt_num_changes)
{
int next_buff_pos = 0;
diff --combined net/batman-adv/bridge_loop_avoidance.c
index 38aab1e,49e10d9..49e10d9
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@@ -1222,7 -1222,7 +1222,7 @@@ int batadv_bla_check_bcast_duplist(stru
/* calculate the crc ... */
crc = crc16(0, content, length);
- for (i = 0 ; i < BATADV_DUPLIST_SIZE; i++) {
+ for (i = 0; i < BATADV_DUPLIST_SIZE; i++) {
curr = (bat_priv->bcast_duplist_curr + i) % BATADV_DUPLIST_SIZE;
entry = &bat_priv->bcast_duplist[curr];
diff --combined net/batman-adv/debugfs.c
index e45cf0e,34fbb16..34fbb16
--- a/net/batman-adv/debugfs.c
+++ b/net/batman-adv/debugfs.c
@@@ -111,6 -111,11 +111,11 @@@ static int batadv_log_release(struct in
return 0;
}
+ static int batadv_log_empty(struct batadv_debug_log *debug_log)
+ {
+ return !(debug_log->log_start - debug_log->log_end);
+ }
+
static ssize_t batadv_log_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
@@@ -120,8 -125,7 +125,7 @@@
char *char_addr;
char c;
- if ((file->f_flags & O_NONBLOCK) &&
- !(debug_log->log_end - debug_log->log_start))
+ if ((file->f_flags & O_NONBLOCK) && batadv_log_empty(debug_log))
return -EAGAIN;
if (!buf)
@@@ -134,7 -138,7 +138,7 @@@
return -EFAULT;
error = wait_event_interruptible(debug_log->queue_wait,
- (debug_log->log_start - debug_log->log_end));
+ (!batadv_log_empty(debug_log)));
if (error)
return error;
@@@ -175,7 -179,7 +179,7 @@@ static unsigned int batadv_log_poll(str
poll_wait(file, &debug_log->queue_wait, wait);
- if (debug_log->log_end - debug_log->log_start)
+ if (!batadv_log_empty(debug_log))
return POLLIN | POLLRDNORM;
return 0;
@@@ -370,9 -374,9 +374,9 @@@ int batadv_debugfs_add_meshif(struct ne
for (bat_debug = batadv_mesh_debuginfos; *bat_debug; ++bat_debug) {
file = debugfs_create_file(((*bat_debug)->attr).name,
- S_IFREG | ((*bat_debug)->attr).mode,
- bat_priv->debug_dir,
- dev, &(*bat_debug)->fops);
+ S_IFREG | ((*bat_debug)->attr).mode,
+ bat_priv->debug_dir,
+ dev, &(*bat_debug)->fops);
if (!file) {
batadv_err(dev, "Can't add debugfs file: %s/%s\n",
dev->name, ((*bat_debug)->attr).name);
diff --combined net/batman-adv/gateway_client.c
index 6fe5cc8,b421cc4..b421cc4
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@@ -228,8 -228,8 +228,8 @@@ void batadv_gw_election(struct batadv_p
} else if ((!curr_gw) && (next_gw)) {
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Adding route to gateway %pM (gw_flags: %i, tq: %i)\n",
- next_gw->orig_node->orig,
- next_gw->orig_node->gw_flags, router->tq_avg);
+ next_gw->orig_node->orig,
+ next_gw->orig_node->gw_flags, router->tq_avg);
batadv_throw_uevent(bat_priv, BATADV_UEV_GW, BATADV_UEV_ADD,
gw_addr);
} else {
diff --combined net/batman-adv/hard-interface.c
index 14e17ea,282bf6e..282bf6e
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@@ -324,15 -324,15 +324,15 @@@ int batadv_hardif_enable_interface(stru
batadv_info(hard_iface->soft_iface, "Adding interface: %s\n",
hard_iface->net_dev->name);
- if (atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu <
- ETH_DATA_LEN + BATADV_HEADER_LEN)
+ if (atomic_read(&bat_priv->fragmentation) &&
+ hard_iface->net_dev->mtu < ETH_DATA_LEN + BATADV_HEADER_LEN)
batadv_info(hard_iface->soft_iface,
"The MTU of interface %s is too small (%i) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to %zi would solve the problem.\n",
hard_iface->net_dev->name, hard_iface->net_dev->mtu,
ETH_DATA_LEN + BATADV_HEADER_LEN);
- if (!atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu <
- ETH_DATA_LEN + BATADV_HEADER_LEN)
+ if (!atomic_read(&bat_priv->fragmentation) &&
+ hard_iface->net_dev->mtu < ETH_DATA_LEN + BATADV_HEADER_LEN)
batadv_info(hard_iface->soft_iface,
"The MTU of interface %s is too small (%i) to handle the transport of batman-adv packets. If you experience problems getting traffic through try increasing the MTU to %zi.\n",
hard_iface->net_dev->name, hard_iface->net_dev->mtu,
@@@ -486,7 -486,7 +486,7 @@@ void batadv_hardif_remove_interfaces(vo
}
static int batadv_hard_if_event(struct notifier_block *this,
- unsigned long event, void *ptr)
+ unsigned long event, void *ptr)
{
struct net_device *net_dev = ptr;
struct batadv_hard_iface *hard_iface;
diff --combined net/batman-adv/hash.c
index 2b16381,15a849c..15a849c
--- a/net/batman-adv/hash.c
+++ b/net/batman-adv/hash.c
@@@ -25,7 -25,7 +25,7 @@@ static void batadv_hash_init(struct bat
{
uint32_t i;
- for (i = 0 ; i < hash->size; i++) {
+ for (i = 0; i < hash->size; i++) {
INIT_HLIST_HEAD(&hash->table[i]);
spin_lock_init(&hash->list_locks[i]);
}
@@@ -73,6 -73,6 +73,6 @@@ void batadv_hash_set_lock_class(struct
{
uint32_t i;
- for (i = 0 ; i < hash->size; i++)
+ for (i = 0; i < hash->size; i++)
lockdep_set_class(&hash->list_locks[i], key);
}
diff --combined net/batman-adv/originator.c
index fc1ce26,ac9bdf8..ac9bdf8
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@@ -413,6 -413,7 +413,7 @@@ int batadv_orig_seq_print_text(struct s
int batman_count = 0;
int last_seen_secs;
int last_seen_msecs;
+ unsigned long last_seen_jiffies;
uint32_t i;
int ret = 0;
@@@ -451,10 -452,10 +452,10 @@@
if (neigh_node->tq_avg == 0)
goto next;
- last_seen_secs = jiffies_to_msecs(jiffies -
- orig_node->last_seen) / 1000;
- last_seen_msecs = jiffies_to_msecs(jiffies -
- orig_node->last_seen) % 1000;
+ last_seen_jiffies = jiffies - orig_node->last_seen;
+ last_seen_msecs = jiffies_to_msecs(last_seen_jiffies);
+ last_seen_secs = last_seen_msecs / 1000;
+ last_seen_msecs = last_seen_msecs % 1000;
seq_printf(seq, "%pM %4i.%03is (%3i) %pM [%10s]:",
orig_node->orig, last_seen_secs,
diff --combined net/batman-adv/packet.h
index c0ed5b4,8d3e55a..8d3e55a
--- a/net/batman-adv/packet.h
+++ b/net/batman-adv/packet.h
@@@ -77,7 -77,7 +77,7 @@@ enum batadv_tt_query_flags
BATADV_TT_FULL_TABLE = 1 << 2,
};
- /* TT_CLIENT flags.
+ /* BATADV_TT_CLIENT flags.
* Flags from 1 to 1 << 7 are sent on the wire, while flags from 1 << 8 to
* 1 << 15 are used for local computation only
*/
diff --combined net/batman-adv/routing.c
index b79e42e,bc2b88b..bc2b88b
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@@ -969,8 -969,7 +969,7 @@@ static int batadv_check_unicast_ttvn(st
ETH_HLEN) < 0)
return 0;
- ethhdr = (struct ethhdr *)(skb->data +
- sizeof(struct batadv_unicast_packet));
+ ethhdr = (struct ethhdr *)(skb->data + sizeof(*unicast_packet));
/* we don't have an updated route for this client, so we should
* not try to reroute the packet!!
diff --combined net/batman-adv/sysfs.c
index 6d519ee,66518c7..66518c7
--- a/net/batman-adv/sysfs.c
+++ b/net/batman-adv/sysfs.c
@@@ -119,7 -119,7 +119,7 @@@ ssize_t batadv_show_##_name(struct kobj
static BATADV_ATTR_SIF_STORE_UINT(_name, _min, _max, _post_func)\
static BATADV_ATTR_SIF_SHOW_UINT(_name) \
static BATADV_ATTR(_name, _mode, batadv_show_##_name, \
- batadv_store_##_name)
+ batadv_store_##_name)
#define BATADV_ATTR_HIF_STORE_UINT(_name, _min, _max, _post_func) \
diff --combined net/batman-adv/translation-table.c
index 2a6d7d6,245cc9a..245cc9a
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@@ -145,7 -145,6 +145,6 @@@ static void batadv_tt_orig_list_entry_f
struct batadv_tt_orig_list_entry *orig_entry;
orig_entry = container_of(rcu, struct batadv_tt_orig_list_entry, rcu);
- atomic_dec(&orig_entry->orig_node->tt_size);
batadv_orig_node_free_ref(orig_entry->orig_node);
kfree(orig_entry);
}
@@@ -153,6 -152,8 +152,8 @@@
static void
batadv_tt_orig_list_entry_free_ref(struct batadv_tt_orig_list_entry *orig_entry)
{
+ /* to avoid race conditions, immediately decrease the tt counter */
+ atomic_dec(&orig_entry->orig_node->tt_size);
call_rcu(&orig_entry->rcu, batadv_tt_orig_list_entry_free_rcu);
}
@@@ -245,7 -246,7 +246,7 @@@ void batadv_tt_local_add(struct net_dev
if (tt_local_entry) {
tt_local_entry->last_seen = jiffies;
- /* possibly unset the TT_CLIENT_PENDING flag */
+ /* possibly unset the BATADV_TT_CLIENT_PENDING flag */
tt_local_entry->common.flags &= ~BATADV_TT_CLIENT_PENDING;
goto out;
}
@@@ -713,8 -714,8 +714,8 @@@ int batadv_tt_global_add(struct batadv_
} else {
/* there is already a global entry, use this one. */
- /* If there is the TT_CLIENT_ROAM flag set, there is only one
- * originator left in the list and we previously received a
+ /* If there is the BATADV_TT_CLIENT_ROAM flag set, there is only
+ * one originator left in the list and we previously received a
* delete + roaming change for this originator.
*
* We should first delete the old originator before adding the
@@@ -889,8 -890,8 +890,8 @@@ batadv_tt_global_del_struct(struct bata
}
/* If the client is to be deleted, we check if it is the last origantor entry
- * within tt_global entry. If yes, we set the TT_CLIENT_ROAM flag and the timer,
- * otherwise we simply remove the originator scheduled for deletion.
+ * within tt_global entry. If yes, we set the BATADV_TT_CLIENT_ROAM flag and the
+ * timer, otherwise we simply remove the originator scheduled for deletion.
*/
static void
batadv_tt_global_del_roaming(struct batadv_priv *bat_priv,
@@@ -958,7 -959,7 +959,7 @@@ static void batadv_tt_global_del(struc
* event, there are two possibilities:
* 1) the client roamed from node A to node B => if there
* is only one originator left for this client, we mark
- * it with TT_CLIENT_ROAM, we start a timer and we
+ * it with BATADV_TT_CLIENT_ROAM, we start a timer and we
* wait for node B to claim it. In case of timeout
* the entry is purged.
*
@@@ -1025,7 -1026,6 +1026,6 @@@ void batadv_tt_global_del_orig(struct b
}
spin_unlock_bh(list_lock);
}
- atomic_set(&orig_node->tt_size, 0);
orig_node->tt_initialised = false;
}
@@@ -2148,7 -2148,7 +2148,7 @@@ out
return changed_num;
}
- /* Purge out all the tt local entries marked with TT_CLIENT_PENDING */
+ /* Purge out all the tt local entries marked with BATADV_TT_CLIENT_PENDING */
static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv)
{
struct batadv_hashtable *hash = bat_priv->tt_local_hash;
@@@ -2247,10 -2247,10 +2247,10 @@@ bool batadv_is_ap_isolated(struct batad
{
struct batadv_tt_local_entry *tt_local_entry = NULL;
struct batadv_tt_global_entry *tt_global_entry = NULL;
- bool ret = true;
+ bool ret = false;
if (!atomic_read(&bat_priv->ap_isolation))
- return false;
+ goto out;
tt_local_entry = batadv_tt_local_hash_find(bat_priv, dst);
if (!tt_local_entry)
@@@ -2260,10 -2260,10 +2260,10 @@@
if (!tt_global_entry)
goto out;
- if (_batadv_is_ap_isolated(tt_local_entry, tt_global_entry))
+ if (!_batadv_is_ap_isolated(tt_local_entry, tt_global_entry))
goto out;
- ret = false;
+ ret = true;
out:
if (tt_global_entry)
@@@ -2292,7 -2292,8 +2292,8 @@@ void batadv_tt_update_orig(struct batad
if ((!orig_node->tt_initialised && ttvn == 1) ||
ttvn - orig_ttvn == 1) {
/* the OGM could not contain the changes due to their size or
- * because they have already been sent TT_OGM_APPEND_MAX times.
+ * because they have already been sent BATADV_TT_OGM_APPEND_MAX
+ * times.
* In this case send a tt request
*/
if (!tt_num_changes) {
diff --combined net/batman-adv/unicast.c
index c42b81d,0016464..0016464
--- a/net/batman-adv/unicast.c
+++ b/net/batman-adv/unicast.c
@@@ -296,6 -296,7 +296,7 @@@ int batadv_unicast_send_skb(struct sk_b
struct batadv_neigh_node *neigh_node;
int data_len = skb->len;
int ret = 1;
+ unsigned int dev_mtu;
/* get routing information */
if (is_multicast_ether_addr(ethhdr->h_dest)) {
@@@ -344,9 -345,9 +345,9 @@@ find_router
if (batadv_tt_global_client_is_roaming(bat_priv, ethhdr->h_dest))
unicast_packet->ttvn = unicast_packet->ttvn - 1;
+ dev_mtu = neigh_node->if_incoming->net_dev->mtu;
if (atomic_read(&bat_priv->fragmentation) &&
- data_len + sizeof(*unicast_packet) >
- neigh_node->if_incoming->net_dev->mtu) {
+ data_len + sizeof(*unicast_packet) > dev_mtu) {
/* send frag skb decreases ttl */
unicast_packet->header.ttl++;
ret = batadv_frag_send_skb(skb, bat_priv,
--
linux integration