diff options
author | Sven Eckelmann <sven@narfation.org> | 2012-05-11 20:09:43 -0400 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-06-20 16:15:33 -0400 |
commit | 9cfc7bd608b97463993b4f3e4775d99022253f8d (patch) | |
tree | fcfcf1e714a91943a740dcaa2744ee66448f9f73 /net | |
parent | 3193e8fdfa355289892661d206d1954114a7be95 (diff) |
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: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net')
40 files changed, 349 insertions, 388 deletions
diff --git a/net/batman-adv/bat_algo.h b/net/batman-adv/bat_algo.h index a14336a08fac..a0ba3bff9b36 100644 --- a/net/batman-adv/bat_algo.h +++ b/net/batman-adv/bat_algo.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2011-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2011-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner | 3 | * Marek Lindner |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #ifndef _NET_BATMAN_ADV_BAT_ALGO_H_ | 20 | #ifndef _NET_BATMAN_ADV_BAT_ALGO_H_ |
diff --git a/net/batman-adv/bat_debugfs.c b/net/batman-adv/bat_debugfs.c index 3900624d333d..4001c57a25e4 100644 --- a/net/batman-adv/bat_debugfs.c +++ b/net/batman-adv/bat_debugfs.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner | 3 | * Marek Lindner |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #include "main.h" | 20 | #include "main.h" |
diff --git a/net/batman-adv/bat_debugfs.h b/net/batman-adv/bat_debugfs.h index 3b206c811263..eb0d576b4f9d 100644 --- a/net/batman-adv/bat_debugfs.h +++ b/net/batman-adv/bat_debugfs.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner | 3 | * Marek Lindner |
5 | * | 4 | * |
@@ -16,10 +15,8 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | |||
23 | #ifndef _NET_BATMAN_ADV_DEBUGFS_H_ | 20 | #ifndef _NET_BATMAN_ADV_DEBUGFS_H_ |
24 | #define _NET_BATMAN_ADV_DEBUGFS_H_ | 21 | #define _NET_BATMAN_ADV_DEBUGFS_H_ |
25 | 22 | ||
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index 0430063d3a7d..94859d45ed6e 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner, Simon Wunderlich | 3 | * Marek Lindner, Simon Wunderlich |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #include "main.h" | 20 | #include "main.h" |
@@ -170,7 +168,8 @@ static void bat_iv_ogm_send_to_if(struct forw_packet *forw_packet, | |||
170 | batman_ogm_packet->tt_num_changes)) { | 168 | batman_ogm_packet->tt_num_changes)) { |
171 | 169 | ||
172 | /* we might have aggregated direct link packets with an | 170 | /* we might have aggregated direct link packets with an |
173 | * ordinary base packet */ | 171 | * ordinary base packet |
172 | */ | ||
174 | if ((forw_packet->direct_link_flags & (1 << packet_num)) && | 173 | if ((forw_packet->direct_link_flags & (1 << packet_num)) && |
175 | (forw_packet->if_incoming == hard_iface)) | 174 | (forw_packet->if_incoming == hard_iface)) |
176 | batman_ogm_packet->flags |= DIRECTLINK; | 175 | batman_ogm_packet->flags |= DIRECTLINK; |
@@ -237,8 +236,9 @@ static void bat_iv_ogm_emit(struct forw_packet *forw_packet) | |||
237 | if (!primary_if) | 236 | if (!primary_if) |
238 | goto out; | 237 | goto out; |
239 | 238 | ||
240 | /* multihomed peer assumed */ | 239 | /* multihomed peer assumed |
241 | /* non-primary OGMs are only broadcasted on their interface */ | 240 | * non-primary OGMs are only broadcasted on their interface |
241 | */ | ||
242 | if ((directlink && (batman_ogm_packet->header.ttl == 1)) || | 242 | if ((directlink && (batman_ogm_packet->header.ttl == 1)) || |
243 | (forw_packet->own && (forw_packet->if_incoming != primary_if))) { | 243 | (forw_packet->own && (forw_packet->if_incoming != primary_if))) { |
244 | 244 | ||
@@ -292,41 +292,39 @@ static bool bat_iv_ogm_can_aggregate(const struct batman_ogm_packet | |||
292 | 292 | ||
293 | batman_ogm_packet = (struct batman_ogm_packet *)forw_packet->skb->data; | 293 | batman_ogm_packet = (struct batman_ogm_packet *)forw_packet->skb->data; |
294 | 294 | ||
295 | /** | 295 | /* we can aggregate the current packet to this aggregated packet |
296 | * we can aggregate the current packet to this aggregated packet | ||
297 | * if: | 296 | * if: |
298 | * | 297 | * |
299 | * - the send time is within our MAX_AGGREGATION_MS time | 298 | * - the send time is within our MAX_AGGREGATION_MS time |
300 | * - the resulting packet wont be bigger than | 299 | * - the resulting packet wont be bigger than |
301 | * MAX_AGGREGATION_BYTES | 300 | * MAX_AGGREGATION_BYTES |
302 | */ | 301 | */ |
303 | |||
304 | if (time_before(send_time, forw_packet->send_time) && | 302 | if (time_before(send_time, forw_packet->send_time) && |
305 | time_after_eq(send_time + msecs_to_jiffies(MAX_AGGREGATION_MS), | 303 | time_after_eq(send_time + msecs_to_jiffies(MAX_AGGREGATION_MS), |
306 | forw_packet->send_time) && | 304 | forw_packet->send_time) && |
307 | (aggregated_bytes <= MAX_AGGREGATION_BYTES)) { | 305 | (aggregated_bytes <= MAX_AGGREGATION_BYTES)) { |
308 | 306 | ||
309 | /** | 307 | /* check aggregation compatibility |
310 | * check aggregation compatibility | ||
311 | * -> direct link packets are broadcasted on | 308 | * -> direct link packets are broadcasted on |
312 | * their interface only | 309 | * their interface only |
313 | * -> aggregate packet if the current packet is | 310 | * -> aggregate packet if the current packet is |
314 | * a "global" packet as well as the base | 311 | * a "global" packet as well as the base |
315 | * packet | 312 | * packet |
316 | */ | 313 | */ |
317 | |||
318 | primary_if = primary_if_get_selected(bat_priv); | 314 | primary_if = primary_if_get_selected(bat_priv); |
319 | if (!primary_if) | 315 | if (!primary_if) |
320 | goto out; | 316 | goto out; |
321 | 317 | ||
322 | /* packets without direct link flag and high TTL | 318 | /* packets without direct link flag and high TTL |
323 | * are flooded through the net */ | 319 | * are flooded through the net |
320 | */ | ||
324 | if ((!directlink) && | 321 | if ((!directlink) && |
325 | (!(batman_ogm_packet->flags & DIRECTLINK)) && | 322 | (!(batman_ogm_packet->flags & DIRECTLINK)) && |
326 | (batman_ogm_packet->header.ttl != 1) && | 323 | (batman_ogm_packet->header.ttl != 1) && |
327 | 324 | ||
328 | /* own packets originating non-primary | 325 | /* own packets originating non-primary |
329 | * interfaces leave only that interface */ | 326 | * interfaces leave only that interface |
327 | */ | ||
330 | ((!forw_packet->own) || | 328 | ((!forw_packet->own) || |
331 | (forw_packet->if_incoming == primary_if))) { | 329 | (forw_packet->if_incoming == primary_if))) { |
332 | res = true; | 330 | res = true; |
@@ -334,14 +332,16 @@ static bool bat_iv_ogm_can_aggregate(const struct batman_ogm_packet | |||
334 | } | 332 | } |
335 | 333 | ||
336 | /* if the incoming packet is sent via this one | 334 | /* if the incoming packet is sent via this one |
337 | * interface only - we still can aggregate */ | 335 | * interface only - we still can aggregate |
336 | */ | ||
338 | if ((directlink) && | 337 | if ((directlink) && |
339 | (new_batman_ogm_packet->header.ttl == 1) && | 338 | (new_batman_ogm_packet->header.ttl == 1) && |
340 | (forw_packet->if_incoming == if_incoming) && | 339 | (forw_packet->if_incoming == if_incoming) && |
341 | 340 | ||
342 | /* packets from direct neighbors or | 341 | /* packets from direct neighbors or |
343 | * own secondary interface packets | 342 | * own secondary interface packets |
344 | * (= secondary interface packets in general) */ | 343 | * (= secondary interface packets in general) |
344 | */ | ||
345 | (batman_ogm_packet->flags & DIRECTLINK || | 345 | (batman_ogm_packet->flags & DIRECTLINK || |
346 | (forw_packet->own && | 346 | (forw_packet->own && |
347 | forw_packet->if_incoming != primary_if))) { | 347 | forw_packet->if_incoming != primary_if))) { |
@@ -457,8 +457,7 @@ static void bat_iv_ogm_queue_add(struct bat_priv *bat_priv, | |||
457 | int packet_len, struct hard_iface *if_incoming, | 457 | int packet_len, struct hard_iface *if_incoming, |
458 | int own_packet, unsigned long send_time) | 458 | int own_packet, unsigned long send_time) |
459 | { | 459 | { |
460 | /** | 460 | /* _aggr -> pointer to the packet we want to aggregate with |
461 | * _aggr -> pointer to the packet we want to aggregate with | ||
462 | * _pos -> pointer to the position in the queue | 461 | * _pos -> pointer to the position in the queue |
463 | */ | 462 | */ |
464 | struct forw_packet *forw_packet_aggr = NULL, *forw_packet_pos = NULL; | 463 | 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, | |||
487 | } | 486 | } |
488 | 487 | ||
489 | /* nothing to aggregate with - either aggregation disabled or no | 488 | /* nothing to aggregate with - either aggregation disabled or no |
490 | * suitable aggregation packet found */ | 489 | * suitable aggregation packet found |
490 | */ | ||
491 | if (!forw_packet_aggr) { | 491 | if (!forw_packet_aggr) { |
492 | /* the following section can run without the lock */ | 492 | /* the following section can run without the lock */ |
493 | spin_unlock_bh(&bat_priv->forw_bat_list_lock); | 493 | spin_unlock_bh(&bat_priv->forw_bat_list_lock); |
494 | 494 | ||
495 | /** | 495 | /* if we could not aggregate this packet with one of the others |
496 | * if we could not aggregate this packet with one of the others | ||
497 | * we hold it back for a while, so that it might be aggregated | 496 | * we hold it back for a while, so that it might be aggregated |
498 | * later on | 497 | * later on |
499 | */ | 498 | */ |
@@ -691,7 +690,8 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv, | |||
691 | batadv_bonding_candidate_add(orig_node, neigh_node); | 690 | batadv_bonding_candidate_add(orig_node, neigh_node); |
692 | 691 | ||
693 | /* if this neighbor already is our next hop there is nothing | 692 | /* if this neighbor already is our next hop there is nothing |
694 | * to change */ | 693 | * to change |
694 | */ | ||
695 | router = batadv_orig_node_get_router(orig_node); | 695 | router = batadv_orig_node_get_router(orig_node); |
696 | if (router == neigh_node) | 696 | if (router == neigh_node) |
697 | goto update_tt; | 697 | goto update_tt; |
@@ -701,7 +701,8 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv, | |||
701 | goto update_tt; | 701 | goto update_tt; |
702 | 702 | ||
703 | /* if the TQ is the same and the link not more symmetric we | 703 | /* if the TQ is the same and the link not more symmetric we |
704 | * won't consider it either */ | 704 | * won't consider it either |
705 | */ | ||
705 | if (router && (neigh_node->tq_avg == router->tq_avg)) { | 706 | if (router && (neigh_node->tq_avg == router->tq_avg)) { |
706 | orig_node_tmp = router->orig_node; | 707 | orig_node_tmp = router->orig_node; |
707 | spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); | 708 | 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, | |||
723 | 724 | ||
724 | update_tt: | 725 | update_tt: |
725 | /* I have to check for transtable changes only if the OGM has been | 726 | /* I have to check for transtable changes only if the OGM has been |
726 | * sent through a primary interface */ | 727 | * sent through a primary interface |
728 | */ | ||
727 | if (((batman_ogm_packet->orig != ethhdr->h_source) && | 729 | if (((batman_ogm_packet->orig != ethhdr->h_source) && |
728 | (batman_ogm_packet->header.ttl > 2)) || | 730 | (batman_ogm_packet->header.ttl > 2)) || |
729 | (batman_ogm_packet->flags & PRIMARIES_FIRST_HOP)) | 731 | (batman_ogm_packet->flags & PRIMARIES_FIRST_HOP)) |
@@ -812,15 +814,17 @@ static int bat_iv_ogm_calc_tq(struct orig_node *orig_node, | |||
812 | total_count = (orig_eq_count > neigh_rq_count ? | 814 | total_count = (orig_eq_count > neigh_rq_count ? |
813 | neigh_rq_count : orig_eq_count); | 815 | neigh_rq_count : orig_eq_count); |
814 | 816 | ||
815 | /* if we have too few packets (too less data) we set tq_own to zero */ | 817 | /* if we have too few packets (too less data) we set tq_own to zero |
816 | /* if we receive too few packets it is not considered bidirectional */ | 818 | * if we receive too few packets it is not considered bidirectional |
819 | */ | ||
817 | if ((total_count < TQ_LOCAL_BIDRECT_SEND_MINIMUM) || | 820 | if ((total_count < TQ_LOCAL_BIDRECT_SEND_MINIMUM) || |
818 | (neigh_rq_count < TQ_LOCAL_BIDRECT_RECV_MINIMUM)) | 821 | (neigh_rq_count < TQ_LOCAL_BIDRECT_RECV_MINIMUM)) |
819 | tq_own = 0; | 822 | tq_own = 0; |
820 | else | 823 | else |
821 | /* neigh_node->real_packet_count is never zero as we | 824 | /* neigh_node->real_packet_count is never zero as we |
822 | * only purge old information when getting new | 825 | * only purge old information when getting new |
823 | * information */ | 826 | * information |
827 | */ | ||
824 | tq_own = (TQ_MAX_VALUE * total_count) / neigh_rq_count; | 828 | tq_own = (TQ_MAX_VALUE * total_count) / neigh_rq_count; |
825 | 829 | ||
826 | /* 1 - ((1-x) ** 3), normalized to TQ_MAX_VALUE this does | 830 | /* 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, | |||
846 | neigh_rq_count, tq_own, tq_asym_penalty, batman_ogm_packet->tq); | 850 | neigh_rq_count, tq_own, tq_asym_penalty, batman_ogm_packet->tq); |
847 | 851 | ||
848 | /* if link has the minimum required transmission quality | 852 | /* if link has the minimum required transmission quality |
849 | * consider it bidirectional */ | 853 | * consider it bidirectional |
854 | */ | ||
850 | if (batman_ogm_packet->tq >= TQ_TOTAL_BIDRECT_LIMIT) | 855 | if (batman_ogm_packet->tq >= TQ_TOTAL_BIDRECT_LIMIT) |
851 | ret = 1; | 856 | ret = 1; |
852 | 857 | ||
@@ -1039,8 +1044,9 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, | |||
1039 | return; | 1044 | return; |
1040 | 1045 | ||
1041 | /* neighbor has to indicate direct link and it has to | 1046 | /* neighbor has to indicate direct link and it has to |
1042 | * come via the corresponding interface */ | 1047 | * come via the corresponding interface |
1043 | /* save packet seqno for bidirectional check */ | 1048 | * save packet seqno for bidirectional check |
1049 | */ | ||
1044 | if (has_directlink_flag && | 1050 | if (has_directlink_flag && |
1045 | compare_eth(if_incoming->net_dev->dev_addr, | 1051 | compare_eth(if_incoming->net_dev->dev_addr, |
1046 | batman_ogm_packet->orig)) { | 1052 | batman_ogm_packet->orig)) { |
@@ -1117,7 +1123,8 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, | |||
1117 | } | 1123 | } |
1118 | 1124 | ||
1119 | /* if sender is a direct neighbor the sender mac equals | 1125 | /* if sender is a direct neighbor the sender mac equals |
1120 | * originator mac */ | 1126 | * originator mac |
1127 | */ | ||
1121 | orig_neigh_node = (is_single_hop_neigh ? | 1128 | orig_neigh_node = (is_single_hop_neigh ? |
1122 | orig_node : | 1129 | orig_node : |
1123 | batadv_get_orig_node(bat_priv, ethhdr->h_source)); | 1130 | batadv_get_orig_node(bat_priv, ethhdr->h_source)); |
@@ -1127,7 +1134,8 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, | |||
1127 | orig_neigh_router = batadv_orig_node_get_router(orig_neigh_node); | 1134 | orig_neigh_router = batadv_orig_node_get_router(orig_neigh_node); |
1128 | 1135 | ||
1129 | /* drop packet if sender is not a direct neighbor and if we | 1136 | /* drop packet if sender is not a direct neighbor and if we |
1130 | * don't route towards it */ | 1137 | * don't route towards it |
1138 | */ | ||
1131 | if (!is_single_hop_neigh && (!orig_neigh_router)) { | 1139 | if (!is_single_hop_neigh && (!orig_neigh_router)) { |
1132 | bat_dbg(DBG_BATMAN, bat_priv, | 1140 | bat_dbg(DBG_BATMAN, bat_priv, |
1133 | "Drop packet: OGM via unknown neighbor!\n"); | 1141 | "Drop packet: OGM via unknown neighbor!\n"); |
@@ -1141,7 +1149,8 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, | |||
1141 | batman_ogm_packet); | 1149 | batman_ogm_packet); |
1142 | 1150 | ||
1143 | /* update ranking if it is not a duplicate or has the same | 1151 | /* update ranking if it is not a duplicate or has the same |
1144 | * seqno and similar ttl as the non-duplicate */ | 1152 | * seqno and similar ttl as the non-duplicate |
1153 | */ | ||
1145 | if (is_bidirectional && | 1154 | if (is_bidirectional && |
1146 | (!is_duplicate || | 1155 | (!is_duplicate || |
1147 | ((orig_node->last_real_seqno == ntohl(batman_ogm_packet->seqno)) && | 1156 | ((orig_node->last_real_seqno == ntohl(batman_ogm_packet->seqno)) && |
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c index 5a7b042873e1..8196fa6ff22e 100644 --- a/net/batman-adv/bat_sysfs.c +++ b/net/batman-adv/bat_sysfs.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner | 3 | * Marek Lindner |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #include "main.h" | 20 | #include "main.h" |
@@ -84,7 +82,8 @@ ssize_t show_##_name(struct kobject *kobj, \ | |||
84 | } \ | 82 | } \ |
85 | 83 | ||
86 | /* Use this, if you are going to turn a [name] in the soft-interface | 84 | /* Use this, if you are going to turn a [name] in the soft-interface |
87 | * (bat_priv) on or off */ | 85 | * (bat_priv) on or off |
86 | */ | ||
88 | #define BAT_ATTR_SIF_BOOL(_name, _mode, _post_func) \ | 87 | #define BAT_ATTR_SIF_BOOL(_name, _mode, _post_func) \ |
89 | static BAT_ATTR_SIF_STORE_BOOL(_name, _post_func) \ | 88 | static BAT_ATTR_SIF_STORE_BOOL(_name, _post_func) \ |
90 | static BAT_ATTR_SIF_SHOW_BOOL(_name) \ | 89 | static BAT_ATTR_SIF_SHOW_BOOL(_name) \ |
@@ -110,7 +109,8 @@ ssize_t show_##_name(struct kobject *kobj, \ | |||
110 | } \ | 109 | } \ |
111 | 110 | ||
112 | /* Use this, if you are going to set [name] in the soft-interface | 111 | /* Use this, if you are going to set [name] in the soft-interface |
113 | * (bat_priv) to an unsigned integer value */ | 112 | * (bat_priv) to an unsigned integer value |
113 | */ | ||
114 | #define BAT_ATTR_SIF_UINT(_name, _mode, _min, _max, _post_func) \ | 114 | #define BAT_ATTR_SIF_UINT(_name, _mode, _min, _max, _post_func) \ |
115 | static BAT_ATTR_SIF_STORE_UINT(_name, _min, _max, _post_func) \ | 115 | static BAT_ATTR_SIF_STORE_UINT(_name, _min, _max, _post_func) \ |
116 | static BAT_ATTR_SIF_SHOW_UINT(_name) \ | 116 | static BAT_ATTR_SIF_SHOW_UINT(_name) \ |
@@ -155,7 +155,8 @@ ssize_t show_##_name(struct kobject *kobj, \ | |||
155 | } | 155 | } |
156 | 156 | ||
157 | /* Use this, if you are going to set [name] in hard_iface to an | 157 | /* Use this, if you are going to set [name] in hard_iface to an |
158 | * unsigned integer value*/ | 158 | * unsigned integer value |
159 | */ | ||
159 | #define BAT_ATTR_HIF_UINT(_name, _mode, _min, _max, _post_func) \ | 160 | #define BAT_ATTR_HIF_UINT(_name, _mode, _min, _max, _post_func) \ |
160 | static BAT_ATTR_HIF_STORE_UINT(_name, _min, _max, _post_func) \ | 161 | static BAT_ATTR_HIF_STORE_UINT(_name, _min, _max, _post_func) \ |
161 | static BAT_ATTR_HIF_SHOW_UINT(_name) \ | 162 | static BAT_ATTR_HIF_SHOW_UINT(_name) \ |
diff --git a/net/batman-adv/bat_sysfs.h b/net/batman-adv/bat_sysfs.h index f01aea836b98..367227707d52 100644 --- a/net/batman-adv/bat_sysfs.h +++ b/net/batman-adv/bat_sysfs.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner | 3 | * Marek Lindner |
5 | * | 4 | * |
@@ -16,10 +15,8 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | |||
23 | #ifndef _NET_BATMAN_ADV_SYSFS_H_ | 20 | #ifndef _NET_BATMAN_ADV_SYSFS_H_ |
24 | #define _NET_BATMAN_ADV_SYSFS_H_ | 21 | #define _NET_BATMAN_ADV_SYSFS_H_ |
25 | 22 | ||
diff --git a/net/batman-adv/bitarray.c b/net/batman-adv/bitarray.c index 99ed9917ff0d..838abbc73c6c 100644 --- a/net/batman-adv/bitarray.c +++ b/net/batman-adv/bitarray.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2006-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2006-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Simon Wunderlich, Marek Lindner | 3 | * Simon Wunderlich, Marek Lindner |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #include "main.h" | 20 | #include "main.h" |
@@ -46,8 +44,8 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, | |||
46 | struct bat_priv *bat_priv = priv; | 44 | struct bat_priv *bat_priv = priv; |
47 | 45 | ||
48 | /* sequence number is slightly older. We already got a sequence number | 46 | /* sequence number is slightly older. We already got a sequence number |
49 | * higher than this one, so we just mark it. */ | 47 | * higher than this one, so we just mark it. |
50 | 48 | */ | |
51 | if ((seq_num_diff <= 0) && (seq_num_diff > -TQ_LOCAL_WINDOW_SIZE)) { | 49 | if ((seq_num_diff <= 0) && (seq_num_diff > -TQ_LOCAL_WINDOW_SIZE)) { |
52 | if (set_mark) | 50 | if (set_mark) |
53 | bat_set_bit(seq_bits, -seq_num_diff); | 51 | bat_set_bit(seq_bits, -seq_num_diff); |
@@ -55,8 +53,8 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, | |||
55 | } | 53 | } |
56 | 54 | ||
57 | /* sequence number is slightly newer, so we shift the window and | 55 | /* sequence number is slightly newer, so we shift the window and |
58 | * set the mark if required */ | 56 | * set the mark if required |
59 | 57 | */ | |
60 | if ((seq_num_diff > 0) && (seq_num_diff < TQ_LOCAL_WINDOW_SIZE)) { | 58 | if ((seq_num_diff > 0) && (seq_num_diff < TQ_LOCAL_WINDOW_SIZE)) { |
61 | batadv_bitmap_shift_left(seq_bits, seq_num_diff); | 59 | batadv_bitmap_shift_left(seq_bits, seq_num_diff); |
62 | 60 | ||
@@ -66,7 +64,6 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, | |||
66 | } | 64 | } |
67 | 65 | ||
68 | /* sequence number is much newer, probably missed a lot of packets */ | 66 | /* sequence number is much newer, probably missed a lot of packets */ |
69 | |||
70 | if ((seq_num_diff >= TQ_LOCAL_WINDOW_SIZE) && | 67 | if ((seq_num_diff >= TQ_LOCAL_WINDOW_SIZE) && |
71 | (seq_num_diff < EXPECTED_SEQNO_RANGE)) { | 68 | (seq_num_diff < EXPECTED_SEQNO_RANGE)) { |
72 | bat_dbg(DBG_BATMAN, bat_priv, | 69 | bat_dbg(DBG_BATMAN, bat_priv, |
@@ -81,8 +78,8 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, | |||
81 | /* received a much older packet. The other host either restarted | 78 | /* received a much older packet. The other host either restarted |
82 | * or the old packet got delayed somewhere in the network. The | 79 | * or the old packet got delayed somewhere in the network. The |
83 | * packet should be dropped without calling this function if the | 80 | * packet should be dropped without calling this function if the |
84 | * seqno window is protected. */ | 81 | * seqno window is protected. |
85 | 82 | */ | |
86 | if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE) || | 83 | if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE) || |
87 | (seq_num_diff >= EXPECTED_SEQNO_RANGE)) { | 84 | (seq_num_diff >= EXPECTED_SEQNO_RANGE)) { |
88 | 85 | ||
diff --git a/net/batman-adv/bitarray.h b/net/batman-adv/bitarray.h index e855ddd37430..8ab542632343 100644 --- a/net/batman-adv/bitarray.h +++ b/net/batman-adv/bitarray.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2006-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2006-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Simon Wunderlich, Marek Lindner | 3 | * Simon Wunderlich, Marek Lindner |
5 | * | 4 | * |
@@ -16,14 +15,14 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #ifndef _NET_BATMAN_ADV_BITARRAY_H_ | 20 | #ifndef _NET_BATMAN_ADV_BITARRAY_H_ |
23 | #define _NET_BATMAN_ADV_BITARRAY_H_ | 21 | #define _NET_BATMAN_ADV_BITARRAY_H_ |
24 | 22 | ||
25 | /* returns true if the corresponding bit in the given seq_bits indicates true | 23 | /* returns true if the corresponding bit in the given seq_bits indicates true |
26 | * and curr_seqno is within range of last_seqno */ | 24 | * and curr_seqno is within range of last_seqno |
25 | */ | ||
27 | static inline int bat_test_bit(const unsigned long *seq_bits, | 26 | static inline int bat_test_bit(const unsigned long *seq_bits, |
28 | uint32_t last_seqno, uint32_t curr_seqno) | 27 | uint32_t last_seqno, uint32_t curr_seqno) |
29 | { | 28 | { |
@@ -47,7 +46,8 @@ static inline void bat_set_bit(unsigned long *seq_bits, int32_t n) | |||
47 | } | 46 | } |
48 | 47 | ||
49 | /* receive and process one packet, returns 1 if received seq_num is considered | 48 | /* receive and process one packet, returns 1 if received seq_num is considered |
50 | * new, 0 if old */ | 49 | * new, 0 if old |
50 | */ | ||
51 | int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, | 51 | int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, |
52 | int32_t seq_num_diff, int set_mark); | 52 | int32_t seq_num_diff, int set_mark); |
53 | 53 | ||
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index 27f451a64ad0..52c0d637d581 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2011-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2011-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Simon Wunderlich | 3 | * Simon Wunderlich |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #include "main.h" | 20 | #include "main.h" |
@@ -123,8 +121,7 @@ static void claim_free_ref(struct claim *claim) | |||
123 | call_rcu(&claim->rcu, claim_free_rcu); | 121 | call_rcu(&claim->rcu, claim_free_rcu); |
124 | } | 122 | } |
125 | 123 | ||
126 | /** | 124 | /* @bat_priv: the bat priv with all the soft interface information |
127 | * @bat_priv: the bat priv with all the soft interface information | ||
128 | * @data: search data (may be local/static data) | 125 | * @data: search data (may be local/static data) |
129 | * | 126 | * |
130 | * looks for a claim in the hash, and returns it if found | 127 | * 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, | |||
162 | return claim_tmp; | 159 | return claim_tmp; |
163 | } | 160 | } |
164 | 161 | ||
165 | /** | 162 | /* @bat_priv: the bat priv with all the soft interface information |
166 | * @bat_priv: the bat priv with all the soft interface information | ||
167 | * @addr: the address of the originator | 163 | * @addr: the address of the originator |
168 | * @vid: the VLAN ID | 164 | * @vid: the VLAN ID |
169 | * | 165 | * |
@@ -241,8 +237,7 @@ static void bla_del_backbone_claims(struct backbone_gw *backbone_gw) | |||
241 | backbone_gw->crc = BLA_CRC_INIT; | 237 | backbone_gw->crc = BLA_CRC_INIT; |
242 | } | 238 | } |
243 | 239 | ||
244 | /** | 240 | /* @bat_priv: the bat priv with all the soft interface information |
245 | * @bat_priv: the bat priv with all the soft interface information | ||
246 | * @orig: the mac address to be announced within the claim | 241 | * @orig: the mac address to be announced within the claim |
247 | * @vid: the VLAN ID | 242 | * @vid: the VLAN ID |
248 | * @claimtype: the type of the claim (CLAIM, UNCLAIM, ANNOUNCE, ...) | 243 | * @claimtype: the type of the claim (CLAIM, UNCLAIM, ANNOUNCE, ...) |
@@ -347,8 +342,7 @@ out: | |||
347 | hardif_free_ref(primary_if); | 342 | hardif_free_ref(primary_if); |
348 | } | 343 | } |
349 | 344 | ||
350 | /** | 345 | /* @bat_priv: the bat priv with all the soft interface information |
351 | * @bat_priv: the bat priv with all the soft interface information | ||
352 | * @orig: the mac address of the originator | 346 | * @orig: the mac address of the originator |
353 | * @vid: the VLAN ID | 347 | * @vid: the VLAN ID |
354 | * | 348 | * |
@@ -422,8 +416,7 @@ static void bla_update_own_backbone_gw(struct bat_priv *bat_priv, | |||
422 | backbone_gw_free_ref(backbone_gw); | 416 | backbone_gw_free_ref(backbone_gw); |
423 | } | 417 | } |
424 | 418 | ||
425 | /** | 419 | /* @bat_priv: the bat priv with all the soft interface information |
426 | * @bat_priv: the bat priv with all the soft interface information | ||
427 | * @vid: the vid where the request came on | 420 | * @vid: the vid where the request came on |
428 | * | 421 | * |
429 | * Repeat all of our own claims, and finally send an ANNOUNCE frame | 422 | * 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, | |||
468 | backbone_gw_free_ref(backbone_gw); | 461 | backbone_gw_free_ref(backbone_gw); |
469 | } | 462 | } |
470 | 463 | ||
471 | /** | 464 | /* @backbone_gw: the backbone gateway from whom we are out of sync |
472 | * @backbone_gw: the backbone gateway from whom we are out of sync | ||
473 | * | 465 | * |
474 | * When the crc is wrong, ask the backbone gateway for a full table update. | 466 | * When the crc is wrong, ask the backbone gateway for a full table update. |
475 | * After the request, it will repeat all of his own claims and finally | 467 | * 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) | |||
495 | } | 487 | } |
496 | } | 488 | } |
497 | 489 | ||
498 | /** | 490 | /* @bat_priv: the bat priv with all the soft interface information |
499 | * @bat_priv: the bat priv with all the soft interface information | ||
500 | * @backbone_gw: our backbone gateway which should be announced | 491 | * @backbone_gw: our backbone gateway which should be announced |
501 | * | 492 | * |
502 | * This function sends an announcement. It is called from multiple | 493 | * This function sends an announcement. It is called from multiple |
@@ -516,8 +507,7 @@ static void bla_send_announce(struct bat_priv *bat_priv, | |||
516 | 507 | ||
517 | } | 508 | } |
518 | 509 | ||
519 | /** | 510 | /* @bat_priv: the bat priv with all the soft interface information |
520 | * @bat_priv: the bat priv with all the soft interface information | ||
521 | * @mac: the mac address of the claim | 511 | * @mac: the mac address of the claim |
522 | * @vid: the VLAN ID of the frame | 512 | * @vid: the VLAN ID of the frame |
523 | * @backbone_gw: the backbone gateway which claims it | 513 | * @backbone_gw: the backbone gateway which claims it |
@@ -731,8 +721,7 @@ static int handle_claim(struct bat_priv *bat_priv, | |||
731 | return 1; | 721 | return 1; |
732 | } | 722 | } |
733 | 723 | ||
734 | /** | 724 | /* @bat_priv: the bat priv with all the soft interface information |
735 | * @bat_priv: the bat priv with all the soft interface information | ||
736 | * @hw_src: the Hardware source in the ARP Header | 725 | * @hw_src: the Hardware source in the ARP Header |
737 | * @hw_dst: the Hardware destination in the ARP Header | 726 | * @hw_dst: the Hardware destination in the ARP Header |
738 | * @ethhdr: pointer to the Ethernet header of the claim frame | 727 | * @ethhdr: pointer to the Ethernet header of the claim frame |
@@ -810,8 +799,7 @@ static int check_claim_group(struct bat_priv *bat_priv, | |||
810 | } | 799 | } |
811 | 800 | ||
812 | 801 | ||
813 | /** | 802 | /* @bat_priv: the bat priv with all the soft interface information |
814 | * @bat_priv: the bat priv with all the soft interface information | ||
815 | * @skb: the frame to be checked | 803 | * @skb: the frame to be checked |
816 | * | 804 | * |
817 | * Check if this is a claim frame, and process it accordingly. | 805 | * 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, | |||
860 | /* Check whether the ARP frame carries a valid | 848 | /* Check whether the ARP frame carries a valid |
861 | * IP information | 849 | * IP information |
862 | */ | 850 | */ |
863 | |||
864 | if (arphdr->ar_hrd != htons(ARPHRD_ETHER)) | 851 | if (arphdr->ar_hrd != htons(ARPHRD_ETHER)) |
865 | return 0; | 852 | return 0; |
866 | if (arphdr->ar_pro != htons(ETH_P_IP)) | 853 | if (arphdr->ar_pro != htons(ETH_P_IP)) |
@@ -963,8 +950,7 @@ purge_now: | |||
963 | } | 950 | } |
964 | } | 951 | } |
965 | 952 | ||
966 | /** | 953 | /* @bat_priv: the bat priv with all the soft interface information |
967 | * @bat_priv: the bat priv with all the soft interface information | ||
968 | * @primary_if: the selected primary interface, may be NULL if now is set | 954 | * @primary_if: the selected primary interface, may be NULL if now is set |
969 | * @now: whether the whole hash shall be wiped now | 955 | * @now: whether the whole hash shall be wiped now |
970 | * | 956 | * |
@@ -1011,13 +997,11 @@ purge_now: | |||
1011 | } | 997 | } |
1012 | } | 998 | } |
1013 | 999 | ||
1014 | /** | 1000 | /* @bat_priv: the bat priv with all the soft interface information |
1015 | * @bat_priv: the bat priv with all the soft interface information | ||
1016 | * @primary_if: the new selected primary_if | 1001 | * @primary_if: the new selected primary_if |
1017 | * @oldif: the old primary interface, may be NULL | 1002 | * @oldif: the old primary interface, may be NULL |
1018 | * | 1003 | * |
1019 | * Update the backbone gateways when the own orig address changes. | 1004 | * Update the backbone gateways when the own orig address changes. |
1020 | * | ||
1021 | */ | 1005 | */ |
1022 | void batadv_bla_update_orig_address(struct bat_priv *bat_priv, | 1006 | void batadv_bla_update_orig_address(struct bat_priv *bat_priv, |
1023 | struct hard_iface *primary_if, | 1007 | struct hard_iface *primary_if, |
@@ -1183,8 +1167,7 @@ int batadv_bla_init(struct bat_priv *bat_priv) | |||
1183 | return 0; | 1167 | return 0; |
1184 | } | 1168 | } |
1185 | 1169 | ||
1186 | /** | 1170 | /* @bat_priv: the bat priv with all the soft interface information |
1187 | * @bat_priv: the bat priv with all the soft interface information | ||
1188 | * @bcast_packet: originator mac address | 1171 | * @bcast_packet: originator mac address |
1189 | * @hdr_size: maximum length of the frame | 1172 | * @hdr_size: maximum length of the frame |
1190 | * | 1173 | * |
@@ -1196,9 +1179,7 @@ int batadv_bla_init(struct bat_priv *bat_priv) | |||
1196 | * with a good chance that it is the same packet. If it is furthermore | 1179 | * with a good chance that it is the same packet. If it is furthermore |
1197 | * sent by another host, drop it. We allow equal packets from | 1180 | * sent by another host, drop it. We allow equal packets from |
1198 | * the same host however as this might be intended. | 1181 | * the same host however as this might be intended. |
1199 | * | 1182 | */ |
1200 | **/ | ||
1201 | |||
1202 | int batadv_bla_check_bcast_duplist(struct bat_priv *bat_priv, | 1183 | int batadv_bla_check_bcast_duplist(struct bat_priv *bat_priv, |
1203 | struct bcast_packet *bcast_packet, | 1184 | struct bcast_packet *bcast_packet, |
1204 | int hdr_size) | 1185 | int hdr_size) |
@@ -1250,16 +1231,13 @@ int batadv_bla_check_bcast_duplist(struct bat_priv *bat_priv, | |||
1250 | 1231 | ||
1251 | 1232 | ||
1252 | 1233 | ||
1253 | /** | 1234 | /* @bat_priv: the bat priv with all the soft interface information |
1254 | * @bat_priv: the bat priv with all the soft interface information | ||
1255 | * @orig: originator mac address | 1235 | * @orig: originator mac address |
1256 | * | 1236 | * |
1257 | * check if the originator is a gateway for any VLAN ID. | 1237 | * check if the originator is a gateway for any VLAN ID. |
1258 | * | 1238 | * |
1259 | * returns 1 if it is found, 0 otherwise | 1239 | * returns 1 if it is found, 0 otherwise |
1260 | * | ||
1261 | */ | 1240 | */ |
1262 | |||
1263 | int batadv_bla_is_backbone_gw_orig(struct bat_priv *bat_priv, uint8_t *orig) | 1241 | int batadv_bla_is_backbone_gw_orig(struct bat_priv *bat_priv, uint8_t *orig) |
1264 | { | 1242 | { |
1265 | struct hashtable_t *hash = bat_priv->backbone_hash; | 1243 | 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) | |||
1291 | } | 1269 | } |
1292 | 1270 | ||
1293 | 1271 | ||
1294 | /** | 1272 | /* @skb: the frame to be checked |
1295 | * @skb: the frame to be checked | ||
1296 | * @orig_node: the orig_node of the frame | 1273 | * @orig_node: the orig_node of the frame |
1297 | * @hdr_size: maximum length of the frame | 1274 | * @hdr_size: maximum length of the frame |
1298 | * | 1275 | * |
1299 | * bla_is_backbone_gw inspects the skb for the VLAN ID and returns 1 | 1276 | * bla_is_backbone_gw inspects the skb for the VLAN ID and returns 1 |
1300 | * if the orig_node is also a gateway on the soft interface, otherwise it | 1277 | * if the orig_node is also a gateway on the soft interface, otherwise it |
1301 | * returns 0. | 1278 | * returns 0. |
1302 | * | ||
1303 | */ | 1279 | */ |
1304 | int batadv_bla_is_backbone_gw(struct sk_buff *skb, | 1280 | int batadv_bla_is_backbone_gw(struct sk_buff *skb, |
1305 | struct orig_node *orig_node, int hdr_size) | 1281 | struct orig_node *orig_node, int hdr_size) |
@@ -1328,7 +1304,6 @@ int batadv_bla_is_backbone_gw(struct sk_buff *skb, | |||
1328 | } | 1304 | } |
1329 | 1305 | ||
1330 | /* see if this originator is a backbone gw for this VLAN */ | 1306 | /* see if this originator is a backbone gw for this VLAN */ |
1331 | |||
1332 | backbone_gw = backbone_hash_find(orig_node->bat_priv, | 1307 | backbone_gw = backbone_hash_find(orig_node->bat_priv, |
1333 | orig_node->orig, vid); | 1308 | orig_node->orig, vid); |
1334 | if (!backbone_gw) | 1309 | if (!backbone_gw) |
@@ -1360,8 +1335,7 @@ void batadv_bla_free(struct bat_priv *bat_priv) | |||
1360 | hardif_free_ref(primary_if); | 1335 | hardif_free_ref(primary_if); |
1361 | } | 1336 | } |
1362 | 1337 | ||
1363 | /** | 1338 | /* @bat_priv: the bat priv with all the soft interface information |
1364 | * @bat_priv: the bat priv with all the soft interface information | ||
1365 | * @skb: the frame to be checked | 1339 | * @skb: the frame to be checked |
1366 | * @vid: the VLAN ID of the frame | 1340 | * @vid: the VLAN ID of the frame |
1367 | * | 1341 | * |
@@ -1372,7 +1346,6 @@ void batadv_bla_free(struct bat_priv *bat_priv) | |||
1372 | * in these cases, the skb is further handled by this function and | 1346 | * in these cases, the skb is further handled by this function and |
1373 | * returns 1, otherwise it returns 0 and the caller shall further | 1347 | * returns 1, otherwise it returns 0 and the caller shall further |
1374 | * process the skb. | 1348 | * process the skb. |
1375 | * | ||
1376 | */ | 1349 | */ |
1377 | int batadv_bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) | 1350 | int batadv_bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) |
1378 | { | 1351 | { |
@@ -1449,8 +1422,7 @@ out: | |||
1449 | return ret; | 1422 | return ret; |
1450 | } | 1423 | } |
1451 | 1424 | ||
1452 | /** | 1425 | /* @bat_priv: the bat priv with all the soft interface information |
1453 | * @bat_priv: the bat priv with all the soft interface information | ||
1454 | * @skb: the frame to be checked | 1426 | * @skb: the frame to be checked |
1455 | * @vid: the VLAN ID of the frame | 1427 | * @vid: the VLAN ID of the frame |
1456 | * | 1428 | * |
@@ -1461,7 +1433,6 @@ out: | |||
1461 | * in these cases, the skb is further handled by this function and | 1433 | * in these cases, the skb is further handled by this function and |
1462 | * returns 1, otherwise it returns 0 and the caller shall further | 1434 | * returns 1, otherwise it returns 0 and the caller shall further |
1463 | * process the skb. | 1435 | * process the skb. |
1464 | * | ||
1465 | */ | 1436 | */ |
1466 | int batadv_bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) | 1437 | int batadv_bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) |
1467 | { | 1438 | { |
diff --git a/net/batman-adv/bridge_loop_avoidance.h b/net/batman-adv/bridge_loop_avoidance.h index 546cd641012a..9818b1e4c59e 100644 --- a/net/batman-adv/bridge_loop_avoidance.h +++ b/net/batman-adv/bridge_loop_avoidance.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2011-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2011-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Simon Wunderlich | 3 | * Simon Wunderlich |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #ifndef _NET_BATMAN_ADV_BLA_H_ | 20 | #ifndef _NET_BATMAN_ADV_BLA_H_ |
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c index e396029e578b..0d90fffd9efb 100644 --- a/net/batman-adv/gateway_client.c +++ b/net/batman-adv/gateway_client.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2009-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2009-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner | 3 | * Marek Lindner |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #include "main.h" | 20 | #include "main.h" |
@@ -33,7 +31,8 @@ | |||
33 | #include <linux/if_vlan.h> | 31 | #include <linux/if_vlan.h> |
34 | 32 | ||
35 | /* This is the offset of the options field in a dhcp packet starting at | 33 | /* This is the offset of the options field in a dhcp packet starting at |
36 | * the beginning of the dhcp header */ | 34 | * the beginning of the dhcp header |
35 | */ | ||
37 | #define DHCP_OPTIONS_OFFSET 240 | 36 | #define DHCP_OPTIONS_OFFSET 240 |
38 | #define DHCP_REQUEST 3 | 37 | #define DHCP_REQUEST 3 |
39 | 38 | ||
@@ -151,14 +150,13 @@ static struct gw_node *gw_get_best_gw_node(struct bat_priv *bat_priv) | |||
151 | } | 150 | } |
152 | break; | 151 | break; |
153 | 152 | ||
154 | default: /** | 153 | default: /* 2: stable connection (use best statistic) |
155 | * 2: stable connection (use best statistic) | ||
156 | * 3: fast-switch (use best statistic but change as | 154 | * 3: fast-switch (use best statistic but change as |
157 | * soon as a better gateway appears) | 155 | * soon as a better gateway appears) |
158 | * XX: late-switch (use best statistic but change as | 156 | * XX: late-switch (use best statistic but change as |
159 | * soon as a better gateway appears which has | 157 | * soon as a better gateway appears which has |
160 | * $routing_class more tq points) | 158 | * $routing_class more tq points) |
161 | **/ | 159 | */ |
162 | if (router->tq_avg > max_tq) { | 160 | if (router->tq_avg > max_tq) { |
163 | if (curr_gw) | 161 | if (curr_gw) |
164 | gw_node_free_ref(curr_gw); | 162 | gw_node_free_ref(curr_gw); |
@@ -190,12 +188,11 @@ void batadv_gw_election(struct bat_priv *bat_priv) | |||
190 | struct neigh_node *router = NULL; | 188 | struct neigh_node *router = NULL; |
191 | char gw_addr[18] = { '\0' }; | 189 | char gw_addr[18] = { '\0' }; |
192 | 190 | ||
193 | /** | 191 | /* The batman daemon checks here if we already passed a full originator |
194 | * The batman daemon checks here if we already passed a full originator | ||
195 | * cycle in order to make sure we don't choose the first gateway we | 192 | * cycle in order to make sure we don't choose the first gateway we |
196 | * hear about. This check is based on the daemon's uptime which we | 193 | * hear about. This check is based on the daemon's uptime which we |
197 | * don't have. | 194 | * don't have. |
198 | **/ | 195 | */ |
199 | if (atomic_read(&bat_priv->gw_mode) != GW_MODE_CLIENT) | 196 | if (atomic_read(&bat_priv->gw_mode) != GW_MODE_CLIENT) |
200 | goto out; | 197 | goto out; |
201 | 198 | ||
@@ -278,10 +275,9 @@ void batadv_gw_check_election(struct bat_priv *bat_priv, | |||
278 | if (orig_tq_avg < gw_tq_avg) | 275 | if (orig_tq_avg < gw_tq_avg) |
279 | goto out; | 276 | goto out; |
280 | 277 | ||
281 | /** | 278 | /* if the routing class is greater than 3 the value tells us how much |
282 | * if the routing class is greater than 3 the value tells us how much | ||
283 | * greater the TQ value of the new gateway must be | 279 | * greater the TQ value of the new gateway must be |
284 | **/ | 280 | */ |
285 | if ((atomic_read(&bat_priv->gw_sel_class) > 3) && | 281 | if ((atomic_read(&bat_priv->gw_sel_class) > 3) && |
286 | (orig_tq_avg - gw_tq_avg < atomic_read(&bat_priv->gw_sel_class))) | 282 | (orig_tq_avg - gw_tq_avg < atomic_read(&bat_priv->gw_sel_class))) |
287 | goto out; | 283 | goto out; |
@@ -337,8 +333,7 @@ void batadv_gw_node_update(struct bat_priv *bat_priv, | |||
337 | struct hlist_node *node; | 333 | struct hlist_node *node; |
338 | struct gw_node *gw_node, *curr_gw; | 334 | struct gw_node *gw_node, *curr_gw; |
339 | 335 | ||
340 | /** | 336 | /* Note: We don't need a NULL check here, since curr_gw never gets |
341 | * Note: We don't need a NULL check here, since curr_gw never gets | ||
342 | * dereferenced. If curr_gw is NULL we also should not exit as we may | 337 | * dereferenced. If curr_gw is NULL we also should not exit as we may |
343 | * have this gateway in our list (duplication check!) even though we | 338 | * have this gateway in our list (duplication check!) even though we |
344 | * have no currently selected gateway. | 339 | * have no currently selected gateway. |
@@ -426,9 +421,7 @@ void batadv_gw_node_purge(struct bat_priv *bat_priv) | |||
426 | gw_node_free_ref(curr_gw); | 421 | gw_node_free_ref(curr_gw); |
427 | } | 422 | } |
428 | 423 | ||
429 | /** | 424 | /* fails if orig_node has no router */ |
430 | * fails if orig_node has no router | ||
431 | */ | ||
432 | static int _write_buffer_text(struct bat_priv *bat_priv, struct seq_file *seq, | 425 | static int _write_buffer_text(struct bat_priv *bat_priv, struct seq_file *seq, |
433 | const struct gw_node *gw_node) | 426 | const struct gw_node *gw_node) |
434 | { | 427 | { |
@@ -534,12 +527,14 @@ static bool is_type_dhcprequest(struct sk_buff *skb, int header_len) | |||
534 | /* Access the dhcp option lists. Each entry is made up by: | 527 | /* Access the dhcp option lists. Each entry is made up by: |
535 | * - octet 1: option type | 528 | * - octet 1: option type |
536 | * - octet 2: option data len (only if type != 255 and 0) | 529 | * - octet 2: option data len (only if type != 255 and 0) |
537 | * - octet 3: option data */ | 530 | * - octet 3: option data |
531 | */ | ||
538 | while (*p != 255 && !ret) { | 532 | while (*p != 255 && !ret) { |
539 | /* p now points to the first octet: option type */ | 533 | /* p now points to the first octet: option type */ |
540 | if (*p == 53) { | 534 | if (*p == 53) { |
541 | /* type 53 is the message type option. | 535 | /* type 53 is the message type option. |
542 | * Jump the len octet and go to the data octet */ | 536 | * Jump the len octet and go to the data octet |
537 | */ | ||
543 | if (pkt_len < 2) | 538 | if (pkt_len < 2) |
544 | goto out; | 539 | goto out; |
545 | p += 2; | 540 | p += 2; |
@@ -667,7 +662,8 @@ bool batadv_gw_out_of_range(struct bat_priv *bat_priv, | |||
667 | switch (atomic_read(&bat_priv->gw_mode)) { | 662 | switch (atomic_read(&bat_priv->gw_mode)) { |
668 | case GW_MODE_SERVER: | 663 | case GW_MODE_SERVER: |
669 | /* If we are a GW then we are our best GW. We can artificially | 664 | /* If we are a GW then we are our best GW. We can artificially |
670 | * set the tq towards ourself as the maximum value */ | 665 | * set the tq towards ourself as the maximum value |
666 | */ | ||
671 | curr_tq_avg = TQ_MAX_VALUE; | 667 | curr_tq_avg = TQ_MAX_VALUE; |
672 | break; | 668 | break; |
673 | case GW_MODE_CLIENT: | 669 | case GW_MODE_CLIENT: |
@@ -681,7 +677,8 @@ bool batadv_gw_out_of_range(struct bat_priv *bat_priv, | |||
681 | 677 | ||
682 | /* If the dhcp packet has been sent to a different gw, | 678 | /* If the dhcp packet has been sent to a different gw, |
683 | * we have to evaluate whether the old gw is still | 679 | * we have to evaluate whether the old gw is still |
684 | * reliable enough */ | 680 | * reliable enough |
681 | */ | ||
685 | neigh_curr = batadv_find_router(bat_priv, curr_gw->orig_node, | 682 | neigh_curr = batadv_find_router(bat_priv, curr_gw->orig_node, |
686 | NULL); | 683 | NULL); |
687 | if (!neigh_curr) | 684 | if (!neigh_curr) |
diff --git a/net/batman-adv/gateway_client.h b/net/batman-adv/gateway_client.h index 2c2446f3f124..4529d42894ef 100644 --- a/net/batman-adv/gateway_client.h +++ b/net/batman-adv/gateway_client.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2009-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2009-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner | 3 | * Marek Lindner |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #ifndef _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ | 20 | #ifndef _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ |
diff --git a/net/batman-adv/gateway_common.c b/net/batman-adv/gateway_common.c index 722c93282442..3700562cf276 100644 --- a/net/batman-adv/gateway_common.c +++ b/net/batman-adv/gateway_common.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2009-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2009-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner | 3 | * Marek Lindner |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #include "main.h" | 20 | #include "main.h" |
@@ -156,11 +154,10 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff, | |||
156 | 154 | ||
157 | kbit_to_gw_bandwidth(down, up, &gw_bandwidth_tmp); | 155 | kbit_to_gw_bandwidth(down, up, &gw_bandwidth_tmp); |
158 | 156 | ||
159 | /** | 157 | /* the gw bandwidth we guessed above might not match the given |
160 | * the gw bandwidth we guessed above might not match the given | ||
161 | * speeds, hence we need to calculate it back to show the number | 158 | * speeds, hence we need to calculate it back to show the number |
162 | * that is going to be propagated | 159 | * that is going to be propagated |
163 | **/ | 160 | */ |
164 | batadv_gw_bandwidth_to_kbit((uint8_t)gw_bandwidth_tmp, &down, &up); | 161 | batadv_gw_bandwidth_to_kbit((uint8_t)gw_bandwidth_tmp, &down, &up); |
165 | 162 | ||
166 | if (atomic_read(&bat_priv->gw_bandwidth) == gw_bandwidth_tmp) | 163 | if (atomic_read(&bat_priv->gw_bandwidth) == gw_bandwidth_tmp) |
diff --git a/net/batman-adv/gateway_common.h b/net/batman-adv/gateway_common.h index e256040760bf..6f8a4d0cbbb6 100644 --- a/net/batman-adv/gateway_common.h +++ b/net/batman-adv/gateway_common.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2009-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2009-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner | 3 | * Marek Lindner |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #ifndef _NET_BATMAN_ADV_GATEWAY_COMMON_H_ | 20 | #ifndef _NET_BATMAN_ADV_GATEWAY_COMMON_H_ |
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index ab2fcfaf297e..2a4d394771b8 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner, Simon Wunderlich | 3 | * Marek Lindner, Simon Wunderlich |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #include "main.h" | 20 | #include "main.h" |
@@ -74,10 +72,6 @@ static int is_valid_iface(const struct net_device *net_dev) | |||
74 | if (batadv_softif_is_valid(net_dev)) | 72 | if (batadv_softif_is_valid(net_dev)) |
75 | return 0; | 73 | return 0; |
76 | 74 | ||
77 | /* Device is being bridged */ | ||
78 | /* if (net_dev->priv_flags & IFF_BRIDGE_PORT) | ||
79 | return 0; */ | ||
80 | |||
81 | return 1; | 75 | return 1; |
82 | } | 76 | } |
83 | 77 | ||
@@ -185,7 +179,8 @@ int batadv_hardif_min_mtu(struct net_device *soft_iface) | |||
185 | const struct bat_priv *bat_priv = netdev_priv(soft_iface); | 179 | const struct bat_priv *bat_priv = netdev_priv(soft_iface); |
186 | const struct hard_iface *hard_iface; | 180 | const struct hard_iface *hard_iface; |
187 | /* allow big frames if all devices are capable to do so | 181 | /* allow big frames if all devices are capable to do so |
188 | * (have MTU > 1500 + BAT_HEADER_LEN) */ | 182 | * (have MTU > 1500 + BAT_HEADER_LEN) |
183 | */ | ||
189 | int min_mtu = ETH_DATA_LEN; | 184 | int min_mtu = ETH_DATA_LEN; |
190 | 185 | ||
191 | if (atomic_read(&bat_priv->fragmentation)) | 186 | if (atomic_read(&bat_priv->fragmentation)) |
@@ -231,8 +226,7 @@ static void hardif_activate_interface(struct hard_iface *hard_iface) | |||
231 | bat_priv->bat_algo_ops->bat_iface_update_mac(hard_iface); | 226 | bat_priv->bat_algo_ops->bat_iface_update_mac(hard_iface); |
232 | hard_iface->if_status = IF_TO_BE_ACTIVATED; | 227 | hard_iface->if_status = IF_TO_BE_ACTIVATED; |
233 | 228 | ||
234 | /** | 229 | /* the first active interface becomes our primary interface or |
235 | * the first active interface becomes our primary interface or | ||
236 | * the next active interface after the old primary interface was removed | 230 | * the next active interface after the old primary interface was removed |
237 | */ | 231 | */ |
238 | primary_if = primary_if_get_selected(bat_priv); | 232 | primary_if = primary_if_get_selected(bat_priv); |
@@ -438,8 +432,7 @@ static struct hard_iface *hardif_add_interface(struct net_device *net_dev) | |||
438 | check_known_mac_addr(hard_iface->net_dev); | 432 | check_known_mac_addr(hard_iface->net_dev); |
439 | list_add_tail_rcu(&hard_iface->list, &batadv_hardif_list); | 433 | list_add_tail_rcu(&hard_iface->list, &batadv_hardif_list); |
440 | 434 | ||
441 | /** | 435 | /* This can't be called via a bat_priv callback because |
442 | * This can't be called via a bat_priv callback because | ||
443 | * we have no bat_priv yet. | 436 | * we have no bat_priv yet. |
444 | */ | 437 | */ |
445 | atomic_set(&hard_iface->seqno, 1); | 438 | atomic_set(&hard_iface->seqno, 1); |
@@ -544,7 +537,8 @@ out: | |||
544 | } | 537 | } |
545 | 538 | ||
546 | /* This function returns true if the interface represented by ifindex is a | 539 | /* This function returns true if the interface represented by ifindex is a |
547 | * 802.11 wireless device */ | 540 | * 802.11 wireless device |
541 | */ | ||
548 | bool batadv_is_wifi_iface(int ifindex) | 542 | bool batadv_is_wifi_iface(int ifindex) |
549 | { | 543 | { |
550 | struct net_device *net_device = NULL; | 544 | struct net_device *net_device = NULL; |
@@ -559,7 +553,8 @@ bool batadv_is_wifi_iface(int ifindex) | |||
559 | 553 | ||
560 | #ifdef CONFIG_WIRELESS_EXT | 554 | #ifdef CONFIG_WIRELESS_EXT |
561 | /* pre-cfg80211 drivers have to implement WEXT, so it is possible to | 555 | /* pre-cfg80211 drivers have to implement WEXT, so it is possible to |
562 | * check for wireless_handlers != NULL */ | 556 | * check for wireless_handlers != NULL |
557 | */ | ||
563 | if (net_device->wireless_handlers) | 558 | if (net_device->wireless_handlers) |
564 | ret = true; | 559 | ret = true; |
565 | else | 560 | else |
diff --git a/net/batman-adv/hard-interface.h b/net/batman-adv/hard-interface.h index 20e09db29d15..6bc12c0eb2f0 100644 --- a/net/batman-adv/hard-interface.h +++ b/net/batman-adv/hard-interface.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner, Simon Wunderlich | 3 | * Marek Lindner, Simon Wunderlich |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #ifndef _NET_BATMAN_ADV_HARD_INTERFACE_H_ | 20 | #ifndef _NET_BATMAN_ADV_HARD_INTERFACE_H_ |
diff --git a/net/batman-adv/hash.c b/net/batman-adv/hash.c index 65bbd15dd37c..e39f8f4bb165 100644 --- a/net/batman-adv/hash.c +++ b/net/batman-adv/hash.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2006-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2006-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Simon Wunderlich, Marek Lindner | 3 | * Simon Wunderlich, Marek Lindner |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #include "main.h" | 20 | #include "main.h" |
diff --git a/net/batman-adv/hash.h b/net/batman-adv/hash.h index e75df6be4f22..eba8f2a55ccc 100644 --- a/net/batman-adv/hash.h +++ b/net/batman-adv/hash.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2006-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2006-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Simon Wunderlich, Marek Lindner | 3 | * Simon Wunderlich, Marek Lindner |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #ifndef _NET_BATMAN_ADV_HASH_H_ | 20 | #ifndef _NET_BATMAN_ADV_HASH_H_ |
@@ -24,15 +22,15 @@ | |||
24 | 22 | ||
25 | #include <linux/list.h> | 23 | #include <linux/list.h> |
26 | 24 | ||
27 | /* callback to a compare function. should | 25 | /* callback to a compare function. should compare 2 element datas for their |
28 | * compare 2 element datas for their keys, | 26 | * keys, return 0 if same and not 0 if not same |
29 | * return 0 if same and not 0 if not | 27 | */ |
30 | * same */ | ||
31 | typedef int (*hashdata_compare_cb)(const struct hlist_node *, const void *); | 28 | typedef int (*hashdata_compare_cb)(const struct hlist_node *, const void *); |
32 | 29 | ||
33 | /* the hashfunction, should return an index | 30 | /* the hashfunction, should return an index |
34 | * based on the key in the data of the first | 31 | * based on the key in the data of the first |
35 | * argument and the size the second */ | 32 | * argument and the size the second |
33 | */ | ||
36 | typedef uint32_t (*hashdata_choose_cb)(const void *, uint32_t); | 34 | typedef uint32_t (*hashdata_choose_cb)(const void *, uint32_t); |
37 | typedef void (*hashdata_free_cb)(struct hlist_node *, void *); | 35 | typedef void (*hashdata_free_cb)(struct hlist_node *, void *); |
38 | 36 | ||
@@ -54,7 +52,8 @@ void batadv_hash_destroy(struct hashtable_t *hash); | |||
54 | 52 | ||
55 | /* remove the hash structure. if hashdata_free_cb != NULL, this function will be | 53 | /* remove the hash structure. if hashdata_free_cb != NULL, this function will be |
56 | * called to remove the elements inside of the hash. if you don't remove the | 54 | * called to remove the elements inside of the hash. if you don't remove the |
57 | * elements, memory might be leaked. */ | 55 | * elements, memory might be leaked. |
56 | */ | ||
58 | static inline void hash_delete(struct hashtable_t *hash, | 57 | static inline void hash_delete(struct hashtable_t *hash, |
59 | hashdata_free_cb free_cb, void *arg) | 58 | hashdata_free_cb free_cb, void *arg) |
60 | { | 59 | { |
@@ -80,8 +79,7 @@ static inline void hash_delete(struct hashtable_t *hash, | |||
80 | batadv_hash_destroy(hash); | 79 | batadv_hash_destroy(hash); |
81 | } | 80 | } |
82 | 81 | ||
83 | /** | 82 | /* hash_add - adds data to the hashtable |
84 | * hash_add - adds data to the hashtable | ||
85 | * @hash: storage hash table | 83 | * @hash: storage hash table |
86 | * @compare: callback to determine if 2 hash elements are identical | 84 | * @compare: callback to determine if 2 hash elements are identical |
87 | * @choose: callback calculating the hash index | 85 | * @choose: callback calculating the hash index |
@@ -91,7 +89,6 @@ static inline void hash_delete(struct hashtable_t *hash, | |||
91 | * Returns 0 on success, 1 if the element already is in the hash | 89 | * Returns 0 on success, 1 if the element already is in the hash |
92 | * and -1 on error. | 90 | * and -1 on error. |
93 | */ | 91 | */ |
94 | |||
95 | static inline int hash_add(struct hashtable_t *hash, | 92 | static inline int hash_add(struct hashtable_t *hash, |
96 | hashdata_compare_cb compare, | 93 | hashdata_compare_cb compare, |
97 | hashdata_choose_cb choose, | 94 | hashdata_choose_cb choose, |
@@ -134,7 +131,8 @@ out: | |||
134 | /* removes data from hash, if found. returns pointer do data on success, so you | 131 | /* removes data from hash, if found. returns pointer do data on success, so you |
135 | * can remove the used structure yourself, or NULL on error . data could be the | 132 | * can remove the used structure yourself, or NULL on error . data could be the |
136 | * structure you use with just the key filled, we just need the key for | 133 | * structure you use with just the key filled, we just need the key for |
137 | * comparing. */ | 134 | * comparing. |
135 | */ | ||
138 | static inline void *hash_remove(struct hashtable_t *hash, | 136 | static inline void *hash_remove(struct hashtable_t *hash, |
139 | hashdata_compare_cb compare, | 137 | hashdata_compare_cb compare, |
140 | hashdata_choose_cb choose, void *data) | 138 | hashdata_choose_cb choose, void *data) |
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c index 230056139445..40c5e189e6fd 100644 --- a/net/batman-adv/icmp_socket.c +++ b/net/batman-adv/icmp_socket.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner | 3 | * Marek Lindner |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #include "main.h" | 20 | #include "main.h" |
@@ -312,7 +310,8 @@ static void bat_socket_add_packet(struct socket_client *socket_client, | |||
312 | spin_lock_bh(&socket_client->lock); | 310 | spin_lock_bh(&socket_client->lock); |
313 | 311 | ||
314 | /* while waiting for the lock the socket_client could have been | 312 | /* while waiting for the lock the socket_client could have been |
315 | * deleted */ | 313 | * deleted |
314 | */ | ||
316 | if (!socket_client_hash[icmp_packet->uid]) { | 315 | if (!socket_client_hash[icmp_packet->uid]) { |
317 | spin_unlock_bh(&socket_client->lock); | 316 | spin_unlock_bh(&socket_client->lock); |
318 | kfree(socket_packet); | 317 | kfree(socket_packet); |
diff --git a/net/batman-adv/icmp_socket.h b/net/batman-adv/icmp_socket.h index 7b8863668490..a62ab80df9bd 100644 --- a/net/batman-adv/icmp_socket.h +++ b/net/batman-adv/icmp_socket.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner | 3 | * Marek Lindner |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #ifndef _NET_BATMAN_ADV_ICMP_SOCKET_H_ | 20 | #ifndef _NET_BATMAN_ADV_ICMP_SOCKET_H_ |
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c index 5e1d906628f5..d56d6b2e1924 100644 --- a/net/batman-adv/main.c +++ b/net/batman-adv/main.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner, Simon Wunderlich | 3 | * Marek Lindner, Simon Wunderlich |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #include "main.h" | 20 | #include "main.h" |
@@ -37,7 +35,8 @@ | |||
37 | 35 | ||
38 | 36 | ||
39 | /* List manipulations on hardif_list have to be rtnl_lock()'ed, | 37 | /* List manipulations on hardif_list have to be rtnl_lock()'ed, |
40 | * list traversals just rcu-locked */ | 38 | * list traversals just rcu-locked |
39 | */ | ||
41 | struct list_head batadv_hardif_list; | 40 | struct list_head batadv_hardif_list; |
42 | static int (*recv_packet_handler[256])(struct sk_buff *, struct hard_iface *); | 41 | static int (*recv_packet_handler[256])(struct sk_buff *, struct hard_iface *); |
43 | char batadv_routing_algo[20] = "BATMAN_IV"; | 42 | char batadv_routing_algo[20] = "BATMAN_IV"; |
@@ -59,7 +58,8 @@ static int __init batman_init(void) | |||
59 | batadv_iv_init(); | 58 | batadv_iv_init(); |
60 | 59 | ||
61 | /* the name should not be longer than 10 chars - see | 60 | /* the name should not be longer than 10 chars - see |
62 | * http://lwn.net/Articles/23634/ */ | 61 | * http://lwn.net/Articles/23634/ |
62 | */ | ||
63 | batadv_event_workqueue = create_singlethread_workqueue("bat_events"); | 63 | batadv_event_workqueue = create_singlethread_workqueue("bat_events"); |
64 | 64 | ||
65 | if (!batadv_event_workqueue) | 65 | if (!batadv_event_workqueue) |
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h index 12386421a55b..4b06b7621e7a 100644 --- a/net/batman-adv/main.h +++ b/net/batman-adv/main.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner, Simon Wunderlich | 3 | * Marek Lindner, Simon Wunderlich |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #ifndef _NET_BATMAN_ADV_MAIN_H_ | 20 | #ifndef _NET_BATMAN_ADV_MAIN_H_ |
@@ -36,19 +34,21 @@ | |||
36 | #define TQ_MAX_VALUE 255 | 34 | #define TQ_MAX_VALUE 255 |
37 | #define JITTER 20 | 35 | #define JITTER 20 |
38 | 36 | ||
39 | /* Time To Live of broadcast messages */ | 37 | /* Time To Live of broadcast messages */ |
40 | #define TTL 50 | 38 | #define TTL 50 |
41 | 39 | ||
42 | /* purge originators after time in seconds if no valid packet comes in | 40 | /* purge originators after time in seconds if no valid packet comes in |
43 | * -> TODO: check influence on TQ_LOCAL_WINDOW_SIZE */ | 41 | * -> TODO: check influence on TQ_LOCAL_WINDOW_SIZE |
42 | */ | ||
44 | #define PURGE_TIMEOUT 200000 /* 200 seconds */ | 43 | #define PURGE_TIMEOUT 200000 /* 200 seconds */ |
45 | #define TT_LOCAL_TIMEOUT 3600000 /* in miliseconds */ | 44 | #define TT_LOCAL_TIMEOUT 3600000 /* in miliseconds */ |
46 | #define TT_CLIENT_ROAM_TIMEOUT 600000 /* in miliseconds */ | 45 | #define TT_CLIENT_ROAM_TIMEOUT 600000 /* in miliseconds */ |
47 | /* sliding packet range of received originator messages in sequence numbers | 46 | /* sliding packet range of received originator messages in sequence numbers |
48 | * (should be a multiple of our word size) */ | 47 | * (should be a multiple of our word size) |
48 | */ | ||
49 | #define TQ_LOCAL_WINDOW_SIZE 64 | 49 | #define TQ_LOCAL_WINDOW_SIZE 64 |
50 | #define TT_REQUEST_TIMEOUT 3000 /* miliseconds we have to keep | 50 | /* miliseconds we have to keep pending tt_req */ |
51 | * pending tt_req */ | 51 | #define TT_REQUEST_TIMEOUT 3000 |
52 | 52 | ||
53 | #define TQ_GLOBAL_WINDOW_SIZE 5 | 53 | #define TQ_GLOBAL_WINDOW_SIZE 5 |
54 | #define TQ_LOCAL_BIDRECT_SEND_MINIMUM 1 | 54 | #define TQ_LOCAL_BIDRECT_SEND_MINIMUM 1 |
@@ -57,8 +57,10 @@ | |||
57 | 57 | ||
58 | #define TT_OGM_APPEND_MAX 3 /* number of OGMs sent with the last tt diff */ | 58 | #define TT_OGM_APPEND_MAX 3 /* number of OGMs sent with the last tt diff */ |
59 | 59 | ||
60 | #define ROAMING_MAX_TIME 20000 /* Time in which a client can roam at most | 60 | /* Time in which a client can roam at most ROAMING_MAX_COUNT times in |
61 | * ROAMING_MAX_COUNT times in miliseconds*/ | 61 | * miliseconds |
62 | */ | ||
63 | #define ROAMING_MAX_TIME 20000 | ||
62 | #define ROAMING_MAX_COUNT 5 | 64 | #define ROAMING_MAX_COUNT 5 |
63 | 65 | ||
64 | #define NO_FLAGS 0 | 66 | #define NO_FLAGS 0 |
@@ -72,11 +74,13 @@ | |||
72 | #define VIS_INTERVAL 5000 /* 5 seconds */ | 74 | #define VIS_INTERVAL 5000 /* 5 seconds */ |
73 | 75 | ||
74 | /* how much worse secondary interfaces may be to be considered as bonding | 76 | /* how much worse secondary interfaces may be to be considered as bonding |
75 | * candidates */ | 77 | * candidates |
78 | */ | ||
76 | #define BONDING_TQ_THRESHOLD 50 | 79 | #define BONDING_TQ_THRESHOLD 50 |
77 | 80 | ||
78 | /* should not be bigger than 512 bytes or change the size of | 81 | /* should not be bigger than 512 bytes or change the size of |
79 | * forw_packet->direct_link_flags */ | 82 | * forw_packet->direct_link_flags |
83 | */ | ||
80 | #define MAX_AGGREGATION_BYTES 512 | 84 | #define MAX_AGGREGATION_BYTES 512 |
81 | #define MAX_AGGREGATION_MS 100 | 85 | #define MAX_AGGREGATION_MS 100 |
82 | 86 | ||
@@ -201,19 +205,16 @@ static inline void bat_dbg(int type __always_unused, | |||
201 | pr_err("%s: " fmt, _netdev->name, ## arg); \ | 205 | pr_err("%s: " fmt, _netdev->name, ## arg); \ |
202 | } while (0) | 206 | } while (0) |
203 | 207 | ||
204 | /** | 208 | /* returns 1 if they are the same ethernet addr |
205 | * returns 1 if they are the same ethernet addr | ||
206 | * | 209 | * |
207 | * note: can't use compare_ether_addr() as it requires aligned memory | 210 | * note: can't use compare_ether_addr() as it requires aligned memory |
208 | */ | 211 | */ |
209 | |||
210 | static inline int compare_eth(const void *data1, const void *data2) | 212 | static inline int compare_eth(const void *data1, const void *data2) |
211 | { | 213 | { |
212 | return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0); | 214 | return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0); |
213 | } | 215 | } |
214 | 216 | ||
215 | /** | 217 | /* has_timed_out - compares current time (jiffies) and timestamp + timeout |
216 | * has_timed_out - compares current time (jiffies) and timestamp + timeout | ||
217 | * @timestamp: base value to compare with (in jiffies) | 218 | * @timestamp: base value to compare with (in jiffies) |
218 | * @timeout: added to base value before comparing (in milliseconds) | 219 | * @timeout: added to base value before comparing (in milliseconds) |
219 | * | 220 | * |
@@ -237,7 +238,8 @@ static inline bool has_timed_out(unsigned long timestamp, unsigned int timeout) | |||
237 | * - when adding nothing - it is neither a predecessor nor a successor | 238 | * - when adding nothing - it is neither a predecessor nor a successor |
238 | * - before adding more than 127 to the starting value - it is a predecessor, | 239 | * - before adding more than 127 to the starting value - it is a predecessor, |
239 | * - when adding 128 - it is neither a predecessor nor a successor, | 240 | * - when adding 128 - it is neither a predecessor nor a successor, |
240 | * - after adding more than 127 to the starting value - it is a successor */ | 241 | * - after adding more than 127 to the starting value - it is a successor |
242 | */ | ||
241 | #define seq_before(x, y) ({typeof(x) _d1 = (x); \ | 243 | #define seq_before(x, y) ({typeof(x) _d1 = (x); \ |
242 | typeof(y) _d2 = (y); \ | 244 | typeof(y) _d2 = (y); \ |
243 | typeof(x) _dummy = (_d1 - _d2); \ | 245 | typeof(x) _dummy = (_d1 - _d2); \ |
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index 3e902042af8f..86e7e082c2bc 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2009-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2009-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner, Simon Wunderlich | 3 | * Marek Lindner, Simon Wunderlich |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #include "main.h" | 20 | #include "main.h" |
@@ -188,7 +186,8 @@ void batadv_originator_free(struct bat_priv *bat_priv) | |||
188 | } | 186 | } |
189 | 187 | ||
190 | /* this function finds or creates an originator entry for the given | 188 | /* this function finds or creates an originator entry for the given |
191 | * address if it does not exits */ | 189 | * address if it does not exits |
190 | */ | ||
192 | struct orig_node *batadv_get_orig_node(struct bat_priv *bat_priv, | 191 | struct orig_node *batadv_get_orig_node(struct bat_priv *bat_priv, |
193 | const uint8_t *addr) | 192 | const uint8_t *addr) |
194 | { | 193 | { |
@@ -521,7 +520,8 @@ int batadv_orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num) | |||
521 | int ret; | 520 | int ret; |
522 | 521 | ||
523 | /* resize all orig nodes because orig_node->bcast_own(_sum) depend on | 522 | /* resize all orig nodes because orig_node->bcast_own(_sum) depend on |
524 | * if_num */ | 523 | * if_num |
524 | */ | ||
525 | for (i = 0; i < hash->size; i++) { | 525 | for (i = 0; i < hash->size; i++) { |
526 | head = &hash->table[i]; | 526 | head = &hash->table[i]; |
527 | 527 | ||
@@ -604,7 +604,8 @@ int batadv_orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num) | |||
604 | int ret; | 604 | int ret; |
605 | 605 | ||
606 | /* resize all orig nodes because orig_node->bcast_own(_sum) depend on | 606 | /* resize all orig nodes because orig_node->bcast_own(_sum) depend on |
607 | * if_num */ | 607 | * if_num |
608 | */ | ||
608 | for (i = 0; i < hash->size; i++) { | 609 | for (i = 0; i < hash->size; i++) { |
609 | head = &hash->table[i]; | 610 | head = &hash->table[i]; |
610 | 611 | ||
diff --git a/net/batman-adv/originator.h b/net/batman-adv/originator.h index 97deeba787ea..a72171997056 100644 --- a/net/batman-adv/originator.h +++ b/net/batman-adv/originator.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner, Simon Wunderlich | 3 | * Marek Lindner, Simon Wunderlich |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #ifndef _NET_BATMAN_ADV_ORIGINATOR_H_ | 20 | #ifndef _NET_BATMAN_ADV_ORIGINATOR_H_ |
@@ -40,8 +38,9 @@ int batadv_orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num); | |||
40 | int batadv_orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num); | 38 | int batadv_orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num); |
41 | 39 | ||
42 | 40 | ||
43 | /* hashfunction to choose an entry in a hash table of given size */ | 41 | /* hashfunction to choose an entry in a hash table of given size |
44 | /* hash algorithm from http://en.wikipedia.org/wiki/Hash_table */ | 42 | * hash algorithm from http://en.wikipedia.org/wiki/Hash_table |
43 | */ | ||
45 | static inline uint32_t choose_orig(const void *data, uint32_t size) | 44 | static inline uint32_t choose_orig(const void *data, uint32_t size) |
46 | { | 45 | { |
47 | const unsigned char *key = data; | 46 | const unsigned char *key = data; |
diff --git a/net/batman-adv/packet.h b/net/batman-adv/packet.h index 033d99490e82..c90219cd648e 100644 --- a/net/batman-adv/packet.h +++ b/net/batman-adv/packet.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner, Simon Wunderlich | 3 | * Marek Lindner, Simon Wunderlich |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #ifndef _NET_BATMAN_ADV_PACKET_H_ | 20 | #ifndef _NET_BATMAN_ADV_PACKET_H_ |
@@ -81,7 +79,8 @@ enum tt_query_flags { | |||
81 | 79 | ||
82 | /* TT_CLIENT flags. | 80 | /* TT_CLIENT flags. |
83 | * Flags from 1 to 1 << 7 are sent on the wire, while flags from 1 << 8 to | 81 | * Flags from 1 to 1 << 7 are sent on the wire, while flags from 1 << 8 to |
84 | * 1 << 15 are used for local computation only */ | 82 | * 1 << 15 are used for local computation only |
83 | */ | ||
85 | enum tt_client_flags { | 84 | enum tt_client_flags { |
86 | TT_CLIENT_DEL = 1 << 0, | 85 | TT_CLIENT_DEL = 1 << 0, |
87 | TT_CLIENT_ROAM = 1 << 1, | 86 | TT_CLIENT_ROAM = 1 << 1, |
@@ -142,7 +141,8 @@ struct icmp_packet { | |||
142 | #define BAT_RR_LEN 16 | 141 | #define BAT_RR_LEN 16 |
143 | 142 | ||
144 | /* icmp_packet_rr must start with all fields from imcp_packet | 143 | /* icmp_packet_rr must start with all fields from imcp_packet |
145 | * as this is assumed by code that handles ICMP packets */ | 144 | * as this is assumed by code that handles ICMP packets |
145 | */ | ||
146 | struct icmp_packet_rr { | 146 | struct icmp_packet_rr { |
147 | struct batman_header header; | 147 | struct batman_header header; |
148 | uint8_t msg_type; /* see ICMP message types above */ | 148 | uint8_t msg_type; /* see ICMP message types above */ |
@@ -192,7 +192,8 @@ struct tt_query_packet { | |||
192 | struct batman_header header; | 192 | struct batman_header header; |
193 | /* the flag field is a combination of: | 193 | /* the flag field is a combination of: |
194 | * - TT_REQUEST or TT_RESPONSE | 194 | * - TT_REQUEST or TT_RESPONSE |
195 | * - TT_FULL_TABLE */ | 195 | * - TT_FULL_TABLE |
196 | */ | ||
196 | uint8_t flags; | 197 | uint8_t flags; |
197 | uint8_t dst[ETH_ALEN]; | 198 | uint8_t dst[ETH_ALEN]; |
198 | uint8_t src[ETH_ALEN]; | 199 | uint8_t src[ETH_ALEN]; |
@@ -200,13 +201,15 @@ struct tt_query_packet { | |||
200 | * if TT_REQUEST: ttvn that triggered the | 201 | * if TT_REQUEST: ttvn that triggered the |
201 | * request | 202 | * request |
202 | * if TT_RESPONSE: new ttvn for the src | 203 | * if TT_RESPONSE: new ttvn for the src |
203 | * orig_node */ | 204 | * orig_node |
205 | */ | ||
204 | uint8_t ttvn; | 206 | uint8_t ttvn; |
205 | /* tt_data field is: | 207 | /* tt_data field is: |
206 | * if TT_REQUEST: crc associated with the | 208 | * if TT_REQUEST: crc associated with the |
207 | * ttvn | 209 | * ttvn |
208 | * if TT_RESPONSE: table_size */ | 210 | * if TT_RESPONSE: table_size |
209 | __be16 tt_data; | 211 | */ |
212 | __be16 tt_data; | ||
210 | } __packed; | 213 | } __packed; |
211 | 214 | ||
212 | struct roam_adv_packet { | 215 | struct roam_adv_packet { |
diff --git a/net/batman-adv/ring_buffer.c b/net/batman-adv/ring_buffer.c index db8f5ef83d3e..aff1ca2990f1 100644 --- a/net/batman-adv/ring_buffer.c +++ b/net/batman-adv/ring_buffer.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner | 3 | * Marek Lindner |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #include "main.h" | 20 | #include "main.h" |
diff --git a/net/batman-adv/ring_buffer.h b/net/batman-adv/ring_buffer.h index fbaf9d29d1d7..fda8c17df273 100644 --- a/net/batman-adv/ring_buffer.h +++ b/net/batman-adv/ring_buffer.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner | 3 | * Marek Lindner |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #ifndef _NET_BATMAN_ADV_RING_BUFFER_H_ | 20 | #ifndef _NET_BATMAN_ADV_RING_BUFFER_H_ |
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 1b1dd41f5fe6..79f63cf11be4 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner, Simon Wunderlich | 3 | * Marek Lindner, Simon Wunderlich |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #include "main.h" | 20 | #include "main.h" |
@@ -165,8 +163,7 @@ void batadv_bonding_candidate_add(struct orig_node *orig_node, | |||
165 | if (neigh_node->tq_avg < router->tq_avg - BONDING_TQ_THRESHOLD) | 163 | if (neigh_node->tq_avg < router->tq_avg - BONDING_TQ_THRESHOLD) |
166 | goto candidate_del; | 164 | goto candidate_del; |
167 | 165 | ||
168 | /** | 166 | /* check if we have another candidate with the same mac address or |
169 | * check if we have another candidate with the same mac address or | ||
170 | * interface. If we do, we won't select this candidate because of | 167 | * interface. If we do, we won't select this candidate because of |
171 | * possible interference. | 168 | * possible interference. |
172 | */ | 169 | */ |
@@ -177,7 +174,8 @@ void batadv_bonding_candidate_add(struct orig_node *orig_node, | |||
177 | continue; | 174 | continue; |
178 | 175 | ||
179 | /* we only care if the other candidate is even | 176 | /* we only care if the other candidate is even |
180 | * considered as candidate. */ | 177 | * considered as candidate. |
178 | */ | ||
181 | if (list_empty(&tmp_neigh_node->bonding_list)) | 179 | if (list_empty(&tmp_neigh_node->bonding_list)) |
182 | continue; | 180 | continue; |
183 | 181 | ||
@@ -398,9 +396,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if) | |||
398 | int hdr_size = sizeof(struct icmp_packet); | 396 | int hdr_size = sizeof(struct icmp_packet); |
399 | int ret = NET_RX_DROP; | 397 | int ret = NET_RX_DROP; |
400 | 398 | ||
401 | /** | 399 | /* we truncate all incoming icmp packets if they don't match our size */ |
402 | * we truncate all incoming icmp packets if they don't match our size | ||
403 | */ | ||
404 | if (skb->len >= sizeof(struct icmp_packet_rr)) | 400 | if (skb->len >= sizeof(struct icmp_packet_rr)) |
405 | hdr_size = sizeof(struct icmp_packet_rr); | 401 | hdr_size = sizeof(struct icmp_packet_rr); |
406 | 402 | ||
@@ -474,7 +470,8 @@ out: | |||
474 | * robin fashion over the remaining interfaces. | 470 | * robin fashion over the remaining interfaces. |
475 | * | 471 | * |
476 | * This method rotates the bonding list and increases the | 472 | * This method rotates the bonding list and increases the |
477 | * returned router's refcount. */ | 473 | * returned router's refcount. |
474 | */ | ||
478 | static struct neigh_node *find_bond_router(struct orig_node *primary_orig, | 475 | static struct neigh_node *find_bond_router(struct orig_node *primary_orig, |
479 | const struct hard_iface *recv_if) | 476 | const struct hard_iface *recv_if) |
480 | { | 477 | { |
@@ -507,10 +504,12 @@ static struct neigh_node *find_bond_router(struct orig_node *primary_orig, | |||
507 | goto out; | 504 | goto out; |
508 | 505 | ||
509 | /* selected should point to the next element | 506 | /* selected should point to the next element |
510 | * after the current router */ | 507 | * after the current router |
508 | */ | ||
511 | spin_lock_bh(&primary_orig->neigh_list_lock); | 509 | spin_lock_bh(&primary_orig->neigh_list_lock); |
512 | /* this is a list_move(), which unfortunately | 510 | /* this is a list_move(), which unfortunately |
513 | * does not exist as rcu version */ | 511 | * does not exist as rcu version |
512 | */ | ||
514 | list_del_rcu(&primary_orig->bond_list); | 513 | list_del_rcu(&primary_orig->bond_list); |
515 | list_add_rcu(&primary_orig->bond_list, | 514 | list_add_rcu(&primary_orig->bond_list, |
516 | &router->bonding_list); | 515 | &router->bonding_list); |
@@ -525,7 +524,8 @@ out: | |||
525 | * remaining candidates which are not using | 524 | * remaining candidates which are not using |
526 | * this interface. | 525 | * this interface. |
527 | * | 526 | * |
528 | * Increases the returned router's refcount */ | 527 | * Increases the returned router's refcount |
528 | */ | ||
529 | static struct neigh_node *find_ifalter_router(struct orig_node *primary_orig, | 529 | static struct neigh_node *find_ifalter_router(struct orig_node *primary_orig, |
530 | const struct hard_iface *recv_if) | 530 | const struct hard_iface *recv_if) |
531 | { | 531 | { |
@@ -546,11 +546,13 @@ static struct neigh_node *find_ifalter_router(struct orig_node *primary_orig, | |||
546 | continue; | 546 | continue; |
547 | 547 | ||
548 | /* if we don't have a router yet | 548 | /* if we don't have a router yet |
549 | * or this one is better, choose it. */ | 549 | * or this one is better, choose it. |
550 | */ | ||
550 | if ((!router) || | 551 | if ((!router) || |
551 | (tmp_neigh_node->tq_avg > router->tq_avg)) { | 552 | (tmp_neigh_node->tq_avg > router->tq_avg)) { |
552 | /* decrement refcount of | 553 | /* decrement refcount of |
553 | * previously selected router */ | 554 | * previously selected router |
555 | */ | ||
554 | if (router) | 556 | if (router) |
555 | batadv_neigh_node_free_ref(router); | 557 | batadv_neigh_node_free_ref(router); |
556 | 558 | ||
@@ -602,7 +604,8 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if) | |||
602 | batadv_inc_counter(bat_priv, BAT_CNT_TT_REQUEST_RX); | 604 | batadv_inc_counter(bat_priv, BAT_CNT_TT_REQUEST_RX); |
603 | 605 | ||
604 | /* If we cannot provide an answer the tt_request is | 606 | /* If we cannot provide an answer the tt_request is |
605 | * forwarded */ | 607 | * forwarded |
608 | */ | ||
606 | if (!batadv_send_tt_response(bat_priv, tt_query)) { | 609 | if (!batadv_send_tt_response(bat_priv, tt_query)) { |
607 | bat_dbg(DBG_TT, bat_priv, | 610 | bat_dbg(DBG_TT, bat_priv, |
608 | "Routing TT_REQUEST to %pM [%c]\n", | 611 | "Routing TT_REQUEST to %pM [%c]\n", |
@@ -616,7 +619,8 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if) | |||
616 | 619 | ||
617 | if (batadv_is_my_mac(tt_query->dst)) { | 620 | if (batadv_is_my_mac(tt_query->dst)) { |
618 | /* packet needs to be linearized to access the TT | 621 | /* packet needs to be linearized to access the TT |
619 | * changes */ | 622 | * changes |
623 | */ | ||
620 | if (skb_linearize(skb) < 0) | 624 | if (skb_linearize(skb) < 0) |
621 | goto out; | 625 | goto out; |
622 | /* skb_linearize() possibly changed skb->data */ | 626 | /* skb_linearize() possibly changed skb->data */ |
@@ -694,7 +698,8 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if) | |||
694 | 698 | ||
695 | /* Roaming phase starts: I have new information but the ttvn has not | 699 | /* Roaming phase starts: I have new information but the ttvn has not |
696 | * been incremented yet. This flag will make me check all the incoming | 700 | * been incremented yet. This flag will make me check all the incoming |
697 | * packets for the correct destination. */ | 701 | * packets for the correct destination. |
702 | */ | ||
698 | bat_priv->tt_poss_change = true; | 703 | bat_priv->tt_poss_change = true; |
699 | 704 | ||
700 | batadv_orig_node_free_ref(orig_node); | 705 | batadv_orig_node_free_ref(orig_node); |
@@ -705,7 +710,8 @@ out: | |||
705 | 710 | ||
706 | /* find a suitable router for this originator, and use | 711 | /* find a suitable router for this originator, and use |
707 | * bonding if possible. increases the found neighbors | 712 | * bonding if possible. increases the found neighbors |
708 | * refcount.*/ | 713 | * refcount. |
714 | */ | ||
709 | struct neigh_node *batadv_find_router(struct bat_priv *bat_priv, | 715 | struct neigh_node *batadv_find_router(struct bat_priv *bat_priv, |
710 | struct orig_node *orig_node, | 716 | struct orig_node *orig_node, |
711 | const struct hard_iface *recv_if) | 717 | const struct hard_iface *recv_if) |
@@ -724,7 +730,8 @@ struct neigh_node *batadv_find_router(struct bat_priv *bat_priv, | |||
724 | goto err; | 730 | goto err; |
725 | 731 | ||
726 | /* without bonding, the first node should | 732 | /* without bonding, the first node should |
727 | * always choose the default router. */ | 733 | * always choose the default router. |
734 | */ | ||
728 | bonding_enabled = atomic_read(&bat_priv->bonding); | 735 | bonding_enabled = atomic_read(&bat_priv->bonding); |
729 | 736 | ||
730 | rcu_read_lock(); | 737 | rcu_read_lock(); |
@@ -737,13 +744,14 @@ struct neigh_node *batadv_find_router(struct bat_priv *bat_priv, | |||
737 | goto return_router; | 744 | goto return_router; |
738 | 745 | ||
739 | /* if we have something in the primary_addr, we can search | 746 | /* if we have something in the primary_addr, we can search |
740 | * for a potential bonding candidate. */ | 747 | * for a potential bonding candidate. |
748 | */ | ||
741 | if (compare_eth(router_orig->primary_addr, zero_mac)) | 749 | if (compare_eth(router_orig->primary_addr, zero_mac)) |
742 | goto return_router; | 750 | goto return_router; |
743 | 751 | ||
744 | /* find the orig_node which has the primary interface. might | 752 | /* find the orig_node which has the primary interface. might |
745 | * even be the same as our router_orig in many cases */ | 753 | * even be the same as our router_orig in many cases |
746 | 754 | */ | |
747 | if (compare_eth(router_orig->primary_addr, router_orig->orig)) { | 755 | if (compare_eth(router_orig->primary_addr, router_orig->orig)) { |
748 | primary_orig_node = router_orig; | 756 | primary_orig_node = router_orig; |
749 | } else { | 757 | } else { |
@@ -756,14 +764,15 @@ struct neigh_node *batadv_find_router(struct bat_priv *bat_priv, | |||
756 | } | 764 | } |
757 | 765 | ||
758 | /* with less than 2 candidates, we can't do any | 766 | /* with less than 2 candidates, we can't do any |
759 | * bonding and prefer the original router. */ | 767 | * bonding and prefer the original router. |
768 | */ | ||
760 | if (atomic_read(&primary_orig_node->bond_candidates) < 2) | 769 | if (atomic_read(&primary_orig_node->bond_candidates) < 2) |
761 | goto return_router; | 770 | goto return_router; |
762 | 771 | ||
763 | /* all nodes between should choose a candidate which | 772 | /* all nodes between should choose a candidate which |
764 | * is is not on the interface where the packet came | 773 | * is is not on the interface where the packet came |
765 | * in. */ | 774 | * in. |
766 | 775 | */ | |
767 | batadv_neigh_node_free_ref(router); | 776 | batadv_neigh_node_free_ref(router); |
768 | 777 | ||
769 | if (bonding_enabled) | 778 | if (bonding_enabled) |
@@ -1089,7 +1098,8 @@ int batadv_recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if) | |||
1089 | goto spin_unlock; | 1098 | goto spin_unlock; |
1090 | 1099 | ||
1091 | /* mark broadcast in flood history, update window position | 1100 | /* mark broadcast in flood history, update window position |
1092 | * if required. */ | 1101 | * if required. |
1102 | */ | ||
1093 | if (batadv_bit_get_packet(bat_priv, orig_node->bcast_bits, seq_diff, 1)) | 1103 | if (batadv_bit_get_packet(bat_priv, orig_node->bcast_bits, seq_diff, 1)) |
1094 | orig_node->last_bcast_seqno = ntohl(bcast_packet->seqno); | 1104 | orig_node->last_bcast_seqno = ntohl(bcast_packet->seqno); |
1095 | 1105 | ||
@@ -1165,6 +1175,7 @@ int batadv_recv_vis_packet(struct sk_buff *skb, struct hard_iface *recv_if) | |||
1165 | } | 1175 | } |
1166 | 1176 | ||
1167 | /* We take a copy of the data in the packet, so we should | 1177 | /* We take a copy of the data in the packet, so we should |
1168 | always free the skbuf. */ | 1178 | * always free the skbuf. |
1179 | */ | ||
1169 | return NET_RX_DROP; | 1180 | return NET_RX_DROP; |
1170 | } | 1181 | } |
diff --git a/net/batman-adv/routing.h b/net/batman-adv/routing.h index 4652f0c147f5..c3fd219e8e53 100644 --- a/net/batman-adv/routing.h +++ b/net/batman-adv/routing.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner, Simon Wunderlich | 3 | * Marek Lindner, Simon Wunderlich |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #ifndef _NET_BATMAN_ADV_ROUTING_H_ | 20 | #ifndef _NET_BATMAN_ADV_ROUTING_H_ |
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c index 1a0f7c364ea0..2c92a32ec6c6 100644 --- a/net/batman-adv/send.c +++ b/net/batman-adv/send.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner, Simon Wunderlich | 3 | * Marek Lindner, Simon Wunderlich |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #include "main.h" | 20 | #include "main.h" |
@@ -32,7 +30,8 @@ | |||
32 | static void send_outstanding_bcast_packet(struct work_struct *work); | 30 | static void send_outstanding_bcast_packet(struct work_struct *work); |
33 | 31 | ||
34 | /* send out an already prepared packet to the given address via the | 32 | /* send out an already prepared packet to the given address via the |
35 | * specified batman interface */ | 33 | * specified batman interface |
34 | */ | ||
36 | int batadv_send_skb_packet(struct sk_buff *skb, struct hard_iface *hard_iface, | 35 | int batadv_send_skb_packet(struct sk_buff *skb, struct hard_iface *hard_iface, |
37 | const uint8_t *dst_addr) | 36 | const uint8_t *dst_addr) |
38 | { | 37 | { |
@@ -69,8 +68,8 @@ int batadv_send_skb_packet(struct sk_buff *skb, struct hard_iface *hard_iface, | |||
69 | 68 | ||
70 | /* dev_queue_xmit() returns a negative result on error. However on | 69 | /* dev_queue_xmit() returns a negative result on error. However on |
71 | * congestion and traffic shaping, it drops and returns NET_XMIT_DROP | 70 | * congestion and traffic shaping, it drops and returns NET_XMIT_DROP |
72 | * (which is > 0). This will not be treated as an error. */ | 71 | * (which is > 0). This will not be treated as an error. |
73 | 72 | */ | |
74 | return dev_queue_xmit(skb); | 73 | return dev_queue_xmit(skb); |
75 | send_skb_err: | 74 | send_skb_err: |
76 | kfree_skb(skb); | 75 | kfree_skb(skb); |
@@ -85,8 +84,7 @@ void batadv_schedule_bat_ogm(struct hard_iface *hard_iface) | |||
85 | (hard_iface->if_status == IF_TO_BE_REMOVED)) | 84 | (hard_iface->if_status == IF_TO_BE_REMOVED)) |
86 | return; | 85 | return; |
87 | 86 | ||
88 | /** | 87 | /* the interface gets activated here to avoid race conditions between |
89 | * the interface gets activated here to avoid race conditions between | ||
90 | * the moment of activating the interface in | 88 | * the moment of activating the interface in |
91 | * hardif_activate_interface() where the originator mac is set and | 89 | * hardif_activate_interface() where the originator mac is set and |
92 | * outdated packets (especially uninitialized mac addresses) in the | 90 | * outdated packets (especially uninitialized mac addresses) in the |
@@ -132,7 +130,8 @@ static void _add_bcast_packet_to_list(struct bat_priv *bat_priv, | |||
132 | * errors. | 130 | * errors. |
133 | * | 131 | * |
134 | * The skb is not consumed, so the caller should make sure that the | 132 | * The skb is not consumed, so the caller should make sure that the |
135 | * skb is freed. */ | 133 | * skb is freed. |
134 | */ | ||
136 | int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv, | 135 | int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv, |
137 | const struct sk_buff *skb, | 136 | const struct sk_buff *skb, |
138 | unsigned long delay) | 137 | unsigned long delay) |
@@ -249,8 +248,7 @@ void batadv_send_outstanding_bat_ogm_packet(struct work_struct *work) | |||
249 | 248 | ||
250 | bat_priv->bat_algo_ops->bat_ogm_emit(forw_packet); | 249 | bat_priv->bat_algo_ops->bat_ogm_emit(forw_packet); |
251 | 250 | ||
252 | /** | 251 | /* we have to have at least one packet in the queue |
253 | * we have to have at least one packet in the queue | ||
254 | * to determine the queues wake up time unless we are | 252 | * to determine the queues wake up time unless we are |
255 | * shutting down | 253 | * shutting down |
256 | */ | 254 | */ |
@@ -285,8 +283,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv, | |||
285 | hlist_for_each_entry_safe(forw_packet, tmp_node, safe_tmp_node, | 283 | hlist_for_each_entry_safe(forw_packet, tmp_node, safe_tmp_node, |
286 | &bat_priv->forw_bcast_list, list) { | 284 | &bat_priv->forw_bcast_list, list) { |
287 | 285 | ||
288 | /** | 286 | /* if purge_outstanding_packets() was called with an argument |
289 | * if purge_outstanding_packets() was called with an argument | ||
290 | * we delete only packets belonging to the given interface | 287 | * we delete only packets belonging to the given interface |
291 | */ | 288 | */ |
292 | if ((hard_iface) && | 289 | if ((hard_iface) && |
@@ -295,8 +292,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv, | |||
295 | 292 | ||
296 | spin_unlock_bh(&bat_priv->forw_bcast_list_lock); | 293 | spin_unlock_bh(&bat_priv->forw_bcast_list_lock); |
297 | 294 | ||
298 | /** | 295 | /* send_outstanding_bcast_packet() will lock the list to |
299 | * send_outstanding_bcast_packet() will lock the list to | ||
300 | * delete the item from the list | 296 | * delete the item from the list |
301 | */ | 297 | */ |
302 | pending = cancel_delayed_work_sync(&forw_packet->delayed_work); | 298 | pending = cancel_delayed_work_sync(&forw_packet->delayed_work); |
@@ -314,8 +310,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv, | |||
314 | hlist_for_each_entry_safe(forw_packet, tmp_node, safe_tmp_node, | 310 | hlist_for_each_entry_safe(forw_packet, tmp_node, safe_tmp_node, |
315 | &bat_priv->forw_bat_list, list) { | 311 | &bat_priv->forw_bat_list, list) { |
316 | 312 | ||
317 | /** | 313 | /* if purge_outstanding_packets() was called with an argument |
318 | * if purge_outstanding_packets() was called with an argument | ||
319 | * we delete only packets belonging to the given interface | 314 | * we delete only packets belonging to the given interface |
320 | */ | 315 | */ |
321 | if ((hard_iface) && | 316 | if ((hard_iface) && |
@@ -324,8 +319,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv, | |||
324 | 319 | ||
325 | spin_unlock_bh(&bat_priv->forw_bat_list_lock); | 320 | spin_unlock_bh(&bat_priv->forw_bat_list_lock); |
326 | 321 | ||
327 | /** | 322 | /* send_outstanding_bat_packet() will lock the list to |
328 | * send_outstanding_bat_packet() will lock the list to | ||
329 | * delete the item from the list | 323 | * delete the item from the list |
330 | */ | 324 | */ |
331 | pending = cancel_delayed_work_sync(&forw_packet->delayed_work); | 325 | pending = cancel_delayed_work_sync(&forw_packet->delayed_work); |
diff --git a/net/batman-adv/send.h b/net/batman-adv/send.h index 452e8df5abb8..e3ac75ba432b 100644 --- a/net/batman-adv/send.h +++ b/net/batman-adv/send.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner, Simon Wunderlich | 3 | * Marek Lindner, Simon Wunderlich |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #ifndef _NET_BATMAN_ADV_SEND_H_ | 20 | #ifndef _NET_BATMAN_ADV_SEND_H_ |
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 994b2b8d7e10..0658781febde 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner, Simon Wunderlich | 3 | * Marek Lindner, Simon Wunderlich |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #include "main.h" | 20 | #include "main.h" |
@@ -65,8 +63,7 @@ int batadv_skb_head_push(struct sk_buff *skb, unsigned int len) | |||
65 | { | 63 | { |
66 | int result; | 64 | int result; |
67 | 65 | ||
68 | /** | 66 | /* TODO: We must check if we can release all references to non-payload |
69 | * TODO: We must check if we can release all references to non-payload | ||
70 | * data using skb_header_release in our skbs to allow skb_cow_header to | 67 | * data using skb_header_release in our skbs to allow skb_cow_header to |
71 | * work optimally. This means that those skbs are not allowed to read | 68 | * work optimally. This means that those skbs are not allowed to read |
72 | * or write any data which is before the current position of skb->data | 69 | * or write any data which is before the current position of skb->data |
@@ -180,14 +177,16 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface) | |||
180 | switch (atomic_read(&bat_priv->gw_mode)) { | 177 | switch (atomic_read(&bat_priv->gw_mode)) { |
181 | case GW_MODE_SERVER: | 178 | case GW_MODE_SERVER: |
182 | /* gateway servers should not send dhcp | 179 | /* gateway servers should not send dhcp |
183 | * requests into the mesh */ | 180 | * requests into the mesh |
181 | */ | ||
184 | ret = batadv_gw_is_dhcp_target(skb, &header_len); | 182 | ret = batadv_gw_is_dhcp_target(skb, &header_len); |
185 | if (ret) | 183 | if (ret) |
186 | goto dropped; | 184 | goto dropped; |
187 | break; | 185 | break; |
188 | case GW_MODE_CLIENT: | 186 | case GW_MODE_CLIENT: |
189 | /* gateway clients should send dhcp requests | 187 | /* gateway clients should send dhcp requests |
190 | * via unicast to their gateway */ | 188 | * via unicast to their gateway |
189 | */ | ||
191 | ret = batadv_gw_is_dhcp_target(skb, &header_len); | 190 | ret = batadv_gw_is_dhcp_target(skb, &header_len); |
192 | if (ret) | 191 | if (ret) |
193 | do_bcast = false; | 192 | do_bcast = false; |
@@ -215,7 +214,8 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface) | |||
215 | bcast_packet->header.packet_type = BAT_BCAST; | 214 | bcast_packet->header.packet_type = BAT_BCAST; |
216 | 215 | ||
217 | /* hw address of first interface is the orig mac because only | 216 | /* hw address of first interface is the orig mac because only |
218 | * this mac is known throughout the mesh */ | 217 | * this mac is known throughout the mesh |
218 | */ | ||
219 | memcpy(bcast_packet->orig, | 219 | memcpy(bcast_packet->orig, |
220 | primary_if->net_dev->dev_addr, ETH_ALEN); | 220 | primary_if->net_dev->dev_addr, ETH_ALEN); |
221 | 221 | ||
@@ -226,7 +226,8 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface) | |||
226 | batadv_add_bcast_packet_to_list(bat_priv, skb, 1); | 226 | batadv_add_bcast_packet_to_list(bat_priv, skb, 1); |
227 | 227 | ||
228 | /* a copy is stored in the bcast list, therefore removing | 228 | /* a copy is stored in the bcast list, therefore removing |
229 | * the original skb. */ | 229 | * the original skb. |
230 | */ | ||
230 | kfree_skb(skb); | 231 | kfree_skb(skb); |
231 | 232 | ||
232 | /* unicast packet */ | 233 | /* unicast packet */ |
@@ -294,9 +295,10 @@ void batadv_interface_rx(struct net_device *soft_iface, | |||
294 | 295 | ||
295 | /* should not be necessary anymore as we use skb_pull_rcsum() | 296 | /* should not be necessary anymore as we use skb_pull_rcsum() |
296 | * TODO: please verify this and remove this TODO | 297 | * TODO: please verify this and remove this TODO |
297 | * -- Dec 21st 2009, Simon Wunderlich */ | 298 | * -- Dec 21st 2009, Simon Wunderlich |
299 | */ | ||
298 | 300 | ||
299 | /* skb->ip_summed = CHECKSUM_UNNECESSARY;*/ | 301 | /* skb->ip_summed = CHECKSUM_UNNECESSARY; */ |
300 | 302 | ||
301 | bat_priv->stats.rx_packets++; | 303 | bat_priv->stats.rx_packets++; |
302 | bat_priv->stats.rx_bytes += skb->len + ETH_HLEN; | 304 | bat_priv->stats.rx_bytes += skb->len + ETH_HLEN; |
@@ -341,8 +343,7 @@ static void interface_setup(struct net_device *dev) | |||
341 | dev->destructor = free_netdev; | 343 | dev->destructor = free_netdev; |
342 | dev->tx_queue_len = 0; | 344 | dev->tx_queue_len = 0; |
343 | 345 | ||
344 | /** | 346 | /* can't call min_mtu, because the needed variables |
345 | * can't call min_mtu, because the needed variables | ||
346 | * have not been initialized yet | 347 | * have not been initialized yet |
347 | */ | 348 | */ |
348 | dev->mtu = ETH_DATA_LEN; | 349 | dev->mtu = ETH_DATA_LEN; |
diff --git a/net/batman-adv/soft-interface.h b/net/batman-adv/soft-interface.h index 7e2bfafbcb79..2711ba5b1233 100644 --- a/net/batman-adv/soft-interface.h +++ b/net/batman-adv/soft-interface.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner | 3 | * Marek Lindner |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #ifndef _NET_BATMAN_ADV_SOFT_INTERFACE_H_ | 20 | #ifndef _NET_BATMAN_ADV_SOFT_INTERFACE_H_ |
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 66e11b58312e..5180d50e909d 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner, Simon Wunderlich, Antonio Quartulli | 3 | * Marek Lindner, Simon Wunderlich, Antonio Quartulli |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #include "main.h" | 20 | #include "main.h" |
@@ -232,7 +230,8 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, | |||
232 | 230 | ||
233 | /* The local entry has to be marked as NEW to avoid to send it in | 231 | /* The local entry has to be marked as NEW to avoid to send it in |
234 | * a full table response going out before the next ttvn increment | 232 | * a full table response going out before the next ttvn increment |
235 | * (consistency check) */ | 233 | * (consistency check) |
234 | */ | ||
236 | tt_local_entry->common.flags |= TT_CLIENT_NEW; | 235 | tt_local_entry->common.flags |= TT_CLIENT_NEW; |
237 | 236 | ||
238 | hash_added = hash_add(bat_priv->tt_local_hash, compare_tt, choose_orig, | 237 | hash_added = hash_add(bat_priv->tt_local_hash, compare_tt, choose_orig, |
@@ -437,7 +436,8 @@ static void tt_local_set_pending(struct bat_priv *bat_priv, | |||
437 | 436 | ||
438 | /* The local client has to be marked as "pending to be removed" but has | 437 | /* The local client has to be marked as "pending to be removed" but has |
439 | * to be kept in the table in order to send it in a full table | 438 | * to be kept in the table in order to send it in a full table |
440 | * response issued before the net ttvn increment (consistency check) */ | 439 | * response issued before the net ttvn increment (consistency check) |
440 | */ | ||
441 | tt_local_entry->common.flags |= TT_CLIENT_PENDING; | 441 | tt_local_entry->common.flags |= TT_CLIENT_PENDING; |
442 | 442 | ||
443 | bat_dbg(DBG_TT, bat_priv, | 443 | bat_dbg(DBG_TT, bat_priv, |
@@ -898,8 +898,8 @@ static void tt_global_del(struct bat_priv *bat_priv, | |||
898 | * If there are other originators left, we directly delete | 898 | * If there are other originators left, we directly delete |
899 | * the originator. | 899 | * the originator. |
900 | * 2) the client roamed to us => we can directly delete | 900 | * 2) the client roamed to us => we can directly delete |
901 | * the global entry, since it is useless now. */ | 901 | * the global entry, since it is useless now. |
902 | 902 | */ | |
903 | tt_local_entry = tt_local_hash_find(bat_priv, | 903 | tt_local_entry = tt_local_hash_find(bat_priv, |
904 | tt_global_entry->common.addr); | 904 | tt_global_entry->common.addr); |
905 | if (tt_local_entry) { | 905 | if (tt_local_entry) { |
@@ -1072,7 +1072,8 @@ struct orig_node *batadv_transtable_search(struct bat_priv *bat_priv, | |||
1072 | goto out; | 1072 | goto out; |
1073 | 1073 | ||
1074 | /* check whether the clients should not communicate due to AP | 1074 | /* check whether the clients should not communicate due to AP |
1075 | * isolation */ | 1075 | * isolation |
1076 | */ | ||
1076 | if (tt_local_entry && _is_ap_isolated(tt_local_entry, tt_global_entry)) | 1077 | if (tt_local_entry && _is_ap_isolated(tt_local_entry, tt_global_entry)) |
1077 | goto out; | 1078 | goto out; |
1078 | 1079 | ||
@@ -1171,7 +1172,8 @@ static uint16_t batadv_tt_local_crc(struct bat_priv *bat_priv) | |||
1171 | hlist_for_each_entry_rcu(tt_common_entry, node, | 1172 | hlist_for_each_entry_rcu(tt_common_entry, node, |
1172 | head, hash_entry) { | 1173 | head, hash_entry) { |
1173 | /* not yet committed clients have not to be taken into | 1174 | /* not yet committed clients have not to be taken into |
1174 | * account while computing the CRC */ | 1175 | * account while computing the CRC |
1176 | */ | ||
1175 | if (tt_common_entry->flags & TT_CLIENT_NEW) | 1177 | if (tt_common_entry->flags & TT_CLIENT_NEW) |
1176 | continue; | 1178 | continue; |
1177 | total_one = 0; | 1179 | total_one = 0; |
@@ -1208,7 +1210,8 @@ static void tt_save_orig_buffer(struct bat_priv *bat_priv, | |||
1208 | uint16_t tt_buff_len = batadv_tt_len(tt_num_changes); | 1210 | uint16_t tt_buff_len = batadv_tt_len(tt_num_changes); |
1209 | 1211 | ||
1210 | /* Replace the old buffer only if I received something in the | 1212 | /* Replace the old buffer only if I received something in the |
1211 | * last OGM (the OGM could carry no changes) */ | 1213 | * last OGM (the OGM could carry no changes) |
1214 | */ | ||
1212 | spin_lock_bh(&orig_node->tt_buff_lock); | 1215 | spin_lock_bh(&orig_node->tt_buff_lock); |
1213 | if (tt_buff_len > 0) { | 1216 | if (tt_buff_len > 0) { |
1214 | kfree(orig_node->tt_buff); | 1217 | kfree(orig_node->tt_buff); |
@@ -1237,7 +1240,8 @@ static void tt_req_purge(struct bat_priv *bat_priv) | |||
1237 | } | 1240 | } |
1238 | 1241 | ||
1239 | /* returns the pointer to the new tt_req_node struct if no request | 1242 | /* returns the pointer to the new tt_req_node struct if no request |
1240 | * has already been issued for this orig_node, NULL otherwise */ | 1243 | * has already been issued for this orig_node, NULL otherwise |
1244 | */ | ||
1241 | static struct tt_req_node *new_tt_req_node(struct bat_priv *bat_priv, | 1245 | static struct tt_req_node *new_tt_req_node(struct bat_priv *bat_priv, |
1242 | struct orig_node *orig_node) | 1246 | struct orig_node *orig_node) |
1243 | { | 1247 | { |
@@ -1347,7 +1351,8 @@ static struct sk_buff *tt_response_fill_table(uint16_t tt_len, uint8_t ttvn, | |||
1347 | rcu_read_unlock(); | 1351 | rcu_read_unlock(); |
1348 | 1352 | ||
1349 | /* store in the message the number of entries we have successfully | 1353 | /* store in the message the number of entries we have successfully |
1350 | * copied */ | 1354 | * copied |
1355 | */ | ||
1351 | tt_response->tt_data = htons(tt_count); | 1356 | tt_response->tt_data = htons(tt_count); |
1352 | 1357 | ||
1353 | out: | 1358 | out: |
@@ -1370,7 +1375,8 @@ static int send_tt_request(struct bat_priv *bat_priv, | |||
1370 | goto out; | 1375 | goto out; |
1371 | 1376 | ||
1372 | /* The new tt_req will be issued only if I'm not waiting for a | 1377 | /* The new tt_req will be issued only if I'm not waiting for a |
1373 | * reply from the same orig_node yet */ | 1378 | * reply from the same orig_node yet |
1379 | */ | ||
1374 | tt_req_node = new_tt_req_node(bat_priv, dst_orig_node); | 1380 | tt_req_node = new_tt_req_node(bat_priv, dst_orig_node); |
1375 | if (!tt_req_node) | 1381 | if (!tt_req_node) |
1376 | goto out; | 1382 | goto out; |
@@ -1478,7 +1484,8 @@ static bool send_other_tt_response(struct bat_priv *bat_priv, | |||
1478 | full_table = false; | 1484 | full_table = false; |
1479 | 1485 | ||
1480 | /* In this version, fragmentation is not implemented, then | 1486 | /* In this version, fragmentation is not implemented, then |
1481 | * I'll send only one packet with as much TT entries as I can */ | 1487 | * I'll send only one packet with as much TT entries as I can |
1488 | */ | ||
1482 | if (!full_table) { | 1489 | if (!full_table) { |
1483 | spin_lock_bh(&req_dst_orig_node->tt_buff_lock); | 1490 | spin_lock_bh(&req_dst_orig_node->tt_buff_lock); |
1484 | tt_len = req_dst_orig_node->tt_buff_len; | 1491 | tt_len = req_dst_orig_node->tt_buff_len; |
@@ -1590,7 +1597,8 @@ static bool send_my_tt_response(struct bat_priv *bat_priv, | |||
1590 | goto out; | 1597 | goto out; |
1591 | 1598 | ||
1592 | /* If the full table has been explicitly requested or the gap | 1599 | /* If the full table has been explicitly requested or the gap |
1593 | * is too big send the whole local translation table */ | 1600 | * is too big send the whole local translation table |
1601 | */ | ||
1594 | if (tt_request->flags & TT_FULL_TABLE || my_ttvn != req_ttvn || | 1602 | if (tt_request->flags & TT_FULL_TABLE || my_ttvn != req_ttvn || |
1595 | !bat_priv->tt_buff) | 1603 | !bat_priv->tt_buff) |
1596 | full_table = true; | 1604 | full_table = true; |
@@ -1598,7 +1606,8 @@ static bool send_my_tt_response(struct bat_priv *bat_priv, | |||
1598 | full_table = false; | 1606 | full_table = false; |
1599 | 1607 | ||
1600 | /* In this version, fragmentation is not implemented, then | 1608 | /* In this version, fragmentation is not implemented, then |
1601 | * I'll send only one packet with as much TT entries as I can */ | 1609 | * I'll send only one packet with as much TT entries as I can |
1610 | */ | ||
1602 | if (!full_table) { | 1611 | if (!full_table) { |
1603 | spin_lock_bh(&bat_priv->tt_buff_lock); | 1612 | spin_lock_bh(&bat_priv->tt_buff_lock); |
1604 | tt_len = bat_priv->tt_buff_len; | 1613 | tt_len = bat_priv->tt_buff_len; |
@@ -1766,7 +1775,8 @@ bool batadv_is_my_client(struct bat_priv *bat_priv, const uint8_t *addr) | |||
1766 | if (!tt_local_entry) | 1775 | if (!tt_local_entry) |
1767 | goto out; | 1776 | goto out; |
1768 | /* Check if the client has been logically deleted (but is kept for | 1777 | /* Check if the client has been logically deleted (but is kept for |
1769 | * consistency purpose) */ | 1778 | * consistency purpose) |
1779 | */ | ||
1770 | if (tt_local_entry->common.flags & TT_CLIENT_PENDING) | 1780 | if (tt_local_entry->common.flags & TT_CLIENT_PENDING) |
1771 | goto out; | 1781 | goto out; |
1772 | ret = true; | 1782 | ret = true; |
@@ -1817,7 +1827,8 @@ void batadv_handle_tt_response(struct bat_priv *bat_priv, | |||
1817 | /* Recalculate the CRC for this orig_node and store it */ | 1827 | /* Recalculate the CRC for this orig_node and store it */ |
1818 | orig_node->tt_crc = tt_global_crc(bat_priv, orig_node); | 1828 | orig_node->tt_crc = tt_global_crc(bat_priv, orig_node); |
1819 | /* Roaming phase is over: tables are in sync again. I can | 1829 | /* Roaming phase is over: tables are in sync again. I can |
1820 | * unset the flag */ | 1830 | * unset the flag |
1831 | */ | ||
1821 | orig_node->tt_poss_change = false; | 1832 | orig_node->tt_poss_change = false; |
1822 | out: | 1833 | out: |
1823 | if (orig_node) | 1834 | if (orig_node) |
@@ -1874,7 +1885,8 @@ static void tt_roam_purge(struct bat_priv *bat_priv) | |||
1874 | * maximum number of possible roaming phases. In this case the ROAMING_ADV | 1885 | * maximum number of possible roaming phases. In this case the ROAMING_ADV |
1875 | * will not be sent. | 1886 | * will not be sent. |
1876 | * | 1887 | * |
1877 | * returns true if the ROAMING_ADV can be sent, false otherwise */ | 1888 | * returns true if the ROAMING_ADV can be sent, false otherwise |
1889 | */ | ||
1878 | static bool tt_check_roam_count(struct bat_priv *bat_priv, | 1890 | static bool tt_check_roam_count(struct bat_priv *bat_priv, |
1879 | uint8_t *client) | 1891 | uint8_t *client) |
1880 | { | 1892 | { |
@@ -1883,7 +1895,8 @@ static bool tt_check_roam_count(struct bat_priv *bat_priv, | |||
1883 | 1895 | ||
1884 | spin_lock_bh(&bat_priv->tt_roam_list_lock); | 1896 | spin_lock_bh(&bat_priv->tt_roam_list_lock); |
1885 | /* The new tt_req will be issued only if I'm not waiting for a | 1897 | /* The new tt_req will be issued only if I'm not waiting for a |
1886 | * reply from the same orig_node yet */ | 1898 | * reply from the same orig_node yet |
1899 | */ | ||
1887 | list_for_each_entry(tt_roam_node, &bat_priv->tt_roam_list, list) { | 1900 | list_for_each_entry(tt_roam_node, &bat_priv->tt_roam_list, list) { |
1888 | if (!compare_eth(tt_roam_node->addr, client)) | 1901 | if (!compare_eth(tt_roam_node->addr, client)) |
1889 | continue; | 1902 | continue; |
@@ -1926,7 +1939,8 @@ static void send_roam_adv(struct bat_priv *bat_priv, uint8_t *client, | |||
1926 | struct hard_iface *primary_if; | 1939 | struct hard_iface *primary_if; |
1927 | 1940 | ||
1928 | /* before going on we have to check whether the client has | 1941 | /* before going on we have to check whether the client has |
1929 | * already roamed to us too many times */ | 1942 | * already roamed to us too many times |
1943 | */ | ||
1930 | if (!tt_check_roam_count(bat_priv, client)) | 1944 | if (!tt_check_roam_count(bat_priv, client)) |
1931 | goto out; | 1945 | goto out; |
1932 | 1946 | ||
@@ -2000,7 +2014,8 @@ void batadv_tt_free(struct bat_priv *bat_priv) | |||
2000 | } | 2014 | } |
2001 | 2015 | ||
2002 | /* This function will enable or disable the specified flags for all the entries | 2016 | /* This function will enable or disable the specified flags for all the entries |
2003 | * in the given hash table and returns the number of modified entries */ | 2017 | * in the given hash table and returns the number of modified entries |
2018 | */ | ||
2004 | static uint16_t tt_set_flags(struct hashtable_t *hash, uint16_t flags, | 2019 | static uint16_t tt_set_flags(struct hashtable_t *hash, uint16_t flags, |
2005 | bool enable) | 2020 | bool enable) |
2006 | { | 2021 | { |
@@ -2172,12 +2187,14 @@ void batadv_tt_update_orig(struct bat_priv *bat_priv, | |||
2172 | return; | 2187 | return; |
2173 | 2188 | ||
2174 | /* orig table not initialised AND first diff is in the OGM OR the ttvn | 2189 | /* orig table not initialised AND first diff is in the OGM OR the ttvn |
2175 | * increased by one -> we can apply the attached changes */ | 2190 | * increased by one -> we can apply the attached changes |
2191 | */ | ||
2176 | if ((!orig_node->tt_initialised && ttvn == 1) || | 2192 | if ((!orig_node->tt_initialised && ttvn == 1) || |
2177 | ttvn - orig_ttvn == 1) { | 2193 | ttvn - orig_ttvn == 1) { |
2178 | /* the OGM could not contain the changes due to their size or | 2194 | /* the OGM could not contain the changes due to their size or |
2179 | * because they have already been sent TT_OGM_APPEND_MAX times. | 2195 | * because they have already been sent TT_OGM_APPEND_MAX times. |
2180 | * In this case send a tt request */ | 2196 | * In this case send a tt request |
2197 | */ | ||
2181 | if (!tt_num_changes) { | 2198 | if (!tt_num_changes) { |
2182 | full_table = false; | 2199 | full_table = false; |
2183 | goto request_table; | 2200 | goto request_table; |
@@ -2188,7 +2205,8 @@ void batadv_tt_update_orig(struct bat_priv *bat_priv, | |||
2188 | 2205 | ||
2189 | /* Even if we received the precomputed crc with the OGM, we | 2206 | /* Even if we received the precomputed crc with the OGM, we |
2190 | * prefer to recompute it to spot any possible inconsistency | 2207 | * prefer to recompute it to spot any possible inconsistency |
2191 | * in the global table */ | 2208 | * in the global table |
2209 | */ | ||
2192 | orig_node->tt_crc = tt_global_crc(bat_priv, orig_node); | 2210 | orig_node->tt_crc = tt_global_crc(bat_priv, orig_node); |
2193 | 2211 | ||
2194 | /* The ttvn alone is not enough to guarantee consistency | 2212 | /* The ttvn alone is not enough to guarantee consistency |
@@ -2198,17 +2216,19 @@ void batadv_tt_update_orig(struct bat_priv *bat_priv, | |||
2198 | * consistent or not. E.g. a node could disconnect while its | 2216 | * consistent or not. E.g. a node could disconnect while its |
2199 | * ttvn is X and reconnect on ttvn = X + TTVN_MAX: in this case | 2217 | * ttvn is X and reconnect on ttvn = X + TTVN_MAX: in this case |
2200 | * checking the CRC value is mandatory to detect the | 2218 | * checking the CRC value is mandatory to detect the |
2201 | * inconsistency */ | 2219 | * inconsistency |
2220 | */ | ||
2202 | if (orig_node->tt_crc != tt_crc) | 2221 | if (orig_node->tt_crc != tt_crc) |
2203 | goto request_table; | 2222 | goto request_table; |
2204 | 2223 | ||
2205 | /* Roaming phase is over: tables are in sync again. I can | 2224 | /* Roaming phase is over: tables are in sync again. I can |
2206 | * unset the flag */ | 2225 | * unset the flag |
2226 | */ | ||
2207 | orig_node->tt_poss_change = false; | 2227 | orig_node->tt_poss_change = false; |
2208 | } else { | 2228 | } else { |
2209 | /* if we missed more than one change or our tables are not | 2229 | /* if we missed more than one change or our tables are not |
2210 | * in sync anymore -> request fresh tt data */ | 2230 | * in sync anymore -> request fresh tt data |
2211 | 2231 | */ | |
2212 | if (!orig_node->tt_initialised || ttvn != orig_ttvn || | 2232 | if (!orig_node->tt_initialised || ttvn != orig_ttvn || |
2213 | orig_node->tt_crc != tt_crc) { | 2233 | orig_node->tt_crc != tt_crc) { |
2214 | request_table: | 2234 | request_table: |
diff --git a/net/batman-adv/translation-table.h b/net/batman-adv/translation-table.h index fe1281a71685..7edc9dff8ba1 100644 --- a/net/batman-adv/translation-table.h +++ b/net/batman-adv/translation-table.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner, Simon Wunderlich, Antonio Quartulli | 3 | * Marek Lindner, Simon Wunderlich, Antonio Quartulli |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #ifndef _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ | 20 | #ifndef _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ |
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h index bf71d525445a..053c5d4776ce 100644 --- a/net/batman-adv/types.h +++ b/net/batman-adv/types.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Marek Lindner, Simon Wunderlich | 3 | * Marek Lindner, Simon Wunderlich |
5 | * | 4 | * |
@@ -16,11 +15,8 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | |||
23 | |||
24 | #ifndef _NET_BATMAN_ADV_TYPES_H_ | 20 | #ifndef _NET_BATMAN_ADV_TYPES_H_ |
25 | #define _NET_BATMAN_ADV_TYPES_H_ | 21 | #define _NET_BATMAN_ADV_TYPES_H_ |
26 | 22 | ||
@@ -49,8 +45,7 @@ struct hard_iface { | |||
49 | struct rcu_head rcu; | 45 | struct rcu_head rcu; |
50 | }; | 46 | }; |
51 | 47 | ||
52 | /** | 48 | /* orig_node - structure for orig_list maintaining nodes of mesh |
53 | * orig_node - structure for orig_list maintaining nodes of mesh | ||
54 | * @primary_addr: hosts primary interface address | 49 | * @primary_addr: hosts primary interface address |
55 | * @last_seen: when last packet from this node was received | 50 | * @last_seen: when last packet from this node was received |
56 | * @bcast_seqno_reset: time when the broadcast seqno window was reset | 51 | * @bcast_seqno_reset: time when the broadcast seqno window was reset |
@@ -86,7 +81,8 @@ struct orig_node { | |||
86 | * If true, then I sent a Roaming_adv to this orig_node and I have to | 81 | * If true, then I sent a Roaming_adv to this orig_node and I have to |
87 | * inspect every packet directed to it to check whether it is still | 82 | * inspect every packet directed to it to check whether it is still |
88 | * the true destination or not. This flag will be reset to false as | 83 | * the true destination or not. This flag will be reset to false as |
89 | * soon as I receive a new TTVN from this orig_node */ | 84 | * soon as I receive a new TTVN from this orig_node |
85 | */ | ||
90 | bool tt_poss_change; | 86 | bool tt_poss_change; |
91 | uint32_t last_real_seqno; | 87 | uint32_t last_real_seqno; |
92 | uint8_t last_ttl; | 88 | uint8_t last_ttl; |
@@ -101,7 +97,8 @@ struct orig_node { | |||
101 | struct bat_priv *bat_priv; | 97 | struct bat_priv *bat_priv; |
102 | unsigned long last_frag_packet; | 98 | unsigned long last_frag_packet; |
103 | /* ogm_cnt_lock protects: bcast_own, bcast_own_sum, | 99 | /* ogm_cnt_lock protects: bcast_own, bcast_own_sum, |
104 | * neigh_node->real_bits, neigh_node->real_packet_count */ | 100 | * neigh_node->real_bits, neigh_node->real_packet_count |
101 | */ | ||
105 | spinlock_t ogm_cnt_lock; | 102 | spinlock_t ogm_cnt_lock; |
106 | /* bcast_seqno_lock protects bcast_bits, last_bcast_seqno */ | 103 | /* bcast_seqno_lock protects bcast_bits, last_bcast_seqno */ |
107 | spinlock_t bcast_seqno_lock; | 104 | spinlock_t bcast_seqno_lock; |
@@ -118,8 +115,7 @@ struct gw_node { | |||
118 | struct rcu_head rcu; | 115 | struct rcu_head rcu; |
119 | }; | 116 | }; |
120 | 117 | ||
121 | /** | 118 | /* neigh_node |
122 | * neigh_node | ||
123 | * @last_seen: when last packet via this neighbor was received | 119 | * @last_seen: when last packet via this neighbor was received |
124 | */ | 120 | */ |
125 | struct neigh_node { | 121 | struct neigh_node { |
@@ -191,7 +187,8 @@ struct bat_priv { | |||
191 | * If true, then I received a Roaming_adv and I have to inspect every | 187 | * If true, then I received a Roaming_adv and I have to inspect every |
192 | * packet directed to me to check whether I am still the true | 188 | * packet directed to me to check whether I am still the true |
193 | * destination or not. This flag will be reset to false as soon as I | 189 | * destination or not. This flag will be reset to false as soon as I |
194 | * increase my TTVN */ | 190 | * increase my TTVN |
191 | */ | ||
195 | bool tt_poss_change; | 192 | bool tt_poss_change; |
196 | char num_ifaces; | 193 | char num_ifaces; |
197 | struct debug_log *debug_log; | 194 | struct debug_log *debug_log; |
@@ -326,8 +323,7 @@ struct tt_roam_node { | |||
326 | struct list_head list; | 323 | struct list_head list; |
327 | }; | 324 | }; |
328 | 325 | ||
329 | /** | 326 | /* forw_packet - structure for forw_list maintaining packets to be |
330 | * forw_packet - structure for forw_list maintaining packets to be | ||
331 | * send/forwarded | 327 | * send/forwarded |
332 | */ | 328 | */ |
333 | struct forw_packet { | 329 | struct forw_packet { |
@@ -369,7 +365,8 @@ struct frag_packet_list_entry { | |||
369 | struct vis_info { | 365 | struct vis_info { |
370 | unsigned long first_seen; | 366 | unsigned long first_seen; |
371 | /* list of server-neighbors we received a vis-packet | 367 | /* list of server-neighbors we received a vis-packet |
372 | * from. we should not reply to them. */ | 368 | * from. we should not reply to them. |
369 | */ | ||
373 | struct list_head recv_list; | 370 | struct list_head recv_list; |
374 | struct list_head send_list; | 371 | struct list_head send_list; |
375 | struct kref refcount; | 372 | struct kref refcount; |
@@ -377,7 +374,7 @@ struct vis_info { | |||
377 | struct bat_priv *bat_priv; | 374 | struct bat_priv *bat_priv; |
378 | /* this packet might be part of the vis send queue. */ | 375 | /* this packet might be part of the vis send queue. */ |
379 | struct sk_buff *skb_packet; | 376 | struct sk_buff *skb_packet; |
380 | /* vis_info may follow here*/ | 377 | /* vis_info may follow here */ |
381 | } __packed; | 378 | } __packed; |
382 | 379 | ||
383 | struct vis_info_entry { | 380 | struct vis_info_entry { |
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c index e9d3bdd4e3d6..b2b76df69607 100644 --- a/net/batman-adv/unicast.c +++ b/net/batman-adv/unicast.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Andreas Langer | 3 | * Andreas Langer |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #include "main.h" | 20 | #include "main.h" |
@@ -300,12 +298,12 @@ int batadv_unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv) | |||
300 | } | 298 | } |
301 | 299 | ||
302 | /* check for tt host - increases orig_node refcount. | 300 | /* check for tt host - increases orig_node refcount. |
303 | * returns NULL in case of AP isolation */ | 301 | * returns NULL in case of AP isolation |
302 | */ | ||
304 | orig_node = batadv_transtable_search(bat_priv, ethhdr->h_source, | 303 | orig_node = batadv_transtable_search(bat_priv, ethhdr->h_source, |
305 | ethhdr->h_dest); | 304 | ethhdr->h_dest); |
306 | find_router: | 305 | find_router: |
307 | /** | 306 | /* find_router(): |
308 | * find_router(): | ||
309 | * - if orig_node is NULL it returns NULL | 307 | * - if orig_node is NULL it returns NULL |
310 | * - increases neigh_nodes refcount if found. | 308 | * - increases neigh_nodes refcount if found. |
311 | */ | 309 | */ |
diff --git a/net/batman-adv/unicast.h b/net/batman-adv/unicast.h index 657fe7392b14..87f8f89d1440 100644 --- a/net/batman-adv/unicast.h +++ b/net/batman-adv/unicast.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Andreas Langer | 3 | * Andreas Langer |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #ifndef _NET_BATMAN_ADV_UNICAST_H_ | 20 | #ifndef _NET_BATMAN_ADV_UNICAST_H_ |
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c index 83c931fa5c21..20eef04645bd 100644 --- a/net/batman-adv/vis.c +++ b/net/batman-adv/vis.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2008-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2008-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Simon Wunderlich | 3 | * Simon Wunderlich |
5 | * | 4 | * |
@@ -16,7 +15,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #include "main.h" | 20 | #include "main.h" |
@@ -64,8 +62,9 @@ static int vis_info_cmp(const struct hlist_node *node, const void *data2) | |||
64 | return compare_eth(p1->vis_orig, p2->vis_orig); | 62 | return compare_eth(p1->vis_orig, p2->vis_orig); |
65 | } | 63 | } |
66 | 64 | ||
67 | /* hash function to choose an entry in a hash table of given size */ | 65 | /* hash function to choose an entry in a hash table of given size |
68 | /* hash algorithm from http://en.wikipedia.org/wiki/Hash_table */ | 66 | * hash algorithm from http://en.wikipedia.org/wiki/Hash_table |
67 | */ | ||
69 | static uint32_t vis_info_choose(const void *data, uint32_t size) | 68 | static uint32_t vis_info_choose(const void *data, uint32_t size) |
70 | { | 69 | { |
71 | const struct vis_info *vis_info = data; | 70 | const struct vis_info *vis_info = data; |
@@ -118,7 +117,8 @@ static struct vis_info *vis_hash_find(struct bat_priv *bat_priv, | |||
118 | } | 117 | } |
119 | 118 | ||
120 | /* insert interface to the list of interfaces of one originator, if it | 119 | /* insert interface to the list of interfaces of one originator, if it |
121 | * does not already exist in the list */ | 120 | * does not already exist in the list |
121 | */ | ||
122 | static void vis_data_insert_interface(const uint8_t *interface, | 122 | static void vis_data_insert_interface(const uint8_t *interface, |
123 | struct hlist_head *if_list, | 123 | struct hlist_head *if_list, |
124 | bool primary) | 124 | bool primary) |
@@ -334,7 +334,8 @@ out: | |||
334 | } | 334 | } |
335 | 335 | ||
336 | /* add the info packet to the send list, if it was not | 336 | /* add the info packet to the send list, if it was not |
337 | * already linked in. */ | 337 | * already linked in. |
338 | */ | ||
338 | static void send_list_add(struct bat_priv *bat_priv, struct vis_info *info) | 339 | static void send_list_add(struct bat_priv *bat_priv, struct vis_info *info) |
339 | { | 340 | { |
340 | if (list_empty(&info->send_list)) { | 341 | if (list_empty(&info->send_list)) { |
@@ -344,7 +345,8 @@ static void send_list_add(struct bat_priv *bat_priv, struct vis_info *info) | |||
344 | } | 345 | } |
345 | 346 | ||
346 | /* delete the info packet from the send list, if it was | 347 | /* delete the info packet from the send list, if it was |
347 | * linked in. */ | 348 | * linked in. |
349 | */ | ||
348 | static void send_list_del(struct vis_info *info) | 350 | static void send_list_del(struct vis_info *info) |
349 | { | 351 | { |
350 | if (!list_empty(&info->send_list)) { | 352 | if (!list_empty(&info->send_list)) { |
@@ -388,7 +390,8 @@ static int recv_list_is_in(struct bat_priv *bat_priv, | |||
388 | 390 | ||
389 | /* try to add the packet to the vis_hash. return NULL if invalid (e.g. too old, | 391 | /* try to add the packet to the vis_hash. return NULL if invalid (e.g. too old, |
390 | * broken.. ). vis hash must be locked outside. is_new is set when the packet | 392 | * broken.. ). vis hash must be locked outside. is_new is set when the packet |
391 | * is newer than old entries in the hash. */ | 393 | * is newer than old entries in the hash. |
394 | */ | ||
392 | static struct vis_info *add_packet(struct bat_priv *bat_priv, | 395 | static struct vis_info *add_packet(struct bat_priv *bat_priv, |
393 | struct vis_packet *vis_packet, | 396 | struct vis_packet *vis_packet, |
394 | int vis_info_len, int *is_new, | 397 | int vis_info_len, int *is_new, |
@@ -500,7 +503,8 @@ void batadv_receive_server_sync_packet(struct bat_priv *bat_priv, | |||
500 | goto end; | 503 | goto end; |
501 | 504 | ||
502 | /* only if we are server ourselves and packet is newer than the one in | 505 | /* only if we are server ourselves and packet is newer than the one in |
503 | * hash.*/ | 506 | * hash. |
507 | */ | ||
504 | if (vis_server == VIS_TYPE_SERVER_SYNC && is_new) | 508 | if (vis_server == VIS_TYPE_SERVER_SYNC && is_new) |
505 | send_list_add(bat_priv, info); | 509 | send_list_add(bat_priv, info); |
506 | end: | 510 | end: |
@@ -554,7 +558,8 @@ end: | |||
554 | /* Walk the originators and find the VIS server with the best tq. Set the packet | 558 | /* Walk the originators and find the VIS server with the best tq. Set the packet |
555 | * address to its address and return the best_tq. | 559 | * address to its address and return the best_tq. |
556 | * | 560 | * |
557 | * Must be called with the originator hash locked */ | 561 | * Must be called with the originator hash locked |
562 | */ | ||
558 | static int find_best_vis_server(struct bat_priv *bat_priv, | 563 | static int find_best_vis_server(struct bat_priv *bat_priv, |
559 | struct vis_info *info) | 564 | struct vis_info *info) |
560 | { | 565 | { |
@@ -605,7 +610,8 @@ static bool vis_packet_full(const struct vis_info *info) | |||
605 | } | 610 | } |
606 | 611 | ||
607 | /* generates a packet of own vis data, | 612 | /* generates a packet of own vis data, |
608 | * returns 0 on success, -1 if no packet could be generated */ | 613 | * returns 0 on success, -1 if no packet could be generated |
614 | */ | ||
609 | static int generate_vis_packet(struct bat_priv *bat_priv) | 615 | static int generate_vis_packet(struct bat_priv *bat_priv) |
610 | { | 616 | { |
611 | struct hashtable_t *hash = bat_priv->orig_hash; | 617 | struct hashtable_t *hash = bat_priv->orig_hash; |
@@ -703,7 +709,8 @@ unlock: | |||
703 | } | 709 | } |
704 | 710 | ||
705 | /* free old vis packets. Must be called with this vis_hash_lock | 711 | /* free old vis packets. Must be called with this vis_hash_lock |
706 | * held */ | 712 | * held |
713 | */ | ||
707 | static void purge_vis_packets(struct bat_priv *bat_priv) | 714 | static void purge_vis_packets(struct bat_priv *bat_priv) |
708 | { | 715 | { |
709 | uint32_t i; | 716 | uint32_t i; |
@@ -762,7 +769,8 @@ static void broadcast_vis_packet(struct bat_priv *bat_priv, | |||
762 | continue; | 769 | continue; |
763 | 770 | ||
764 | /* don't send it if we already received the packet from | 771 | /* don't send it if we already received the packet from |
765 | * this node. */ | 772 | * this node. |
773 | */ | ||
766 | if (recv_list_is_in(bat_priv, &info->recv_list, | 774 | if (recv_list_is_in(bat_priv, &info->recv_list, |
767 | orig_node->orig)) { | 775 | orig_node->orig)) { |
768 | batadv_neigh_node_free_ref(router); | 776 | batadv_neigh_node_free_ref(router); |
@@ -879,7 +887,8 @@ static void send_vis_packets(struct work_struct *work) | |||
879 | } | 887 | } |
880 | 888 | ||
881 | /* init the vis server. this may only be called when if_list is already | 889 | /* init the vis server. this may only be called when if_list is already |
882 | * initialized (e.g. bat0 is initialized, interfaces have been added) */ | 890 | * initialized (e.g. bat0 is initialized, interfaces have been added) |
891 | */ | ||
883 | int batadv_vis_init(struct bat_priv *bat_priv) | 892 | int batadv_vis_init(struct bat_priv *bat_priv) |
884 | { | 893 | { |
885 | struct vis_packet *packet; | 894 | struct vis_packet *packet; |
diff --git a/net/batman-adv/vis.h b/net/batman-adv/vis.h index 932514e4b7d7..dad595870f8f 100644 --- a/net/batman-adv/vis.h +++ b/net/batman-adv/vis.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* Copyright (C) 2008-2012 B.A.T.M.A.N. contributors: |
2 | * Copyright (C) 2008-2012 B.A.T.M.A.N. contributors: | ||
3 | * | 2 | * |
4 | * Simon Wunderlich, Marek Lindner | 3 | * Simon Wunderlich, Marek Lindner |
5 | * | 4 | * |
@@ -16,14 +15,13 @@ | |||
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | * 02110-1301, USA | 17 | * 02110-1301, USA |
19 | * | ||
20 | */ | 18 | */ |
21 | 19 | ||
22 | #ifndef _NET_BATMAN_ADV_VIS_H_ | 20 | #ifndef _NET_BATMAN_ADV_VIS_H_ |
23 | #define _NET_BATMAN_ADV_VIS_H_ | 21 | #define _NET_BATMAN_ADV_VIS_H_ |
24 | 22 | ||
25 | #define VIS_TIMEOUT 200000 /* timeout of vis packets | 23 | /* timeout of vis packets in miliseconds */ |
26 | * in miliseconds */ | 24 | #define VIS_TIMEOUT 200000 |
27 | 25 | ||
28 | int batadv_vis_seq_print_text(struct seq_file *seq, void *offset); | 26 | int batadv_vis_seq_print_text(struct seq_file *seq, void *offset); |
29 | void batadv_receive_server_sync_packet(struct bat_priv *bat_priv, | 27 | void batadv_receive_server_sync_packet(struct bat_priv *bat_priv, |