[08/12] batman-adv: Add sysfs option for enabling redundant bonding mode

Message ID 1299086321-25116-9-git-send-email-linus.luessing@ascom.ch (mailing list archive)
State Rejected, archived
Headers

Commit Message

Linus Lüssing March 2, 2011, 5:18 p.m. UTC
  When bonding is enabled, then enabling red_bonding too changes the
behavior from throughput bonding (round robin sending on interfaces) to
redundant bonding (sending every packet on all interfaces available for
bonding).

Signed-off-by: Linus Lüssing <linus.luessing@ascom.ch>
---
 bat_sysfs.c      |   10 ++++++++++
 soft-interface.c |    1 +
 types.h          |    1 +
 3 files changed, 12 insertions(+), 0 deletions(-)
  

Comments

Marek Lindner March 3, 2011, 2:01 a.m. UTC | #1
On Wednesday 02 March 2011 18:18:37 Linus Lüssing wrote:
> When bonding is enabled, then enabling red_bonding too changes the
> behavior from throughput bonding (round robin sending on interfaces) to
> redundant bonding (sending every packet on all interfaces available for
> bonding).

Why not making redundant bonding a sysfs variant of bonding ? You wrote 
yourself: "Also make sure to activate general bonding for redundant bonding to 
take effect". Having an extra option does not seem to make much sense ?!

Cheers,
Marek
  

Patch

diff --git a/bat_sysfs.c b/bat_sysfs.c
index e449bf6..3b8cf26 100644
--- a/bat_sysfs.c
+++ b/bat_sysfs.c
@@ -356,8 +356,17 @@  static ssize_t store_gw_bwidth(struct kobject *kobj, struct attribute *attr,
 	return gw_bandwidth_set(net_dev, buff, count);
 }
 
+static void print_bonding_notice(struct net_device *net_dev)
+{
+	bat_info(net_dev, "Redundant Bonding mode is currently not compatible "
+			"with batman-adv's link layer fragmentation and will "
+			"be ignored. Also make sure to activate general "
+			"bonding for redundant bonding to take effect.\n");
+}
+
 BAT_ATTR_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL);
 BAT_ATTR_BOOL(bonding, S_IRUGO | S_IWUSR, NULL);
+BAT_ATTR_BOOL(red_bonding, S_IRUGO | S_IWUSR, print_bonding_notice);
 BAT_ATTR_BOOL(fragmentation, S_IRUGO | S_IWUSR, update_min_mtu);
 static BAT_ATTR(vis_mode, S_IRUGO | S_IWUSR, show_vis_mode, store_vis_mode);
 static BAT_ATTR(gw_mode, S_IRUGO | S_IWUSR, show_gw_mode, store_gw_mode);
@@ -374,6 +383,7 @@  BAT_ATTR_UINT(log_level, S_IRUGO | S_IWUSR, 0, 3, NULL);
 static struct bat_attribute *mesh_attrs[] = {
 	&bat_attr_aggregated_ogms,
 	&bat_attr_bonding,
+	&bat_attr_red_bonding,
 	&bat_attr_fragmentation,
 	&bat_attr_vis_mode,
 	&bat_attr_gw_mode,
diff --git a/soft-interface.c b/soft-interface.c
index 8224fdc..7f0e768 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -571,6 +571,7 @@  struct net_device *softif_create(char *name)
 
 	atomic_set(&bat_priv->aggregated_ogms, 1);
 	atomic_set(&bat_priv->bonding, 0);
+	atomic_set(&bat_priv->red_bonding, 0);
 	atomic_set(&bat_priv->vis_mode, VIS_TYPE_CLIENT_UPDATE);
 	atomic_set(&bat_priv->gw_mode, GW_MODE_OFF);
 	atomic_set(&bat_priv->gw_sel_class, 20);
diff --git a/types.h b/types.h
index 83445cf..0ce4b99 100644
--- a/types.h
+++ b/types.h
@@ -133,6 +133,7 @@  struct bat_priv {
 	struct net_device_stats stats;
 	atomic_t aggregated_ogms;	/* boolean */
 	atomic_t bonding;		/* boolean */
+	atomic_t red_bonding;		/* boolean */
 	atomic_t fragmentation;		/* boolean */
 	atomic_t vis_mode;		/* VIS_TYPE_* */
 	atomic_t gw_mode;		/* GW_MODE_* */