Skip to contentSkip to conversation

pull request for net-next: batman-adv 2016-10-27

PATCH In review Simon Wunderlich 10 participants 36 messages Oct 27, 2016 – Aug 4, 2018 5 messages not in the archive

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover pull request for net-next: batman-adv 2016-10-27

Hi David,

this is our first feature pull request for batman-adv (mostly containing code cleanup stuff), there are at least two more to come.

Please pull or let me know of any problem!

Thank you,
Simon

The following changes since commit 29fbff8698fc0ac1a1d74584b258e0bf18b469f9:

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net (2016-10-13 21:40:23 -0700)

are available in the git repository at:

git://git.open-mesh.org/linux-merge.git tags/batadv-next-for-davem-20161027

for you to fetch changes up to 4c7da0f6dbcde2431d773ce03cde5e7abede54e0:

batman-adv: Avoid precedence issues in macros (2016-10-19 08:37:54 +0200)

----------------------------------------------------------------
This code cleanup patchset includes the following changes (chronological order):

- bump version strings, by Simon Wunderlich

- README updates/clean up, by Sven Eckelmann (4 patches)

- Code clean up and restructuring by Sven Eckelmann (2 patches)

- Kerneldoc fix in forw_packet structure, by Linus Luessing

- Remove unused argument in dbg_arp, by Antonio Quartulli

- Add support to build batman-adv without wireless, by Linus Luessing

- Restructure error handling for is_ap_isolated, by Markus Elfring

- Remove unused initialization in various functions, by Sven Eckelmann

- Use better names for fragment and gateway list heads, by Sven Eckelmann (2 patches)

- Convert to octal permissions for files, by Sven Eckelmann

- Avoid precedence issues for some macros, by Sven Eckelmann

----------------------------------------------------------------
Antonio Quartulli (1):
batman-adv: remove unsed argument from batadv_dbg_arp() function

Linus Lüssing (2):
batman-adv: fix batadv_forw_packet kerneldoc for list attribute
batman-adv: Allow selecting BATMAN V if CFG80211 is not built

Markus Elfring (1):
batman-adv: Less function calls in batadv_is_ap_isolated() after error detection

Simon Wunderlich (1):
batman-adv: Start new development cycle

Sven Eckelmann (12):
batman-adv: Add B.A.T.M.A.N. V sysfs files to README
batman-adv: Add network_coding and mcast sysfs files to README
batman-adv: Add dat, mcast, nc and neighbor debugfs files to README
batman-adv: Document new nc, mcast and tpmeter log levels
batman-adv: Remove unused function batadv_hash_delete
batman-adv: Move batadv_sum_counter to soft-interface.c
batman-adv: Remove unused batadv_icmp_user_cmd_type
batman-adv: Remove needless init of variables on stack
batman-adv: Use proper name for fragments list head
batman-adv: Use proper name for gateway list head
batman-adv: Use octal permissions instead of macros
batman-adv: Avoid precedence issues in macros

 Documentation/networking/batman-adv.txt | 35 ++++++++++++----------
 net/batman-adv/Kconfig                  |  2 +-
 net/batman-adv/bat_iv_ogm.c             |  6 ++--
 net/batman-adv/bat_v.c                  |  8 ++---
 net/batman-adv/bat_v_ogm.c              |  4 +--
 net/batman-adv/debugfs.c                | 26 ++++++++--------
 net/batman-adv/distributed-arp-table.c  | 17 ++++-------
 net/batman-adv/fragmentation.c          | 18 +++++------
 net/batman-adv/fragmentation.h          |  2 +-
 net/batman-adv/gateway_client.c         |  9 +++---
 net/batman-adv/hash.h                   | 30 -------------------
 net/batman-adv/icmp_socket.c            |  5 ++--
 net/batman-adv/log.c                    |  4 +--
 net/batman-adv/log.h                    | 12 ++++----
 net/batman-adv/main.c                   |  2 +-
 net/batman-adv/main.h                   | 27 ++---------------
 net/batman-adv/network-coding.c         |  8 ++---
 net/batman-adv/originator.c             | 10 +++----
 net/batman-adv/packet.h                 | 12 +-------
 net/batman-adv/send.c                   |  2 +-
 net/batman-adv/soft-interface.c         | 21 +++++++++++++
 net/batman-adv/sysfs.c                  | 53 ++++++++++++++-------------------
 net/batman-adv/translation-table.c      | 25 +++++++---------
 net/batman-adv/types.h                  | 16 +++++-----
 24 files changed, 149 insertions(+), 205 deletions(-)
#2 lore raw

PATCH 1/17 batman-adv: Start new development cycle

In reply to a message not in the archive
---
 net/batman-adv/main.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/main.h +1 -1
index 09af21e..8b0979b 100644
@@ -24,7 +24,7 @@
 #define BATADV_DRIVER_DEVICE "batman-adv"
 
 #ifndef BATADV_SOURCE_VERSION
-#define BATADV_SOURCE_VERSION "2016.4"
+#define BATADV_SOURCE_VERSION "2016.5"
 #endif
 
 /* B.A.T.M.A.N. parameters */
Signature · 1 line
2.10.1
#3 lore raw

PATCH 2/17 batman-adv: Add B.A.T.M.A.N. V sysfs files to README

In reply to a message not in the archive

From: Sven Eckelmann <[email protected]>

---
 Documentation/networking/batman-adv.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/networking/batman-adv.txt +1 -1
index 8a8d3d9..d414e60 100644
@@ -32,7 +32,7 @@ compatible interfaces. Once found, it will create  subfolders  in
 the /sys directories of each supported interface, e.g.
 
 # ls /sys/class/net/eth0/batman_adv/
-# iface_status  mesh_iface
+# elp_interval  iface_status  mesh_iface  throughput_override
 
 If an interface does not have the "batman_adv" subfolder it prob-
 ably is not supported. Not supported  interfaces  are:  loopback,
Signature · 1 line
2.10.1
#4 lore raw

PATCH 3/17 batman-adv: Add network_coding and mcast sysfs files to README

In reply to a message not in the archive

From: Sven Eckelmann <[email protected]>

---
 Documentation/networking/batman-adv.txt | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
Documentation/networking/batman-adv.txt +5 -4
index d414e60..8afa991 100644
@@ -71,10 +71,11 @@ All  mesh  wide  settings  can be found in batman's own interface
 folder:
 
 # ls /sys/class/net/bat0/mesh/
-#aggregated_ogms        distributed_arp_table  gw_sel_class    orig_interval
-#ap_isolation           fragmentation          hop_penalty     routing_algo
-#bonding                gw_bandwidth           isolation_mark  vlan0
-#bridge_loop_avoidance  gw_mode                log_level
+# aggregated_ogms        fragmentation  isolation_mark  routing_algo
+# ap_isolation           gw_bandwidth   log_level       vlan0
+# bonding                gw_mode        multicast_mode
+# bridge_loop_avoidance  gw_sel_class   network_coding
+# distributed_arp_table  hop_penalty    orig_interval
 
 There is a special folder for debugging information:
 
Signature · 1 line
2.10.1
maintainer
#23 lore raw

PATCH 4/17 batman-adv: Add dat, mcast, nc and neighbor debugfs files to README

In reply to Simon Wunderlich

From: Sven Eckelmann <[email protected]>

---
 Documentation/networking/batman-adv.txt | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Documentation/networking/batman-adv.txt +4 -3
index 8afa991..a918131 100644
@@ -80,9 +80,10 @@ folder:
 There is a special folder for debugging information:
 
 # ls /sys/kernel/debug/batman_adv/bat0/
-# bla_backbone_table  log                 transtable_global
-# bla_claim_table     originators         transtable_local
-# gateways            socket
+# bla_backbone_table  log          neighbors          transtable_local
+# bla_claim_table     mcast_flags  originators
+# dat_cache           nc           socket
+# gateways            nc_nodes     transtable_global
 
 Some of the files contain all sort of status information  regard-
 ing  the  mesh  network.  For  example, you can view the table of
Signature · 1 line
2.10.1
maintainer
#24 lore raw

PATCH 5/17 batman-adv: Document new nc, mcast and tpmeter log levels

In reply to Simon Wunderlich

From: Sven Eckelmann <[email protected]>

---
 Documentation/networking/batman-adv.txt | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
Documentation/networking/batman-adv.txt +10 -7
index a918131..ccf9467 100644
@@ -161,13 +161,16 @@ file in debugfs
 The additional debug output is by default disabled. It can be en-
 abled  during run time. Following log_levels are defined:
 
-0 - All  debug  output  disabled
-1 - Enable messages related to routing / flooding / broadcasting
-2 - Enable messages related to route added / changed / deleted
-4 - Enable messages related to translation table operations
-8 - Enable messages related to bridge loop avoidance
-16 - Enable messaged related to DAT, ARP snooping and parsing
-31 - Enable all messages
+  0 - All  debug  output  disabled
+  1 - Enable messages related to routing / flooding / broadcasting
+  2 - Enable messages related to route added / changed / deleted
+  4 - Enable messages related to translation table operations
+  8 - Enable messages related to bridge loop avoidance
+ 16 - Enable messages related to DAT, ARP snooping and parsing
+ 32 - Enable messages related to network coding
+ 64 - Enable messages related to multicast
+128 - Enable messages related to throughput meter
+255 - Enable all messages
 
 The debug output can be changed at runtime  using  the  file
 /sys/class/net/bat0/mesh/log_level. e.g.
Signature · 1 line
2.10.1
#21 lore raw

PATCH 6/17 batman-adv: Remove unused function batadv_hash_delete

In reply to a message not in the archive

From: Sven Eckelmann <[email protected]>

---
 net/batman-adv/hash.h | 30 ------------------------------
 1 file changed, 30 deletions(-)
net/batman-adv/hash.h +0 -30
index cbbf870..557a704 100644
@@ -61,36 +61,6 @@ void batadv_hash_set_lock_class(struct batadv_hashtable *hash,
 /* free only the hashtable and the hash itself. */
 void batadv_hash_destroy(struct batadv_hashtable *hash);
 
-/* remove the hash structure. if hashdata_free_cb != NULL, this function will be
- * called to remove the elements inside of the hash.  if you don't remove the
- * elements, memory might be leaked.
- */
-static inline void batadv_hash_delete(struct batadv_hashtable *hash,
-				      batadv_hashdata_free_cb free_cb,
-				      void *arg)
-{
-	struct hlist_head *head;
-	struct hlist_node *node, *node_tmp;
-	spinlock_t *list_lock; /* spinlock to protect write access */
-	u32 i;
-
-	for (i = 0; i < hash->size; i++) {
-		head = &hash->table[i];
-		list_lock = &hash->list_locks[i];
-
-		spin_lock_bh(list_lock);
-		hlist_for_each_safe(node, node_tmp, head) {
-			hlist_del_rcu(node);
-
-			if (free_cb)
-				free_cb(node, arg);
-		}
-		spin_unlock_bh(list_lock);
-	}
-
-	batadv_hash_destroy(hash);
-}
-
 /**
  *	batadv_hash_add - adds data to the hashtable
  *	@hash: storage hash table
Signature · 1 line
2.10.1
maintainer
#25 lore raw

PATCH 7/17 batman-adv: Move batadv_sum_counter to soft-interface.c

In reply to Simon Wunderlich

From: Sven Eckelmann <[email protected]>

The function batadv_sum_counter is only used in soft-interface.c and has no special relevance for main.h.

---
 net/batman-adv/main.h           | 21 ---------------------
 net/batman-adv/soft-interface.c | 21 +++++++++++++++++++++
 2 files changed, 21 insertions(+), 21 deletions(-)
net/batman-adv/main.h +0 -21
index 8b0979b..6a2328d 100644
@@ -185,7 +185,6 @@ enum batadv_uev_type {
 
 #include <linux/bitops.h> /* for packet.h */
 #include <linux/compiler.h>
-#include <linux/cpumask.h>
 #include <linux/etherdevice.h>
 #include <linux/if_ether.h> /* for packet.h */
 #include <linux/if_vlan.h>
@@ -284,26 +283,6 @@ static inline void batadv_add_counter(struct batadv_priv *bat_priv, size_t idx,
 
 #define batadv_inc_counter(b, i) batadv_add_counter(b, i, 1)
 
-/**
- * batadv_sum_counter - Sum the cpu-local counters for index 'idx'
- * @bat_priv: the bat priv with all the soft interface information
- * @idx: index of counter to sum up
- *
- * Return: sum of all cpu-local counters
- */
-static inline u64 batadv_sum_counter(struct batadv_priv *bat_priv,  size_t idx)
-{
-	u64 *counters, sum = 0;
-	int cpu;
-
-	for_each_possible_cpu(cpu) {
-		counters = per_cpu_ptr(bat_priv->bat_counters, cpu);
-		sum += counters[idx];
-	}
-
-	return sum;
-}
-
 /* Define a macro to reach the control buffer of the skb. The members of the
  * control buffer are defined in struct batadv_skb_cb in types.h.
  * The macro is inspired by the similar macro TCP_SKB_CB() in tcp.h.
net/batman-adv/soft-interface.c +21 -0
index 49e16b6..f37c1c7 100644
@@ -22,6 +22,7 @@
 #include <linux/byteorder/generic.h>
 #include <linux/cache.h>
 #include <linux/compiler.h>
+#include <linux/cpumask.h>
 #include <linux/errno.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
@@ -116,6 +117,26 @@ static int batadv_interface_release(struct net_device *dev)
 	return 0;
 }
 
+/**
+ * batadv_sum_counter - Sum the cpu-local counters for index 'idx'
+ * @bat_priv: the bat priv with all the soft interface information
+ * @idx: index of counter to sum up
+ *
+ * Return: sum of all cpu-local counters
+ */
+static u64 batadv_sum_counter(struct batadv_priv *bat_priv,  size_t idx)
+{
+	u64 *counters, sum = 0;
+	int cpu;
+
+	for_each_possible_cpu(cpu) {
+		counters = per_cpu_ptr(bat_priv->bat_counters, cpu);
+		sum += counters[idx];
+	}
+
+	return sum;
+}
+
 static struct net_device_stats *batadv_interface_stats(struct net_device *dev)
 {
 	struct batadv_priv *bat_priv = netdev_priv(dev);
Signature · 1 line
2.10.1
maintainer
#26 lore raw

PATCH 8/17 batman-adv: Remove unused batadv_icmp_user_cmd_type

In reply to Simon Wunderlich

From: Sven Eckelmann <[email protected]>

---
 net/batman-adv/packet.h | 10 ----------
 1 file changed, 10 deletions(-)
net/batman-adv/packet.h +0 -10
index 6afc0b8..d2e9bbd 100644
@@ -252,16 +252,6 @@ struct batadv_elp_packet {
 #define BATADV_ELP_HLEN sizeof(struct batadv_elp_packet)
 
 /**
- * enum batadv_icmp_user_cmd_type - types for batman-adv icmp cmd modes
- * @BATADV_TP_START: start a throughput meter run
- * @BATADV_TP_STOP: stop a throughput meter run
- */
-enum batadv_icmp_user_cmd_type {
-	BATADV_TP_START		= 0,
-	BATADV_TP_STOP		= 2,
-};
-
-/**
  * struct batadv_icmp_header - common members among all the ICMP packets
  * @packet_type: batman-adv packet type, part of the general header
  * @version: batman-adv protocol version, part of the genereal header
Signature · 1 line
2.10.1
maintainer
#27 lore raw

PATCH 9/17 batman-adv: fix batadv_forw_packet kerneldoc for list attribute

In reply to Simon Wunderlich

From: Linus Lüssing <[email protected]>

The forw_packet list node is wrongly attributed to the icmp socket code.

---
 net/batman-adv/types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/types.h +1 -1
index b3dd1a3..97336ec 100644
@@ -1363,7 +1363,7 @@ struct batadv_skb_cb {
 
 /**
  * struct batadv_forw_packet - structure for bcast packets to be sent/forwarded
- * @list: list node for batadv_socket_client::queue_list
+ * @list: list node for batadv_priv::forw_{bat,bcast}_list
  * @send_time: execution time for delayed_work (packet sending)
  * @own: bool for locally generated packets (local OGMs are re-scheduled after
  *  sending)
Signature · 1 line
2.10.1
maintainer
#28 lore raw

PATCH 10/17 batman-adv: remove unsed argument from batadv_dbg_arp() function

In reply to Simon Wunderlich

From: Antonio Quartulli <[email protected]>

The argument "type" passed to the batadv_dbg_arp() function is never used. Remove it.

---
 net/batman-adv/distributed-arp-table.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)
net/batman-adv/distributed-arp-table.c +6 -11
index e257efd..cbb4f32 100644
@@ -369,12 +369,11 @@ static void batadv_dat_entry_add(struct batadv_priv *bat_priv, __be32 ip,
  * batadv_dbg_arp - print a debug message containing all the ARP packet details
  * @bat_priv: the bat priv with all the soft interface information
  * @skb: ARP packet
- * @type: ARP type
  * @hdr_size: size of the possible header before the ARP packet
  * @msg: message to print together with the debugging information
  */
 static void batadv_dbg_arp(struct batadv_priv *bat_priv, struct sk_buff *skb,
-			   u16 type, int hdr_size, char *msg)
+			   int hdr_size, char *msg)
 {
 	struct batadv_unicast_4addr_packet *unicast_4addr_packet;
 	struct batadv_bcast_packet *bcast_pkt;
@@ -441,7 +440,7 @@ static void batadv_dbg_arp(struct batadv_priv *bat_priv, struct sk_buff *skb,
 #else
 
 static void batadv_dbg_arp(struct batadv_priv *bat_priv, struct sk_buff *skb,
-			   u16 type, int hdr_size, char *msg)
+			   int hdr_size, char *msg)
 {
 }
 
@@ -983,8 +982,7 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
 	if (type != ARPOP_REQUEST)
 		goto out;
 
-	batadv_dbg_arp(bat_priv, skb, type, hdr_size,
-		       "Parsing outgoing ARP REQUEST");
+	batadv_dbg_arp(bat_priv, skb, hdr_size, "Parsing outgoing ARP REQUEST");
 
 	ip_src = batadv_arp_ip_src(skb, hdr_size);
 	hw_src = batadv_arp_hw_src(skb, hdr_size);
@@ -1075,8 +1073,7 @@ bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv,
 	ip_src = batadv_arp_ip_src(skb, hdr_size);
 	ip_dst = batadv_arp_ip_dst(skb, hdr_size);
 
-	batadv_dbg_arp(bat_priv, skb, type, hdr_size,
-		       "Parsing incoming ARP REQUEST");
+	batadv_dbg_arp(bat_priv, skb, hdr_size, "Parsing incoming ARP REQUEST");
 
 	batadv_dat_entry_add(bat_priv, ip_src, hw_src, vid);
 
@@ -1149,8 +1146,7 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv,
 	if (type != ARPOP_REPLY)
 		return;
 
-	batadv_dbg_arp(bat_priv, skb, type, hdr_size,
-		       "Parsing outgoing ARP REPLY");
+	batadv_dbg_arp(bat_priv, skb, hdr_size, "Parsing outgoing ARP REPLY");
 
 	hw_src = batadv_arp_hw_src(skb, hdr_size);
 	ip_src = batadv_arp_ip_src(skb, hdr_size);
@@ -1195,8 +1191,7 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv,
 	if (type != ARPOP_REPLY)
 		goto out;
 
-	batadv_dbg_arp(bat_priv, skb, type, hdr_size,
-		       "Parsing incoming ARP REPLY");
+	batadv_dbg_arp(bat_priv, skb, hdr_size, "Parsing incoming ARP REPLY");
 
 	hw_src = batadv_arp_hw_src(skb, hdr_size);
 	ip_src = batadv_arp_ip_src(skb, hdr_size);
Signature · 1 line
2.10.1
maintainer
#29 lore raw

PATCH 11/17 batman-adv: Allow selecting BATMAN V if CFG80211 is not built

In reply to Simon Wunderlich

From: Linus Lüssing <[email protected]>

With the new stub for cfg80211_get_station(), we can now build the BATMAN V protocol even with a kernel that was built without any wireless support.

---
 net/batman-adv/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/Kconfig +1 -1
index f20742c..b73b96a 100644
@@ -17,7 +17,7 @@ config BATMAN_ADV
 
 config BATMAN_ADV_BATMAN_V
 	bool "B.A.T.M.A.N. V protocol (experimental)"
-	depends on BATMAN_ADV && CFG80211=y || (CFG80211=m && BATMAN_ADV=m)
+	depends on BATMAN_ADV && !(CFG80211=m && BATMAN_ADV=y)
 	default n
 	help
 	  This option enables the B.A.T.M.A.N. V protocol, the successor
Signature · 1 line
2.10.1
maintainer
#30 lore raw

PATCH 12/17 batman-adv: Less function calls in batadv_is_ap_isolated() after error detection

In reply to Simon Wunderlich

From: Markus Elfring <[email protected]>

The variables "tt_local_entry" and "tt_global_entry" were eventually checked again despite of a corresponding null pointer test before.

* Avoid this double check by reordering a function call sequence and the better selection of jump targets.

* Omit the initialisation for these variables at the beginning then.

---
 net/batman-adv/translation-table.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)
net/batman-adv/translation-table.c +11 -14
index 7f66309..ad1e3bc 100644
@@ -3835,8 +3835,8 @@ void batadv_tt_local_commit_changes(struct batadv_priv *bat_priv)
 bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst,
 			   unsigned short vid)
 {
-	struct batadv_tt_local_entry *tt_local_entry = NULL;
-	struct batadv_tt_global_entry *tt_global_entry = NULL;
+	struct batadv_tt_local_entry *tt_local_entry;
+	struct batadv_tt_global_entry *tt_global_entry;
 	struct batadv_softif_vlan *vlan;
 	bool ret = false;
 
@@ -3845,27 +3845,24 @@ bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst,
 		return false;
 
 	if (!atomic_read(&vlan->ap_isolation))
-		goto out;
+		goto vlan_put;
 
 	tt_local_entry = batadv_tt_local_hash_find(bat_priv, dst, vid);
 	if (!tt_local_entry)
-		goto out;
+		goto vlan_put;
 
 	tt_global_entry = batadv_tt_global_hash_find(bat_priv, src, vid);
 	if (!tt_global_entry)
-		goto out;
-
-	if (!_batadv_is_ap_isolated(tt_local_entry, tt_global_entry))
-		goto out;
+		goto local_entry_put;
 
-	ret = true;
+	if (_batadv_is_ap_isolated(tt_local_entry, tt_global_entry))
+		ret = true;
 
-out:
+	batadv_tt_global_entry_put(tt_global_entry);
+local_entry_put:
+	batadv_tt_local_entry_put(tt_local_entry);
+vlan_put:
 	batadv_softif_vlan_put(vlan);
-	if (tt_global_entry)
-		batadv_tt_global_entry_put(tt_global_entry);
-	if (tt_local_entry)
-		batadv_tt_local_entry_put(tt_local_entry);
 	return ret;
 }
 
Signature · 1 line
2.10.1
maintainer
#31 lore raw

PATCH 13/17 batman-adv: Remove needless init of variables on stack

In reply to Simon Wunderlich

From: Sven Eckelmann <[email protected]>

Some variables are overwritten immediatelly in a functions. These don't have to be initialized to a specific value on the stack because the value will be overwritten before they will be used anywhere.

---
 net/batman-adv/bat_v.c          | 2 +-
 net/batman-adv/bat_v_ogm.c      | 4 ++--
 net/batman-adv/fragmentation.c  | 4 ++--
 net/batman-adv/gateway_client.c | 2 +-
 net/batman-adv/originator.c     | 8 ++++----
 net/batman-adv/send.c           | 2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)
net/batman-adv/bat_v.c +1 -1
index e79f6f0..57c795c 100644
@@ -787,7 +787,7 @@ static bool batadv_v_gw_is_eligible(struct batadv_priv *bat_priv,
 				    struct batadv_orig_node *curr_gw_orig,
 				    struct batadv_orig_node *orig_node)
 {
-	struct batadv_gw_node *curr_gw = NULL, *orig_gw = NULL;
+	struct batadv_gw_node *curr_gw, *orig_gw = NULL;
 	u32 gw_throughput, orig_throughput, threshold;
 	bool ret = false;
 
net/batman-adv/bat_v_ogm.c +2 -2
index 1aeeadc..61ff5f8 100644
@@ -401,7 +401,7 @@ static int batadv_v_ogm_metric_update(struct batadv_priv *bat_priv,
 				      struct batadv_hard_iface *if_incoming,
 				      struct batadv_hard_iface *if_outgoing)
 {
-	struct batadv_orig_ifinfo *orig_ifinfo = NULL;
+	struct batadv_orig_ifinfo *orig_ifinfo;
 	struct batadv_neigh_ifinfo *neigh_ifinfo = NULL;
 	bool protection_started = false;
 	int ret = -EINVAL;
@@ -486,7 +486,7 @@ static bool batadv_v_ogm_route_update(struct batadv_priv *bat_priv,
 				      struct batadv_hard_iface *if_outgoing)
 {
 	struct batadv_neigh_node *router = NULL;
-	struct batadv_orig_node *orig_neigh_node = NULL;
+	struct batadv_orig_node *orig_neigh_node;
 	struct batadv_neigh_node *orig_neigh_router = NULL;
 	struct batadv_neigh_ifinfo *router_ifinfo = NULL, *neigh_ifinfo = NULL;
 	u32 router_throughput, neigh_throughput;
net/batman-adv/fragmentation.c +2 -2
index 0934730..1b2f5b9 100644
@@ -252,7 +252,7 @@ batadv_frag_merge_packets(struct hlist_head *chain)
 {
 	struct batadv_frag_packet *packet;
 	struct batadv_frag_list_entry *entry;
-	struct sk_buff *skb_out = NULL;
+	struct sk_buff *skb_out;
 	int size, hdr_size = sizeof(struct batadv_frag_packet);
 
 	/* Remove first entry, as this is the destination for the rest of the
@@ -352,7 +352,7 @@ bool batadv_frag_skb_fwd(struct sk_buff *skb,
 			 struct batadv_orig_node *orig_node_src)
 {
 	struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface);
-	struct batadv_orig_node *orig_node_dst = NULL;
+	struct batadv_orig_node *orig_node_dst;
 	struct batadv_neigh_node *neigh_node = NULL;
 	struct batadv_frag_packet *packet;
 	u16 total_size;
net/batman-adv/gateway_client.c +1 -1
index de055d6..69bfe98 100644
@@ -704,7 +704,7 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
 {
 	struct batadv_neigh_node *neigh_curr = NULL;
 	struct batadv_neigh_node *neigh_old = NULL;
-	struct batadv_orig_node *orig_dst_node = NULL;
+	struct batadv_orig_node *orig_dst_node;
 	struct batadv_gw_node *gw_node = NULL;
 	struct batadv_gw_node *curr_gw = NULL;
 	struct batadv_neigh_ifinfo *curr_ifinfo, *old_ifinfo;
net/batman-adv/originator.c +4 -4
index 5f3bfc4..6af87c9 100644
@@ -364,7 +364,7 @@ struct batadv_orig_ifinfo *
 batadv_orig_ifinfo_new(struct batadv_orig_node *orig_node,
 		       struct batadv_hard_iface *if_outgoing)
 {
-	struct batadv_orig_ifinfo *orig_ifinfo = NULL;
+	struct batadv_orig_ifinfo *orig_ifinfo;
 	unsigned long reset_time;
 
 	spin_lock_bh(&orig_node->neigh_list_lock);
@@ -520,7 +520,7 @@ batadv_hardif_neigh_create(struct batadv_hard_iface *hard_iface,
 			   const u8 *neigh_addr)
 {
 	struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
-	struct batadv_hardif_neigh_node *hardif_neigh = NULL;
+	struct batadv_hardif_neigh_node *hardif_neigh;
 
 	spin_lock_bh(&hard_iface->neigh_list_lock);
 
@@ -563,7 +563,7 @@ static struct batadv_hardif_neigh_node *
 batadv_hardif_neigh_get_or_create(struct batadv_hard_iface *hard_iface,
 				  const u8 *neigh_addr)
 {
-	struct batadv_hardif_neigh_node *hardif_neigh = NULL;
+	struct batadv_hardif_neigh_node *hardif_neigh;
 
 	/* first check without locking to avoid the overhead */
 	hardif_neigh = batadv_hardif_neigh_get(hard_iface, neigh_addr);
@@ -683,7 +683,7 @@ batadv_neigh_node_get_or_create(struct batadv_orig_node *orig_node,
 				struct batadv_hard_iface *hard_iface,
 				const u8 *neigh_addr)
 {
-	struct batadv_neigh_node *neigh_node = NULL;
+	struct batadv_neigh_node *neigh_node;
 
 	/* first check without locking to avoid the overhead */
 	neigh_node = batadv_neigh_node_get(orig_node, hard_iface, neigh_addr);
net/batman-adv/send.c +1 -1
index 8d4e1f5..e1e9136 100644
@@ -562,7 +562,7 @@ int batadv_add_bcast_packet_to_list(struct batadv_priv *bat_priv,
 				    const struct sk_buff *skb,
 				    unsigned long delay)
 {
-	struct batadv_hard_iface *primary_if = NULL;
+	struct batadv_hard_iface *primary_if;
 	struct batadv_forw_packet *forw_packet;
 	struct batadv_bcast_packet *bcast_packet;
 	struct sk_buff *newskb;
Signature · 1 line
2.10.1
maintainer
#32 lore raw

PATCH 14/17 batman-adv: Use proper name for fragments list head

In reply to Simon Wunderlich

From: Sven Eckelmann <[email protected]>

The batman-adv codebase is using "list" for the list node (prev/next) and <list content descriptor>+"_list" for the head of a list. Not using this naming scheme can up in confusions because list_head is used for both the head of the list and the list node (prev/next) in each item of the list.

---
 net/batman-adv/fragmentation.c | 14 +++++++-------
 net/batman-adv/fragmentation.h |  2 +-
 net/batman-adv/originator.c    |  2 +-
 net/batman-adv/types.h         |  6 +++---
 4 files changed, 12 insertions(+), 12 deletions(-)
net/batman-adv/fragmentation.c +7 -7
index 1b2f5b9..2b967a3 100644
@@ -73,7 +73,7 @@ void batadv_frag_purge_orig(struct batadv_orig_node *orig_node,
 		spin_lock_bh(&chain->lock);
 
 		if (!check_cb || check_cb(chain)) {
-			batadv_frag_clear_chain(&chain->head);
+			batadv_frag_clear_chain(&chain->fragment_list);
 			chain->size = 0;
 		}
 
@@ -117,8 +117,8 @@ static bool batadv_frag_init_chain(struct batadv_frag_table_entry *chain,
 	if (chain->seqno == seqno)
 		return false;
 
-	if (!hlist_empty(&chain->head))
-		batadv_frag_clear_chain(&chain->head);
+	if (!hlist_empty(&chain->fragment_list))
+		batadv_frag_clear_chain(&chain->fragment_list);
 
 	chain->size = 0;
 	chain->seqno = seqno;
@@ -176,7 +176,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
 	chain = &orig_node->fragments[bucket];
 	spin_lock_bh(&chain->lock);
 	if (batadv_frag_init_chain(chain, seqno)) {
-		hlist_add_head(&frag_entry_new->list, &chain->head);
+		hlist_add_head(&frag_entry_new->list, &chain->fragment_list);
 		chain->size = skb->len - hdr_size;
 		chain->timestamp = jiffies;
 		chain->total_size = ntohs(frag_packet->total_size);
@@ -185,7 +185,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
 	}
 
 	/* Find the position for the new fragment. */
-	hlist_for_each_entry(frag_entry_curr, &chain->head, list) {
+	hlist_for_each_entry(frag_entry_curr, &chain->fragment_list, list) {
 		/* Drop packet if fragment already exists. */
 		if (frag_entry_curr->no == frag_entry_new->no)
 			goto err_unlock;
@@ -220,11 +220,11 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
 		 * exceeds the maximum size of one merged packet. Don't allow
 		 * packets to have different total_size.
 		 */
-		batadv_frag_clear_chain(&chain->head);
+		batadv_frag_clear_chain(&chain->fragment_list);
 		chain->size = 0;
 	} else if (ntohs(frag_packet->total_size) == chain->size) {
 		/* All fragments received. Hand over chain to caller. */
-		hlist_move_list(&chain->head, chain_out);
+		hlist_move_list(&chain->fragment_list, chain_out);
 		chain->size = 0;
 	}
 
net/batman-adv/fragmentation.h +1 -1
index 3202fe3..b95f619 100644
@@ -47,7 +47,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
 static inline bool
 batadv_frag_check_entry(struct batadv_frag_table_entry *frags_entry)
 {
-	if (!hlist_empty(&frags_entry->head) &&
+	if (!hlist_empty(&frags_entry->fragment_list) &&
 	    batadv_has_timed_out(frags_entry->timestamp, BATADV_FRAG_TIMEOUT))
 		return true;
 	return false;
net/batman-adv/originator.c +1 -1
index 6af87c9..518b1ed 100644
@@ -1021,7 +1021,7 @@ struct batadv_orig_node *batadv_orig_node_new(struct batadv_priv *bat_priv,
 	batadv_orig_node_vlan_put(vlan);
 
 	for (i = 0; i < BATADV_FRAG_BUFFER_COUNT; i++) {
-		INIT_HLIST_HEAD(&orig_node->fragments[i].head);
+		INIT_HLIST_HEAD(&orig_node->fragments[i].fragment_list);
 		spin_lock_init(&orig_node->fragments[i].lock);
 		orig_node->fragments[i].size = 0;
 	}
net/batman-adv/types.h +3 -3
index 97336ec..d31e7ec 100644
@@ -184,7 +184,7 @@ struct batadv_orig_ifinfo {
 
 /**
  * struct batadv_frag_table_entry - head in the fragment buffer table
- * @head: head of list with fragments
+ * @fragment_list: head of list with fragments
  * @lock: lock to protect the list of fragments
  * @timestamp: time (jiffie) of last received fragment
  * @seqno: sequence number of the fragments in the list
@@ -192,8 +192,8 @@ struct batadv_orig_ifinfo {
  * @total_size: expected size of the assembled packet
  */
 struct batadv_frag_table_entry {
-	struct hlist_head head;
-	spinlock_t lock; /* protects head */
+	struct hlist_head fragment_list;
+	spinlock_t lock; /* protects fragment_list */
 	unsigned long timestamp;
 	u16 seqno;
 	u16 size;
Signature · 1 line
2.10.1
maintainer
#33 lore raw

PATCH 15/17 batman-adv: Use proper name for gateway list head

In reply to Simon Wunderlich

From: Sven Eckelmann <[email protected]>

The batman-adv codebase is using "list" for the list node (prev/next) and <list content descriptor>+"_list" for the head of a list. Not using this naming scheme can up in confusions when reading the code.

---
 net/batman-adv/bat_iv_ogm.c     | 6 +++---
 net/batman-adv/bat_v.c          | 6 +++---
 net/batman-adv/gateway_client.c | 7 ++++---
 net/batman-adv/main.c           | 2 +-
 net/batman-adv/types.h          | 8 ++++----
 5 files changed, 15 insertions(+), 14 deletions(-)
net/batman-adv/bat_iv_ogm.c +3 -3
index e2d18d0..0b9be62 100644
@@ -2486,7 +2486,7 @@ batadv_iv_gw_get_best_gw_node(struct batadv_priv *bat_priv)
 	struct batadv_orig_node *orig_node;
 
 	rcu_read_lock();
-	hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) {
+	hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.gateway_list, list) {
 		orig_node = gw_node->orig_node;
 		router = batadv_orig_router_get(orig_node, BATADV_IF_DEFAULT);
 		if (!router)
@@ -2674,7 +2674,7 @@ static void batadv_iv_gw_print(struct batadv_priv *bat_priv,
 		 "      Gateway      (#/255)           Nexthop [outgoingIF]: advertised uplink bandwidth\n");
 
 	rcu_read_lock();
-	hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) {
+	hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.gateway_list, list) {
 		/* fails if orig_node has no router */
 		if (batadv_iv_gw_write_buffer_text(bat_priv, seq, gw_node) < 0)
 			continue;
@@ -2774,7 +2774,7 @@ static void batadv_iv_gw_dump(struct sk_buff *msg, struct netlink_callback *cb,
 	int idx = 0;
 
 	rcu_read_lock();
-	hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) {
+	hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.gateway_list, list) {
 		if (idx++ < idx_skip)
 			continue;
 
net/batman-adv/bat_v.c +3 -3
index 57c795c..2ac612d 100644
@@ -750,7 +750,7 @@ batadv_v_gw_get_best_gw_node(struct batadv_priv *bat_priv)
 	u32 max_bw = 0, bw;
 
 	rcu_read_lock();
-	hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) {
+	hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.gateway_list, list) {
 		if (!kref_get_unless_zero(&gw_node->refcount))
 			continue;
 
@@ -889,7 +889,7 @@ static void batadv_v_gw_print(struct batadv_priv *bat_priv,
 		 "      Gateway        ( throughput)           Nexthop [outgoingIF]: advertised uplink bandwidth\n");
 
 	rcu_read_lock();
-	hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) {
+	hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.gateway_list, list) {
 		/* fails if orig_node has no router */
 		if (batadv_v_gw_write_buffer_text(bat_priv, seq, gw_node) < 0)
 			continue;
@@ -1009,7 +1009,7 @@ static void batadv_v_gw_dump(struct sk_buff *msg, struct netlink_callback *cb,
 	int idx = 0;
 
 	rcu_read_lock();
-	hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) {
+	hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.gateway_list, list) {
 		if (idx++ < idx_skip)
 			continue;
 
net/batman-adv/gateway_client.c +4 -3
index 69bfe98..52b8bd6 100644
@@ -348,7 +348,7 @@ static void batadv_gw_node_add(struct batadv_priv *bat_priv,
 
 	spin_lock_bh(&bat_priv->gw.list_lock);
 	kref_get(&gw_node->refcount);
-	hlist_add_head_rcu(&gw_node->list, &bat_priv->gw.list);
+	hlist_add_head_rcu(&gw_node->list, &bat_priv->gw.gateway_list);
 	spin_unlock_bh(&bat_priv->gw.list_lock);
 
 	batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
@@ -376,7 +376,8 @@ struct batadv_gw_node *batadv_gw_node_get(struct batadv_priv *bat_priv,
 	struct batadv_gw_node *gw_node_tmp, *gw_node = NULL;
 
 	rcu_read_lock();
-	hlist_for_each_entry_rcu(gw_node_tmp, &bat_priv->gw.list, list) {
+	hlist_for_each_entry_rcu(gw_node_tmp, &bat_priv->gw.gateway_list,
+				 list) {
 		if (gw_node_tmp->orig_node != orig_node)
 			continue;
 
@@ -475,7 +476,7 @@ void batadv_gw_node_free(struct batadv_priv *bat_priv)
 
 	spin_lock_bh(&bat_priv->gw.list_lock);
 	hlist_for_each_entry_safe(gw_node, node_tmp,
-				  &bat_priv->gw.list, list) {
+				  &bat_priv->gw.gateway_list, list) {
 		hlist_del_init_rcu(&gw_node->list);
 		batadv_gw_node_put(gw_node);
 	}
net/batman-adv/main.c +1 -1
index 2c017ab..5e4e818 100644
@@ -160,7 +160,7 @@ int batadv_mesh_init(struct net_device *soft_iface)
 
 	INIT_HLIST_HEAD(&bat_priv->forw_bat_list);
 	INIT_HLIST_HEAD(&bat_priv->forw_bcast_list);
-	INIT_HLIST_HEAD(&bat_priv->gw.list);
+	INIT_HLIST_HEAD(&bat_priv->gw.gateway_list);
 #ifdef CONFIG_BATMAN_ADV_MCAST
 	INIT_HLIST_HEAD(&bat_priv->mcast.want_all_unsnoopables_list);
 	INIT_HLIST_HEAD(&bat_priv->mcast.want_all_ipv4_list);
net/batman-adv/types.h +4 -4
index d31e7ec..673a22e 100644
@@ -706,8 +706,8 @@ struct batadv_priv_debug_log {
 
 /**
  * struct batadv_priv_gw - per mesh interface gateway data
- * @list: list of available gateway nodes
- * @list_lock: lock protecting gw_list & curr_gw
+ * @gateway_list: list of available gateway nodes
+ * @list_lock: lock protecting gateway_list & curr_gw
  * @curr_gw: pointer to currently selected gateway node
  * @mode: gateway operation: off, client or server (see batadv_gw_modes)
  * @sel_class: gateway selection class (applies if gw_mode client)
@@ -716,8 +716,8 @@ struct batadv_priv_debug_log {
  * @reselect: bool indicating a gateway re-selection is in progress
  */
 struct batadv_priv_gw {
-	struct hlist_head list;
-	spinlock_t list_lock; /* protects gw_list & curr_gw */
+	struct hlist_head gateway_list;
+	spinlock_t list_lock; /* protects gateway_list & curr_gw */
 	struct batadv_gw_node __rcu *curr_gw;  /* rcu protected pointer */
 	atomic_t mode;
 	atomic_t sel_class;
Signature · 1 line
2.10.1
maintainer
#34 lore raw

PATCH 16/17 batman-adv: Use octal permissions instead of macros

In reply to Simon Wunderlich

From: Sven Eckelmann <[email protected]>

Linus prefers to have octal permission numbers instead of combinations of macro names ("random line noise"). Also old existing "bad symbolic permission bit macro use" should be converted to octal numbers.
(http://lkml.kernel.org/r/CA+55aFw5v23T-zvDZp-MmD_EYxF8WbafwwB59934FV7g21uMGQ@mail.gmail.com)

Also remove the S_IFREG bit from the octal representation because it is filtered out by debugfs_create.

---
 net/batman-adv/debugfs.c        | 26 ++++++++++----------
 net/batman-adv/icmp_socket.c    |  5 ++--
 net/batman-adv/log.c            |  4 +---
 net/batman-adv/network-coding.c |  8 +++----
 net/batman-adv/sysfs.c          | 53 ++++++++++++++++++-----------------------
 5 files changed, 41 insertions(+), 55 deletions(-)
net/batman-adv/debugfs.c +12 -14
index b4ffba7..7792550 100644
@@ -186,7 +186,7 @@ struct batadv_debuginfo batadv_debuginfo_##_name = {	\
 /* the following attributes are general and therefore they will be directly
  * placed in the BATADV_DEBUGFS_SUBDIR subdirectory of debugfs
  */
-static BATADV_DEBUGINFO(routing_algos, S_IRUGO, batadv_algorithms_open);
+static BATADV_DEBUGINFO(routing_algos, 0444, batadv_algorithms_open);
 
 static struct batadv_debuginfo *batadv_general_debuginfos[] = {
 	&batadv_debuginfo_routing_algos,
@@ -194,26 +194,24 @@ static struct batadv_debuginfo *batadv_general_debuginfos[] = {
 };
 
 /* The following attributes are per soft interface */
-static BATADV_DEBUGINFO(neighbors, S_IRUGO, neighbors_open);
-static BATADV_DEBUGINFO(originators, S_IRUGO, batadv_originators_open);
-static BATADV_DEBUGINFO(gateways, S_IRUGO, batadv_gateways_open);
-static BATADV_DEBUGINFO(transtable_global, S_IRUGO,
-			batadv_transtable_global_open);
+static BATADV_DEBUGINFO(neighbors, 0444, neighbors_open);
+static BATADV_DEBUGINFO(originators, 0444, batadv_originators_open);
+static BATADV_DEBUGINFO(gateways, 0444, batadv_gateways_open);
+static BATADV_DEBUGINFO(transtable_global, 0444, batadv_transtable_global_open);
 #ifdef CONFIG_BATMAN_ADV_BLA
-static BATADV_DEBUGINFO(bla_claim_table, S_IRUGO, batadv_bla_claim_table_open);
-static BATADV_DEBUGINFO(bla_backbone_table, S_IRUGO,
+static BATADV_DEBUGINFO(bla_claim_table, 0444, batadv_bla_claim_table_open);
+static BATADV_DEBUGINFO(bla_backbone_table, 0444,
 			batadv_bla_backbone_table_open);
 #endif
 #ifdef CONFIG_BATMAN_ADV_DAT
-static BATADV_DEBUGINFO(dat_cache, S_IRUGO, batadv_dat_cache_open);
+static BATADV_DEBUGINFO(dat_cache, 0444, batadv_dat_cache_open);
 #endif
-static BATADV_DEBUGINFO(transtable_local, S_IRUGO,
-			batadv_transtable_local_open);
+static BATADV_DEBUGINFO(transtable_local, 0444, batadv_transtable_local_open);
 #ifdef CONFIG_BATMAN_ADV_NC
-static BATADV_DEBUGINFO(nc_nodes, S_IRUGO, batadv_nc_nodes_open);
+static BATADV_DEBUGINFO(nc_nodes, 0444, batadv_nc_nodes_open);
 #endif
 #ifdef CONFIG_BATMAN_ADV_MCAST
-static BATADV_DEBUGINFO(mcast_flags, S_IRUGO, batadv_mcast_flags_open);
+static BATADV_DEBUGINFO(mcast_flags, 0444, batadv_mcast_flags_open);
 #endif
 
 static struct batadv_debuginfo *batadv_mesh_debuginfos[] = {
@@ -253,7 +251,7 @@ struct batadv_debuginfo batadv_hardif_debuginfo_##_name = {	\
 	},							\
 }
 
-static BATADV_HARDIF_DEBUGINFO(originators, S_IRUGO,
+static BATADV_HARDIF_DEBUGINFO(originators, 0444,
 			       batadv_originators_hardif_open);
 
 static struct batadv_debuginfo *batadv_hardif_debuginfos[] = {
net/batman-adv/icmp_socket.c +2 -3
index 378cc11..b310f381a 100644
@@ -38,7 +38,6 @@
 #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/uaccess.h>
@@ -322,8 +321,8 @@ int batadv_socket_setup(struct batadv_priv *bat_priv)
 	if (!bat_priv->debug_dir)
 		goto err;
 
-	d = debugfs_create_file(BATADV_ICMP_SOCKET, S_IFREG | S_IWUSR | S_IRUSR,
-				bat_priv->debug_dir, bat_priv, &batadv_fops);
+	d = debugfs_create_file(BATADV_ICMP_SOCKET, 0600, bat_priv->debug_dir,
+				bat_priv, &batadv_fops);
 	if (!d)
 		goto err;
 
net/batman-adv/log.c +1 -3
index 56dc532..c73c317 100644
@@ -31,7 +31,6 @@
 #include <linux/sched.h> /* for linux/wait.h */
 #include <linux/slab.h>
 #include <linux/spinlock.h>
-#include <linux/stat.h>
 #include <linux/stddef.h>
 #include <linux/types.h>
 #include <linux/uaccess.h>
@@ -212,8 +211,7 @@ int batadv_debug_log_setup(struct batadv_priv *bat_priv)
 	spin_lock_init(&bat_priv->debug_log->lock);
 	init_waitqueue_head(&bat_priv->debug_log->queue_wait);
 
-	d = debugfs_create_file("log", S_IFREG | S_IRUSR,
-				bat_priv->debug_dir, bat_priv,
+	d = debugfs_create_file("log", 0400, bat_priv->debug_dir, bat_priv,
 				&batadv_log_fops);
 	if (!d)
 		goto err;
net/batman-adv/network-coding.c +3 -5
index e3baf69..c213dde 100644
@@ -44,7 +44,6 @@
 #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>
@@ -1961,17 +1960,16 @@ int batadv_nc_init_debugfs(struct batadv_priv *bat_priv)
 	if (!nc_dir)
 		goto out;
 
-	file = debugfs_create_u8("min_tq", S_IRUGO | S_IWUSR, nc_dir,
-				 &bat_priv->nc.min_tq);
+	file = debugfs_create_u8("min_tq", 0644, nc_dir, &bat_priv->nc.min_tq);
 	if (!file)
 		goto out;
 
-	file = debugfs_create_u32("max_fwd_delay", S_IRUGO | S_IWUSR, nc_dir,
+	file = debugfs_create_u32("max_fwd_delay", 0644, nc_dir,
 				  &bat_priv->nc.max_fwd_delay);
 	if (!file)
 		goto out;
 
-	file = debugfs_create_u32("max_buffer_time", S_IRUGO | S_IWUSR, nc_dir,
+	file = debugfs_create_u32("max_buffer_time", 0644, nc_dir,
 				  &bat_priv->nc.max_buffer_time);
 	if (!file)
 		goto out;
net/batman-adv/sysfs.c +23 -30

92 lines not on this page · raw message

Signature · 1 line
2.10.1
maintainer
#35 lore raw

PATCH 17/17 batman-adv: Avoid precedence issues in macros

In reply to Simon Wunderlich

From: Sven Eckelmann <[email protected]>

It must be avoided that arguments to a macro are evaluated ungrouped (which enforces normal operator precendence). Otherwise the result of the macro is not well defined.

---
 net/batman-adv/log.h    | 12 ++++++------
 net/batman-adv/main.h   |  4 ++--
 net/batman-adv/packet.h |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)
net/batman-adv/log.h +6 -6
index e0e1a88..ab47acf 100644
@@ -71,12 +71,12 @@ 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);\
-	}							\
+#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)
net/batman-adv/main.h +2 -2
index 6a2328d..daddca9 100644
@@ -199,8 +199,8 @@ 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)
+#define BATADV_PRINT_VID(vid) (((vid) & BATADV_VLAN_HAS_TAG) ? \
+			       (int)((vid) & VLAN_VID_MASK) : -1)
 
 extern struct list_head batadv_hardif_list;
 
net/batman-adv/packet.h +1 -1
index d2e9bbd..7a36bcf 100644
@@ -21,7 +21,7 @@
 #include <asm/byteorder.h>
 #include <linux/types.h>
 
-#define batadv_tp_is_error(n) ((u8)n > 127 ? 1 : 0)
+#define batadv_tp_is_error(n) ((u8)(n) > 127 ? 1 : 0)
 
 /**
  * enum batadv_packettype - types for batman-adv encapsulated packets
Signature · 1 line
2.10.1
#36 lore raw

Re: [PATCH 17/17] batman-adv: Avoid precedence issues in macros

Quoted 5 lines · Simon Wunderlich

From: Sven Eckelmann <[email protected]>

It must be avoided that arguments to a macro are evaluated ungrouped (which enforces normal operator precendence). Otherwise the result of the macro is not well defined.

Curiosity:

in net/batman-adv/tp_meter.c

static int batadv_tp_send(void *arg)

{
	struct batadv_tp_vars *tp_vars = arg;
	struct batadv_priv *bat_priv = tp_vars->bat_priv;
	struct batadv_hard_iface *primary_if = NULL;
	struct batadv_orig_node *orig_node = NULL;
	size_t payload_len, packet_len;
	int err = 0;

	if (unlikely(tp_vars->role != BATADV_TP_SENDER)) {
		err = BATADV_TP_REASON_DST_UNREACHABLE;
		tp_vars->reason = err;
		goto out;
	}

	orig_node = batadv_orig_hash_find(bat_priv, tp_vars->other_end);
	if (unlikely(!orig_node)) {
		err = BATADV_TP_REASON_DST_UNREACHABLE;
		tp_vars->reason = err;
		goto out;
	}

	primary_if = batadv_primary_if_get_selected(bat_priv);
	if (unlikely(!primary_if)) {
		err = BATADV_TP_REASON_DST_UNREACHABLE;
		goto out;
	}

err is not used in the out block

Is the last if block supposed to set tp_vars->reason to err?

maintainer
#37 lore raw

Re: [PATCH 17/17] batman-adv: Avoid precedence issues in macros

Quoted 10 lines · On Freitag, 28. Oktober 2016 14:13:06 CEST Joe Perches wrote:
Quoted 5 lines · Simon Wunderlich

From: Sven Eckelmann <[email protected]>

It must be avoided that arguments to a macro are evaluated ungrouped (which enforces normal operator precendence). Otherwise the result of the macro is not well defined.

Curiosity:

in net/batman-adv/tp_meter.c

[...]

Quoted 13 lines
	orig_node = batadv_orig_hash_find(bat_priv, tp_vars->other_end);
	if (unlikely(!orig_node)) {
		err = BATADV_TP_REASON_DST_UNREACHABLE;
		tp_vars->reason = err;
		goto out;
	}

	primary_if = batadv_primary_if_get_selected(bat_priv);
	if (unlikely(!primary_if)) {
		err = BATADV_TP_REASON_DST_UNREACHABLE;
		goto out;
	}
Quoted 3 lines

err is not used in the out block

Is the last if block supposed to set tp_vars->reason to err?

This seems to be unrelated to this patch.

But yes, looks to me like it is missing. Do you want to propose a patch or should I do? Just make sure you Cc Antonio Quartulli <[email protected]> (and of course [email protected]). He is the original author of 33a3bb4a3345 ("batman-adv: throughput meter implementation").

Kind regards,
Sven

#38 lore raw

Re: [PATCH 17/17] batman-adv: Avoid precedence issues in macros

Quoted 26 lines · Sven Eckelmann
Quoted 10 lines · On Freitag, 28. Oktober 2016 14:13:06 CEST Joe Perches wrote:
Quoted 5 lines · Simon Wunderlich

From: Sven Eckelmann <[email protected]>

It must be avoided that arguments to a macro are evaluated ungrouped (which enforces normal operator precendence). Otherwise the result of the macro is not well defined.

Curiosity:

in net/batman-adv/tp_meter.c

[...]

Quoted 13 lines
	orig_node = batadv_orig_hash_find(bat_priv, tp_vars->other_end);
	if (unlikely(!orig_node)) {
		err = BATADV_TP_REASON_DST_UNREACHABLE;
		tp_vars->reason = err;
		goto out;
	}

	primary_if = batadv_primary_if_get_selected(bat_priv);
	if (unlikely(!primary_if)) {
		err = BATADV_TP_REASON_DST_UNREACHABLE;
		goto out;
	}
Quoted 5 lines
Quoted 3 lines

err is not used in the out block

Is the last if block supposed to set tp_vars->reason to err?

This seems to be unrelated to this patch.

Kinda. I was looking at how the one instance of batadv_tp_is_error was used and it's in this file.

Quoted 2 lines

But yes, looks to me like it is missing. Do you want to propose a patch or should I do?

As you are working on this file, perhaps you should.

cheers, Joe

#40 lore raw

Re: [PATCH 17/17] batman-adv: Avoid precedence issues in macros

In reply to a message not in the archive

On Freitag, 28. Oktober 2016 18:56:24 CEST Joe Perches wrote:
[...]

Quoted 4 lines
Quoted 2 lines

But yes, looks to me like it is missing. Do you want to propose a patch or should I do?

As you are working on this file, perhaps you should.

Ok, I will submit a patch with you as Reported-by to the batman-adv mailing list

Kind regards,
Sven

#5 lore raw

Re: [PATCH 03/17] batman-adv: Add network_coding and mcast sysfs files to README

In reply to Simon Wunderlich
Quoted 16 lines · Thu, Oct 27, 2016 at 09:01:36PM CEST, [email protected] wrote:

From: Sven Eckelmann <[email protected]>

---
Documentation/networking/batman-adv.txt | 9 +++++----

1 file changed, 5 insertions(+), 4 deletions(-)
Documentation/networking/batman-adv.txt +0 -0
index d414e60..8afa991 100644
@@ -71,10 +71,11 @@ All  mesh  wide  settings  can be found in batman's own interface

folder:

# ls /sys/class/net/bat0/mesh/

Documentation/networking/batman-adv.txt All mesh wide settings can be found in batman's own interface · line 78

Quoted 9 lines
Documentation/networking/batman-adv.txt +5 -4
-#aggregated_ogms        distributed_arp_table  gw_sel_class    orig_interval
-#ap_isolation           fragmentation          hop_penalty     routing_algo
-#bonding                gw_bandwidth           isolation_mark  vlan0
-#bridge_loop_avoidance  gw_mode                log_level
+# aggregated_ogms        fragmentation  isolation_mark  routing_algo
+# ap_isolation           gw_bandwidth   log_level       vlan0
+# bonding                gw_mode        multicast_mode
+# bridge_loop_avoidance  gw_sel_class   network_coding
+# distributed_arp_table  hop_penalty    orig_interval

I strongly believe it is a huge mistake to use sysfs for things like this. This should be done via generic netlink api.

Quoted 1 line
maintainer
#6 lore raw

Re: [PATCH 03/17] batman-adv: Add network_coding and mcast sysfs files to README

On Samstag, 29. Oktober 2016 12:33:01 CEST Jiri Pirko wrote:
[...]

Quoted 5 lines
Quoted 5 lines
Documentation/networking/batman-adv.txt +0 -0
@@ -71,10 +71,11 @@ All  mesh  wide  settings  can be found in batman's own interface

folder:

Quoted 13 lines

Documentation/networking/batman-adv.txt All mesh wide settings can be found in batman's own interface · line 78

Quoted 10 lines
# ls /sys/class/net/bat0/mesh/
Documentation/networking/batman-adv.txt +5 -4
-#aggregated_ogms        distributed_arp_table  gw_sel_class    orig_interval
-#ap_isolation           fragmentation          hop_penalty     routing_algo
-#bonding                gw_bandwidth           isolation_mark  vlan0
-#bridge_loop_avoidance  gw_mode                log_level
+# aggregated_ogms        fragmentation  isolation_mark  routing_algo
+# ap_isolation           gw_bandwidth   log_level       vlan0
+# bonding                gw_mode        multicast_mode
+# bridge_loop_avoidance  gw_sel_class   network_coding
+# distributed_arp_table  hop_penalty    orig_interval

I strongly believe it is a huge mistake to use sysfs for things like this. This should be done via generic netlink api.

This doesn't change the problem that it is already that way. This patch only adds the list of available files to the README.

Kind regards,
Sven

#7 lore raw

Re: [PATCH 03/17] batman-adv: Add network_coding and mcast sysfs files to README

Quoted 21 lines · Sat, Oct 29, 2016 at 12:37:07PM CEST, [email protected] wrote:

On Samstag, 29. Oktober 2016 12:33:01 CEST Jiri Pirko wrote:
[...]

Quoted 5 lines
Quoted 5 lines
Documentation/networking/batman-adv.txt +0 -0
@@ -71,10 +71,11 @@ All  mesh  wide  settings  can be found in batman's own interface

folder:

Quoted 13 lines

Documentation/networking/batman-adv.txt All mesh wide settings can be found in batman's own interface · line 78

Quoted 10 lines
# ls /sys/class/net/bat0/mesh/
Documentation/networking/batman-adv.txt +5 -4
-#aggregated_ogms        distributed_arp_table  gw_sel_class    orig_interval
-#ap_isolation           fragmentation          hop_penalty     routing_algo
-#bonding                gw_bandwidth           isolation_mark  vlan0
-#bridge_loop_avoidance  gw_mode                log_level
+# aggregated_ogms        fragmentation  isolation_mark  routing_algo
+# ap_isolation           gw_bandwidth   log_level       vlan0
+# bonding                gw_mode        multicast_mode
+# bridge_loop_avoidance  gw_sel_class   network_coding
+# distributed_arp_table  hop_penalty    orig_interval

I strongly believe it is a huge mistake to use sysfs for things like this. This should be done via generic netlink api.

Quoted 2 lines

This doesn't change the problem that it is already that way. This patch only adds the list of available files to the README.

Sure. Just found out you did it like that. Therefore I commented. I suggest to rework the api to use genl entirely.

Quoted 3 lines

Kind regards,
Sven

#9 lore raw

Re: [PATCH 03/17] batman-adv: Add network_coding and mcast sysfs files to README

In reply to a message not in the archive

On Samstag, 29. Oktober 2016 12:56:28 CEST Jiri Pirko wrote:
[...]

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I strongly believe it is a huge mistake to use sysfs for things like this. This should be done via generic netlink api.

This doesn't change the problem that it is already that way. This patch only adds the list of available files to the README.

Sure. Just found out you did it like that. Therefore I commented. I suggest to rework the api to use genl entirely.

Fair enough, I have added it to the issue tracker [1].

It seems there is no easy way to drop support for modifying batman-adv attributes of the interface or its ports via sysfs in the near future. But disallowing sysfs for new attributes might be a viable policy.

Kind regards,
Sven

[1] https://www.open-mesh.org/issues/300

#10 lore raw

Re: [PATCH 03/17] batman-adv: Add network_coding and mcast sysfs files to README

Quoted 11 lines · Sat, Oct 29, 2016 at 01:46:59PM CEST, [email protected] wrote:

On Samstag, 29. Oktober 2016 12:56:28 CEST Jiri Pirko wrote:
[...]

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I strongly believe it is a huge mistake to use sysfs for things like this. This should be done via generic netlink api.

This doesn't change the problem that it is already that way. This patch only adds the list of available files to the README.

Sure. Just found out you did it like that. Therefore I commented. I suggest to rework the api to use genl entirely.

Quoted 6 lines

Fair enough, I have added it to the issue tracker [1].

It seems there is no easy way to drop support for modifying batman-adv attributes of the interface or its ports via sysfs in the near future. But disallowing sysfs for new attributes might be a viable policy.

Cool. Thanks!

Quoted 5 lines

Kind regards,
Sven

[1] https://www.open-mesh.org/issues/300

#11 lore raw

Re: [B.A.T.M.A.N.] [PATCH 03/17] batman-adv: Add network_coding and mcast sysfs files to README

In reply to Jiri Pirko
Quoted 8 lines · Jiri Pirko
Quoted 5 lines
Quoted 2 lines

I strongly believe it is a huge mistake to use sysfs for things like this. This should be done via generic netlink api.

This doesn't change the problem that it is already that way. This patch only adds the list of available files to the README.

Sure. Just found out you did it like that. Therefore I commented. I suggest to rework the api to use genl entirely.

Hi Jiri,

Thanks for sharing your thoughts!

Could you explain a bit more on which disadvantages you see in the usage of sysfs here?

Regards, Linus

#12 lore raw

Re: [PATCH 03/17] batman-adv: Add network_coding and mcast sysfs files to README

Quoted 10 lines · On Dienstag, 27. März 2018 17:43:08 CEST Linus Lüssing wrote:
Quoted 8 lines · Jiri Pirko
Quoted 5 lines
Quoted 2 lines

I strongly believe it is a huge mistake to use sysfs for things like this. This should be done via generic netlink api.

This doesn't change the problem that it is already that way. This patch only adds the list of available files to the README.

Sure. Just found out you did it like that. Therefore I commented. I suggest to rework the api to use genl entirely.

Quoted 6 lines

Hi Jiri,

Thanks for sharing your thoughts!

Could you explain a bit more on which disadvantages you see in the usage of sysfs here?

Linus is asking because of following patch:
https://patchwork.open-mesh.org/patch/17340/

Kind regards,
Sven

#13 lore raw

Re: [PATCH 03/17] batman-adv: Add network_coding and mcast sysfs files to README

Hi Jiri,

seems like you still haven't answered Linus' question.

Quoted 13 lines · On Montag, 7. Mai 2018 08:34:16 CEST Sven Eckelmann wrote:
Quoted 12 lines · On Dienstag, 27. März 2018 17:43:08 CEST Linus Lüssing wrote:
Quoted 8 lines · Jiri Pirko
Quoted 5 lines
Quoted 2 lines

I strongly believe it is a huge mistake to use sysfs for things like this. This should be done via generic netlink api.

This doesn't change the problem that it is already that way. This patch only adds the list of available files to the README.

Sure. Just found out you did it like that. Therefore I commented. I suggest to rework the api to use genl entirely.

Hi Jiri,

Quoted 7 lines
Quoted 4 lines

Thanks for sharing your thoughts!

Could you explain a bit more on which disadvantages you see in the usage of sysfs here?

Linus is asking because of following patch:
https://patchwork.open-mesh.org/patch/17340/

The next patch with a similar problem would be
https://patchwork.open-mesh.org/patch/17372/. It is rather important that you are discussing this with Linus Luessing and Marek Lindner.

Kind regards,
Sven

#14 lore raw

Re: [PATCH 03/17] batman-adv: Add network_coding and mcast sysfs files to README

In reply to Linus Lüssing
Quoted 10 lines · Tue, Mar 27, 2018 at 05:43:08PM CEST, [email protected] wrote:
Quoted 8 lines · Jiri Pirko
Quoted 5 lines
Quoted 2 lines

I strongly believe it is a huge mistake to use sysfs for things like this. This should be done via generic netlink api.

This doesn't change the problem that it is already that way. This patch only adds the list of available files to the README.

Sure. Just found out you did it like that. Therefore I commented. I suggest to rework the api to use genl entirely.

Quoted 6 lines

Hi Jiri,

Thanks for sharing your thoughts!

Could you explain a bit more on which disadvantages you see in the usage of sysfs here?

There are 2 major disadvantages.
1) You don't have any events on a change. An app has to poll in order to know what changed in kernel. Netlink handles this by sending multicast messages on a specific socket while whoever is interested gets the messages.
2) In sysfs, everything is string. There are even mixed values like "1 (means something)". There are no well defined values. Every driver can expose same things differently. In Netlink, you have well-defined attributes, with typed values. You can pass multiple attributes for the same value if needed.

In general, usage of sysfs in netdev subsystem is frowned upon. I would suggest to convert your iface to Generic Netlink API and let the existing sysfs API to rot.

Quoted 2 lines

Regards, Linus

#15 lore raw

Re: [B.A.T.M.A.N.] [PATCH 03/17] batman-adv: Add network_coding and mcast sysfs files to README

Hi Jiri,

Quoted 29 lines · Jiri Pirko
Quoted 10 lines · Tue, Mar 27, 2018 at 05:43:08PM CEST, [email protected] wrote:
Quoted 8 lines · Jiri Pirko
Quoted 5 lines
Quoted 2 lines

I strongly believe it is a huge mistake to use sysfs for things like this. This should be done via generic netlink api.

This doesn't change the problem that it is already that way. This patch only adds the list of available files to the README.

Sure. Just found out you did it like that. Therefore I commented. I suggest to rework the api to use genl entirely.

Quoted 6 lines

Hi Jiri,

Thanks for sharing your thoughts!

Could you explain a bit more on which disadvantages you see in the usage of sysfs here?

There are 2 major disadvantages.
1) You don't have any events on a change. An app has to poll in order to know what changed in kernel. Netlink handles this by sending multicast messages on a specific socket while whoever is interested gets the messages.
2) In sysfs, everything is string. There are even mixed values like "1 (means something)". There are no well defined values. Every driver can expose same things differently. In Netlink, you have well-defined attributes, with typed values. You can pass multiple attributes for the same value if needed.

Quoted 3 lines

In general, usage of sysfs in netdev subsystem is frowned upon. I would suggest to convert your iface to Generic Netlink API and let the existing sysfs API to rot.

Do you have any pointer about where this discussion took place? I imagine it happened in conjunction with some patches intended to other drivers/netdev changes.

Reading that could give us a sense of how strict/important/severe this decision was and how to prioritize future work.

I am asking because we have been working on a new feature since several months and this feature introduces a new sysfs knob.

Now, although I understand the recommendation of switching to netlink, I find it a bit impractical to delay a new (and fairly big) feature, simply because it uses a potentially obsolete, but current, API.

Any opinion about this?

Thanks a lot

Regards,

Signature · 1 line
Antonio Quartulli
#17 lore raw

Re: [PATCH 03/17] batman-adv: Add network_coding and mcast sysfs files to README

In reply to a message not in the archive
Quoted 43 lines · Sat, Aug 04, 2018 at 11:24:11AM CEST, [email protected] wrote:

Hi Jiri,

Quoted 29 lines · Jiri Pirko
Quoted 10 lines · Tue, Mar 27, 2018 at 05:43:08PM CEST, [email protected] wrote:
Quoted 8 lines · Jiri Pirko
Quoted 5 lines
Quoted 2 lines

I strongly believe it is a huge mistake to use sysfs for things like this. This should be done via generic netlink api.

This doesn't change the problem that it is already that way. This patch only adds the list of available files to the README.

Sure. Just found out you did it like that. Therefore I commented. I suggest to rework the api to use genl entirely.

Quoted 6 lines

Hi Jiri,

Thanks for sharing your thoughts!

Could you explain a bit more on which disadvantages you see in the usage of sysfs here?

There are 2 major disadvantages.
1) You don't have any events on a change. An app has to poll in order to know what changed in kernel. Netlink handles this by sending multicast messages on a specific socket while whoever is interested gets the messages.
2) In sysfs, everything is string. There are even mixed values like "1 (means something)". There are no well defined values. Every driver can expose same things differently. In Netlink, you have well-defined attributes, with typed values. You can pass multiple attributes for the same value if needed.

Quoted 3 lines

In general, usage of sysfs in netdev subsystem is frowned upon. I would suggest to convert your iface to Generic Netlink API and let the existing sysfs API to rot.

Do you have any pointer about where this discussion took place? I imagine it happened in conjunction with some patches intended to other drivers/netdev changes.

Reading that could give us a sense of how strict/important/severe this decision was and how to prioritize future work.

Quoted 8 lines

I am asking because we have been working on a new feature since several months and this feature introduces a new sysfs knob.

Now, although I understand the recommendation of switching to netlink, I find it a bit impractical to delay a new (and fairly big) feature, simply because it uses a potentially obsolete, but current, API.

Any opinion about this?

I agree, that does not make sense.

I just wanted you to consider introducing netlink iface and migrate to it as it is generally the preffered way to comunicate with userspace in networking area (I don't have pointer any specific discussion though - it is just a common knowledge :)). I will be more then happy to help you with that. You should look at net/core/devlink.c and net/wireless/nl80211.c to get some inspiration.

Quoted 11 lines

Thanks a lot

Regards,

Signature · 1 line
Antonio Quartulli
#18 lore raw

Re: [B.A.T.M.A.N.] [PATCH 03/17] batman-adv: Add network_coding and mcast sysfs files to README

Quoted 11 lines · Jiri Pirko
Quoted 11 lines

Do you have any pointer about where this discussion took place? I imagine it happened in conjunction with some patches intended to other drivers/netdev changes.

Reading that could give us a sense of how strict/important/severe this decision was and how to prioritize future work.

I am asking because we have been working on a new feature since several months and this feature introduces a new sysfs knob.

Quoted 7 lines
Quoted 5 lines

Now, although I understand the recommendation of switching to netlink, I find it a bit impractical to delay a new (and fairly big) feature, simply because it uses a potentially obsolete, but current, API.

Any opinion about this?

I agree, that does not make sense.

Thanks for your reply, Jiri.

Quoted 5 lines

I just wanted you to consider introducing netlink iface and migrate to it as it is generally the preffered way to comunicate with userspace in networking area (I don't have pointer any specific discussion though - it is just a common knowledge :)).

That's ok. I was asking because in the past batman-adv was using debugfs for dealing with settings and we were (properly) redirected to sysfs by David.
Now it seems we need to migrate to the next thing :-) So I just wanted to be sure we have to do it, but this seems to be the case..

Quoted 3 lines

I will be more then happy to help you
with that. You should look at net/core/devlink.c and net/wireless/nl80211.c to get some inspiration.

Actually we have already implemented a basic netlink API to be used when sending information to userspace (i.e. routing tables, neighbour tables, etc..), therefore I think we might be able to leverage on that. But of course, any help will be appreciated :)

Thanks!

Cheers,

Signature · 1 line
Antonio Quartulli
#20 lore raw

Re: [PATCH 03/17] batman-adv: Add network_coding and mcast sysfs files to README

In reply to a message not in the archive
Quoted 34 lines · Sat, Aug 04, 2018 at 01:19:39PM CEST, [email protected] wrote:
Quoted 11 lines · Jiri Pirko
Quoted 11 lines

Do you have any pointer about where this discussion took place? I imagine it happened in conjunction with some patches intended to other drivers/netdev changes.

Reading that could give us a sense of how strict/important/severe this decision was and how to prioritize future work.

I am asking because we have been working on a new feature since several months and this feature introduces a new sysfs knob.

Quoted 7 lines
Quoted 5 lines

Now, although I understand the recommendation of switching to netlink, I find it a bit impractical to delay a new (and fairly big) feature, simply because it uses a potentially obsolete, but current, API.

Any opinion about this?

I agree, that does not make sense.

Thanks for your reply, Jiri.

Quoted 5 lines

I just wanted you to consider introducing netlink iface and migrate to it as it is generally the preffered way to comunicate with userspace in networking area (I don't have pointer any specific discussion though - it is just a common knowledge :)).

That's ok. I was asking because in the past batman-adv was using debugfs for dealing with settings and we were (properly) redirected to sysfs by David.
Now it seems we need to migrate to the next thing :-) So I just wanted to be sure we have to do it, but this seems to be the case..

Quoted 8 lines
Quoted 3 lines

I will be more then happy to help you
with that. You should look at net/core/devlink.c and net/wireless/nl80211.c to get some inspiration.

Actually we have already implemented a basic netlink API to be used when sending information to userspace (i.e. routing tables, neighbour tables, etc..), therefore I think we might be able to leverage on that. But of course, any help will be appreciated :)

Yes, I see net/batman-adv/netlink.c. That looks fine. Shouldn't be hard to migrate the existing sysfs things there and add new features. Please don't forget to echo the configured options via netlink notifications from the very beginning. Feel free to send me patches to look at.

Thanks!

Quoted 10 lines

Thanks!

Cheers,

Signature · 1 line
Antonio Quartulli