Skip to content
  1. Mar 17, 2021
  2. Mar 16, 2021
  3. Mar 15, 2021
    • David S. Miller's avatar
      Merge branch 'psample-Add-additional-metadata-attributes' · 2117fce8
      David S. Miller authored
      
      
      Ido Schimmel says:
      
      ====================
      psample: Add additional metadata attributes
      
      This series extends the psample module to expose additional metadata to
      user space for packets sampled via act_sample. The new metadata (e.g.,
      transit delay) can then be consumed by applications such as hsflowd [1]
      for better network observability.
      
      netdevsim is extended with a dummy psample implementation that
      periodically reports "sampled" packets to the psample module. In
      addition to testing of the psample module, it enables the development
      and demonstration of user space applications (e.g., hsflowd) that are
      interested in the new metadata even without access to specialized
      hardware (e.g., Spectrum ASIC) that can provide it.
      
      mlxsw is also extended to provide the new metadata to psample.
      
      A Wireshark dissector for psample netlink packets [2] will be submitted
      upstream after the kernel patches are accepted. In addition, a libpcap
      capture module for psample is currently in the works. Eventually, users
      should be able to run:
      
       # tshark -i psample
      
      In order to consume sampled packets along with their metadata.
      
      Series overview:
      
      Patch #1 makes it easier to extend the metadata provided to psample
      
      Patch #2 adds the new metadata attributes to psample
      
      Patch #3 extends netdevsim to periodically report "sampled" packets to
      psample. Various debugfs knobs are added to control the reporting
      
      Patch #4 adds a selftest over netdevsim
      
      Patches #5-#10 gradually add support for the new metadata in mlxsw
      
      Patch #11 adds a selftest over mlxsw
      
      [1] https://sflow.org/draft4_sflow_transit.txt
      [2] https://gitlab.com/amitcohen1/wireshark/-/commit/3d711143024e032aef1b056dd23f0266c54fab56
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2117fce8
    • Ido Schimmel's avatar
      selftests: mlxsw: Add tc sample tests · bb24d592
      Ido Schimmel authored
      
      
      Test that packets are sampled when tc-sample is used and that reported
      metadata is correct. Two sets of hosts (with and without LAG) are used,
      since metadata extraction in mlxsw is a bit different when LAG is
      involved.
      
       # ./tc_sample.sh
       TEST: tc sample rate (forward)                                      [ OK ]
       TEST: tc sample rate (local receive)                                [ OK ]
       TEST: tc sample maximum rate                                        [ OK ]
       TEST: tc sample group conflict test                                 [ OK ]
       TEST: tc sample iif                                                 [ OK ]
       TEST: tc sample lag iif                                             [ OK ]
       TEST: tc sample oif                                                 [ OK ]
       TEST: tc sample lag oif                                             [ OK ]
       TEST: tc sample out-tc                                              [ OK ]
       TEST: tc sample out-tc-occ                                          [ OK ]
      
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bb24d592
    • Ido Schimmel's avatar
      mlxsw: spectrum: Report extra metadata to psample module · 2073c600
      Ido Schimmel authored
      
      
      Make use of the previously added metadata and report it to the psample
      module. The metadata is read from the skb's control block, which was
      initialized by the bus driver (i.e., 'mlxsw_pci') after decoding the
      packet's Completion Queue Element (CQE).
      
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2073c600
    • Ido Schimmel's avatar
      mlxsw: spectrum: Remove mlxsw_sp_sample_receive() · 48990bef
      Ido Schimmel authored
      
      
      The function resolves the psample sampling group from the Rx port
      because this is the only form of sampling the driver currently supports.
      Subsequent patches are going to add support for Tx-based and
      policy-based sampling, in which case the sampling group would not be
      resolved from the Rx port.
      
      Therefore, move this code to the Rx-specific sampling listener.
      
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      48990bef
    • Ido Schimmel's avatar
      mlxsw: spectrum: Remove unnecessary RCU read-side critical section · e1f78ecd
      Ido Schimmel authored
      Since commit 7d8e8f34
      
       ("mlxsw: core: Increase scope of RCU read-side
      critical section"), all Rx handlers are called from an RCU read-side
      critical section.
      
      Remove the unnecessary rcu_read_lock() / rcu_read_unlock().
      
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e1f78ecd
    • Ido Schimmel's avatar
      mlxsw: pci: Set extra metadata in skb control block · 5ab6dc9f
      Ido Schimmel authored
      
      
      Packets that are mirrored / sampled to the CPU have extra metadata
      encoded in their corresponding Completion Queue Element (CQE). Retrieve
      this metadata from the CQE and set it in the skb control block so that
      it could be accessed by the switch driver (i.e., 'mlxsw_spectrum').
      
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5ab6dc9f
    • Ido Schimmel's avatar
      mlxsw: Create dedicated field for Rx metadata in skb control block · d4cabaad
      Ido Schimmel authored
      
      
      Next patch will need to encode more Rx metadata in the skb control
      block, so create a dedicated field for it and move the cookie index
      there.
      
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d4cabaad