public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: move batadv_slide_own_bcast_window to bat_iv_ogm.c
@ 2013-04-02  9:41 Antonio Quartulli
  2013-04-15  9:10 ` Marek Lindner
  0 siblings, 1 reply; 4+ messages in thread
From: Antonio Quartulli @ 2013-04-02  9:41 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Antonio Quartulli

From: Antonio Quartulli <antonio@open-mesh.com>

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>
---
 bat_iv_ogm.c | 32 +++++++++++++++++++++++++++++++-
 routing.c    | 29 -----------------------------
 routing.h    |  1 -
 3 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index bd50e0d..3c6670f 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -589,6 +589,36 @@ static void batadv_iv_ogm_forward(struct batadv_orig_node *orig_node,
 				if_incoming, 0, batadv_iv_ogm_fwd_send_time());
 }
 
+static void
+batadv_iv_ogm_slide_own_bcast_window(struct batadv_hard_iface *hard_iface)
+{
+	struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
+	struct batadv_hashtable *hash = bat_priv->orig_hash;
+	struct hlist_head *head;
+	struct batadv_orig_node *orig_node;
+	unsigned long *word;
+	uint32_t i;
+	size_t word_index;
+	uint8_t *w;
+
+	for (i = 0; i < hash->size; i++) {
+		head = &hash->table[i];
+
+		rcu_read_lock();
+		hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
+			spin_lock_bh(&orig_node->ogm_cnt_lock);
+			word_index = hard_iface->if_num * BATADV_NUM_WORDS;
+			word = &(orig_node->bcast_own[word_index]);
+
+			batadv_bit_get_packet(bat_priv, word, 1, 0);
+			w = &orig_node->bcast_own_sum[hard_iface->if_num];
+			*w = bitmap_weight(word, BATADV_TQ_LOCAL_WINDOW_SIZE);
+			spin_unlock_bh(&orig_node->ogm_cnt_lock);
+		}
+		rcu_read_unlock();
+	}
+}
+
 static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface)
 {
 	struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
@@ -633,7 +663,7 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface)
 		batadv_ogm_packet->gw_flags = BATADV_NO_FLAGS;
 	}
 
-	batadv_slide_own_bcast_window(hard_iface);
+	batadv_iv_ogm_slide_own_bcast_window(hard_iface);
 	batadv_iv_ogm_queue_add(bat_priv, hard_iface->bat_iv.ogm_buff,
 				hard_iface->bat_iv.ogm_buff_len, hard_iface, 1,
 				batadv_iv_ogm_emit_send_time(bat_priv));
diff --git a/routing.c b/routing.c
index 8f88967..0b79e65 100644
--- a/routing.c
+++ b/routing.c
@@ -34,35 +34,6 @@
 static int batadv_route_unicast_packet(struct sk_buff *skb,
 				       struct batadv_hard_iface *recv_if);
 
-void batadv_slide_own_bcast_window(struct batadv_hard_iface *hard_iface)
-{
-	struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
-	struct batadv_hashtable *hash = bat_priv->orig_hash;
-	struct hlist_head *head;
-	struct batadv_orig_node *orig_node;
-	unsigned long *word;
-	uint32_t i;
-	size_t word_index;
-	uint8_t *w;
-
-	for (i = 0; i < hash->size; i++) {
-		head = &hash->table[i];
-
-		rcu_read_lock();
-		hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
-			spin_lock_bh(&orig_node->ogm_cnt_lock);
-			word_index = hard_iface->if_num * BATADV_NUM_WORDS;
-			word = &(orig_node->bcast_own[word_index]);
-
-			batadv_bit_get_packet(bat_priv, word, 1, 0);
-			w = &orig_node->bcast_own_sum[hard_iface->if_num];
-			*w = bitmap_weight(word, BATADV_TQ_LOCAL_WINDOW_SIZE);
-			spin_unlock_bh(&orig_node->ogm_cnt_lock);
-		}
-		rcu_read_unlock();
-	}
-}
-
 static void _batadv_update_route(struct batadv_priv *bat_priv,
 				 struct batadv_orig_node *orig_node,
 				 struct batadv_neigh_node *neigh_node)
diff --git a/routing.h b/routing.h
index 99eeafa..72a29bd 100644
--- a/routing.h
+++ b/routing.h
@@ -20,7 +20,6 @@
 #ifndef _NET_BATMAN_ADV_ROUTING_H_
 #define _NET_BATMAN_ADV_ROUTING_H_
 
-void batadv_slide_own_bcast_window(struct batadv_hard_iface *hard_iface);
 bool batadv_check_management_packet(struct sk_buff *skb,
 				    struct batadv_hard_iface *hard_iface,
 				    int header_len);
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: move batadv_slide_own_bcast_window to bat_iv_ogm.c
  2013-04-02  9:41 [B.A.T.M.A.N.] [PATCH] batman-adv: move batadv_slide_own_bcast_window to bat_iv_ogm.c Antonio Quartulli
@ 2013-04-15  9:10 ` Marek Lindner
  2013-04-15 10:25   ` Antonio Quartulli
  0 siblings, 1 reply; 4+ messages in thread
From: Marek Lindner @ 2013-04-15  9:10 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Tuesday, April 02, 2013 17:41:08 Antonio Quartulli wrote:
> +static void
> +batadv_iv_ogm_slide_own_bcast_window(struct batadv_hard_iface *hard_iface)
> +{
> +       struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
> +       struct batadv_hashtable *hash = bat_priv->orig_hash;
> +       struct hlist_head *head;
> +       struct batadv_orig_node *orig_node;
> +       unsigned long *word;
> +       uint32_t i;
> +       size_t word_index;
> +       uint8_t *w;
> +
> +       for (i = 0; i < hash->size; i++) {
> +               head = &hash->table[i];
> +
> +               rcu_read_lock();
> +               hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
> +                       spin_lock_bh(&orig_node->ogm_cnt_lock);
> +                       word_index = hard_iface->if_num * BATADV_NUM_WORDS;
> +                       word = &(orig_node->bcast_own[word_index]);
> +
> +                       batadv_bit_get_packet(bat_priv, word, 1, 0);
> +                       w = &orig_node->bcast_own_sum[hard_iface->if_num];
> +                       *w = bitmap_weight(word,
> BATADV_TQ_LOCAL_WINDOW_SIZE);
> +                       spin_unlock_bh(&orig_node->ogm_cnt_lock);
> +               }
> +               rcu_read_unlock();
> +       }
> +}

Kernel doc ?

Cheers,
Marek

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: move batadv_slide_own_bcast_window to bat_iv_ogm.c
  2013-04-15  9:10 ` Marek Lindner
@ 2013-04-15 10:25   ` Antonio Quartulli
  2013-04-16 13:38     ` Marek Lindner
  0 siblings, 1 reply; 4+ messages in thread
From: Antonio Quartulli @ 2013-04-15 10:25 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

[-- Attachment #1: Type: text/plain, Size: 1601 bytes --]

On Mon, Apr 15, 2013 at 05:10:40PM +0800, Marek Lindner wrote:
> On Tuesday, April 02, 2013 17:41:08 Antonio Quartulli wrote:
> > +static void
> > +batadv_iv_ogm_slide_own_bcast_window(struct batadv_hard_iface *hard_iface)
> > +{
> > +       struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
> > +       struct batadv_hashtable *hash = bat_priv->orig_hash;
> > +       struct hlist_head *head;
> > +       struct batadv_orig_node *orig_node;
> > +       unsigned long *word;
> > +       uint32_t i;
> > +       size_t word_index;
> > +       uint8_t *w;
> > +
> > +       for (i = 0; i < hash->size; i++) {
> > +               head = &hash->table[i];
> > +
> > +               rcu_read_lock();
> > +               hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
> > +                       spin_lock_bh(&orig_node->ogm_cnt_lock);
> > +                       word_index = hard_iface->if_num * BATADV_NUM_WORDS;
> > +                       word = &(orig_node->bcast_own[word_index]);
> > +
> > +                       batadv_bit_get_packet(bat_priv, word, 1, 0);
> > +                       w = &orig_node->bcast_own_sum[hard_iface->if_num];
> > +                       *w = bitmap_weight(word,
> > BATADV_TQ_LOCAL_WINDOW_SIZE);
> > +                       spin_unlock_bh(&orig_node->ogm_cnt_lock);
> > +               }
> > +               rcu_read_unlock();
> > +       }
> > +}
> 
> Kernel doc ?

ok. Will provide some :)

> 
> Cheers,
> Marek

-- 
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: move batadv_slide_own_bcast_window to bat_iv_ogm.c
  2013-04-15 10:25   ` Antonio Quartulli
@ 2013-04-16 13:38     ` Marek Lindner
  0 siblings, 0 replies; 4+ messages in thread
From: Marek Lindner @ 2013-04-16 13:38 UTC (permalink / raw)
  To: b.a.t.m.a.n

On Monday, April 15, 2013 18:25:09 Antonio Quartulli wrote:
>   On Mon, Apr 15, 2013 at 05:10:40PM +0800, Marek Lindner wrote:
> > On Tuesday, April 02, 2013 17:41:08 Antonio Quartulli wrote:
> > > +static void
> > > +batadv_iv_ogm_slide_own_bcast_window(struct batadv_hard_iface
> > > *hard_iface) +{
> > > +       struct batadv_priv *bat_priv =
> > > netdev_priv(hard_iface->soft_iface); +       struct batadv_hashtable
> > > *hash = bat_priv->orig_hash;
> > > +       struct hlist_head *head;
> > > +       struct batadv_orig_node *orig_node;
> > > +       unsigned long *word;
> > > +       uint32_t i;
> > > +       size_t word_index;
> > > +       uint8_t *w;
> > > +
> > > +       for (i = 0; i < hash->size; i++) {
> > > +               head = &hash->table[i];
> > > +
> > > +               rcu_read_lock();
> > > +               hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
> > > +                       spin_lock_bh(&orig_node->ogm_cnt_lock);
> > > +                       word_index = hard_iface->if_num *
> > > BATADV_NUM_WORDS; +                       word =
> > > &(orig_node->bcast_own[word_index]); +
> > > +                       batadv_bit_get_packet(bat_priv, word, 1, 0);
> > > +                       w =
> > > &orig_node->bcast_own_sum[hard_iface->if_num];
> > > +                       *w = bitmap_weight(word,
> > > BATADV_TQ_LOCAL_WINDOW_SIZE);
> > > +                       spin_unlock_bh(&orig_node->ogm_cnt_lock);
> > > +               }
> > > +               rcu_read_unlock();
> > > +       }
> > > +}
> >
> > 
> >
> > Kernel doc ?
> 
> ok. Will provide some :)

I added the kernel doc for you.

Applied in revision c941378.

Thanks,
Marek

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-04-16 13:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-02  9:41 [B.A.T.M.A.N.] [PATCH] batman-adv: move batadv_slide_own_bcast_window to bat_iv_ogm.c Antonio Quartulli
2013-04-15  9:10 ` Marek Lindner
2013-04-15 10:25   ` Antonio Quartulli
2013-04-16 13:38     ` Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox