Commit de631a00 authored by Shmulik Hen's avatar Shmulik Hen Committed by Jeff Garzik

[PATCH] bonding cleanup 2.6 - Remove multicast_mode module param

Eliminate the multicast_mode module param. Settings are now done only
according to mode.
parent 4b949deb
...@@ -368,20 +368,6 @@ mode ...@@ -368,20 +368,6 @@ mode
fails it's hw address is swapped with the new current_slave fails it's hw address is swapped with the new current_slave
that was chosen. that was chosen.
multicast
Option specifying the mode of operation for multicast support.
Possible values are:
disabled or 0
Disabled (no multicast support)
active or 1
Enabled on active slave only, useful in active-backup mode
all or 2
Enabled on all slaves, this is the default
primary primary
A string (eth0, eth2, etc) to equate to a primary device. If this A string (eth0, eth2, etc) to equate to a primary device. If this
......
...@@ -537,16 +537,6 @@ static struct bond_parm_tbl bond_mode_tbl[] = { ...@@ -537,16 +537,6 @@ static struct bond_parm_tbl bond_mode_tbl[] = {
{ NULL, -1}, { NULL, -1},
}; };
static int multicast_mode = BOND_MULTICAST_ALL;
static char *multicast = NULL;
static struct bond_parm_tbl bond_mc_tbl[] = {
{ "disabled", BOND_MULTICAST_DISABLED},
{ "active", BOND_MULTICAST_ACTIVE},
{ "all", BOND_MULTICAST_ALL},
{ NULL, -1},
};
static int lacp_fast = 0; static int lacp_fast = 0;
static char *lacp_rate = NULL; static char *lacp_rate = NULL;
...@@ -579,8 +569,6 @@ MODULE_PARM(downdelay, "i"); ...@@ -579,8 +569,6 @@ MODULE_PARM(downdelay, "i");
MODULE_PARM_DESC(downdelay, "Delay before considering link down, in milliseconds"); MODULE_PARM_DESC(downdelay, "Delay before considering link down, in milliseconds");
MODULE_PARM(primary, "s"); MODULE_PARM(primary, "s");
MODULE_PARM_DESC(primary, "Primary network device to use"); MODULE_PARM_DESC(primary, "Primary network device to use");
MODULE_PARM(multicast, "s");
MODULE_PARM_DESC(multicast, "Mode for multicast support : 0 for none, 1 for active slave, 2 for all slaves (default)");
MODULE_PARM(lacp_rate, "s"); MODULE_PARM(lacp_rate, "s");
MODULE_PARM_DESC(lacp_rate, "LACPDU tx rate to request from 802.3ad partner (slow/fast)"); MODULE_PARM_DESC(lacp_rate, "LACPDU tx rate to request from 802.3ad partner (slow/fast)");
...@@ -644,21 +632,6 @@ bond_mode_name(void) ...@@ -644,21 +632,6 @@ bond_mode_name(void)
} }
} }
static const char *
multicast_mode_name(void)
{
switch(multicast_mode) {
case BOND_MULTICAST_DISABLED :
return "disabled";
case BOND_MULTICAST_ACTIVE :
return "active slave only";
case BOND_MULTICAST_ALL :
return "all slaves";
default :
return "unknown";
}
}
void bond_set_slave_inactive_flags(struct slave *slave) void bond_set_slave_inactive_flags(struct slave *slave)
{ {
slave->state = BOND_STATE_BACKUP; slave->state = BOND_STATE_BACKUP;
...@@ -1080,44 +1053,36 @@ static void bond_mc_list_destroy(struct bonding *bond) ...@@ -1080,44 +1053,36 @@ static void bond_mc_list_destroy(struct bonding *bond)
} }
/* /*
* Add a Multicast address to every slave in the bonding group * Add a Multicast address to slaves
* according to mode
*/ */
static void bond_mc_add(struct bonding *bond, void *addr, int alen) static void bond_mc_add(struct bonding *bond, void *addr, int alen)
{ {
struct slave *slave; if (USES_PRIMARY(bond_mode)) {
switch (multicast_mode) {
case BOND_MULTICAST_ACTIVE :
/* write lock already acquired */ /* write lock already acquired */
if (bond->current_slave != NULL) if (bond->current_slave != NULL)
dev_mc_add(bond->current_slave->dev, addr, alen, 0); dev_mc_add(bond->current_slave->dev, addr, alen, 0);
break; } else {
case BOND_MULTICAST_ALL : struct slave *slave;
for (slave = bond->prev; slave != (struct slave *)bond; slave = slave->prev) for (slave = bond->prev; slave != (struct slave *)bond; slave = slave->prev)
dev_mc_add(slave->dev, addr, alen, 0); dev_mc_add(slave->dev, addr, alen, 0);
break;
case BOND_MULTICAST_DISABLED :
break;
} }
} }
/* /*
* Remove a multicast address from every slave in the bonding group * Remove a multicast address from slave
* according to mode
*/ */
static void bond_mc_delete(struct bonding *bond, void *addr, int alen) static void bond_mc_delete(struct bonding *bond, void *addr, int alen)
{ {
struct slave *slave; if (USES_PRIMARY(bond_mode)) {
switch (multicast_mode) {
case BOND_MULTICAST_ACTIVE :
/* write lock already acquired */ /* write lock already acquired */
if (bond->current_slave != NULL) if (bond->current_slave != NULL)
dev_mc_delete(bond->current_slave->dev, addr, alen, 0); dev_mc_delete(bond->current_slave->dev, addr, alen, 0);
break; } else {
case BOND_MULTICAST_ALL : struct slave *slave;
for (slave = bond->prev; slave != (struct slave *)bond; slave = slave->prev) for (slave = bond->prev; slave != (struct slave *)bond; slave = slave->prev)
dev_mc_delete(slave->dev, addr, alen, 0); dev_mc_delete(slave->dev, addr, alen, 0);
break;
case BOND_MULTICAST_DISABLED :
break;
} }
} }
...@@ -1161,14 +1126,14 @@ static inline int dmi_same(struct dev_mc_list *dmi1, struct dev_mc_list *dmi2) ...@@ -1161,14 +1126,14 @@ static inline int dmi_same(struct dev_mc_list *dmi1, struct dev_mc_list *dmi2)
*/ */
static void bond_set_promiscuity(struct bonding *bond, int inc) static void bond_set_promiscuity(struct bonding *bond, int inc)
{ {
struct slave *slave;
if (USES_PRIMARY(bond_mode)) { if (USES_PRIMARY(bond_mode)) {
/* write lock already acquired */
if (bond->current_slave) { if (bond->current_slave) {
dev_set_promiscuity(bond->current_slave->dev, inc); dev_set_promiscuity(bond->current_slave->dev, inc);
} }
} else { } else {
struct slave *slave;
for (slave = bond->prev; slave != (struct slave *)bond; for (slave = bond->prev; slave != (struct slave *)bond;
slave = slave->prev) { slave = slave->prev) {
dev_set_promiscuity(slave->dev, inc); dev_set_promiscuity(slave->dev, inc);
...@@ -1181,19 +1146,14 @@ static void bond_set_promiscuity(struct bonding *bond, int inc) ...@@ -1181,19 +1146,14 @@ static void bond_set_promiscuity(struct bonding *bond, int inc)
*/ */
static void bond_set_allmulti(struct bonding *bond, int inc) static void bond_set_allmulti(struct bonding *bond, int inc)
{ {
struct slave *slave; if (USES_PRIMARY(bond_mode)) {
switch (multicast_mode) {
case BOND_MULTICAST_ACTIVE :
/* write lock already acquired */ /* write lock already acquired */
if (bond->current_slave != NULL) if (bond->current_slave != NULL)
dev_set_allmulti(bond->current_slave->dev, inc); dev_set_allmulti(bond->current_slave->dev, inc);
break; } else {
case BOND_MULTICAST_ALL : struct slave *slave;
for (slave = bond->prev; slave != (struct slave *)bond; slave = slave->prev) for (slave = bond->prev; slave != (struct slave *)bond; slave = slave->prev)
dev_set_allmulti(slave->dev, inc); dev_set_allmulti(slave->dev, inc);
break;
case BOND_MULTICAST_DISABLED :
break;
} }
} }
...@@ -1229,12 +1189,6 @@ static void set_multicast_list(struct net_device *master) ...@@ -1229,12 +1189,6 @@ static void set_multicast_list(struct net_device *master)
if ( !(master->flags & IFF_PROMISC) && (bond->flags & IFF_PROMISC) ) if ( !(master->flags & IFF_PROMISC) && (bond->flags & IFF_PROMISC) )
bond_set_promiscuity(bond, -1); bond_set_promiscuity(bond, -1);
if (multicast_mode == BOND_MULTICAST_DISABLED) {
bond->flags = master->flags;
write_unlock_bh(&bond->lock);
return;
}
/* set allmulti flag to slaves */ /* set allmulti flag to slaves */
if ( (master->flags & IFF_ALLMULTI) && !(bond->flags & IFF_ALLMULTI) ) if ( (master->flags & IFF_ALLMULTI) && !(bond->flags & IFF_ALLMULTI) )
bond_set_allmulti(bond, 1); bond_set_allmulti(bond, 1);
...@@ -1273,39 +1227,35 @@ static void bond_mc_update(struct bonding *bond, struct slave *new, struct slave ...@@ -1273,39 +1227,35 @@ static void bond_mc_update(struct bonding *bond, struct slave *new, struct slave
{ {
struct dev_mc_list *dmi; struct dev_mc_list *dmi;
if (USES_PRIMARY(bond_mode)) { if (!USES_PRIMARY(bond_mode)) {
/* nothing to do - mc list is already up-to-date on
* all slaves
*/
return;
}
if (old) {
if (bond->device->flags & IFF_PROMISC) { if (bond->device->flags & IFF_PROMISC) {
if (old)
dev_set_promiscuity(old->dev, -1); dev_set_promiscuity(old->dev, -1);
if (new)
dev_set_promiscuity(new->dev, 1);
}
} }
switch(multicast_mode) {
case BOND_MULTICAST_ACTIVE :
if (bond->device->flags & IFF_ALLMULTI) { if (bond->device->flags & IFF_ALLMULTI) {
if (old)
dev_set_allmulti(old->dev, -1); dev_set_allmulti(old->dev, -1);
if (new)
dev_set_allmulti(new->dev, 1);
} }
/* first remove all mc addresses from old slave if any, for (dmi = bond->device->mc_list; dmi != NULL; dmi = dmi->next) {
and _then_ add them to new active slave */
if (old) {
for (dmi = bond->device->mc_list; dmi != NULL; dmi = dmi->next)
dev_mc_delete(old->dev, dmi->dmi_addr, dmi->dmi_addrlen, 0); dev_mc_delete(old->dev, dmi->dmi_addr, dmi->dmi_addrlen, 0);
} }
}
if (new) { if (new) {
for (dmi = bond->device->mc_list; dmi != NULL; dmi = dmi->next) if (bond->device->flags & IFF_PROMISC) {
dev_set_promiscuity(new->dev, 1);
}
if (bond->device->flags & IFF_ALLMULTI) {
dev_set_allmulti(new->dev, 1);
}
for (dmi = bond->device->mc_list; dmi != NULL; dmi = dmi->next) {
dev_mc_add(new->dev, dmi->dmi_addr, dmi->dmi_addrlen, 0); dev_mc_add(new->dev, dmi->dmi_addr, dmi->dmi_addrlen, 0);
} }
break;
case BOND_MULTICAST_ALL :
/* nothing to do: mc list is already up-to-date on all slaves */
break;
case BOND_MULTICAST_DISABLED :
break;
} }
} }
...@@ -1444,19 +1394,16 @@ static int bond_enslave(struct net_device *master_dev, ...@@ -1444,19 +1394,16 @@ static int bond_enslave(struct net_device *master_dev,
} }
} }
/* set promiscuity level to new slave */
if (master_dev->flags & IFF_PROMISC) {
/* If the mode USES_PRIMARY, then the new slave gets the /* If the mode USES_PRIMARY, then the new slave gets the
* master's promisc (and mc) settings only if it becomes the * master's promisc (and mc) settings only if it becomes the
* current_slave, and that is taken care of later when calling * current_slave, and that is taken care of later when calling
* bond_change_active() * bond_change_active()
*/ */
if (!USES_PRIMARY(bond_mode)) { if (!USES_PRIMARY(bond_mode)) {
/* set promiscuity level to new slave */
if (master_dev->flags & IFF_PROMISC) {
dev_set_promiscuity(slave_dev, 1); dev_set_promiscuity(slave_dev, 1);
} }
}
if (multicast_mode == BOND_MULTICAST_ALL) {
/* set allmulti level to new slave */ /* set allmulti level to new slave */
if (master_dev->flags & IFF_ALLMULTI) if (master_dev->flags & IFF_ALLMULTI)
dev_set_allmulti(slave_dev, 1); dev_set_allmulti(slave_dev, 1);
...@@ -2006,25 +1953,21 @@ static int bond_release(struct net_device *master, struct net_device *slave) ...@@ -2006,25 +1953,21 @@ static int bond_release(struct net_device *master, struct net_device *slave)
return -EINVAL; return -EINVAL;
} }
/* unset promiscuity level from slave */
if (master->flags & IFF_PROMISC) {
/* If the mode USES_PRIMARY, then we should only remove its /* If the mode USES_PRIMARY, then we should only remove its
* promisc settings if it was the current_slave, but that was * promisc and mc settings if it was the current_slave, but that was
* already taken care of above when we detached the slave * already taken care of above when we detached the slave
*/ */
if (!USES_PRIMARY(bond_mode)) { if (!USES_PRIMARY(bond_mode)) {
/* unset promiscuity level from slave */
if (master->flags & IFF_PROMISC) {
dev_set_promiscuity(slave, -1); dev_set_promiscuity(slave, -1);
} }
}
/* undo settings and restore original values */
if (multicast_mode == BOND_MULTICAST_ALL) {
/* flush master's mc_list from slave */
bond_mc_list_flush (slave, master);
/* unset allmulti level from slave */ /* unset allmulti level from slave */
if (master->flags & IFF_ALLMULTI) if (master->flags & IFF_ALLMULTI)
dev_set_allmulti(slave, -1); dev_set_allmulti(slave, -1);
/* flush master's mc_list from slave */
bond_mc_list_flush (slave, master);
} }
netdev_set_master(slave, NULL); netdev_set_master(slave, NULL);
...@@ -2107,20 +2050,21 @@ static int bond_release_all(struct net_device *master) ...@@ -2107,20 +2050,21 @@ static int bond_release_all(struct net_device *master)
*/ */
write_unlock_bh(&bond->lock); write_unlock_bh(&bond->lock);
/* If the mode USES_PRIMARY, then we should only remove its
* promisc and mc settings if it was the current_slave, but that was
* already taken care of above when we detached the slave
*/
if (!USES_PRIMARY(bond_mode)) {
/* unset promiscuity level from slave */ /* unset promiscuity level from slave */
if (master->flags & IFF_PROMISC) { if (master->flags & IFF_PROMISC) {
if (!USES_PRIMARY(bond_mode)) {
dev_set_promiscuity(slave_dev, -1); dev_set_promiscuity(slave_dev, -1);
} }
}
if (multicast_mode == BOND_MULTICAST_ALL) {
/* flush master's mc_list from slave */
bond_mc_list_flush (slave_dev, master);
/* unset allmulti level from slave */ /* unset allmulti level from slave */
if (master->flags & IFF_ALLMULTI) if (master->flags & IFF_ALLMULTI)
dev_set_allmulti(slave_dev, -1); dev_set_allmulti(slave_dev, -1);
/* flush master's mc_list from slave */
bond_mc_list_flush (slave_dev, master);
} }
netdev_set_master(slave_dev, NULL); netdev_set_master(slave_dev, NULL);
...@@ -3343,7 +3287,6 @@ static void bond_info_show_master(struct seq_file *seq, struct bonding *bond) ...@@ -3343,7 +3287,6 @@ static void bond_info_show_master(struct seq_file *seq, struct bonding *bond)
seq_printf(seq, "MII Polling Interval (ms): %d\n", miimon); seq_printf(seq, "MII Polling Interval (ms): %d\n", miimon);
seq_printf(seq, "Up Delay (ms): %d\n", updelay * miimon); seq_printf(seq, "Up Delay (ms): %d\n", updelay * miimon);
seq_printf(seq, "Down Delay (ms): %d\n", downdelay * miimon); seq_printf(seq, "Down Delay (ms): %d\n", downdelay * miimon);
seq_printf(seq, "Multicast Mode: %s\n", multicast_mode_name());
if (bond_mode == BOND_MODE_8023AD) { if (bond_mode == BOND_MODE_8023AD) {
struct ad_info ad_info; struct ad_info ad_info;
...@@ -3942,22 +3885,6 @@ static int bond_check_params(void) ...@@ -3942,22 +3885,6 @@ static int bond_check_params(void)
} }
} }
if (USES_PRIMARY(bond_mode)) {
multicast_mode = BOND_MULTICAST_ACTIVE;
} else {
multicast_mode = BOND_MULTICAST_ALL;
}
if (multicast) {
multicast_mode = bond_parse_parm(multicast, bond_mc_tbl);
if (multicast_mode == -1) {
printk(KERN_ERR DRV_NAME
": Error: Invalid multicast mode \"%s\"\n",
multicast == NULL ? "NULL" : multicast);
return -EINVAL;
}
}
if (lacp_rate) { if (lacp_rate) {
if (bond_mode != BOND_MODE_8023AD) { if (bond_mode != BOND_MODE_8023AD) {
printk(KERN_INFO DRV_NAME printk(KERN_INFO DRV_NAME
...@@ -4026,14 +3953,6 @@ static int bond_check_params(void) ...@@ -4026,14 +3953,6 @@ static int bond_check_params(void)
printk(KERN_WARNING "Forcing miimon to 100msec\n"); printk(KERN_WARNING "Forcing miimon to 100msec\n");
miimon = 100; miimon = 100;
} }
if (multicast_mode != BOND_MULTICAST_ALL) {
printk(KERN_WARNING DRV_NAME
": Warning: Multicast mode must be set to ALL "
"for 802.3ad\n");
printk(KERN_WARNING "Forcing Multicast mode to ALL\n");
multicast_mode = BOND_MULTICAST_ALL;
}
} }
/* reset values for TLB/ALB */ /* reset values for TLB/ALB */
...@@ -4048,15 +3967,6 @@ static int bond_check_params(void) ...@@ -4048,15 +3967,6 @@ static int bond_check_params(void)
printk(KERN_WARNING "Forcing miimon to 100msec\n"); printk(KERN_WARNING "Forcing miimon to 100msec\n");
miimon = 100; miimon = 100;
} }
if (multicast_mode != BOND_MULTICAST_ACTIVE) {
printk(KERN_WARNING DRV_NAME
": Warning: Multicast mode must be set to "
"ACTIVE for TLB/ALB\n");
printk(KERN_WARNING "Forcing Multicast mode to "
"ACTIVE\n");
multicast_mode = BOND_MULTICAST_ACTIVE;
}
} }
if (bond_mode == BOND_MODE_ALB) { if (bond_mode == BOND_MODE_ALB) {
......
...@@ -77,10 +77,6 @@ ...@@ -77,10 +77,6 @@
#define BOND_DEFAULT_MAX_BONDS 1 /* Default maximum number of devices to support */ #define BOND_DEFAULT_MAX_BONDS 1 /* Default maximum number of devices to support */
#define BOND_MULTICAST_DISABLED 0
#define BOND_MULTICAST_ACTIVE 1
#define BOND_MULTICAST_ALL 2
typedef struct ifbond { typedef struct ifbond {
__s32 bond_mode; __s32 bond_mode;
__s32 num_slaves; __s32 num_slaves;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment