1. 19 May, 2021 27 commits
  2. 18 May, 2021 13 commits
    • Vladimir Oltean's avatar
      net: mdio: provide shim implementation of devm_of_mdiobus_register · 86544c3d
      Vladimir Oltean authored
      Similar to the way in which of_mdiobus_register() has a fallback to the
      non-DT based mdiobus_register() when CONFIG_OF is not set, we can create
      a shim for the device-managed devm_of_mdiobus_register() which calls
      devm_mdiobus_register() and discards the struct device_node *.
      
      In particular, this solves a build issue with the qca8k DSA driver which
      uses devm_of_mdiobus_register and can be compiled without CONFIG_OF.
      Reported-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      86544c3d
    • Yang Yingliang's avatar
      net: dcb: Remove unnecessary INIT_LIST_HEAD() · e2bd6bad
      Yang Yingliang authored
      The list_head dcb_app_list is initialized statically.
      It is unnecessary to initialize by INIT_LIST_HEAD().
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e2bd6bad
    • Yang Yingliang's avatar
      cxgb4: clip_tbl: use list_del_init instead of list_del/INIT_LIST_HEAD · 44e261c7
      Yang Yingliang authored
      Using list_del_init() instead of list_del() + INIT_LIST_HEAD()
      to simpify the code.
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      44e261c7
    • David S. Miller's avatar
      Merge branch 'wan-cleanups' · 46212b69
      David S. Miller authored
      Guangbin Huang says:
      
      ====================
      net: wan: clean up some code style issues
      
      This patchset clean up some code style issues.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      46212b69
    • Peng Li's avatar
      net: wan: fix variable definition style · a3f3e831
      Peng Li authored
      Fix the checkpatch error: "foo* bar" should be "foo *bar".
      Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
      Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a3f3e831
    • Peng Li's avatar
      net: wan: remove redundant space · da8e6fdd
      Peng Li authored
      Space prohibited before that close parenthesis ')',
      so removes the redundant space.
      Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
      Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      da8e6fdd
    • Peng Li's avatar
      net: wan: remove redundant braces {} · a4e59147
      Peng Li authored
      Braces {} are not necessary for single statement blocks,
      this patch removes redundant braces {}.
      Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
      Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a4e59147
    • Peng Li's avatar
      net: wan: add some required spaces · 23c23541
      Peng Li authored
      Add space required before the open parenthesis '(',
      and add spaces required around that '<', '>' and '!='.
      Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
      Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      23c23541
    • Peng Li's avatar
      net: wan: remove redundant blank lines · 78524c01
      Peng Li authored
      This patch removes some redundant blank lines.
      Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
      Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      78524c01
    • Wei Yongjun's avatar
      net: dsa: qca8k: fix missing unlock on error in qca8k_vlan_(add|del) · 0d56e5c1
      Wei Yongjun authored
      Add the missing unlock before return from function qca8k_vlan_add()
      and qca8k_vlan_del() in the error handling case.
      
      Fixes: 028f5f8e ("net: dsa: qca8k: handle error with qca8k_read operation")
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0d56e5c1
    • Zheng Yejian's avatar
      cipso: correct comments of cipso_v4_cache_invalidate() · 4ac9e23c
      Zheng Yejian authored
      Since cipso_v4_cache_invalidate() has no return value, so drop
      related descriptions in its comments.
      
      Fixes: 446fda4f ("[NetLabel]: CIPSOv4 engine")
      Signed-off-by: default avatarZheng Yejian <zhengyejian1@huawei.com>
      Acked-by: default avatarPaul Moore <paul@paul-moore.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4ac9e23c
    • David S. Miller's avatar
      Merge branch 'custom-multipath-hash' · 22ba9d0d
      David S. Miller authored
      Ido Schimmel says:
      
      ====================
      Add support for custom multipath hash
      
      This patchset adds support for custom multipath hash policy for both
      IPv4 and IPv6 traffic. The new policy allows user space to control the
      outer and inner packet fields used for the hash computation.
      
      Motivation
      ==========
      
      Linux currently supports different multipath hash policies for IPv4 and
      IPv6 traffic:
      
      * Layer 3
      * Layer 4
      * Layer 3 or inner layer 3, if present
      
      These policies hash on a fixed set of fields, which is inflexible and
      against operators' requirements to control the hash input: "The ability
      to control the inputs to the hash function should be a consideration in
      any load-balancing RFP" [1].
      
      An example of this inflexibility can be seen by the fact that none of
      the current policies allows operators to use the standard 5-tuple and
      the flow label for multipath hash computation. Such a policy is useful
      in the following real-world example of a data center with the following
      types of traffic:
      
      * Anycast IPv6 TCP traffic towards layer 4 load balancers. Flow label is
      constant (zero) to avoid breaking established connections
      
      * Non-encapsulated IPv6 traffic. Flow label is used to re-route flows
      around problematic (congested / failed) paths [2]
      
      * IPv6 encapsulated traffic (IPv4-in-IPv6 or IPv6-in-IPv6). Outer flow
      label is generated from encapsulated packet
      
      * UDP encapsulated traffic. Outer source port is generated from
      encapsulated packet
      
      In the above example, using the inner flow information for hash
      computation in addition to the outer flow information is useful during
      failures of the BPF agent that selectively generates the flow label
      based on the traffic type. In such cases, the self-healing properties of
      the flow label are lost, but encapsulated flows are still load balanced.
      
      Control over the inner fields is even more critical when encapsulation
      is performed by hardware routers. For example, the Spectrum ASIC can
      only encode 8 bits of entropy in the outer flow label / outer UDP source
      port when performing IP / UDP encapsulation. In the case of IPv4 GRE
      encapsulation there is no outer field to encode the inner hash in.
      
      User interface
      ==============
      
      In accordance with existing multipath hash configuration, the new custom
      policy is added as a new option (3) to the
      net.ipv{4,6}.fib_multipath_hash_policy sysctls. When the new policy is
      used, the packet fields used for hash computation are determined by the
      net.ipv{4,6}.fib_multipath_hash_fields sysctls. These sysctls accept a
      bitmask according to the following table (from ip-sysctl.rst):
      
      	====== ============================
      	0x0001 Source IP address
      	0x0002 Destination IP address
      	0x0004 IP protocol
      	0x0008 Flow Label
      	0x0010 Source port
      	0x0020 Destination port
      	0x0040 Inner source IP address
      	0x0080 Inner destination IP address
      	0x0100 Inner IP protocol
      	0x0200 Inner Flow Label
      	0x0400 Inner source port
      	0x0800 Inner destination port
      	====== ============================
      
      For example, to allow IPv6 traffic to be hashed based on standard
      5-tuple and flow label:
      
       # sysctl -wq net.ipv6.fib_multipath_hash_fields=0x0037
       # sysctl -wq net.ipv6.fib_multipath_hash_policy=3
      
      Implementation
      ==============
      
      As with existing policies, the new policy relies on the flow dissector
      to extract the packet fields for the hash computation. However, unlike
      existing policies that either use the outer or inner flow, the new
      policy might require both flows to be dissected.
      
      To avoid unnecessary invocations of the flow dissector, the data path
      skips dissection of the outer or inner flows if none of the outer or
      inner fields are required.
      
      In addition, inner flow dissection is not performed when no
      encapsulation was encountered (i.e., 'FLOW_DIS_ENCAPSULATION' not set by
      flow dissector) during dissection of the outer flow.
      
      Testing
      =======
      
      Three new selftests are added with three different topologies that allow
      testing of following traffic combinations:
      
      * Non-encapsulated IPv4 / IPv6 traffic
      * IPv4 / IPv6 overlay over IPv4 underlay
      * IPv4 / IPv6 overlay over IPv6 underlay
      
      All three tests follow the same pattern. Each time a different packet
      field is used for hash computation. When the field changes in the packet
      stream, traffic is expected to be balanced across the two paths. When
      the field does not change, traffic is expected to be unbalanced across
      the two paths.
      
      Patchset overview
      =================
      
      Patches #1-#3 add custom multipath hash support for IPv4 traffic
      Patches #4-#7 do the same for IPv6
      Patches #8-#10 add selftests
      
      Future work
      ===========
      
      mlxsw support can be found here [3].
      
      Changes since RFC v2 [4]:
      
      * Patch #2: Document that 0x0008 is used for Flow Label
      * Patch #2: Do not allow the bitmask to be zero
      * Patch #6: Do not allow the bitmask to be zero
      
      Changes since RFC v1 [5]:
      
      * Use a bitmask instead of a bitmap
      
      [1] https://blog.apnic.net/2018/01/11/ipv6-flow-label-misuse-hashing/
      [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3acf3ec3f4b0fd4263989f2e4227bbd1c42b5fe1
      [3] https://github.com/idosch/linux/tree/submit/custom_hash_mlxsw_v2
      [4] https://lore.kernel.org/netdev/20210509151615.200608-1-idosch@idosch.org/
      [5] https://lore.kernel.org/netdev/20210502162257.3472453-1-idosch@idosch.org/
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      22ba9d0d
    • Ido Schimmel's avatar
      selftests: forwarding: Add test for custom multipath hash with IPv6 GRE · b7715acb
      Ido Schimmel authored
      Test that when the hash policy is set to custom, traffic is distributed
      only according to the inner fields set in the fib_multipath_hash_fields
      sysctl.
      
      Each time set a different field and make sure traffic is only
      distributed when the field is changed in the packet stream.
      
      The test only verifies the behavior of IPv4/IPv6 overlays on top of an
      IPv6 underlay network. The previous patch verified the same with an IPv4
      underlay network.
      
      Example output:
      
       # ./ip6gre_custom_multipath_hash.sh
       TEST: ping                                                          [ OK ]
       TEST: ping6                                                         [ OK ]
       INFO: Running IPv4 overlay custom multipath hash tests
       TEST: Multipath hash field: Inner source IP (balanced)              [ OK ]
       INFO: Packets sent on path1 / path2: 6602 / 6002
       TEST: Multipath hash field: Inner source IP (unbalanced)            [ OK ]
       INFO: Packets sent on path1 / path2: 1 / 12601
       TEST: Multipath hash field: Inner destination IP (balanced)         [ OK ]
       INFO: Packets sent on path1 / path2: 6802 / 5801
       TEST: Multipath hash field: Inner destination IP (unbalanced)       [ OK ]
       INFO: Packets sent on path1 / path2: 12602 / 3
       TEST: Multipath hash field: Inner source port (balanced)            [ OK ]
       INFO: Packets sent on path1 / path2: 16431 / 16344
       TEST: Multipath hash field: Inner source port (unbalanced)          [ OK ]
       INFO: Packets sent on path1 / path2: 0 / 32773
       TEST: Multipath hash field: Inner destination port (balanced)       [ OK ]
       INFO: Packets sent on path1 / path2: 16431 / 16344
       TEST: Multipath hash field: Inner destination port (unbalanced)     [ OK ]
       INFO: Packets sent on path1 / path2: 2 / 32772
       INFO: Running IPv6 overlay custom multipath hash tests
       TEST: Multipath hash field: Inner source IP (balanced)              [ OK ]
       INFO: Packets sent on path1 / path2: 6704 / 5902
       TEST: Multipath hash field: Inner source IP (unbalanced)            [ OK ]
       INFO: Packets sent on path1 / path2: 1 / 12600
       TEST: Multipath hash field: Inner destination IP (balanced)         [ OK ]
       INFO: Packets sent on path1 / path2: 5751 / 6852
       TEST: Multipath hash field: Inner destination IP (unbalanced)       [ OK ]
       INFO: Packets sent on path1 / path2: 12602 / 0
       TEST: Multipath hash field: Inner flowlabel (balanced)              [ OK ]
       INFO: Packets sent on path1 / path2: 8272 / 8181
       TEST: Multipath hash field: Inner flowlabel (unbalanced)            [ OK ]
       INFO: Packets sent on path1 / path2: 3 / 12602
       TEST: Multipath hash field: Inner source port (balanced)            [ OK ]
       INFO: Packets sent on path1 / path2: 16424 / 16351
       TEST: Multipath hash field: Inner source port (unbalanced)          [ OK ]
       INFO: Packets sent on path1 / path2: 3 / 32774
       TEST: Multipath hash field: Inner destination port (balanced)       [ OK ]
       INFO: Packets sent on path1 / path2: 16425 / 16350
       TEST: Multipath hash field: Inner destination port (unbalanced)     [ OK ]
       INFO: Packets sent on path1 / path2: 2 / 32773
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Acked-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b7715acb