Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bonding: add retransmit membership reports tunable

Allow sysadmins to configure the number of multicast
membership report sent on a link failure event.

Signed-off-by: Flavio Leitner <fleitner@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Flavio Leitner and committed by
David S. Miller
c2952c31 e12b4539

+72
+8
Documentation/networking/bonding.txt
··· 765 765 does not exist, and the layer2 policy is the only policy. The 766 766 layer2+3 value was added for bonding version 3.2.2. 767 767 768 + resend_igmp 769 + 770 + Specifies the number of IGMP membership reports to be issued after 771 + a failover event. One membership report is issued immediately after 772 + the failover, subsequent packets are sent in each 200ms interval. 773 + 774 + The valid range is 0 - 255; the default value is 1. This option 775 + was added for bonding version 3.7.0. 768 776 769 777 3. Configuring Bonding Devices 770 778 ==============================
+15
drivers/net/bonding/bond_main.c
··· 109 109 static char *fail_over_mac; 110 110 static int all_slaves_active = 0; 111 111 static struct bond_params bonding_defaults; 112 + static int resend_igmp = BOND_DEFAULT_RESEND_IGMP; 112 113 113 114 module_param(max_bonds, int, 0); 114 115 MODULE_PARM_DESC(max_bonds, "Max number of bonded devices"); ··· 164 163 MODULE_PARM_DESC(all_slaves_active, "Keep all frames received on an interface" 165 164 "by setting active flag for all slaves. " 166 165 "0 for never (default), 1 for always."); 166 + module_param(resend_igmp, int, 0); 167 + MODULE_PARM_DESC(resend_igmp, "Number of IGMP membership reports to send on link failure"); 167 168 168 169 /*----------------------------- Global variables ----------------------------*/ 169 170 ··· 908 905 } 909 906 } 910 907 908 + if (--bond->igmp_retrans > 0) 909 + queue_delayed_work(bond->wq, &bond->mcast_work, HZ/5); 910 + 911 911 read_unlock(&bond->lock); 912 912 } 913 913 ··· 1219 1213 * all were sent on curr_active_slave */ 1220 1214 if ((USES_PRIMARY(bond->params.mode) && new_active) || 1221 1215 bond->params.mode == BOND_MODE_ROUNDROBIN) { 1216 + bond->igmp_retrans = bond->params.resend_igmp; 1222 1217 queue_delayed_work(bond->wq, &bond->mcast_work, 0); 1223 1218 } 1224 1219 } ··· 4940 4933 all_slaves_active = 0; 4941 4934 } 4942 4935 4936 + if (resend_igmp < 0 || resend_igmp > 255) { 4937 + pr_warning("Warning: resend_igmp (%d) should be between " 4938 + "0 and 255, resetting to %d\n", 4939 + resend_igmp, BOND_DEFAULT_RESEND_IGMP); 4940 + resend_igmp = BOND_DEFAULT_RESEND_IGMP; 4941 + } 4942 + 4943 4943 /* reset values for TLB/ALB */ 4944 4944 if ((bond_mode == BOND_MODE_TLB) || 4945 4945 (bond_mode == BOND_MODE_ALB)) { ··· 5119 5105 params->fail_over_mac = fail_over_mac_value; 5120 5106 params->tx_queues = tx_queues; 5121 5107 params->all_slaves_active = all_slaves_active; 5108 + params->resend_igmp = resend_igmp; 5122 5109 5123 5110 if (primary) { 5124 5111 strncpy(params->primary, primary, IFNAMSIZ);
+44
drivers/net/bonding/bond_sysfs.c
··· 1592 1592 static DEVICE_ATTR(all_slaves_active, S_IRUGO | S_IWUSR, 1593 1593 bonding_show_slaves_active, bonding_store_slaves_active); 1594 1594 1595 + /* 1596 + * Show and set the number of IGMP membership reports to send on link failure 1597 + */ 1598 + static ssize_t bonding_show_resend_igmp(struct device *d, 1599 + struct device_attribute *attr, 1600 + char *buf) 1601 + { 1602 + struct bonding *bond = to_bond(d); 1603 + 1604 + return sprintf(buf, "%d\n", bond->params.resend_igmp); 1605 + } 1606 + 1607 + static ssize_t bonding_store_resend_igmp(struct device *d, 1608 + struct device_attribute *attr, 1609 + const char *buf, size_t count) 1610 + { 1611 + int new_value, ret = count; 1612 + struct bonding *bond = to_bond(d); 1613 + 1614 + if (sscanf(buf, "%d", &new_value) != 1) { 1615 + pr_err("%s: no resend_igmp value specified.\n", 1616 + bond->dev->name); 1617 + ret = -EINVAL; 1618 + goto out; 1619 + } 1620 + 1621 + if (new_value < 0) { 1622 + pr_err("%s: Invalid resend_igmp value %d not in range 0-255; rejected.\n", 1623 + bond->dev->name, new_value); 1624 + ret = -EINVAL; 1625 + goto out; 1626 + } 1627 + 1628 + pr_info("%s: Setting resend_igmp to %d.\n", 1629 + bond->dev->name, new_value); 1630 + bond->params.resend_igmp = new_value; 1631 + out: 1632 + return ret; 1633 + } 1634 + 1635 + static DEVICE_ATTR(resend_igmp, S_IRUGO | S_IWUSR, 1636 + bonding_show_resend_igmp, bonding_store_resend_igmp); 1637 + 1595 1638 static struct attribute *per_bond_attrs[] = { 1596 1639 &dev_attr_slaves.attr, 1597 1640 &dev_attr_mode.attr, ··· 1662 1619 &dev_attr_ad_partner_mac.attr, 1663 1620 &dev_attr_queue_id.attr, 1664 1621 &dev_attr_all_slaves_active.attr, 1622 + &dev_attr_resend_igmp.attr, 1665 1623 NULL, 1666 1624 }; 1667 1625
+2
drivers/net/bonding/bonding.h
··· 136 136 __be32 arp_targets[BOND_MAX_ARP_TARGETS]; 137 137 int tx_queues; 138 138 int all_slaves_active; 139 + int resend_igmp; 139 140 }; 140 141 141 142 struct bond_parm_tbl { ··· 203 202 s8 send_grat_arp; 204 203 s8 send_unsol_na; 205 204 s8 setup_by_slave; 205 + s8 igmp_retrans; 206 206 #ifdef CONFIG_PROC_FS 207 207 struct proc_dir_entry *proc_entry; 208 208 char proc_file_name[IFNAMSIZ];
+3
include/linux/if_bonding.h
··· 84 84 #define BOND_DEFAULT_MAX_BONDS 1 /* Default maximum number of devices to support */ 85 85 86 86 #define BOND_DEFAULT_TX_QUEUES 16 /* Default number of tx queues per device */ 87 + 88 + #define BOND_DEFAULT_RESEND_IGMP 1 /* Default number of IGMP membership reports */ 89 + 87 90 /* hashing types */ 88 91 #define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */ 89 92 #define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ (TCP || UDP)) */