Skip to contentSkip to conversation

pull request for net-next: batman-adv 2025-01-17

PATCH Applied Simon Wunderlich 2 participants 12 messages Jan 17, 2025 – Jan 19, 2025

Subsystems (4)
lore
Share & tools
lore

Simon Wunderlich

author maintainer
#0 lore raw

cover pull request for net-next: batman-adv 2025-01-17

Hi Jakub, hi David,

here is a cleanup pull request of batman-adv to go into net-next.

Please pull or let me know of any problem!

Thank you,
Simon

The following changes since commit 40384c840ea1944d7c5a392e8975ed088ecf0b37:

Linux 6.13-rc1 (2024-12-01 14:28:56 -0800)

are available in the Git repository at:

git://git.open-mesh.org/linux-merge.git tags/batadv-next-pullrequest-20250117

for you to fetch changes up to 6ecc4fd6c2f43862c5e3b280cf419f0131e45c97:

batman-adv: netlink: reduce duplicate code by returning interfaces (2025-01-17 13:36:01 +0100)

----------------------------------------------------------------
This cleanup patchset includes the following patches:

- bump version strings, by Simon Wunderlich

- Reorder includes for distributed-arp-table.c, by Sven Eckelmann

- Fix translation table change handling, by Remi Pommarel (2 patches)

- Map VID 0 to untagged TT VLAN, by Sven Eckelmann

- Update MAINTAINERS/mailmap e-mail addresses, by the respective authors (4 patches)

- netlink: reduce duplicate code by returning interfaces, by Linus Lüssing

----------------------------------------------------------------
Antonio Quartulli (1):
MAINTAINERS: mailmap: add entries for Antonio Quartulli

Linus Lüssing (1):
batman-adv: netlink: reduce duplicate code by returning interfaces

Marek Lindner (1):
MAINTAINERS: update email address of Marek Linder

Remi Pommarel (2):
batman-adv: Remove atomic usage for tt.local_changes
batman-adv: Don't keep redundant TT change events

Simon Wunderlich (2):
batman-adv: Start new development cycle
mailmap: add entries for Simon Wunderlich

Sven Eckelmann (3):
batman-adv: Reorder includes for distributed-arp-table.c
batman-adv: Map VID 0 to untagged TT VLAN
mailmap: add entries for Sven Eckelmann

 .mailmap                                |  19 +++++
 Documentation/networking/batman-adv.rst |   2 +-
 MAINTAINERS                             |   4 +-
 net/batman-adv/bridge_loop_avoidance.c  |  33 ++------
 net/batman-adv/distributed-arp-table.c  |  20 ++---
 net/batman-adv/gateway_client.c         |  18 +---
 net/batman-adv/main.c                   |   7 ++
 net/batman-adv/main.h                   |   4 +-
 net/batman-adv/multicast.c              |  17 +---
 net/batman-adv/netlink.c                | 146 ++++++++++++++++++++++----------
 net/batman-adv/netlink.h                |   5 +-
 net/batman-adv/originator.c             | 116 +++++++++----------------
 net/batman-adv/soft-interface.c         |  16 +++-
 net/batman-adv/translation-table.c      |  92 ++++++++------------
 net/batman-adv/types.h                  |   4 +-
 15 files changed, 251 insertions(+), 252 deletions(-)
author maintainer
#1 lore raw

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

This version will contain all the (major or even only minor) changes for Linux 6.14.

The version number isn't a semantic version number with major and minor information. It is just encoding the year of the expected publishing as Linux -rc1 and the number of published versions this year (starting at 0).

---
 net/batman-adv/main.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/main.h +1 -1
index 97ea71a052f8..1fbe3a4dd965 100644
@@ -13,7 +13,7 @@
 #define BATADV_DRIVER_DEVICE "batman-adv"
 
 #ifndef BATADV_SOURCE_VERSION
-#define BATADV_SOURCE_VERSION "2024.3"
+#define BATADV_SOURCE_VERSION "2025.0"
 #endif
 
 /* B.A.T.M.A.N. parameters */
Signature · 1 line
2.39.5
#2 lore raw

Re: [PATCH 01/10] batman-adv: Start new development cycle

This series was applied to netdev/net-next.git (main) by Simon Wunderlich <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Simon Wunderlich <[email protected]>:

Quoted 8 lines · On Fri, 17 Jan 2025 13:39:01 +0100 you wrote:

This version will contain all the (major or even only minor) changes for Linux 6.14.

The version number isn't a semantic version number with major and minor information. It is just encoding the year of the expected publishing as Linux -rc1 and the number of published versions this year (starting at 0).

[...]

Here is the summary with links:
- [01/10] batman-adv: Start new development cycle

    https://git.kernel.org/netdev/net-next/c/77a214317a6a
  - [02/10] batman-adv: Reorder includes for distributed-arp-table.c
    https://git.kernel.org/netdev/net-next/c/a7d5100ed009
  - [03/10] batman-adv: Remove atomic usage for tt.local_changes
    https://git.kernel.org/netdev/net-next/c/8587e0e3f562
  - [04/10] batman-adv: Don't keep redundant TT change events
    https://git.kernel.org/netdev/net-next/c/fca81aa3e653
  - [05/10] batman-adv: Map VID 0 to untagged TT VLAN
    https://git.kernel.org/netdev/net-next/c/bf2a5a622a50
  - [06/10] MAINTAINERS: update email address of Marek Linder
    https://git.kernel.org/netdev/net-next/c/7bce3f75189c
  - [07/10] mailmap: add entries for Simon Wunderlich
    https://git.kernel.org/netdev/net-next/c/1f5f7ff46435
  - [08/10] mailmap: add entries for Sven Eckelmann
    https://git.kernel.org/netdev/net-next/c/285c72be9440
  - [09/10] MAINTAINERS: mailmap: add entries for Antonio Quartulli
    https://git.kernel.org/netdev/net-next/c/425970f94b3c
  - [10/10] batman-adv: netlink: reduce duplicate code by returning interfaces
    https://git.kernel.org/netdev/net-next/c/6ecc4fd6c2f4

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
author maintainer
#3 lore raw

PATCH 2/10 batman-adv: Reorder includes for distributed-arp-table.c

In reply to Simon Wunderlich

From: Sven Eckelmann <[email protected]>

The commit 5f60d5f6bbc1 ("move asm/unaligned.h to linux/unaligned.h") changed the include without adjusting the order (to match the rest of the file).

---
 net/batman-adv/distributed-arp-table.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/distributed-arp-table.c +1 -1
index 801eff8a40e5..48b72c2be098 100644
@@ -7,7 +7,6 @@
 #include "distributed-arp-table.h"
 #include "main.h"
 
-#include <linux/unaligned.h>
 #include <linux/atomic.h>
 #include <linux/bitops.h>
 #include <linux/byteorder/generic.h>
@@ -32,6 +31,7 @@
 #include <linux/stddef.h>
 #include <linux/string.h>
 #include <linux/udp.h>
+#include <linux/unaligned.h>
 #include <linux/workqueue.h>
 #include <net/arp.h>
 #include <net/genetlink.h>
Signature · 1 line
2.39.5
author maintainer
#4 lore raw

PATCH 3/10 batman-adv: Remove atomic usage for tt.local_changes

In reply to Simon Wunderlich

From: Remi Pommarel <[email protected]>

The tt.local_changes atomic is either written with tt.changes_list_lock or close to it (see batadv_tt_local_event()). Thus the performance gain using an atomic was limited (or because of atomic_read() impact even negative). Using atomic also comes with the need to be wary of potential negative tt.local_changes value.

Simplify the tt.local_changes usage by removing the atomic property and modifying it only with tt.changes_list_lock held.

---
 net/batman-adv/soft-interface.c    |  2 +-
 net/batman-adv/translation-table.c | 24 +++++++++++-------------
 net/batman-adv/types.h             |  4 ++--
 3 files changed, 14 insertions(+), 16 deletions(-)
net/batman-adv/soft-interface.c +1 -1
index 2758aba47a2f..5666c268cead 100644
@@ -783,13 +783,13 @@ static int batadv_softif_init_late(struct net_device *dev)
 	atomic_set(&bat_priv->mesh_state, BATADV_MESH_INACTIVE);
 	atomic_set(&bat_priv->bcast_seqno, 1);
 	atomic_set(&bat_priv->tt.vn, 0);
-	atomic_set(&bat_priv->tt.local_changes, 0);
 	atomic_set(&bat_priv->tt.ogm_append_cnt, 0);
 #ifdef CONFIG_BATMAN_ADV_BLA
 	atomic_set(&bat_priv->bla.num_requests, 0);
 #endif
 	atomic_set(&bat_priv->tp_num, 0);
 
+	WRITE_ONCE(bat_priv->tt.local_changes, 0);
 	bat_priv->tt.last_changeset = NULL;
 	bat_priv->tt.last_changeset_len = 0;
 	bat_priv->isolation_mark = 0;
net/batman-adv/translation-table.c +11 -13
index b44c382226a1..6e0345b91ece 100644
@@ -423,8 +423,8 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv,
 	struct batadv_tt_change_node *tt_change_node, *entry, *safe;
 	struct batadv_tt_common_entry *common = &tt_local_entry->common;
 	u8 flags = common->flags | event_flags;
-	bool event_removed = false;
 	bool del_op_requested, del_op_entry;
+	size_t changes;
 
 	tt_change_node = kmem_cache_alloc(batadv_tt_change_cache, GFP_ATOMIC);
 	if (!tt_change_node)
@@ -440,6 +440,7 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv,
 
 	/* check for ADD+DEL or DEL+ADD events */
 	spin_lock_bh(&bat_priv->tt.changes_list_lock);
+	changes = READ_ONCE(bat_priv->tt.local_changes);
 	list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list,
 				 list) {
 		if (!batadv_compare_eth(entry->change.addr, common->addr))
@@ -468,21 +469,18 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv,
 del:
 		list_del(&entry->list);
 		kmem_cache_free(batadv_tt_change_cache, entry);
+		changes--;
 		kmem_cache_free(batadv_tt_change_cache, tt_change_node);
-		event_removed = true;
-		goto unlock;
+		goto update_changes;
 	}
 
 	/* track the change in the OGMinterval list */
 	list_add_tail(&tt_change_node->list, &bat_priv->tt.changes_list);
+	changes++;
 
-unlock:
+update_changes:
+	WRITE_ONCE(bat_priv->tt.local_changes, changes);
 	spin_unlock_bh(&bat_priv->tt.changes_list_lock);
-
-	if (event_removed)
-		atomic_dec(&bat_priv->tt.local_changes);
-	else
-		atomic_inc(&bat_priv->tt.local_changes);
 }
 
 /**
@@ -950,7 +948,7 @@ static void batadv_tt_tvlv_container_update(struct batadv_priv *bat_priv)
 	int tt_diff_entries_count = 0;
 	u16 tvlv_len;
 
-	tt_diff_entries_num = atomic_read(&bat_priv->tt.local_changes);
+	tt_diff_entries_num = READ_ONCE(bat_priv->tt.local_changes);
 	tt_diff_len = batadv_tt_len(tt_diff_entries_num);
 
 	/* if we have too many changes for one packet don't send any
@@ -970,7 +968,7 @@ static void batadv_tt_tvlv_container_update(struct batadv_priv *bat_priv)
 		goto container_register;
 
 	spin_lock_bh(&bat_priv->tt.changes_list_lock);
-	atomic_set(&bat_priv->tt.local_changes, 0);
+	WRITE_ONCE(bat_priv->tt.local_changes, 0);
 
 	list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list,
 				 list) {
@@ -1380,7 +1378,7 @@ static void batadv_tt_changes_list_free(struct batadv_priv *bat_priv)
 		kmem_cache_free(batadv_tt_change_cache, entry);
 	}
 
-	atomic_set(&bat_priv->tt.local_changes, 0);
+	WRITE_ONCE(bat_priv->tt.local_changes, 0);
 	spin_unlock_bh(&bat_priv->tt.changes_list_lock);
 }
 
@@ -3634,7 +3632,7 @@ static void batadv_tt_local_commit_changes_nolock(struct batadv_priv *bat_priv)
 {
 	lockdep_assert_held(&bat_priv->tt.commit_lock);
 
-	if (atomic_read(&bat_priv->tt.local_changes) < 1) {
+	if (READ_ONCE(bat_priv->tt.local_changes) == 0) {
 		if (!batadv_atomic_dec_not_zero(&bat_priv->tt.ogm_append_cnt))
 			batadv_tt_tvlv_container_update(bat_priv);
 		return;
net/batman-adv/types.h +2 -2
index 04f6398b3a40..f491bff8c51b 100644
@@ -1022,7 +1022,7 @@ struct batadv_priv_tt {
 	atomic_t ogm_append_cnt;
 
 	/** @local_changes: changes registered in an originator interval */
-	atomic_t local_changes;
+	size_t local_changes;
 
 	/**
 	 * @changes_list: tracks tt local changes within an originator interval
@@ -1044,7 +1044,7 @@ struct batadv_priv_tt {
 	 */
 	struct list_head roam_list;
 
-	/** @changes_list_lock: lock protecting changes_list */
+	/** @changes_list_lock: lock protecting changes_list & local_changes */
 	spinlock_t changes_list_lock;
 
 	/** @req_list_lock: lock protecting req_list */
Signature · 1 line
2.39.5
author maintainer
#5 lore raw

PATCH 4/10 batman-adv: Don't keep redundant TT change events

In reply to Simon Wunderlich

From: Remi Pommarel <[email protected]>

When adding a local TT twice within the same OGM interval (e.g. happens when flag get updated), the flags of the first TT change entry is updated with the second one and both change events is added to the change list. This leads to having the same ADD change entry twice. Similarly, a DEL+DEL scenario is also creating twice the same event.

Deduplicate ADD+ADD or DEL+DEL scenarios to reduce the TT change events that need to be sent in both OGM and TT response.

---
 net/batman-adv/translation-table.c | 40 ++++++++++++++----------------
 1 file changed, 18 insertions(+), 22 deletions(-)
net/batman-adv/translation-table.c +18 -22
index 6e0345b91ece..76d5517bb507 100644
@@ -438,7 +438,7 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv,
 
 	del_op_requested = flags & BATADV_TT_CLIENT_DEL;
 
-	/* check for ADD+DEL or DEL+ADD events */
+	/* check for ADD+DEL, DEL+ADD, ADD+ADD or DEL+DEL events */
 	spin_lock_bh(&bat_priv->tt.changes_list_lock);
 	changes = READ_ONCE(bat_priv->tt.local_changes);
 	list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list,
@@ -446,30 +446,26 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv,
 		if (!batadv_compare_eth(entry->change.addr, common->addr))
 			continue;
 
-		/* DEL+ADD in the same orig interval have no effect and can be
-		 * removed to avoid silly behaviour on the receiver side. The
-		 * other way around (ADD+DEL) can happen in case of roaming of
-		 * a client still in the NEW state. Roaming of NEW clients is
-		 * now possible due to automatically recognition of "temporary"
-		 * clients
-		 */
 		del_op_entry = entry->change.flags & BATADV_TT_CLIENT_DEL;
-		if (!del_op_requested && del_op_entry)
-			goto del;
-		if (del_op_requested && !del_op_entry)
-			goto del;
-
-		/* this is a second add in the same originator interval. It
-		 * means that flags have been changed: update them!
-		 */
-		if (!del_op_requested && !del_op_entry)
+		if (del_op_requested != del_op_entry) {
+			/* DEL+ADD in the same orig interval have no effect and
+			 * can be removed to avoid silly behaviour on the
+			 * receiver side. The  other way around (ADD+DEL) can
+			 * happen in case of roaming of  a client still in the
+			 * NEW state. Roaming of NEW clients is now possible due
+			 * to automatically recognition of "temporary" clients
+			 */
+			list_del(&entry->list);
+			kmem_cache_free(batadv_tt_change_cache, entry);
+			changes--;
+		} else {
+			/* this is a second add or del in the same originator
+			 * interval. It could mean that flags have been changed
+			 * (e.g. double add): update them
+			 */
 			entry->change.flags = flags;
+		}
 
-		continue;
-del:
-		list_del(&entry->list);
-		kmem_cache_free(batadv_tt_change_cache, entry);
-		changes--;
 		kmem_cache_free(batadv_tt_change_cache, tt_change_node);
 		goto update_changes;
 	}
Signature · 1 line
2.39.5
author maintainer
#6 lore raw

PATCH 5/10 batman-adv: Map VID 0 to untagged TT VLAN

In reply to Simon Wunderlich

From: Sven Eckelmann <[email protected]>

VID 0 is not a valid VLAN according to "802.1Q-2011" "Table 9-2—Reserved VID values". It is only used to indicate "priority tag" frames which only contain priority information and no VID.

The 8021q is also redirecting the priority tagged frames to the underlying interface since commit ad1afb003939 ("vlan_dev: VLAN 0 should be treated as "no vlan tag" (802.1p packet)"). But at the same time, it automatically adds the VID 0 to all devices to ensure that VID 0 is in the allowed list of the HW filter. This resulted in a VLAN 0 which was always announced in OGM messages.

batman-adv should therefore not create a new batadv_softif_vlan for VID 0 and handle all VID 0 related frames using the "untagged" global/local translation tables.

---
 net/batman-adv/main.c           |  7 +++++++
 net/batman-adv/soft-interface.c | 14 ++++++++++++++
 2 files changed, 21 insertions(+)
net/batman-adv/main.c +7 -0
index 8e0f44c71696..333e947afcce 100644
@@ -637,6 +637,13 @@ unsigned short batadv_get_vid(struct sk_buff *skb, size_t header_len)
 
 	vhdr = (struct vlan_ethhdr *)(skb->data + header_len);
 	vid = ntohs(vhdr->h_vlan_TCI) & VLAN_VID_MASK;
+
+	/* VID 0 is only used to indicate "priority tag" frames which only
+	 * contain priority information and no VID.
+	 */
+	if (vid == 0)
+		return BATADV_NO_FLAGS;
+
 	vid |= BATADV_VLAN_HAS_TAG;
 
 	return vid;
net/batman-adv/soft-interface.c +14 -0
index 5666c268cead..822d788a5f86 100644
@@ -637,6 +637,14 @@ static int batadv_interface_add_vid(struct net_device *dev, __be16 proto,
 	if (proto != htons(ETH_P_8021Q))
 		return -EINVAL;
 
+	/* VID 0 is only used to indicate "priority tag" frames which only
+	 * contain priority information and no VID. No management structures
+	 * should be created for this VID and it should be handled like an
+	 * untagged frame.
+	 */
+	if (vid == 0)
+		return 0;
+
 	vid |= BATADV_VLAN_HAS_TAG;
 
 	/* if a new vlan is getting created and it already exists, it means that
@@ -684,6 +692,12 @@ static int batadv_interface_kill_vid(struct net_device *dev, __be16 proto,
 	if (proto != htons(ETH_P_8021Q))
 		return -EINVAL;
 
+	/* "priority tag" frames are handled like "untagged" frames
+	 * and no softif_vlan needs to be destroyed
+	 */
+	if (vid == 0)
+		return 0;
+
 	vlan = batadv_softif_vlan_get(bat_priv, vid | BATADV_VLAN_HAS_TAG);
 	if (!vlan)
 		return -ENOENT;
Signature · 1 line
2.39.5
author maintainer
#7 lore raw

PATCH 6/10 MAINTAINERS: update email address of Marek Linder

In reply to Simon Wunderlich

From: Marek Lindner <[email protected]>

---
 .mailmap                                | 2 ++
 Documentation/networking/batman-adv.rst | 2 +-
 MAINTAINERS                             | 2 +-
 net/batman-adv/main.h                   | 2 +-
 4 files changed, 5 insertions(+), 3 deletions(-)
.mailmap +2 -0
index 5ff0e5d681e7..53e038f5f654 100644
@@ -427,6 +427,8 @@ Marcin Nowakowski <[email protected]> <[email protected]>
 Marc Zyngier <[email protected]> <[email protected]>
 Marek Behún <[email protected]> <[email protected]>
 Marek Behún <[email protected]> Marek Behun <[email protected]>
+Marek Lindner <[email protected]> <[email protected]>
+Marek Lindner <[email protected]> <[email protected]>
 Mark Brown <[email protected]>
 Mark Starovoytov <[email protected]> <[email protected]>
 Markus Schneider-Pargmann <[email protected]> <[email protected]>
Documentation/networking/batman-adv.rst +1 -1
index 8a0dcb1894b4..44b9b5cc0e24 100644
@@ -164,5 +164,5 @@ Mailing-list:
 
 You can also contact the Authors:
 
-* Marek Lindner <[email protected]>
+* Marek Lindner <[email protected]>
 * Simon Wunderlich <[email protected]>
MAINTAINERS +1 -1
index 1e930c7a58b1..c5e909a759e6 100644
@@ -3867,7 +3867,7 @@ S:	Maintained
 F:	drivers/platform/x86/barco-p50-gpio.c
 
 BATMAN ADVANCED
-M:	Marek Lindner <[email protected]>
+M:	Marek Lindner <[email protected]>
 M:	Simon Wunderlich <[email protected]>
 M:	Antonio Quartulli <[email protected]>
 M:	Sven Eckelmann <[email protected]>
net/batman-adv/main.h +1 -1
index 1fbe3a4dd965..964f3088af5b 100644
@@ -7,7 +7,7 @@
 #ifndef _NET_BATMAN_ADV_MAIN_H_
 #define _NET_BATMAN_ADV_MAIN_H_
 
-#define BATADV_DRIVER_AUTHOR "Marek Lindner <[email protected]>, " \
+#define BATADV_DRIVER_AUTHOR "Marek Lindner <[email protected]>, " \
 			     "Simon Wunderlich <[email protected]>"
 #define BATADV_DRIVER_DESC   "B.A.T.M.A.N. advanced"
 #define BATADV_DRIVER_DEVICE "batman-adv"
Signature · 1 line
2.39.5
author maintainer
#8 lore raw

PATCH 7/10 mailmap: add entries for Simon Wunderlich

In reply to Simon Wunderlich

Map the defunc mail addresses to the currently used mail address (listed in MAINTAINERS).

---
 .mailmap | 5 +++++
 1 file changed, 5 insertions(+)
.mailmap +5 -0
index 53e038f5f654..efabe03f7849 100644
@@ -642,6 +642,11 @@ Simona Vetter <[email protected]> <[email protected]>
 Simon Horman <[email protected]> <[email protected]>
 Simon Horman <[email protected]> <[email protected]>
 Simon Kelley <[email protected]>
+Simon Wunderlich <[email protected]> <[email protected]>
+Simon Wunderlich <[email protected]> <[email protected]>
+Simon Wunderlich <[email protected]> <[email protected]>
+Simon Wunderlich <[email protected]> <[email protected]>
+Simon Wunderlich <[email protected]> <[email protected]>
 Sricharan Ramabadhran <[email protected]> <[email protected]>
 Srinivas Ramana <[email protected]> <[email protected]>
 Sriram R <[email protected]> <[email protected]>
Signature · 1 line
2.39.5
author maintainer
#9 lore raw

PATCH 8/10 mailmap: add entries for Sven Eckelmann

In reply to Simon Wunderlich

From: Sven Eckelmann <[email protected]>

Map the defunc mail addresses to the currently used mail address (listed in MAINTAINERS).

---
 .mailmap | 5 +++++
 1 file changed, 5 insertions(+)
.mailmap +5 -0
index efabe03f7849..41aca254671d 100644
@@ -667,6 +667,11 @@ Sudarshan Rajagopalan <[email protected]> <[email protected]>
 Sudeep Holla <[email protected]> Sudeep KarkadaNagesha <[email protected]>
 Sumit Semwal <[email protected]>
 Surabhi Vishnoi <[email protected]> <[email protected]>
+Sven Eckelmann <[email protected]> <[email protected]>
+Sven Eckelmann <[email protected]> <[email protected]>
+Sven Eckelmann <[email protected]> <[email protected]>
+Sven Eckelmann <[email protected]> <[email protected]>
+Sven Eckelmann <[email protected]> <[email protected]>
 Takashi YOSHII <[email protected]>
 Tamizh Chelvam Raja <[email protected]> <[email protected]>
 Taniya Das <[email protected]> <[email protected]>
Signature · 1 line
2.39.5
author maintainer
#10 lore raw

PATCH 9/10 MAINTAINERS: mailmap: add entries for Antonio Quartulli

In reply to Simon Wunderlich

From: Antonio Quartulli <[email protected]>

Update MAINTAINERS and link my various emails to my company email address in .mailmap.

---
 .mailmap    | 7 +++++++
 MAINTAINERS | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)
.mailmap +7 -0
index 41aca254671d..d55b94d1fe0b 100644
@@ -83,6 +83,13 @@ Anirudh Ghayal <[email protected]> <[email protected]>
 Antoine Tenart <[email protected]> <[email protected]>
 Antoine Tenart <[email protected]> <[email protected]>
 Antonio Ospite <[email protected]> <[email protected]>
+Antonio Quartulli <[email protected]> <[email protected]>
+Antonio Quartulli <[email protected]> <[email protected]>
+Antonio Quartulli <[email protected]> <[email protected]>
+Antonio Quartulli <[email protected]> <[email protected]>
+Antonio Quartulli <[email protected]> <[email protected]>
+Antonio Quartulli <[email protected]> <[email protected]>
+Antonio Quartulli <[email protected]> <[email protected]>
 Anup Patel <[email protected]> <[email protected]>
 Archit Taneja <[email protected]>
 Ard Biesheuvel <[email protected]> <[email protected]>
MAINTAINERS +1 -1
index c5e909a759e6..07206a6a1be5 100644
@@ -3869,7 +3869,7 @@ F:	drivers/platform/x86/barco-p50-gpio.c
 BATMAN ADVANCED
 M:	Marek Lindner <[email protected]>
 M:	Simon Wunderlich <[email protected]>
-M:	Antonio Quartulli <[email protected]>
+M:	Antonio Quartulli <[email protected]>
 M:	Sven Eckelmann <[email protected]>
 L:	[email protected] (moderated for non-subscribers)
 S:	Maintained
Signature · 1 line
2.39.5
author maintainer
#11 lore raw

PATCH 10/10 batman-adv: netlink: reduce duplicate code by returning interfaces

In reply to Simon Wunderlich

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

Reduce duplicate code by using netlink helpers which return the soft/hard interface directly. Instead of returning an interface index which we are typically not interested in.

---
 net/batman-adv/bridge_loop_avoidance.c |  33 ++----
 net/batman-adv/distributed-arp-table.c |  18 +--
 net/batman-adv/gateway_client.c        |  18 +--
 net/batman-adv/multicast.c             |  17 +--
 net/batman-adv/netlink.c               | 146 +++++++++++++++++--------
 net/batman-adv/netlink.h               |   5 +-
 net/batman-adv/originator.c            | 116 +++++++-------------
 net/batman-adv/translation-table.c     |  30 ++---
 8 files changed, 174 insertions(+), 209 deletions(-)
net/batman-adv/bridge_loop_avoidance.c +7 -26
index 449faf5a5487..8c814f790d17 100644
@@ -12,6 +12,7 @@
 #include <linux/compiler.h>
 #include <linux/container_of.h>
 #include <linux/crc16.h>
+#include <linux/err.h>
 #include <linux/errno.h>
 #include <linux/etherdevice.h>
 #include <linux/gfp.h>
@@ -38,7 +39,6 @@
 #include <net/arp.h>
 #include <net/genetlink.h>
 #include <net/netlink.h>
-#include <net/sock.h>
 #include <uapi/linux/batadv_packet.h>
 #include <uapi/linux/batman_adv.h>
 
@@ -47,7 +47,6 @@
 #include "log.h"
 #include "netlink.h"
 #include "originator.h"
-#include "soft-interface.h"
 #include "translation-table.h"
 
 static const u8 batadv_announce_mac[4] = {0x43, 0x05, 0x43, 0x05};
@@ -2233,25 +2232,16 @@ int batadv_bla_claim_dump(struct sk_buff *msg, struct netlink_callback *cb)
 {
 	struct batadv_hard_iface *primary_if = NULL;
 	int portid = NETLINK_CB(cb->skb).portid;
-	struct net *net = sock_net(cb->skb->sk);
 	struct net_device *soft_iface;
 	struct batadv_hashtable *hash;
 	struct batadv_priv *bat_priv;
 	int bucket = cb->args[0];
 	int idx = cb->args[1];
-	int ifindex;
 	int ret = 0;
 
-	ifindex = batadv_netlink_get_ifindex(cb->nlh,
-					     BATADV_ATTR_MESH_IFINDEX);
-	if (!ifindex)
-		return -EINVAL;
-
-	soft_iface = dev_get_by_index(net, ifindex);
-	if (!soft_iface || !batadv_softif_is_valid(soft_iface)) {
-		ret = -ENODEV;
-		goto out;
-	}
+	soft_iface = batadv_netlink_get_softif(cb);
+	if (IS_ERR(soft_iface))
+		return PTR_ERR(soft_iface);
 
 	bat_priv = netdev_priv(soft_iface);
 	hash = bat_priv->bla.claim_hash;
@@ -2403,25 +2393,16 @@ int batadv_bla_backbone_dump(struct sk_buff *msg, struct netlink_callback *cb)
 {
 	struct batadv_hard_iface *primary_if = NULL;
 	int portid = NETLINK_CB(cb->skb).portid;
-	struct net *net = sock_net(cb->skb->sk);
 	struct net_device *soft_iface;
 	struct batadv_hashtable *hash;
 	struct batadv_priv *bat_priv;
 	int bucket = cb->args[0];
 	int idx = cb->args[1];
-	int ifindex;
 	int ret = 0;
 
-	ifindex = batadv_netlink_get_ifindex(cb->nlh,
-					     BATADV_ATTR_MESH_IFINDEX);
-	if (!ifindex)
-		return -EINVAL;
-
-	soft_iface = dev_get_by_index(net, ifindex);
-	if (!soft_iface || !batadv_softif_is_valid(soft_iface)) {
-		ret = -ENODEV;
-		goto out;
-	}
+	soft_iface = batadv_netlink_get_softif(cb);
+	if (IS_ERR(soft_iface))
+		return PTR_ERR(soft_iface);
 
 	bat_priv = netdev_priv(soft_iface);
 	hash = bat_priv->bla.backbone_hash;
net/batman-adv/distributed-arp-table.c +4 -14
index 48b72c2be098..e5a07152d4ec 100644
@@ -11,6 +11,7 @@
 #include <linux/bitops.h>
 #include <linux/byteorder/generic.h>
 #include <linux/container_of.h>
+#include <linux/err.h>
 #include <linux/errno.h>
 #include <linux/etherdevice.h>
 #include <linux/gfp.h>
@@ -36,7 +37,6 @@
 #include <net/arp.h>
 #include <net/genetlink.h>
 #include <net/netlink.h>
-#include <net/sock.h>
 #include <uapi/linux/batman_adv.h>
 
 #include "bridge_loop_avoidance.h"
@@ -46,7 +46,6 @@
 #include "netlink.h"
 #include "originator.h"
 #include "send.h"
-#include "soft-interface.h"
 #include "translation-table.h"
 #include "tvlv.h"
 
@@ -937,25 +936,16 @@ int batadv_dat_cache_dump(struct sk_buff *msg, struct netlink_callback *cb)
 {
 	struct batadv_hard_iface *primary_if = NULL;
 	int portid = NETLINK_CB(cb->skb).portid;
-	struct net *net = sock_net(cb->skb->sk);
 	struct net_device *soft_iface;
 	struct batadv_hashtable *hash;
 	struct batadv_priv *bat_priv;
 	int bucket = cb->args[0];
 	int idx = cb->args[1];
-	int ifindex;
 	int ret = 0;
 
-	ifindex = batadv_netlink_get_ifindex(cb->nlh,
-					     BATADV_ATTR_MESH_IFINDEX);
-	if (!ifindex)
-		return -EINVAL;
-
-	soft_iface = dev_get_by_index(net, ifindex);
-	if (!soft_iface || !batadv_softif_is_valid(soft_iface)) {
-		ret = -ENODEV;
-		goto out;
-	}
+	soft_iface = batadv_netlink_get_softif(cb);
+	if (IS_ERR(soft_iface))
+		return PTR_ERR(soft_iface);
 
 	bat_priv = netdev_priv(soft_iface);
 	hash = bat_priv->dat.hash;
net/batman-adv/gateway_client.c +4 -14
index 0ddd8b4b3f4c..f68e34ed1f62 100644
@@ -10,6 +10,7 @@
 #include <linux/atomic.h>
 #include <linux/byteorder/generic.h>
 #include <linux/container_of.h>
+#include <linux/err.h>
 #include <linux/errno.h>
 #include <linux/etherdevice.h>
 #include <linux/gfp.h>
@@ -31,7 +32,6 @@
 #include <linux/sprintf.h>
 #include <linux/stddef.h>
 #include <linux/udp.h>
-#include <net/sock.h>
 #include <uapi/linux/batadv_packet.h>
 #include <uapi/linux/batman_adv.h>
 
@@ -40,7 +40,6 @@
 #include "netlink.h"
 #include "originator.h"
 #include "routing.h"
-#include "soft-interface.h"
 #include "translation-table.h"
 
 /* These are the offsets of the "hw type" and "hw address length" in the dhcp
@@ -502,22 +501,13 @@ void batadv_gw_node_free(struct batadv_priv *bat_priv)
 int batadv_gw_dump(struct sk_buff *msg, struct netlink_callback *cb)
 {
 	struct batadv_hard_iface *primary_if = NULL;
-	struct net *net = sock_net(cb->skb->sk);
 	struct net_device *soft_iface;
 	struct batadv_priv *bat_priv;
-	int ifindex;
 	int ret;
 
-	ifindex = batadv_netlink_get_ifindex(cb->nlh,
-					     BATADV_ATTR_MESH_IFINDEX);
-	if (!ifindex)
-		return -EINVAL;
-
-	soft_iface = dev_get_by_index(net, ifindex);
-	if (!soft_iface || !batadv_softif_is_valid(soft_iface)) {
-		ret = -ENODEV;
-		goto out;
-	}
+	soft_iface = batadv_netlink_get_softif(cb);
+	if (IS_ERR(soft_iface))
+		return PTR_ERR(soft_iface);
 
 	bat_priv = netdev_priv(soft_iface);
 
net/batman-adv/multicast.c +4 -13
index 14088c4ff2f6..d95c418484fa 100644
@@ -12,6 +12,7 @@
 #include <linux/bug.h>
 #include <linux/byteorder/generic.h>
 #include <linux/container_of.h>
+#include <linux/err.h>
 #include <linux/errno.h>
 #include <linux/etherdevice.h>
 #include <linux/gfp.h>
@@ -46,7 +47,6 @@
 #include <net/ip.h>
 #include <net/ipv6.h>
 #include <net/netlink.h>
-#include <net/sock.h>
 #include <uapi/linux/batadv_packet.h>
 #include <uapi/linux/batman_adv.h>
 
@@ -56,7 +56,6 @@
 #include "log.h"
 #include "netlink.h"
 #include "send.h"
-#include "soft-interface.h"
 #include "translation-table.h"
 #include "tvlv.h"
 
@@ -2104,21 +2103,13 @@ batadv_mcast_netlink_get_primary(struct netlink_callback *cb,
 				 struct batadv_hard_iface **primary_if)
 {
 	struct batadv_hard_iface *hard_iface = NULL;
-	struct net *net = sock_net(cb->skb->sk);
 	struct net_device *soft_iface;
 	struct batadv_priv *bat_priv;
-	int ifindex;
 	int ret = 0;
 
-	ifindex = batadv_netlink_get_ifindex(cb->nlh, BATADV_ATTR_MESH_IFINDEX);
-	if (!ifindex)
-		return -EINVAL;
-
-	soft_iface = dev_get_by_index(net, ifindex);
-	if (!soft_iface || !batadv_softif_is_valid(soft_iface)) {
-		ret = -ENODEV;
-		goto out;
-	}
+	soft_iface = batadv_netlink_get_softif(cb);
+	if (IS_ERR(soft_iface))
+		return PTR_ERR(soft_iface);
 
 	bat_priv = netdev_priv(soft_iface);
 
net/batman-adv/netlink.c +103 -43

231 lines not on this page · raw message

net/batman-adv/netlink.h +4 -1
index 876d2806a67d..2097c2ae98f1 100644
@@ -15,7 +15,10 @@
 
 void batadv_netlink_register(void);
 void batadv_netlink_unregister(void);
-int batadv_netlink_get_ifindex(const struct nlmsghdr *nlh, int attrtype);
+struct net_device *batadv_netlink_get_softif(struct netlink_callback *cb);
+struct batadv_hard_iface *
+batadv_netlink_get_hardif(struct batadv_priv *bat_priv,
+			  struct netlink_callback *cb);
 
 int batadv_netlink_tpmeter_notify(struct batadv_priv *bat_priv, const u8 *dst,
 				  u8 result, u32 test_time, u64 total_bytes,
net/batman-adv/originator.c +41 -75

191 lines not on this page · raw message

net/batman-adv/translation-table.c +7 -23
index 76d5517bb507..2bc3407f38b2 100644
@@ -15,6 +15,7 @@
 #include <linux/compiler.h>
 #include <linux/container_of.h>
 #include <linux/crc32c.h>
+#include <linux/err.h>
 #include <linux/errno.h>
 #include <linux/etherdevice.h>
 #include <linux/gfp.h>
@@ -39,7 +40,6 @@
 #include <linux/workqueue.h>
 #include <net/genetlink.h>
 #include <net/netlink.h>
-#include <net/sock.h>
 #include <uapi/linux/batadv_packet.h>
 #include <uapi/linux/batman_adv.h>
 
@@ -1115,26 +1115,18 @@ batadv_tt_local_dump_bucket(struct sk_buff *msg, u32 portid,
  */
 int batadv_tt_local_dump(struct sk_buff *msg, struct netlink_callback *cb)
 {
-	struct net *net = sock_net(cb->skb->sk);
 	struct net_device *soft_iface;
 	struct batadv_priv *bat_priv;
 	struct batadv_hard_iface *primary_if = NULL;
 	struct batadv_hashtable *hash;
 	int ret;
-	int ifindex;
 	int bucket = cb->args[0];
 	int idx = cb->args[1];
 	int portid = NETLINK_CB(cb->skb).portid;
 
-	ifindex = batadv_netlink_get_ifindex(cb->nlh, BATADV_ATTR_MESH_IFINDEX);
-	if (!ifindex)
-		return -EINVAL;
-
-	soft_iface = dev_get_by_index(net, ifindex);
-	if (!soft_iface || !batadv_softif_is_valid(soft_iface)) {
-		ret = -ENODEV;
-		goto out;
-	}
+	soft_iface = batadv_netlink_get_softif(cb);
+	if (IS_ERR(soft_iface))
+		return PTR_ERR(soft_iface);
 
 	bat_priv = netdev_priv(soft_iface);
 
@@ -1890,28 +1882,20 @@ batadv_tt_global_dump_bucket(struct sk_buff *msg, u32 portid, u32 seq,
  */
 int batadv_tt_global_dump(struct sk_buff *msg, struct netlink_callback *cb)
 {
-	struct net *net = sock_net(cb->skb->sk);
 	struct net_device *soft_iface;
 	struct batadv_priv *bat_priv;
 	struct batadv_hard_iface *primary_if = NULL;
 	struct batadv_hashtable *hash;
 	struct hlist_head *head;
 	int ret;
-	int ifindex;
 	int bucket = cb->args[0];
 	int idx = cb->args[1];
 	int sub = cb->args[2];
 	int portid = NETLINK_CB(cb->skb).portid;
 
-	ifindex = batadv_netlink_get_ifindex(cb->nlh, BATADV_ATTR_MESH_IFINDEX);
-	if (!ifindex)
-		return -EINVAL;
-
-	soft_iface = dev_get_by_index(net, ifindex);
-	if (!soft_iface || !batadv_softif_is_valid(soft_iface)) {
-		ret = -ENODEV;
-		goto out;
-	}
+	soft_iface = batadv_netlink_get_softif(cb);
+	if (IS_ERR(soft_iface))
+		return PTR_ERR(soft_iface);
 
 	bat_priv = netdev_priv(soft_iface);
 
Signature · 1 line
2.39.5