Skip to content

Commit

Permalink
Merge tag 'batadv-next-for-davem-20190627v2' of git://git.open-mesh.o…
Browse files Browse the repository at this point in the history
…rg/linux-merge

Simon Wunderlich says:

====================
This feature/cleanup patchset includes the following patches:

 - bump version strings, by Simon Wunderlich

 - fix includes for _MAX constants, atomic functions and fwdecls,
   by Sven Eckelmann (3 patches)

 - shorten multicast tt/tvlv worker spinlock section, by Linus Luessing

 - routeable multicast preparations: implement MAC multicast filtering,
   by Linus Luessing (2 patches, David Millers comments integrated)

 - remove return value checks for debugfs_create, by Greg Kroah-Hartman

 - add routable multicast optimizations, by Linus Luessing (2 patches)
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jun 28, 2019
2 parents fcd71ef + 11d458c commit 65dc541
Show file tree
Hide file tree
Showing 40 changed files with 1,041 additions and 463 deletions.
8 changes: 8 additions & 0 deletions include/uapi/linux/batadv_packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,20 @@ enum batadv_icmp_packettype {
* @BATADV_MCAST_WANT_ALL_UNSNOOPABLES: we want all packets destined for
* 224.0.0.0/24 or ff02::1
* @BATADV_MCAST_WANT_ALL_IPV4: we want all IPv4 multicast packets
* (both link-local and routable ones)
* @BATADV_MCAST_WANT_ALL_IPV6: we want all IPv6 multicast packets
* (both link-local and routable ones)
* @BATADV_MCAST_WANT_NO_RTR4: we have no IPv4 multicast router and therefore
* only need routable IPv4 multicast packets we signed up for explicitly
* @BATADV_MCAST_WANT_NO_RTR6: we have no IPv6 multicast router and therefore
* only need routable IPv6 multicast packets we signed up for explicitly
*/
enum batadv_mcast_flags {
BATADV_MCAST_WANT_ALL_UNSNOOPABLES = 1UL << 0,
BATADV_MCAST_WANT_ALL_IPV4 = 1UL << 1,
BATADV_MCAST_WANT_ALL_IPV6 = 1UL << 2,
BATADV_MCAST_WANT_NO_RTR4 = 1UL << 3,
BATADV_MCAST_WANT_NO_RTR6 = 1UL << 4,
};

/* tt data subtypes */
Expand Down
7 changes: 3 additions & 4 deletions net/batman-adv/bat_algo.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@

#include "main.h"

#include <linux/netlink.h>
#include <linux/seq_file.h>
#include <linux/skbuff.h>
#include <linux/types.h>

struct netlink_callback;
struct seq_file;
struct sk_buff;

extern char batadv_routing_algo[];
extern struct list_head batadv_hardif_list;

Expand Down
3 changes: 1 addition & 2 deletions net/batman-adv/bat_v.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <linux/rculist.h>
#include <linux/rcupdate.h>
#include <linux/seq_file.h>
#include <linux/skbuff.h>
#include <linux/spinlock.h>
#include <linux/stddef.h>
#include <linux/types.h>
Expand All @@ -41,8 +42,6 @@
#include "netlink.h"
#include "originator.h"

struct sk_buff;

static void batadv_v_iface_activate(struct batadv_hard_iface *hard_iface)
{
struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
Expand Down
4 changes: 2 additions & 2 deletions net/batman-adv/bat_v_elp.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

#include "main.h"

struct sk_buff;
struct work_struct;
#include <linux/skbuff.h>
#include <linux/workqueue.h>

int batadv_v_elp_iface_enable(struct batadv_hard_iface *hard_iface);
void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface);
Expand Down
3 changes: 1 addition & 2 deletions net/batman-adv/bat_v_ogm.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@

#include "main.h"

#include <linux/skbuff.h>
#include <linux/types.h>

struct sk_buff;

int batadv_v_ogm_init(struct batadv_priv *bat_priv);
void batadv_v_ogm_free(struct batadv_priv *bat_priv);
int batadv_v_ogm_iface_enable(struct batadv_hard_iface *hard_iface);
Expand Down
9 changes: 4 additions & 5 deletions net/batman-adv/bridge_loop_avoidance.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
#include "main.h"

#include <linux/compiler.h>
#include <linux/netdevice.h>
#include <linux/netlink.h>
#include <linux/seq_file.h>
#include <linux/skbuff.h>
#include <linux/stddef.h>
#include <linux/types.h>

struct net_device;
struct netlink_callback;
struct seq_file;
struct sk_buff;

/**
* batadv_bla_is_loopdetect_mac() - check if the mac address is from a loop
* detect frame sent by bridge loop avoidance
Expand Down
99 changes: 20 additions & 79 deletions net/batman-adv/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <asm/current.h>
#include <linux/dcache.h>
#include <linux/debugfs.h>
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/export.h>
#include <linux/fs.h>
Expand Down Expand Up @@ -293,31 +292,13 @@ static struct batadv_debuginfo *batadv_hardif_debuginfos[] = {
void batadv_debugfs_init(void)
{
struct batadv_debuginfo **bat_debug;
struct dentry *file;

batadv_debugfs = debugfs_create_dir(BATADV_DEBUGFS_SUBDIR, NULL);
if (batadv_debugfs == ERR_PTR(-ENODEV))
batadv_debugfs = NULL;

if (!batadv_debugfs)
goto err;

for (bat_debug = batadv_general_debuginfos; *bat_debug; ++bat_debug) {
file = debugfs_create_file(((*bat_debug)->attr).name,
S_IFREG | ((*bat_debug)->attr).mode,
batadv_debugfs, NULL,
&(*bat_debug)->fops);
if (!file) {
pr_err("Can't add general debugfs file: %s\n",
((*bat_debug)->attr).name);
goto err;
}
}

return;
err:
debugfs_remove_recursive(batadv_debugfs);
batadv_debugfs = NULL;
for (bat_debug = batadv_general_debuginfos; *bat_debug; ++bat_debug)
debugfs_create_file(((*bat_debug)->attr).name,
S_IFREG | ((*bat_debug)->attr).mode,
batadv_debugfs, NULL, &(*bat_debug)->fops);
}

/**
Expand All @@ -333,42 +314,23 @@ void batadv_debugfs_destroy(void)
* batadv_debugfs_add_hardif() - creates the base directory for a hard interface
* in debugfs.
* @hard_iface: hard interface which should be added.
*
* Return: 0 on success or negative error number in case of failure
*/
int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface)
void batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface)
{
struct net *net = dev_net(hard_iface->net_dev);
struct batadv_debuginfo **bat_debug;
struct dentry *file;

if (!batadv_debugfs)
goto out;

if (net != &init_net)
return 0;
return;

hard_iface->debug_dir = debugfs_create_dir(hard_iface->net_dev->name,
batadv_debugfs);
if (!hard_iface->debug_dir)
goto out;

for (bat_debug = batadv_hardif_debuginfos; *bat_debug; ++bat_debug) {
file = debugfs_create_file(((*bat_debug)->attr).name,
S_IFREG | ((*bat_debug)->attr).mode,
hard_iface->debug_dir,
hard_iface->net_dev,
&(*bat_debug)->fops);
if (!file)
goto rem_attr;
}

return 0;
rem_attr:
debugfs_remove_recursive(hard_iface->debug_dir);
hard_iface->debug_dir = NULL;
out:
return -ENOMEM;
for (bat_debug = batadv_hardif_debuginfos; *bat_debug; ++bat_debug)
debugfs_create_file(((*bat_debug)->attr).name,
S_IFREG | ((*bat_debug)->attr).mode,
hard_iface->debug_dir, hard_iface->net_dev,
&(*bat_debug)->fops);
}

/**
Expand All @@ -379,15 +341,12 @@ void batadv_debugfs_rename_hardif(struct batadv_hard_iface *hard_iface)
{
const char *name = hard_iface->net_dev->name;
struct dentry *dir;
struct dentry *d;

dir = hard_iface->debug_dir;
if (!dir)
return;

d = debugfs_rename(dir->d_parent, dir, dir->d_parent, name);
if (!d)
pr_err("Can't rename debugfs dir to %s\n", name);
debugfs_rename(dir->d_parent, dir, dir->d_parent, name);
}

/**
Expand Down Expand Up @@ -419,44 +378,29 @@ int batadv_debugfs_add_meshif(struct net_device *dev)
struct batadv_priv *bat_priv = netdev_priv(dev);
struct batadv_debuginfo **bat_debug;
struct net *net = dev_net(dev);
struct dentry *file;

if (!batadv_debugfs)
goto out;

if (net != &init_net)
return 0;

bat_priv->debug_dir = debugfs_create_dir(dev->name, batadv_debugfs);
if (!bat_priv->debug_dir)
goto out;

if (batadv_socket_setup(bat_priv) < 0)
goto rem_attr;
batadv_socket_setup(bat_priv);

if (batadv_debug_log_setup(bat_priv) < 0)
goto rem_attr;

for (bat_debug = batadv_mesh_debuginfos; *bat_debug; ++bat_debug) {
file = debugfs_create_file(((*bat_debug)->attr).name,
S_IFREG | ((*bat_debug)->attr).mode,
bat_priv->debug_dir,
dev, &(*bat_debug)->fops);
if (!file) {
batadv_err(dev, "Can't add debugfs file: %s/%s\n",
dev->name, ((*bat_debug)->attr).name);
goto rem_attr;
}
}
for (bat_debug = batadv_mesh_debuginfos; *bat_debug; ++bat_debug)
debugfs_create_file(((*bat_debug)->attr).name,
S_IFREG | ((*bat_debug)->attr).mode,
bat_priv->debug_dir, dev,
&(*bat_debug)->fops);

if (batadv_nc_init_debugfs(bat_priv) < 0)
goto rem_attr;
batadv_nc_init_debugfs(bat_priv);

return 0;
rem_attr:
debugfs_remove_recursive(bat_priv->debug_dir);
bat_priv->debug_dir = NULL;
out:
return -ENOMEM;
}

Expand All @@ -469,15 +413,12 @@ void batadv_debugfs_rename_meshif(struct net_device *dev)
struct batadv_priv *bat_priv = netdev_priv(dev);
const char *name = dev->name;
struct dentry *dir;
struct dentry *d;

dir = bat_priv->debug_dir;
if (!dir)
return;

d = debugfs_rename(dir->d_parent, dir, dir->d_parent, name);
if (!d)
pr_err("Can't rename debugfs dir to %s\n", name);
debugfs_rename(dir->d_parent, dir, dir->d_parent, name);
}

/**
Expand Down
9 changes: 4 additions & 5 deletions net/batman-adv/debugfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

#include "main.h"

struct file;
struct net_device;
#include <linux/fs.h>
#include <linux/netdevice.h>

#define BATADV_DEBUGFS_SUBDIR "batman_adv"

Expand All @@ -22,7 +22,7 @@ void batadv_debugfs_destroy(void);
int batadv_debugfs_add_meshif(struct net_device *dev);
void batadv_debugfs_rename_meshif(struct net_device *dev);
void batadv_debugfs_del_meshif(struct net_device *dev);
int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface);
void batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface);
void batadv_debugfs_rename_hardif(struct batadv_hard_iface *hard_iface);
void batadv_debugfs_del_hardif(struct batadv_hard_iface *hard_iface);

Expand Down Expand Up @@ -54,9 +54,8 @@ static inline void batadv_debugfs_del_meshif(struct net_device *dev)
}

static inline
int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface)
void batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface)
{
return 0;
}

static inline
Expand Down
7 changes: 3 additions & 4 deletions net/batman-adv/distributed-arp-table.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@

#include <linux/compiler.h>
#include <linux/netdevice.h>
#include <linux/netlink.h>
#include <linux/seq_file.h>
#include <linux/skbuff.h>
#include <linux/types.h>
#include <uapi/linux/batadv_packet.h>

#include "originator.h"

struct netlink_callback;
struct seq_file;
struct sk_buff;

#ifdef CONFIG_BATMAN_ADV_DAT

/* BATADV_DAT_ADDR_MAX - maximum address value in the DHT space */
Expand Down
3 changes: 1 addition & 2 deletions net/batman-adv/fragmentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@

#include <linux/compiler.h>
#include <linux/list.h>
#include <linux/skbuff.h>
#include <linux/stddef.h>
#include <linux/types.h>

struct sk_buff;

void batadv_frag_purge_orig(struct batadv_orig_node *orig,
bool (*check_cb)(struct batadv_frag_table_entry *));
bool batadv_frag_skb_fwd(struct sk_buff *skb,
Expand Down
9 changes: 4 additions & 5 deletions net/batman-adv/gateway_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@

#include "main.h"

#include <linux/netlink.h>
#include <linux/seq_file.h>
#include <linux/skbuff.h>
#include <linux/types.h>

struct batadv_tvlv_gateway_data;
struct netlink_callback;
struct seq_file;
struct sk_buff;
#include <uapi/linux/batadv_packet.h>

void batadv_gw_check_client_stop(struct batadv_priv *bat_priv);
void batadv_gw_reselect(struct batadv_priv *bat_priv);
Expand Down
1 change: 1 addition & 0 deletions net/batman-adv/gateway_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <linux/byteorder/generic.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/limits.h>
#include <linux/math64.h>
#include <linux/netdevice.h>
#include <linux/stddef.h>
Expand Down
3 changes: 1 addition & 2 deletions net/batman-adv/gateway_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@

#include "main.h"

#include <linux/netdevice.h>
#include <linux/types.h>

struct net_device;

/**
* enum batadv_bandwidth_units - bandwidth unit types
*/
Expand Down
Loading

0 comments on commit 65dc541

Please sign in to comment.