The following commit has been merged in the master branch: commit 4c4b4a182eeb3bb5e18e5e6853afdc4b015758dd Merge: f8a89f0c03dadc2eb95481062b69c044442fdaa7 474f9178314dc440d3be1df8e1af0f222ad7aff1 Author: Marek Lindner lindner_marek@yahoo.de Date: Mon Oct 24 14:40:50 2011 +0200
Merge branch 'next'
diff --combined compat.h index 64fbac7,58c3c6a..964c066 --- a/compat.h +++ b/compat.h @@@ -55,13 -55,6 +55,13 @@@
#endif /* < KERNEL_VERSION(2, 6, 36) */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) + +#define kstrtoul strict_strtoul +#define kstrtol strict_strtol + +#endif /* < KERNEL_VERSION(2, 6, 39) */ + #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
#define kfree_rcu(ptr, rcu_head) call_rcu(&ptr->rcu_head, free_rcu_##ptr) @@@ -70,7 -63,6 +70,6 @@@ void free_rcu_gw_node(struct rcu_head * void free_rcu_neigh_node(struct rcu_head *rcu); void free_rcu_softif_neigh(struct rcu_head *rcu); void free_rcu_tt_local_entry(struct rcu_head *rcu); - void free_rcu_tt_global_entry(struct rcu_head *rcu);
#endif /* < KERNEL_VERSION(3, 0, 0) */
diff --combined translation-table.c index c2af2b1,c7aafc7..5f28a7f --- a/translation-table.c +++ b/translation-table.c @@@ -67,7 -67,7 +67,7 @@@ static struct tt_local_entry *tt_local_ struct hlist_head *head; struct hlist_node *node; struct tt_local_entry *tt_local_entry, *tt_local_entry_tmp = NULL; - int index; + uint32_t index;
if (!hash) return NULL; @@@ -99,7 -99,7 +99,7 @@@ static struct tt_global_entry *tt_globa struct hlist_node *node; struct tt_global_entry *tt_global_entry; struct tt_global_entry *tt_global_entry_tmp = NULL; - int index; + uint32_t index;
if (!hash) return NULL; @@@ -137,10 -137,22 +137,22 @@@ static void tt_local_entry_free_ref(str kfree_rcu(tt_local_entry, rcu); }
+ static void tt_global_entry_free_rcu(struct rcu_head *rcu) + { + struct tt_global_entry *tt_global_entry; + + tt_global_entry = container_of(rcu, struct tt_global_entry, rcu); + + if (tt_global_entry->orig_node) + orig_node_free_ref(tt_global_entry->orig_node); + + kfree(tt_global_entry); + } + static void tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry) { if (atomic_dec_and_test(&tt_global_entry->refcount)) - kfree_rcu(tt_global_entry, rcu); + call_rcu(&tt_global_entry->rcu, tt_global_entry_free_rcu); }
static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr, @@@ -304,8 -316,7 +316,8 @@@ int tt_local_seq_print_text(struct seq_ struct hlist_head *head; size_t buf_size, pos; char *buff; - int i, ret = 0; + uint32_t i; + int ret = 0;
primary_if = primary_if_get_selected(bat_priv); if (!primary_if) { @@@ -416,7 -427,7 +428,7 @@@ static void tt_local_purge(struct bat_p struct hlist_node *node, *node_tmp; struct hlist_head *head; spinlock_t *list_lock; /* protects write access to the hash lists */ - int i; + uint32_t i;
for (i = 0; i < hash->size; i++) { head = &hash->table[i]; @@@ -454,7 -465,7 +466,7 @@@ static void tt_local_table_free(struct struct tt_local_entry *tt_local_entry; struct hlist_node *node, *node_tmp; struct hlist_head *head; - int i; + uint32_t i;
if (!bat_priv->tt_local_hash) return; @@@ -581,8 -592,7 +593,8 @@@ int tt_global_seq_print_text(struct seq struct hlist_head *head; size_t buf_size, pos; char *buff; - int i, ret = 0; + uint32_t i; + int ret = 0;
primary_if = primary_if_get_selected(bat_priv); if (!primary_if) { @@@ -706,12 -716,15 +718,15 @@@ void tt_global_del_orig(struct bat_pri struct orig_node *orig_node, const char *message) { struct tt_global_entry *tt_global_entry; - int i; + uint32_t i; struct hashtable_t *hash = bat_priv->tt_global_hash; struct hlist_node *node, *safe; struct hlist_head *head; spinlock_t *list_lock; /* protects write access to the hash lists */
+ if (!hash) + return; + for (i = 0; i < hash->size; i++) { head = &hash->table[i]; list_lock = &hash->list_locks[i]; @@@ -722,10 -735,9 +737,10 @@@ if (tt_global_entry->orig_node == orig_node) { bat_dbg(DBG_TT, bat_priv, "Deleting global tt entry %pM " - "(via %pM): originator time out\n", + "(via %pM): %s\n", tt_global_entry->addr, - tt_global_entry->orig_node->orig); + tt_global_entry->orig_node->orig, + message); hlist_del_rcu(node); tt_global_entry_free_ref(tt_global_entry); } @@@ -742,7 -754,7 +757,7 @@@ static void tt_global_roam_purge(struc struct hlist_node *node, *node_tmp; struct hlist_head *head; spinlock_t *list_lock; /* protects write access to the hash lists */ - int i; + uint32_t i;
for (i = 0; i < hash->size; i++) { head = &hash->table[i]; @@@ -776,7 -788,7 +791,7 @@@ static void tt_global_table_free(struc struct tt_global_entry *tt_global_entry; struct hlist_node *node, *node_tmp; struct hlist_head *head; - int i; + uint32_t i;
if (!bat_priv->tt_global_hash) return; @@@ -862,8 -874,7 +877,8 @@@ uint16_t tt_global_crc(struct bat_priv struct tt_global_entry *tt_global_entry; struct hlist_node *node; struct hlist_head *head; - int i, j; + uint32_t i; + int j;
for (i = 0; i < hash->size; i++) { head = &hash->table[i]; @@@ -900,8 -911,7 +915,8 @@@ uint16_t tt_local_crc(struct bat_priv * struct tt_local_entry *tt_local_entry; struct hlist_node *node; struct hlist_head *head; - int i, j; + uint32_t i; + int j;
for (i = 0; i < hash->size; i++) { head = &hash->table[i]; @@@ -1038,7 -1048,7 +1053,7 @@@ static struct sk_buff *tt_response_fill struct sk_buff *skb = NULL; uint16_t tt_tot, tt_count; ssize_t tt_query_size = sizeof(struct tt_query_packet); - int i; + uint32_t i;
if (tt_query_size + tt_len > primary_if->soft_iface->mtu) { tt_len = primary_if->soft_iface->mtu - tt_query_size; @@@ -1177,11 -1187,11 +1192,11 @@@ static bool send_other_tt_response(stru (tt_request->flags & TT_FULL_TABLE ? 'F' : '.'));
/* Let's get the orig node of the REAL destination */ - req_dst_orig_node = get_orig_node(bat_priv, tt_request->dst); + req_dst_orig_node = orig_hash_find(bat_priv, tt_request->dst); if (!req_dst_orig_node) goto out;
- res_dst_orig_node = get_orig_node(bat_priv, tt_request->src); + res_dst_orig_node = orig_hash_find(bat_priv, tt_request->src); if (!res_dst_orig_node) goto out;
@@@ -1307,7 -1317,7 +1322,7 @@@ static bool send_my_tt_response(struct my_ttvn = (uint8_t)atomic_read(&bat_priv->ttvn); req_ttvn = tt_request->ttvn;
- orig_node = get_orig_node(bat_priv, tt_request->src); + orig_node = orig_hash_find(bat_priv, tt_request->src); if (!orig_node) goto out;
@@@ -1715,7 -1725,7 +1730,7 @@@ void tt_free(struct bat_priv *bat_priv * entry */ static void tt_local_reset_flags(struct bat_priv *bat_priv, uint16_t flags) { - int i; + uint32_t i; struct hashtable_t *hash = bat_priv->tt_local_hash; struct hlist_head *head; struct hlist_node *node; @@@ -1748,7 -1758,7 +1763,7 @@@ static void tt_local_purge_pending_clie struct hlist_node *node, *node_tmp; struct hlist_head *head; spinlock_t *list_lock; /* protects write access to the hash lists */ - int i; + uint32_t i;
if (!hash) return;