diff options
| author | Antonio Quartulli <antonio@open-mesh.com> | 2013-04-17 11:44:43 -0400 |
|---|---|---|
| committer | Antonio Quartulli <ordex@autistici.org> | 2013-05-28 20:44:54 -0400 |
| commit | d98966173213704873864c4e5057d823996ae95d (patch) | |
| tree | edd4383ff16238b0a19d2df4bb98ae9e7d3ab2bd /net/batman-adv | |
| parent | 24a5deeb8a198f0a26ae04485d9976c5e414f723 (diff) | |
batman-adv: move batadv_slide_own_bcast_window to bat_iv_ogm.c
batadv_slide_own_bcast_window() is used only in bat_iv_ogm.c
and it is currently touching only batman_iv specific
attributes.
Move it into bat_iv_ogm.c and make it static.
Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Diffstat (limited to 'net/batman-adv')
| -rw-r--r-- | net/batman-adv/bat_iv_ogm.c | 37 | ||||
| -rw-r--r-- | net/batman-adv/routing.c | 29 | ||||
| -rw-r--r-- | net/batman-adv/routing.h | 1 |
3 files changed, 36 insertions, 31 deletions
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index 31c2891c2cd0..42b7a94d61b3 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c | |||
| @@ -630,6 +630,41 @@ static void batadv_iv_ogm_forward(struct batadv_orig_node *orig_node, | |||
| 630 | if_incoming, 0, batadv_iv_ogm_fwd_send_time()); | 630 | if_incoming, 0, batadv_iv_ogm_fwd_send_time()); |
| 631 | } | 631 | } |
| 632 | 632 | ||
| 633 | /** | ||
| 634 | * batadv_iv_ogm_slide_own_bcast_window - bitshift own OGM broadcast windows for | ||
| 635 | * the given interface | ||
| 636 | * @hard_iface: the interface for which the windows have to be shifted | ||
| 637 | */ | ||
| 638 | static void | ||
| 639 | batadv_iv_ogm_slide_own_bcast_window(struct batadv_hard_iface *hard_iface) | ||
| 640 | { | ||
| 641 | struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface); | ||
| 642 | struct batadv_hashtable *hash = bat_priv->orig_hash; | ||
| 643 | struct hlist_head *head; | ||
| 644 | struct batadv_orig_node *orig_node; | ||
| 645 | unsigned long *word; | ||
| 646 | uint32_t i; | ||
| 647 | size_t word_index; | ||
| 648 | uint8_t *w; | ||
| 649 | |||
| 650 | for (i = 0; i < hash->size; i++) { | ||
| 651 | head = &hash->table[i]; | ||
| 652 | |||
| 653 | rcu_read_lock(); | ||
| 654 | hlist_for_each_entry_rcu(orig_node, head, hash_entry) { | ||
| 655 | spin_lock_bh(&orig_node->ogm_cnt_lock); | ||
| 656 | word_index = hard_iface->if_num * BATADV_NUM_WORDS; | ||
| 657 | word = &(orig_node->bcast_own[word_index]); | ||
| 658 | |||
| 659 | batadv_bit_get_packet(bat_priv, word, 1, 0); | ||
| 660 | w = &orig_node->bcast_own_sum[hard_iface->if_num]; | ||
| 661 | *w = bitmap_weight(word, BATADV_TQ_LOCAL_WINDOW_SIZE); | ||
| 662 | spin_unlock_bh(&orig_node->ogm_cnt_lock); | ||
| 663 | } | ||
| 664 | rcu_read_unlock(); | ||
| 665 | } | ||
| 666 | } | ||
| 667 | |||
| 633 | static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface) | 668 | static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface) |
| 634 | { | 669 | { |
| 635 | struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface); | 670 | struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface); |
| @@ -674,7 +709,7 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface) | |||
| 674 | batadv_ogm_packet->gw_flags = BATADV_NO_FLAGS; | 709 | batadv_ogm_packet->gw_flags = BATADV_NO_FLAGS; |
| 675 | } | 710 | } |
| 676 | 711 | ||
| 677 | batadv_slide_own_bcast_window(hard_iface); | 712 | batadv_iv_ogm_slide_own_bcast_window(hard_iface); |
| 678 | batadv_iv_ogm_queue_add(bat_priv, hard_iface->bat_iv.ogm_buff, | 713 | batadv_iv_ogm_queue_add(bat_priv, hard_iface->bat_iv.ogm_buff, |
| 679 | hard_iface->bat_iv.ogm_buff_len, hard_iface, 1, | 714 | hard_iface->bat_iv.ogm_buff_len, hard_iface, 1, |
| 680 | batadv_iv_ogm_emit_send_time(bat_priv)); | 715 | batadv_iv_ogm_emit_send_time(bat_priv)); |
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index beeab2e8cd66..fad08469767d 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
| @@ -34,35 +34,6 @@ | |||
| 34 | static int batadv_route_unicast_packet(struct sk_buff *skb, | 34 | static int batadv_route_unicast_packet(struct sk_buff *skb, |
| 35 | struct batadv_hard_iface *recv_if); | 35 | struct batadv_hard_iface *recv_if); |
| 36 | 36 | ||
| 37 | void batadv_slide_own_bcast_window(struct batadv_hard_iface *hard_iface) | ||
| 38 | { | ||
| 39 | struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface); | ||
| 40 | struct batadv_hashtable *hash = bat_priv->orig_hash; | ||
| 41 | struct hlist_head *head; | ||
| 42 | struct batadv_orig_node *orig_node; | ||
| 43 | unsigned long *word; | ||
| 44 | uint32_t i; | ||
| 45 | size_t word_index; | ||
| 46 | uint8_t *w; | ||
| 47 | |||
| 48 | for (i = 0; i < hash->size; i++) { | ||
| 49 | head = &hash->table[i]; | ||
| 50 | |||
| 51 | rcu_read_lock(); | ||
| 52 | hlist_for_each_entry_rcu(orig_node, head, hash_entry) { | ||
| 53 | spin_lock_bh(&orig_node->ogm_cnt_lock); | ||
| 54 | word_index = hard_iface->if_num * BATADV_NUM_WORDS; | ||
| 55 | word = &(orig_node->bcast_own[word_index]); | ||
| 56 | |||
| 57 | batadv_bit_get_packet(bat_priv, word, 1, 0); | ||
| 58 | w = &orig_node->bcast_own_sum[hard_iface->if_num]; | ||
| 59 | *w = bitmap_weight(word, BATADV_TQ_LOCAL_WINDOW_SIZE); | ||
| 60 | spin_unlock_bh(&orig_node->ogm_cnt_lock); | ||
| 61 | } | ||
| 62 | rcu_read_unlock(); | ||
| 63 | } | ||
| 64 | } | ||
| 65 | |||
| 66 | static void _batadv_update_route(struct batadv_priv *bat_priv, | 37 | static void _batadv_update_route(struct batadv_priv *bat_priv, |
| 67 | struct batadv_orig_node *orig_node, | 38 | struct batadv_orig_node *orig_node, |
| 68 | struct batadv_neigh_node *neigh_node) | 39 | struct batadv_neigh_node *neigh_node) |
diff --git a/net/batman-adv/routing.h b/net/batman-adv/routing.h index 99eeafaba407..72a29bde2010 100644 --- a/net/batman-adv/routing.h +++ b/net/batman-adv/routing.h | |||
| @@ -20,7 +20,6 @@ | |||
| 20 | #ifndef _NET_BATMAN_ADV_ROUTING_H_ | 20 | #ifndef _NET_BATMAN_ADV_ROUTING_H_ |
| 21 | #define _NET_BATMAN_ADV_ROUTING_H_ | 21 | #define _NET_BATMAN_ADV_ROUTING_H_ |
| 22 | 22 | ||
| 23 | void batadv_slide_own_bcast_window(struct batadv_hard_iface *hard_iface); | ||
| 24 | bool batadv_check_management_packet(struct sk_buff *skb, | 23 | bool batadv_check_management_packet(struct sk_buff *skb, |
| 25 | struct batadv_hard_iface *hard_iface, | 24 | struct batadv_hard_iface *hard_iface, |
| 26 | int header_len); | 25 | int header_len); |
