Defined Type: profile::lvs::interface_tweaks

Defined in:
modules/profile/manifests/lvs/interface_tweaks.pp

Overview

Parameters:

  • interface (Any) (defaults to: $name)
  • txqlen (Any) (defaults to: false)
  • rss_pattern (Any) (defaults to: '')
  • do_rps (Any) (defaults to: true)
  • ipip_enabled (Any) (defaults to: false)


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'modules/profile/manifests/lvs/interface_tweaks.pp', line 5

define profile::lvs::interface_tweaks(
  $interface=$name,
  $txqlen=false,
  $rss_pattern='',
  $do_rps=true,
  $ipip_enabled=false,
) {
    if $interface != $facts['interface_primary'] {
        interface::manual { $name:
            interface => $interface,
        }
    }

    # Disable LRO to avoid merging important headers for flow control and such
    interface::offload { "${interface}-lro":
        interface => $interface,
        setting   => 'lro',
        value     => 'off',
    }

    # RSS/RPS/XPS-type perf stuff ( https://www.kernel.org/doc/Documentation/networking/scaling.txt )
    if $do_rps {
        interface::rps { $name:
            interface   => $interface,
            rss_pattern => $rss_pattern,
        }
    }

    # Optional larger TX queue len for 10Gbps+
    if $txqlen {
        interface::txqueuelen { $name:
            interface => $interface,
            len       => $txqlen,
        }
    }

    # Max out ring buffers, seems to eliminate the spurious drops under heavy traffic
    $ring_size = $facts['net_driver'][$interface]['driver'] ? {
        'bnx2x' => 4078,
        'bnxt_en' => 2047,
    }

    if $facts['net_driver'][$interface]['driver'] =~ /^bnx(2x|t_en)$/ {
        interface::ring { "${name} rxring":
            interface => $interface,
            setting   => 'rx',
            value     => $ring_size,
        }

        # Disable ethernet PAUSE behavior, dropping is better than buffering (in reasonable cases!)
        interface::noflow { $interface: }
    }

    # bnxt_en also needs the tx set explicitly, unlike bnx2x above
    if $facts['net_driver'][$interface]['driver'] == 'bnxt_en' {
        interface::ring { "${name} txring":
            interface => $interface,
            setting   => 'tx',
            value     => $ring_size,
        }
    }

    # if we are using IPIP encapsulation we need the clsact qdisc + ipip-multiqueue-optimizer
    $ensure_clsact = bool2str($ipip_enabled, 'present', 'absent')
    interface::clsact { $name:
        ensure    => $ensure_clsact,
        interface => $interface,
    }
}