All of lore.kernel.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups
@ 2014-12-26 11:41 Markus Pargmann
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 01/26] batman-adv: debugfs, avoid compiling for !DEBUG_FS Markus Pargmann
                   ` (26 more replies)
  0 siblings, 27 replies; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

Hi,

this is v2 of this series. I removed the hashtable patches for the moment. The
types.h patch is fixed to include linux headers only when compiling for the
kernel so that it can still be used in batctl.

Major changes (Patch 1-7):
 - Compiling debugfs.c only when CONFIG_DEBUG_FS is selected. This reduces the
   amount of unnecessary code that is executed. At the moment all calls to
   debugfs functions will result in NOOPs. However there is some more code that
   we simply don't need without DEBUG_FS.
 - tvlv is separated from the large main.c file into its own tvlv.c. I don't
   see a reason to have this set of functions for tvlv inside the main.c file.

Minor changes (Patch 8-26):
 - Removing unnecessary return value variables
 - Fixing some comments
 - Reordering functions to increase readability
 - Coding style fixes
 - Declare boolean return types as bool
 - Add missing includes

Best regards,

Markus


Markus Pargmann (26):
  batman-adv: debugfs, avoid compiling for !DEBUG_FS
  batman-adv: Separate logging header
  batman-adv: iv_ogm, Reduce code duplication
  batman-adv: iv_ogm, divide and round for ring buffer avg
  batman-adv: init, Add some error handling
  batman-adv: tvlv realloc, move error handling into if block
  batman-adv: split tvlv into a seperate file
  batman-adv: Makefile, Sort alphabetically
  batman-adv: iv_ogm_iface_enable, direct return values
  batman-adv: iv_ogm_aggr_packet, bool return value
  batman-adv: iv_ogm_send_to_if, declare char* as const
  batman-adv: iv_ogm_can_aggregate, code readability
  batman-adv: iv_ogm_orig_update, remove unnecessary brackets
  batman-adv: iv_ogm_aggregate_new, simplify error handling
  batman-adv: iv_ogm_queue_add, Simplify expressions
  batman-adv: iv_ogm_orig_update, style, add missin brackets
  batman-adv: iv_ogm, Fix dup_status comment
  batman-adv: iv_ogm, fix coding style
  batman-adv: iv_ogm, fix comment function name
  batman-adv: types, Fix comment on bcast_own
  batman-adv: main, Convert is_my_mac() to bool
  batman-adv: main, batadv_compare_eth return bool
  batman-adv: Remove unnecessary ret variable
  batman-adv: Remove unnecessary ret variable in algo_register
  batman-adv: packet.h, add some missing includes
  batman-adv: types.h, add missing include

 Makefile.kbuild         |   5 +-
 bat_iv_ogm.c            | 239 +++++++++---------
 bitarray.c              |   1 +
 bridge_loop_avoidance.c |   1 +
 debugfs.c               |   9 +-
 debugfs.h               |  39 +++
 distributed-arp-table.c |   2 +
 gateway_client.c        |   1 +
 gateway_common.c        |   2 +
 hard-interface.c        |   1 +
 icmp_socket.c           |   1 +
 log.h                   |  82 +++++++
 main.c                  | 626 +++---------------------------------------------
 main.h                  | 101 +-------
 multicast.c             |   1 +
 network-coding.c        |   2 +
 originator.c            |   1 +
 packet.h                |   5 +
 routing.c               |   2 +
 send.c                  |   1 +
 sysfs.c                 |   1 +
 translation-table.c     |   2 +
 tvlv.c                  | 592 +++++++++++++++++++++++++++++++++++++++++++++
 tvlv.h                  |  62 +++++
 types.h                 |   8 +-
 25 files changed, 967 insertions(+), 820 deletions(-)
 create mode 100644 log.h
 create mode 100644 tvlv.c
 create mode 100644 tvlv.h

-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 01/26] batman-adv: debugfs, avoid compiling for !DEBUG_FS
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-01-11 10:32   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 02/26] batman-adv: Separate logging header Markus Pargmann
                   ` (25 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

Normally the debugfs framework will return error pointer with -ENODEV
for function calls when DEBUG_FS is not set.

batman does not notice this error code and continues trying to create
debugfs files and executes more code. We can avoid this code execution
by disabling compiling debugfs.c when DEBUG_FS is not set.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 Makefile.kbuild |  2 +-
 debugfs.c       |  8 --------
 debugfs.h       | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/Makefile.kbuild b/Makefile.kbuild
index eb7d8c0388e4..96fa99b3a409 100644
--- a/Makefile.kbuild
+++ b/Makefile.kbuild
@@ -20,7 +20,7 @@ obj-$(CONFIG_BATMAN_ADV) += batman-adv.o
 batman-adv-y += bat_iv_ogm.o
 batman-adv-y += bitarray.o
 batman-adv-$(CONFIG_BATMAN_ADV_BLA) += bridge_loop_avoidance.o
-batman-adv-y += debugfs.o
+batman-adv-$(CONFIG_DEBUG_FS) += debugfs.o
 batman-adv-$(CONFIG_BATMAN_ADV_DAT) += distributed-arp-table.o
 batman-adv-y += fragmentation.o
 batman-adv-y += gateway_client.o
diff --git a/debugfs.c b/debugfs.c
index d9b9a8eb17fb..026a25ce364c 100644
--- a/debugfs.c
+++ b/debugfs.c
@@ -483,11 +483,7 @@ rem_attr:
 	debugfs_remove_recursive(hard_iface->debug_dir);
 	hard_iface->debug_dir = NULL;
 out:
-#ifdef CONFIG_DEBUG_FS
 	return -ENOMEM;
-#else
-	return 0;
-#endif /* CONFIG_DEBUG_FS */
 }
 
 /**
@@ -542,11 +538,7 @@ rem_attr:
 	debugfs_remove_recursive(bat_priv->debug_dir);
 	bat_priv->debug_dir = NULL;
 out:
-#ifdef CONFIG_DEBUG_FS
 	return -ENOMEM;
-#else
-	return 0;
-#endif /* CONFIG_DEBUG_FS */
 }
 
 void batadv_debugfs_del_meshif(struct net_device *dev)
diff --git a/debugfs.h b/debugfs.h
index 37c4d6ddd04d..5db336a6ef57 100644
--- a/debugfs.h
+++ b/debugfs.h
@@ -20,6 +20,8 @@
 
 #define BATADV_DEBUGFS_SUBDIR "batman_adv"
 
+#if IS_ENABLED(CONFIG_DEBUG_FS)
+
 void batadv_debugfs_init(void);
 void batadv_debugfs_destroy(void);
 int batadv_debugfs_add_meshif(struct net_device *dev);
@@ -27,4 +29,36 @@ void batadv_debugfs_del_meshif(struct net_device *dev);
 int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface);
 void batadv_debugfs_del_hardif(struct batadv_hard_iface *hard_iface);
 
+#else
+
+static inline void batadv_debugfs_init(void)
+{
+}
+
+static inline void batadv_debugfs_destroy(void)
+{
+}
+
+static inline int batadv_debugfs_add_meshif(struct net_device *dev)
+{
+	return 0;
+}
+
+static inline void batadv_debugfs_del_meshif(struct net_device *dev)
+{
+}
+
+static inline int batadv_debugfs_add_hardif(
+		struct batadv_hard_iface *hard_iface)
+{
+	return 0;
+}
+
+static inline void batadv_debugfs_del_hardif(
+		struct batadv_hard_iface *hard_iface)
+{
+}
+
+#endif
+
 #endif /* _NET_BATMAN_ADV_DEBUGFS_H_ */
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 02/26] batman-adv: Separate logging header
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 01/26] batman-adv: debugfs, avoid compiling for !DEBUG_FS Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2014-12-28  2:33   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 03/26] batman-adv: iv_ogm, Reduce code duplication Markus Pargmann
                   ` (24 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

This patch creates a separate header file for logging related functions
and definitions.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 bat_iv_ogm.c            |  1 +
 bitarray.c              |  1 +
 bridge_loop_avoidance.c |  1 +
 debugfs.c               |  1 +
 debugfs.h               |  5 +++
 distributed-arp-table.c |  1 +
 gateway_client.c        |  1 +
 gateway_common.c        |  1 +
 hard-interface.c        |  1 +
 icmp_socket.c           |  1 +
 log.h                   | 82 +++++++++++++++++++++++++++++++++++++++++++++++++
 main.c                  |  1 +
 main.h                  | 62 -------------------------------------
 network-coding.c        |  1 +
 originator.c            |  1 +
 routing.c               |  1 +
 send.c                  |  1 +
 sysfs.c                 |  1 +
 translation-table.c     |  1 +
 19 files changed, 103 insertions(+), 62 deletions(-)
 create mode 100644 log.h

diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 00e00e09b000..2d064a71613f 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -25,6 +25,7 @@
 #include "send.h"
 #include "bat_algo.h"
 #include "network-coding.h"
+#include "log.h"
 
 /**
  * enum batadv_dup_status - duplicate status
diff --git a/bitarray.c b/bitarray.c
index e3da07a64026..3fbaf540d56d 100644
--- a/bitarray.c
+++ b/bitarray.c
@@ -17,6 +17,7 @@
 
 #include "main.h"
 #include "bitarray.h"
+#include "log.h"
 
 #include <linux/bitops.h>
 
diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c
index 4fc6cab7ed46..d93288377f80 100644
--- a/bridge_loop_avoidance.c
+++ b/bridge_loop_avoidance.c
@@ -22,6 +22,7 @@
 #include "bridge_loop_avoidance.h"
 #include "translation-table.h"
 #include "send.h"
+#include "log.h"
 
 #include <linux/etherdevice.h>
 #include <linux/crc16.h>
diff --git a/debugfs.c b/debugfs.c
index 026a25ce364c..3f21e855a13d 100644
--- a/debugfs.c
+++ b/debugfs.c
@@ -30,6 +30,7 @@
 #include "bridge_loop_avoidance.h"
 #include "distributed-arp-table.h"
 #include "network-coding.h"
+#include "log.h"
 
 static struct dentry *batadv_debugfs;
 
diff --git a/debugfs.h b/debugfs.h
index 5db336a6ef57..1fda474defe8 100644
--- a/debugfs.h
+++ b/debugfs.h
@@ -20,6 +20,11 @@
 
 #define BATADV_DEBUGFS_SUBDIR "batman_adv"
 
+#ifdef CONFIG_BATMAN_ADV_DEBUG
+int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...)
+__printf(2, 3);
+#endif
+
 #if IS_ENABLED(CONFIG_DEBUG_FS)
 
 void batadv_debugfs_init(void);
diff --git a/distributed-arp-table.c b/distributed-arp-table.c
index aad022dd15df..e2f0677a5a01 100644
--- a/distributed-arp-table.c
+++ b/distributed-arp-table.c
@@ -28,6 +28,7 @@
 #include "send.h"
 #include "types.h"
 #include "translation-table.h"
+#include "log.h"
 
 static void batadv_dat_purge(struct work_struct *work);
 
diff --git a/gateway_client.c b/gateway_client.c
index 27649e85f3f6..d4aa578c78f9 100644
--- a/gateway_client.c
+++ b/gateway_client.c
@@ -23,6 +23,7 @@
 #include "originator.h"
 #include "translation-table.h"
 #include "routing.h"
+#include "log.h"
 #include <linux/ip.h>
 #include <linux/ipv6.h>
 #include <linux/udp.h>
diff --git a/gateway_common.c b/gateway_common.c
index 6f5e621f220a..cbef7fd97971 100644
--- a/gateway_common.c
+++ b/gateway_common.c
@@ -18,6 +18,7 @@
 #include "main.h"
 #include "gateway_common.h"
 #include "gateway_client.h"
+#include "log.h"
 
 /**
  * batadv_parse_gw_bandwidth - parse supplied string buffer to extract download
diff --git a/hard-interface.c b/hard-interface.c
index fbda6b54baff..5138f11babb4 100644
--- a/hard-interface.c
+++ b/hard-interface.c
@@ -28,6 +28,7 @@
 #include "hash.h"
 #include "bridge_loop_avoidance.h"
 #include "gateway_client.h"
+#include "log.h"
 
 #include <linux/if_arp.h>
 #include <linux/if_ether.h>
diff --git a/icmp_socket.c b/icmp_socket.c
index 161ef8f17d2e..520b2f4739d1 100644
--- a/icmp_socket.c
+++ b/icmp_socket.c
@@ -23,6 +23,7 @@
 #include "hash.h"
 #include "originator.h"
 #include "hard-interface.h"
+#include "log.h"
 
 static struct batadv_socket_client *batadv_socket_client_hash[256];
 
diff --git a/log.h b/log.h
new file mode 100644
index 000000000000..05b0b9d15883
--- /dev/null
+++ b/log.h
@@ -0,0 +1,82 @@
+/* Copyright (C) 2007-2014 B.A.T.M.A.N. contributors:
+ *
+ * Marek Lindner, Simon Wunderlich
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _NET_BATMAN_ADV_LOG_H_
+#define _NET_BATMAN_ADV_LOG_H_
+
+#include "debugfs.h"
+
+/**
+ * enum batadv_dbg_level - available log levels
+ * @BATADV_DBG_BATMAN: OGM and TQ computations related messages
+ * @BATADV_DBG_ROUTES: route added / changed / deleted
+ * @BATADV_DBG_TT: translation table messages
+ * @BATADV_DBG_BLA: bridge loop avoidance messages
+ * @BATADV_DBG_DAT: ARP snooping and DAT related messages
+ * @BATADV_DBG_NC: network coding related messages
+ * @BATADV_DBG_ALL: the union of all the above log levels
+ */
+enum batadv_dbg_level {
+	BATADV_DBG_BATMAN = BIT(0),
+	BATADV_DBG_ROUTES = BIT(1),
+	BATADV_DBG_TT	  = BIT(2),
+	BATADV_DBG_BLA    = BIT(3),
+	BATADV_DBG_DAT    = BIT(4),
+	BATADV_DBG_NC	  = BIT(5),
+	BATADV_DBG_ALL    = 63,
+};
+
+#ifdef CONFIG_BATMAN_ADV_DEBUG
+/* possibly ratelimited debug output */
+#define _batadv_dbg(type, bat_priv, ratelimited, fmt, arg...)	\
+	do {							\
+		if (atomic_read(&bat_priv->log_level) & type && \
+		    (!ratelimited || net_ratelimit()))		\
+			batadv_debug_log(bat_priv, fmt, ## arg);\
+	}							\
+	while (0)
+#else /* !CONFIG_BATMAN_ADV_DEBUG */
+__printf(4, 5)
+static inline void _batadv_dbg(int type __always_unused,
+			       struct batadv_priv *bat_priv __always_unused,
+			       int ratelimited __always_unused,
+			       const char *fmt __always_unused, ...)
+{
+}
+#endif
+
+#define batadv_dbg(type, bat_priv, arg...) \
+	_batadv_dbg(type, bat_priv, 0, ## arg)
+#define batadv_dbg_ratelimited(type, bat_priv, arg...) \
+	_batadv_dbg(type, bat_priv, 1, ## arg)
+
+#define batadv_info(net_dev, fmt, arg...)				\
+	do {								\
+		struct net_device *_netdev = (net_dev);                 \
+		struct batadv_priv *_batpriv = netdev_priv(_netdev);    \
+		batadv_dbg(BATADV_DBG_ALL, _batpriv, fmt, ## arg);	\
+		pr_info("%s: " fmt, _netdev->name, ## arg);		\
+	} while (0)
+#define batadv_err(net_dev, fmt, arg...)				\
+	do {								\
+		struct net_device *_netdev = (net_dev);                 \
+		struct batadv_priv *_batpriv = netdev_priv(_netdev);    \
+		batadv_dbg(BATADV_DBG_ALL, _batpriv, fmt, ## arg);	\
+		pr_err("%s: " fmt, _netdev->name, ## arg);		\
+	} while (0)
+
+#endif  /* _NET_BATMAN_ADV_LOG_H_ */
diff --git a/main.c b/main.c
index 3bcd847a8f9f..a9e09e852c4b 100644
--- a/main.c
+++ b/main.c
@@ -40,6 +40,7 @@
 #include "bat_algo.h"
 #include "network-coding.h"
 #include "fragmentation.h"
+#include "log.h"
 
 /* List manipulations on hardif_list have to be rtnl_lock()'ed,
  * list traversals just rcu-locked
diff --git a/main.h b/main.h
index 52cb0072bfc8..1cd4ebdbe060 100644
--- a/main.h
+++ b/main.h
@@ -214,68 +214,6 @@ int batadv_algo_select(struct batadv_priv *bat_priv, char *name);
 int batadv_algo_seq_print_text(struct seq_file *seq, void *offset);
 __be32 batadv_skb_crc32(struct sk_buff *skb, u8 *payload_ptr);
 
-/**
- * enum batadv_dbg_level - available log levels
- * @BATADV_DBG_BATMAN: OGM and TQ computations related messages
- * @BATADV_DBG_ROUTES: route added / changed / deleted
- * @BATADV_DBG_TT: translation table messages
- * @BATADV_DBG_BLA: bridge loop avoidance messages
- * @BATADV_DBG_DAT: ARP snooping and DAT related messages
- * @BATADV_DBG_NC: network coding related messages
- * @BATADV_DBG_ALL: the union of all the above log levels
- */
-enum batadv_dbg_level {
-	BATADV_DBG_BATMAN = BIT(0),
-	BATADV_DBG_ROUTES = BIT(1),
-	BATADV_DBG_TT	  = BIT(2),
-	BATADV_DBG_BLA    = BIT(3),
-	BATADV_DBG_DAT    = BIT(4),
-	BATADV_DBG_NC	  = BIT(5),
-	BATADV_DBG_ALL    = 63,
-};
-
-#ifdef CONFIG_BATMAN_ADV_DEBUG
-int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...)
-__printf(2, 3);
-
-/* possibly ratelimited debug output */
-#define _batadv_dbg(type, bat_priv, ratelimited, fmt, arg...)	\
-	do {							\
-		if (atomic_read(&bat_priv->log_level) & type && \
-		    (!ratelimited || net_ratelimit()))		\
-			batadv_debug_log(bat_priv, fmt, ## arg);\
-	}							\
-	while (0)
-#else /* !CONFIG_BATMAN_ADV_DEBUG */
-__printf(4, 5)
-static inline void _batadv_dbg(int type __always_unused,
-			       struct batadv_priv *bat_priv __always_unused,
-			       int ratelimited __always_unused,
-			       const char *fmt __always_unused, ...)
-{
-}
-#endif
-
-#define batadv_dbg(type, bat_priv, arg...) \
-	_batadv_dbg(type, bat_priv, 0, ## arg)
-#define batadv_dbg_ratelimited(type, bat_priv, arg...) \
-	_batadv_dbg(type, bat_priv, 1, ## arg)
-
-#define batadv_info(net_dev, fmt, arg...)				\
-	do {								\
-		struct net_device *_netdev = (net_dev);                 \
-		struct batadv_priv *_batpriv = netdev_priv(_netdev);    \
-		batadv_dbg(BATADV_DBG_ALL, _batpriv, fmt, ## arg);	\
-		pr_info("%s: " fmt, _netdev->name, ## arg);		\
-	} while (0)
-#define batadv_err(net_dev, fmt, arg...)				\
-	do {								\
-		struct net_device *_netdev = (net_dev);                 \
-		struct batadv_priv *_batpriv = netdev_priv(_netdev);    \
-		batadv_dbg(BATADV_DBG_ALL, _batpriv, fmt, ## arg);	\
-		pr_err("%s: " fmt, _netdev->name, ## arg);		\
-	} while (0)
-
 /* returns 1 if they are the same ethernet addr
  *
  * note: can't use ether_addr_equal() as it requires aligned memory
diff --git a/network-coding.c b/network-coding.c
index 127cc4d7380a..93190fc25f76 100644
--- a/network-coding.c
+++ b/network-coding.c
@@ -24,6 +24,7 @@
 #include "originator.h"
 #include "hard-interface.h"
 #include "routing.h"
+#include "log.h"
 
 static struct lock_class_key batadv_nc_coding_hash_lock_class_key;
 static struct lock_class_key batadv_nc_decoding_hash_lock_class_key;
diff --git a/originator.c b/originator.c
index 6c2cb2da9865..3386ae54ede5 100644
--- a/originator.c
+++ b/originator.c
@@ -28,6 +28,7 @@
 #include "network-coding.h"
 #include "fragmentation.h"
 #include "multicast.h"
+#include "log.h"
 
 /* hash class keys */
 static struct lock_class_key batadv_orig_hash_lock_class_key;
diff --git a/routing.c b/routing.c
index 139d2f65728e..07205591b05f 100644
--- a/routing.c
+++ b/routing.c
@@ -27,6 +27,7 @@
 #include "distributed-arp-table.h"
 #include "network-coding.h"
 #include "fragmentation.h"
+#include "log.h"
 
 #include <linux/if_vlan.h>
 
diff --git a/send.c b/send.c
index d27161e1088d..043ee89596be 100644
--- a/send.c
+++ b/send.c
@@ -28,6 +28,7 @@
 #include "network-coding.h"
 #include "fragmentation.h"
 #include "multicast.h"
+#include "log.h"
 
 static void batadv_send_outstanding_bcast_packet(struct work_struct *work);
 
diff --git a/sysfs.c b/sysfs.c
index a63c3ebfbf53..6e39cdef1e1f 100644
--- a/sysfs.c
+++ b/sysfs.c
@@ -25,6 +25,7 @@
 #include "soft-interface.h"
 #include "gateway_common.h"
 #include "gateway_client.h"
+#include "log.h"
 
 static struct net_device *batadv_kobj_to_netdev(struct kobject *obj)
 {
diff --git a/translation-table.c b/translation-table.c
index 84e6f01b734f..be75a2ac543e 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -25,6 +25,7 @@
 #include "routing.h"
 #include "bridge_loop_avoidance.h"
 #include "multicast.h"
+#include "log.h"
 
 #include <linux/crc32c.h>
 
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 03/26] batman-adv: iv_ogm, Reduce code duplication
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 01/26] batman-adv: debugfs, avoid compiling for !DEBUG_FS Markus Pargmann
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 02/26] batman-adv: Separate logging header Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-01-11 10:38   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 04/26] batman-adv: iv_ogm, divide and round for ring buffer avg Markus Pargmann
                   ` (23 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

The difference between tq1 and tq2 are calculated the same way in two
separate functions.

This patch moves the common code to a seperate function
'batadv_iv_ogm_neigh_diff' which handles everything necessary. The other
two functions can then handle errors and use the difference directly.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 bat_iv_ogm.c | 80 +++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 41 insertions(+), 39 deletions(-)

diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 2d064a71613f..1458ecfa66b8 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -1858,36 +1858,27 @@ next:
 		seq_puts(seq, "No batman nodes in range ...\n");
 }
 
-/**
- * batadv_iv_ogm_neigh_cmp - compare the metrics of two neighbors
- * @neigh1: the first neighbor object of the comparison
- * @if_outgoing1: outgoing interface for the first neighbor
- * @neigh2: the second neighbor object of the comparison
- * @if_outgoing2: outgoing interface for the second neighbor
- *
- * Returns a value less, equal to or greater than 0 if the metric via neigh1 is
- * lower, the same as or higher than the metric via neigh2
- */
-static int batadv_iv_ogm_neigh_cmp(struct batadv_neigh_node *neigh1,
-				   struct batadv_hard_iface *if_outgoing1,
-				   struct batadv_neigh_node *neigh2,
-				   struct batadv_hard_iface *if_outgoing2)
+static int batadv_iv_ogm_neigh_diff(struct batadv_neigh_node *neigh1,
+				    struct batadv_hard_iface *if_outgoing1,
+				    struct batadv_neigh_node *neigh2,
+				    struct batadv_hard_iface *if_outgoing2,
+				    int *diff)
 {
 	struct batadv_neigh_ifinfo *neigh1_ifinfo, *neigh2_ifinfo;
 	uint8_t tq1, tq2;
-	int diff;
+	int ret;
 
 	neigh1_ifinfo = batadv_neigh_ifinfo_get(neigh1, if_outgoing1);
 	neigh2_ifinfo = batadv_neigh_ifinfo_get(neigh2, if_outgoing2);
 
 	if (!neigh1_ifinfo || !neigh2_ifinfo) {
-		diff = 0;
+		ret = -EINVAL;
 		goto out;
 	}
 
 	tq1 = neigh1_ifinfo->bat_iv.tq_avg;
 	tq2 = neigh2_ifinfo->bat_iv.tq_avg;
-	diff = tq1 - tq2;
+	*diff = (int)tq1 - (int)tq2;
 
 out:
 	if (neigh1_ifinfo)
@@ -1895,6 +1886,32 @@ out:
 	if (neigh2_ifinfo)
 		batadv_neigh_ifinfo_free_ref(neigh2_ifinfo);
 
+	return ret;
+}
+
+/**
+ * batadv_iv_ogm_neigh_cmp - compare the metrics of two neighbors
+ * @neigh1: the first neighbor object of the comparison
+ * @if_outgoing1: outgoing interface for the first neighbor
+ * @neigh2: the second neighbor object of the comparison
+ * @if_outgoing2: outgoing interface for the second neighbor
+ *
+ * Returns a value less, equal to or greater than 0 if the metric via neigh1 is
+ * lower, the same as or higher than the metric via neigh2
+ */
+static int batadv_iv_ogm_neigh_cmp(struct batadv_neigh_node *neigh1,
+				   struct batadv_hard_iface *if_outgoing1,
+				   struct batadv_neigh_node *neigh2,
+				   struct batadv_hard_iface *if_outgoing2)
+{
+	int ret;
+	int diff;
+
+	ret = batadv_iv_ogm_neigh_diff(neigh1, if_outgoing1, neigh2,
+				       if_outgoing2, &diff);
+	if (ret)
+		return 0;
+
 	return diff;
 }
 
@@ -1915,30 +1932,15 @@ batadv_iv_ogm_neigh_is_eob(struct batadv_neigh_node *neigh1,
 			   struct batadv_neigh_node *neigh2,
 			   struct batadv_hard_iface *if_outgoing2)
 {
-	struct batadv_neigh_ifinfo *neigh1_ifinfo, *neigh2_ifinfo;
-	uint8_t tq1, tq2;
-	bool ret;
-
-	neigh1_ifinfo = batadv_neigh_ifinfo_get(neigh1, if_outgoing1);
-	neigh2_ifinfo = batadv_neigh_ifinfo_get(neigh2, if_outgoing2);
-
-	/* we can't say that the metric is better */
-	if (!neigh1_ifinfo || !neigh2_ifinfo) {
-		ret = false;
-		goto out;
-	}
-
-	tq1 = neigh1_ifinfo->bat_iv.tq_avg;
-	tq2 = neigh2_ifinfo->bat_iv.tq_avg;
-	ret = (tq1 - tq2) > -BATADV_TQ_SIMILARITY_THRESHOLD;
+	int ret;
+	int diff;
 
-out:
-	if (neigh1_ifinfo)
-		batadv_neigh_ifinfo_free_ref(neigh1_ifinfo);
-	if (neigh2_ifinfo)
-		batadv_neigh_ifinfo_free_ref(neigh2_ifinfo);
+	ret = batadv_iv_ogm_neigh_diff(neigh1, if_outgoing1, neigh2,
+				       if_outgoing2, &diff);
+	if (ret)
+		return false;
 
-	return ret;
+	return diff > -BATADV_TQ_SIMILARITY_THRESHOLD;
 }
 
 static struct batadv_algo_ops batadv_batman_iv __read_mostly = {
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 04/26] batman-adv: iv_ogm, divide and round for ring buffer avg
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (2 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 03/26] batman-adv: iv_ogm, Reduce code duplication Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-01-11 12:32   ` Marek Lindner
  2015-01-12 15:56   ` Simon Wunderlich
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 05/26] batman-adv: init, Add some error handling Markus Pargmann
                   ` (22 subsequent siblings)
  26 siblings, 2 replies; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

Instead of the normal division which looses precision, use a division
with rounding.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 bat_iv_ogm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 1458ecfa66b8..10eada270015 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -82,7 +82,7 @@ static uint8_t batadv_ring_buffer_avg(const uint8_t lq_recv[])
 	if (count == 0)
 		return 0;
 
-	return (uint8_t)(sum / count);
+	return (uint8_t)DIV_ROUND_CLOSEST(sum, count);
 }
 
 /**
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 05/26] batman-adv: init, Add some error handling
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (3 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 04/26] batman-adv: iv_ogm, divide and round for ring buffer avg Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-01-11 12:38   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 06/26] batman-adv: tvlv realloc, move error handling into if block Markus Pargmann
                   ` (21 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

This patch adds some error handling for the main init function. It
checks the return values of all the function calls that provide return
values.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 main.c | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/main.c b/main.c
index a9e09e852c4b..65021ea567e8 100644
--- a/main.c
+++ b/main.c
@@ -59,29 +59,47 @@ static void batadv_recv_handler_init(void);
 
 static int __init batadv_init(void)
 {
+	int ret;
+
 	INIT_LIST_HEAD(&batadv_hardif_list);
 	INIT_HLIST_HEAD(&batadv_algo_list);
 
 	batadv_recv_handler_init();
 
-	batadv_iv_init();
-	batadv_nc_init();
+	ret = batadv_iv_init();
+	if (ret)
+		return ret;
+
+	ret = batadv_nc_init();
+	if (ret)
+		return ret;
 
 	batadv_event_workqueue = create_singlethread_workqueue("bat_events");
-
 	if (!batadv_event_workqueue)
 		return -ENOMEM;
 
 	batadv_socket_init();
 	batadv_debugfs_init();
 
-	register_netdevice_notifier(&batadv_hard_if_notifier);
-	rtnl_link_register(&batadv_link_ops);
+	ret = register_netdevice_notifier(&batadv_hard_if_notifier);
+	if (ret)
+		goto err_netdev_notifier;
+
+	ret = rtnl_link_register(&batadv_link_ops);
+	if (ret)
+		goto err_link_register;
 
 	pr_info("B.A.T.M.A.N. advanced %s (compatibility version %i) loaded\n",
 		BATADV_SOURCE_VERSION, BATADV_COMPAT_VERSION);
 
 	return 0;
+
+err_link_register:
+	unregister_netdevice_notifier(&batadv_hard_if_notifier);
+err_netdev_notifier:
+	batadv_debugfs_destroy();
+
+	return ret;
 }
 
 static void __exit batadv_exit(void)
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 06/26] batman-adv: tvlv realloc, move error handling into if block
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (4 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 05/26] batman-adv: init, Add some error handling Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-01-11 12:40   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 07/26] batman-adv: split tvlv into a seperate file Markus Pargmann
                   ` (20 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

Instead of hiding the normal function flow inside an if block, we should
just put the error handling into the if block.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 main.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/main.c b/main.c
index 65021ea567e8..00a1107109e8 100644
--- a/main.c
+++ b/main.c
@@ -838,15 +838,15 @@ static bool batadv_tvlv_realloc_packet_buff(unsigned char **packet_buff,
 	new_buff = kmalloc(min_packet_len + additional_packet_len, GFP_ATOMIC);
 
 	/* keep old buffer if kmalloc should fail */
-	if (new_buff) {
-		memcpy(new_buff, *packet_buff, min_packet_len);
-		kfree(*packet_buff);
-		*packet_buff = new_buff;
-		*packet_buff_len = min_packet_len + additional_packet_len;
-		return true;
-	}
+	if (!new_buff)
+		return false;
+
+	memcpy(new_buff, *packet_buff, min_packet_len);
+	kfree(*packet_buff);
+	*packet_buff = new_buff;
+	*packet_buff_len = min_packet_len + additional_packet_len;
 
-	return false;
+	return true;
 }
 
 /**
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 07/26] batman-adv: split tvlv into a seperate file
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (5 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 06/26] batman-adv: tvlv realloc, move error handling into if block Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 08/26] batman-adv: Makefile, Sort alphabetically Markus Pargmann
                   ` (19 subsequent siblings)
  26 siblings, 0 replies; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

The main file includes a lot of helper functions. tvlv is a seperate set
of functions so we should split them into a seperate file. There is no
need for tvlv to be implemented in main.c.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 Makefile.kbuild         |   1 +
 bat_iv_ogm.c            |   1 +
 distributed-arp-table.c |   1 +
 gateway_common.c        |   1 +
 main.c                  | 568 ----------------------------------------------
 main.h                  |  35 ---
 multicast.c             |   1 +
 network-coding.c        |   1 +
 routing.c               |   1 +
 translation-table.c     |   1 +
 tvlv.c                  | 592 ++++++++++++++++++++++++++++++++++++++++++++++++
 tvlv.h                  |  62 +++++
 12 files changed, 662 insertions(+), 603 deletions(-)
 create mode 100644 tvlv.c
 create mode 100644 tvlv.h

diff --git a/Makefile.kbuild b/Makefile.kbuild
index 96fa99b3a409..a8c34baddd63 100644
--- a/Makefile.kbuild
+++ b/Makefile.kbuild
@@ -36,4 +36,5 @@ batman-adv-y += send.o
 batman-adv-y += soft-interface.o
 batman-adv-y += sysfs.o
 batman-adv-y += translation-table.o
+batman-adv-y += tvlv.o
 batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += multicast.o
diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 10eada270015..20295c5e5121 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -23,6 +23,7 @@
 #include "gateway_client.h"
 #include "hard-interface.h"
 #include "send.h"
+#include "tvlv.h"
 #include "bat_algo.h"
 #include "network-coding.h"
 #include "log.h"
diff --git a/distributed-arp-table.c b/distributed-arp-table.c
index e2f0677a5a01..e3deff63d393 100644
--- a/distributed-arp-table.c
+++ b/distributed-arp-table.c
@@ -29,6 +29,7 @@
 #include "types.h"
 #include "translation-table.h"
 #include "log.h"
+#include "tvlv.h"
 
 static void batadv_dat_purge(struct work_struct *work);
 
diff --git a/gateway_common.c b/gateway_common.c
index cbef7fd97971..c2dfcc03ddfa 100644
--- a/gateway_common.c
+++ b/gateway_common.c
@@ -19,6 +19,7 @@
 #include "gateway_common.h"
 #include "gateway_client.h"
 #include "log.h"
+#include "tvlv.h"
 
 /**
  * batadv_parse_gw_bandwidth - parse supplied string buffer to extract download
diff --git a/main.c b/main.c
index 00a1107109e8..cff31bb9bb14 100644
--- a/main.c
+++ b/main.c
@@ -623,574 +623,6 @@ __be32 batadv_skb_crc32(struct sk_buff *skb, u8 *payload_ptr)
 }
 
 /**
- * batadv_tvlv_handler_free_ref - decrement the tvlv handler refcounter and
- *  possibly free it
- * @tvlv_handler: the tvlv handler to free
- */
-static void
-batadv_tvlv_handler_free_ref(struct batadv_tvlv_handler *tvlv_handler)
-{
-	if (atomic_dec_and_test(&tvlv_handler->refcount))
-		kfree_rcu(tvlv_handler, rcu);
-}
-
-/**
- * batadv_tvlv_handler_get - retrieve tvlv handler from the tvlv handler list
- *  based on the provided type and version (both need to match)
- * @bat_priv: the bat priv with all the soft interface information
- * @type: tvlv handler type to look for
- * @version: tvlv handler version to look for
- *
- * Returns tvlv handler if found or NULL otherwise.
- */
-static struct batadv_tvlv_handler
-*batadv_tvlv_handler_get(struct batadv_priv *bat_priv,
-			 uint8_t type, uint8_t version)
-{
-	struct batadv_tvlv_handler *tvlv_handler_tmp, *tvlv_handler = NULL;
-
-	rcu_read_lock();
-	hlist_for_each_entry_rcu(tvlv_handler_tmp,
-				 &bat_priv->tvlv.handler_list, list) {
-		if (tvlv_handler_tmp->type != type)
-			continue;
-
-		if (tvlv_handler_tmp->version != version)
-			continue;
-
-		if (!atomic_inc_not_zero(&tvlv_handler_tmp->refcount))
-			continue;
-
-		tvlv_handler = tvlv_handler_tmp;
-		break;
-	}
-	rcu_read_unlock();
-
-	return tvlv_handler;
-}
-
-/**
- * batadv_tvlv_container_free_ref - decrement the tvlv container refcounter and
- *  possibly free it
- * @tvlv: the tvlv container to free
- */
-static void batadv_tvlv_container_free_ref(struct batadv_tvlv_container *tvlv)
-{
-	if (atomic_dec_and_test(&tvlv->refcount))
-		kfree(tvlv);
-}
-
-/**
- * batadv_tvlv_container_get - retrieve tvlv container from the tvlv container
- *  list based on the provided type and version (both need to match)
- * @bat_priv: the bat priv with all the soft interface information
- * @type: tvlv container type to look for
- * @version: tvlv container version to look for
- *
- * Has to be called with the appropriate locks being acquired
- * (tvlv.container_list_lock).
- *
- * Returns tvlv container if found or NULL otherwise.
- */
-static struct batadv_tvlv_container
-*batadv_tvlv_container_get(struct batadv_priv *bat_priv,
-			   uint8_t type, uint8_t version)
-{
-	struct batadv_tvlv_container *tvlv_tmp, *tvlv = NULL;
-
-	hlist_for_each_entry(tvlv_tmp, &bat_priv->tvlv.container_list, list) {
-		if (tvlv_tmp->tvlv_hdr.type != type)
-			continue;
-
-		if (tvlv_tmp->tvlv_hdr.version != version)
-			continue;
-
-		if (!atomic_inc_not_zero(&tvlv_tmp->refcount))
-			continue;
-
-		tvlv = tvlv_tmp;
-		break;
-	}
-
-	return tvlv;
-}
-
-/**
- * batadv_tvlv_container_list_size - calculate the size of the tvlv container
- *  list entries
- * @bat_priv: the bat priv with all the soft interface information
- *
- * Has to be called with the appropriate locks being acquired
- * (tvlv.container_list_lock).
- *
- * Returns size of all currently registered tvlv containers in bytes.
- */
-static uint16_t batadv_tvlv_container_list_size(struct batadv_priv *bat_priv)
-{
-	struct batadv_tvlv_container *tvlv;
-	uint16_t tvlv_len = 0;
-
-	hlist_for_each_entry(tvlv, &bat_priv->tvlv.container_list, list) {
-		tvlv_len += sizeof(struct batadv_tvlv_hdr);
-		tvlv_len += ntohs(tvlv->tvlv_hdr.len);
-	}
-
-	return tvlv_len;
-}
-
-/**
- * batadv_tvlv_container_remove - remove tvlv container from the tvlv container
- *  list
- * @tvlv: the to be removed tvlv container
- *
- * Has to be called with the appropriate locks being acquired
- * (tvlv.container_list_lock).
- */
-static void batadv_tvlv_container_remove(struct batadv_tvlv_container *tvlv)
-{
-	if (!tvlv)
-		return;
-
-	hlist_del(&tvlv->list);
-
-	/* first call to decrement the counter, second call to free */
-	batadv_tvlv_container_free_ref(tvlv);
-	batadv_tvlv_container_free_ref(tvlv);
-}
-
-/**
- * batadv_tvlv_container_unregister - unregister tvlv container based on the
- *  provided type and version (both need to match)
- * @bat_priv: the bat priv with all the soft interface information
- * @type: tvlv container type to unregister
- * @version: tvlv container type to unregister
- */
-void batadv_tvlv_container_unregister(struct batadv_priv *bat_priv,
-				      uint8_t type, uint8_t version)
-{
-	struct batadv_tvlv_container *tvlv;
-
-	spin_lock_bh(&bat_priv->tvlv.container_list_lock);
-	tvlv = batadv_tvlv_container_get(bat_priv, type, version);
-	batadv_tvlv_container_remove(tvlv);
-	spin_unlock_bh(&bat_priv->tvlv.container_list_lock);
-}
-
-/**
- * batadv_tvlv_container_register - register tvlv type, version and content
- *  to be propagated with each (primary interface) OGM
- * @bat_priv: the bat priv with all the soft interface information
- * @type: tvlv container type
- * @version: tvlv container version
- * @tvlv_value: tvlv container content
- * @tvlv_value_len: tvlv container content length
- *
- * If a container of the same type and version was already registered the new
- * content is going to replace the old one.
- */
-void batadv_tvlv_container_register(struct batadv_priv *bat_priv,
-				    uint8_t type, uint8_t version,
-				    void *tvlv_value, uint16_t tvlv_value_len)
-{
-	struct batadv_tvlv_container *tvlv_old, *tvlv_new;
-
-	if (!tvlv_value)
-		tvlv_value_len = 0;
-
-	tvlv_new = kzalloc(sizeof(*tvlv_new) + tvlv_value_len, GFP_ATOMIC);
-	if (!tvlv_new)
-		return;
-
-	tvlv_new->tvlv_hdr.version = version;
-	tvlv_new->tvlv_hdr.type = type;
-	tvlv_new->tvlv_hdr.len = htons(tvlv_value_len);
-
-	memcpy(tvlv_new + 1, tvlv_value, ntohs(tvlv_new->tvlv_hdr.len));
-	INIT_HLIST_NODE(&tvlv_new->list);
-	atomic_set(&tvlv_new->refcount, 1);
-
-	spin_lock_bh(&bat_priv->tvlv.container_list_lock);
-	tvlv_old = batadv_tvlv_container_get(bat_priv, type, version);
-	batadv_tvlv_container_remove(tvlv_old);
-	hlist_add_head(&tvlv_new->list, &bat_priv->tvlv.container_list);
-	spin_unlock_bh(&bat_priv->tvlv.container_list_lock);
-}
-
-/**
- * batadv_tvlv_realloc_packet_buff - reallocate packet buffer to accomodate
- *  requested packet size
- * @packet_buff: packet buffer
- * @packet_buff_len: packet buffer size
- * @min_packet_len: requested packet minimum size
- * @additional_packet_len: requested additional packet size on top of minimum
- *  size
- *
- * Returns true of the packet buffer could be changed to the requested size,
- * false otherwise.
- */
-static bool batadv_tvlv_realloc_packet_buff(unsigned char **packet_buff,
-					    int *packet_buff_len,
-					    int min_packet_len,
-					    int additional_packet_len)
-{
-	unsigned char *new_buff;
-
-	new_buff = kmalloc(min_packet_len + additional_packet_len, GFP_ATOMIC);
-
-	/* keep old buffer if kmalloc should fail */
-	if (!new_buff)
-		return false;
-
-	memcpy(new_buff, *packet_buff, min_packet_len);
-	kfree(*packet_buff);
-	*packet_buff = new_buff;
-	*packet_buff_len = min_packet_len + additional_packet_len;
-
-	return true;
-}
-
-/**
- * batadv_tvlv_container_ogm_append - append tvlv container content to given
- *  OGM packet buffer
- * @bat_priv: the bat priv with all the soft interface information
- * @packet_buff: ogm packet buffer
- * @packet_buff_len: ogm packet buffer size including ogm header and tvlv
- *  content
- * @packet_min_len: ogm header size to be preserved for the OGM itself
- *
- * The ogm packet might be enlarged or shrunk depending on the current size
- * and the size of the to-be-appended tvlv containers.
- *
- * Returns size of all appended tvlv containers in bytes.
- */
-uint16_t batadv_tvlv_container_ogm_append(struct batadv_priv *bat_priv,
-					  unsigned char **packet_buff,
-					  int *packet_buff_len,
-					  int packet_min_len)
-{
-	struct batadv_tvlv_container *tvlv;
-	struct batadv_tvlv_hdr *tvlv_hdr;
-	uint16_t tvlv_value_len;
-	void *tvlv_value;
-	bool ret;
-
-	spin_lock_bh(&bat_priv->tvlv.container_list_lock);
-	tvlv_value_len = batadv_tvlv_container_list_size(bat_priv);
-
-	ret = batadv_tvlv_realloc_packet_buff(packet_buff, packet_buff_len,
-					      packet_min_len, tvlv_value_len);
-
-	if (!ret)
-		goto end;
-
-	if (!tvlv_value_len)
-		goto end;
-
-	tvlv_value = (*packet_buff) + packet_min_len;
-
-	hlist_for_each_entry(tvlv, &bat_priv->tvlv.container_list, list) {
-		tvlv_hdr = tvlv_value;
-		tvlv_hdr->type = tvlv->tvlv_hdr.type;
-		tvlv_hdr->version = tvlv->tvlv_hdr.version;
-		tvlv_hdr->len = tvlv->tvlv_hdr.len;
-		tvlv_value = tvlv_hdr + 1;
-		memcpy(tvlv_value, tvlv + 1, ntohs(tvlv->tvlv_hdr.len));
-		tvlv_value = (uint8_t *)tvlv_value + ntohs(tvlv->tvlv_hdr.len);
-	}
-
-end:
-	spin_unlock_bh(&bat_priv->tvlv.container_list_lock);
-	return tvlv_value_len;
-}
-
-/**
- * batadv_tvlv_call_handler - parse the given tvlv buffer to call the
- *  appropriate handlers
- * @bat_priv: the bat priv with all the soft interface information
- * @tvlv_handler: tvlv callback function handling the tvlv content
- * @ogm_source: flag indicating wether the tvlv is an ogm or a unicast packet
- * @orig_node: orig node emitting the ogm packet
- * @src: source mac address of the unicast packet
- * @dst: destination mac address of the unicast packet
- * @tvlv_value: tvlv content
- * @tvlv_value_len: tvlv content length
- *
- * Returns success if handler was not found or the return value of the handler
- * callback.
- */
-static int batadv_tvlv_call_handler(struct batadv_priv *bat_priv,
-				    struct batadv_tvlv_handler *tvlv_handler,
-				    bool ogm_source,
-				    struct batadv_orig_node *orig_node,
-				    uint8_t *src, uint8_t *dst,
-				    void *tvlv_value, uint16_t tvlv_value_len)
-{
-	if (!tvlv_handler)
-		return NET_RX_SUCCESS;
-
-	if (ogm_source) {
-		if (!tvlv_handler->ogm_handler)
-			return NET_RX_SUCCESS;
-
-		if (!orig_node)
-			return NET_RX_SUCCESS;
-
-		tvlv_handler->ogm_handler(bat_priv, orig_node,
-					  BATADV_NO_FLAGS,
-					  tvlv_value, tvlv_value_len);
-		tvlv_handler->flags |= BATADV_TVLV_HANDLER_OGM_CALLED;
-	} else {
-		if (!src)
-			return NET_RX_SUCCESS;
-
-		if (!dst)
-			return NET_RX_SUCCESS;
-
-		if (!tvlv_handler->unicast_handler)
-			return NET_RX_SUCCESS;
-
-		return tvlv_handler->unicast_handler(bat_priv, src,
-						     dst, tvlv_value,
-						     tvlv_value_len);
-	}
-
-	return NET_RX_SUCCESS;
-}
-
-/**
- * batadv_tvlv_containers_process - parse the given tvlv buffer to call the
- *  appropriate handlers
- * @bat_priv: the bat priv with all the soft interface information
- * @ogm_source: flag indicating wether the tvlv is an ogm or a unicast packet
- * @orig_node: orig node emitting the ogm packet
- * @src: source mac address of the unicast packet
- * @dst: destination mac address of the unicast packet
- * @tvlv_value: tvlv content
- * @tvlv_value_len: tvlv content length
- *
- * Returns success when processing an OGM or the return value of all called
- * handler callbacks.
- */
-int batadv_tvlv_containers_process(struct batadv_priv *bat_priv,
-				   bool ogm_source,
-				   struct batadv_orig_node *orig_node,
-				   uint8_t *src, uint8_t *dst,
-				   void *tvlv_value, uint16_t tvlv_value_len)
-{
-	struct batadv_tvlv_handler *tvlv_handler;
-	struct batadv_tvlv_hdr *tvlv_hdr;
-	uint16_t tvlv_value_cont_len;
-	uint8_t cifnotfound = BATADV_TVLV_HANDLER_OGM_CIFNOTFND;
-	int ret = NET_RX_SUCCESS;
-
-	while (tvlv_value_len >= sizeof(*tvlv_hdr)) {
-		tvlv_hdr = tvlv_value;
-		tvlv_value_cont_len = ntohs(tvlv_hdr->len);
-		tvlv_value = tvlv_hdr + 1;
-		tvlv_value_len -= sizeof(*tvlv_hdr);
-
-		if (tvlv_value_cont_len > tvlv_value_len)
-			break;
-
-		tvlv_handler = batadv_tvlv_handler_get(bat_priv,
-						       tvlv_hdr->type,
-						       tvlv_hdr->version);
-
-		ret |= batadv_tvlv_call_handler(bat_priv, tvlv_handler,
-						ogm_source, orig_node,
-						src, dst, tvlv_value,
-						tvlv_value_cont_len);
-		if (tvlv_handler)
-			batadv_tvlv_handler_free_ref(tvlv_handler);
-		tvlv_value = (uint8_t *)tvlv_value + tvlv_value_cont_len;
-		tvlv_value_len -= tvlv_value_cont_len;
-	}
-
-	if (!ogm_source)
-		return ret;
-
-	rcu_read_lock();
-	hlist_for_each_entry_rcu(tvlv_handler,
-				 &bat_priv->tvlv.handler_list, list) {
-		if ((tvlv_handler->flags & BATADV_TVLV_HANDLER_OGM_CIFNOTFND) &&
-		    !(tvlv_handler->flags & BATADV_TVLV_HANDLER_OGM_CALLED))
-			tvlv_handler->ogm_handler(bat_priv, orig_node,
-						  cifnotfound, NULL, 0);
-
-		tvlv_handler->flags &= ~BATADV_TVLV_HANDLER_OGM_CALLED;
-	}
-	rcu_read_unlock();
-
-	return NET_RX_SUCCESS;
-}
-
-/**
- * batadv_tvlv_ogm_receive - process an incoming ogm and call the appropriate
- *  handlers
- * @bat_priv: the bat priv with all the soft interface information
- * @batadv_ogm_packet: ogm packet containing the tvlv containers
- * @orig_node: orig node emitting the ogm packet
- */
-void batadv_tvlv_ogm_receive(struct batadv_priv *bat_priv,
-			     struct batadv_ogm_packet *batadv_ogm_packet,
-			     struct batadv_orig_node *orig_node)
-{
-	void *tvlv_value;
-	uint16_t tvlv_value_len;
-
-	if (!batadv_ogm_packet)
-		return;
-
-	tvlv_value_len = ntohs(batadv_ogm_packet->tvlv_len);
-	if (!tvlv_value_len)
-		return;
-
-	tvlv_value = batadv_ogm_packet + 1;
-
-	batadv_tvlv_containers_process(bat_priv, true, orig_node, NULL, NULL,
-				       tvlv_value, tvlv_value_len);
-}
-
-/**
- * batadv_tvlv_handler_register - register tvlv handler based on the provided
- *  type and version (both need to match) for ogm tvlv payload and/or unicast
- *  payload
- * @bat_priv: the bat priv with all the soft interface information
- * @optr: ogm tvlv handler callback function. This function receives the orig
- *  node, flags and the tvlv content as argument to process.
- * @uptr: unicast tvlv handler callback function. This function receives the
- *  source & destination of the unicast packet as well as the tvlv content
- *  to process.
- * @type: tvlv handler type to be registered
- * @version: tvlv handler version to be registered
- * @flags: flags to enable or disable TVLV API behavior
- */
-void batadv_tvlv_handler_register(struct batadv_priv *bat_priv,
-				  void (*optr)(struct batadv_priv *bat_priv,
-					       struct batadv_orig_node *orig,
-					       uint8_t flags,
-					       void *tvlv_value,
-					       uint16_t tvlv_value_len),
-				  int (*uptr)(struct batadv_priv *bat_priv,
-					      uint8_t *src, uint8_t *dst,
-					      void *tvlv_value,
-					      uint16_t tvlv_value_len),
-				  uint8_t type, uint8_t version, uint8_t flags)
-{
-	struct batadv_tvlv_handler *tvlv_handler;
-
-	tvlv_handler = batadv_tvlv_handler_get(bat_priv, type, version);
-	if (tvlv_handler) {
-		batadv_tvlv_handler_free_ref(tvlv_handler);
-		return;
-	}
-
-	tvlv_handler = kzalloc(sizeof(*tvlv_handler), GFP_ATOMIC);
-	if (!tvlv_handler)
-		return;
-
-	tvlv_handler->ogm_handler = optr;
-	tvlv_handler->unicast_handler = uptr;
-	tvlv_handler->type = type;
-	tvlv_handler->version = version;
-	tvlv_handler->flags = flags;
-	atomic_set(&tvlv_handler->refcount, 1);
-	INIT_HLIST_NODE(&tvlv_handler->list);
-
-	spin_lock_bh(&bat_priv->tvlv.handler_list_lock);
-	hlist_add_head_rcu(&tvlv_handler->list, &bat_priv->tvlv.handler_list);
-	spin_unlock_bh(&bat_priv->tvlv.handler_list_lock);
-}
-
-/**
- * batadv_tvlv_handler_unregister - unregister tvlv handler based on the
- *  provided type and version (both need to match)
- * @bat_priv: the bat priv with all the soft interface information
- * @type: tvlv handler type to be unregistered
- * @version: tvlv handler version to be unregistered
- */
-void batadv_tvlv_handler_unregister(struct batadv_priv *bat_priv,
-				    uint8_t type, uint8_t version)
-{
-	struct batadv_tvlv_handler *tvlv_handler;
-
-	tvlv_handler = batadv_tvlv_handler_get(bat_priv, type, version);
-	if (!tvlv_handler)
-		return;
-
-	batadv_tvlv_handler_free_ref(tvlv_handler);
-	spin_lock_bh(&bat_priv->tvlv.handler_list_lock);
-	hlist_del_rcu(&tvlv_handler->list);
-	spin_unlock_bh(&bat_priv->tvlv.handler_list_lock);
-	batadv_tvlv_handler_free_ref(tvlv_handler);
-}
-
-/**
- * batadv_tvlv_unicast_send - send a unicast packet with tvlv payload to the
- *  specified host
- * @bat_priv: the bat priv with all the soft interface information
- * @src: source mac address of the unicast packet
- * @dst: destination mac address of the unicast packet
- * @type: tvlv type
- * @version: tvlv version
- * @tvlv_value: tvlv content
- * @tvlv_value_len: tvlv content length
- */
-void batadv_tvlv_unicast_send(struct batadv_priv *bat_priv, uint8_t *src,
-			      uint8_t *dst, uint8_t type, uint8_t version,
-			      void *tvlv_value, uint16_t tvlv_value_len)
-{
-	struct batadv_unicast_tvlv_packet *unicast_tvlv_packet;
-	struct batadv_tvlv_hdr *tvlv_hdr;
-	struct batadv_orig_node *orig_node;
-	struct sk_buff *skb = NULL;
-	unsigned char *tvlv_buff;
-	unsigned int tvlv_len;
-	ssize_t hdr_len = sizeof(*unicast_tvlv_packet);
-	bool ret = false;
-
-	orig_node = batadv_orig_hash_find(bat_priv, dst);
-	if (!orig_node)
-		goto out;
-
-	tvlv_len = sizeof(*tvlv_hdr) + tvlv_value_len;
-
-	skb = netdev_alloc_skb_ip_align(NULL, ETH_HLEN + hdr_len + tvlv_len);
-	if (!skb)
-		goto out;
-
-	skb->priority = TC_PRIO_CONTROL;
-	skb_reserve(skb, ETH_HLEN);
-	tvlv_buff = skb_put(skb, sizeof(*unicast_tvlv_packet) + tvlv_len);
-	unicast_tvlv_packet = (struct batadv_unicast_tvlv_packet *)tvlv_buff;
-	unicast_tvlv_packet->packet_type = BATADV_UNICAST_TVLV;
-	unicast_tvlv_packet->version = BATADV_COMPAT_VERSION;
-	unicast_tvlv_packet->ttl = BATADV_TTL;
-	unicast_tvlv_packet->reserved = 0;
-	unicast_tvlv_packet->tvlv_len = htons(tvlv_len);
-	unicast_tvlv_packet->align = 0;
-	ether_addr_copy(unicast_tvlv_packet->src, src);
-	ether_addr_copy(unicast_tvlv_packet->dst, dst);
-
-	tvlv_buff = (unsigned char *)(unicast_tvlv_packet + 1);
-	tvlv_hdr = (struct batadv_tvlv_hdr *)tvlv_buff;
-	tvlv_hdr->version = version;
-	tvlv_hdr->type = type;
-	tvlv_hdr->len = htons(tvlv_value_len);
-	tvlv_buff += sizeof(*tvlv_hdr);
-	memcpy(tvlv_buff, tvlv_value, tvlv_value_len);
-
-	if (batadv_send_skb_to_orig(skb, orig_node, NULL) != NET_XMIT_DROP)
-		ret = true;
-
-out:
-	if (skb && !ret)
-		kfree_skb(skb);
-	if (orig_node)
-		batadv_orig_node_free_ref(orig_node);
-}
-
-/**
  * batadv_get_vid - extract the VLAN identifier from skb if any
  * @skb: the buffer containing the packet
  * @header_len: length of the batman header preceding the ethernet header
diff --git a/main.h b/main.h
index 1cd4ebdbe060..013de2f7ee11 100644
--- a/main.h
+++ b/main.h
@@ -287,41 +287,6 @@ static inline uint64_t batadv_sum_counter(struct batadv_priv *bat_priv,
  * The macro is inspired by the similar macro TCP_SKB_CB() in tcp.h.
  */
 #define BATADV_SKB_CB(__skb)       ((struct batadv_skb_cb *)&((__skb)->cb[0]))
-
-void batadv_tvlv_container_register(struct batadv_priv *bat_priv,
-				    uint8_t type, uint8_t version,
-				    void *tvlv_value, uint16_t tvlv_value_len);
-uint16_t batadv_tvlv_container_ogm_append(struct batadv_priv *bat_priv,
-					  unsigned char **packet_buff,
-					  int *packet_buff_len,
-					  int packet_min_len);
-void batadv_tvlv_ogm_receive(struct batadv_priv *bat_priv,
-			     struct batadv_ogm_packet *batadv_ogm_packet,
-			     struct batadv_orig_node *orig_node);
-void batadv_tvlv_container_unregister(struct batadv_priv *bat_priv,
-				      uint8_t type, uint8_t version);
-
-void batadv_tvlv_handler_register(struct batadv_priv *bat_priv,
-				  void (*optr)(struct batadv_priv *bat_priv,
-					       struct batadv_orig_node *orig,
-					       uint8_t flags,
-					       void *tvlv_value,
-					       uint16_t tvlv_value_len),
-				  int (*uptr)(struct batadv_priv *bat_priv,
-					      uint8_t *src, uint8_t *dst,
-					      void *tvlv_value,
-					      uint16_t tvlv_value_len),
-				  uint8_t type, uint8_t version, uint8_t flags);
-void batadv_tvlv_handler_unregister(struct batadv_priv *bat_priv,
-				    uint8_t type, uint8_t version);
-int batadv_tvlv_containers_process(struct batadv_priv *bat_priv,
-				   bool ogm_source,
-				   struct batadv_orig_node *orig_node,
-				   uint8_t *src, uint8_t *dst,
-				   void *tvlv_buff, uint16_t tvlv_buff_len);
-void batadv_tvlv_unicast_send(struct batadv_priv *bat_priv, uint8_t *src,
-			      uint8_t *dst, uint8_t type, uint8_t version,
-			      void *tvlv_value, uint16_t tvlv_value_len);
 unsigned short batadv_get_vid(struct sk_buff *skb, size_t header_len);
 bool batadv_vlan_ap_isola_get(struct batadv_priv *bat_priv, unsigned short vid);
 
diff --git a/multicast.c b/multicast.c
index b24e4bb64fb5..abc410b7e705 100644
--- a/multicast.c
+++ b/multicast.c
@@ -20,6 +20,7 @@
 #include "originator.h"
 #include "hard-interface.h"
 #include "translation-table.h"
+#include "tvlv.h"
 
 /**
  * batadv_mcast_mla_softif_get - get softif multicast listeners
diff --git a/network-coding.c b/network-coding.c
index 93190fc25f76..68b1f9c880cd 100644
--- a/network-coding.c
+++ b/network-coding.c
@@ -25,6 +25,7 @@
 #include "hard-interface.h"
 #include "routing.h"
 #include "log.h"
+#include "tvlv.h"
 
 static struct lock_class_key batadv_nc_coding_hash_lock_class_key;
 static struct lock_class_key batadv_nc_decoding_hash_lock_class_key;
diff --git a/routing.c b/routing.c
index 07205591b05f..99b31499941b 100644
--- a/routing.c
+++ b/routing.c
@@ -28,6 +28,7 @@
 #include "network-coding.h"
 #include "fragmentation.h"
 #include "log.h"
+#include "tvlv.h"
 
 #include <linux/if_vlan.h>
 
diff --git a/translation-table.c b/translation-table.c
index be75a2ac543e..2d0bad466b68 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -26,6 +26,7 @@
 #include "bridge_loop_avoidance.h"
 #include "multicast.h"
 #include "log.h"
+#include "tvlv.h"
 
 #include <linux/crc32c.h>
 
diff --git a/tvlv.c b/tvlv.c
new file mode 100644
index 000000000000..43f9d9456f42
--- /dev/null
+++ b/tvlv.c
@@ -0,0 +1,592 @@
+/* Copyright (C) 2007-2014 B.A.T.M.A.N. contributors:
+ *
+ * Marek Lindner, Simon Wunderlich
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/netdevice.h>
+
+#include "main.h"
+#include "tvlv.h"
+#include "types.h"
+#include "originator.h"
+#include "send.h"
+
+/**
+ * batadv_tvlv_handler_free_ref - decrement the tvlv handler refcounter and
+ *  possibly free it
+ * @tvlv_handler: the tvlv handler to free
+ */
+static void
+batadv_tvlv_handler_free_ref(struct batadv_tvlv_handler *tvlv_handler)
+{
+	if (atomic_dec_and_test(&tvlv_handler->refcount))
+		kfree_rcu(tvlv_handler, rcu);
+}
+
+/**
+ * batadv_tvlv_handler_get - retrieve tvlv handler from the tvlv handler list
+ *  based on the provided type and version (both need to match)
+ * @bat_priv: the bat priv with all the soft interface information
+ * @type: tvlv handler type to look for
+ * @version: tvlv handler version to look for
+ *
+ * Returns tvlv handler if found or NULL otherwise.
+ */
+static struct batadv_tvlv_handler
+*batadv_tvlv_handler_get(struct batadv_priv *bat_priv,
+			 uint8_t type, uint8_t version)
+{
+	struct batadv_tvlv_handler *tvlv_handler_tmp, *tvlv_handler = NULL;
+
+	rcu_read_lock();
+	hlist_for_each_entry_rcu(tvlv_handler_tmp,
+				 &bat_priv->tvlv.handler_list, list) {
+		if (tvlv_handler_tmp->type != type)
+			continue;
+
+		if (tvlv_handler_tmp->version != version)
+			continue;
+
+		if (!atomic_inc_not_zero(&tvlv_handler_tmp->refcount))
+			continue;
+
+		tvlv_handler = tvlv_handler_tmp;
+		break;
+	}
+	rcu_read_unlock();
+
+	return tvlv_handler;
+}
+
+/**
+ * batadv_tvlv_container_free_ref - decrement the tvlv container refcounter and
+ *  possibly free it
+ * @tvlv: the tvlv container to free
+ */
+static void batadv_tvlv_container_free_ref(struct batadv_tvlv_container *tvlv)
+{
+	if (atomic_dec_and_test(&tvlv->refcount))
+		kfree(tvlv);
+}
+
+/**
+ * batadv_tvlv_container_get - retrieve tvlv container from the tvlv container
+ *  list based on the provided type and version (both need to match)
+ * @bat_priv: the bat priv with all the soft interface information
+ * @type: tvlv container type to look for
+ * @version: tvlv container version to look for
+ *
+ * Has to be called with the appropriate locks being acquired
+ * (tvlv.container_list_lock).
+ *
+ * Returns tvlv container if found or NULL otherwise.
+ */
+static struct batadv_tvlv_container
+*batadv_tvlv_container_get(struct batadv_priv *bat_priv,
+			   uint8_t type, uint8_t version)
+{
+	struct batadv_tvlv_container *tvlv_tmp, *tvlv = NULL;
+
+	hlist_for_each_entry(tvlv_tmp, &bat_priv->tvlv.container_list, list) {
+		if (tvlv_tmp->tvlv_hdr.type != type)
+			continue;
+
+		if (tvlv_tmp->tvlv_hdr.version != version)
+			continue;
+
+		if (!atomic_inc_not_zero(&tvlv_tmp->refcount))
+			continue;
+
+		tvlv = tvlv_tmp;
+		break;
+	}
+
+	return tvlv;
+}
+
+/**
+ * batadv_tvlv_container_list_size - calculate the size of the tvlv container
+ *  list entries
+ * @bat_priv: the bat priv with all the soft interface information
+ *
+ * Has to be called with the appropriate locks being acquired
+ * (tvlv.container_list_lock).
+ *
+ * Returns size of all currently registered tvlv containers in bytes.
+ */
+static uint16_t batadv_tvlv_container_list_size(struct batadv_priv *bat_priv)
+{
+	struct batadv_tvlv_container *tvlv;
+	uint16_t tvlv_len = 0;
+
+	hlist_for_each_entry(tvlv, &bat_priv->tvlv.container_list, list) {
+		tvlv_len += sizeof(struct batadv_tvlv_hdr);
+		tvlv_len += ntohs(tvlv->tvlv_hdr.len);
+	}
+
+	return tvlv_len;
+}
+
+/**
+ * batadv_tvlv_container_remove - remove tvlv container from the tvlv container
+ *  list
+ * @tvlv: the to be removed tvlv container
+ *
+ * Has to be called with the appropriate locks being acquired
+ * (tvlv.container_list_lock).
+ */
+static void batadv_tvlv_container_remove(struct batadv_tvlv_container *tvlv)
+{
+	if (!tvlv)
+		return;
+
+	hlist_del(&tvlv->list);
+
+	/* first call to decrement the counter, second call to free */
+	batadv_tvlv_container_free_ref(tvlv);
+	batadv_tvlv_container_free_ref(tvlv);
+}
+
+/**
+ * batadv_tvlv_container_unregister - unregister tvlv container based on the
+ *  provided type and version (both need to match)
+ * @bat_priv: the bat priv with all the soft interface information
+ * @type: tvlv container type to unregister
+ * @version: tvlv container type to unregister
+ */
+void batadv_tvlv_container_unregister(struct batadv_priv *bat_priv,
+				      uint8_t type, uint8_t version)
+{
+	struct batadv_tvlv_container *tvlv;
+
+	spin_lock_bh(&bat_priv->tvlv.container_list_lock);
+	tvlv = batadv_tvlv_container_get(bat_priv, type, version);
+	batadv_tvlv_container_remove(tvlv);
+	spin_unlock_bh(&bat_priv->tvlv.container_list_lock);
+}
+
+/**
+ * batadv_tvlv_container_register - register tvlv type, version and content
+ *  to be propagated with each (primary interface) OGM
+ * @bat_priv: the bat priv with all the soft interface information
+ * @type: tvlv container type
+ * @version: tvlv container version
+ * @tvlv_value: tvlv container content
+ * @tvlv_value_len: tvlv container content length
+ *
+ * If a container of the same type and version was already registered the new
+ * content is going to replace the old one.
+ */
+void batadv_tvlv_container_register(struct batadv_priv *bat_priv,
+				    uint8_t type, uint8_t version,
+				    void *tvlv_value, uint16_t tvlv_value_len)
+{
+	struct batadv_tvlv_container *tvlv_old, *tvlv_new;
+
+	if (!tvlv_value)
+		tvlv_value_len = 0;
+
+	tvlv_new = kzalloc(sizeof(*tvlv_new) + tvlv_value_len, GFP_ATOMIC);
+	if (!tvlv_new)
+		return;
+
+	tvlv_new->tvlv_hdr.version = version;
+	tvlv_new->tvlv_hdr.type = type;
+	tvlv_new->tvlv_hdr.len = htons(tvlv_value_len);
+
+	memcpy(tvlv_new + 1, tvlv_value, ntohs(tvlv_new->tvlv_hdr.len));
+	INIT_HLIST_NODE(&tvlv_new->list);
+	atomic_set(&tvlv_new->refcount, 1);
+
+	spin_lock_bh(&bat_priv->tvlv.container_list_lock);
+	tvlv_old = batadv_tvlv_container_get(bat_priv, type, version);
+	batadv_tvlv_container_remove(tvlv_old);
+	hlist_add_head(&tvlv_new->list, &bat_priv->tvlv.container_list);
+	spin_unlock_bh(&bat_priv->tvlv.container_list_lock);
+}
+
+/**
+ * batadv_tvlv_realloc_packet_buff - reallocate packet buffer to accomodate
+ *  requested packet size
+ * @packet_buff: packet buffer
+ * @packet_buff_len: packet buffer size
+ * @min_packet_len: requested packet minimum size
+ * @additional_packet_len: requested additional packet size on top of minimum
+ *  size
+ *
+ * Returns true of the packet buffer could be changed to the requested size,
+ * false otherwise.
+ */
+static bool batadv_tvlv_realloc_packet_buff(unsigned char **packet_buff,
+					    int *packet_buff_len,
+					    int min_packet_len,
+					    int additional_packet_len)
+{
+	unsigned char *new_buff;
+
+	new_buff = kmalloc(min_packet_len + additional_packet_len, GFP_ATOMIC);
+
+	/* keep old buffer if kmalloc should fail */
+	if (!new_buff)
+		return false;
+
+	memcpy(new_buff, *packet_buff, min_packet_len);
+	kfree(*packet_buff);
+	*packet_buff = new_buff;
+	*packet_buff_len = min_packet_len + additional_packet_len;
+
+	return true;
+}
+
+/**
+ * batadv_tvlv_container_ogm_append - append tvlv container content to given
+ *  OGM packet buffer
+ * @bat_priv: the bat priv with all the soft interface information
+ * @packet_buff: ogm packet buffer
+ * @packet_buff_len: ogm packet buffer size including ogm header and tvlv
+ *  content
+ * @packet_min_len: ogm header size to be preserved for the OGM itself
+ *
+ * The ogm packet might be enlarged or shrunk depending on the current size
+ * and the size of the to-be-appended tvlv containers.
+ *
+ * Returns size of all appended tvlv containers in bytes.
+ */
+uint16_t batadv_tvlv_container_ogm_append(struct batadv_priv *bat_priv,
+					  unsigned char **packet_buff,
+					  int *packet_buff_len,
+					  int packet_min_len)
+{
+	struct batadv_tvlv_container *tvlv;
+	struct batadv_tvlv_hdr *tvlv_hdr;
+	uint16_t tvlv_value_len;
+	void *tvlv_value;
+	bool ret;
+
+	spin_lock_bh(&bat_priv->tvlv.container_list_lock);
+	tvlv_value_len = batadv_tvlv_container_list_size(bat_priv);
+
+	ret = batadv_tvlv_realloc_packet_buff(packet_buff, packet_buff_len,
+					      packet_min_len, tvlv_value_len);
+
+	if (!ret)
+		goto end;
+
+	if (!tvlv_value_len)
+		goto end;
+
+	tvlv_value = (*packet_buff) + packet_min_len;
+
+	hlist_for_each_entry(tvlv, &bat_priv->tvlv.container_list, list) {
+		tvlv_hdr = tvlv_value;
+		tvlv_hdr->type = tvlv->tvlv_hdr.type;
+		tvlv_hdr->version = tvlv->tvlv_hdr.version;
+		tvlv_hdr->len = tvlv->tvlv_hdr.len;
+		tvlv_value = tvlv_hdr + 1;
+		memcpy(tvlv_value, tvlv + 1, ntohs(tvlv->tvlv_hdr.len));
+		tvlv_value = (uint8_t *)tvlv_value + ntohs(tvlv->tvlv_hdr.len);
+	}
+
+end:
+	spin_unlock_bh(&bat_priv->tvlv.container_list_lock);
+	return tvlv_value_len;
+}
+
+/**
+ * batadv_tvlv_call_handler - parse the given tvlv buffer to call the
+ *  appropriate handlers
+ * @bat_priv: the bat priv with all the soft interface information
+ * @tvlv_handler: tvlv callback function handling the tvlv content
+ * @ogm_source: flag indicating wether the tvlv is an ogm or a unicast packet
+ * @orig_node: orig node emitting the ogm packet
+ * @src: source mac address of the unicast packet
+ * @dst: destination mac address of the unicast packet
+ * @tvlv_value: tvlv content
+ * @tvlv_value_len: tvlv content length
+ *
+ * Returns success if handler was not found or the return value of the handler
+ * callback.
+ */
+static int batadv_tvlv_call_handler(struct batadv_priv *bat_priv,
+				    struct batadv_tvlv_handler *tvlv_handler,
+				    bool ogm_source,
+				    struct batadv_orig_node *orig_node,
+				    uint8_t *src, uint8_t *dst,
+				    void *tvlv_value, uint16_t tvlv_value_len)
+{
+	if (!tvlv_handler)
+		return NET_RX_SUCCESS;
+
+	if (ogm_source) {
+		if (!tvlv_handler->ogm_handler)
+			return NET_RX_SUCCESS;
+
+		if (!orig_node)
+			return NET_RX_SUCCESS;
+
+		tvlv_handler->ogm_handler(bat_priv, orig_node,
+					  BATADV_NO_FLAGS,
+					  tvlv_value, tvlv_value_len);
+		tvlv_handler->flags |= BATADV_TVLV_HANDLER_OGM_CALLED;
+	} else {
+		if (!src)
+			return NET_RX_SUCCESS;
+
+		if (!dst)
+			return NET_RX_SUCCESS;
+
+		if (!tvlv_handler->unicast_handler)
+			return NET_RX_SUCCESS;
+
+		return tvlv_handler->unicast_handler(bat_priv, src,
+						     dst, tvlv_value,
+						     tvlv_value_len);
+	}
+
+	return NET_RX_SUCCESS;
+}
+
+/**
+ * batadv_tvlv_containers_process - parse the given tvlv buffer to call the
+ *  appropriate handlers
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ogm_source: flag indicating wether the tvlv is an ogm or a unicast packet
+ * @orig_node: orig node emitting the ogm packet
+ * @src: source mac address of the unicast packet
+ * @dst: destination mac address of the unicast packet
+ * @tvlv_value: tvlv content
+ * @tvlv_value_len: tvlv content length
+ *
+ * Returns success when processing an OGM or the return value of all called
+ * handler callbacks.
+ */
+int batadv_tvlv_containers_process(struct batadv_priv *bat_priv,
+				   bool ogm_source,
+				   struct batadv_orig_node *orig_node,
+				   uint8_t *src, uint8_t *dst,
+				   void *tvlv_value, uint16_t tvlv_value_len)
+{
+	struct batadv_tvlv_handler *tvlv_handler;
+	struct batadv_tvlv_hdr *tvlv_hdr;
+	uint16_t tvlv_value_cont_len;
+	uint8_t cifnotfound = BATADV_TVLV_HANDLER_OGM_CIFNOTFND;
+	int ret = NET_RX_SUCCESS;
+
+	while (tvlv_value_len >= sizeof(*tvlv_hdr)) {
+		tvlv_hdr = tvlv_value;
+		tvlv_value_cont_len = ntohs(tvlv_hdr->len);
+		tvlv_value = tvlv_hdr + 1;
+		tvlv_value_len -= sizeof(*tvlv_hdr);
+
+		if (tvlv_value_cont_len > tvlv_value_len)
+			break;
+
+		tvlv_handler = batadv_tvlv_handler_get(bat_priv,
+						       tvlv_hdr->type,
+						       tvlv_hdr->version);
+
+		ret |= batadv_tvlv_call_handler(bat_priv, tvlv_handler,
+						ogm_source, orig_node,
+						src, dst, tvlv_value,
+						tvlv_value_cont_len);
+		if (tvlv_handler)
+			batadv_tvlv_handler_free_ref(tvlv_handler);
+		tvlv_value = (uint8_t *)tvlv_value + tvlv_value_cont_len;
+		tvlv_value_len -= tvlv_value_cont_len;
+	}
+
+	if (!ogm_source)
+		return ret;
+
+	rcu_read_lock();
+	hlist_for_each_entry_rcu(tvlv_handler,
+				 &bat_priv->tvlv.handler_list, list) {
+		if ((tvlv_handler->flags & BATADV_TVLV_HANDLER_OGM_CIFNOTFND) &&
+		    !(tvlv_handler->flags & BATADV_TVLV_HANDLER_OGM_CALLED))
+			tvlv_handler->ogm_handler(bat_priv, orig_node,
+						  cifnotfound, NULL, 0);
+
+		tvlv_handler->flags &= ~BATADV_TVLV_HANDLER_OGM_CALLED;
+	}
+	rcu_read_unlock();
+
+	return NET_RX_SUCCESS;
+}
+
+/**
+ * batadv_tvlv_ogm_receive - process an incoming ogm and call the appropriate
+ *  handlers
+ * @bat_priv: the bat priv with all the soft interface information
+ * @batadv_ogm_packet: ogm packet containing the tvlv containers
+ * @orig_node: orig node emitting the ogm packet
+ */
+void batadv_tvlv_ogm_receive(struct batadv_priv *bat_priv,
+			     struct batadv_ogm_packet *batadv_ogm_packet,
+			     struct batadv_orig_node *orig_node)
+{
+	void *tvlv_value;
+	uint16_t tvlv_value_len;
+
+	if (!batadv_ogm_packet)
+		return;
+
+	tvlv_value_len = ntohs(batadv_ogm_packet->tvlv_len);
+	if (!tvlv_value_len)
+		return;
+
+	tvlv_value = batadv_ogm_packet + 1;
+
+	batadv_tvlv_containers_process(bat_priv, true, orig_node, NULL, NULL,
+				       tvlv_value, tvlv_value_len);
+}
+
+/**
+ * batadv_tvlv_handler_register - register tvlv handler based on the provided
+ *  type and version (both need to match) for ogm tvlv payload and/or unicast
+ *  payload
+ * @bat_priv: the bat priv with all the soft interface information
+ * @optr: ogm tvlv handler callback function. This function receives the orig
+ *  node, flags and the tvlv content as argument to process.
+ * @uptr: unicast tvlv handler callback function. This function receives the
+ *  source & destination of the unicast packet as well as the tvlv content
+ *  to process.
+ * @type: tvlv handler type to be registered
+ * @version: tvlv handler version to be registered
+ * @flags: flags to enable or disable TVLV API behavior
+ */
+void batadv_tvlv_handler_register(struct batadv_priv *bat_priv,
+				  void (*optr)(struct batadv_priv *bat_priv,
+					       struct batadv_orig_node *orig,
+					       uint8_t flags,
+					       void *tvlv_value,
+					       uint16_t tvlv_value_len),
+				  int (*uptr)(struct batadv_priv *bat_priv,
+					      uint8_t *src, uint8_t *dst,
+					      void *tvlv_value,
+					      uint16_t tvlv_value_len),
+				  uint8_t type, uint8_t version, uint8_t flags)
+{
+	struct batadv_tvlv_handler *tvlv_handler;
+
+	tvlv_handler = batadv_tvlv_handler_get(bat_priv, type, version);
+	if (tvlv_handler) {
+		batadv_tvlv_handler_free_ref(tvlv_handler);
+		return;
+	}
+
+	tvlv_handler = kzalloc(sizeof(*tvlv_handler), GFP_ATOMIC);
+	if (!tvlv_handler)
+		return;
+
+	tvlv_handler->ogm_handler = optr;
+	tvlv_handler->unicast_handler = uptr;
+	tvlv_handler->type = type;
+	tvlv_handler->version = version;
+	tvlv_handler->flags = flags;
+	atomic_set(&tvlv_handler->refcount, 1);
+	INIT_HLIST_NODE(&tvlv_handler->list);
+
+	spin_lock_bh(&bat_priv->tvlv.handler_list_lock);
+	hlist_add_head_rcu(&tvlv_handler->list, &bat_priv->tvlv.handler_list);
+	spin_unlock_bh(&bat_priv->tvlv.handler_list_lock);
+}
+
+/**
+ * batadv_tvlv_handler_unregister - unregister tvlv handler based on the
+ *  provided type and version (both need to match)
+ * @bat_priv: the bat priv with all the soft interface information
+ * @type: tvlv handler type to be unregistered
+ * @version: tvlv handler version to be unregistered
+ */
+void batadv_tvlv_handler_unregister(struct batadv_priv *bat_priv,
+				    uint8_t type, uint8_t version)
+{
+	struct batadv_tvlv_handler *tvlv_handler;
+
+	tvlv_handler = batadv_tvlv_handler_get(bat_priv, type, version);
+	if (!tvlv_handler)
+		return;
+
+	batadv_tvlv_handler_free_ref(tvlv_handler);
+	spin_lock_bh(&bat_priv->tvlv.handler_list_lock);
+	hlist_del_rcu(&tvlv_handler->list);
+	spin_unlock_bh(&bat_priv->tvlv.handler_list_lock);
+	batadv_tvlv_handler_free_ref(tvlv_handler);
+}
+
+/**
+ * batadv_tvlv_unicast_send - send a unicast packet with tvlv payload to the
+ *  specified host
+ * @bat_priv: the bat priv with all the soft interface information
+ * @src: source mac address of the unicast packet
+ * @dst: destination mac address of the unicast packet
+ * @type: tvlv type
+ * @version: tvlv version
+ * @tvlv_value: tvlv content
+ * @tvlv_value_len: tvlv content length
+ */
+void batadv_tvlv_unicast_send(struct batadv_priv *bat_priv, uint8_t *src,
+			      uint8_t *dst, uint8_t type, uint8_t version,
+			      void *tvlv_value, uint16_t tvlv_value_len)
+{
+	struct batadv_unicast_tvlv_packet *unicast_tvlv_packet;
+	struct batadv_tvlv_hdr *tvlv_hdr;
+	struct batadv_orig_node *orig_node;
+	struct sk_buff *skb = NULL;
+	unsigned char *tvlv_buff;
+	unsigned int tvlv_len;
+	ssize_t hdr_len = sizeof(*unicast_tvlv_packet);
+	bool ret = false;
+
+	orig_node = batadv_orig_hash_find(bat_priv, dst);
+	if (!orig_node)
+		goto out;
+
+	tvlv_len = sizeof(*tvlv_hdr) + tvlv_value_len;
+
+	skb = netdev_alloc_skb_ip_align(NULL, ETH_HLEN + hdr_len + tvlv_len);
+	if (!skb)
+		goto out;
+
+	skb->priority = TC_PRIO_CONTROL;
+	skb_reserve(skb, ETH_HLEN);
+	tvlv_buff = skb_put(skb, sizeof(*unicast_tvlv_packet) + tvlv_len);
+	unicast_tvlv_packet = (struct batadv_unicast_tvlv_packet *)tvlv_buff;
+	unicast_tvlv_packet->packet_type = BATADV_UNICAST_TVLV;
+	unicast_tvlv_packet->version = BATADV_COMPAT_VERSION;
+	unicast_tvlv_packet->ttl = BATADV_TTL;
+	unicast_tvlv_packet->reserved = 0;
+	unicast_tvlv_packet->tvlv_len = htons(tvlv_len);
+	unicast_tvlv_packet->align = 0;
+	ether_addr_copy(unicast_tvlv_packet->src, src);
+	ether_addr_copy(unicast_tvlv_packet->dst, dst);
+
+	tvlv_buff = (unsigned char *)(unicast_tvlv_packet + 1);
+	tvlv_hdr = (struct batadv_tvlv_hdr *)tvlv_buff;
+	tvlv_hdr->version = version;
+	tvlv_hdr->type = type;
+	tvlv_hdr->len = htons(tvlv_value_len);
+	tvlv_buff += sizeof(*tvlv_hdr);
+	memcpy(tvlv_buff, tvlv_value, tvlv_value_len);
+
+	if (batadv_send_skb_to_orig(skb, orig_node, NULL) != NET_XMIT_DROP)
+		ret = true;
+
+out:
+	if (skb && !ret)
+		kfree_skb(skb);
+	if (orig_node)
+		batadv_orig_node_free_ref(orig_node);
+}
diff --git a/tvlv.h b/tvlv.h
new file mode 100644
index 000000000000..26436c01bc78
--- /dev/null
+++ b/tvlv.h
@@ -0,0 +1,62 @@
+/* Copyright (C) 2007-2014 B.A.T.M.A.N. contributors:
+ *
+ * Marek Lindner, Simon Wunderlich
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _NET_BATMAN_ADV_TVLV_H_
+#define _NET_BATMAN_ADV_TVLV_H_
+
+#include <linux/types.h>
+
+struct batadv_priv;
+struct batadv_ogm_packet;
+struct batadv_orig_node;
+
+void batadv_tvlv_container_register(struct batadv_priv *bat_priv,
+				    uint8_t type, uint8_t version,
+				    void *tvlv_value, uint16_t tvlv_value_len);
+uint16_t batadv_tvlv_container_ogm_append(struct batadv_priv *bat_priv,
+					  unsigned char **packet_buff,
+					  int *packet_buff_len,
+					  int packet_min_len);
+void batadv_tvlv_ogm_receive(struct batadv_priv *bat_priv,
+			     struct batadv_ogm_packet *batadv_ogm_packet,
+			     struct batadv_orig_node *orig_node);
+void batadv_tvlv_container_unregister(struct batadv_priv *bat_priv,
+				      uint8_t type, uint8_t version);
+
+void batadv_tvlv_handler_register(struct batadv_priv *bat_priv,
+				  void (*optr)(struct batadv_priv *bat_priv,
+					       struct batadv_orig_node *orig,
+					       uint8_t flags,
+					       void *tvlv_value,
+					       uint16_t tvlv_value_len),
+				  int (*uptr)(struct batadv_priv *bat_priv,
+					      uint8_t *src, uint8_t *dst,
+					      void *tvlv_value,
+					      uint16_t tvlv_value_len),
+				  uint8_t type, uint8_t version, uint8_t flags);
+void batadv_tvlv_handler_unregister(struct batadv_priv *bat_priv,
+				    uint8_t type, uint8_t version);
+int batadv_tvlv_containers_process(struct batadv_priv *bat_priv,
+				   bool ogm_source,
+				   struct batadv_orig_node *orig_node,
+				   uint8_t *src, uint8_t *dst,
+				   void *tvlv_buff, uint16_t tvlv_buff_len);
+void batadv_tvlv_unicast_send(struct batadv_priv *bat_priv, uint8_t *src,
+			      uint8_t *dst, uint8_t type, uint8_t version,
+			      void *tvlv_value, uint16_t tvlv_value_len);
+
+#endif  /* _NET_BATMAN_ADV_TVLV_H_ */
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 08/26] batman-adv: Makefile, Sort alphabetically
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (6 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 07/26] batman-adv: split tvlv into a seperate file Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-01-11 12:44   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 09/26] batman-adv: iv_ogm_iface_enable, direct return values Markus Pargmann
                   ` (18 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

The whole Makefile is sorted, just the multicast rule is not at the
right position.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 Makefile.kbuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.kbuild b/Makefile.kbuild
index a8c34baddd63..6fb243c5b13c 100644
--- a/Makefile.kbuild
+++ b/Makefile.kbuild
@@ -29,6 +29,7 @@ batman-adv-y += hard-interface.o
 batman-adv-y += hash.o
 batman-adv-y += icmp_socket.o
 batman-adv-y += main.o
+batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += multicast.o
 batman-adv-$(CONFIG_BATMAN_ADV_NC) += network-coding.o
 batman-adv-y += originator.o
 batman-adv-y += routing.o
@@ -37,4 +38,3 @@ batman-adv-y += soft-interface.o
 batman-adv-y += sysfs.o
 batman-adv-y += translation-table.o
 batman-adv-y += tvlv.o
-batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += multicast.o
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 09/26] batman-adv: iv_ogm_iface_enable, direct return values
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (7 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 08/26] batman-adv: Makefile, Sort alphabetically Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-01-11 12:46   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 10/26] batman-adv: iv_ogm_aggr_packet, bool return value Markus Pargmann
                   ` (17 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

Directly return error values. No need to use a return variable.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 bat_iv_ogm.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 20295c5e5121..92eeed406663 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -310,7 +310,6 @@ static int batadv_iv_ogm_iface_enable(struct batadv_hard_iface *hard_iface)
 	struct batadv_ogm_packet *batadv_ogm_packet;
 	unsigned char *ogm_buff;
 	uint32_t random_seqno;
-	int res = -ENOMEM;
 
 	/* randomize initial seqno to avoid collision */
 	get_random_bytes(&random_seqno, sizeof(random_seqno));
@@ -319,7 +318,7 @@ static int batadv_iv_ogm_iface_enable(struct batadv_hard_iface *hard_iface)
 	hard_iface->bat_iv.ogm_buff_len = BATADV_OGM_HLEN;
 	ogm_buff = kmalloc(hard_iface->bat_iv.ogm_buff_len, GFP_ATOMIC);
 	if (!ogm_buff)
-		goto out;
+		return -ENOMEM;
 
 	hard_iface->bat_iv.ogm_buff = ogm_buff;
 
@@ -331,10 +330,7 @@ static int batadv_iv_ogm_iface_enable(struct batadv_hard_iface *hard_iface)
 	batadv_ogm_packet->reserved = 0;
 	batadv_ogm_packet->tq = BATADV_TQ_MAX_VALUE;
 
-	res = 0;
-
-out:
-	return res;
+	return 0;
 }
 
 static void batadv_iv_ogm_iface_disable(struct batadv_hard_iface *hard_iface)
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 10/26] batman-adv: iv_ogm_aggr_packet, bool return value
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (8 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 09/26] batman-adv: iv_ogm_iface_enable, direct return values Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-01-11 12:48   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 11/26] batman-adv: iv_ogm_send_to_if, declare char* as const Markus Pargmann
                   ` (16 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

This function returns bool values, so it should be defined to return
them instead of the whole int range.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 bat_iv_ogm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 92eeed406663..b267afab65bb 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -394,8 +394,8 @@ static uint8_t batadv_hop_penalty(uint8_t tq,
 }
 
 /* is there another aggregated packet here? */
-static int batadv_iv_ogm_aggr_packet(int buff_pos, int packet_len,
-				     __be16 tvlv_len)
+static bool batadv_iv_ogm_aggr_packet(int buff_pos, int packet_len,
+				      __be16 tvlv_len)
 {
 	int next_buff_pos = 0;
 
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 11/26] batman-adv: iv_ogm_send_to_if, declare char* as const
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (9 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 10/26] batman-adv: iv_ogm_aggr_packet, bool return value Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-02-18  9:14   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 12/26] batman-adv: iv_ogm_can_aggregate, code readability Markus Pargmann
                   ` (15 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

This string pointer is later assigned to a constant string, so it should
be defined constant at the beginning.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 bat_iv_ogm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index b267afab65bb..4801619c4da5 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -411,7 +411,7 @@ static void batadv_iv_ogm_send_to_if(struct batadv_forw_packet *forw_packet,
 				     struct batadv_hard_iface *hard_iface)
 {
 	struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
-	char *fwd_str;
+	const char *fwd_str;
 	uint8_t packet_num;
 	int16_t buff_pos;
 	struct batadv_ogm_packet *batadv_ogm_packet;
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 12/26] batman-adv: iv_ogm_can_aggregate, code readability
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (10 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 11/26] batman-adv: iv_ogm_send_to_if, declare char* as const Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-02-19 16:20   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 13/26] batman-adv: iv_ogm_orig_update, remove unnecessary brackets Markus Pargmann
                   ` (14 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

This patch tries to increase code readability by negating the first if
block and rearranging some of the other conditional blocks. This way we
save an indentation level, we also save some allocation that is not
necessary for one of the conditions.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 bat_iv_ogm.c | 98 +++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 50 insertions(+), 48 deletions(-)

diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 4801619c4da5..1f3880ac8376 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -546,58 +546,60 @@ batadv_iv_ogm_can_aggregate(const struct batadv_ogm_packet *new_bat_ogm_packet,
 	 * - the send time is within our MAX_AGGREGATION_MS time
 	 * - the resulting packet wont be bigger than
 	 *   MAX_AGGREGATION_BYTES
+	 * otherwise aggregation is not possible
 	 */
-	if (time_before(send_time, forw_packet->send_time) &&
-	    time_after_eq(aggregation_end_time, forw_packet->send_time) &&
-	    (aggregated_bytes <= BATADV_MAX_AGGREGATION_BYTES)) {
-		/* check aggregation compatibility
-		 * -> direct link packets are broadcasted on
-		 *    their interface only
-		 * -> aggregate packet if the current packet is
-		 *    a "global" packet as well as the base
-		 *    packet
-		 */
-		primary_if = batadv_primary_if_get_selected(bat_priv);
-		if (!primary_if)
-			goto out;
+	if (!time_before(send_time, forw_packet->send_time) ||
+	    !time_after_eq(aggregation_end_time, forw_packet->send_time) ||
+	    aggregated_bytes > BATADV_MAX_AGGREGATION_BYTES)
+		return false;
 
-		/* packet is not leaving on the same interface. */
-		if (forw_packet->if_outgoing != if_outgoing)
-			goto out;
+	/* packet is not leaving on the same interface. */
+	if (forw_packet->if_outgoing != if_outgoing)
+		return false;
 
-		/* packets without direct link flag and high TTL
-		 * are flooded through the net
-		 */
-		if ((!directlink) &&
-		    (!(batadv_ogm_packet->flags & BATADV_DIRECTLINK)) &&
-		    (batadv_ogm_packet->ttl != 1) &&
-
-		    /* own packets originating non-primary
-		     * interfaces leave only that interface
-		     */
-		    ((!forw_packet->own) ||
-		     (forw_packet->if_incoming == primary_if))) {
-			res = true;
-			goto out;
-		}
+	/* check aggregation compatibility
+	 * -> direct link packets are broadcasted on
+	 *    their interface only
+	 * -> aggregate packet if the current packet is
+	 *    a "global" packet as well as the base
+	 *    packet
+	 */
+	primary_if = batadv_primary_if_get_selected(bat_priv);
+	if (!primary_if)
+		return false;
 
-		/* if the incoming packet is sent via this one
-		 * interface only - we still can aggregate
-		 */
-		if ((directlink) &&
-		    (new_bat_ogm_packet->ttl == 1) &&
-		    (forw_packet->if_incoming == if_incoming) &&
-
-		    /* packets from direct neighbors or
-		     * own secondary interface packets
-		     * (= secondary interface packets in general)
-		     */
-		    (batadv_ogm_packet->flags & BATADV_DIRECTLINK ||
-		     (forw_packet->own &&
-		      forw_packet->if_incoming != primary_if))) {
-			res = true;
-			goto out;
-		}
+	/* packets without direct link flag and high TTL
+	 * are flooded through the net
+	 */
+	if (!directlink &&
+	    !(batadv_ogm_packet->flags & BATADV_DIRECTLINK) &&
+	    batadv_ogm_packet->ttl != 1 &&
+
+	    /* own packets originating non-primary
+	     * interfaces leave only that interface
+	     */
+	    (!forw_packet->own ||
+	     forw_packet->if_incoming == primary_if)) {
+		res = true;
+		goto out;
+	}
+
+	/* if the incoming packet is sent via this one
+	 * interface only - we still can aggregate
+	 */
+	if (directlink &&
+	    new_bat_ogm_packet->ttl == 1 &&
+	    forw_packet->if_incoming == if_incoming &&
+
+	    /* packets from direct neighbors or
+	     * own secondary interface packets
+	     * (= secondary interface packets in general)
+	     */
+	    (batadv_ogm_packet->flags & BATADV_DIRECTLINK ||
+	     (forw_packet->own &&
+	      forw_packet->if_incoming != primary_if))) {
+		res = true;
+		goto out;
 	}
 
 out:
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 13/26] batman-adv: iv_ogm_orig_update, remove unnecessary brackets
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (11 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 12/26] batman-adv: iv_ogm_can_aggregate, code readability Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-02-20 11:53   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 14/26] batman-adv: iv_ogm_aggregate_new, simplify error handling Markus Pargmann
                   ` (13 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

Remove these unnecessary brackets inside a condition.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 bat_iv_ogm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 1f3880ac8376..3f76f39b2a13 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -1081,7 +1081,7 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
 	 * won't consider it either
 	 */
 	if (router_ifinfo &&
-	    (neigh_ifinfo->bat_iv.tq_avg == router_ifinfo->bat_iv.tq_avg)) {
+	    neigh_ifinfo->bat_iv.tq_avg == router_ifinfo->bat_iv.tq_avg) {
 		orig_node_tmp = router->orig_node;
 		spin_lock_bh(&orig_node_tmp->bat_iv.ogm_cnt_lock);
 		if_num = router->if_incoming->if_num;
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 14/26] batman-adv: iv_ogm_aggregate_new, simplify error handling
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (12 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 13/26] batman-adv: iv_ogm_orig_update, remove unnecessary brackets Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-02-23 16:50   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 15/26] batman-adv: iv_ogm_queue_add, Simplify expressions Markus Pargmann
                   ` (12 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

It is just a bit easier to put the error handling at one place and let
multiple error paths use the same calls.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 bat_iv_ogm.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 3f76f39b2a13..12185f985c79 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -647,14 +647,11 @@ static void batadv_iv_ogm_aggregate_new(const unsigned char *packet_buff,
 	}
 
 	forw_packet_aggr = kmalloc(sizeof(*forw_packet_aggr), GFP_ATOMIC);
-	if (!forw_packet_aggr) {
-		if (!own_packet)
-			atomic_inc(&bat_priv->batman_queue_left);
-		goto out;
-	}
+	if (!forw_packet_aggr)
+		goto out_nomem;
 
-	if ((atomic_read(&bat_priv->aggregated_ogms)) &&
-	    (packet_len < BATADV_MAX_AGGREGATION_BYTES))
+	if (atomic_read(&bat_priv->aggregated_ogms) &&
+	    packet_len < BATADV_MAX_AGGREGATION_BYTES)
 		skb_size = BATADV_MAX_AGGREGATION_BYTES;
 	else
 		skb_size = packet_len;
@@ -662,12 +659,8 @@ static void batadv_iv_ogm_aggregate_new(const unsigned char *packet_buff,
 	skb_size += ETH_HLEN;
 
 	forw_packet_aggr->skb = netdev_alloc_skb_ip_align(NULL, skb_size);
-	if (!forw_packet_aggr->skb) {
-		if (!own_packet)
-			atomic_inc(&bat_priv->batman_queue_left);
-		kfree(forw_packet_aggr);
-		goto out;
-	}
+	if (!forw_packet_aggr->skb)
+		goto out_free_forw_packet;
 	forw_packet_aggr->skb->priority = TC_PRIO_CONTROL;
 	skb_reserve(forw_packet_aggr->skb, ETH_HLEN);
 
@@ -699,6 +692,11 @@ static void batadv_iv_ogm_aggregate_new(const unsigned char *packet_buff,
 			   send_time - jiffies);
 
 	return;
+out_free_forw_packet:
+	kfree(forw_packet_aggr);
+out_nomem:
+	if (!own_packet)
+		atomic_inc(&bat_priv->batman_queue_left);
 out:
 	batadv_hardif_free_ref(if_outgoing);
 out_free_incoming:
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 15/26] batman-adv: iv_ogm_queue_add, Simplify expressions
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (13 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 14/26] batman-adv: iv_ogm_aggregate_new, simplify error handling Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-02-24 21:20   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 16/26] batman-adv: iv_ogm_orig_update, style, add missin brackets Markus Pargmann
                   ` (11 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 bat_iv_ogm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 12185f985c79..8e29772ad8ae 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -750,13 +750,13 @@ static void batadv_iv_ogm_queue_add(struct batadv_priv *bat_priv,
 	unsigned long max_aggregation_jiffies;
 
 	batadv_ogm_packet = (struct batadv_ogm_packet *)packet_buff;
-	direct_link = batadv_ogm_packet->flags & BATADV_DIRECTLINK ? 1 : 0;
+	direct_link = !!(batadv_ogm_packet->flags & BATADV_DIRECTLINK);
 	max_aggregation_jiffies = msecs_to_jiffies(BATADV_MAX_AGGREGATION_MS);
 
 	/* find position for the packet in the forward queue */
 	spin_lock_bh(&bat_priv->forw_bat_list_lock);
 	/* own packets are not to be aggregated */
-	if ((atomic_read(&bat_priv->aggregated_ogms)) && (!own_packet)) {
+	if (atomic_read(&bat_priv->aggregated_ogms) && !own_packet) {
 		hlist_for_each_entry(forw_packet_pos,
 				     &bat_priv->forw_bat_list, list) {
 			if (batadv_iv_ogm_can_aggregate(batadv_ogm_packet,
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 16/26] batman-adv: iv_ogm_orig_update, style, add missin brackets
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (14 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 15/26] batman-adv: iv_ogm_queue_add, Simplify expressions Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-02-27 18:42   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 17/26] batman-adv: iv_ogm, Fix dup_status comment Markus Pargmann
                   ` (10 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

CodingStyle describes that either none or both branches of a conditional
have to have brackets.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 bat_iv_ogm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 8e29772ad8ae..32640e0997ed 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -1032,9 +1032,10 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
 		batadv_orig_node_free_ref(orig_tmp);
 		if (!neigh_node)
 			goto unlock;
-	} else
+	} else {
 		batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
 			   "Updating existing last-hop neighbor of originator\n");
+	}
 
 	rcu_read_unlock();
 	neigh_ifinfo = batadv_neigh_ifinfo_new(neigh_node, if_outgoing);
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 17/26] batman-adv: iv_ogm, Fix dup_status comment
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (15 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 16/26] batman-adv: iv_ogm_orig_update, style, add missin brackets Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-02-27 18:43   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 18/26] batman-adv: iv_ogm, fix coding style Markus Pargmann
                   ` (9 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 bat_iv_ogm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 32640e0997ed..ab48865130b0 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -30,7 +30,7 @@
 
 /**
  * enum batadv_dup_status - duplicate status
- * @BATADV_NO_DUP: the packet is a duplicate
+ * @BATADV_NO_DUP: the packet is no duplicate
  * @BATADV_ORIG_DUP: OGM is a duplicate in the originator (but not for the
  *  neighbor)
  * @BATADV_NEIGH_DUP: OGM is a duplicate for the neighbor
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 18/26] batman-adv: iv_ogm, fix coding style
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (16 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 17/26] batman-adv: iv_ogm, Fix dup_status comment Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-02-28 15:59   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 19/26] batman-adv: iv_ogm, fix comment function name Markus Pargmann
                   ` (8 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

The kernel coding style says, that there should not be multiple
assignments in one row.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 bat_iv_ogm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index ab48865130b0..39ec3eeec41f 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -66,7 +66,9 @@ static void batadv_ring_buffer_set(uint8_t lq_recv[], uint8_t *lq_index,
 static uint8_t batadv_ring_buffer_avg(const uint8_t lq_recv[])
 {
 	const uint8_t *ptr;
-	uint16_t count = 0, i = 0, sum = 0;
+	uint16_t count = 0;
+	uint16_t i = 0;
+	uint16_t sum = 0;
 
 	ptr = lq_recv;
 
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 19/26] batman-adv: iv_ogm, fix comment function name
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (17 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 18/26] batman-adv: iv_ogm, fix coding style Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-03-01  9:00   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 20/26] batman-adv: types, Fix comment on bcast_own Markus Pargmann
                   ` (7 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

This is a small copy paste fix for batadv_ing_buffer_avg.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 bat_iv_ogm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 39ec3eeec41f..b613ef74b9e0 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -57,7 +57,7 @@ static void batadv_ring_buffer_set(uint8_t lq_recv[], uint8_t *lq_index,
 }
 
 /**
- * batadv_ring_buffer_set - compute the average of all non-zero values stored
+ * batadv_ring_buffer_avg - compute the average of all non-zero values stored
  * in the given ring buffer
  * @lq_recv: pointer to the ring buffer
  *
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 20/26] batman-adv: types, Fix comment on bcast_own
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (18 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 19/26] batman-adv: iv_ogm, fix comment function name Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-03-09  0:28   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 21/26] batman-adv: main, Convert is_my_mac() to bool Markus Pargmann
                   ` (6 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

batadv_orig_bat_iv->bcast_own is actually not a bitfield, it is an
array. Adjust the comment accordingly.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 types.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/types.h b/types.h
index 462a70c0db8f..cd331974321b 100644
--- a/types.h
+++ b/types.h
@@ -181,9 +181,10 @@ struct batadv_orig_node_vlan {
 
 /**
  * struct batadv_orig_bat_iv - B.A.T.M.A.N. IV private orig_node members
- * @bcast_own: bitfield containing the number of our OGMs this orig_node
- *  rebroadcasted "back" to us (relative to last_real_seqno)
- * @bcast_own_sum: counted result of bcast_own
+ * @bcast_own: array containing the number of our OGMs this orig_node
+ *  rebroadcasted "back" to us (relative to last_real_seqno) on each hard
+ *  interface
+ * @bcast_own_sum: sum of bcast_own
  * @ogm_cnt_lock: lock protecting bcast_own, bcast_own_sum,
  *  neigh_node->bat_iv.real_bits & neigh_node->bat_iv.real_packet_count
  */
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 21/26] batman-adv: main, Convert is_my_mac() to bool
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (19 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 20/26] batman-adv: types, Fix comment on bcast_own Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-03-11  9:45   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 22/26] batman-adv: main, batadv_compare_eth return bool Markus Pargmann
                   ` (5 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

It is much clearer to see a bool type as return value than 'int' for
functions that are supposed to return true or false.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 main.c | 11 +++++++----
 main.h |  2 +-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/main.c b/main.c
index cff31bb9bb14..d5c79ae1db6f 100644
--- a/main.c
+++ b/main.c
@@ -228,10 +228,13 @@ void batadv_mesh_free(struct net_device *soft_iface)
  * interfaces in the current mesh
  * @bat_priv: the bat priv with all the soft interface information
  * @addr: the address to check
+ *
+ * Returns 'true' if the mac address was found, false otherwise.
  */
-int batadv_is_my_mac(struct batadv_priv *bat_priv, const uint8_t *addr)
+bool batadv_is_my_mac(struct batadv_priv *bat_priv, const uint8_t *addr)
 {
 	const struct batadv_hard_iface *hard_iface;
+	bool is_my_mac = false;
 
 	rcu_read_lock();
 	list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
@@ -242,12 +245,12 @@ int batadv_is_my_mac(struct batadv_priv *bat_priv, const uint8_t *addr)
 			continue;
 
 		if (batadv_compare_eth(hard_iface->net_dev->dev_addr, addr)) {
-			rcu_read_unlock();
-			return 1;
+			is_my_mac = true;
+			break;
 		}
 	}
 	rcu_read_unlock();
-	return 0;
+	return is_my_mac;
 }
 
 /**
diff --git a/main.h b/main.h
index 013de2f7ee11..6cd339090658 100644
--- a/main.h
+++ b/main.h
@@ -196,7 +196,7 @@ extern struct workqueue_struct *batadv_event_workqueue;
 
 int batadv_mesh_init(struct net_device *soft_iface);
 void batadv_mesh_free(struct net_device *soft_iface);
-int batadv_is_my_mac(struct batadv_priv *bat_priv, const uint8_t *addr);
+bool batadv_is_my_mac(struct batadv_priv *bat_priv, const uint8_t *addr);
 struct batadv_hard_iface *
 batadv_seq_print_text_primary_if_get(struct seq_file *seq);
 int batadv_max_header_len(void);
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 22/26] batman-adv: main, batadv_compare_eth return bool
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (20 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 21/26] batman-adv: main, Convert is_my_mac() to bool Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-03-11  9:48   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 23/26] batman-adv: Remove unnecessary ret variable Markus Pargmann
                   ` (4 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

Declare the returntype of batadv_compare_eth as bool.
The function called inside this helper function
(ether_addr_equal_unaligned) also uses bool as return value, so there is
no need to return int.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 main.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/main.h b/main.h
index 6cd339090658..2e70d4dc748d 100644
--- a/main.h
+++ b/main.h
@@ -218,7 +218,7 @@ __be32 batadv_skb_crc32(struct sk_buff *skb, u8 *payload_ptr);
  *
  * note: can't use ether_addr_equal() as it requires aligned memory
  */
-static inline int batadv_compare_eth(const void *data1, const void *data2)
+static inline bool batadv_compare_eth(const void *data1, const void *data2)
 {
 	return ether_addr_equal_unaligned(data1, data2);
 }
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 23/26] batman-adv: Remove unnecessary ret variable
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (21 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 22/26] batman-adv: main, batadv_compare_eth return bool Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-03-13  6:04   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 24/26] batman-adv: Remove unnecessary ret variable in algo_register Markus Pargmann
                   ` (3 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

We can avoid this indirect return variable by directly returning the
error values.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 main.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/main.c b/main.c
index d5c79ae1db6f..2e2ad071a085 100644
--- a/main.c
+++ b/main.c
@@ -532,14 +532,12 @@ static struct batadv_algo_ops *batadv_algo_get(char *name)
 int batadv_algo_register(struct batadv_algo_ops *bat_algo_ops)
 {
 	struct batadv_algo_ops *bat_algo_ops_tmp;
-	int ret;
 
 	bat_algo_ops_tmp = batadv_algo_get(bat_algo_ops->name);
 	if (bat_algo_ops_tmp) {
 		pr_info("Trying to register already registered routing algorithm: %s\n",
 			bat_algo_ops->name);
-		ret = -EEXIST;
-		goto out;
+		return -EEXIST;
 	}
 
 	/* all algorithms must implement all ops (for now) */
@@ -553,16 +551,13 @@ int batadv_algo_register(struct batadv_algo_ops *bat_algo_ops)
 	    !bat_algo_ops->bat_neigh_is_equiv_or_better) {
 		pr_info("Routing algo '%s' does not implement required ops\n",
 			bat_algo_ops->name);
-		ret = -EINVAL;
-		goto out;
+		return -EINVAL;
 	}
 
 	INIT_HLIST_NODE(&bat_algo_ops->list);
 	hlist_add_head(&bat_algo_ops->list, &batadv_algo_list);
-	ret = 0;
 
-out:
-	return ret;
+	return 0;
 }
 
 int batadv_algo_select(struct batadv_priv *bat_priv, char *name)
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 24/26] batman-adv: Remove unnecessary ret variable in algo_register
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (22 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 23/26] batman-adv: Remove unnecessary ret variable Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2015-03-13  6:06   ` Marek Lindner
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 25/26] batman-adv: packet.h, add some missing includes Markus Pargmann
                   ` (2 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

Remove ret variable and all jumps.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 main.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/main.c b/main.c
index 2e2ad071a085..d67be132e5df 100644
--- a/main.c
+++ b/main.c
@@ -563,17 +563,14 @@ int batadv_algo_register(struct batadv_algo_ops *bat_algo_ops)
 int batadv_algo_select(struct batadv_priv *bat_priv, char *name)
 {
 	struct batadv_algo_ops *bat_algo_ops;
-	int ret = -EINVAL;
 
 	bat_algo_ops = batadv_algo_get(name);
 	if (!bat_algo_ops)
-		goto out;
+		return -EINVAL;
 
 	bat_priv->bat_algo_ops = bat_algo_ops;
-	ret = 0;
 
-out:
-	return ret;
+	return 0;
 }
 
 int batadv_algo_seq_print_text(struct seq_file *seq, void *offset)
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 25/26] batman-adv: packet.h, add some missing includes
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (23 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 24/26] batman-adv: Remove unnecessary ret variable in algo_register Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2014-12-27 14:30   ` Antonio Quartulli
                     ` (2 more replies)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 26/26] batman-adv: types.h, add missing include Markus Pargmann
  2015-03-22  0:52 ` [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Sven Eckelmann
  26 siblings, 3 replies; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 packet.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/packet.h b/packet.h
index facd1feddd4e..5fd0d814b6de 100644
--- a/packet.h
+++ b/packet.h
@@ -18,6 +18,11 @@
 #ifndef _NET_BATMAN_ADV_PACKET_H_
 #define _NET_BATMAN_ADV_PACKET_H_
 
+#ifdef __KERNEL__
+#include <linux/bitops.h>
+#include <uapi/linux/if_ether.h>
+#endif /* __KERNEL__ */
+
 /**
  * enum batadv_packettype - types for batman-adv encapsulated packets
  * @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV
-- 
2.1.3


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

* [B.A.T.M.A.N.] [PATCH v2 26/26] batman-adv: types.h, add missing include
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (24 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 25/26] batman-adv: packet.h, add some missing includes Markus Pargmann
@ 2014-12-26 11:41 ` Markus Pargmann
  2014-12-28  2:35   ` Marek Lindner
  2015-03-22  0:52 ` [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Sven Eckelmann
  26 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-26 11:41 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: b.a.t.m.a.n, Sven Eckelmann

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 types.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/types.h b/types.h
index cd331974321b..7c22dfadff5e 100644
--- a/types.h
+++ b/types.h
@@ -21,6 +21,7 @@
 #include "packet.h"
 #include "bitarray.h"
 #include <linux/kernel.h>
+#include <linux/netdevice.h>
 
 #ifdef CONFIG_BATMAN_ADV_DAT
 
-- 
2.1.3


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

* Re: [B.A.T.M.A.N.] [PATCH v2 25/26] batman-adv: packet.h, add some missing includes
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 25/26] batman-adv: packet.h, add some missing includes Markus Pargmann
@ 2014-12-27 14:30   ` Antonio Quartulli
  2014-12-27 17:03     ` Markus Pargmann
  2014-12-28  2:35   ` Marek Lindner
  2015-03-21 22:36   ` Sven Eckelmann
  2 siblings, 1 reply; 67+ messages in thread
From: Antonio Quartulli @ 2014-12-27 14:30 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking,
	Marek Lindner, Simon Wunderlich
  Cc: Sven Eckelmann

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

Hi Markus,

first of all you should know that I really appreciate your hard work.
Thank you very much for this!

On 26/12/14 12:41, Markus Pargmann wrote:
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  packet.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/packet.h b/packet.h
> index facd1feddd4e..5fd0d814b6de 100644
> --- a/packet.h
> +++ b/packet.h
> @@ -18,6 +18,11 @@
>  #ifndef _NET_BATMAN_ADV_PACKET_H_
>  #define _NET_BATMAN_ADV_PACKET_H_
>  
> +#ifdef __KERNEL__
> +#include <linux/bitops.h>
> +#include <uapi/linux/if_ether.h>
> +#endif /* __KERNEL__ */

Unfortunately we can't do this :-(

Patches sent to the kernel cannot contain conditional code on being in
the kernel or not (same is true for checks against a particular kernel
version - such code can't be in the kernel).

Patches sent to the kernel must assume that they are only for the kernel
(and for that particular version we are sending the patches against).

Of course this makes everything a bit trickier for us since we share
files between kernel and userspace .....

This is one of the reasons why we have compat.c/h in the batman-adv
package: you will see that in those files we had to implement all sort
of hackish/dirty tricks in order to keep the code in the other files
clean (compat.h/c are not sent to the kernel but are part of the
batman-adv out-of-the-tree package).


However, as far as I know, you should be able to simply do:

#include <linux/if_ether.h> (without the uapi subfolder)

and this should happily work for both the kernel and the userspace. Have
you tried that? I might be wrong - it's quite some time I haven't used
uapi headers.


Otherwise we might need to find a different solution - or live we what
we have now :)

Cheers,


> +
>  /**
>   * enum batadv_packettype - types for batman-adv encapsulated packets
>   * @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV
> 

-- 
Antonio Quartulli


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 25/26] batman-adv: packet.h, add some missing includes
  2014-12-27 14:30   ` Antonio Quartulli
@ 2014-12-27 17:03     ` Markus Pargmann
  2014-12-31 17:55       ` Antonio Quartulli
  0 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2014-12-27 17:03 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking
  Cc: Marek Lindner, Sven Eckelmann

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

Hi Antonio,

On Sat, Dec 27, 2014 at 03:30:53PM +0100, Antonio Quartulli wrote:
> Hi Markus,
> 
> first of all you should know that I really appreciate your hard work.
> Thank you very much for this!
> 
> On 26/12/14 12:41, Markus Pargmann wrote:
> > Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> > ---
> >  packet.h | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/packet.h b/packet.h
> > index facd1feddd4e..5fd0d814b6de 100644
> > --- a/packet.h
> > +++ b/packet.h
> > @@ -18,6 +18,11 @@
> >  #ifndef _NET_BATMAN_ADV_PACKET_H_
> >  #define _NET_BATMAN_ADV_PACKET_H_
> >  
> > +#ifdef __KERNEL__
> > +#include <linux/bitops.h>
> > +#include <uapi/linux/if_ether.h>
> > +#endif /* __KERNEL__ */
> 
> Unfortunately we can't do this :-(
> 
> Patches sent to the kernel cannot contain conditional code on being in
> the kernel or not (same is true for checks against a particular kernel
> version - such code can't be in the kernel).
> 
> Patches sent to the kernel must assume that they are only for the kernel
> (and for that particular version we are sending the patches against).

Oh, I checked by grepping through the kernel before changing the patch
like this.
	git grep "^#if.*def.*__KERNEL__" | grep -v include | wc -l
	145

So there are 145 uses of an ifdef __KERNEL__ outside of include
directories (I excluded include directories as they may be exported to
userspace). So I thought it would be ok.

> Of course this makes everything a bit trickier for us since we share
> files between kernel and userspace .....
> 
> This is one of the reasons why we have compat.c/h in the batman-adv
> package: you will see that in those files we had to implement all sort
> of hackish/dirty tricks in order to keep the code in the other files
> clean (compat.h/c are not sent to the kernel but are part of the
> batman-adv out-of-the-tree package).

Yes I saw that. I still don't really understand why this whole out of
tree package is necessary. But I am wondering if it wouldn't be easier
to develope and build directly in the kernel tree.

> 
> However, as far as I know, you should be able to simply do:
> 
> #include <linux/if_ether.h> (without the uapi subfolder)
> 
> and this should happily work for both the kernel and the userspace. Have
> you tried that? I might be wrong - it's quite some time I haven't used
> uapi headers.

Yep, that works for the kernel, thanks. However, bitops.h remains as we
don't have bitops.h for the userspace.

> Otherwise we might need to find a different solution - or live we what
> we have now :)

Yeah it works normally as the includes leak through other include files.
But I prefer explicit includes. I am thinking about some solution for
the bitops.h

Best Regards,

Markus

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

* Re: [B.A.T.M.A.N.] [PATCH v2 02/26] batman-adv: Separate logging header
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 02/26] batman-adv: Separate logging header Markus Pargmann
@ 2014-12-28  2:33   ` Marek Lindner
  2014-12-28 11:08     ` Markus Pargmann
  0 siblings, 1 reply; 67+ messages in thread
From: Marek Lindner @ 2014-12-28  2:33 UTC (permalink / raw)
  To: Markus Pargmann; +Cc: b.a.t.m.a.n, Sven Eckelmann, Antonio Quartulli

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

On Friday 26 December 2014 12:41:19 Markus Pargmann wrote:
> This patch creates a separate header file for logging related functions
> and definitions.

Martin's comment still stands. Your commit message states the obvious without 
giving any clue as to why this is desired or wanted ..

Cheers,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 25/26] batman-adv: packet.h, add some missing includes
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 25/26] batman-adv: packet.h, add some missing includes Markus Pargmann
  2014-12-27 14:30   ` Antonio Quartulli
@ 2014-12-28  2:35   ` Marek Lindner
  2014-12-28 11:11     ` Markus Pargmann
  2015-03-21 22:36   ` Sven Eckelmann
  2 siblings, 1 reply; 67+ messages in thread
From: Marek Lindner @ 2014-12-28  2:35 UTC (permalink / raw)
  To: Markus Pargmann; +Cc: b.a.t.m.a.n, Sven Eckelmann, Antonio Quartulli

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

On Friday 26 December 2014 12:41:42 Markus Pargmann wrote:
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  packet.h | 5 +++++
>  1 file changed, 5 insertions(+)

Again, why is it a problem if these headers are missing ? Something not 
compiling ? Something else broken ? What are we fixing ?

Cheers,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 26/26] batman-adv: types.h, add missing include
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 26/26] batman-adv: types.h, add missing include Markus Pargmann
@ 2014-12-28  2:35   ` Marek Lindner
  0 siblings, 0 replies; 67+ messages in thread
From: Marek Lindner @ 2014-12-28  2:35 UTC (permalink / raw)
  To: Markus Pargmann; +Cc: b.a.t.m.a.n, Sven Eckelmann, Antonio Quartulli

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

On Friday 26 December 2014 12:41:43 Markus Pargmann wrote:
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---

Same here ..

Cheers,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 02/26] batman-adv: Separate logging header
  2014-12-28  2:33   ` Marek Lindner
@ 2014-12-28 11:08     ` Markus Pargmann
  0 siblings, 0 replies; 67+ messages in thread
From: Markus Pargmann @ 2014-12-28 11:08 UTC (permalink / raw)
  To: Marek Lindner; +Cc: b.a.t.m.a.n, Sven Eckelmann, Antonio Quartulli

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

Hi Marek,

On Sun, Dec 28, 2014 at 10:33:58AM +0800, Marek Lindner wrote:
> On Friday 26 December 2014 12:41:19 Markus Pargmann wrote:
> > This patch creates a separate header file for logging related functions
> > and definitions.
> 
> Martin's comment still stands. Your commit message states the obvious without 
> giving any clue as to why this is desired or wanted ..

Didn't see Martin's comment as my email somewhere was lost in the to
list.

However I am doing this because I think it is better to remove as much
code from main.c/h as possible that is not used for init/shutdown.
Logging functions are not interesting for the reader of main.c, so I
think it should be moved to a separate file.

I will add some similar explanation to the commit message.

Best regards,

Markus

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

* Re: [B.A.T.M.A.N.] [PATCH v2 25/26] batman-adv: packet.h, add some missing includes
  2014-12-28  2:35   ` Marek Lindner
@ 2014-12-28 11:11     ` Markus Pargmann
  0 siblings, 0 replies; 67+ messages in thread
From: Markus Pargmann @ 2014-12-28 11:11 UTC (permalink / raw)
  To: Marek Lindner; +Cc: b.a.t.m.a.n, Sven Eckelmann, Antonio Quartulli

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

On Sun, Dec 28, 2014 at 10:35:03AM +0800, Marek Lindner wrote:
> On Friday 26 December 2014 12:41:42 Markus Pargmann wrote:
> > Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> > ---
> >  packet.h | 5 +++++
> >  1 file changed, 5 insertions(+)
> 
> Again, why is it a problem if these headers are missing ? Something not 
> compiling ? Something else broken ? What are we fixing ?

This is fixing missing includes that I discovered when removing other
includes from c files. As this header uses defines from that include file
I think it should be explicitly listed. Will add more description to the
commit message.

Best regards,

Markus

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

* Re: [B.A.T.M.A.N.] [PATCH v2 25/26] batman-adv: packet.h, add some missing includes
  2014-12-27 17:03     ` Markus Pargmann
@ 2014-12-31 17:55       ` Antonio Quartulli
  2015-01-14 16:27         ` Markus Pargmann
  0 siblings, 1 reply; 67+ messages in thread
From: Antonio Quartulli @ 2014-12-31 17:55 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking,
	Markus Pargmann
  Cc: Marek Lindner, Sven Eckelmann

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

Markus,

On 27/12/14 18:03, Markus Pargmann wrote:
> Hi Antonio,
> 
> On Sat, Dec 27, 2014 at 03:30:53PM +0100, Antonio Quartulli wrote:
>> Hi Markus,
>>
>> first of all you should know that I really appreciate your hard work.
>> Thank you very much for this!
>>
>> On 26/12/14 12:41, Markus Pargmann wrote:
>>> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
>>> ---
>>>  packet.h | 5 +++++
>>>  1 file changed, 5 insertions(+)
>>>
>>> diff --git a/packet.h b/packet.h
>>> index facd1feddd4e..5fd0d814b6de 100644
>>> --- a/packet.h
>>> +++ b/packet.h
>>> @@ -18,6 +18,11 @@
>>>  #ifndef _NET_BATMAN_ADV_PACKET_H_
>>>  #define _NET_BATMAN_ADV_PACKET_H_
>>>  
>>> +#ifdef __KERNEL__
>>> +#include <linux/bitops.h>
>>> +#include <uapi/linux/if_ether.h>
>>> +#endif /* __KERNEL__ */
>>
>> Unfortunately we can't do this :-(
>>
>> Patches sent to the kernel cannot contain conditional code on being in
>> the kernel or not (same is true for checks against a particular kernel
>> version - such code can't be in the kernel).
>>
>> Patches sent to the kernel must assume that they are only for the kernel
>> (and for that particular version we are sending the patches against).
> 
> Oh, I checked by grepping through the kernel before changing the patch
> like this.
> 	git grep "^#if.*def.*__KERNEL__" | grep -v include | wc -l
> 	145
> 
> So there are 145 uses of an ifdef __KERNEL__ outside of include
> directories (I excluded include directories as they may be exported to
> userspace). So I thought it would be ok.

these are probably pieces of code that have not yet been cleaned up.
Still, this does not allow us to introduce more code like this: David
(the networking tree maintainer) would refuse such additions.


Cheers,

-- 
Antonio Quartulli


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 01/26] batman-adv: debugfs, avoid compiling for !DEBUG_FS
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 01/26] batman-adv: debugfs, avoid compiling for !DEBUG_FS Markus Pargmann
@ 2015-01-11 10:32   ` Marek Lindner
  0 siblings, 0 replies; 67+ messages in thread
From: Marek Lindner @ 2015-01-11 10:32 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday 26 December 2014 12:41:18 Markus Pargmann wrote:
> Normally the debugfs framework will return error pointer with -ENODEV
> for function calls when DEBUG_FS is not set.
> 
> batman does not notice this error code and continues trying to create
> debugfs files and executes more code. We can avoid this code execution
> by disabling compiling debugfs.c when DEBUG_FS is not set.
> 
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  Makefile.kbuild |  2 +-
>  debugfs.c       |  8 --------
>  debugfs.h       | 34 ++++++++++++++++++++++++++++++++++
>  3 files changed, 35 insertions(+), 9 deletions(-)

Applied in revision fe67bb4.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 03/26] batman-adv: iv_ogm, Reduce code duplication
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 03/26] batman-adv: iv_ogm, Reduce code duplication Markus Pargmann
@ 2015-01-11 10:38   ` Marek Lindner
  0 siblings, 0 replies; 67+ messages in thread
From: Marek Lindner @ 2015-01-11 10:38 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday 26 December 2014 12:41:20 Markus Pargmann wrote:
> +static int batadv_iv_ogm_neigh_diff(struct batadv_neigh_node *neigh1,
> +                                   struct batadv_hard_iface *if_outgoing1,
> +                                   struct batadv_neigh_node *neigh2,
> +                                   struct batadv_hard_iface *if_outgoing2,
> +                                   int *diff)
>  {
>         struct batadv_neigh_ifinfo *neigh1_ifinfo, *neigh2_ifinfo;
>         uint8_t tq1, tq2;
> -       int diff;
> +       int ret;

In the success case 'ret' is never initialized or set to any specific value.
We do lack kernel doc for the newly created function 
'batadv_iv_ogm_neigh_diff'.

Cheers,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 04/26] batman-adv: iv_ogm, divide and round for ring buffer avg
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 04/26] batman-adv: iv_ogm, divide and round for ring buffer avg Markus Pargmann
@ 2015-01-11 12:32   ` Marek Lindner
  2015-01-11 12:42     ` Sven Eckelmann
  2015-01-12 15:56   ` Simon Wunderlich
  1 sibling, 1 reply; 67+ messages in thread
From: Marek Lindner @ 2015-01-11 12:32 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday 26 December 2014 12:41:21 Markus Pargmann wrote:
> Instead of the normal division which looses precision, use a division
> with rounding.
> 
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  bat_iv_ogm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
> index 1458ecfa66b8..10eada270015 100644
> --- a/bat_iv_ogm.c
> +++ b/bat_iv_ogm.c
> @@ -82,7 +82,7 @@ static uint8_t batadv_ring_buffer_avg(const uint8_t
> lq_recv[]) if (count == 0)
>                 return 0;
>  
> -       return (uint8_t)(sum / count);
> +       return (uint8_t)DIV_ROUND_CLOSEST(sum, count);
>  }

Is DIV_ROUND_CLOSEST available in 2.6.29 ? I could not find a conclusive hint 
whether or not we need compat code for the out-of-tree module ?

Cheers,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 05/26] batman-adv: init, Add some error handling
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 05/26] batman-adv: init, Add some error handling Markus Pargmann
@ 2015-01-11 12:38   ` Marek Lindner
  2015-01-14 15:24     ` Markus Pargmann
  0 siblings, 1 reply; 67+ messages in thread
From: Marek Lindner @ 2015-01-11 12:38 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday 26 December 2014 12:41:22 Markus Pargmann wrote:
>  static int __init batadv_init(void)
>  {
> +       int ret;
> +
>         INIT_LIST_HEAD(&batadv_hardif_list);
>         INIT_HLIST_HEAD(&batadv_algo_list);
>  
>         batadv_recv_handler_init();
>  
> -       batadv_iv_init();
> -       batadv_nc_init();
> +       ret = batadv_iv_init();
> +       if (ret)
> +               return ret;
> +
> +       ret = batadv_nc_init();
> +       if (ret)
> +               return ret;
>  
>         batadv_event_workqueue =
> create_singlethread_workqueue("bat_events"); -
>         if (!batadv_event_workqueue)
>                 return -ENOMEM;
>  
>         batadv_socket_init();
>         batadv_debugfs_init();
>  
> -       register_netdevice_notifier(&batadv_hard_if_notifier);
> -       rtnl_link_register(&batadv_link_ops);
> +       ret = register_netdevice_notifier(&batadv_hard_if_notifier);
> +       if (ret)
> +               goto err_netdev_notifier;
> +
> +       ret = rtnl_link_register(&batadv_link_ops);
> +       if (ret)
> +               goto err_link_register;
>  
>         pr_info("B.A.T.M.A.N. advanced %s (compatibility version %i)
> loaded\n", BATADV_SOURCE_VERSION, BATADV_COMPAT_VERSION);
>  
>         return 0;
> +
> +err_link_register:
> +       unregister_netdevice_notifier(&batadv_hard_if_notifier);
> +err_netdev_notifier:
> +       batadv_debugfs_destroy();
> +
> +       return ret;
>  }

To be truely clean, I guess the workqueue should be destroyed as well ?

Cheers,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 06/26] batman-adv: tvlv realloc, move error handling into if block
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 06/26] batman-adv: tvlv realloc, move error handling into if block Markus Pargmann
@ 2015-01-11 12:40   ` Marek Lindner
  0 siblings, 0 replies; 67+ messages in thread
From: Marek Lindner @ 2015-01-11 12:40 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday 26 December 2014 12:41:23 Markus Pargmann wrote:
> Instead of hiding the normal function flow inside an if block, we should
> just put the error handling into the if block.
> 
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  main.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)

Applied in revision 9aef872.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 04/26] batman-adv: iv_ogm, divide and round for ring buffer avg
  2015-01-11 12:32   ` Marek Lindner
@ 2015-01-11 12:42     ` Sven Eckelmann
  0 siblings, 0 replies; 67+ messages in thread
From: Sven Eckelmann @ 2015-01-11 12:42 UTC (permalink / raw)
  To: Marek Lindner; +Cc: b.a.t.m.a.n, Antonio Quartulli

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

On Sunday 11 January 2015 20:32:49 Marek Lindner wrote:
> Is DIV_ROUND_CLOSEST available in 2.6.29 ? I could not find a conclusive
> hint whether or not we need compat code for the out-of-tree module ?

It was introduced in 2.6.29 in v2.6.28-6240-g9fe0608. So you would only need 
compat code in marek/compat_old_kernel

Kind regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 08/26] batman-adv: Makefile, Sort alphabetically
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 08/26] batman-adv: Makefile, Sort alphabetically Markus Pargmann
@ 2015-01-11 12:44   ` Marek Lindner
  0 siblings, 0 replies; 67+ messages in thread
From: Marek Lindner @ 2015-01-11 12:44 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday 26 December 2014 12:41:25 Markus Pargmann wrote:
> The whole Makefile is sorted, just the multicast rule is not at the
> right position.
> 
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  Makefile.kbuild | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied in revision d857186.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 09/26] batman-adv: iv_ogm_iface_enable, direct return values
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 09/26] batman-adv: iv_ogm_iface_enable, direct return values Markus Pargmann
@ 2015-01-11 12:46   ` Marek Lindner
  0 siblings, 0 replies; 67+ messages in thread
From: Marek Lindner @ 2015-01-11 12:46 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday 26 December 2014 12:41:26 Markus Pargmann wrote:
> Directly return error values. No need to use a return variable.
> 
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  bat_iv_ogm.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)

Applied in revision 0cc4569.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 10/26] batman-adv: iv_ogm_aggr_packet, bool return value
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 10/26] batman-adv: iv_ogm_aggr_packet, bool return value Markus Pargmann
@ 2015-01-11 12:48   ` Marek Lindner
  0 siblings, 0 replies; 67+ messages in thread
From: Marek Lindner @ 2015-01-11 12:48 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday 26 December 2014 12:41:27 Markus Pargmann wrote:
> This function returns bool values, so it should be defined to return
> them instead of the whole int range.
> 
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  bat_iv_ogm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied in revision ec3b2d9.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 04/26] batman-adv: iv_ogm, divide and round for ring buffer avg
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 04/26] batman-adv: iv_ogm, divide and round for ring buffer avg Markus Pargmann
  2015-01-11 12:32   ` Marek Lindner
@ 2015-01-12 15:56   ` Simon Wunderlich
  1 sibling, 0 replies; 67+ messages in thread
From: Simon Wunderlich @ 2015-01-12 15:56 UTC (permalink / raw)
  To: Markus Pargmann
  Cc: Sven Eckelmann, b.a.t.m.a.n, Marek Lindner, Antonio Quartulli

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

On Friday 26 December 2014 12:41:21 Markus Pargmann wrote:
> Instead of the normal division which looses precision, use a division
> with rounding.
> 
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>

(sorry for the duplicate, sent the reply for the first patch version, so I'm 
replying another time on v2 ...)

Why do we need to have more precise rounding here? In doubt, we should rather 
always round down to avoid any spurious routing loops - the loop free property 
depends on monotonicity after all, and therefore its better to always round 
down.

I'm not convinced that this change is safe in that regard, if you think it is 
please explain further.

> ---
>  bat_iv_ogm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
> index 1458ecfa66b8..10eada270015 100644
> --- a/bat_iv_ogm.c
> +++ b/bat_iv_ogm.c
> @@ -82,7 +82,7 @@ static uint8_t batadv_ring_buffer_avg(const uint8_t
> lq_recv[]) if (count == 0)
>  		return 0;
> 
> -	return (uint8_t)(sum / count);
> +	return (uint8_t)DIV_ROUND_CLOSEST(sum, count);
>  }
> 
>  /**

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 05/26] batman-adv: init, Add some error handling
  2015-01-11 12:38   ` Marek Lindner
@ 2015-01-14 15:24     ` Markus Pargmann
  0 siblings, 0 replies; 67+ messages in thread
From: Markus Pargmann @ 2015-01-14 15:24 UTC (permalink / raw)
  To: Marek Lindner; +Cc: b.a.t.m.a.n, Sven Eckelmann, Antonio Quartulli

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

On Sun, Jan 11, 2015 at 08:38:10PM +0800, Marek Lindner wrote:
> On Friday 26 December 2014 12:41:22 Markus Pargmann wrote:
> >  static int __init batadv_init(void)
> >  {
> > +       int ret;
> > +
> >         INIT_LIST_HEAD(&batadv_hardif_list);
> >         INIT_HLIST_HEAD(&batadv_algo_list);
> >  
> >         batadv_recv_handler_init();
> >  
> > -       batadv_iv_init();
> > -       batadv_nc_init();
> > +       ret = batadv_iv_init();
> > +       if (ret)
> > +               return ret;
> > +
> > +       ret = batadv_nc_init();
> > +       if (ret)
> > +               return ret;
> >  
> >         batadv_event_workqueue =
> > create_singlethread_workqueue("bat_events"); -
> >         if (!batadv_event_workqueue)
> >                 return -ENOMEM;
> >  
> >         batadv_socket_init();
> >         batadv_debugfs_init();
> >  
> > -       register_netdevice_notifier(&batadv_hard_if_notifier);
> > -       rtnl_link_register(&batadv_link_ops);
> > +       ret = register_netdevice_notifier(&batadv_hard_if_notifier);
> > +       if (ret)
> > +               goto err_netdev_notifier;
> > +
> > +       ret = rtnl_link_register(&batadv_link_ops);
> > +       if (ret)
> > +               goto err_link_register;
> >  
> >         pr_info("B.A.T.M.A.N. advanced %s (compatibility version %i)
> > loaded\n", BATADV_SOURCE_VERSION, BATADV_COMPAT_VERSION);
> >  
> >         return 0;
> > +
> > +err_link_register:
> > +       unregister_netdevice_notifier(&batadv_hard_if_notifier);
> > +err_netdev_notifier:
> > +       batadv_debugfs_destroy();
> > +
> > +       return ret;
> >  }
> 
> To be truely clean, I guess the workqueue should be destroyed as well ?

Yes, thanks, added destroy_workqueue() for v3.

Best Regards,

Markus

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

* Re: [B.A.T.M.A.N.] [PATCH v2 25/26] batman-adv: packet.h, add some missing includes
  2014-12-31 17:55       ` Antonio Quartulli
@ 2015-01-14 16:27         ` Markus Pargmann
  0 siblings, 0 replies; 67+ messages in thread
From: Markus Pargmann @ 2015-01-14 16:27 UTC (permalink / raw)
  To: Antonio Quartulli
  Cc: The list for a Better Approach To Mobile Ad-hoc Networking,
	Marek Lindner, Sven Eckelmann

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

On Wed, Dec 31, 2014 at 06:55:25PM +0100, Antonio Quartulli wrote:
> Markus,
> 
> On 27/12/14 18:03, Markus Pargmann wrote:
> > Hi Antonio,
> > 
> > On Sat, Dec 27, 2014 at 03:30:53PM +0100, Antonio Quartulli wrote:
> >> Hi Markus,
> >>
> >> first of all you should know that I really appreciate your hard work.
> >> Thank you very much for this!
> >>
> >> On 26/12/14 12:41, Markus Pargmann wrote:
> >>> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> >>> ---
> >>>  packet.h | 5 +++++
> >>>  1 file changed, 5 insertions(+)
> >>>
> >>> diff --git a/packet.h b/packet.h
> >>> index facd1feddd4e..5fd0d814b6de 100644
> >>> --- a/packet.h
> >>> +++ b/packet.h
> >>> @@ -18,6 +18,11 @@
> >>>  #ifndef _NET_BATMAN_ADV_PACKET_H_
> >>>  #define _NET_BATMAN_ADV_PACKET_H_
> >>>  
> >>> +#ifdef __KERNEL__
> >>> +#include <linux/bitops.h>
> >>> +#include <uapi/linux/if_ether.h>
> >>> +#endif /* __KERNEL__ */
> >>
> >> Unfortunately we can't do this :-(
> >>
> >> Patches sent to the kernel cannot contain conditional code on being in
> >> the kernel or not (same is true for checks against a particular kernel
> >> version - such code can't be in the kernel).
> >>
> >> Patches sent to the kernel must assume that they are only for the kernel
> >> (and for that particular version we are sending the patches against).
> > 
> > Oh, I checked by grepping through the kernel before changing the patch
> > like this.
> > 	git grep "^#if.*def.*__KERNEL__" | grep -v include | wc -l
> > 	145
> > 
> > So there are 145 uses of an ifdef __KERNEL__ outside of include
> > directories (I excluded include directories as they may be exported to
> > userspace). So I thought it would be ok.
> 
> these are probably pieces of code that have not yet been cleaned up.
> Still, this does not allow us to introduce more code like this: David
> (the networking tree maintainer) would refuse such additions.

Okay, thanks. I removed the bitops.h include for the moment as I don't
have an idea how to keep the header usable for the userspace
application.

Best regards,

Markus

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

* Re: [B.A.T.M.A.N.] [PATCH v2 11/26] batman-adv: iv_ogm_send_to_if, declare char* as const
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 11/26] batman-adv: iv_ogm_send_to_if, declare char* as const Markus Pargmann
@ 2015-02-18  9:14   ` Marek Lindner
  0 siblings, 0 replies; 67+ messages in thread
From: Marek Lindner @ 2015-02-18  9:14 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday, December 26, 2014 12:41:28 Markus Pargmann wrote:
> This string pointer is later assigned to a constant string, so it should
> be defined constant at the beginning.
> 
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  bat_iv_ogm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied in revision 3de1d1b.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 12/26] batman-adv: iv_ogm_can_aggregate, code readability
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 12/26] batman-adv: iv_ogm_can_aggregate, code readability Markus Pargmann
@ 2015-02-19 16:20   ` Marek Lindner
  0 siblings, 0 replies; 67+ messages in thread
From: Marek Lindner @ 2015-02-19 16:20 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday, December 26, 2014 12:41:29 Markus Pargmann wrote:
> This patch tries to increase code readability by negating the first if
> block and rearranging some of the other conditional blocks. This way we
> save an indentation level, we also save some allocation that is not
> necessary for one of the conditions.
> 
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  bat_iv_ogm.c | 98
> +++++++++++++++++++++++++++++++----------------------------- 1 file
> changed, 50 insertions(+), 48 deletions(-)

Applied in revision f7ac9a4.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 13/26] batman-adv: iv_ogm_orig_update, remove unnecessary brackets
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 13/26] batman-adv: iv_ogm_orig_update, remove unnecessary brackets Markus Pargmann
@ 2015-02-20 11:53   ` Marek Lindner
  0 siblings, 0 replies; 67+ messages in thread
From: Marek Lindner @ 2015-02-20 11:53 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday, December 26, 2014 12:41:30 Markus Pargmann wrote:
> Remove these unnecessary brackets inside a condition.
> 
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  bat_iv_ogm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied in revision 442b546.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 14/26] batman-adv: iv_ogm_aggregate_new, simplify error handling
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 14/26] batman-adv: iv_ogm_aggregate_new, simplify error handling Markus Pargmann
@ 2015-02-23 16:50   ` Marek Lindner
  0 siblings, 0 replies; 67+ messages in thread
From: Marek Lindner @ 2015-02-23 16:50 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday, December 26, 2014 12:41:31 Markus Pargmann wrote:
> It is just a bit easier to put the error handling at one place and let
> multiple error paths use the same calls.
> 
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  bat_iv_ogm.c | 24 +++++++++++-------------
>  1 file changed, 11 insertions(+), 13 deletions(-)

Applied in revision a467a76.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 15/26] batman-adv: iv_ogm_queue_add, Simplify expressions
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 15/26] batman-adv: iv_ogm_queue_add, Simplify expressions Markus Pargmann
@ 2015-02-24 21:20   ` Marek Lindner
  0 siblings, 0 replies; 67+ messages in thread
From: Marek Lindner @ 2015-02-24 21:20 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday, December 26, 2014 12:41:32 Markus Pargmann wrote:
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  bat_iv_ogm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied in revision 253a6dd.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 16/26] batman-adv: iv_ogm_orig_update, style, add missin brackets
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 16/26] batman-adv: iv_ogm_orig_update, style, add missin brackets Markus Pargmann
@ 2015-02-27 18:42   ` Marek Lindner
  0 siblings, 0 replies; 67+ messages in thread
From: Marek Lindner @ 2015-02-27 18:42 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday, December 26, 2014 12:41:33 Markus Pargmann wrote:
> CodingStyle describes that either none or both branches of a conditional
> have to have brackets.
> 
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  bat_iv_ogm.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Applied in revision 3040f9c.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 17/26] batman-adv: iv_ogm, Fix dup_status comment
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 17/26] batman-adv: iv_ogm, Fix dup_status comment Markus Pargmann
@ 2015-02-27 18:43   ` Marek Lindner
  0 siblings, 0 replies; 67+ messages in thread
From: Marek Lindner @ 2015-02-27 18:43 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday, December 26, 2014 12:41:34 Markus Pargmann wrote:
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  bat_iv_ogm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied in revision d00159a.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 18/26] batman-adv: iv_ogm, fix coding style
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 18/26] batman-adv: iv_ogm, fix coding style Markus Pargmann
@ 2015-02-28 15:59   ` Marek Lindner
  0 siblings, 0 replies; 67+ messages in thread
From: Marek Lindner @ 2015-02-28 15:59 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday, December 26, 2014 12:41:35 Markus Pargmann wrote:
> The kernel coding style says, that there should not be multiple
> assignments in one row.
> 
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  bat_iv_ogm.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Applied in revision 63c15a5.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 19/26] batman-adv: iv_ogm, fix comment function name
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 19/26] batman-adv: iv_ogm, fix comment function name Markus Pargmann
@ 2015-03-01  9:00   ` Marek Lindner
  0 siblings, 0 replies; 67+ messages in thread
From: Marek Lindner @ 2015-03-01  9:00 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday, December 26, 2014 12:41:36 Markus Pargmann wrote:
> This is a small copy paste fix for batadv_ing_buffer_avg.
> 
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  bat_iv_ogm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied in revision 11c63fa.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 20/26] batman-adv: types, Fix comment on bcast_own
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 20/26] batman-adv: types, Fix comment on bcast_own Markus Pargmann
@ 2015-03-09  0:28   ` Marek Lindner
  0 siblings, 0 replies; 67+ messages in thread
From: Marek Lindner @ 2015-03-09  0:28 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday, December 26, 2014 12:41:37 Markus Pargmann wrote:
> batadv_orig_bat_iv->bcast_own is actually not a bitfield, it is an
> array. Adjust the comment accordingly.
> 
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  types.h | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

Applied in revision eb923e9 (with the modifications discussed on IRC).

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 21/26] batman-adv: main, Convert is_my_mac() to bool
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 21/26] batman-adv: main, Convert is_my_mac() to bool Markus Pargmann
@ 2015-03-11  9:45   ` Marek Lindner
  0 siblings, 0 replies; 67+ messages in thread
From: Marek Lindner @ 2015-03-11  9:45 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday, December 26, 2014 12:41:38 Markus Pargmann wrote:
> It is much clearer to see a bool type as return value than 'int' for
> functions that are supposed to return true or false.
> 
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  main.c | 11 +++++++----
>  main.h |  2 +-
>  2 files changed, 8 insertions(+), 5 deletions(-)

Applied in revision a5b709e.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 22/26] batman-adv: main, batadv_compare_eth return bool
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 22/26] batman-adv: main, batadv_compare_eth return bool Markus Pargmann
@ 2015-03-11  9:48   ` Marek Lindner
  0 siblings, 0 replies; 67+ messages in thread
From: Marek Lindner @ 2015-03-11  9:48 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday, December 26, 2014 12:41:39 Markus Pargmann wrote:
> Declare the returntype of batadv_compare_eth as bool.
> The function called inside this helper function
> (ether_addr_equal_unaligned) also uses bool as return value, so there is
> no need to return int.
> 
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  main.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied in revision 16af734.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 23/26] batman-adv: Remove unnecessary ret variable
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 23/26] batman-adv: Remove unnecessary ret variable Markus Pargmann
@ 2015-03-13  6:04   ` Marek Lindner
  0 siblings, 0 replies; 67+ messages in thread
From: Marek Lindner @ 2015-03-13  6:04 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday, December 26, 2014 12:41:40 Markus Pargmann wrote:
> We can avoid this indirect return variable by directly returning the
> error values.
> 
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  main.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)

Applied in revision 32a451a.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 24/26] batman-adv: Remove unnecessary ret variable in algo_register
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 24/26] batman-adv: Remove unnecessary ret variable in algo_register Markus Pargmann
@ 2015-03-13  6:06   ` Marek Lindner
  0 siblings, 0 replies; 67+ messages in thread
From: Marek Lindner @ 2015-03-13  6:06 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli

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

On Friday, December 26, 2014 12:41:41 Markus Pargmann wrote:
> Remove ret variable and all jumps.
> 
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>  main.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)

Applied in revision 16b4833.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 25/26] batman-adv: packet.h, add some missing includes
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 25/26] batman-adv: packet.h, add some missing includes Markus Pargmann
  2014-12-27 14:30   ` Antonio Quartulli
  2014-12-28  2:35   ` Marek Lindner
@ 2015-03-21 22:36   ` Sven Eckelmann
  2015-03-24 11:10     ` Markus Pargmann
  2 siblings, 1 reply; 67+ messages in thread
From: Sven Eckelmann @ 2015-03-21 22:36 UTC (permalink / raw)
  To: Markus Pargmann; +Cc: b.a.t.m.a.n, Marek Lindner, Antonio Quartulli


[-- Attachment #1.1: Type: text/plain, Size: 3984 bytes --]

=2D-nextPart1503914.9bye3UvnRG
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"

> --- a/packet.h
> +++ b/packet.h
> @@ -18,6 +18,11 @@
>  #ifndef _NET_BATMAN_ADV_PACKET_H_
>  #define _NET_BATMAN_ADV_PACKET_H_
> 
> +#ifdef __KERNEL__
> +#include <linux/bitops.h>
> +#include <uapi/linux/if_ether.h>
> +#endif /* __KERNEL__ */
> +
>  /**
>   * enum batadv_packettype - types for batman-adv encapsulated packets
>   * @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV

Ok, so you are including linux/bitops.h for BIT(...) and uapi/linux/if_ether.h 
for ETH_ALEN? You are missing:

 * linux/types.h for uint8_t, __be16 and so on
 * define for the bitfield byteorder comes from asm/byteorder.h

Most of these files are part of linux-libc-dev. The rest requires some kind of 
hack. A way to still work in the batctl build would be to include dummy files. 
An example patch is attached. This builds at least on my Debian system and my 
OpenWrt build environment.

Kind regards,
	Sven
=2D-nextPart1503914.9bye3UvnRG
Content-Disposition: attachment; filename="batctl-packet-h-includes.patch"
Content-Transfer-Encoding: 7Bit
Content-Type: text/x-patch; charset="UTF-8"; name="batctl-packet-h-includes.patch"

diff --git a/Makefile b/Makefile
index 0eb71a1..ffbbf72 100755
=2D-- a/Makefile
+++ b/Makefile
@@ -30,7 +30,7 @@ MANPAGE = man/batctl.8
 
 # batctl flags and options
 CFLAGS += -Wall -W -std=gnu99 -fno-strict-aliasing -MD -MP
=2DCPPFLAGS += -D_GNU_SOURCE
+CPPFLAGS += -D_GNU_SOURCE -Ikernelinc
 LDLIBS += -lm
 
 # disable verbose output
diff --git a/kernelinc/linux/bitops.h b/kernelinc/linux/bitops.h
new file mode 100644
index 0000000..d41db10
=2D-- /dev/null
+++ b/kernelinc/linux/bitops.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2009-2014 B.A.T.M.A.N. contributors:
+ *
+ * Marek Lindner <mareklindner@neomailbox.ch>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA
+ *
+ */
+
+#ifndef _BATCTL_KERNELINC_LINUX_BITOPS_H
+#define _BATCTL_KERNELINC_LINUX_BITOPS_H
+
+#define BIT(nr) (1UL << (nr))
+
+#endif
diff --git a/main.h b/main.h
index 461f3e3..248467c 100644
=2D-- a/main.h
+++ b/main.h
@@ -36,17 +36,6 @@
 #define DEBUG_TABLE_PATH_MAX_LEN 20
 #define SETTINGS_PATH_MAX_LEN 25
 
=2D#if BYTE_ORDER == BIG_ENDIAN
=2D#define __BIG_ENDIAN_BITFIELD
=2D#elif BYTE_ORDER == LITTLE_ENDIAN
=2D#define __LITTLE_ENDIAN_BITFIELD
=2D#else
=2D#error "unknown endianess"
=2D#endif
=2D
=2D#define __packed __attribute((packed))   /* linux kernel compat */
=2D#define BIT(nr)                 (1UL << (nr)) /* linux kernel compat */
=2D
 extern char module_ver_path[];
 
 #ifndef VLAN_VID_MASK
diff --git a/packet.h b/packet.h
index b81fbbf..27b4003 100644
=2D-- a/packet.h
+++ b/packet.h
@@ -18,6 +18,11 @@
 #ifndef _NET_BATMAN_ADV_PACKET_H_
 #define _NET_BATMAN_ADV_PACKET_H_
 
+#include <asm/byteorder.h>
+#include <linux/bitops.h>
+#include <linux/if_ether.h>
+#include <linux/types.h>
+
 /**
  * enum batadv_packettype - types for batman-adv encapsulated packets
  * @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV
diff --git a/sys.c b/sys.c
index 676bef1..6c0cab4 100644
=2D-- a/sys.c
+++ b/sys.c
@@ -26,6 +26,7 @@
 #include <string.h>
 #include <errno.h>
 #include <dirent.h>
+#include <linux/bitops.h>
 
 #include "main.h"
 #include "sys.h"

=2D-nextPart1503914.9bye3UvnRG--
This is a multi-part message in MIME format.

[-- Attachment #1.2: Type: text/plain, Size: 902 bytes --]

> --- a/packet.h
> +++ b/packet.h
> @@ -18,6 +18,11 @@
>  #ifndef _NET_BATMAN_ADV_PACKET_H_
>  #define _NET_BATMAN_ADV_PACKET_H_
> 
> +#ifdef __KERNEL__
> +#include <linux/bitops.h>
> +#include <uapi/linux/if_ether.h>
> +#endif /* __KERNEL__ */
> +
>  /**
>   * enum batadv_packettype - types for batman-adv encapsulated packets
>   * @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV

Ok, so you are including linux/bitops.h for BIT(...) and uapi/linux/if_ether.h 
for ETH_ALEN? You are missing:

 * linux/types.h for uint8_t, __be16 and so on
 * define for the bitfield byteorder comes from asm/byteorder.h

Most of these files are part of linux-libc-dev. The rest requires some kind of 
hack. A way to still work in the batctl build would be to include dummy files. 
An example patch is attached. This builds at least on my Debian system and my 
OpenWrt build environment.

Kind regards,
	Sven

[-- Attachment #1.3: batctl-packet-h-includes.patch --]
[-- Type: text/x-patch, Size: 2637 bytes --]

diff --git a/Makefile b/Makefile
index 0eb71a1..ffbbf72 100755
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,7 @@ MANPAGE = man/batctl.8
 
 # batctl flags and options
 CFLAGS += -Wall -W -std=gnu99 -fno-strict-aliasing -MD -MP
-CPPFLAGS += -D_GNU_SOURCE
+CPPFLAGS += -D_GNU_SOURCE -Ikernelinc
 LDLIBS += -lm
 
 # disable verbose output
diff --git a/kernelinc/linux/bitops.h b/kernelinc/linux/bitops.h
new file mode 100644
index 0000000..d41db10
--- /dev/null
+++ b/kernelinc/linux/bitops.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2009-2014 B.A.T.M.A.N. contributors:
+ *
+ * Marek Lindner <mareklindner@neomailbox.ch>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA
+ *
+ */
+
+#ifndef _BATCTL_KERNELINC_LINUX_BITOPS_H
+#define _BATCTL_KERNELINC_LINUX_BITOPS_H
+
+#define BIT(nr) (1UL << (nr))
+
+#endif
diff --git a/main.h b/main.h
index 461f3e3..248467c 100644
--- a/main.h
+++ b/main.h
@@ -36,17 +36,6 @@
 #define DEBUG_TABLE_PATH_MAX_LEN 20
 #define SETTINGS_PATH_MAX_LEN 25
 
-#if BYTE_ORDER == BIG_ENDIAN
-#define __BIG_ENDIAN_BITFIELD
-#elif BYTE_ORDER == LITTLE_ENDIAN
-#define __LITTLE_ENDIAN_BITFIELD
-#else
-#error "unknown endianess"
-#endif
-
-#define __packed __attribute((packed))   /* linux kernel compat */
-#define BIT(nr)                 (1UL << (nr)) /* linux kernel compat */
-
 extern char module_ver_path[];
 
 #ifndef VLAN_VID_MASK
diff --git a/packet.h b/packet.h
index b81fbbf..27b4003 100644
--- a/packet.h
+++ b/packet.h
@@ -18,6 +18,11 @@
 #ifndef _NET_BATMAN_ADV_PACKET_H_
 #define _NET_BATMAN_ADV_PACKET_H_
 
+#include <asm/byteorder.h>
+#include <linux/bitops.h>
+#include <linux/if_ether.h>
+#include <linux/types.h>
+
 /**
  * enum batadv_packettype - types for batman-adv encapsulated packets
  * @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV
diff --git a/sys.c b/sys.c
index 676bef1..6c0cab4 100644
--- a/sys.c
+++ b/sys.c
@@ -26,6 +26,7 @@
 #include <string.h>
 #include <errno.h>
 #include <dirent.h>
+#include <linux/bitops.h>
 
 #include "main.h"
 #include "sys.h"

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups
  2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
                   ` (25 preceding siblings ...)
  2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 26/26] batman-adv: types.h, add missing include Markus Pargmann
@ 2015-03-22  0:52 ` Sven Eckelmann
  2015-03-22  1:34   ` Sven Eckelmann
  26 siblings, 1 reply; 67+ messages in thread
From: Sven Eckelmann @ 2015-03-22  0:52 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Marek Lindner, Antonio Quartulli


[-- Attachment #1.1: Type: text/plain, Size: 39746 bytes --]

=2D-nextPart3922123.nRKsmd8L0B
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"

On Friday 26 December 2014 12:41:17 Markus Pargmann wrote:
> Markus Pargmann (26):
[...]
>   batman-adv: packet.h, add some missing includes
>   batman-adv: types.h, add missing include

Just went through the includes and noticed that a lot more are missing (also 
in the files which you are already touched). I have attached the current state 
of my analysis so you can compare it with your notes.

Kind regards,
	Sven
=2D-nextPart3922123.nRKsmd8L0B
Content-Disposition: attachment; filename="0001-batman-adv-Add-required-includes-previously-used-thr.patch"
Content-Transfer-Encoding: 7Bit
Content-Type: text/x-patch; charset="UTF-8"; name="0001-batman-adv-Add-required-includes-previously-used-thr.patch"

From=20a99b635a3f9dcf745ca6ad00323fa4aa6150c3c1 Mon Sep 17 00:00:00 2001
From: Sven Eckelmann <sven@narfation.org>
Date: Sun, 22 Mar 2015 01:03:04 +0100
Subject: [RFCv0] batman-adv: Add required includes previously used through
 transient includes

TODO:
 * write something about bad transient includes
 * write about the four include/forward declaration sections
 
Signed-off-by: Sven Eckelmann <sven@narfation.org>
=2D--
 bat_iv_ogm.c            | 42 ++++++++++++++++++++++++++++++------
 bitarray.c              |  4 ++--
 bitarray.h              |  6 ++++++
 bridge_loop_avoidance.c | 39 ++++++++++++++++++++++++++-------
 bridge_loop_avoidance.h | 10 +++++++++
 debugfs.c               | 25 +++++++++++++++-------
 debugfs.h               |  7 ++++++
 distributed-arp-table.c | 29 ++++++++++++++++++++-----
 distributed-arp-table.h | 14 +++++++++---
 fragmentation.c         | 22 ++++++++++++++++---
 fragmentation.h         | 11 ++++++++++
 gateway_client.c        | 34 +++++++++++++++++++++++------
 gateway_client.h        | 10 +++++++++
 gateway_common.c        | 12 ++++++++++-
 gateway_common.h        |  7 ++++++
 hard-interface.c        | 38 ++++++++++++++++++++++-----------
 hard-interface.h        | 13 +++++++++++
 hash.c                  |  6 +++++-
 hash.h                  |  9 ++++++++
 icmp_socket.c           | 33 ++++++++++++++++++++++++----
 icmp_socket.h           |  7 ++++++
 main.c                  | 57 ++++++++++++++++++++++++++++++++++---------------
 main.h                  | 33 ++++++++++++++--------------
 multicast.c             | 30 +++++++++++++++++++++++---
 multicast.h             |  6 ++++++
 network-coding.c        | 38 +++++++++++++++++++++++++++++----
 network-coding.h        | 13 +++++++++++
 originator.c            | 28 +++++++++++++++++-------
 originator.h            | 14 ++++++++++++
 packet.h                |  5 +++++
 routing.c               | 37 +++++++++++++++++++++++---------
 routing.h               | 10 +++++++++
 send.c                  | 37 ++++++++++++++++++++++++--------
 send.h                  | 13 +++++++++++
 soft-interface.c        | 55 ++++++++++++++++++++++++++++++++++-------------
 soft-interface.h        | 11 ++++++++++
 sysfs.c                 | 32 +++++++++++++++++++++------
 sysfs.h                 | 10 +++++++++
 translation-table.c     | 40 +++++++++++++++++++++++++++-------
 translation-table.h     |  9 ++++++++
 types.h                 | 15 +++++++++++--
 41 files changed, 712 insertions(+), 159 deletions(-)

diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 04bd220..41c7bd2 100644
=2D-- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -16,15 +16,45 @@
  */
 
 #include "main.h"
=2D#include "translation-table.h"
+
+#include <linux/atomic.h>
+#include <linux/bitmap.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
+#include <linux/byteorder/generic.h>
+#include <linux/cache.h>
+#include <linux/errno.h>
+#include <linux/etherdevice.h>
+#include <linux/fs.h>
+#include <linux/if_ether.h>
+#include <linux/init.h>
+#include <linux/jiffies.h>
+#include <linux/list.h>
+#include <linux/netdevice.h>
+#include <linux/pkt_sched.h>
+#include <linux/printk.h>
+#include <linux/random.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/types.h>
+#include <linux/workqueue.h>
+
+#include "bitarray.h"
+#include "hard-interface.h"
+#include "hash.h"
+#include "network-coding.h"
 #include "originator.h"
+#include "packet.h"
 #include "routing.h"
=2D#include "gateway_common.h"
=2D#include "gateway_client.h"
=2D#include "hard-interface.h"
 #include "send.h"
=2D#include "bat_algo.h"
=2D#include "network-coding.h"
+#include "translation-table.h"
+#include "types.h"
 
 /**
  * enum batadv_dup_status - duplicate status
diff --git a/bitarray.c b/bitarray.c
index e3da07a..ea483f5 100644
=2D-- a/bitarray.c
+++ b/bitarray.c
@@ -15,10 +15,10 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
=2D#include "main.h"
 #include "bitarray.h"
+#include "main.h"
 
=2D#include <linux/bitops.h>
+#include <linux/bitmap.h>
 
 /* shift the packet array by n places. */
 static void batadv_bitmap_shift_left(unsigned long *seq_bits, int32_t n)
diff --git a/bitarray.h b/bitarray.h
index 2acaafe..0240fc2 100644
=2D-- a/bitarray.h
+++ b/bitarray.h
@@ -18,6 +18,12 @@
 #ifndef _NET_BATMAN_ADV_BITARRAY_H_
 #define _NET_BATMAN_ADV_BITARRAY_H_
 
+#include "main.h"
+
+#include <linux/bitops.h>
+#include <linux/compiler.h>
+#include <linux/types.h>
+
 /* Returns 1 if the corresponding bit in the given seq_bits indicates true
  * and curr_seqno is within range of last_seqno. Otherwise returns 0.
  */
diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c
index 6927589..30ebbdc 100644
=2D-- a/bridge_loop_avoidance.c
+++ b/bridge_loop_avoidance.c
@@ -15,19 +15,42 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
=2D#include "main.h"
=2D#include "hash.h"
=2D#include "hard-interface.h"
=2D#include "originator.h"
 #include "bridge_loop_avoidance.h"
=2D#include "translation-table.h"
=2D#include "send.h"
+#include "main.h"
 
=2D#include <linux/etherdevice.h>
+#include <linux/atomic.h>
+#include <linux/byteorder/generic.h>
+#include <linux/compiler.h>
 #include <linux/crc16.h>
+#include <linux/errno.h>
+#include <linux/etherdevice.h>
+#include <linux/fs.h>
 #include <linux/if_arp.h>
=2D#include <net/arp.h>
+#include <linux/if_ether.h>
 #include <linux/if_vlan.h>
+#include <linux/jhash.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/lockdep.h>
+#include <linux/netdevice.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/workqueue.h>
+#include <net/arp.h>
+
+#include "hard-interface.h"
+#include "hash.h"
+#include "originator.h"
+#include "packet.h"
+#include "translation-table.h"
+#include "types.h"
 
 static const uint8_t batadv_announce_mac[4] = {0x43, 0x05, 0x43, 0x05};
 
diff --git a/bridge_loop_avoidance.h b/bridge_loop_avoidance.h
index 43c985d..1318805 100644
=2D-- a/bridge_loop_avoidance.h
+++ b/bridge_loop_avoidance.h
@@ -18,6 +18,16 @@
 #ifndef _NET_BATMAN_ADV_BLA_H_
 #define _NET_BATMAN_ADV_BLA_H_
 
+#include "main.h"
+
+#include <linux/types.h>
+
+struct batadv_hard_iface;
+struct batadv_orig_node;
+struct batadv_priv;
+struct seq_file;
+struct sk_buff;
+
 #ifdef CONFIG_BATMAN_ADV_BLA
 int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
 		  unsigned short vid, bool is_bcast);
diff --git a/debugfs.c b/debugfs.c
index 9d337b5..9d23aff 100644
=2D-- a/debugfs.c
+++ b/debugfs.c
@@ -15,21 +15,30 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "debugfs.h"
 #include "main.h"
 
 #include <linux/debugfs.h>
+#include <linux/device.h>
+#include <linux/errno.h>
+#include <linux/export.h>
+#include <linux/fs.h>
+#include <linux/netdevice.h>
+#include <linux/printk.h>
+#include <linux/seq_file.h>
+#include <linux/stat.h>
+#include <linux/stddef.h>
+#include <linux/stringify.h>
+#include <linux/sysfs.h>
 
=2D#include "debugfs.h"
=2D#include "translation-table.h"
=2D#include "originator.h"
=2D#include "hard-interface.h"
=2D#include "gateway_common.h"
=2D#include "gateway_client.h"
=2D#include "soft-interface.h"
=2D#include "icmp_socket.h"
 #include "bridge_loop_avoidance.h"
 #include "distributed-arp-table.h"
+#include "gateway_client.h"
+#include "icmp_socket.h"
 #include "network-coding.h"
+#include "originator.h"
+#include "translation-table.h"
+#include "types.h"
 
 static struct dentry *batadv_debugfs;
 
diff --git a/debugfs.h b/debugfs.h
index 421f092..ce085b8 100644
=2D-- a/debugfs.h
+++ b/debugfs.h
@@ -18,6 +18,13 @@
 #ifndef _NET_BATMAN_ADV_DEBUGFS_H_
 #define _NET_BATMAN_ADV_DEBUGFS_H_
 
+#include "main.h"
+
+#include <linux/kconfig.h>
+
+struct batadv_hard_iface;
+struct net_device;
+
 #define BATADV_DEBUGFS_SUBDIR "batman_adv"
 
 #if IS_ENABLED(CONFIG_DEBUG_FS)
diff --git a/distributed-arp-table.c b/distributed-arp-table.c
index 107ad62..1339985 100644
=2D-- a/distributed-arp-table.c
+++ b/distributed-arp-table.c
@@ -15,19 +15,38 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
=2D#include <linux/if_ether.h>
+#include "distributed-arp-table.h"
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/byteorder/generic.h>
+#include <linux/errno.h>
+#include <linux/etherdevice.h>
+#include <linux/fs.h>
 #include <linux/if_arp.h>
+#include <linux/if_ether.h>
 #include <linux/if_vlan.h>
+#include <linux/in.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/workqueue.h>
 #include <net/arp.h>
 
=2D#include "main.h"
=2D#include "hash.h"
=2D#include "distributed-arp-table.h"
 #include "hard-interface.h"
+#include "hash.h"
 #include "originator.h"
 #include "send.h"
=2D#include "types.h"
 #include "translation-table.h"
+#include "types.h"
 
 static void batadv_dat_purge(struct work_struct *work);
 
diff --git a/distributed-arp-table.h b/distributed-arp-table.h
index 2fe0764..fed3ff2 100644
=2D-- a/distributed-arp-table.h
+++ b/distributed-arp-table.h
@@ -18,12 +18,20 @@
 #ifndef _NET_BATMAN_ADV_DISTRIBUTED_ARP_TABLE_H_
 #define _NET_BATMAN_ADV_DISTRIBUTED_ARP_TABLE_H_
 
=2D#ifdef CONFIG_BATMAN_ADV_DAT
+#include "main.h"
+
+#include <linux/compiler.h>
+#include <linux/netdevice.h>
+#include <linux/types.h>
 
=2D#include "types.h"
 #include "originator.h"
+#include "packet.h"
+#include "types.h"
+
+struct seq_file;
+struct sk_buff;
 
=2D#include <linux/if_arp.h>
+#ifdef CONFIG_BATMAN_ADV_DAT
 
 /* BATADV_DAT_ADDR_MAX - maximum address value in the DHT space */
 #define BATADV_DAT_ADDR_MAX ((batadv_dat_addr_t)~(batadv_dat_addr_t)0)
diff --git a/fragmentation.c b/fragmentation.c
index 9e06457..124356a 100644
=2D-- a/fragmentation.c
+++ b/fragmentation.c
@@ -15,12 +15,28 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
=2D#include "main.h"
 #include "fragmentation.h"
=2D#include "send.h"
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/byteorder/generic.h>
+#include <linux/etherdevice.h>
+#include <linux/fs.h>
+#include <linux/if_ether.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/netdevice.h>
+#include <linux/pkt_sched.h>
+#include <linux/skbuff.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/string.h>
+
+#include "hard-interface.h"
 #include "originator.h"
+#include "packet.h"
 #include "routing.h"
=2D#include "hard-interface.h"
+#include "send.h"
 #include "soft-interface.h"
 
 /**
diff --git a/fragmentation.h b/fragmentation.h
index d848cf6..446cdee 100644
=2D-- a/fragmentation.h
+++ b/fragmentation.h
@@ -18,6 +18,17 @@
 #ifndef _NET_BATMAN_ADV_FRAGMENTATION_H_
 #define _NET_BATMAN_ADV_FRAGMENTATION_H_
 
+#include "main.h"
+
+#include <linux/compiler.h>
+#include <linux/list.h>
+#include <linux/stddef.h>
+#include <linux/types.h>
+
+#include "types.h"
+
+struct sk_buff;
+
 void batadv_frag_purge_orig(struct batadv_orig_node *orig,
 			    bool (*check_cb)(struct batadv_frag_table_entry *));
 bool batadv_frag_skb_fwd(struct sk_buff *skb,
diff --git a/gateway_client.c b/gateway_client.c
index 090828c..9b2ef82 100644
=2D-- a/gateway_client.c
+++ b/gateway_client.c
@@ -15,18 +15,38 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
=2D#include "main.h"
=2D#include "sysfs.h"
 #include "gateway_client.h"
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/byteorder/generic.h>
+#include <linux/etherdevice.h>
+#include <linux/fs.h>
+#include <linux/if_ether.h>
+#include <linux/if_vlan.h>
+#include <linux/in.h>
+#include <linux/ip.h>
+#include <linux/ipv6.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/netdevice.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+#include <linux/udp.h>
+
 #include "gateway_common.h"
 #include "hard-interface.h"
 #include "originator.h"
=2D#include "translation-table.h"
+#include "packet.h"
 #include "routing.h"
=2D#include <linux/ip.h>
=2D#include <linux/ipv6.h>
=2D#include <linux/udp.h>
=2D#include <linux/if_vlan.h>
+#include "sysfs.h"
+#include "translation-table.h"
 
 /* These are the offsets of the "hw type" and "hw address length" in the dhcp
  * packet starting at the beginning of the dhcp header
diff --git a/gateway_client.h b/gateway_client.h
index 7ee53bb..588122b 100644
=2D-- a/gateway_client.h
+++ b/gateway_client.h
@@ -18,6 +18,16 @@
 #ifndef _NET_BATMAN_ADV_GATEWAY_CLIENT_H_
 #define _NET_BATMAN_ADV_GATEWAY_CLIENT_H_
 
+#include "main.h"
+
+#include <linux/types.h>
+
+#include "types.h"
+
+struct batadv_tvlv_gateway_data;
+struct seq_file;
+struct sk_buff;
+
 void batadv_gw_check_client_stop(struct batadv_priv *bat_priv);
 void batadv_gw_reselect(struct batadv_priv *bat_priv);
 void batadv_gw_election(struct batadv_priv *bat_priv);
diff --git a/gateway_common.c b/gateway_common.c
index 6f5e621..636d59c 100644
=2D-- a/gateway_common.c
+++ b/gateway_common.c
@@ -15,9 +15,19 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
=2D#include "main.h"
 #include "gateway_common.h"
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/byteorder/generic.h>
+#include <linux/kernel.h>
+#include <linux/netdevice.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+
 #include "gateway_client.h"
+#include "packet.h"
+#include "types.h"
 
 /**
  * batadv_parse_gw_bandwidth - parse supplied string buffer to extract download
diff --git a/gateway_common.h b/gateway_common.h
index aa51165..2020c0f 100644
=2D-- a/gateway_common.h
+++ b/gateway_common.h
@@ -18,6 +18,13 @@
 #ifndef _NET_BATMAN_ADV_GATEWAY_COMMON_H_
 #define _NET_BATMAN_ADV_GATEWAY_COMMON_H_
 
+#include "main.h"
+
+#include <linux/types.h>
+
+struct batadv_priv;
+struct net_device;
+
 enum batadv_gw_modes {
 	BATADV_GW_MODE_OFF,
 	BATADV_GW_MODE_CLIENT,
diff --git a/hard-interface.c b/hard-interface.c
index fbda6b5..380e025 100644
=2D-- a/hard-interface.c
+++ b/hard-interface.c
@@ -15,22 +15,36 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
=2D#include "main.h"
=2D#include "distributed-arp-table.h"
 #include "hard-interface.h"
=2D#include "soft-interface.h"
=2D#include "send.h"
=2D#include "translation-table.h"
=2D#include "routing.h"
=2D#include "sysfs.h"
=2D#include "debugfs.h"
=2D#include "originator.h"
=2D#include "hash.h"
=2D#include "bridge_loop_avoidance.h"
=2D#include "gateway_client.h"
+#include "main.h"
 
+#include <linux/bug.h>
+#include <linux/byteorder/generic.h>
+#include <linux/errno.h>
+#include <linux/fs.h>
 #include <linux/if_arp.h>
 #include <linux/if_ether.h>
+#include <linux/if.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/netdevice.h>
+#include <linux/printk.h>
+#include <linux/rculist.h>
+#include <linux/rtnetlink.h>
+#include <linux/slab.h>
+#include <linux/workqueue.h>
+#include <net/net_namespace.h>
+
+#include "bridge_loop_avoidance.h"
+#include "debugfs.h"
+#include "distributed-arp-table.h"
+#include "gateway_client.h"
+#include "originator.h"
+#include "packet.h"
+#include "send.h"
+#include "soft-interface.h"
+#include "sysfs.h"
+#include "translation-table.h"
 
 void batadv_hardif_free_rcu(struct rcu_head *rcu)
 {
diff --git a/hard-interface.h b/hard-interface.h
index 1918cd5..004f859 100644
=2D-- a/hard-interface.h
+++ b/hard-interface.h
@@ -18,6 +18,19 @@
 #ifndef _NET_BATMAN_ADV_HARD_INTERFACE_H_
 #define _NET_BATMAN_ADV_HARD_INTERFACE_H_
 
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/compiler.h>
+#include <linux/notifier.h>
+#include <linux/rcupdate.h>
+#include <linux/stddef.h>
+#include <linux/types.h>
+
+#include "types.h"
+
+struct net_device;
+
 enum batadv_hard_if_state {
 	BATADV_IF_NOT_IN_USE,
 	BATADV_IF_TO_BE_REMOVED,
diff --git a/hash.c b/hash.c
index 7c1c630..0532dc9 100644
=2D-- a/hash.c
+++ b/hash.c
@@ -15,8 +15,12 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
=2D#include "main.h"
 #include "hash.h"
+#include "main.h"
+
+#include <linux/fs.h>
+#include <linux/lockdep.h>
+#include <linux/slab.h>
 
 /* clears the hash */
 static void batadv_hash_init(struct batadv_hashtable *hash)
diff --git a/hash.h b/hash.h
index a1d0980..b7cc418 100644
=2D-- a/hash.h
+++ b/hash.h
@@ -18,7 +18,16 @@
 #ifndef _NET_BATMAN_ADV_HASH_H_
 #define _NET_BATMAN_ADV_HASH_H_
 
+#include "main.h"
+
+#include <linux/compiler.h>
 #include <linux/list.h>
+#include <linux/rculist.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+#include <linux/types.h>
+
+struct lock_class_key;
 
 /* callback to a compare function.  should compare 2 element datas for their
  * keys, return 0 if same and not 0 if not same
diff --git a/icmp_socket.c b/icmp_socket.c
index 161ef8f..4bab8ab 100644
=2D-- a/icmp_socket.c
+++ b/icmp_socket.c
@@ -15,14 +15,39 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "icmp_socket.h"
 #include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/compiler.h>
 #include <linux/debugfs.h>
+#include <linux/errno.h>
+#include <linux/etherdevice.h>
+#include <linux/export.h>
+#include <linux/fcntl.h>
+#include <linux/fs.h>
+#include <linux/if_ether.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/module.h>
+#include <linux/netdevice.h>
+#include <linux/pkt_sched.h>
+#include <linux/poll.h>
+#include <linux/printk.h>
+#include <linux/skbuff.h>
 #include <linux/slab.h>
=2D#include "icmp_socket.h"
=2D#include "send.h"
=2D#include "hash.h"
=2D#include "originator.h"
+#include <linux/spinlock.h>
+#include <linux/stat.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/uaccess.h>
+#include <linux/wait.h>
+
 #include "hard-interface.h"
+#include "originator.h"
+#include "packet.h"
+#include "send.h"
+#include "types.h"
 
 static struct batadv_socket_client *batadv_socket_client_hash[256];
 
diff --git a/icmp_socket.h b/icmp_socket.h
index 0c33950..0189910 100644
=2D-- a/icmp_socket.h
+++ b/icmp_socket.h
@@ -18,6 +18,13 @@
 #ifndef _NET_BATMAN_ADV_ICMP_SOCKET_H_
 #define _NET_BATMAN_ADV_ICMP_SOCKET_H_
 
+#include "main.h"
+
+#include <linux/types.h>
+
+struct batadv_icmp_header;
+struct batadv_priv;
+
 #define BATADV_ICMP_SOCKET "socket"
 
 void batadv_socket_init(void);
diff --git a/main.c b/main.c
index 766ab33..dd159b1 100644
=2D-- a/main.c
+++ b/main.c
@@ -15,31 +15,54 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/bug.h>
+#include <linux/byteorder/generic.h>
 #include <linux/crc32c.h>
=2D#include <linux/highmem.h>
+#include <linux/errno.h>
+#include <linux/fs.h>
+#include <linux/if_ether.h>
 #include <linux/if_vlan.h>
=2D#include <net/ip.h>
=2D#include <net/ipv6.h>
+#include <linux/init.h>
+#include <linux/ip.h>
+#include <linux/ipv6.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/netdevice.h>
+#include <linux/pkt_sched.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/workqueue.h>
 #include <net/dsfield.h>
=2D#include "main.h"
=2D#include "sysfs.h"
+#include <net/rtnetlink.h>
+
+#include "bat_algo.h"
+#include "bridge_loop_avoidance.h"
 #include "debugfs.h"
+#include "distributed-arp-table.h"
+#include "gateway_client.h"
+#include "gateway_common.h"
+#include "hard-interface.h"
+#include "icmp_socket.h"
+#include "multicast.h"
+#include "network-coding.h"
+#include "originator.h"
+#include "packet.h"
 #include "routing.h"
 #include "send.h"
=2D#include "originator.h"
 #include "soft-interface.h"
=2D#include "icmp_socket.h"
 #include "translation-table.h"
=2D#include "hard-interface.h"
=2D#include "gateway_client.h"
=2D#include "bridge_loop_avoidance.h"
=2D#include "distributed-arp-table.h"
=2D#include "multicast.h"
=2D#include "gateway_common.h"
=2D#include "hash.h"
=2D#include "bat_algo.h"
=2D#include "network-coding.h"
=2D#include "fragmentation.h"
+#include "types.h"
 
 /* List manipulations on hardif_list have to be rtnl_lock()'ed,
  * list traversals just rcu-locked
diff --git a/main.h b/main.h
index 569846b..0df62b8 100644
=2D-- a/main.h
+++ b/main.h
@@ -163,28 +163,27 @@ enum batadv_uev_type {
 
 /* Kernel headers */
 
=2D#include <linux/mutex.h>	/* mutex */
=2D#include <linux/module.h>	/* needed by all modules */
=2D#include <linux/netdevice.h>	/* netdevice */
=2D#include <linux/etherdevice.h>  /* ethernet address classification */
=2D#include <linux/if_ether.h>	/* ethernet header */
=2D#include <linux/poll.h>		/* poll_table */
=2D#include <linux/kthread.h>	/* kernel threads */
=2D#include <linux/pkt_sched.h>	/* schedule types */
=2D#include <linux/workqueue.h>	/* workqueue */
+#include <linux/bitops.h>
+#include <linux/compiler.h>
+#include <linux/cpumask.h>
+#include <linux/etherdevice.h>
+#include <linux/printk.h>
+#include <linux/types.h>
 #include <linux/percpu.h>
=2D#include <linux/slab.h>
=2D#include <linux/jhash.h>
=2D#include <net/sock.h>		/* struct sock */
=2D#include <net/addrconf.h>	/* ipv6 address stuff */
=2D#include <linux/ip.h>
=2D#include <net/rtnetlink.h>
 #include <linux/jiffies.h>
=2D#include <linux/seq_file.h>
 #include <linux/if_vlan.h>
+
 #include "compat.h"
 
=2D#include "types.h"
+struct batadv_algo_ops;
+struct batadv_hard_iface;
+struct batadv_orig_node;
+struct batadv_priv;
+struct batadv_ogm_packet;
+struct net_device;
+struct packet_type;
+struct seq_file;
+struct sk_buff;
 
 #define BATADV_PRINT_VID(vid) (vid & BATADV_VLAN_HAS_TAG ? \
 			       (int)(vid & VLAN_VID_MASK) : -1)
diff --git a/multicast.c b/multicast.c
index b24e4bb..e1b50b5 100644
=2D-- a/multicast.c
+++ b/multicast.c
@@ -15,11 +15,35 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
=2D#include "main.h"
 #include "multicast.h"
=2D#include "originator.h"
=2D#include "hard-interface.h"
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/byteorder/generic.h>
+#include <linux/errno.h>
+#include <linux/etherdevice.h>
+#include <linux/fs.h>
+#include <linux/if_ether.h>
+#include <linux/in6.h>
+#include <linux/in.h>
+#include <linux/ip.h>
+#include <linux/ipv6.h>
+#include <linux/list.h>
+#include <linux/netdevice.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/skbuff.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/types.h>
+#include <net/addrconf.h>
+#include <net/ipv6.h>
+
+#include "packet.h"
 #include "translation-table.h"
+#include "types.h"
 
 /**
  * batadv_mcast_mla_softif_get - get softif multicast listeners
diff --git a/multicast.h b/multicast.h
index 3a44ebd..ae04f1e 100644
=2D-- a/multicast.h
+++ b/multicast.h
@@ -18,6 +18,12 @@
 #ifndef _NET_BATMAN_ADV_MULTICAST_H_
 #define _NET_BATMAN_ADV_MULTICAST_H_
 
+#include "main.h"
+
+struct batadv_orig_node;
+struct batadv_priv;
+struct sk_buff;
+
 /**
  * batadv_forw_mode - the way a packet should be forwarded as
  * @BATADV_FORW_ALL: forward the packet to all nodes (currently via classic
diff --git a/network-coding.c b/network-coding.c
index d128c3b..f72108b 100644
=2D-- a/network-coding.c
+++ b/network-coding.c
@@ -15,15 +15,45 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "network-coding.h"
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/byteorder/generic.h>
+#include <linux/compiler.h>
 #include <linux/debugfs.h>
+#include <linux/errno.h>
+#include <linux/etherdevice.h>
+#include <linux/fs.h>
+#include <linux/if_ether.h>
+#include <linux/if_packet.h>
+#include <linux/init.h>
+#include <linux/jhash.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/lockdep.h>
+#include <linux/netdevice.h>
+#include <linux/printk.h>
+#include <linux/random.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/stat.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/workqueue.h>
 
=2D#include "main.h"
+#include "hard-interface.h"
 #include "hash.h"
=2D#include "network-coding.h"
=2D#include "send.h"
 #include "originator.h"
=2D#include "hard-interface.h"
+#include "packet.h"
 #include "routing.h"
+#include "send.h"
+#include "types.h"
 
 static struct lock_class_key batadv_nc_coding_hash_lock_class_key;
 static struct lock_class_key batadv_nc_decoding_hash_lock_class_key;
diff --git a/network-coding.h b/network-coding.h
index 358c0d6..4008ec2 100644
=2D-- a/network-coding.h
+++ b/network-coding.h
@@ -18,6 +18,19 @@
 #ifndef _NET_BATMAN_ADV_NETWORK_CODING_H_
 #define _NET_BATMAN_ADV_NETWORK_CODING_H_
 
+#include "main.h"
+
+#include <linux/types.h>
+
+struct batadv_nc_node;
+struct batadv_neigh_node;
+struct batadv_ogm_packet;
+struct batadv_orig_node;
+struct batadv_priv;
+struct net_device;
+struct seq_file;
+struct sk_buff;
+
 #ifdef CONFIG_BATMAN_ADV_NC
 
 void batadv_nc_status_update(struct net_device *net_dev);
diff --git a/originator.c b/originator.c
index 9e04e60..684536e 100644
=2D-- a/originator.c
+++ b/originator.c
@@ -15,19 +15,31 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "originator.h"
 #include "main.h"
+
+#include <linux/errno.h>
+#include <linux/etherdevice.h>
+#include <linux/fs.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/lockdep.h>
+#include <linux/netdevice.h>
+#include <linux/seq_file.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/workqueue.h>
+
 #include "distributed-arp-table.h"
=2D#include "originator.h"
=2D#include "hash.h"
=2D#include "translation-table.h"
=2D#include "routing.h"
+#include "fragmentation.h"
 #include "gateway_client.h"
 #include "hard-interface.h"
=2D#include "soft-interface.h"
=2D#include "bridge_loop_avoidance.h"
=2D#include "network-coding.h"
=2D#include "fragmentation.h"
+#include "hash.h"
 #include "multicast.h"
+#include "network-coding.h"
+#include "routing.h"
+#include "translation-table.h"
 
 /* hash class keys */
 static struct lock_class_key batadv_orig_hash_lock_class_key;
diff --git a/originator.h b/originator.h
index a179c03..a966394 100644
=2D-- a/originator.h
+++ b/originator.h
@@ -18,7 +18,21 @@
 #ifndef _NET_BATMAN_ADV_ORIGINATOR_H_
 #define _NET_BATMAN_ADV_ORIGINATOR_H_
 
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/compiler.h>
+#include <linux/if_ether.h>
+#include <linux/jhash.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/stddef.h>
+#include <linux/types.h>
+
 #include "hash.h"
+#include "types.h"
+
+struct seq_file;
 
 int batadv_compare_orig(const struct hlist_node *node, const void *data2);
 int batadv_originator_init(struct batadv_priv *bat_priv);
diff --git a/packet.h b/packet.h
index b81fbbf..27b4003 100644
=2D-- a/packet.h
+++ b/packet.h
@@ -18,6 +18,11 @@
 #ifndef _NET_BATMAN_ADV_PACKET_H_
 #define _NET_BATMAN_ADV_PACKET_H_
 
+#include <asm/byteorder.h>
+#include <linux/bitops.h>
+#include <linux/if_ether.h>
+#include <linux/types.h>
+
 /**
  * enum batadv_packettype - types for batman-adv encapsulated packets
  * @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV
diff --git a/routing.c b/routing.c
index da83982..ea6fa6e 100644
=2D-- a/routing.c
+++ b/routing.c
@@ -15,20 +15,37 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
=2D#include "main.h"
 #include "routing.h"
=2D#include "send.h"
=2D#include "soft-interface.h"
=2D#include "hard-interface.h"
=2D#include "icmp_socket.h"
=2D#include "translation-table.h"
=2D#include "originator.h"
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/byteorder/generic.h>
+#include <linux/compiler.h>
+#include <linux/errno.h>
+#include <linux/etherdevice.h>
+#include <linux/if_ether.h>
+#include <linux/jiffies.h>
+#include <linux/netdevice.h>
+#include <linux/printk.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/skbuff.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+
+#include "bitarray.h"
 #include "bridge_loop_avoidance.h"
 #include "distributed-arp-table.h"
=2D#include "network-coding.h"
 #include "fragmentation.h"
=2D
=2D#include <linux/if_vlan.h>
+#include "hard-interface.h"
+#include "icmp_socket.h"
+#include "network-coding.h"
+#include "originator.h"
+#include "packet.h"
+#include "send.h"
+#include "soft-interface.h"
+#include "translation-table.h"
+#include "types.h"
 
 static int batadv_route_unicast_packet(struct sk_buff *skb,
 				       struct batadv_hard_iface *recv_if);
diff --git a/routing.h b/routing.h
index 557d3d1..f8a9e14 100644
=2D-- a/routing.h
+++ b/routing.h
@@ -18,6 +18,16 @@
 #ifndef _NET_BATMAN_ADV_ROUTING_H_
 #define _NET_BATMAN_ADV_ROUTING_H_
 
+#include "main.h"
+
+#include <linux/types.h>
+
+struct batadv_hard_iface;
+struct batadv_neigh_node;
+struct batadv_orig_node;
+struct batadv_priv;
+struct sk_buff;
+
 bool batadv_check_management_packet(struct sk_buff *skb,
 				    struct batadv_hard_iface *hard_iface,
 				    int header_len);
diff --git a/send.c b/send.c
index d27161e..27d8ee3 100644
=2D-- a/send.c
+++ b/send.c
@@ -15,19 +15,38 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "send.h"
 #include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/byteorder/generic.h>
+#include <linux/etherdevice.h>
+#include <linux/fs.h>
+#include <linux/if_ether.h>
+#include <linux/if.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/netdevice.h>
+#include <linux/printk.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/skbuff.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+#include <linux/workqueue.h>
+
 #include "distributed-arp-table.h"
=2D#include "send.h"
=2D#include "routing.h"
=2D#include "translation-table.h"
=2D#include "soft-interface.h"
=2D#include "hard-interface.h"
=2D#include "gateway_common.h"
+#include "fragmentation.h"
 #include "gateway_client.h"
=2D#include "originator.h"
+#include "hard-interface.h"
 #include "network-coding.h"
=2D#include "fragmentation.h"
=2D#include "multicast.h"
+#include "originator.h"
+#include "routing.h"
+#include "soft-interface.h"
+#include "translation-table.h"
+#include "types.h"
 
 static void batadv_send_outstanding_bcast_packet(struct work_struct *work);
 
diff --git a/send.h b/send.h
index 38d0ec1..de85f2f 100644
=2D-- a/send.h
+++ b/send.h
@@ -18,6 +18,19 @@
 #ifndef _NET_BATMAN_ADV_SEND_H_
 #define _NET_BATMAN_ADV_SEND_H_
 
+#include "main.h"
+
+#include <linux/compiler.h>
+#include <linux/types.h>
+
+#include "packet.h"
+
+struct batadv_hard_iface;
+struct batadv_orig_node;
+struct batadv_priv;
+struct sk_buff;
+struct work_struct;
+
 int batadv_send_skb_packet(struct sk_buff *skb,
 			   struct batadv_hard_iface *hard_iface,
 			   const uint8_t *dst_addr);
diff --git a/soft-interface.c b/soft-interface.c
index 78d63e3..57e621b 100644
=2D-- a/soft-interface.c
+++ b/soft-interface.c
@@ -15,26 +15,51 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
=2D#include "main.h"
 #include "soft-interface.h"
=2D#include "hard-interface.h"
=2D#include "distributed-arp-table.h"
=2D#include "routing.h"
=2D#include "send.h"
=2D#include "debugfs.h"
=2D#include "translation-table.h"
=2D#include "hash.h"
=2D#include "gateway_common.h"
=2D#include "gateway_client.h"
=2D#include "sysfs.h"
=2D#include "originator.h"
=2D#include <linux/slab.h>
=2D#include <linux/ethtool.h>
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/byteorder/generic.h>
+#include <linux/cache.h>
+#include <linux/compiler.h>
+#include <linux/errno.h>
 #include <linux/etherdevice.h>
+#include <linux/ethtool.h>
+#include <linux/fs.h>
+#include <linux/if_ether.h>
 #include <linux/if_vlan.h>
=2D#include "multicast.h"
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/lockdep.h>
+#include <linux/netdevice.h>
+#include <linux/percpu.h>
+#include <linux/printk.h>
+#include <linux/random.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/skbuff.h>
+#include <linux/slab.h>
+#include <linux/socket.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/types.h>
+#include <linux/workqueue.h>
+
 #include "bridge_loop_avoidance.h"
+#include "debugfs.h"
+#include "distributed-arp-table.h"
+#include "gateway_client.h"
+#include "gateway_common.h"
+#include "hard-interface.h"
+#include "multicast.h"
 #include "network-coding.h"
+#include "packet.h"
+#include "send.h"
+#include "sysfs.h"
+#include "translation-table.h"
+#include "types.h"
 
 static int batadv_get_settings(struct net_device *dev, struct ethtool_cmd *cmd);
 static void batadv_get_drvinfo(struct net_device *dev,
diff --git a/soft-interface.h b/soft-interface.h
index dbab22f..e1e8bb9 100644
=2D-- a/soft-interface.h
+++ b/soft-interface.h
@@ -18,6 +18,17 @@
 #ifndef _NET_BATMAN_ADV_SOFT_INTERFACE_H_
 #define _NET_BATMAN_ADV_SOFT_INTERFACE_H_
 
+#include "main.h"
+
+#include <net/rtnetlink.h>
+
+struct batadv_hard_iface;
+struct batadv_orig_node;
+struct batadv_priv;
+struct batadv_softif_vlan;
+struct net_device;
+struct sk_buff;
+
 int batadv_skb_head_push(struct sk_buff *skb, unsigned int len);
 void batadv_interface_rx(struct net_device *soft_iface,
 			 struct sk_buff *skb, struct batadv_hard_iface *recv_if,
diff --git a/sysfs.c b/sysfs.c
index 97a6192..3cb2f13 100644
=2D-- a/sysfs.c
+++ b/sysfs.c
@@ -15,16 +15,36 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
=2D#include "main.h"
 #include "sysfs.h"
=2D#include "translation-table.h"
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/compiler.h>
+#include <linux/device.h>
+#include <linux/errno.h>
+#include <linux/fs.h>
+#include <linux/if.h>
+#include <linux/if_vlan.h>
+#include <linux/kernel.h>
+#include <linux/netdevice.h>
+#include <linux/printk.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/rtnetlink.h>
+#include <linux/slab.h>
+#include <linux/stat.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/stringify.h>
+
 #include "distributed-arp-table.h"
=2D#include "network-coding.h"
=2D#include "originator.h"
+#include "gateway_client.h"
+#include "gateway_common.h"
 #include "hard-interface.h"
+#include "network-coding.h"
+#include "packet.h"
 #include "soft-interface.h"
=2D#include "gateway_common.h"
=2D#include "gateway_client.h"
+#include "types.h"
 
 static struct net_device *batadv_kobj_to_netdev(struct kobject *obj)
 {
diff --git a/sysfs.h b/sysfs.h
index b715b60..bc1f6df 100644
=2D-- a/sysfs.h
+++ b/sysfs.h
@@ -18,6 +18,16 @@
 #ifndef _NET_BATMAN_ADV_SYSFS_H_
 #define _NET_BATMAN_ADV_SYSFS_H_
 
+#include "main.h"
+
+#include <linux/sysfs.h>
+#include <linux/types.h>
+
+struct batadv_priv;
+struct batadv_softif_vlan;
+struct kobject;
+struct net_device;
+
 #define BATADV_SYSFS_IF_MESH_SUBDIR "mesh"
 #define BATADV_SYSFS_IF_BAT_SUBDIR "batman_adv"
 /**
diff --git a/translation-table.c b/translation-table.c
index b20812b..74ec17c 100644
=2D-- a/translation-table.c
+++ b/translation-table.c
@@ -15,18 +15,42 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
=2D#include "main.h"
 #include "translation-table.h"
=2D#include "soft-interface.h"
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/bug.h>
+#include <linux/byteorder/generic.h>
+#include <linux/compiler.h>
+#include <linux/crc32c.h>
+#include <linux/errno.h>
+#include <linux/etherdevice.h>
+#include <linux/fs.h>
+#include <linux/if_ether.h>
+#include <linux/jhash.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/lockdep.h>
+#include <linux/netdevice.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/seq_file.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/workqueue.h>
+#include <net/net_namespace.h>
+
+#include "bridge_loop_avoidance.h"
 #include "hard-interface.h"
=2D#include "send.h"
 #include "hash.h"
=2D#include "originator.h"
=2D#include "routing.h"
=2D#include "bridge_loop_avoidance.h"
 #include "multicast.h"
=2D
=2D#include <linux/crc32c.h>
+#include "originator.h"
+#include "packet.h"
+#include "soft-interface.h"
+#include "types.h"
 
 /* hash class keys */
 static struct lock_class_key batadv_tt_local_hash_lock_class_key;
diff --git a/translation-table.h b/translation-table.h
index ad84d7b..3c2b868 100644
=2D-- a/translation-table.h
+++ b/translation-table.h
@@ -18,6 +18,15 @@
 #ifndef _NET_BATMAN_ADV_TRANSLATION_TABLE_H_
 #define _NET_BATMAN_ADV_TRANSLATION_TABLE_H_
 
+#include "main.h"
+
+#include <linux/types.h>
+
+struct batadv_orig_node;
+struct batadv_priv;
+struct net_device;
+struct seq_file;
+
 int batadv_tt_init(struct batadv_priv *bat_priv);
 bool batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
 			 unsigned short vid, int ifindex, uint32_t mark);
diff --git a/types.h b/types.h
index b72fa7b..c5f2424 100644
=2D-- a/types.h
+++ b/types.h
@@ -18,9 +18,20 @@
 #ifndef _NET_BATMAN_ADV_TYPES_H_
 #define _NET_BATMAN_ADV_TYPES_H_
 
+#include "main.h"
+
+#include <linux/bitops.h>
+#include <linux/compiler.h>
+#include <linux/if_ether.h>
+#include <linux/netdevice.h>
+#include <linux/spinlock.h>
+#include <linux/types.h>
+#include <linux/wait.h>
+#include <linux/workqueue.h>
+
 #include "packet.h"
=2D#include "bitarray.h"
=2D#include <linux/kernel.h>
+
+struct seq_file;
 
 #ifdef CONFIG_BATMAN_ADV_DAT
 
=2D- 
2.1.4


=2D-nextPart3922123.nRKsmd8L0B--
This is a multi-part message in MIME format.

[-- Attachment #1.2: Type: text/plain, Size: 419 bytes --]

On Friday 26 December 2014 12:41:17 Markus Pargmann wrote:
> Markus Pargmann (26):
[...]
>   batman-adv: packet.h, add some missing includes
>   batman-adv: types.h, add missing include

Just went through the includes and noticed that a lot more are missing (also 
in the files which you are already touched). I have attached the current state 
of my analysis so you can compare it with your notes.

Kind regards,
	Sven

[-- Attachment #1.3: 0001-batman-adv-Add-required-includes-previously-used-thr.patch --]
[-- Type: text/x-patch, Size: 38444 bytes --]

From a99b635a3f9dcf745ca6ad00323fa4aa6150c3c1 Mon Sep 17 00:00:00 2001
From: Sven Eckelmann <sven@narfation.org>
Date: Sun, 22 Mar 2015 01:03:04 +0100
Subject: [RFCv0] batman-adv: Add required includes previously used through
 transient includes

TODO:
 * write something about bad transient includes
 * write about the four include/forward declaration sections
 
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 bat_iv_ogm.c            | 42 ++++++++++++++++++++++++++++++------
 bitarray.c              |  4 ++--
 bitarray.h              |  6 ++++++
 bridge_loop_avoidance.c | 39 ++++++++++++++++++++++++++-------
 bridge_loop_avoidance.h | 10 +++++++++
 debugfs.c               | 25 +++++++++++++++-------
 debugfs.h               |  7 ++++++
 distributed-arp-table.c | 29 ++++++++++++++++++++-----
 distributed-arp-table.h | 14 +++++++++---
 fragmentation.c         | 22 ++++++++++++++++---
 fragmentation.h         | 11 ++++++++++
 gateway_client.c        | 34 +++++++++++++++++++++++------
 gateway_client.h        | 10 +++++++++
 gateway_common.c        | 12 ++++++++++-
 gateway_common.h        |  7 ++++++
 hard-interface.c        | 38 ++++++++++++++++++++++-----------
 hard-interface.h        | 13 +++++++++++
 hash.c                  |  6 +++++-
 hash.h                  |  9 ++++++++
 icmp_socket.c           | 33 ++++++++++++++++++++++++----
 icmp_socket.h           |  7 ++++++
 main.c                  | 57 ++++++++++++++++++++++++++++++++++---------------
 main.h                  | 33 ++++++++++++++--------------
 multicast.c             | 30 +++++++++++++++++++++++---
 multicast.h             |  6 ++++++
 network-coding.c        | 38 +++++++++++++++++++++++++++++----
 network-coding.h        | 13 +++++++++++
 originator.c            | 28 +++++++++++++++++-------
 originator.h            | 14 ++++++++++++
 packet.h                |  5 +++++
 routing.c               | 37 +++++++++++++++++++++++---------
 routing.h               | 10 +++++++++
 send.c                  | 37 ++++++++++++++++++++++++--------
 send.h                  | 13 +++++++++++
 soft-interface.c        | 55 ++++++++++++++++++++++++++++++++++-------------
 soft-interface.h        | 11 ++++++++++
 sysfs.c                 | 32 +++++++++++++++++++++------
 sysfs.h                 | 10 +++++++++
 translation-table.c     | 40 +++++++++++++++++++++++++++-------
 translation-table.h     |  9 ++++++++
 types.h                 | 15 +++++++++++--
 41 files changed, 712 insertions(+), 159 deletions(-)

diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 04bd220..41c7bd2 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -16,15 +16,45 @@
  */
 
 #include "main.h"
-#include "translation-table.h"
+
+#include <linux/atomic.h>
+#include <linux/bitmap.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
+#include <linux/byteorder/generic.h>
+#include <linux/cache.h>
+#include <linux/errno.h>
+#include <linux/etherdevice.h>
+#include <linux/fs.h>
+#include <linux/if_ether.h>
+#include <linux/init.h>
+#include <linux/jiffies.h>
+#include <linux/list.h>
+#include <linux/netdevice.h>
+#include <linux/pkt_sched.h>
+#include <linux/printk.h>
+#include <linux/random.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/types.h>
+#include <linux/workqueue.h>
+
+#include "bitarray.h"
+#include "hard-interface.h"
+#include "hash.h"
+#include "network-coding.h"
 #include "originator.h"
+#include "packet.h"
 #include "routing.h"
-#include "gateway_common.h"
-#include "gateway_client.h"
-#include "hard-interface.h"
 #include "send.h"
-#include "bat_algo.h"
-#include "network-coding.h"
+#include "translation-table.h"
+#include "types.h"
 
 /**
  * enum batadv_dup_status - duplicate status
diff --git a/bitarray.c b/bitarray.c
index e3da07a..ea483f5 100644
--- a/bitarray.c
+++ b/bitarray.c
@@ -15,10 +15,10 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "main.h"
 #include "bitarray.h"
+#include "main.h"
 
-#include <linux/bitops.h>
+#include <linux/bitmap.h>
 
 /* shift the packet array by n places. */
 static void batadv_bitmap_shift_left(unsigned long *seq_bits, int32_t n)
diff --git a/bitarray.h b/bitarray.h
index 2acaafe..0240fc2 100644
--- a/bitarray.h
+++ b/bitarray.h
@@ -18,6 +18,12 @@
 #ifndef _NET_BATMAN_ADV_BITARRAY_H_
 #define _NET_BATMAN_ADV_BITARRAY_H_
 
+#include "main.h"
+
+#include <linux/bitops.h>
+#include <linux/compiler.h>
+#include <linux/types.h>
+
 /* Returns 1 if the corresponding bit in the given seq_bits indicates true
  * and curr_seqno is within range of last_seqno. Otherwise returns 0.
  */
diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c
index 6927589..30ebbdc 100644
--- a/bridge_loop_avoidance.c
+++ b/bridge_loop_avoidance.c
@@ -15,19 +15,42 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "main.h"
-#include "hash.h"
-#include "hard-interface.h"
-#include "originator.h"
 #include "bridge_loop_avoidance.h"
-#include "translation-table.h"
-#include "send.h"
+#include "main.h"
 
-#include <linux/etherdevice.h>
+#include <linux/atomic.h>
+#include <linux/byteorder/generic.h>
+#include <linux/compiler.h>
 #include <linux/crc16.h>
+#include <linux/errno.h>
+#include <linux/etherdevice.h>
+#include <linux/fs.h>
 #include <linux/if_arp.h>
-#include <net/arp.h>
+#include <linux/if_ether.h>
 #include <linux/if_vlan.h>
+#include <linux/jhash.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/lockdep.h>
+#include <linux/netdevice.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/workqueue.h>
+#include <net/arp.h>
+
+#include "hard-interface.h"
+#include "hash.h"
+#include "originator.h"
+#include "packet.h"
+#include "translation-table.h"
+#include "types.h"
 
 static const uint8_t batadv_announce_mac[4] = {0x43, 0x05, 0x43, 0x05};
 
diff --git a/bridge_loop_avoidance.h b/bridge_loop_avoidance.h
index 43c985d..1318805 100644
--- a/bridge_loop_avoidance.h
+++ b/bridge_loop_avoidance.h
@@ -18,6 +18,16 @@
 #ifndef _NET_BATMAN_ADV_BLA_H_
 #define _NET_BATMAN_ADV_BLA_H_
 
+#include "main.h"
+
+#include <linux/types.h>
+
+struct batadv_hard_iface;
+struct batadv_orig_node;
+struct batadv_priv;
+struct seq_file;
+struct sk_buff;
+
 #ifdef CONFIG_BATMAN_ADV_BLA
 int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
 		  unsigned short vid, bool is_bcast);
diff --git a/debugfs.c b/debugfs.c
index 9d337b5..9d23aff 100644
--- a/debugfs.c
+++ b/debugfs.c
@@ -15,21 +15,30 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "debugfs.h"
 #include "main.h"
 
 #include <linux/debugfs.h>
+#include <linux/device.h>
+#include <linux/errno.h>
+#include <linux/export.h>
+#include <linux/fs.h>
+#include <linux/netdevice.h>
+#include <linux/printk.h>
+#include <linux/seq_file.h>
+#include <linux/stat.h>
+#include <linux/stddef.h>
+#include <linux/stringify.h>
+#include <linux/sysfs.h>
 
-#include "debugfs.h"
-#include "translation-table.h"
-#include "originator.h"
-#include "hard-interface.h"
-#include "gateway_common.h"
-#include "gateway_client.h"
-#include "soft-interface.h"
-#include "icmp_socket.h"
 #include "bridge_loop_avoidance.h"
 #include "distributed-arp-table.h"
+#include "gateway_client.h"
+#include "icmp_socket.h"
 #include "network-coding.h"
+#include "originator.h"
+#include "translation-table.h"
+#include "types.h"
 
 static struct dentry *batadv_debugfs;
 
diff --git a/debugfs.h b/debugfs.h
index 421f092..ce085b8 100644
--- a/debugfs.h
+++ b/debugfs.h
@@ -18,6 +18,13 @@
 #ifndef _NET_BATMAN_ADV_DEBUGFS_H_
 #define _NET_BATMAN_ADV_DEBUGFS_H_
 
+#include "main.h"
+
+#include <linux/kconfig.h>
+
+struct batadv_hard_iface;
+struct net_device;
+
 #define BATADV_DEBUGFS_SUBDIR "batman_adv"
 
 #if IS_ENABLED(CONFIG_DEBUG_FS)
diff --git a/distributed-arp-table.c b/distributed-arp-table.c
index 107ad62..1339985 100644
--- a/distributed-arp-table.c
+++ b/distributed-arp-table.c
@@ -15,19 +15,38 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <linux/if_ether.h>
+#include "distributed-arp-table.h"
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/byteorder/generic.h>
+#include <linux/errno.h>
+#include <linux/etherdevice.h>
+#include <linux/fs.h>
 #include <linux/if_arp.h>
+#include <linux/if_ether.h>
 #include <linux/if_vlan.h>
+#include <linux/in.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/workqueue.h>
 #include <net/arp.h>
 
-#include "main.h"
-#include "hash.h"
-#include "distributed-arp-table.h"
 #include "hard-interface.h"
+#include "hash.h"
 #include "originator.h"
 #include "send.h"
-#include "types.h"
 #include "translation-table.h"
+#include "types.h"
 
 static void batadv_dat_purge(struct work_struct *work);
 
diff --git a/distributed-arp-table.h b/distributed-arp-table.h
index 2fe0764..fed3ff2 100644
--- a/distributed-arp-table.h
+++ b/distributed-arp-table.h
@@ -18,12 +18,20 @@
 #ifndef _NET_BATMAN_ADV_DISTRIBUTED_ARP_TABLE_H_
 #define _NET_BATMAN_ADV_DISTRIBUTED_ARP_TABLE_H_
 
-#ifdef CONFIG_BATMAN_ADV_DAT
+#include "main.h"
+
+#include <linux/compiler.h>
+#include <linux/netdevice.h>
+#include <linux/types.h>
 
-#include "types.h"
 #include "originator.h"
+#include "packet.h"
+#include "types.h"
+
+struct seq_file;
+struct sk_buff;
 
-#include <linux/if_arp.h>
+#ifdef CONFIG_BATMAN_ADV_DAT
 
 /* BATADV_DAT_ADDR_MAX - maximum address value in the DHT space */
 #define BATADV_DAT_ADDR_MAX ((batadv_dat_addr_t)~(batadv_dat_addr_t)0)
diff --git a/fragmentation.c b/fragmentation.c
index 9e06457..124356a 100644
--- a/fragmentation.c
+++ b/fragmentation.c
@@ -15,12 +15,28 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "main.h"
 #include "fragmentation.h"
-#include "send.h"
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/byteorder/generic.h>
+#include <linux/etherdevice.h>
+#include <linux/fs.h>
+#include <linux/if_ether.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/netdevice.h>
+#include <linux/pkt_sched.h>
+#include <linux/skbuff.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/string.h>
+
+#include "hard-interface.h"
 #include "originator.h"
+#include "packet.h"
 #include "routing.h"
-#include "hard-interface.h"
+#include "send.h"
 #include "soft-interface.h"
 
 /**
diff --git a/fragmentation.h b/fragmentation.h
index d848cf6..446cdee 100644
--- a/fragmentation.h
+++ b/fragmentation.h
@@ -18,6 +18,17 @@
 #ifndef _NET_BATMAN_ADV_FRAGMENTATION_H_
 #define _NET_BATMAN_ADV_FRAGMENTATION_H_
 
+#include "main.h"
+
+#include <linux/compiler.h>
+#include <linux/list.h>
+#include <linux/stddef.h>
+#include <linux/types.h>
+
+#include "types.h"
+
+struct sk_buff;
+
 void batadv_frag_purge_orig(struct batadv_orig_node *orig,
 			    bool (*check_cb)(struct batadv_frag_table_entry *));
 bool batadv_frag_skb_fwd(struct sk_buff *skb,
diff --git a/gateway_client.c b/gateway_client.c
index 090828c..9b2ef82 100644
--- a/gateway_client.c
+++ b/gateway_client.c
@@ -15,18 +15,38 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "main.h"
-#include "sysfs.h"
 #include "gateway_client.h"
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/byteorder/generic.h>
+#include <linux/etherdevice.h>
+#include <linux/fs.h>
+#include <linux/if_ether.h>
+#include <linux/if_vlan.h>
+#include <linux/in.h>
+#include <linux/ip.h>
+#include <linux/ipv6.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/netdevice.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+#include <linux/udp.h>
+
 #include "gateway_common.h"
 #include "hard-interface.h"
 #include "originator.h"
-#include "translation-table.h"
+#include "packet.h"
 #include "routing.h"
-#include <linux/ip.h>
-#include <linux/ipv6.h>
-#include <linux/udp.h>
-#include <linux/if_vlan.h>
+#include "sysfs.h"
+#include "translation-table.h"
 
 /* These are the offsets of the "hw type" and "hw address length" in the dhcp
  * packet starting at the beginning of the dhcp header
diff --git a/gateway_client.h b/gateway_client.h
index 7ee53bb..588122b 100644
--- a/gateway_client.h
+++ b/gateway_client.h
@@ -18,6 +18,16 @@
 #ifndef _NET_BATMAN_ADV_GATEWAY_CLIENT_H_
 #define _NET_BATMAN_ADV_GATEWAY_CLIENT_H_
 
+#include "main.h"
+
+#include <linux/types.h>
+
+#include "types.h"
+
+struct batadv_tvlv_gateway_data;
+struct seq_file;
+struct sk_buff;
+
 void batadv_gw_check_client_stop(struct batadv_priv *bat_priv);
 void batadv_gw_reselect(struct batadv_priv *bat_priv);
 void batadv_gw_election(struct batadv_priv *bat_priv);
diff --git a/gateway_common.c b/gateway_common.c
index 6f5e621..636d59c 100644
--- a/gateway_common.c
+++ b/gateway_common.c
@@ -15,9 +15,19 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "main.h"
 #include "gateway_common.h"
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/byteorder/generic.h>
+#include <linux/kernel.h>
+#include <linux/netdevice.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+
 #include "gateway_client.h"
+#include "packet.h"
+#include "types.h"
 
 /**
  * batadv_parse_gw_bandwidth - parse supplied string buffer to extract download
diff --git a/gateway_common.h b/gateway_common.h
index aa51165..2020c0f 100644
--- a/gateway_common.h
+++ b/gateway_common.h
@@ -18,6 +18,13 @@
 #ifndef _NET_BATMAN_ADV_GATEWAY_COMMON_H_
 #define _NET_BATMAN_ADV_GATEWAY_COMMON_H_
 
+#include "main.h"
+
+#include <linux/types.h>
+
+struct batadv_priv;
+struct net_device;
+
 enum batadv_gw_modes {
 	BATADV_GW_MODE_OFF,
 	BATADV_GW_MODE_CLIENT,
diff --git a/hard-interface.c b/hard-interface.c
index fbda6b5..380e025 100644
--- a/hard-interface.c
+++ b/hard-interface.c
@@ -15,22 +15,36 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "main.h"
-#include "distributed-arp-table.h"
 #include "hard-interface.h"
-#include "soft-interface.h"
-#include "send.h"
-#include "translation-table.h"
-#include "routing.h"
-#include "sysfs.h"
-#include "debugfs.h"
-#include "originator.h"
-#include "hash.h"
-#include "bridge_loop_avoidance.h"
-#include "gateway_client.h"
+#include "main.h"
 
+#include <linux/bug.h>
+#include <linux/byteorder/generic.h>
+#include <linux/errno.h>
+#include <linux/fs.h>
 #include <linux/if_arp.h>
 #include <linux/if_ether.h>
+#include <linux/if.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/netdevice.h>
+#include <linux/printk.h>
+#include <linux/rculist.h>
+#include <linux/rtnetlink.h>
+#include <linux/slab.h>
+#include <linux/workqueue.h>
+#include <net/net_namespace.h>
+
+#include "bridge_loop_avoidance.h"
+#include "debugfs.h"
+#include "distributed-arp-table.h"
+#include "gateway_client.h"
+#include "originator.h"
+#include "packet.h"
+#include "send.h"
+#include "soft-interface.h"
+#include "sysfs.h"
+#include "translation-table.h"
 
 void batadv_hardif_free_rcu(struct rcu_head *rcu)
 {
diff --git a/hard-interface.h b/hard-interface.h
index 1918cd5..004f859 100644
--- a/hard-interface.h
+++ b/hard-interface.h
@@ -18,6 +18,19 @@
 #ifndef _NET_BATMAN_ADV_HARD_INTERFACE_H_
 #define _NET_BATMAN_ADV_HARD_INTERFACE_H_
 
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/compiler.h>
+#include <linux/notifier.h>
+#include <linux/rcupdate.h>
+#include <linux/stddef.h>
+#include <linux/types.h>
+
+#include "types.h"
+
+struct net_device;
+
 enum batadv_hard_if_state {
 	BATADV_IF_NOT_IN_USE,
 	BATADV_IF_TO_BE_REMOVED,
diff --git a/hash.c b/hash.c
index 7c1c630..0532dc9 100644
--- a/hash.c
+++ b/hash.c
@@ -15,8 +15,12 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "main.h"
 #include "hash.h"
+#include "main.h"
+
+#include <linux/fs.h>
+#include <linux/lockdep.h>
+#include <linux/slab.h>
 
 /* clears the hash */
 static void batadv_hash_init(struct batadv_hashtable *hash)
diff --git a/hash.h b/hash.h
index a1d0980..b7cc418 100644
--- a/hash.h
+++ b/hash.h
@@ -18,7 +18,16 @@
 #ifndef _NET_BATMAN_ADV_HASH_H_
 #define _NET_BATMAN_ADV_HASH_H_
 
+#include "main.h"
+
+#include <linux/compiler.h>
 #include <linux/list.h>
+#include <linux/rculist.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+#include <linux/types.h>
+
+struct lock_class_key;
 
 /* callback to a compare function.  should compare 2 element datas for their
  * keys, return 0 if same and not 0 if not same
diff --git a/icmp_socket.c b/icmp_socket.c
index 161ef8f..4bab8ab 100644
--- a/icmp_socket.c
+++ b/icmp_socket.c
@@ -15,14 +15,39 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "icmp_socket.h"
 #include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/compiler.h>
 #include <linux/debugfs.h>
+#include <linux/errno.h>
+#include <linux/etherdevice.h>
+#include <linux/export.h>
+#include <linux/fcntl.h>
+#include <linux/fs.h>
+#include <linux/if_ether.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/module.h>
+#include <linux/netdevice.h>
+#include <linux/pkt_sched.h>
+#include <linux/poll.h>
+#include <linux/printk.h>
+#include <linux/skbuff.h>
 #include <linux/slab.h>
-#include "icmp_socket.h"
-#include "send.h"
-#include "hash.h"
-#include "originator.h"
+#include <linux/spinlock.h>
+#include <linux/stat.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/uaccess.h>
+#include <linux/wait.h>
+
 #include "hard-interface.h"
+#include "originator.h"
+#include "packet.h"
+#include "send.h"
+#include "types.h"
 
 static struct batadv_socket_client *batadv_socket_client_hash[256];
 
diff --git a/icmp_socket.h b/icmp_socket.h
index 0c33950..0189910 100644
--- a/icmp_socket.h
+++ b/icmp_socket.h
@@ -18,6 +18,13 @@
 #ifndef _NET_BATMAN_ADV_ICMP_SOCKET_H_
 #define _NET_BATMAN_ADV_ICMP_SOCKET_H_
 
+#include "main.h"
+
+#include <linux/types.h>
+
+struct batadv_icmp_header;
+struct batadv_priv;
+
 #define BATADV_ICMP_SOCKET "socket"
 
 void batadv_socket_init(void);
diff --git a/main.c b/main.c
index 766ab33..dd159b1 100644
--- a/main.c
+++ b/main.c
@@ -15,31 +15,54 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/bug.h>
+#include <linux/byteorder/generic.h>
 #include <linux/crc32c.h>
-#include <linux/highmem.h>
+#include <linux/errno.h>
+#include <linux/fs.h>
+#include <linux/if_ether.h>
 #include <linux/if_vlan.h>
-#include <net/ip.h>
-#include <net/ipv6.h>
+#include <linux/init.h>
+#include <linux/ip.h>
+#include <linux/ipv6.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/netdevice.h>
+#include <linux/pkt_sched.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/workqueue.h>
 #include <net/dsfield.h>
-#include "main.h"
-#include "sysfs.h"
+#include <net/rtnetlink.h>
+
+#include "bat_algo.h"
+#include "bridge_loop_avoidance.h"
 #include "debugfs.h"
+#include "distributed-arp-table.h"
+#include "gateway_client.h"
+#include "gateway_common.h"
+#include "hard-interface.h"
+#include "icmp_socket.h"
+#include "multicast.h"
+#include "network-coding.h"
+#include "originator.h"
+#include "packet.h"
 #include "routing.h"
 #include "send.h"
-#include "originator.h"
 #include "soft-interface.h"
-#include "icmp_socket.h"
 #include "translation-table.h"
-#include "hard-interface.h"
-#include "gateway_client.h"
-#include "bridge_loop_avoidance.h"
-#include "distributed-arp-table.h"
-#include "multicast.h"
-#include "gateway_common.h"
-#include "hash.h"
-#include "bat_algo.h"
-#include "network-coding.h"
-#include "fragmentation.h"
+#include "types.h"
 
 /* List manipulations on hardif_list have to be rtnl_lock()'ed,
  * list traversals just rcu-locked
diff --git a/main.h b/main.h
index 569846b..0df62b8 100644
--- a/main.h
+++ b/main.h
@@ -163,28 +163,27 @@ enum batadv_uev_type {
 
 /* Kernel headers */
 
-#include <linux/mutex.h>	/* mutex */
-#include <linux/module.h>	/* needed by all modules */
-#include <linux/netdevice.h>	/* netdevice */
-#include <linux/etherdevice.h>  /* ethernet address classification */
-#include <linux/if_ether.h>	/* ethernet header */
-#include <linux/poll.h>		/* poll_table */
-#include <linux/kthread.h>	/* kernel threads */
-#include <linux/pkt_sched.h>	/* schedule types */
-#include <linux/workqueue.h>	/* workqueue */
+#include <linux/bitops.h>
+#include <linux/compiler.h>
+#include <linux/cpumask.h>
+#include <linux/etherdevice.h>
+#include <linux/printk.h>
+#include <linux/types.h>
 #include <linux/percpu.h>
-#include <linux/slab.h>
-#include <linux/jhash.h>
-#include <net/sock.h>		/* struct sock */
-#include <net/addrconf.h>	/* ipv6 address stuff */
-#include <linux/ip.h>
-#include <net/rtnetlink.h>
 #include <linux/jiffies.h>
-#include <linux/seq_file.h>
 #include <linux/if_vlan.h>
+
 #include "compat.h"
 
-#include "types.h"
+struct batadv_algo_ops;
+struct batadv_hard_iface;
+struct batadv_orig_node;
+struct batadv_priv;
+struct batadv_ogm_packet;
+struct net_device;
+struct packet_type;
+struct seq_file;
+struct sk_buff;
 
 #define BATADV_PRINT_VID(vid) (vid & BATADV_VLAN_HAS_TAG ? \
 			       (int)(vid & VLAN_VID_MASK) : -1)
diff --git a/multicast.c b/multicast.c
index b24e4bb..e1b50b5 100644
--- a/multicast.c
+++ b/multicast.c
@@ -15,11 +15,35 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "main.h"
 #include "multicast.h"
-#include "originator.h"
-#include "hard-interface.h"
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/byteorder/generic.h>
+#include <linux/errno.h>
+#include <linux/etherdevice.h>
+#include <linux/fs.h>
+#include <linux/if_ether.h>
+#include <linux/in6.h>
+#include <linux/in.h>
+#include <linux/ip.h>
+#include <linux/ipv6.h>
+#include <linux/list.h>
+#include <linux/netdevice.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/skbuff.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/types.h>
+#include <net/addrconf.h>
+#include <net/ipv6.h>
+
+#include "packet.h"
 #include "translation-table.h"
+#include "types.h"
 
 /**
  * batadv_mcast_mla_softif_get - get softif multicast listeners
diff --git a/multicast.h b/multicast.h
index 3a44ebd..ae04f1e 100644
--- a/multicast.h
+++ b/multicast.h
@@ -18,6 +18,12 @@
 #ifndef _NET_BATMAN_ADV_MULTICAST_H_
 #define _NET_BATMAN_ADV_MULTICAST_H_
 
+#include "main.h"
+
+struct batadv_orig_node;
+struct batadv_priv;
+struct sk_buff;
+
 /**
  * batadv_forw_mode - the way a packet should be forwarded as
  * @BATADV_FORW_ALL: forward the packet to all nodes (currently via classic
diff --git a/network-coding.c b/network-coding.c
index d128c3b..f72108b 100644
--- a/network-coding.c
+++ b/network-coding.c
@@ -15,15 +15,45 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "network-coding.h"
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/byteorder/generic.h>
+#include <linux/compiler.h>
 #include <linux/debugfs.h>
+#include <linux/errno.h>
+#include <linux/etherdevice.h>
+#include <linux/fs.h>
+#include <linux/if_ether.h>
+#include <linux/if_packet.h>
+#include <linux/init.h>
+#include <linux/jhash.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/lockdep.h>
+#include <linux/netdevice.h>
+#include <linux/printk.h>
+#include <linux/random.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/stat.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/workqueue.h>
 
-#include "main.h"
+#include "hard-interface.h"
 #include "hash.h"
-#include "network-coding.h"
-#include "send.h"
 #include "originator.h"
-#include "hard-interface.h"
+#include "packet.h"
 #include "routing.h"
+#include "send.h"
+#include "types.h"
 
 static struct lock_class_key batadv_nc_coding_hash_lock_class_key;
 static struct lock_class_key batadv_nc_decoding_hash_lock_class_key;
diff --git a/network-coding.h b/network-coding.h
index 358c0d6..4008ec2 100644
--- a/network-coding.h
+++ b/network-coding.h
@@ -18,6 +18,19 @@
 #ifndef _NET_BATMAN_ADV_NETWORK_CODING_H_
 #define _NET_BATMAN_ADV_NETWORK_CODING_H_
 
+#include "main.h"
+
+#include <linux/types.h>
+
+struct batadv_nc_node;
+struct batadv_neigh_node;
+struct batadv_ogm_packet;
+struct batadv_orig_node;
+struct batadv_priv;
+struct net_device;
+struct seq_file;
+struct sk_buff;
+
 #ifdef CONFIG_BATMAN_ADV_NC
 
 void batadv_nc_status_update(struct net_device *net_dev);
diff --git a/originator.c b/originator.c
index 9e04e60..684536e 100644
--- a/originator.c
+++ b/originator.c
@@ -15,19 +15,31 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "originator.h"
 #include "main.h"
+
+#include <linux/errno.h>
+#include <linux/etherdevice.h>
+#include <linux/fs.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/lockdep.h>
+#include <linux/netdevice.h>
+#include <linux/seq_file.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/workqueue.h>
+
 #include "distributed-arp-table.h"
-#include "originator.h"
-#include "hash.h"
-#include "translation-table.h"
-#include "routing.h"
+#include "fragmentation.h"
 #include "gateway_client.h"
 #include "hard-interface.h"
-#include "soft-interface.h"
-#include "bridge_loop_avoidance.h"
-#include "network-coding.h"
-#include "fragmentation.h"
+#include "hash.h"
 #include "multicast.h"
+#include "network-coding.h"
+#include "routing.h"
+#include "translation-table.h"
 
 /* hash class keys */
 static struct lock_class_key batadv_orig_hash_lock_class_key;
diff --git a/originator.h b/originator.h
index a179c03..a966394 100644
--- a/originator.h
+++ b/originator.h
@@ -18,7 +18,21 @@
 #ifndef _NET_BATMAN_ADV_ORIGINATOR_H_
 #define _NET_BATMAN_ADV_ORIGINATOR_H_
 
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/compiler.h>
+#include <linux/if_ether.h>
+#include <linux/jhash.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/stddef.h>
+#include <linux/types.h>
+
 #include "hash.h"
+#include "types.h"
+
+struct seq_file;
 
 int batadv_compare_orig(const struct hlist_node *node, const void *data2);
 int batadv_originator_init(struct batadv_priv *bat_priv);
diff --git a/packet.h b/packet.h
index b81fbbf..27b4003 100644
--- a/packet.h
+++ b/packet.h
@@ -18,6 +18,11 @@
 #ifndef _NET_BATMAN_ADV_PACKET_H_
 #define _NET_BATMAN_ADV_PACKET_H_
 
+#include <asm/byteorder.h>
+#include <linux/bitops.h>
+#include <linux/if_ether.h>
+#include <linux/types.h>
+
 /**
  * enum batadv_packettype - types for batman-adv encapsulated packets
  * @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV
diff --git a/routing.c b/routing.c
index da83982..ea6fa6e 100644
--- a/routing.c
+++ b/routing.c
@@ -15,20 +15,37 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "main.h"
 #include "routing.h"
-#include "send.h"
-#include "soft-interface.h"
-#include "hard-interface.h"
-#include "icmp_socket.h"
-#include "translation-table.h"
-#include "originator.h"
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/byteorder/generic.h>
+#include <linux/compiler.h>
+#include <linux/errno.h>
+#include <linux/etherdevice.h>
+#include <linux/if_ether.h>
+#include <linux/jiffies.h>
+#include <linux/netdevice.h>
+#include <linux/printk.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/skbuff.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+
+#include "bitarray.h"
 #include "bridge_loop_avoidance.h"
 #include "distributed-arp-table.h"
-#include "network-coding.h"
 #include "fragmentation.h"
-
-#include <linux/if_vlan.h>
+#include "hard-interface.h"
+#include "icmp_socket.h"
+#include "network-coding.h"
+#include "originator.h"
+#include "packet.h"
+#include "send.h"
+#include "soft-interface.h"
+#include "translation-table.h"
+#include "types.h"
 
 static int batadv_route_unicast_packet(struct sk_buff *skb,
 				       struct batadv_hard_iface *recv_if);
diff --git a/routing.h b/routing.h
index 557d3d1..f8a9e14 100644
--- a/routing.h
+++ b/routing.h
@@ -18,6 +18,16 @@
 #ifndef _NET_BATMAN_ADV_ROUTING_H_
 #define _NET_BATMAN_ADV_ROUTING_H_
 
+#include "main.h"
+
+#include <linux/types.h>
+
+struct batadv_hard_iface;
+struct batadv_neigh_node;
+struct batadv_orig_node;
+struct batadv_priv;
+struct sk_buff;
+
 bool batadv_check_management_packet(struct sk_buff *skb,
 				    struct batadv_hard_iface *hard_iface,
 				    int header_len);
diff --git a/send.c b/send.c
index d27161e..27d8ee3 100644
--- a/send.c
+++ b/send.c
@@ -15,19 +15,38 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "send.h"
 #include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/byteorder/generic.h>
+#include <linux/etherdevice.h>
+#include <linux/fs.h>
+#include <linux/if_ether.h>
+#include <linux/if.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/netdevice.h>
+#include <linux/printk.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/skbuff.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+#include <linux/workqueue.h>
+
 #include "distributed-arp-table.h"
-#include "send.h"
-#include "routing.h"
-#include "translation-table.h"
-#include "soft-interface.h"
-#include "hard-interface.h"
-#include "gateway_common.h"
+#include "fragmentation.h"
 #include "gateway_client.h"
-#include "originator.h"
+#include "hard-interface.h"
 #include "network-coding.h"
-#include "fragmentation.h"
-#include "multicast.h"
+#include "originator.h"
+#include "routing.h"
+#include "soft-interface.h"
+#include "translation-table.h"
+#include "types.h"
 
 static void batadv_send_outstanding_bcast_packet(struct work_struct *work);
 
diff --git a/send.h b/send.h
index 38d0ec1..de85f2f 100644
--- a/send.h
+++ b/send.h
@@ -18,6 +18,19 @@
 #ifndef _NET_BATMAN_ADV_SEND_H_
 #define _NET_BATMAN_ADV_SEND_H_
 
+#include "main.h"
+
+#include <linux/compiler.h>
+#include <linux/types.h>
+
+#include "packet.h"
+
+struct batadv_hard_iface;
+struct batadv_orig_node;
+struct batadv_priv;
+struct sk_buff;
+struct work_struct;
+
 int batadv_send_skb_packet(struct sk_buff *skb,
 			   struct batadv_hard_iface *hard_iface,
 			   const uint8_t *dst_addr);
diff --git a/soft-interface.c b/soft-interface.c
index 78d63e3..57e621b 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -15,26 +15,51 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "main.h"
 #include "soft-interface.h"
-#include "hard-interface.h"
-#include "distributed-arp-table.h"
-#include "routing.h"
-#include "send.h"
-#include "debugfs.h"
-#include "translation-table.h"
-#include "hash.h"
-#include "gateway_common.h"
-#include "gateway_client.h"
-#include "sysfs.h"
-#include "originator.h"
-#include <linux/slab.h>
-#include <linux/ethtool.h>
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/byteorder/generic.h>
+#include <linux/cache.h>
+#include <linux/compiler.h>
+#include <linux/errno.h>
 #include <linux/etherdevice.h>
+#include <linux/ethtool.h>
+#include <linux/fs.h>
+#include <linux/if_ether.h>
 #include <linux/if_vlan.h>
-#include "multicast.h"
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/lockdep.h>
+#include <linux/netdevice.h>
+#include <linux/percpu.h>
+#include <linux/printk.h>
+#include <linux/random.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/skbuff.h>
+#include <linux/slab.h>
+#include <linux/socket.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/types.h>
+#include <linux/workqueue.h>
+
 #include "bridge_loop_avoidance.h"
+#include "debugfs.h"
+#include "distributed-arp-table.h"
+#include "gateway_client.h"
+#include "gateway_common.h"
+#include "hard-interface.h"
+#include "multicast.h"
 #include "network-coding.h"
+#include "packet.h"
+#include "send.h"
+#include "sysfs.h"
+#include "translation-table.h"
+#include "types.h"
 
 static int batadv_get_settings(struct net_device *dev, struct ethtool_cmd *cmd);
 static void batadv_get_drvinfo(struct net_device *dev,
diff --git a/soft-interface.h b/soft-interface.h
index dbab22f..e1e8bb9 100644
--- a/soft-interface.h
+++ b/soft-interface.h
@@ -18,6 +18,17 @@
 #ifndef _NET_BATMAN_ADV_SOFT_INTERFACE_H_
 #define _NET_BATMAN_ADV_SOFT_INTERFACE_H_
 
+#include "main.h"
+
+#include <net/rtnetlink.h>
+
+struct batadv_hard_iface;
+struct batadv_orig_node;
+struct batadv_priv;
+struct batadv_softif_vlan;
+struct net_device;
+struct sk_buff;
+
 int batadv_skb_head_push(struct sk_buff *skb, unsigned int len);
 void batadv_interface_rx(struct net_device *soft_iface,
 			 struct sk_buff *skb, struct batadv_hard_iface *recv_if,
diff --git a/sysfs.c b/sysfs.c
index 97a6192..3cb2f13 100644
--- a/sysfs.c
+++ b/sysfs.c
@@ -15,16 +15,36 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "main.h"
 #include "sysfs.h"
-#include "translation-table.h"
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/compiler.h>
+#include <linux/device.h>
+#include <linux/errno.h>
+#include <linux/fs.h>
+#include <linux/if.h>
+#include <linux/if_vlan.h>
+#include <linux/kernel.h>
+#include <linux/netdevice.h>
+#include <linux/printk.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/rtnetlink.h>
+#include <linux/slab.h>
+#include <linux/stat.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/stringify.h>
+
 #include "distributed-arp-table.h"
-#include "network-coding.h"
-#include "originator.h"
+#include "gateway_client.h"
+#include "gateway_common.h"
 #include "hard-interface.h"
+#include "network-coding.h"
+#include "packet.h"
 #include "soft-interface.h"
-#include "gateway_common.h"
-#include "gateway_client.h"
+#include "types.h"
 
 static struct net_device *batadv_kobj_to_netdev(struct kobject *obj)
 {
diff --git a/sysfs.h b/sysfs.h
index b715b60..bc1f6df 100644
--- a/sysfs.h
+++ b/sysfs.h
@@ -18,6 +18,16 @@
 #ifndef _NET_BATMAN_ADV_SYSFS_H_
 #define _NET_BATMAN_ADV_SYSFS_H_
 
+#include "main.h"
+
+#include <linux/sysfs.h>
+#include <linux/types.h>
+
+struct batadv_priv;
+struct batadv_softif_vlan;
+struct kobject;
+struct net_device;
+
 #define BATADV_SYSFS_IF_MESH_SUBDIR "mesh"
 #define BATADV_SYSFS_IF_BAT_SUBDIR "batman_adv"
 /**
diff --git a/translation-table.c b/translation-table.c
index b20812b..74ec17c 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -15,18 +15,42 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "main.h"
 #include "translation-table.h"
-#include "soft-interface.h"
+#include "main.h"
+
+#include <linux/atomic.h>
+#include <linux/bug.h>
+#include <linux/byteorder/generic.h>
+#include <linux/compiler.h>
+#include <linux/crc32c.h>
+#include <linux/errno.h>
+#include <linux/etherdevice.h>
+#include <linux/fs.h>
+#include <linux/if_ether.h>
+#include <linux/jhash.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/lockdep.h>
+#include <linux/netdevice.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/seq_file.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/workqueue.h>
+#include <net/net_namespace.h>
+
+#include "bridge_loop_avoidance.h"
 #include "hard-interface.h"
-#include "send.h"
 #include "hash.h"
-#include "originator.h"
-#include "routing.h"
-#include "bridge_loop_avoidance.h"
 #include "multicast.h"
-
-#include <linux/crc32c.h>
+#include "originator.h"
+#include "packet.h"
+#include "soft-interface.h"
+#include "types.h"
 
 /* hash class keys */
 static struct lock_class_key batadv_tt_local_hash_lock_class_key;
diff --git a/translation-table.h b/translation-table.h
index ad84d7b..3c2b868 100644
--- a/translation-table.h
+++ b/translation-table.h
@@ -18,6 +18,15 @@
 #ifndef _NET_BATMAN_ADV_TRANSLATION_TABLE_H_
 #define _NET_BATMAN_ADV_TRANSLATION_TABLE_H_
 
+#include "main.h"
+
+#include <linux/types.h>
+
+struct batadv_orig_node;
+struct batadv_priv;
+struct net_device;
+struct seq_file;
+
 int batadv_tt_init(struct batadv_priv *bat_priv);
 bool batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
 			 unsigned short vid, int ifindex, uint32_t mark);
diff --git a/types.h b/types.h
index b72fa7b..c5f2424 100644
--- a/types.h
+++ b/types.h
@@ -18,9 +18,20 @@
 #ifndef _NET_BATMAN_ADV_TYPES_H_
 #define _NET_BATMAN_ADV_TYPES_H_
 
+#include "main.h"
+
+#include <linux/bitops.h>
+#include <linux/compiler.h>
+#include <linux/if_ether.h>
+#include <linux/netdevice.h>
+#include <linux/spinlock.h>
+#include <linux/types.h>
+#include <linux/wait.h>
+#include <linux/workqueue.h>
+
 #include "packet.h"
-#include "bitarray.h"
-#include <linux/kernel.h>
+
+struct seq_file;
 
 #ifdef CONFIG_BATMAN_ADV_DAT
 
-- 
2.1.4


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups
  2015-03-22  0:52 ` [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Sven Eckelmann
@ 2015-03-22  1:34   ` Sven Eckelmann
  2015-03-24 11:41     ` Markus Pargmann
  0 siblings, 1 reply; 67+ messages in thread
From: Sven Eckelmann @ 2015-03-22  1:34 UTC (permalink / raw)
  To: Markus Pargmann; +Cc: b.a.t.m.a.n, Marek Lindner, Antonio Quartulli

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

On Sunday 22 March 2015 01:52:40 Sven Eckelmann wrote:
> On Friday 26 December 2014 12:41:17 Markus Pargmann wrote:
> > Markus Pargmann (26):
> [...]
> 
> >   batman-adv: packet.h, add some missing includes
> >   batman-adv: types.h, add missing include
> 
> Just went through the includes and noticed that a lot more are missing (also
> in the files which you are already touched). I have attached the current
> state of my analysis so you can compare it with your notes.

Small disclaimer I forgot:

The patch is currently not finished. Following things are missing:

 * #include "types.h" in main.h after "compat.h" (may be removed in the future 
   when I can drop it somehow... but it will most likely be added again even
   when there is a dependency circle with types.h)
 * tests with older kernels
 * an actual description

Kind regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH v2 25/26] batman-adv: packet.h, add some missing includes
  2015-03-21 22:36   ` Sven Eckelmann
@ 2015-03-24 11:10     ` Markus Pargmann
  0 siblings, 0 replies; 67+ messages in thread
From: Markus Pargmann @ 2015-03-24 11:10 UTC (permalink / raw)
  To: Sven Eckelmann; +Cc: b.a.t.m.a.n, Marek Lindner, Antonio Quartulli

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

On Sat, Mar 21, 2015 at 11:36:10PM +0100, Sven Eckelmann wrote:
> > --- a/packet.h
> > +++ b/packet.h
> > @@ -18,6 +18,11 @@
> >  #ifndef _NET_BATMAN_ADV_PACKET_H_
> >  #define _NET_BATMAN_ADV_PACKET_H_
> > 
> > +#ifdef __KERNEL__
> > +#include <linux/bitops.h>
> > +#include <uapi/linux/if_ether.h>
> > +#endif /* __KERNEL__ */
> > +
> >  /**
> >   * enum batadv_packettype - types for batman-adv encapsulated packets
> >   * @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV
> 
> Ok, so you are including linux/bitops.h for BIT(...) and uapi/linux/if_ether.h 
> for ETH_ALEN? You are missing:
> 
>  * linux/types.h for uint8_t, __be16 and so on
>  * define for the bitfield byteorder comes from asm/byteorder.h
> 
> Most of these files are part of linux-libc-dev. The rest requires some kind of 
> hack. A way to still work in the batctl build would be to include dummy files. 
> An example patch is attached. This builds at least on my Debian system and my 
> OpenWrt build environment.

Thanks, I like the idea of dummy files. The patch also looks fine.

Best Regards,

Markus

> 
> Kind regards,
> 	Sven

> diff --git a/Makefile b/Makefile
> index 0eb71a1..ffbbf72 100755
> --- a/Makefile
> +++ b/Makefile
> @@ -30,7 +30,7 @@ MANPAGE = man/batctl.8
>  
>  # batctl flags and options
>  CFLAGS += -Wall -W -std=gnu99 -fno-strict-aliasing -MD -MP
> -CPPFLAGS += -D_GNU_SOURCE
> +CPPFLAGS += -D_GNU_SOURCE -Ikernelinc
>  LDLIBS += -lm
>  
>  # disable verbose output
> diff --git a/kernelinc/linux/bitops.h b/kernelinc/linux/bitops.h
> new file mode 100644
> index 0000000..d41db10
> --- /dev/null
> +++ b/kernelinc/linux/bitops.h
> @@ -0,0 +1,27 @@
> +/*
> + * Copyright (C) 2009-2014 B.A.T.M.A.N. contributors:
> + *
> + * Marek Lindner <mareklindner@neomailbox.ch>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of version 2 of the GNU General Public
> + * License as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> + * 02110-1301, USA
> + *
> + */
> +
> +#ifndef _BATCTL_KERNELINC_LINUX_BITOPS_H
> +#define _BATCTL_KERNELINC_LINUX_BITOPS_H
> +
> +#define BIT(nr) (1UL << (nr))
> +
> +#endif
> diff --git a/main.h b/main.h
> index 461f3e3..248467c 100644
> --- a/main.h
> +++ b/main.h
> @@ -36,17 +36,6 @@
>  #define DEBUG_TABLE_PATH_MAX_LEN 20
>  #define SETTINGS_PATH_MAX_LEN 25
>  
> -#if BYTE_ORDER == BIG_ENDIAN
> -#define __BIG_ENDIAN_BITFIELD
> -#elif BYTE_ORDER == LITTLE_ENDIAN
> -#define __LITTLE_ENDIAN_BITFIELD
> -#else
> -#error "unknown endianess"
> -#endif
> -
> -#define __packed __attribute((packed))   /* linux kernel compat */
> -#define BIT(nr)                 (1UL << (nr)) /* linux kernel compat */
> -
>  extern char module_ver_path[];
>  
>  #ifndef VLAN_VID_MASK
> diff --git a/packet.h b/packet.h
> index b81fbbf..27b4003 100644
> --- a/packet.h
> +++ b/packet.h
> @@ -18,6 +18,11 @@
>  #ifndef _NET_BATMAN_ADV_PACKET_H_
>  #define _NET_BATMAN_ADV_PACKET_H_
>  
> +#include <asm/byteorder.h>
> +#include <linux/bitops.h>
> +#include <linux/if_ether.h>
> +#include <linux/types.h>
> +
>  /**
>   * enum batadv_packettype - types for batman-adv encapsulated packets
>   * @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV
> diff --git a/sys.c b/sys.c
> index 676bef1..6c0cab4 100644
> --- a/sys.c
> +++ b/sys.c
> @@ -26,6 +26,7 @@
>  #include <string.h>
>  #include <errno.h>
>  #include <dirent.h>
> +#include <linux/bitops.h>
>  
>  #include "main.h"
>  #include "sys.h"




-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

* Re: [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups
  2015-03-22  1:34   ` Sven Eckelmann
@ 2015-03-24 11:41     ` Markus Pargmann
  2015-03-24 11:47       ` Sven Eckelmann
  0 siblings, 1 reply; 67+ messages in thread
From: Markus Pargmann @ 2015-03-24 11:41 UTC (permalink / raw)
  To: Sven Eckelmann; +Cc: b.a.t.m.a.n, Marek Lindner, Antonio Quartulli

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

Hi Sven,

On Sun, Mar 22, 2015 at 02:34:33AM +0100, Sven Eckelmann wrote:
> On Sunday 22 March 2015 01:52:40 Sven Eckelmann wrote:
> > On Friday 26 December 2014 12:41:17 Markus Pargmann wrote:
> > > Markus Pargmann (26):
> > [...]
> > 
> > >   batman-adv: packet.h, add some missing includes
> > >   batman-adv: types.h, add missing include
> > 
> > Just went through the includes and noticed that a lot more are missing (also
> > in the files which you are already touched). I have attached the current
> > state of my analysis so you can compare it with your notes.

Do you have any tool which makes this include analysis easier?

> 
> Small disclaimer I forgot:
> 
> The patch is currently not finished. Following things are missing:
> 
>  * #include "types.h" in main.h after "compat.h" (may be removed in the future 
>    when I can drop it somehow... but it will most likely be added again even
>    when there is a dependency circle with types.h)

I hope that types.h can be split up into appropriate topic headers
which are selectively included by the files which need it. However I
didn't have a deeper look into this yet so it may be more complicated.

>  * tests with older kernels

I will test your series with an arm build, but I don't think that
anything breaks there.

Best Regards,

Markus

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

* Re: [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups
  2015-03-24 11:41     ` Markus Pargmann
@ 2015-03-24 11:47       ` Sven Eckelmann
  0 siblings, 0 replies; 67+ messages in thread
From: Sven Eckelmann @ 2015-03-24 11:47 UTC (permalink / raw)
  To: Markus Pargmann; +Cc: b.a.t.m.a.n, Marek Lindner, Antonio Quartulli


[-- Attachment #1.1: Type: text/plain, Size: 7758 bytes --]

=2D-nextPart1757407.5OSSQHo2tk
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"

On Tuesday 24 March 2015 12:41:07 Markus Pargmann wrote:
> Hi Sven,
> 
> On Sun, Mar 22, 2015 at 02:34:33AM +0100, Sven Eckelmann wrote:
> > On Sunday 22 March 2015 01:52:40 Sven Eckelmann wrote:
> > > On Friday 26 December 2014 12:41:17 Markus Pargmann wrote:
> > > > Markus Pargmann (26):
> > > [...]
> > > 
> > > >   batman-adv: packet.h, add some missing includes
> > > >   batman-adv: types.h, add missing include
> > > 
> > > Just went through the includes and noticed that a lot more are missing
> > > (also in the files which you are already touched). I have attached the
> > > current state of my analysis so you can compare it with your notes.
> 
> Do you have any tool which makes this include analysis easier?

I've started to test iwyu but the output cannot really be trusted. But at 
least it can help to spot things.

make -k CC="iwyu -Xiwyu --no_default_mappings  -Xiwyu --verbose=1 -Xiwyu --
mapping_file=$HOME/kernel_mappings.iwyu" CONFIG_BATMAN_ADV_NC=y 
CONFIG_BATMAN_ADV_DEBUG=y

The header files are for example also not all analyzed. So you have to fiddle 
around with them too.

Kind regards,
	Sven
=2D-nextPart1757407.5OSSQHo2tk
Content-Disposition: attachment; filename="kernel_mappings.iwyu"
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="UTF-8"; name="kernel_mappings.iwyu"

[
{ include: ["\"linux/compiler-gcc.h\"", "private", "<linux/compiler.h>", "public"] },
{ include: ["\"asm/atomic.h\"", "private", "<linux/atomic.h>", "public"] },
{ include: ["\"asm/bitops.h\"", "private", "<linux/bitops.h>", "public"] },
{ include: ["\"asm/cache.h\"", "private", "<linux/cache.h>", "public"] },
{ include: ["\"asm-generic/bug.h\"", "private", "<linux/bug.h>", "public"] },
{ include: ["\"asm-generic/errno-base.h\"", "private", "<linux/errno.h>", "public"] },
{ include: ["\"asm-generic/errno.h\"", "private", "<linux/errno.h>", "public"] },
{ include: ["\"asm-generic/fcntl.h\"", "private", "<linux/fcntl.h>", "public"] },
{ include: ["\"asm-generic/int-ll64.h\"", "private", "<linux/types.h>", "public"] },
{ include: ["\"asm-generic/poll.h\"", "private", "<linux/poll.h>", "public"] },
{ include: ["\"asm/percpu.h\"", "private", "<linux/percpu.h>", "public"] },
{ include: ["\"asm/string_64.h\"", "private", "<linux/string.h>", "public"] },
{ include: ["\"asm/uaccess.h\"", "private", "<linux/uaccess.h>", "public"] },
{ include: ["\"linux/atomic.h\"", "private", "<linux/atomic.h>", "public"] },
{ include: ["\"linux/bitmap.h\"", "private", "<linux/bitmap.h>", "public"] },
{ include: ["\"linux/bitops.h\"", "private", "<linux/bitops.h>", "public"] },
{ include: ["\"linux/bug.h\"", "private", "<linux/bug.h>", "public"] },
{ include: ["\"linux/byteorder/generic.h\"", "private", "<linux/byteorder/generic.h>", "public"] },
{ include: ["\"linux/compiler.h\"", "private", "<linux/compiler.h>", "public"] },
{ include: ["\"linux/cpumask.h\"", "private", "<linux/cpumask.h>", "public"] },
{ include: ["\"linux/device.h\"", "private", "<linux/device.h>", "public"] },
{ include: ["\"linux/err.h\"", "private", "<linux/device.h>", "public"] },
{ include: ["\"linux/etherdevice.h\"", "private", "<linux/etherdevice.h>", "public"] },
{ include: ["\"linux/ethtool.h\"", "private", "<linux/ethtool.h>", "public"] },
{ include: ["\"linux/export.h\"", "private", "<linux/export.h>", "public"] },
{ include: ["\"linux/fs.h\"", "private", "<linux/fs.h>", "public"] },
{ include: ["\"linux/gfp.h\"", "private", "<linux/fs.h>", "public"] },
{ include: ["\"linux/if_arp.h\"", "private", "<linux/if_arp.h>", "public"] },
{ include: ["\"linux/if_ether.h\"", "private", "<linux/if_ether.h>", "public"] },
{ include: ["\"linux/if.h\"", "private", "<linux/if.h>", "public"] },
{ include: ["\"linux/if_packet.h\"", "private", "<linux/if_packet.h>", "public"] },
{ include: ["\"linux/if_vlan.h\"", "private", "<linux/if_vlan.h>", "public"] },
{ include: ["\"linux/in6.h\"", "private", "<linux/in6.h>", "public"] },
{ include: ["\"linux/in.h\"", "private", "<linux/in.h>", "public"] },
{ include: ["\"linux/init.h\"", "private", "<linux/init.h>", "public"] },
{ include: ["\"linux/ip.h\"", "private", "<linux/ip.h>", "public"] },
{ include: ["\"linux/ipv6.h\"", "private", "<linux/ipv6.h>", "public"] },
{ include: ["\"linux/jhash.h\"", "private", "<linux/jhash.h>", "public"] },
{ include: ["\"linux/jiffies.h\"", "private", "<linux/jiffies.h>", "public"] },
{ include: ["\"linux/kconfig.h\"", "private", "<linux/kconfig.h>", "public"] },
{ include: ["\"linux/kernel.h\"", "private", "<linux/kernel.h>", "public"] },
{ include: ["\"linux/kern_levels.h\"", "private", "<linux/printk.h>", "public"] },
{ include: ["\"linux/kobject.h\"", "private", "<linux/printk.h>", "public"] },
{ include: ["\"linux/list.h\"", "private", "<linux/list.h>", "public"] },
{ include: ["\"linux/lockdep.h\"", "private", "<linux/lockdep.h>", "public"] },
{ include: ["\"linux/module.h\"", "private", "<linux/module.h>", "public"] },
{ include: ["\"linux/moduleparam.h\"", "private", "<linux/moduleparam.h>", "public"] },
{ include: ["\"linux/netdev_features.h\"", "private", "<linux/netdevice.h>", "public"] },
{ include: ["\"linux/netdevice.h\"", "private", "<linux/netdevice.h>", "public"] },
{ include: ["\"linux/net.h\"", "private", "<linux/netdevice.h>", "public"] },
{ include: ["\"linux/notifier.h\"", "private", "<linux/notifier.h>", "public"] },
{ include: ["\"linux/percpu.h\"", "private", "<linux/percpu.h>", "public"] },
{ include: ["\"linux/pkt_sched.h\"", "private", "<linux/pkt_sched.h>", "public"] },
{ include: ["\"linux/poll.h\"", "private", "<linux/poll.h>", "public"] },
{ include: ["\"linux/printk.h\"", "private", "<linux/printk.h>", "public"] },
{ include: ["\"linux/random.h\"", "private", "<linux/random.h>", "public"] },
{ include: ["\"linux/rculist.h\"", "private", "<linux/rculist.h>", "public"] },
{ include: ["\"linux/rcupdate.h\"", "private", "<linux/rcupdate.h>", "public"] },
{ include: ["\"linux/rcutree.h\"", "private", "<linux/rcupdate.h>", "public"] },
{ include: ["\"linux/rtnetlink.h\"", "private", "<linux/rtnetlink.h>", "public"] },
{ include: ["\"linux/seq_file.h\"", "private", "<linux/seq_file.h>", "public"] },
{ include: ["\"linux/skbuff.h\"", "private", "<linux/skbuff.h>", "public"] },
{ include: ["\"linux/slab.h\"", "private", "<linux/slab.h>", "public"] },
{ include: ["\"linux/socket.h\"", "private", "<linux/socket.h>", "public"] },
{ include: ["\"linux/spinlock.h\"", "private", "<linux/spinlock.h>", "public"] },
{ include: ["\"linux/spinlock_types.h\"", "private", "<linux/spinlock.h>", "public"] },
{ include: ["\"linux/stat.h\"", "private", "<linux/stat.h>", "public"] },
{ include: ["\"linux/stddef.h\"", "private", "<linux/stddef.h>", "public"] },
{ include: ["\"linux/string.h\"", "private", "<linux/string.h>", "public"] },
{ include: ["\"linux/stringify.h\"", "private", "<linux/stringify.h>", "public"] },
{ include: ["\"linux/sysfs.h\"", "private", "<linux/sysfs.h>", "public"] },
{ include: ["\"linux/types.h\"", "private", "<linux/types.h>", "public"] },
{ include: ["\"linux/udp.h\"", "private", "<linux/udp.h>", "public"] },
{ include: ["\"linux/wait.h\"", "private", "<linux/wait.h>", "public"] },
{ include: ["\"linux/workqueue.h\"", "private", "<linux/workqueue.h>", "public"] },
{ include: ["\"net/addrconf.h\"", "private", "<net/addrconf.h>", "public"] },
{ include: ["\"net/ipv6.h\"", "private", "<net/ipv6.h>", "public"] },
{ include: ["\"net/net_namespace.h\"", "private", "<net/net_namespace.h>", "public"] },
{ include: ["\"net/rtnetlink.h\"", "private", "<net/rtnetlink.h>", "public"] },
]
=2D-nextPart1757407.5OSSQHo2tk--
This is a multi-part message in MIME format.

[-- Attachment #1.2: Type: text/plain, Size: 1122 bytes --]

On Tuesday 24 March 2015 12:41:07 Markus Pargmann wrote:
> Hi Sven,
> 
> On Sun, Mar 22, 2015 at 02:34:33AM +0100, Sven Eckelmann wrote:
> > On Sunday 22 March 2015 01:52:40 Sven Eckelmann wrote:
> > > On Friday 26 December 2014 12:41:17 Markus Pargmann wrote:
> > > > Markus Pargmann (26):
> > > [...]
> > > 
> > > >   batman-adv: packet.h, add some missing includes
> > > >   batman-adv: types.h, add missing include
> > > 
> > > Just went through the includes and noticed that a lot more are missing
> > > (also in the files which you are already touched). I have attached the
> > > current state of my analysis so you can compare it with your notes.
> 
> Do you have any tool which makes this include analysis easier?

I've started to test iwyu but the output cannot really be trusted. But at 
least it can help to spot things.

make -k CC="iwyu -Xiwyu --no_default_mappings  -Xiwyu --verbose=1 -Xiwyu --
mapping_file=$HOME/kernel_mappings.iwyu" CONFIG_BATMAN_ADV_NC=y 
CONFIG_BATMAN_ADV_DEBUG=y

The header files are for example also not all analyzed. So you have to fiddle 
around with them too.

Kind regards,
	Sven

[-- Attachment #1.3: kernel_mappings.iwyu --]
[-- Type: text/plain, Size: 6247 bytes --]

[
{ include: ["\"linux/compiler-gcc.h\"", "private", "<linux/compiler.h>", "public"] },
{ include: ["\"asm/atomic.h\"", "private", "<linux/atomic.h>", "public"] },
{ include: ["\"asm/bitops.h\"", "private", "<linux/bitops.h>", "public"] },
{ include: ["\"asm/cache.h\"", "private", "<linux/cache.h>", "public"] },
{ include: ["\"asm-generic/bug.h\"", "private", "<linux/bug.h>", "public"] },
{ include: ["\"asm-generic/errno-base.h\"", "private", "<linux/errno.h>", "public"] },
{ include: ["\"asm-generic/errno.h\"", "private", "<linux/errno.h>", "public"] },
{ include: ["\"asm-generic/fcntl.h\"", "private", "<linux/fcntl.h>", "public"] },
{ include: ["\"asm-generic/int-ll64.h\"", "private", "<linux/types.h>", "public"] },
{ include: ["\"asm-generic/poll.h\"", "private", "<linux/poll.h>", "public"] },
{ include: ["\"asm/percpu.h\"", "private", "<linux/percpu.h>", "public"] },
{ include: ["\"asm/string_64.h\"", "private", "<linux/string.h>", "public"] },
{ include: ["\"asm/uaccess.h\"", "private", "<linux/uaccess.h>", "public"] },
{ include: ["\"linux/atomic.h\"", "private", "<linux/atomic.h>", "public"] },
{ include: ["\"linux/bitmap.h\"", "private", "<linux/bitmap.h>", "public"] },
{ include: ["\"linux/bitops.h\"", "private", "<linux/bitops.h>", "public"] },
{ include: ["\"linux/bug.h\"", "private", "<linux/bug.h>", "public"] },
{ include: ["\"linux/byteorder/generic.h\"", "private", "<linux/byteorder/generic.h>", "public"] },
{ include: ["\"linux/compiler.h\"", "private", "<linux/compiler.h>", "public"] },
{ include: ["\"linux/cpumask.h\"", "private", "<linux/cpumask.h>", "public"] },
{ include: ["\"linux/device.h\"", "private", "<linux/device.h>", "public"] },
{ include: ["\"linux/err.h\"", "private", "<linux/device.h>", "public"] },
{ include: ["\"linux/etherdevice.h\"", "private", "<linux/etherdevice.h>", "public"] },
{ include: ["\"linux/ethtool.h\"", "private", "<linux/ethtool.h>", "public"] },
{ include: ["\"linux/export.h\"", "private", "<linux/export.h>", "public"] },
{ include: ["\"linux/fs.h\"", "private", "<linux/fs.h>", "public"] },
{ include: ["\"linux/gfp.h\"", "private", "<linux/fs.h>", "public"] },
{ include: ["\"linux/if_arp.h\"", "private", "<linux/if_arp.h>", "public"] },
{ include: ["\"linux/if_ether.h\"", "private", "<linux/if_ether.h>", "public"] },
{ include: ["\"linux/if.h\"", "private", "<linux/if.h>", "public"] },
{ include: ["\"linux/if_packet.h\"", "private", "<linux/if_packet.h>", "public"] },
{ include: ["\"linux/if_vlan.h\"", "private", "<linux/if_vlan.h>", "public"] },
{ include: ["\"linux/in6.h\"", "private", "<linux/in6.h>", "public"] },
{ include: ["\"linux/in.h\"", "private", "<linux/in.h>", "public"] },
{ include: ["\"linux/init.h\"", "private", "<linux/init.h>", "public"] },
{ include: ["\"linux/ip.h\"", "private", "<linux/ip.h>", "public"] },
{ include: ["\"linux/ipv6.h\"", "private", "<linux/ipv6.h>", "public"] },
{ include: ["\"linux/jhash.h\"", "private", "<linux/jhash.h>", "public"] },
{ include: ["\"linux/jiffies.h\"", "private", "<linux/jiffies.h>", "public"] },
{ include: ["\"linux/kconfig.h\"", "private", "<linux/kconfig.h>", "public"] },
{ include: ["\"linux/kernel.h\"", "private", "<linux/kernel.h>", "public"] },
{ include: ["\"linux/kern_levels.h\"", "private", "<linux/printk.h>", "public"] },
{ include: ["\"linux/kobject.h\"", "private", "<linux/printk.h>", "public"] },
{ include: ["\"linux/list.h\"", "private", "<linux/list.h>", "public"] },
{ include: ["\"linux/lockdep.h\"", "private", "<linux/lockdep.h>", "public"] },
{ include: ["\"linux/module.h\"", "private", "<linux/module.h>", "public"] },
{ include: ["\"linux/moduleparam.h\"", "private", "<linux/moduleparam.h>", "public"] },
{ include: ["\"linux/netdev_features.h\"", "private", "<linux/netdevice.h>", "public"] },
{ include: ["\"linux/netdevice.h\"", "private", "<linux/netdevice.h>", "public"] },
{ include: ["\"linux/net.h\"", "private", "<linux/netdevice.h>", "public"] },
{ include: ["\"linux/notifier.h\"", "private", "<linux/notifier.h>", "public"] },
{ include: ["\"linux/percpu.h\"", "private", "<linux/percpu.h>", "public"] },
{ include: ["\"linux/pkt_sched.h\"", "private", "<linux/pkt_sched.h>", "public"] },
{ include: ["\"linux/poll.h\"", "private", "<linux/poll.h>", "public"] },
{ include: ["\"linux/printk.h\"", "private", "<linux/printk.h>", "public"] },
{ include: ["\"linux/random.h\"", "private", "<linux/random.h>", "public"] },
{ include: ["\"linux/rculist.h\"", "private", "<linux/rculist.h>", "public"] },
{ include: ["\"linux/rcupdate.h\"", "private", "<linux/rcupdate.h>", "public"] },
{ include: ["\"linux/rcutree.h\"", "private", "<linux/rcupdate.h>", "public"] },
{ include: ["\"linux/rtnetlink.h\"", "private", "<linux/rtnetlink.h>", "public"] },
{ include: ["\"linux/seq_file.h\"", "private", "<linux/seq_file.h>", "public"] },
{ include: ["\"linux/skbuff.h\"", "private", "<linux/skbuff.h>", "public"] },
{ include: ["\"linux/slab.h\"", "private", "<linux/slab.h>", "public"] },
{ include: ["\"linux/socket.h\"", "private", "<linux/socket.h>", "public"] },
{ include: ["\"linux/spinlock.h\"", "private", "<linux/spinlock.h>", "public"] },
{ include: ["\"linux/spinlock_types.h\"", "private", "<linux/spinlock.h>", "public"] },
{ include: ["\"linux/stat.h\"", "private", "<linux/stat.h>", "public"] },
{ include: ["\"linux/stddef.h\"", "private", "<linux/stddef.h>", "public"] },
{ include: ["\"linux/string.h\"", "private", "<linux/string.h>", "public"] },
{ include: ["\"linux/stringify.h\"", "private", "<linux/stringify.h>", "public"] },
{ include: ["\"linux/sysfs.h\"", "private", "<linux/sysfs.h>", "public"] },
{ include: ["\"linux/types.h\"", "private", "<linux/types.h>", "public"] },
{ include: ["\"linux/udp.h\"", "private", "<linux/udp.h>", "public"] },
{ include: ["\"linux/wait.h\"", "private", "<linux/wait.h>", "public"] },
{ include: ["\"linux/workqueue.h\"", "private", "<linux/workqueue.h>", "public"] },
{ include: ["\"net/addrconf.h\"", "private", "<net/addrconf.h>", "public"] },
{ include: ["\"net/ipv6.h\"", "private", "<net/ipv6.h>", "public"] },
{ include: ["\"net/net_namespace.h\"", "private", "<net/net_namespace.h>", "public"] },
{ include: ["\"net/rtnetlink.h\"", "private", "<net/rtnetlink.h>", "public"] },
]

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2015-03-24 11:47 UTC | newest]

Thread overview: 67+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-26 11:41 [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Markus Pargmann
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 01/26] batman-adv: debugfs, avoid compiling for !DEBUG_FS Markus Pargmann
2015-01-11 10:32   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 02/26] batman-adv: Separate logging header Markus Pargmann
2014-12-28  2:33   ` Marek Lindner
2014-12-28 11:08     ` Markus Pargmann
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 03/26] batman-adv: iv_ogm, Reduce code duplication Markus Pargmann
2015-01-11 10:38   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 04/26] batman-adv: iv_ogm, divide and round for ring buffer avg Markus Pargmann
2015-01-11 12:32   ` Marek Lindner
2015-01-11 12:42     ` Sven Eckelmann
2015-01-12 15:56   ` Simon Wunderlich
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 05/26] batman-adv: init, Add some error handling Markus Pargmann
2015-01-11 12:38   ` Marek Lindner
2015-01-14 15:24     ` Markus Pargmann
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 06/26] batman-adv: tvlv realloc, move error handling into if block Markus Pargmann
2015-01-11 12:40   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 07/26] batman-adv: split tvlv into a seperate file Markus Pargmann
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 08/26] batman-adv: Makefile, Sort alphabetically Markus Pargmann
2015-01-11 12:44   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 09/26] batman-adv: iv_ogm_iface_enable, direct return values Markus Pargmann
2015-01-11 12:46   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 10/26] batman-adv: iv_ogm_aggr_packet, bool return value Markus Pargmann
2015-01-11 12:48   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 11/26] batman-adv: iv_ogm_send_to_if, declare char* as const Markus Pargmann
2015-02-18  9:14   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 12/26] batman-adv: iv_ogm_can_aggregate, code readability Markus Pargmann
2015-02-19 16:20   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 13/26] batman-adv: iv_ogm_orig_update, remove unnecessary brackets Markus Pargmann
2015-02-20 11:53   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 14/26] batman-adv: iv_ogm_aggregate_new, simplify error handling Markus Pargmann
2015-02-23 16:50   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 15/26] batman-adv: iv_ogm_queue_add, Simplify expressions Markus Pargmann
2015-02-24 21:20   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 16/26] batman-adv: iv_ogm_orig_update, style, add missin brackets Markus Pargmann
2015-02-27 18:42   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 17/26] batman-adv: iv_ogm, Fix dup_status comment Markus Pargmann
2015-02-27 18:43   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 18/26] batman-adv: iv_ogm, fix coding style Markus Pargmann
2015-02-28 15:59   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 19/26] batman-adv: iv_ogm, fix comment function name Markus Pargmann
2015-03-01  9:00   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 20/26] batman-adv: types, Fix comment on bcast_own Markus Pargmann
2015-03-09  0:28   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 21/26] batman-adv: main, Convert is_my_mac() to bool Markus Pargmann
2015-03-11  9:45   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 22/26] batman-adv: main, batadv_compare_eth return bool Markus Pargmann
2015-03-11  9:48   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 23/26] batman-adv: Remove unnecessary ret variable Markus Pargmann
2015-03-13  6:04   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 24/26] batman-adv: Remove unnecessary ret variable in algo_register Markus Pargmann
2015-03-13  6:06   ` Marek Lindner
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 25/26] batman-adv: packet.h, add some missing includes Markus Pargmann
2014-12-27 14:30   ` Antonio Quartulli
2014-12-27 17:03     ` Markus Pargmann
2014-12-31 17:55       ` Antonio Quartulli
2015-01-14 16:27         ` Markus Pargmann
2014-12-28  2:35   ` Marek Lindner
2014-12-28 11:11     ` Markus Pargmann
2015-03-21 22:36   ` Sven Eckelmann
2015-03-24 11:10     ` Markus Pargmann
2014-12-26 11:41 ` [B.A.T.M.A.N.] [PATCH v2 26/26] batman-adv: types.h, add missing include Markus Pargmann
2014-12-28  2:35   ` Marek Lindner
2015-03-22  0:52 ` [B.A.T.M.A.N.] [PATCH v2 00/26] batman-adv: Cleanups Sven Eckelmann
2015-03-22  1:34   ` Sven Eckelmann
2015-03-24 11:41     ` Markus Pargmann
2015-03-24 11:47       ` Sven Eckelmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.