The following commit has been merged in the master branch:
commit 402196724816875d382099bedb09fdf1f57845bc
Author: Antonio Quartulli <ordex(a)autistici.org>
Date: Wed May 18 16:47:23 2011 +0200
batman-adv: a multiline comment should precede the variable it is describing
This comment has been wrongly put after the variable it refers to and was also bad indented
Signed-off-by: Antonio Quartulli <ordex(a)autistici.org>
Acked-by: Sven Eckelmann <sven(a)narfation.org>
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index fab70e8..65b3222 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -246,10 +246,10 @@ struct frag_packet_list_entry {
};
struct vis_info {
- unsigned long first_seen;
- struct list_head recv_list;
- /* list of server-neighbors we received a vis-packet
- * from. we should not reply to them. */
+ unsigned long first_seen;
+ /* list of server-neighbors we received a vis-packet
+ * from. we should not reply to them. */
+ struct list_head recv_list;
struct list_head send_list;
struct kref refcount;
struct hlist_node hash_entry;
--
LinuxNextTracking
The following commit has been merged in the master branch:
commit bb899b89f46eb1fd6f62a4c360f6511b9714e479
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Tue May 10 11:22:37 2011 +0200
batman-adv: Ensure that we really have route changes in update_route
The debug output of update_route has tests for "route deleted" and "route
added". All other situations are handled as "route changed". This is not
true because neigh_node and curr_router could be both NULL.
The function is not called in this situation, but the code might be
interpreted wrong when reading it without this test.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 90ae6f0..368ceeb 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -108,7 +108,7 @@ static void update_route(struct bat_priv *bat_priv, struct orig_node *orig_node,
tt_buff, tt_buff_len);
/* route changed */
- } else {
+ } else if (neigh_node && curr_router) {
bat_dbg(DBG_ROUTES, bat_priv,
"Changing route towards: %pM "
"(now via %pM - was via %pM)\n",
--
LinuxNextTracking
The following commit has been merged in the master branch:
commit 44e92bc8d6366ebe477cab23199b9f50328d326a
Author: Antonio Quartulli <ordex(a)autistici.org>
Date: Sat May 21 01:33:07 2011 +0200
batman-adv: use is_broadcast_ether_addr() instead of compare_eth(.., brd_addr)
Instead of comparing mac addresses with the broadcast address by means
of compare_eth(), the is_broadcast_ether_addr() kernel function has to be
used.
Signed-off-by: Antonio Quartulli <ordex(a)autistici.org>
Acked-by: Sven Eckelmann <sven(a)narfation.org>
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 07f23ba..90ae6f0 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -661,7 +661,7 @@ void receive_bat_packet(const struct ethhdr *ethhdr,
hard_iface->net_dev->dev_addr))
is_my_oldorig = 1;
- if (compare_eth(ethhdr->h_source, broadcast_addr))
+ if (is_broadcast_ether_addr(ethhdr->h_source))
is_broadcast = 1;
}
rcu_read_unlock();
--
LinuxNextTracking
The following commit has been merged in the master branch:
commit f5d33d37786af139cecde5af831d64a671bb756b
Author: Antonio Quartulli <ordex(a)autistici.org>
Date: Wed May 18 09:20:50 2011 +0200
batman-adv: move smallest_signed_int(), seq_before() and seq_after() into main.h
smallest_signed_int(), seq_before() and seq_after() are very useful
functions that help to handle comparisons between sequence numbers.
However they were only defined in vis.c. With this patch every
batman-adv function will be able to use them.
Signed-off-by: Antonio Quartulli <ordex(a)autistici.org>
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 0150897a..80be5ad 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -182,4 +182,20 @@ static inline int compare_eth(const void *data1, const void *data2)
#define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0)
+/* Returns the smallest signed integer in two's complement with the sizeof x */
+#define smallest_signed_int(x) (1u << (7u + 8u * (sizeof(x) - 1u)))
+
+/* Checks if a sequence number x is a predecessor/successor of y.
+ * they handle overflows/underflows and can correctly check for a
+ * predecessor/successor unless the variable sequence number has grown by
+ * more then 2**(bitwidth(x)-1)-1.
+ * This means that for a uint8_t with the maximum value 255, it would think:
+ * - when adding nothing - it is neither a predecessor nor a successor
+ * - before adding more than 127 to the starting value - it is a predecessor,
+ * - when adding 128 - it is neither a predecessor nor a successor,
+ * - after adding more than 127 to the starting value - it is a successor */
+#define seq_before(x, y) ({typeof(x) _dummy = (x - y); \
+ _dummy > smallest_signed_int(_dummy); })
+#define seq_after(x, y) seq_before(y, x)
+
#endif /* _NET_BATMAN_ADV_MAIN_H_ */
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c
index ea8d7e9..355c6e5 100644
--- a/net/batman-adv/vis.c
+++ b/net/batman-adv/vis.c
@@ -30,22 +30,6 @@
#define MAX_VIS_PACKET_SIZE 1000
-/* Returns the smallest signed integer in two's complement with the sizeof x */
-#define smallest_signed_int(x) (1u << (7u + 8u * (sizeof(x) - 1u)))
-
-/* Checks if a sequence number x is a predecessor/successor of y.
- * they handle overflows/underflows and can correctly check for a
- * predecessor/successor unless the variable sequence number has grown by
- * more then 2**(bitwidth(x)-1)-1.
- * This means that for a uint8_t with the maximum value 255, it would think:
- * - when adding nothing - it is neither a predecessor nor a successor
- * - before adding more than 127 to the starting value - it is a predecessor,
- * - when adding 128 - it is neither a predecessor nor a successor,
- * - after adding more than 127 to the starting value - it is a successor */
-#define seq_before(x, y) ({typeof(x) _dummy = (x - y); \
- _dummy > smallest_signed_int(_dummy); })
-#define seq_after(x, y) seq_before(y, x)
-
static void start_vis_timer(struct bat_priv *bat_priv);
/* free the info */
--
LinuxNextTracking
The following commit has been merged in the master branch:
commit 0bb857511b6a1572ad15dfd7f23d79587d7e2781
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Thu May 19 21:43:08 2011 +0200
batman-adv: Check type of x and y in seq_(before|after)
seq_before and seq_after depend on the fact that both sequence numbers
have the same type and thus the same bitwidth. We can ensure that by
compile time checking using a compare between the pointer to the
temporary buffers which were created using the typeof of both
parameters. For example gcc would create a warning like
"warning: comparison of distinct pointer types lacks a cast".
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 80be5ad..610eaf0 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -194,8 +194,11 @@ static inline int compare_eth(const void *data1, const void *data2)
* - before adding more than 127 to the starting value - it is a predecessor,
* - when adding 128 - it is neither a predecessor nor a successor,
* - after adding more than 127 to the starting value - it is a successor */
-#define seq_before(x, y) ({typeof(x) _dummy = (x - y); \
- _dummy > smallest_signed_int(_dummy); })
+#define seq_before(x, y) ({typeof(x) _d1 = (x); \
+ typeof(y) _d2 = (y); \
+ typeof(x) _dummy = (_d1 - _d2); \
+ (void) (&_d1 == &_d2); \
+ _dummy > smallest_signed_int(_dummy); })
#define seq_after(x, y) seq_before(y, x)
#endif /* _NET_BATMAN_ADV_MAIN_H_ */
--
LinuxNextTracking
The following commit has been merged in the master branch:
commit 728cbc6ac1eef89660875c70a602c1a0ba8df4ff
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Sun May 15 00:50:21 2011 +0200
batman-adv: Use rcu_dereference_protected by update-side
Usually rcu_dereference isn't necessary in situations were the
RCU-protected data structure cannot change, but sparse and lockdep still
need a similar functionality for analysis. rcu_dereference_protected
implements the reduced version which should be used to support the
dynamic and static analysis.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index a44dff3..ab597c4 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -86,7 +86,7 @@ static void gw_select(struct bat_priv *bat_priv, struct gw_node *new_gw_node)
if (new_gw_node && !atomic_inc_not_zero(&new_gw_node->refcount))
new_gw_node = NULL;
- curr_gw_node = bat_priv->curr_gw;
+ curr_gw_node = rcu_dereference_protected(bat_priv->curr_gw, 1);
rcu_assign_pointer(bat_priv->curr_gw, new_gw_node);
if (curr_gw_node)
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index e0052cf..a3fbfb5 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -138,7 +138,7 @@ static void primary_if_select(struct bat_priv *bat_priv,
if (new_hard_iface && !atomic_inc_not_zero(&new_hard_iface->refcount))
new_hard_iface = NULL;
- curr_hard_iface = bat_priv->primary_if;
+ curr_hard_iface = rcu_dereference_protected(bat_priv->primary_if, 1);
rcu_assign_pointer(bat_priv->primary_if, new_hard_iface);
if (curr_hard_iface)
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index cead606..b8d3f248 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -241,7 +241,8 @@ static void softif_neigh_vid_select(struct bat_priv *bat_priv,
if (new_neigh && !atomic_inc_not_zero(&new_neigh->refcount))
new_neigh = NULL;
- curr_neigh = softif_neigh_vid->softif_neigh;
+ curr_neigh = rcu_dereference_protected(softif_neigh_vid->softif_neigh,
+ 1);
rcu_assign_pointer(softif_neigh_vid->softif_neigh, new_neigh);
if ((curr_neigh) && (!new_neigh))
--
LinuxNextTracking
The following commit has been merged in the master branch:
commit 5f718c20076f4b47c3dc0f1277aef9966928089c
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Sat May 14 23:14:52 2011 +0200
batman-adv: Remove explicit casts cast from void* for store
It is not necessary to cast a void* to the pointer type when we just
store it and don't want to do pointer arithmetic before the actual
assignment.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
diff --git a/net/batman-adv/bitarray.c b/net/batman-adv/bitarray.c
index 767e237..700ee4f 100644
--- a/net/batman-adv/bitarray.c
+++ b/net/batman-adv/bitarray.c
@@ -130,7 +130,7 @@ static void bit_reset_window(unsigned long *seq_bits)
char bit_get_packet(void *priv, unsigned long *seq_bits,
int32_t seq_num_diff, int8_t set_mark)
{
- struct bat_priv *bat_priv = (struct bat_priv *)priv;
+ struct bat_priv *bat_priv = priv;
/* sequence number is slightly older. We already got a sequence number
* higher than this one, so we just mark it. */
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 915e12b..e626e75 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -523,7 +523,7 @@ void hardif_remove_interfaces(void)
static int hard_if_event(struct notifier_block *this,
unsigned long event, void *ptr)
{
- struct net_device *net_dev = (struct net_device *)ptr;
+ struct net_device *net_dev = ptr;
struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev);
struct hard_iface *primary_if = NULL;
struct bat_priv *bat_priv;
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index be7b5cc..802eace 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -313,7 +313,7 @@ out:
static void _tt_local_del(struct hlist_node *node, void *arg)
{
- struct bat_priv *bat_priv = (struct bat_priv *)arg;
+ struct bat_priv *bat_priv = arg;
void *data = container_of(node, struct tt_local_entry, hash_entry);
kfree(data);
--
LinuxNextTracking
The following commit has been merged in the master branch:
commit 958ca5985604a6f13387d32de489365df816558b
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Sat May 14 23:14:53 2011 +0200
batman-adv: Remove casts from type x to type x
Casting from pointer like 'struct orig_node*' to 'struct orig_node *'
doesn't provide any additional functionality and can be savely removed.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c
index e2deb44..82717fd 100644
--- a/net/batman-adv/unicast.c
+++ b/net/batman-adv/unicast.c
@@ -295,7 +295,7 @@ int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv)
/* get routing information */
if (is_multicast_ether_addr(ethhdr->h_dest)) {
- orig_node = (struct orig_node *)gw_get_selected_orig(bat_priv);
+ orig_node = gw_get_selected_orig(bat_priv);
if (orig_node)
goto find_router;
}
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c
index adb0327..b48954c 100644
--- a/net/batman-adv/vis.c
+++ b/net/batman-adv/vis.c
@@ -621,7 +621,7 @@ static int generate_vis_packet(struct bat_priv *bat_priv)
struct hlist_head *head;
struct orig_node *orig_node;
struct neigh_node *router;
- struct vis_info *info = (struct vis_info *)bat_priv->my_vis_info;
+ struct vis_info *info = bat_priv->my_vis_info;
struct vis_packet *packet = (struct vis_packet *)info->skb_packet->data;
struct vis_info_entry *entry;
struct tt_local_entry *tt_local_entry;
--
LinuxNextTracking