1. 18 May, 2021 7 commits
    • Ido Schimmel's avatar
      ipv6: Add custom multipath hash policy · 73c2c5cb
      Ido Schimmel authored
      Add a new multipath hash policy where the packet fields used for hash
      calculation are determined by user space via the
      fib_multipath_hash_fields sysctl that was introduced in the previous
      patch.
      
      The current set of available packet fields includes both outer and inner
      fields, which requires two invocations of the flow dissector. Avoid
      unnecessary dissection of the outer or inner flows by skipping
      dissection if none of the outer or inner fields are required.
      
      In accordance with the existing policies, when an skb is not available,
      packet fields are extracted from the provided flow key. In which case,
      only outer fields are considered.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      73c2c5cb
    • Ido Schimmel's avatar
      ipv6: Add a sysctl to control multipath hash fields · ed13923f
      Ido Schimmel authored
      A subsequent patch will add a new multipath hash policy where the packet
      fields used for multipath hash calculation are determined by user space.
      This patch adds a sysctl that allows user space to set these fields.
      
      The packet fields are represented using a bitmask and are common between
      IPv4 and IPv6 to allow user space to use the same numbering across both
      protocols. For example, to hash based on standard 5-tuple:
      
       # sysctl -w net.ipv6.fib_multipath_hash_fields=0x0037
       net.ipv6.fib_multipath_hash_fields = 0x0037
      
      To avoid introducing holes in 'struct netns_sysctl_ipv6', move the
      'bindv6only' field after the multipath hash fields.
      
      The kernel rejects unknown fields, for example:
      
       # sysctl -w net.ipv6.fib_multipath_hash_fields=0x1000
       sysctl: setting key "net.ipv6.fib_multipath_hash_fields": Invalid argument
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ed13923f
    • Ido Schimmel's avatar
      ipv6: Calculate multipath hash inside switch statement · b95b6e07
      Ido Schimmel authored
      A subsequent patch will add another multipath hash policy where the
      multipath hash is calculated directly by the policy specific code and
      not outside of the switch statement.
      
      Prepare for this change by moving the multipath hash calculation inside
      the switch statement.
      
      No functional changes intended.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b95b6e07
    • Ido Schimmel's avatar
      ipv6: Use a more suitable label name · 67db5ca7
      Ido Schimmel authored
      The 'out_timer' label was added in commit 63152fc0 ("[NETNS][IPV6]
      ip6_fib - gc timer per namespace") when the timer was allocated on the
      heap.
      
      Commit 417f28bb ("netns: dont alloc ipv6 fib timer list") removed
      the allocation, but kept the label name.
      
      Rename it to a more suitable name.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      67db5ca7
    • Ido Schimmel's avatar
      ipv4: Add custom multipath hash policy · 4253b498
      Ido Schimmel authored
      Add a new multipath hash policy where the packet fields used for hash
      calculation are determined by user space via the
      fib_multipath_hash_fields sysctl that was introduced in the previous
      patch.
      
      The current set of available packet fields includes both outer and inner
      fields, which requires two invocations of the flow dissector. Avoid
      unnecessary dissection of the outer or inner flows by skipping
      dissection if none of the outer or inner fields are required.
      
      In accordance with the existing policies, when an skb is not available,
      packet fields are extracted from the provided flow key. In which case,
      only outer fields are considered.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4253b498
    • Ido Schimmel's avatar
      ipv4: Add a sysctl to control multipath hash fields · ce5c9c20
      Ido Schimmel authored
      A subsequent patch will add a new multipath hash policy where the packet
      fields used for multipath hash calculation are determined by user space.
      This patch adds a sysctl that allows user space to set these fields.
      
      The packet fields are represented using a bitmask and are common between
      IPv4 and IPv6 to allow user space to use the same numbering across both
      protocols. For example, to hash based on standard 5-tuple:
      
       # sysctl -w net.ipv4.fib_multipath_hash_fields=0x0037
       net.ipv4.fib_multipath_hash_fields = 0x0037
      
      The kernel rejects unknown fields, for example:
      
       # sysctl -w net.ipv4.fib_multipath_hash_fields=0x1000
       sysctl: setting key "net.ipv4.fib_multipath_hash_fields": Invalid argument
      
      More fields can be added in the future, if needed.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ce5c9c20
    • Ido Schimmel's avatar
      ipv4: Calculate multipath hash inside switch statement · 2e68ea92
      Ido Schimmel authored
      A subsequent patch will add another multipath hash policy where the
      multipath hash is calculated directly by the policy specific code and
      not outside of the switch statement.
      
      Prepare for this change by moving the multipath hash calculation inside
      the switch statement.
      
      No functional changes intended.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2e68ea92
  2. 17 May, 2021 33 commits