From: Antonio Quartulli <ordex@autistici.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Subject: [B.A.T.M.A.N.] [PATCH 16/16] batman-adv: add bridge loop avoidance compile option
Date: Thu, 5 Apr 2012 12:39:02 +0200 [thread overview]
Message-ID: <1333622342-6128-17-git-send-email-ordex@autistici.org> (raw)
In-Reply-To: <1333622342-6128-1-git-send-email-ordex@autistici.org>
From: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>
The define CONFIG_BATMAN_ADV_BLA switches the bridge loop avoidance
on - skip it, and the bridge loop avoidance is not compiled in.
This is useful if binary size should be saved or the feature is
not needed.
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
net/batman-adv/Kconfig | 12 +++++++++++-
net/batman-adv/Makefile | 2 +-
net/batman-adv/bat_debugfs.c | 7 ++++++-
net/batman-adv/bat_sysfs.c | 4 ++++
net/batman-adv/bridge_loop_avoidance.h | 15 +++++++++++++++
net/batman-adv/soft-interface.c | 4 ++--
net/batman-adv/types.h | 8 ++++++++
7 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/net/batman-adv/Kconfig b/net/batman-adv/Kconfig
index 6ff977c..53f5244 100644
--- a/net/batman-adv/Kconfig
+++ b/net/batman-adv/Kconfig
@@ -4,7 +4,7 @@
config BATMAN_ADV
tristate "B.A.T.M.A.N. Advanced Meshing Protocol"
- depends on NET && INET
+ depends on NET
select CRC16
default n
help
@@ -14,6 +14,16 @@ config BATMAN_ADV
http://www.open-mesh.org/ for more information and user space
tools.
+config BATMAN_ADV_BLA
+ bool "Bridge Loop Avoidance"
+ depends on BATMAN_ADV && INET
+ default y
+ help
+ This option enables BLA (Bridge Loop Avoidance), a mechanism
+ to avoid Ethernet frames looping when mesh nodes are connected
+ to both the same LAN and the same mesh. If you will never use
+ more than one mesh node in the same LAN, you can safely remove
+ this feature and save some space.
config BATMAN_ADV_DEBUG
bool "B.A.T.M.A.N. debugging"
diff --git a/net/batman-adv/Makefile b/net/batman-adv/Makefile
index 94b67fd..6d5c194 100644
--- a/net/batman-adv/Makefile
+++ b/net/batman-adv/Makefile
@@ -23,7 +23,7 @@ batman-adv-y += bat_debugfs.o
batman-adv-y += bat_iv_ogm.o
batman-adv-y += bat_sysfs.o
batman-adv-y += bitarray.o
-batman-adv-y += bridge_loop_avoidance.o
+batman-adv-$(CONFIG_BATMAN_ADV_BLA) += bridge_loop_avoidance.o
batman-adv-y += gateway_client.o
batman-adv-y += gateway_common.o
batman-adv-y += hard-interface.o
diff --git a/net/batman-adv/bat_debugfs.c b/net/batman-adv/bat_debugfs.c
index 0e35177..916380c 100644
--- a/net/batman-adv/bat_debugfs.c
+++ b/net/batman-adv/bat_debugfs.c
@@ -245,12 +245,13 @@ static int transtable_global_open(struct inode *inode, struct file *file)
return single_open(file, tt_global_seq_print_text, net_dev);
}
+#ifdef CONFIG_BATMAN_ADV_BLA
static int bla_claim_table_open(struct inode *inode, struct file *file)
{
struct net_device *net_dev = (struct net_device *)inode->i_private;
return single_open(file, bla_claim_table_seq_print_text, net_dev);
}
-
+#endif
static int transtable_local_open(struct inode *inode, struct file *file)
{
@@ -285,7 +286,9 @@ static BAT_DEBUGINFO(routing_algos, S_IRUGO, bat_algorithms_open);
static BAT_DEBUGINFO(originators, S_IRUGO, originators_open);
static BAT_DEBUGINFO(gateways, S_IRUGO, gateways_open);
static BAT_DEBUGINFO(transtable_global, S_IRUGO, transtable_global_open);
+#ifdef CONFIG_BATMAN_ADV_BLA
static BAT_DEBUGINFO(bla_claim_table, S_IRUGO, bla_claim_table_open);
+#endif
static BAT_DEBUGINFO(transtable_local, S_IRUGO, transtable_local_open);
static BAT_DEBUGINFO(vis_data, S_IRUGO, vis_data_open);
@@ -293,7 +296,9 @@ static struct bat_debuginfo *mesh_debuginfos[] = {
&bat_debuginfo_originators,
&bat_debuginfo_gateways,
&bat_debuginfo_transtable_global,
+#ifdef CONFIG_BATMAN_ADV_BLA
&bat_debuginfo_bla_claim_table,
+#endif
&bat_debuginfo_transtable_local,
&bat_debuginfo_vis_data,
NULL,
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c
index 824bfe7..c6efd68 100644
--- a/net/batman-adv/bat_sysfs.c
+++ b/net/batman-adv/bat_sysfs.c
@@ -386,7 +386,9 @@ static ssize_t store_gw_bwidth(struct kobject *kobj, struct attribute *attr,
BAT_ATTR_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL);
BAT_ATTR_BOOL(bonding, S_IRUGO | S_IWUSR, NULL);
+#ifdef CONFIG_BATMAN_ADV_BLA
BAT_ATTR_BOOL(bridge_loop_avoidance, S_IRUGO | S_IWUSR, NULL);
+#endif
BAT_ATTR_BOOL(fragmentation, S_IRUGO | S_IWUSR, update_min_mtu);
BAT_ATTR_BOOL(ap_isolation, S_IRUGO | S_IWUSR, NULL);
static BAT_ATTR(vis_mode, S_IRUGO | S_IWUSR, show_vis_mode, store_vis_mode);
@@ -405,7 +407,9 @@ BAT_ATTR_UINT(log_level, S_IRUGO | S_IWUSR, 0, 15, NULL);
static struct bat_attribute *mesh_attrs[] = {
&bat_attr_aggregated_ogms,
&bat_attr_bonding,
+#ifdef CONFIG_BATMAN_ADV_BLA
&bat_attr_bridge_loop_avoidance,
+#endif
&bat_attr_fragmentation,
&bat_attr_ap_isolation,
&bat_attr_vis_mode,
diff --git a/net/batman-adv/bridge_loop_avoidance.h b/net/batman-adv/bridge_loop_avoidance.h
index 9468c24..2758b8c 100644
--- a/net/batman-adv/bridge_loop_avoidance.h
+++ b/net/batman-adv/bridge_loop_avoidance.h
@@ -22,6 +22,7 @@
#ifndef _NET_BATMAN_ADV_BLA_H_
#define _NET_BATMAN_ADV_BLA_H_
+#ifdef CONFIG_BATMAN_ADV_BLA
int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid);
int bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid);
int bla_is_backbone_gw(struct sk_buff *skb,
@@ -37,5 +38,19 @@ int bla_init(struct bat_priv *bat_priv);
void bla_free(struct bat_priv *bat_priv);
#define BLA_CRC_INIT 0
+#else /* ifdef CONFIG_BATMAN_ADV_BLA */
+
+#define bla_rx(...) (0)
+#define bla_tx(...) (0)
+#define bla_is_backbone_gw(...) (0)
+#define bla_claim_table_seq_print_text (0)
+#define bla_is_backbone_gw_orig(...) (0)
+#define bla_check_bcast_duplist(...) (0)
+#define bla_update_orig_address(...) do {} while (0)
+#define bla_init(...) (1)
+#define bla_free(...) do {} while (0)
+
+
+#endif /* ifdef CONFIG_BATMAN_ADV_BLA */
#endif /* ifndef _NET_BATMAN_ADV_BLA_H_ */
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 7585029..e6dbe00 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -133,7 +133,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
uint8_t stp_addr[ETH_ALEN] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x00};
unsigned int header_len = 0;
int data_len = skb->len, ret;
- short vid = -1;
+ short vid __maybe_unused = -1;
bool do_bcast = false;
if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE)
@@ -254,7 +254,7 @@ void interface_rx(struct net_device *soft_iface,
struct bat_priv *bat_priv = netdev_priv(soft_iface);
struct ethhdr *ethhdr;
struct vlan_ethhdr *vhdr;
- short vid = -1;
+ short vid __maybe_unused = -1;
/* check if enough space is available for pulling, and pull */
if (!pskb_may_pull(skb, hdr_size))
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index 7f7f610..a5b1a63 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -140,11 +140,13 @@ struct neigh_node {
spinlock_t tq_lock; /* protects: tq_recv, tq_index */
};
+#ifdef CONFIG_BATMAN_ADV_BLA
struct bcast_duplist_entry {
uint8_t orig[ETH_ALEN];
uint16_t crc;
unsigned long entrytime;
};
+#endif
struct bat_priv {
atomic_t mesh_state;
@@ -186,14 +188,18 @@ struct bat_priv {
struct hashtable_t *orig_hash;
struct hashtable_t *tt_local_hash;
struct hashtable_t *tt_global_hash;
+#ifdef CONFIG_BATMAN_ADV_BLA
struct hashtable_t *claim_hash;
struct hashtable_t *backbone_hash;
+#endif
struct list_head tt_req_list; /* list of pending tt_requests */
struct list_head tt_roam_list;
struct hashtable_t *vis_hash;
+#ifdef CONFIG_BATMAN_ADV_BLA
struct bcast_duplist_entry bcast_duplist[DUPLIST_SIZE];
int bcast_duplist_curr;
struct bla_claim_dst claim_dest;
+#endif
spinlock_t forw_bat_list_lock; /* protects forw_bat_list */
spinlock_t forw_bcast_list_lock; /* protects */
spinlock_t tt_changes_list_lock; /* protects tt_changes */
@@ -261,6 +267,7 @@ struct tt_orig_list_entry {
struct hlist_node list;
};
+#ifdef CONFIG_BATMAN_ADV_BLA
struct backbone_gw {
uint8_t orig[ETH_ALEN];
short vid; /* used VLAN ID */
@@ -282,6 +289,7 @@ struct claim {
atomic_t refcount;
struct hlist_node hash_entry;
};
+#endif
struct tt_change_node {
struct list_head list;
--
1.7.9.4
next prev parent reply other threads:[~2012-04-05 10:39 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-05 10:38 [B.A.T.M.A.N.] pull request: batman-adv 2012-04-05 Antonio Quartulli
2012-04-05 10:38 ` [B.A.T.M.A.N.] [PATCH 01/16] MAINTAINERS: add additional maintainer for net/batman-adv Antonio Quartulli
2012-04-05 10:38 ` [B.A.T.M.A.N.] [PATCH 02/16] batman-adv: clean up Kconfig Antonio Quartulli
2012-04-05 10:38 ` [B.A.T.M.A.N.] [PATCH 03/16] batman-adv: use ETH_ALEN instead of hardcoded numeric constants Antonio Quartulli
2012-04-05 10:38 ` [B.A.T.M.A.N.] [PATCH 04/16] batman-adv: Replace bitarray operations with bitmap Antonio Quartulli
2012-04-05 10:38 ` [B.A.T.M.A.N.] [PATCH 05/16] batman-adv: Remove declaration of only locally used functions Antonio Quartulli
2012-04-05 10:38 ` [B.A.T.M.A.N.] [PATCH 06/16] batman-adv: encourage batman to take shorter routes by changing the default hop penalty Antonio Quartulli
2012-04-05 10:38 ` [B.A.T.M.A.N.] [PATCH 07/16] batman-adv: remove old bridge loop avoidance code Antonio Quartulli
2012-04-05 10:38 ` [B.A.T.M.A.N.] [PATCH 08/16] batman-adv: add basic " Antonio Quartulli
2012-04-05 10:38 ` [B.A.T.M.A.N.] [PATCH 09/16] batman-adv: make bridge loop avoidance switchable Antonio Quartulli
2012-04-05 10:38 ` [B.A.T.M.A.N.] [PATCH 10/16] batman-adv: export claim tables through debugfs Antonio Quartulli
2012-04-05 10:38 ` [B.A.T.M.A.N.] [PATCH 11/16] batman-adv: allow multiple entries in tt_global_entries Antonio Quartulli
2012-04-05 10:38 ` [B.A.T.M.A.N.] [PATCH 12/16] batman-adv: don't let backbone gateways exchange tt entries Antonio Quartulli
2012-04-05 10:38 ` [B.A.T.M.A.N.] [PATCH 13/16] batman-adv: add broadcast duplicate check Antonio Quartulli
2012-04-05 10:39 ` [B.A.T.M.A.N.] [PATCH 14/16] batman-adv: drop STP over batman Antonio Quartulli
2012-04-05 10:39 ` [B.A.T.M.A.N.] [PATCH 15/16] batman-adv: form groups in the bridge loop avoidance Antonio Quartulli
2012-04-05 10:39 ` Antonio Quartulli [this message]
2012-04-05 23:15 ` [B.A.T.M.A.N.] pull request: batman-adv 2012-04-05 David Miller
2012-04-07 18:49 [B.A.T.M.A.N.] pull request: batman-adv 2012-04-07 Antonio Quartulli
2012-04-07 18:49 ` [B.A.T.M.A.N.] [PATCH 16/16] batman-adv: add bridge loop avoidance compile option Antonio Quartulli
2012-04-11 12:50 [B.A.T.M.A.N.] pull request: batman-adv 2012-04-11 Antonio Quartulli
2012-04-11 12:50 ` [B.A.T.M.A.N.] [PATCH 16/16] batman-adv: add bridge loop avoidance compile option Antonio Quartulli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1333622342-6128-17-git-send-email-ordex@autistici.org \
--to=ordex@autistici.org \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=siwu@hrz.tu-chemnitz.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).