chiark / gitweb /
networkd: add support for bond options
authorSusant Sahani <susant@redhat.com>
Mon, 21 Jul 2014 13:44:48 +0000 (19:14 +0530)
committerTom Gundersen <teg@jklm.no>
Mon, 21 Jul 2014 18:35:21 +0000 (20:35 +0200)
The following bond options are supported by this patch.

MIIMonitorSec:
Specifies the frequency in milli-seconds that MII link
monitoring will occur.

UpDelaySec:
Specifies the delay time in milli-seconds to enable a link
after a link up status has been detected.

DownDelaySec:
Specifies the delay time in milli-seconds to disable a link
after a link failure has been detected.

changes:
1. Added gconf variables.
2. man page

conf:

[NetDev]
Name=bond1
Kind=bond

[Bond]
Mode=802.3ad
TransmitHashPolicy=layer2+3
LacpduTransmitRate=fast
MIIMonitorSec=1s
UpDelaySec=2s
DownDelaySec=8s

cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer2+3 (2)
MII Status: up
MII Polling Interval (ms): 1000
Up Delay (ms): 2000
Down Delay (ms): 8000

802.3ad info
LACP rate: fast
Min links: 0
Aggregator selection policy (ad_select): stable
bond bond1 has no active aggregator

[tomegun: rephrased manpage, dropped bond_ prefix from variables]

man/systemd.netdev.xml
src/network/networkd-netdev-bond.c
src/network/networkd-netdev-bond.h
src/network/networkd-netdev-gperf.gperf

index cea416f94f02e83c0d58e2e5fee708cf78a7af0e..acd845498c0cef29dfdf07309948e2aeb57ef3cb 100644 (file)
                                     The default value is <literal>slow</literal>.</para>
                                   </listitem>
                                 </varlistentry>
+
+                                <varlistentry>
+                                  <term><varname>MIIMonitorSec=</varname></term>
+                                  <listitem>
+                                    <para>Specifies the frequency that Media Independent Interface link
+                                    monitoring will occur. A value of zero disables MII link monitoring.
+                                    This values is rounded down to the nearest millisecond. The default
+                                    value is 0.</para>
+                                  </listitem>
+                                </varlistentry>
+
+                                <varlistentry>
+                                  <term><varname>UpDelaySec=</varname></term>
+                                  <listitem>
+                                    <para>Specifies the delay before a link is enabled after a link up
+                                    status has been detected. This value is rounded down to a multiple of
+                                    MIIMonitorSec. The default value is 0.</para>
+                                  </listitem>
+                                </varlistentry>
+
+                                <varlistentry>
+                                  <term><varname>DownDelaySec=</varname></term>
+                                  <listitem>
+                                    <para>Specifies the delay before a link is disabled after a link down
+                                    status has been detected. This value is rounded down to a multiple of
+                                    MIIMonitorSec. The default value is 0.</para>
+                                  </listitem>
+                                </varlistentry>
+
                         </variablelist>
         </refsect1>
 
index e3f3333560c00f47d6e934032c587409c8b97d2e..1f57083626c92cda7c4a32fac0887a210ce8f638 100644 (file)
@@ -145,6 +145,36 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
                 }
         }
 
+        if (b->miimon != 0) {
+                r = sd_rtnl_message_append_u32(m, IFLA_BOND_MIIMON, b->miimon / 1000);
+                if (r < 0) {
+                        log_error_netdev(netdev,
+                                         "Could not append IFLA_BOND_BOND_MIIMON attribute: %s",
+                                         strerror(-r));
+                        return r;
+                }
+        }
+
+        if (b->downdelay != 0) {
+                r = sd_rtnl_message_append_u32(m, IFLA_BOND_DOWNDELAY, b->downdelay / 1000);
+                if (r < 0) {
+                        log_error_netdev(netdev,
+                                         "Could not append IFLA_BOND_DOWNDELAY attribute: %s",
+                                         strerror(-r));
+                        return r;
+                }
+        }
+
+        if (b->updelay != 0) {
+                r = sd_rtnl_message_append_u32(m, IFLA_BOND_UPDELAY, b->updelay / 1000);
+                if (r < 0) {
+                        log_error_netdev(netdev,
+                                         "Could not append IFLA_BOND_UPDELAY attribute: %s",
+                                         strerror(-r));
+                        return r;
+                }
+        }
+
         return 0;
 }
 
index fea076817a572c20c9dcb2ca9ea207171dc2d9e1..c09af5fa52bc02841eaeca93ac215511c3669e80 100644 (file)
@@ -61,6 +61,10 @@ struct Bond {
         BondMode mode;
         BondXmitHashPolicy xmit_hash_policy;
         BondLacpRate lacp_rate;
+
+        usec_t miimon;
+        usec_t updelay;
+        usec_t downdelay;
 };
 
 extern const NetDevVTable bond_vtable;
index 40fae75c42754569be74e673fe1bdd1efca13c1a..c524ee57980259e9b5d440ec76eef7a1ab1b9128 100644 (file)
@@ -54,3 +54,6 @@ Tap.Group,               config_parse_string,                0,
 Bond.Mode,               config_parse_bond_mode,             0,                             offsetof(Bond, mode)
 Bond.TransmitHashPolicy, config_parse_bond_xmit_hash_policy, 0,                             offsetof(Bond, xmit_hash_policy)
 Bond.LACPTransmitRate,   config_parse_bond_lacp_rate,        0,                             offsetof(Bond, lacp_rate)
+Bond.MIIMonitorSec,      config_parse_sec,                   0,                             offsetof(Bond, miimon)
+Bond.UpDelaySec,         config_parse_sec,                   0,                             offsetof(Bond, updelay)
+Bond.DownDelaySec,       config_parse_sec,                   0,                             offsetof(Bond, downdelay)