1. 12 Apr, 2023 11 commits
    • Yevgeny Kliteynik's avatar
      net/mlx5: DR, Set counter ID on the last STE for STEv1 TX · cee6484e
      Yevgeny Kliteynik authored
      In STEv1 counter action can be set either by filling counter ID on STE, in
      which case it is executed before other actions on this STE, or as a single
      action, in which case it is executed in accordance with the actions order.
      FW steering on STEv1 devices implements counter as counter ID on STE, and
      this counter is set on the last STE.
      Fix SMFS to be consistent with this behaviour - move TX counter to the
      last STE, this way the counter will include all actions of the previous STEs
      that might have changed packet headers length, e.g. encap, vlan push, etc.
      Signed-off-by: default avatarYevgeny Kliteynik <kliteyn@nvidia.com>
      Reviewed-by: default avatarAlex Vesker <valex@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      cee6484e
    • Parav Pandit's avatar
      net/mlx5: Create a new profile for SFs · 9df839a7
      Parav Pandit authored
      Create a new profile for SFs in order to disable the command cache.
      Each function command cache consumes ~500KB of memory, when using a
      large number of SFs this savings is notable on memory constarined
      systems.
      
      Use a new profile to provide for future differences between SFs and PFs.
      
      The mr_cache not used for non-PF functions, so it is excluded from the
      new profile.
      Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
      Reviewed-by: default avatarBodong Wang <bodong@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      9df839a7
    • Vlad Buslov's avatar
      net/mlx5: Bridge, add tracepoints for multicast · 55f3e740
      Vlad Buslov authored
      Pass target struct net_device to mdb attach/detach handler in order to
      expose the port name to the new tracepoints. Implemented following
      tracepoints:
      
      - Attach mdb to port.
      - Detach mdb from port.
      
      Usage example:
      
      ># cd /sys/kernel/debug/tracing
      ># echo mlx5:mlx5_esw_bridge_port_mdb_attach >> set_event
      ># cat trace
      ...
           kworker/0:0-19071   [000] ..... 259004.253848: mlx5_esw_bridge_port_mdb_attach: net_device=enp8s0f0_0 addr=33:33:ff:00:00:01 vid=0 num_ports=1 offloaded=1
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Reviewed-by: default avatarMaor Dickman <maord@nvidia.com>
      Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      55f3e740
    • Vlad Buslov's avatar
      net/mlx5: Bridge, implement mdb offload · 70f0302b
      Vlad Buslov authored
      Implement support for add/del SWITCHDEV_OBJ_ID_PORT_MDB events. For mdb
      destination addresses configure egress table rules to replicate to per-port
      multicast tables of all ports that are member of the multicast group as
      illustrated by 'MDB1' rule in the following diagram:
      
                                                                                                                                  +--------+--+
                                                                                          +---------------------------------------> Port 1 |  |
                                                                                          |                                       +-^------+--+
                                                                                          |                                         |
                                                                                          |                                         |
                                             +-----------------------------------------+  |     +---------------------------+       |
                                             | EGRESS table                            |  |  +--> PORT 1 multicast table    |       |
      +----------------------------------+   +-----------------------------------------+  |  |  +---------------------------+       |
      | INGRESS table                    |   |                                         |  |  |  |                           |       |
      +----------------------------------+   | dst_mac=P1,vlan=X -> pop vlan, goto P1  +--+  |  | FG0:                      |       |
      |                                  |   | dst_mac=P1,vlan=Y -> pop vlan, goto P1  |     |  | src_port=dst_port -> drop |       |
      | src_mac=M1,vlan=X -> goto egress +---> dst_mac=P2,vlan=X -> pop vlan, goto P2  +--+  |  | FG1:                      |       |
      | ...                              |   | dst_mac=P2,vlan=Y -> goto P2            |  |  |  | VLAN X -> pop, goto port  |       |
      |                                  |   | dst_mac=MDB1,vlan=Y -> goto mcast P1,P2 +-----+  | ...                       |       |
      +----------------------------------+   |                                         |  |  |  | VLAN Y -> pop, goto port  +-------+
                                             +-----------------------------------------+  |  |  | FG3:                      |
                                                                                          |  |  | matchall -> goto port     |
                                                                                          |  |  |                           |
                                                                                          |  |  +---------------------------+
                                                                                          |  |
                                                                                          |  |
                                                                                          |  |                                    +--------+--+
                                                                                          +---------------------------------------> Port 2 |  |
                                                                                             |                                    +-^------+--+
                                                                                             |                                      |
                                                                                             |                                      |
                                                                                             |  +---------------------------+       |
                                                                                             +--> PORT 2 multicast table    |       |
                                                                                                +---------------------------+       |
                                                                                                |                           |       |
                                                                                                | FG0:                      |       |
                                                                                                | src_port=dst_port -> drop |       |
                                                                                                | FG1:                      |       |
                                                                                                | VLAN X -> pop, goto port  |       |
                                                                                                | ...                       |       |
                                                                                                |                           |       |
                                                                                                | FG3:                      |       |
                                                                                                | matchall -> goto port     +-------+
                                                                                                |                           |
                                                                                                +---------------------------+
      
      MDB is managed by extending mlx5 bridge to store an entry in
      mlx5_esw_bridge->mdb_list linked list (used to iterate over all offloaded
      MDBs) and mlx5_esw_bridge->mdb_ht hash table (used to lookup existing MDB
      by MAC+VLAN). Every MDB entry can be attached to arbitrary amount of bridge
      ports that are stored in mlx5_esw_bridge_mdb_entry->ports xarray in order
      to allow both efficient lookup of the port and also iteration over all
      ports that the entry is attached to. Every time MDB is attached/detached
      to/from a port, the hardware rule is recreated with list of destinations
      corresponding to all attached ports. When the entry is detached from the
      last port it is removed from mdb and destroyed which means that the ports
      xarray also acts as implicit reference counting mechanism.
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Reviewed-by: default avatarMaor Dickman <maord@nvidia.com>
      Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      70f0302b
    • Vlad Buslov's avatar
      net/mlx5: Bridge, support multicast VLAN pop · b5e80625
      Vlad Buslov authored
      When VLAN with 'untagged' flag is created on port also provision the
      per-port multicast table rule to pop the VLAN during packet replication.
      This functionality must be in per-port table because some subset of ports
      that are member of multicast group can require just a match on VLAN (trunk
      mode) while other subset can be configured to remove the VLAN tag from
      packets received on the ports (access mode).
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Reviewed-by: default avatarMaor Dickman <maord@nvidia.com>
      Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      b5e80625
    • Vlad Buslov's avatar
      net/mlx5: Bridge, add per-port multicast replication tables · 272ecfc9
      Vlad Buslov authored
      Multicast replication requires adding one more level of FDB_BR_OFFLOAD
      priority flow tables. The new level is used for per-port multicast-specific
      tables that have following flow groups structure (flow highest to lowest
      priority):
      
      - Flow group of size one that matches on source port metadata. This will
      have a static single rule that prevent packets from being replicated to
      their source port.
      
      - Flow group of size one that matches all packets and forwards them to the
      port that owns the table.
      
      Initialize the table dynamically on all bridge ports when adding a port to
      the bridge that has multicast enabled and on all existing bridge ports when
      receiving multicast enable notification.
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Reviewed-by: default avatarMaor Dickman <maord@nvidia.com>
      Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      272ecfc9
    • Vlad Buslov's avatar
      net/mlx5: Bridge, snoop igmp/mld packets · 18c2916c
      Vlad Buslov authored
      Handle SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED attribute notification to
      dynamically toggle bridge multicast offload. Set new
      MLX5_ESW_BRIDGE_MCAST_FLAG bridge flag when multicast offload is enabled.
      Put multicast-specific code into new bridge_mcast.c file.
      
      When initializing bridge multicast pipeline create a static rule for
      snooping on IGMP traffic and three rules for snooping on MLD traffic (for
      query, report and done message types). Note that matching MLD traffic
      requires having flexparser MLX5_FLEX_PROTO_ICMPV6 capability enabled.
      
      By default Linux bridge is created with multicast enabled which can be
      modified by 'mcast_snooping' argument:
      
      $ ip link set name my_bridge type bridge mcast_snooping 0
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Reviewed-by: default avatarMaor Dickman <maord@nvidia.com>
      Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      18c2916c
    • Vlad Buslov's avatar
      net/mlx5: Bridge, extract code to lookup parent bridge of port · b99c4ef2
      Vlad Buslov authored
      The pattern when function looks up a port by vport_num+vhca_id tuple in
      order to just obtain its parent bridge is repeated multiple times in
      bridge.c file. Further commits in this series use the pattern even more.
      Extract the pattern to standalone mlx5_esw_bridge_from_port_lookup()
      function to improve code readability.
      
      This commits doesn't change functionality.
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Reviewed-by: default avatarMaor Dickman <maord@nvidia.com>
      Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      b99c4ef2
    • Vlad Buslov's avatar
      net/mlx5: Bridge, move additional data structures to priv header · 6767c97d
      Vlad Buslov authored
      Following patches in series will require accessing flow tables and groups
      sizes, table levels and struct mlx5_esw_bridge from new the new source file
      dedicated to multicast code. Expose these data in bridge_priv.h to reduce
      clutter in following patches that will implement the actual functionality.
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Reviewed-by: default avatarMaor Dickman <maord@nvidia.com>
      Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      6767c97d
    • Vlad Buslov's avatar
      net/mlx5: Bridge, increase bridge tables sizes · 9071b423
      Vlad Buslov authored
      Bridge ingress and egress tables got more flow groups recently for QinQ
      support and will get more in following patches of this series. Increase the
      sizes of the tables to allow offloading more flows in each mode.
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Reviewed-by: default avatarMaor Dickman <maord@nvidia.com>
      Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      9071b423
    • Vlad Buslov's avatar
      net/mlx5: Add mlx5_ifc definitions for bridge multicast support · e5688f6f
      Vlad Buslov authored
      Add the required hardware definitions to mlx5_ifc: fdb_uplink_hairpin,
      fdb_multi_path_any_table_limit_regc, fdb_multi_path_any_table.
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Reviewed-by: default avatarMaor Dickman <maord@nvidia.com>
      Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      e5688f6f
  2. 11 Apr, 2023 12 commits
  3. 10 Apr, 2023 9 commits
  4. 09 Apr, 2023 1 commit
    • Vladimir Oltean's avatar
      net: dsa: replace NETDEV_PRE_CHANGE_HWTSTAMP notifier with a stub · 5a178186
      Vladimir Oltean authored
      There was a sort of rush surrounding commit 88c0a6b5 ("net: create a
      netdev notifier for DSA to reject PTP on DSA master"), due to a desire
      to convert DSA's attempt to deny TX timestamping on a DSA master to
      something that doesn't block the kernel-wide API conversion from
      ndo_eth_ioctl() to ndo_hwtstamp_set().
      
      What was required was a mechanism that did not depend on ndo_eth_ioctl(),
      and what was provided was a mechanism that did not depend on
      ndo_eth_ioctl(), while at the same time introducing something that
      wasn't absolutely necessary - a new netdev notifier.
      
      There have been objections from Jakub Kicinski that using notifiers in
      general when they are not absolutely necessary creates complications to
      the control flow and difficulties to maintainers who look at the code.
      So there is a desire to not use notifiers.
      
      In addition to that, the notifier chain gets called even if there is no
      DSA in the system and no one is interested in applying any restriction.
      
      Take the model of udp_tunnel_nic_ops and introduce a stub mechanism,
      through which net/core/dev_ioctl.c can call into DSA even when
      CONFIG_NET_DSA=m.
      
      Compared to the code that existed prior to the notifier conversion, aka
      what was added in commits:
      - 4cfab356 ("net: dsa: Add wrappers for overloaded ndo_ops")
      - 3369afba ("net: Call into DSA netdevice_ops wrappers")
      
      this is different because we are not overloading any struct
      net_device_ops of the DSA master anymore, but rather, we are exposing a
      rather specific functionality which is orthogonal to which API is used
      to enable it - ndo_eth_ioctl() or ndo_hwtstamp_set().
      
      Also, what is similar is that both approaches use function pointers to
      get from built-in code to DSA.
      
      There is no point in replicating the function pointers towards
      __dsa_master_hwtstamp_validate() once for every CPU port (dev->dsa_ptr).
      Instead, it is sufficient to introduce a singleton struct dsa_stubs,
      built into the kernel, which contains a single function pointer to
      __dsa_master_hwtstamp_validate().
      
      I find this approach preferable to what we had originally, because
      dev->dsa_ptr->netdev_ops->ndo_do_ioctl() used to require going through
      struct dsa_port (dev->dsa_ptr), and so, this was incompatible with any
      attempts to add any data encapsulation and hide DSA data structures from
      the outside world.
      
      Link: https://lore.kernel.org/netdev/20230403083019.120b72fd@kernel.org/Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5a178186
  5. 08 Apr, 2023 7 commits