Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 206271 Details for
Bug 296531
LTC:38943: 201138: Enhancing the active-backup mode of the Bonding driver.
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
fail_over_mac option for bonding
bonding-fail-over-mac-rhel5.1.patch (text/plain), 10.40 KB, created by
IBM Bug Proxy
on 2007-09-26 00:00:41 UTC
(
hide
)
Description:
fail_over_mac option for bonding
Filename:
MIME Type:
Creator:
IBM Bug Proxy
Created:
2007-09-26 00:00:41 UTC
Size:
10.40 KB
patch
obsolete
>--- linux-2.6.18.i386/drivers/net/bonding/bond_main.c 2007/09/22 00:05:48 1.1 >+++ linux-2.6.18.i386/drivers/net/bonding/bond_main.c 2007/09/22 00:17:07 >@@ -98,6 +98,7 @@ > static int arp_interval = BOND_LINK_ARP_INTERV; > static char *arp_ip_target[BOND_MAX_ARP_TARGETS] = { NULL, }; > static char *arp_validate = NULL; >+static int fail_over_mac = 0; > struct bond_params bonding_defaults; > > module_param(max_bonds, int, 0); >@@ -131,6 +132,9 @@ > MODULE_PARM_DESC(arp_ip_target, "arp targets in n.n.n.n form"); > module_param(arp_validate, charp, 0); > MODULE_PARM_DESC(arp_validate, "validate src/dst of ARP probes: none (default), active, backup or all"); >+module_param(fail_over_mac, int, 0); >+MODULE_PARM_DESC(fail_over_mac, "For active-backup, do not set all slaves to the same MAC. 0 of off (default), 1 for on."); >+ > > /*----------------------------- Global variables ----------------------------*/ > >@@ -1128,7 +1132,20 @@ > if (new_active) { > bond_set_slave_active_flags(new_active); > } >- bond_send_gratuitous_arp(bond); >+ /* when bonding does not set the slave MAC address, the bond MAC >+ * address is the one of the active slave. >+ */ >+ if (new_active && bond->params.fail_over_mac) >+ memcpy(bond->dev->dev_addr, new_active->dev->dev_addr, >+ new_active->dev->addr_len); >+ if (bond->curr_active_slave && >+ test_bit(__LINK_STATE_LINKWATCH_PENDING, >+ &bond->curr_active_slave->dev->state)) { >+ dprintk("delaying gratuitous arp on %s\n", >+ bond->curr_active_slave->dev->name); >+ bond->send_grat_arp = 1; >+ } else >+ bond_send_gratuitous_arp(bond); > } > } > >@@ -1386,16 +1403,18 @@ > */ > memcpy(new_slave->perm_hwaddr, slave_dev->dev_addr, ETH_ALEN); > >- /* >- * Set slave to master's mac address. The application already >- * set the master's mac address to that of the first slave >- */ >- memcpy(addr.sa_data, bond_dev->dev_addr, bond_dev->addr_len); >- addr.sa_family = slave_dev->type; >- res = dev_set_mac_address(slave_dev, &addr); >- if (res) { >- dprintk("Error %d calling set_mac_address\n", res); >- goto err_free; >+ if (!bond->params.fail_over_mac) { >+ /* >+ * Set slave to master's mac address. The application already >+ * set the master's mac address to that of the first slave >+ */ >+ memcpy(addr.sa_data, bond_dev->dev_addr, bond_dev->addr_len); >+ addr.sa_family = slave_dev->type; >+ res = dev_set_mac_address(slave_dev, &addr); >+ if (res) { >+ dprintk("Error %d calling set_mac_address\n", res); >+ goto err_free; >+ } > } > > /* open the slave since the application closed it */ >@@ -1621,9 +1640,11 @@ > dev_close(slave_dev); > > err_restore_mac: >- memcpy(addr.sa_data, new_slave->perm_hwaddr, ETH_ALEN); >- addr.sa_family = slave_dev->type; >- dev_set_mac_address(slave_dev, &addr); >+ if (!bond->params.fail_over_mac) { >+ memcpy(addr.sa_data, new_slave->perm_hwaddr, ETH_ALEN); >+ addr.sa_family = slave_dev->type; >+ dev_set_mac_address(slave_dev, &addr); >+ } > > err_free: > kfree(new_slave); >@@ -1815,10 +1836,12 @@ > /* close slave before restoring its mac address */ > dev_close(slave_dev); > >- /* restore original ("permanent") mac address */ >- memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN); >- addr.sa_family = slave_dev->type; >- dev_set_mac_address(slave_dev, &addr); >+ if (!bond->params.fail_over_mac) { >+ /* restore original ("permanent") mac address */ >+ memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN); >+ addr.sa_family = slave_dev->type; >+ dev_set_mac_address(slave_dev, &addr); >+ } > > slave_dev->priv_flags &= ~(IFF_MASTER_8023AD | IFF_MASTER_ALB | > IFF_SLAVE_INACTIVE | IFF_BONDING | >@@ -1905,10 +1928,12 @@ > /* close slave before restoring its mac address */ > dev_close(slave_dev); > >- /* restore original ("permanent") mac address*/ >- memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN); >- addr.sa_family = slave_dev->type; >- dev_set_mac_address(slave_dev, &addr); >+ if (!bond->params.fail_over_mac) { >+ /* restore original ("permanent") mac address*/ >+ memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN); >+ addr.sa_family = slave_dev->type; >+ dev_set_mac_address(slave_dev, &addr); >+ } > > slave_dev->priv_flags &= ~(IFF_MASTER_8023AD | IFF_MASTER_ALB | > IFF_SLAVE_INACTIVE); >@@ -2110,6 +2135,18 @@ > * program could monitor the link itself if needed. > */ > >+ if (bond->send_grat_arp) { >+ if (bond->curr_active_slave && test_bit(__LINK_STATE_LINKWATCH_PENDING, >+ &bond->curr_active_slave->dev->state)) >+ dprintk("Needs to send gratuitous arp but not yet\n"); >+ else { >+ dprintk("sending delayed gratuitous arp on on %s\n", >+ bond->curr_active_slave->dev->name); >+ bond_send_gratuitous_arp(bond); >+ bond->send_grat_arp = 0; >+ } >+ } >+ > read_lock(&bond->curr_slave_lock); > oldcurrent = bond->curr_active_slave; > read_unlock(&bond->curr_slave_lock); >@@ -3086,9 +3123,15 @@ > curr = bond->curr_active_slave; > read_unlock(&bond->curr_slave_lock); > >- seq_printf(seq, "Bonding Mode: %s\n", >+ seq_printf(seq, "Bonding Mode: %s", > bond_mode_name(bond->params.mode)); > >+ if (bond->params.mode == BOND_MODE_ACTIVEBACKUP && >+ bond->params.fail_over_mac) >+ seq_printf(seq, " (fail_over_mac)"); >+ >+ seq_printf(seq, "\n"); >+ > if (bond->params.mode == BOND_MODE_XOR || > bond->params.mode == BOND_MODE_8023AD) { > seq_printf(seq, "Transmit Hash Policy: %s (%d)\n", >@@ -4007,6 +4050,13 @@ > > dprintk("bond=%p, name=%s\n", bond, (bond_dev ? bond_dev->name : "None")); > >+ /* >+ * If fail_over_mac is enabled, do nothing and return success. >+ * Returning an error causes ifenslave to fail. >+ */ >+ if (bond->params.fail_over_mac) >+ return 0; >+ > if (!is_valid_ether_addr(sa->sa_data)) { > return -EADDRNOTAVAIL; > } >@@ -4732,6 +4782,11 @@ > primary = NULL; > } > >+ if (fail_over_mac && (bond_mode != BOND_MODE_ACTIVEBACKUP)) >+ printk(KERN_WARNING DRV_NAME >+ ": Warning: fail_over_mac only affects " >+ "active-backup mode.\n"); >+ > /* fill params struct with the proper values */ > params->mode = bond_mode; > params->xmit_policy = xmit_hashtype; >@@ -4743,6 +4798,7 @@ > params->use_carrier = use_carrier; > params->lacp_fast = lacp_fast; > params->primary[0] = 0; >+ params->fail_over_mac = fail_over_mac; > > if (primary) { > strncpy(params->primary, primary, IFNAMSIZ); >--- linux-2.6.18.i386/drivers/net/bonding/bond_sysfs.c 2007/09/22 00:05:48 1.1 >+++ linux-2.6.18.i386/drivers/net/bonding/bond_sysfs.c 2007/09/25 21:24:53 >@@ -551,6 +551,54 @@ > static CLASS_DEVICE_ATTR(arp_validate, S_IRUGO | S_IWUSR, bonding_show_arp_validate, bonding_store_arp_validate); > > /* >+ * Show and store fail_over_mac. User only allowed to change the >+ * value when there are no slaves. >+ */ >+static ssize_t bonding_show_fail_over_mac(struct class_device *cd, char *buf) >+{ >+ struct bonding *bond = to_bond(cd); >+ >+ return sprintf(buf, "%d\n", bond->params.fail_over_mac) + 1; >+} >+ >+static ssize_t bonding_store_fail_over_mac(struct class_device *cd, const char *buf, size_t count) >+{ >+ int new_value; >+ int ret = count; >+ struct bonding *bond = to_bond(cd); >+ >+ if (bond->slave_cnt != 0) { >+ printk(KERN_ERR DRV_NAME >+ ": %s: Can't alter fail_over_mac with slaves in bond.\n", >+ bond->dev->name); >+ ret = -EPERM; >+ goto out; >+ } >+ >+ if (sscanf(buf, "%d", &new_value) != 1) { >+ printk(KERN_ERR DRV_NAME >+ ": %s: no fail_over_mac value specified.\n", >+ bond->dev->name); >+ ret = -EINVAL; >+ goto out; >+ } >+ >+ if ((new_value == 0) || (new_value == 1)) { >+ bond->params.fail_over_mac = new_value; >+ printk(KERN_INFO DRV_NAME ": %s: Setting fail_over_mac to %d.\n", >+ bond->dev->name, new_value); >+ } else { >+ printk(KERN_INFO DRV_NAME >+ ": %s: Ignoring invalid fail_over_mac value %d.\n", >+ bond->dev->name, new_value); >+ } >+out: >+ return ret; >+} >+ >+static CLASS_DEVICE_ATTR(fail_over_mac, S_IRUGO | S_IWUSR, bonding_show_fail_over_mac, bonding_store_fail_over_mac); >+ >+/* > * Show and set the arp timer interval. There are two tricky bits > * here. First, if ARP monitoring is activated, then we must disable > * MII monitoring. Second, if the ARP timer isn't running, we must >@@ -1320,6 +1368,7 @@ > static struct attribute *per_bond_attrs[] = { > &class_device_attr_slaves.attr, > &class_device_attr_mode.attr, >+ &class_device_attr_fail_over_mac.attr, > &class_device_attr_arp_validate.attr, > &class_device_attr_arp_interval.attr, > &class_device_attr_arp_ip_target.attr, >--- linux-2.6.18.i386/drivers/net/bonding/bonding.h 2007/09/22 00:05:48 1.1 >+++ linux-2.6.18.i386/drivers/net/bonding/bonding.h 2007/09/25 19:47:32 >@@ -128,6 +128,7 @@ > int arp_interval; > int arp_validate; > int use_carrier; >+ int fail_over_mac; > int updelay; > int downdelay; > int lacp_fast; >@@ -183,6 +184,7 @@ > rwlock_t lock; > rwlock_t curr_slave_lock; > s8 kill_timers; >+ s8 send_grat_arp; > u16 rr_tx_counter; > struct net_device_stats stats; > #ifdef CONFIG_PROC_FS >--- linux-2.6.18.i386/Documentation/networking/bonding.txt.orig 2006-09-19 20:42:06.000000000 -0700 >+++ linux-2.6.18.i386/Documentation/networking/bonding.txt 2007-09-25 14:17:36.000000000 -0700 >@@ -222,6 +222,39 @@ > will be rounded down to the nearest multiple. The default > value is 0. > >+fail_over_mac >+ >+ Specifies whether active-backup mode should set all slaves to >+ the same MAC address (the traditional behavior), or, when >+ enabled, change the bond's MAC address when changing the >+ active interface (i.e., fail over the MAC address itself). >+ >+ Fail over MAC is useful for devices that cannot ever alter >+ their MAC address, or for devices that refuse incoming >+ broadcasts with their own source MAC (which interferes with >+ the ARP monitor). >+ >+ The down side of fail over MAC is that every device on the >+ network must be updated via gratuitous ARP, vs. just updating >+ a switch or set of switches (which often takes place for any >+ traffic, not just ARP traffic, if the switch snoops incoming >+ traffic to update its tables) for the traditional method. If >+ the gratuitous ARP is lost, communication may be disrupted. >+ >+ When fail over MAC is used in conjuction with the mii monitor, >+ devices which assert link up prior to being able to actually >+ transmit and receive are particularly susecptible to loss of >+ the gratuitous ARP, and an appropriate updelay setting may be >+ required. >+ >+ A value of 0 disables fail over MAC, and is the default. A >+ value of 1 enables fail over MAC. This option is enabled >+ automatically if the first slave added cannot change its MAC >+ address. This option may be modified via sysfs only when no >+ slaves are present in the bond. >+ >+ > lacp_rate > > Option specifying the rate in which we'll ask our link partner
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 296531
: 206271 |
210891