1. 06 Dec, 2018 25 commits
  2. 05 Dec, 2018 9 commits
  3. 04 Dec, 2018 6 commits
    • David S. Miller's avatar
      Merge branch 'mlxsw-Add-one-armed-router-support' · 55827458
      David S. Miller authored
      Ido Schimmel says:
      
      ====================
      mlxsw: Add one-armed router support
      
      Up until now, when a packet was routed by the ASIC through the same
      router interface (RIF) from which it ingressed from, the ASIC passed the
      sole copy of the packet to the kernel. This allowed the kernel to route
      the packet and also potentially generate an ICMP redirect.
      
      There are scenarios (e.g., "one-armed router") where packets are
      intentionally routed this way and are therefore not deemed as
      exceptions. In such scenarios the current method of trapping packets to
      the CPU is problematic, as it results in major packet loss.
      
      This patchset solves the problem by having the ASIC forward the packet,
      but also send a copy to the CPU, which gives the kernel the opportunity
      to generate required exceptions.
      
      To prevent the kernel from forwarding such packets again, the driver
      marks them with 'offload_l3_fwd_mark', which causes the kernel to
      consume them in ip{,6}_forward_finish().
      
      Patch #1 renames 'offload_mr_fwd_mark' to 'offload_l3_fwd_mark'. When
      set, the field indicates that a packet was already forwarded in L3
      (unicast / multicast) by a capable device.
      
      Patch #2 teaches the kernel to consume unicast packets that have
      'offload_l3_fwd_mark' set.
      
      Patch #3 changes mlxsw to mirror loopbacked (iRIF == eRIF) packets,
      instead of trapping them.
      
      Patch #4 adds a test case for above mentioned scenario.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      55827458
    • Ido Schimmel's avatar
      selftests: mlxsw: Add one-armed router test · b6f153d3
      Ido Schimmel authored
      Construct a "one-armed router" topology and test that packets are
      forwarded by the ASIC and that a copy of the packet is sent to the
      kernel, which does not forward the packet again.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b6f153d3
    • Ido Schimmel's avatar
      mlxsw: spectrum: Mirror loopbacked packets instead of trapping them · 2f4f4494
      Ido Schimmel authored
      When the ASIC detects that a unicast packet is routed through the same
      router interface (RIF) from which it ingressed (iRIF == eRIF), it raises
      a trap called loopback error (LBERROR).
      
      Thus far, this trap was configured to send a sole copy of the packet to
      the CPU so that ICMP redirect packets could be potentially generated by
      the kernel.
      
      This is problematic as the CPU cannot forward packets at 3.2Tb/s and
      there are scenarios (e.g., "one-armed router") where iRIF == eRIF is not
      an exception.
      
      Solve this by changing the trap to send a copy of the packet to the CPU.
      To prevent the kernel from forwarding the packet again, it is marked
      with 'offload_l3_fwd_mark'.
      
      The trap is configured in a trap group of its own with a dedicated
      policer in order not to prevent packets trapped by other traps from
      reaching the CPU.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2f4f4494
    • Ido Schimmel's avatar
      net: Do not route unicast IP packets twice · f839a6c9
      Ido Schimmel authored
      Packets marked with 'offload_l3_fwd_mark' were already forwarded by a
      capable device and should not be forwarded again by the kernel.
      Therefore, have the kernel consume them.
      
      The check is performed in ip{,6}_forward_finish() in order to allow the
      kernel to process such packets in ip{,6}_forward() and generate required
      exceptions. For example, ICMP redirects.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f839a6c9
    • Ido Schimmel's avatar
      skbuff: Rename 'offload_mr_fwd_mark' to 'offload_l3_fwd_mark' · 875e8939
      Ido Schimmel authored
      Commit abf4bb6b ("skbuff: Add the offload_mr_fwd_mark field") added
      the 'offload_mr_fwd_mark' field to indicate that a packet has already
      undergone L3 multicast routing by a capable device. The field is used to
      prevent the kernel from forwarding a packet through a netdev through
      which the device has already forwarded the packet.
      
      Currently, no unicast packet is routed by both the device and the
      kernel, but this is about to change by subsequent patches and we need to
      be able to mark such packets, so that they will no be forwarded twice.
      
      Instead of adding yet another field to 'struct sk_buff', we can just
      rename 'offload_mr_fwd_mark' to 'offload_l3_fwd_mark', as a packet
      either has a multicast or a unicast destination IP.
      
      While at it, add a comment about both 'offload_fwd_mark' and
      'offload_l3_fwd_mark'.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      875e8939
    • Yangtao Li's avatar
      net: marvell: convert to DEFINE_SHOW_ATTRIBUTE · d9bbd6a1
      Yangtao Li authored
      Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
      Signed-off-by: default avatarYangtao Li <tiny.windzz@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d9bbd6a1