@@ -25,6 +25,7 @@
#include "send.h"
#include "bat_algo.h"
#include "network-coding.h"
+#include "log.h"
/**
* enum batadv_dup_status - duplicate status
@@ -17,6 +17,7 @@
#include "main.h"
#include "bitarray.h"
+#include "log.h"
#include <linux/bitops.h>
@@ -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>
@@ -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;
@@ -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);
@@ -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);
@@ -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>
@@ -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
@@ -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>
@@ -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];
new file mode 100644
@@ -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_ */
@@ -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
@@ -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
@@ -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;
@@ -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;
@@ -27,6 +27,7 @@
#include "distributed-arp-table.h"
#include "network-coding.h"
#include "fragmentation.h"
+#include "log.h"
#include <linux/if_vlan.h>
@@ -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);
@@ -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)
{
@@ -25,6 +25,7 @@
#include "routing.h"
#include "bridge_loop_avoidance.h"
#include "multicast.h"
+#include "log.h"
#include <linux/crc32c.h>