pull request for net-next: batman-adv 2025-07-10
Subsystems (3)
Simon Wunderlich
maintainercover pull request for net-next: batman-adv 2025-07-10
Hi Jakub, hi David,
here is a small 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 90b83efa6701656e02c86e7df2cb1765ea602d07:
Merge tag 'bpf-next-6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next (2025-05-28 15:52:42 -0700)
are available in the Git repository at:
git://git.open-mesh.org/linux-merge.git tags/batadv-next-pullrequest-20250710
for you to fetch changes up to 7dc284702bcd065a822a4c0bdbca09a08de5a654:
batman-adv: store hard_iface as iflink private data (2025-05-31 10:41:11 +0200)
----------------------------------------------------------------
This cleanup patchset includes the following patches:
- bump version strings, by Simon Wunderlich
- batman-adv: store hard_iface as iflink private data, by Matthias Schiffer
----------------------------------------------------------------
Matthias Schiffer (1):
batman-adv: store hard_iface as iflink private data
Simon Wunderlich (1):
batman-adv: Start new development cycle
net/batman-adv/bat_algo.c | 1 + net/batman-adv/bat_algo.h | 2 -- net/batman-adv/bat_iv_ogm.c | 25 ++++++++----------------- net/batman-adv/bat_v.c | 6 ++---- net/batman-adv/bat_v_elp.c | 8 ++------ net/batman-adv/bat_v_ogm.c | 14 ++++---------- net/batman-adv/hard-interface.c | 39 ++++++++++++++------------------------- net/batman-adv/main.c | 7 ++----- net/batman-adv/main.h | 2 +- net/batman-adv/mesh-interface.c | 6 +++--- net/batman-adv/multicast.c | 6 ++---- net/batman-adv/netlink.c | 7 ++----- net/batman-adv/originator.c | 7 ++----- net/batman-adv/send.c | 7 ++----- 14 files changed, 45 insertions(+), 92 deletions(-)
Simon Wunderlich
maintainerPATCH 1/2 batman-adv: Start new development cycle
This version will contain all the (major or even only minor) changes for Linux 6.17.
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
@@ -13,7 +13,7 @@#define BATADV_DRIVER_DEVICE "batman-adv"#ifndef BATADV_SOURCE_VERSION -#define BATADV_SOURCE_VERSION "2025.2" +#define BATADV_SOURCE_VERSION "2025.3"#endif /* B.A.T.M.A.N. parameters */
Signature · 1 line
2.39.5
Re: [PATCH net-next 1/2] 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 Thu, 10 Jul 2025 18:45:00 +0200 you wrote:
This version will contain all the (major or even only minor) changes for Linux 6.17.
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:
- [net-next,1/2] batman-adv: Start new development cycle
https://git.kernel.org/netdev/net-next/c/2b05db6b8a10 - [net-next,2/2] batman-adv: store hard_iface as iflink private data https://git.kernel.org/netdev/net-next/c/7dc284702bcd
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Simon Wunderlich
maintainerPATCH 2/2 batman-adv: store hard_iface as iflink private data
In reply to Simon WunderlichFrom: Matthias Schiffer <[email protected]>
By passing the hard_iface to netdev_master_upper_dev_link() as private data, we can iterate over hardifs of a mesh interface more efficiently using netdev_for_each_lower_private*() (instead of iterating over the global hardif list). In addition, this will enable resolving a hardif from its netdev using netdev_lower_dev_get_private() and getting rid of the global list altogether in the following patches.
A similar approach can be seen in the bonding driver.
--- net/batman-adv/bat_algo.c | 1 + net/batman-adv/bat_algo.h | 2 -- net/batman-adv/bat_iv_ogm.c | 25 +++++++-------------- net/batman-adv/bat_v.c | 6 ++--- net/batman-adv/bat_v_elp.c | 8 ++----- net/batman-adv/bat_v_ogm.c | 14 ++++-------- net/batman-adv/hard-interface.c | 39 ++++++++++++--------------------- net/batman-adv/main.c | 7 ++---- net/batman-adv/mesh-interface.c | 6 ++--- net/batman-adv/multicast.c | 6 ++--- net/batman-adv/netlink.c | 7 ++---- net/batman-adv/originator.c | 7 ++---- net/batman-adv/send.c | 7 ++---- 13 files changed, 44 insertions(+), 91 deletions(-)
net/batman-adv/bat_algo.c +1 -0
@@ -14,6 +14,7 @@#include <linux/skbuff.h> #include <linux/stddef.h> #include <linux/string.h> +#include <linux/types.h> #include <net/genetlink.h> #include <net/netlink.h> #include <uapi/linux/batman_adv.h>
net/batman-adv/bat_algo.h +0 -2
@@ -11,10 +11,8 @@#include <linux/netlink.h> #include <linux/skbuff.h> -#include <linux/types.h> extern char batadv_routing_algo[]; -extern struct list_head batadv_hardif_list;void batadv_algo_init (void );struct batadv_algo_ops *batadv_algo_get (const char *name);
net/batman-adv/bat_iv_ogm.c +8 -17
@@ -791,6 +791,7 @@ static void batadv_iv_ogm_schedule_buff(struct batadv_hard_iface *hard_iface)struct batadv_ogm_packet *batadv_ogm_packet;struct batadv_hard_iface *primary_if, *tmp_hard_iface;int *ogm_buff_len = &hard_iface->bat_iv.ogm_buff_len; +struct list_head *iter;u32 seqno;u16 tvlv_len =0 ;unsigned long send_time;
@@ -847,10 +848,7 @@ static void batadv_iv_ogm_schedule_buff(struct batadv_hard_iface *hard_iface)* interfaces. */ rcu_read_lock (); -list_for_each_entry_rcu (tmp_hard_iface, &batadv_hardif_list, list) { -if (tmp_hard_iface->mesh_iface != hard_iface->mesh_iface) -continue ; - +netdev_for_each_lower_private_rcu (hard_iface->mesh_iface, tmp_hard_iface, iter) {if (!kref_get_unless_zero (&tmp_hard_iface->refcount))continue ;
@@ -1567,6 +1565,7 @@ static void batadv_iv_ogm_process(const struct sk_buff *skb, int ogm_offset,bool is_my_oldorig = false;bool is_my_addr = false;bool is_my_orig = false; +struct list_head *iter; ogm_packet = (struct batadv_ogm_packet *)(skb->data + ogm_offset); ethhdr =eth_hdr (skb);
@@ -1603,11 +1602,9 @@ static void batadv_iv_ogm_process(const struct sk_buff *skb, int ogm_offset, ogm_packet->version, has_directlink_flag);rcu_read_lock (); -list_for_each_entry_rcu (hard_iface, &batadv_hardif_list, list) { -if (hard_iface->if_status !=BATADV_IF_ACTIVE ) -continue ; -if (hard_iface->mesh_iface != if_incoming->mesh_iface) +netdev_for_each_lower_private_rcu (if_incoming->mesh_iface, hard_iface, iter) { +if (hard_iface->if_status !=BATADV_IF_ACTIVE )continue ; if (batadv_compare_eth(ethhdr->h_source,
@@ -1668,13 +1665,10 @@ static void batadv_iv_ogm_process(const struct sk_buff *skb, int ogm_offset, if_incoming, BATADV_IF_DEFAULT);rcu_read_lock (); -list_for_each_entry_rcu (hard_iface, &batadv_hardif_list, list) { +netdev_for_each_lower_private_rcu (bat_priv->mesh_iface, hard_iface, iter) {if (hard_iface->if_status !=BATADV_IF_ACTIVE )continue ; -if (hard_iface->mesh_iface != bat_priv->mesh_iface) -continue ; -if (!kref_get_unless_zero (&hard_iface->refcount))continue ;
@@ -2142,6 +2136,7 @@ batadv_iv_ogm_neigh_dump(struct sk_buff *msg, struct netlink_callback *cb, struct batadv_hard_iface *single_hardif) {struct batadv_hard_iface *hard_iface; +struct list_head *iter;int i_hardif =0 ;int i_hardif_s = cb->args[0 ];int idx = cb->args[1 ];
@@ -2158,11 +2153,7 @@ batadv_iv_ogm_neigh_dump(struct sk_buff *msg, struct netlink_callback *cb, i_hardif++; } }else { -list_for_each_entry_rcu (hard_iface, &batadv_hardif_list, - list) { -if (hard_iface->mesh_iface != bat_priv->mesh_iface) -continue ; - +netdev_for_each_lower_private_rcu (bat_priv->mesh_iface, hard_iface, iter) {if (i_hardif++ < i_hardif_s)continue ;
net/batman-adv/bat_v.c +2 -4
@@ -212,6 +212,7 @@ batadv_v_neigh_dump(struct sk_buff *msg, struct netlink_callback *cb, struct batadv_hard_iface *single_hardif) {struct batadv_hard_iface *hard_iface; +struct list_head *iter;int i_hardif =0 ;int i_hardif_s = cb->args[0 ];int idx = cb->args[1 ];
@@ -227,10 +228,7 @@ batadv_v_neigh_dump(struct sk_buff *msg, struct netlink_callback *cb, i_hardif++; } }else { -list_for_each_entry_rcu (hard_iface, &batadv_hardif_list, list) { -if (hard_iface->mesh_iface != bat_priv->mesh_iface) -continue ; - +netdev_for_each_lower_private_rcu (bat_priv->mesh_iface, hard_iface, iter) {if (i_hardif++ < i_hardif_s)continue ;
net/batman-adv/bat_v_elp.c +2 -6
@@ -35,7 +35,6 @@#include <net/cfg80211.h> #include <uapi/linux/batadv_packet.h> -#include "bat_algo.h" #include "bat_v_ogm.h" #include "hard-interface.h" #include "log.h"
@@ -472,15 +471,12 @@ void batadv_v_elp_iface_activate(struct batadv_hard_iface *primary_iface,void batadv_v_elp_primary_iface_set (struct batadv_hard_iface *primary_iface) {struct batadv_hard_iface *hard_iface; +struct list_head *iter;/* update orig field of every elp iface belonging to this mesh */ rcu_read_lock (); -list_for_each_entry_rcu (hard_iface, &batadv_hardif_list, list) { -if (primary_iface->mesh_iface != hard_iface->mesh_iface) -continue ; - +netdev_for_each_lower_private_rcu (primary_iface->mesh_iface, hard_iface, iter)batadv_v_elp_iface_activate (primary_iface, hard_iface); - }rcu_read_unlock (); }
net/batman-adv/bat_v_ogm.c +4 -10
@@ -22,7 +22,6 @@#include <linux/mutex.h> #include <linux/netdevice.h> #include <linux/random.h> -#include <linux/rculist.h> #include <linux/rcupdate.h> #include <linux/skbuff.h> #include <linux/slab.h>
@@ -33,7 +32,6 @@#include <linux/workqueue.h> #include <uapi/linux/batadv_packet.h> -#include "bat_algo.h" #include "hard-interface.h" #include "hash.h" #include "log.h"
@@ -265,6 +263,7 @@ static void batadv_v_ogm_send_meshif(struct batadv_priv *bat_priv)struct batadv_ogm2_packet *ogm_packet;struct sk_buff *skb, *skb_tmp;unsigned char *ogm_buff; +struct list_head *iter;int ogm_buff_len;u16 tvlv_len =0 ;int ret;
@@ -301,10 +300,7 @@ static void batadv_v_ogm_send_meshif(struct batadv_priv *bat_priv)/* broadcast on every interface */ rcu_read_lock (); -list_for_each_entry_rcu (hard_iface, &batadv_hardif_list, list) { -if (hard_iface->mesh_iface != bat_priv->mesh_iface) -continue ; - +netdev_for_each_lower_private_rcu (bat_priv->mesh_iface, hard_iface, iter) {if (!kref_get_unless_zero (&hard_iface->refcount))continue ;
@@ -859,6 +855,7 @@ static void batadv_v_ogm_process(const struct sk_buff *skb, int ogm_offset,struct batadv_hard_iface *hard_iface;struct batadv_ogm2_packet *ogm_packet;u32 ogm_throughput, link_throughput, path_throughput; +struct list_head *iter;int ret; ethhdr =eth_hdr (skb);
@@ -921,13 +918,10 @@ static void batadv_v_ogm_process(const struct sk_buff *skb, int ogm_offset, BATADV_IF_DEFAULT);rcu_read_lock (); -list_for_each_entry_rcu (hard_iface, &batadv_hardif_list, list) { +netdev_for_each_lower_private_rcu (bat_priv->mesh_iface, hard_iface, iter) {if (hard_iface->if_status !=BATADV_IF_ACTIVE )continue ; -if (hard_iface->mesh_iface != bat_priv->mesh_iface) -continue ; -if (!kref_get_unless_zero (&hard_iface->refcount))continue ;
net/batman-adv/hard-interface.c +14 -25
@@ -438,15 +438,13 @@ int batadv_hardif_no_broadcast(struct batadv_hard_iface *if_outgoing, }static struct batadv_hard_iface * -batadv_hardif_get_active (const struct net_device *mesh_iface) +batadv_hardif_get_active (struct net_device *mesh_iface) {struct batadv_hard_iface *hard_iface; +struct list_head *iter;rcu_read_lock (); -list_for_each_entry_rcu (hard_iface, &batadv_hardif_list, list) { -if (hard_iface->mesh_iface != mesh_iface) -continue ; - +netdev_for_each_lower_private_rcu (mesh_iface, hard_iface, iter) {if (hard_iface->if_status ==BATADV_IF_ACTIVE &&kref_get_unless_zero (&hard_iface->refcount)) goto out;
@@ -508,19 +506,17 @@ batadv_hardif_is_iface_up(const struct batadv_hard_iface *hard_iface)static void batadv_check_known_mac_addr (const struct batadv_hard_iface *hard_iface) { -const struct net_device *mesh_iface = hard_iface->mesh_iface; +struct net_device *mesh_iface = hard_iface->mesh_iface;const struct batadv_hard_iface *tmp_hard_iface; +struct list_head *iter;if (!mesh_iface)return ; -list_for_each_entry (tmp_hard_iface, &batadv_hardif_list, list) { +netdev_for_each_lower_private (mesh_iface, tmp_hard_iface, iter) {if (tmp_hard_iface == hard_iface)continue ; -if (tmp_hard_iface->mesh_iface != mesh_iface) -continue ; -if (tmp_hard_iface->if_status ==BATADV_IF_NOT_IN_USE )continue ;
@@ -545,15 +541,13 @@ static void batadv_hardif_recalc_extra_skbroom(struct net_device *mesh_iface)unsigned short lower_headroom =0 ;unsigned short lower_tailroom =0 ;unsigned short needed_headroom; +struct list_head *iter;rcu_read_lock (); -list_for_each_entry_rcu (hard_iface, &batadv_hardif_list, list) { +netdev_for_each_lower_private_rcu (mesh_iface, hard_iface, iter) {if (hard_iface->if_status ==BATADV_IF_NOT_IN_USE )continue ; -if (hard_iface->mesh_iface != mesh_iface) -continue ; - lower_header_len = max_t(unsigned short, lower_header_len, hard_iface->net_dev->hard_header_len);
@@ -586,17 +580,15 @@ int batadv_hardif_min_mtu(struct net_device *mesh_iface) {struct batadv_priv *bat_priv =netdev_priv (mesh_iface);const struct batadv_hard_iface *hard_iface; +struct list_head *iter;int min_mtu =INT_MAX ;rcu_read_lock (); -list_for_each_entry_rcu (hard_iface, &batadv_hardif_list, list) { +netdev_for_each_lower_private_rcu (mesh_iface, hard_iface, iter) {if (hard_iface->if_status !=BATADV_IF_ACTIVE && hard_iface->if_status !=BATADV_IF_TO_BE_ACTIVATED )continue ; -if (hard_iface->mesh_iface != mesh_iface) -continue ; - min_mtu =min_t (int, hard_iface->net_dev->mtu, min_mtu); }rcu_read_unlock ();
@@ -734,7 +726,7 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, bat_priv =netdev_priv (hard_iface->mesh_iface); ret =netdev_master_upper_dev_link (hard_iface->net_dev, - mesh_iface,NULL ,NULL ,NULL ); + mesh_iface, hard_iface,NULL ,NULL );if (ret) goto err_dev;
@@ -803,18 +795,15 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,* * Return: number of connected/enslaved hard interfaces */ -static size_t batadv_hardif_cnt (const struct net_device *mesh_iface) +static size_t batadv_hardif_cnt (struct net_device *mesh_iface) {struct batadv_hard_iface *hard_iface; +struct list_head *iter;size_t count =0 ;rcu_read_lock (); -list_for_each_entry_rcu (hard_iface, &batadv_hardif_list, list) { -if (hard_iface->mesh_iface != mesh_iface) -continue ; - +netdev_for_each_lower_private_rcu (mesh_iface, hard_iface, iter) count++; - }rcu_read_unlock ();return count;
net/batman-adv/main.c +2 -5
@@ -27,7 +27,6 @@#include <linux/module.h> #include <linux/netdevice.h> #include <linux/printk.h> -#include <linux/rculist.h> #include <linux/rcupdate.h> #include <linux/skbuff.h> #include <linux/slab.h>
@@ -303,16 +302,14 @@ void batadv_mesh_free(struct net_device *mesh_iface)bool batadv_is_my_mac (struct batadv_priv *bat_priv,const u8 *addr) {const struct batadv_hard_iface *hard_iface; +struct list_head *iter;bool is_my_mac = false;rcu_read_lock (); -list_for_each_entry_rcu (hard_iface, &batadv_hardif_list, list) { +netdev_for_each_lower_private_rcu (bat_priv->mesh_iface, hard_iface, iter) {if (hard_iface->if_status !=BATADV_IF_ACTIVE )continue ; -if (hard_iface->mesh_iface != bat_priv->mesh_iface) -continue ; -if (batadv_compare_eth (hard_iface->net_dev->dev_addr, addr)) { is_my_mac = true;break ;
net/batman-adv/mesh-interface.c +3 -3
@@ -1101,9 +1101,9 @@ static void batadv_meshif_destroy_netlink(struct net_device *mesh_iface,struct batadv_hard_iface *hard_iface;struct batadv_meshif_vlan *vlan; -list_for_each_entry (hard_iface, &batadv_hardif_list, list) { -if (hard_iface->mesh_iface == mesh_iface) -batadv_hardif_disable_interface (hard_iface); +while (!list_empty (&mesh_iface->adj_list.lower)) { + hard_iface =netdev_adjacent_get_private (mesh_iface->adj_list.lower.next); +batadv_hardif_disable_interface (hard_iface); }/* destroy the "untagged" VLAN */
net/batman-adv/multicast.c +2 -4
@@ -246,15 +246,13 @@ static u8 batadv_mcast_mla_rtr_flags_get(struct batadv_priv *bat_priv,static u8 batadv_mcast_mla_forw_flags_get (struct batadv_priv *bat_priv) {const struct batadv_hard_iface *hard_iface; +struct list_head *iter;rcu_read_lock (); -list_for_each_entry_rcu (hard_iface, &batadv_hardif_list, list) { +netdev_for_each_lower_private_rcu (bat_priv->mesh_iface, hard_iface, iter) {if (hard_iface->if_status !=BATADV_IF_ACTIVE )continue ; -if (hard_iface->mesh_iface != bat_priv->mesh_iface) -continue ; -if (hard_iface->net_dev->mtu <IPV6_MIN_MTU ) {rcu_read_unlock ();return BATADV_NO_FLAGS ;
net/batman-adv/netlink.c +2 -5
@@ -20,7 +20,6 @@#include <linux/if_vlan.h> #include <linux/init.h> #include <linux/limits.h> -#include <linux/list.h> #include <linux/minmax.h> #include <linux/netdevice.h> #include <linux/netlink.h>
@@ -968,6 +967,7 @@ batadv_netlink_dump_hardif(struct sk_buff *msg, struct netlink_callback *cb)struct batadv_priv *bat_priv;int portid =NETLINK_CB (cb->skb).portid;int skip = cb->args[0 ]; +struct list_head *iter;int i =0 ; mesh_iface =batadv_netlink_get_meshif (cb);
@@ -979,10 +979,7 @@ batadv_netlink_dump_hardif(struct sk_buff *msg, struct netlink_callback *cb)rtnl_lock (); cb->seq = batadv_hardif_generation <<1 |1 ; -list_for_each_entry (hard_iface, &batadv_hardif_list, list) { -if (hard_iface->mesh_iface != mesh_iface) -continue ; - +netdev_for_each_lower_private (mesh_iface, hard_iface, iter) {if (i++ < skip)continue ;
net/batman-adv/originator.c +2 -5
@@ -29,7 +29,6 @@#include <linux/workqueue.h> #include <uapi/linux/batadv_packet.h> -#include "bat_algo.h" #include "distributed-arp-table.h" #include "fragmentation.h" #include "gateway_client.h"
@@ -1208,6 +1207,7 @@ static bool batadv_purge_orig_node(struct batadv_priv *bat_priv,struct batadv_neigh_node *best_neigh_node;struct batadv_hard_iface *hard_iface;bool changed_ifinfo, changed_neigh; +struct list_head *iter;if (batadv_has_timed_out (orig_node->last_seen,2 *BATADV_PURGE_TIMEOUT )) {
@@ -1232,13 +1232,10 @@ static bool batadv_purge_orig_node(struct batadv_priv *bat_priv,/* ... then for all other interfaces. */ rcu_read_lock (); -list_for_each_entry_rcu (hard_iface, &batadv_hardif_list, list) { +netdev_for_each_lower_private_rcu (bat_priv->mesh_iface, hard_iface, iter) {if (hard_iface->if_status !=BATADV_IF_ACTIVE )continue ; -if (hard_iface->mesh_iface != bat_priv->mesh_iface) -continue ; -if (!kref_get_unless_zero (&hard_iface->refcount))continue ;
net/batman-adv/send.c +2 -5
@@ -21,7 +21,6 @@#include <linux/list.h> #include <linux/netdevice.h> #include <linux/printk.h> -#include <linux/rculist.h> #include <linux/rcupdate.h> #include <linux/skbuff.h> #include <linux/slab.h>
@@ -924,6 +923,7 @@ static int __batadv_forw_bcast_packet(struct batadv_priv *bat_priv, {struct batadv_hard_iface *hard_iface;struct batadv_hard_iface *primary_if; +struct list_head *iter;int ret =NETDEV_TX_OK ; primary_if =batadv_primary_if_get_selected (bat_priv);
@@ -931,10 +931,7 @@ static int __batadv_forw_bcast_packet(struct batadv_priv *bat_priv,return NETDEV_TX_BUSY ;rcu_read_lock (); -list_for_each_entry_rcu (hard_iface, &batadv_hardif_list, list) { -if (hard_iface->mesh_iface != bat_priv->mesh_iface) -continue ; - +netdev_for_each_lower_private_rcu (bat_priv->mesh_iface, hard_iface, iter) {if (!kref_get_unless_zero (&hard_iface->refcount))continue ;
Signature · 1 line
2.39.5