Correct MTU

Correct MTU for interface with 'i40e' driver
Closes-Bug: #1587310

Change-Id: I2cee98194c4d1761feeb1999804c0e24a467eb2c
This commit is contained in:
Mikhail 2017-01-14 19:09:20 +04:00
parent 3529c56f8e
commit 4a64028d70
7 changed files with 31 additions and 4 deletions

View File

@ -34,6 +34,9 @@ if [ "${MODE}" = "start" ]; then
if [ -n "$IF_MULTIQ_THREADS" ]; then
DPDK_EXTRA="${DPDK_EXTRA} -- set Interface ${IF_DPDK_PORT} options:n_rxq=${IF_MULTIQ_THREADS}"
fi
if [ -n "$IF_MTU_REQUEST" ]; then
DPDK_EXTRA="${DPDK_EXTRA} -- set Interface ${IF_DPDK_PORT} mtu_request=${IF_MTU_REQUEST}"
fi
ovs_vsctl -- --may-exist add-port "${IF_OVS_BRIDGE}"\
"${IF_DPDK_PORT}" ${IF_OVS_OPTIONS} \
${DPDK_EXTRA} \
@ -45,6 +48,9 @@ if [ "${MODE}" = "start" ]; then
if [ -n "$IF_MULTIQ_THREADS" ]; then
DPDK_EXTRA="${DPDK_EXTRA} -- set Interface ${slave} options:n_rxq=${IF_MULTIQ_THREADS}"
fi
if [ -n "$IF_MTU_REQUEST" ]; then
DPDK_EXTRA="${DPDK_EXTRA} -- set Interface ${slave} mtu_request=${IF_MTU_REQUEST}"
fi
done
ovs_vsctl -- --fake-iface add-bond "${IF_OVS_BRIDGE}"\
"${IFACE}" ${IF_OVS_BONDS} ${IF_OVS_OPTIONS} \

View File

@ -46,6 +46,7 @@ Puppet::Type.type(:l23_stored_config).provide(:dpdkovs_ubuntu, :parent => Puppet
:bond_updelay => 'ovs_options',
:bond_downdelay => 'ovs_options',
:multiq_threads => 'multiq_threads',
:mtu => 'mtu_request',
})
return rv
end

View File

@ -47,6 +47,11 @@ Puppet::Type.type(:l2_port).provide(:dpdkovs, :parent => Puppet::Provider::Ovs_b
dpdk_port = self.class.get_dpdk_ports_mapping[@resource[:interface]]
vsctl('set', 'Interface', '#{dpdk_port}', 'options:n_rxq=#{@property_flush[:vendor_specific][:max_queues].to_i}')
end
if !@property_flush[:mtu].nil? and @property_flush[:mtu] != :absent
dpdk_port = self.class.get_dpdk_ports_mapping[@resource[:interface]]
vsctl('set', 'Interface', '#{dpdk_port}', 'mtu_request=#{mtu}')
end
@property_hash = resource.to_hash
end
end

View File

@ -6,7 +6,7 @@
# *********************************************************************
allow-br-prv bond_lacp
iface bond_lacp inet manual
mtu 9000
mtu_request 9000
ovs_bonds dpdk0 dpdk1
ovs_type DPDKOVSBond
ovs_bridge br-prv

View File

@ -4,3 +4,4 @@ ovs_type DPDKOVSPort
dpdk_port dpdk0
ovs_bridge br-prv
multiq_threads 3
mtu_request 1500

View File

@ -84,7 +84,7 @@ describe Puppet::Type.type(:l23_stored_config).provider(:dpdkovs_ubuntu) do
it { expect(cfg_file).not_to match(/auto\s+bond_lacp/) }
it { expect(cfg_file).to match(/allow-br-prv\s+bond_lacp/) }
it { expect(cfg_file).to match(/iface\s+bond_lacp\s+inet\s+manual/) }
it { expect(cfg_file).to match(/mtu\s+9000/) }
it { expect(cfg_file).to match(/mtu_request\s+9000/) }
it { expect(cfg_file).to match(/ovs_bonds\s+dpdk0\s+dpdk1/) }
it { expect(cfg_file).to match(/ovs_type\s+DPDKOVSBond/) }
it { expect(cfg_file).to match(/ovs_bridge\s+br-prv/) }
@ -98,6 +98,7 @@ describe Puppet::Type.type(:l23_stored_config).provider(:dpdkovs_ubuntu) do
it { expect(cfg_file.split(/\n/).reject{|x| x=~/(^\s*$)|(^#.*$)/}.length). to eq(7) } # no more lines in the interface file
end
context "parse data from fixture" do
let(:res) do
subject.class.stubs(:get_dpdk_ports_mapping).returns(dpdk_ports_mapping)
@ -116,5 +117,6 @@ describe Puppet::Type.type(:l23_stored_config).provider(:dpdkovs_ubuntu) do
it { expect(res[:bond_downdelay]).to eq '222' }
it { expect(res[:bond_slaves]).to eq ['enp1s0f0', 'enp1s0f1'] }
end
end
end

View File

@ -8,7 +8,10 @@ describe Puppet::Type.type(:l23_stored_config).provider(:dpdkovs_ubuntu) do
:if_type => 'ethernet',
:bridge => 'br-prv',
:provider => 'dpdkovs_ubuntu',
:vendor_specific => {'max_queues' => 3},
:vendor_specific => {
:max_queues => 3
},
:mtu => 1500,
},
}
}
@ -19,6 +22,13 @@ describe Puppet::Type.type(:l23_stored_config).provider(:dpdkovs_ubuntu) do
}
}
let(:dpdk_ports_mapping_i40e) {
{
'enp1s0f1' => 'dpdk0'
}
}
let(:resources) do
resources = {}
input_data.each do |name, res|
@ -73,7 +83,8 @@ describe Puppet::Type.type(:l23_stored_config).provider(:dpdkovs_ubuntu) do
it { expect(cfg_file).to match(/ovs_bridge\s+br-prv/) }
it { expect(cfg_file).to match(/dpdk_port\s+dpdk0/) }
it { expect(cfg_file).to match(/multiq_threads\s+3/) }
it { expect(cfg_file.split(/\n/).reject{|x| x=~/(^\s*$)|(^#.*$)/}.length). to eq(6) }
it { expect(cfg_file).to match(/mtu_request\s+1500/) }
it { expect(cfg_file.split(/\n/).reject{|x| x=~/(^\s*$)|(^#.*$)/}.length). to eq(7) }
end
end
@ -86,6 +97,7 @@ describe Puppet::Type.type(:l23_stored_config).provider(:dpdkovs_ubuntu) do
it { expect(res[:if_provider].to_s).to eq 'dpdkovs' }
it { expect(res[:dpdk_port].to_s).to eq 'dpdk0' }
it { expect(res[:multiq_threads].to_s).to eq '3' }
it { expect(res[:mtu].to_s).to eq '1500' }
end
end
end