1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

netdev bond: add support to configure tlb_dynamic_lb

Closes https://github.com/systemd/systemd/issues/11135

Add test for bond : tlb_dynamic_lb
This commit is contained in:
Susant Sahani 2018-12-13 14:53:07 +05:30
parent fd0ec39d38
commit fde60a424e
8 changed files with 38 additions and 0 deletions

View File

@ -1457,6 +1457,15 @@
</listitem>
</varlistentry>
<varlistentry>
<term><varname>DynamicTransmitLoadBalancing=</varname></term>
<listitem>
<para>Takes a boolean. Specifies if dynamic shuffling of flows is enabled. Applies only
for balance-tlb mode. Defaults to unset.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>MinLinks=</varname></term>
<listitem>

View File

@ -227,6 +227,7 @@ static const NLType rtnl_link_info_data_bond_types[] = {
[IFLA_BOND_AD_ACTOR_SYS_PRIO] = { .type = NETLINK_TYPE_U16 },
[IFLA_BOND_AD_USER_PORT_KEY] = { .type = NETLINK_TYPE_U16 },
[IFLA_BOND_AD_ACTOR_SYSTEM] = { .type = NETLINK_TYPE_ETHER_ADDR },
[IFLA_BOND_TLB_DYNAMIC_LB] = { .type = NETLINK_TYPE_U8 },
};
static const NLType rtnl_link_info_data_iptun_types[] = {

View File

@ -307,6 +307,12 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_netlin
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ALL_SLAVES_ACTIVE attribute: %m");
if (b->tlb_dynamic_lb >= 0) {
r = sd_netlink_message_append_u8(m, IFLA_BOND_TLB_DYNAMIC_LB, b->tlb_dynamic_lb);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_TLB_DYNAMIC_LB attribute: %m");
}
if (b->arp_interval > 0) {
if (b->n_arp_ip_targets > 0) {
@ -534,6 +540,7 @@ static void bond_init(NetDev *netdev) {
b->primary_reselect = _NETDEV_BOND_PRIMARY_RESELECT_INVALID;
b->all_slaves_active = false;
b->tlb_dynamic_lb = -1;
b->resend_igmp = RESEND_IGMP_DEFAULT;
b->packets_per_slave = PACKETS_PER_SLAVE_DEFAULT;

View File

@ -99,6 +99,8 @@ typedef struct Bond {
BondArpAllTargets arp_all_targets;
BondPrimaryReselect primary_reselect;
int tlb_dynamic_lb;
bool all_slaves_active;
unsigned resend_igmp;

View File

@ -141,6 +141,7 @@ Bond.ResendIGMP, config_parse_unsigned, 0,
Bond.PacketsPerSlave, config_parse_unsigned, 0, offsetof(Bond, packets_per_slave)
Bond.GratuitousARP, config_parse_unsigned, 0, offsetof(Bond, num_grat_arp)
Bond.AllSlavesActive, config_parse_unsigned, 0, offsetof(Bond, all_slaves_active)
Bond.DynamicTransmitLoadBalancing, config_parse_tristate, 0, offsetof(Bond, tlb_dynamic_lb)
Bond.MinLinks, config_parse_unsigned, 0, offsetof(Bond, min_links)
Bond.MIIMonitorSec, config_parse_sec, 0, offsetof(Bond, miimon)
Bond.UpDelaySec, config_parse_sec, 0, offsetof(Bond, updelay)

View File

@ -129,6 +129,7 @@ MinLinks=
LACPTransmitRate=
ARPIntervalSec=
AllSlavesActive=
DynamicTransmitLoadBalancing=
[FooOverUDP]
Protocol=
Port=

View File

@ -0,0 +1,7 @@
[NetDev]
Name=bond99
Kind=bond
[Bond]
Mode=balance-tlb
DynamicTransmitLoadBalancing=true

View File

@ -213,6 +213,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
'21-vlan.network',
'25-6rd-tunnel.netdev',
'25-bond.netdev',
'25-bond-balanced-tlb.netdev',
'25-bridge.netdev',
'25-erspan-tunnel.netdev',
'25-geneve.netdev',
@ -300,6 +301,15 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
self.assertEqual('811', self.read_link_attr('bond99', 'bonding', 'ad_user_port_key'))
self.assertEqual('00:11:22:33:44:55', self.read_link_attr('bond99', 'bonding', 'ad_actor_system'))
def test_bond_balanced_tlb(self):
self.copy_unit_to_networkd_unit_path('25-bond-balanced-tlb.netdev')
self.start_networkd()
self.assertTrue(self.link_exits('bond99'))
self.assertEqual('balance-tlb 5', self.read_link_attr('bond99', 'bonding', 'mode'))
self.assertEqual('1', self.read_link_attr('bond99', 'bonding', 'tlb_dynamic_lb'))
def test_vlan(self):
self.copy_unit_to_networkd_unit_path('21-vlan.netdev', '11-dummy.netdev', '21-vlan.network')
self.start_networkd()