1. 10 Jun, 2021 10 commits
    • Vlad Buslov's avatar
      net/mlx5: Bridge, handle FDB events · 7cd6a54a
      Vlad Buslov authored
      Hardware supported by mlx5 driver doesn't provide learning and requires the
      driver to emulate all switch-like behavior in software. As such, all
      packets by default go through miss path, appear on representor and get to
      software bridge, if it is the upper device of the representor. This causes
      bridge to process packet in software, learn the MAC address to FDB and send
      SWITCHDEV_FDB_ADD_TO_DEVICE event to all subscribers.
      
      In order to offload FDB entries in mlx5, register switchdev notifier
      callback and implement support for both 'added_by_user' and dynamic FDB
      entry SWITCHDEV_FDB_ADD_TO_DEVICE events asynchronously using new
      mlx5_esw_bridge_offloads->wq ordered workqueue. In workqueue callback
      offload the ingress rule (matching FDB entry MAC as packet source MAC) and
      egress table rule (matching FDB entry MAC as destination MAC). For ingress
      table rule also match source vport to ensure that only traffic coming from
      expected bridge port is matched by offloaded rule. Save all the relevant
      FDB entry data in struct mlx5_esw_bridge_fdb_entry instance and insert the
      instance in new mlx5_esw_bridge->fdb_list list (for traversing all entries
      by software ageing implementation in following patch) and in new
      mlx5_esw_bridge->fdb_ht hash table for fast retrieval. Notify the bridge
      that FDB entry has been offloaded by sending SWITCHDEV_FDB_OFFLOADED
      notification.
      
      Delete FDB entry on reception of SWITCHDEV_FDB_DEL_TO_DEVICE event.
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Reviewed-by: default avatarJianbo Liu <jianbol@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      7cd6a54a
    • Vlad Buslov's avatar
      net/mlx5: Bridge, add offload infrastructure · 19e9bfa0
      Vlad Buslov authored
      Create new files bridge.{c|h} in en/rep directory that implement bridge
      interaction with representor netdevices and handle required
      events/notifications, bridge.{c|h} in esw directory that implement all
      necessary eswitch offloading infrastructure and works on vport/eswitch
      level. Provide new kconfig MLX5_BRIDGE which is automatically selected when
      both kernel bridge and mlx5 eswitch configs are enabled.
      
      Provide basic infrastructure for bridge offloads:
      
      - struct mlx5_esw_bridge_offloads - per-eswitch bridge offload structure
      that encapsulates generic bridge-offloads data (notifier blocks, ingress
      flow table/group, etc.) that is created/deleted on enable/disable eswitch
      offloads.
      
      - struct mlx5_esw_bridge - per-bridge structure that encapsulates
      per-bridge data (reference counter, FDB, egress flow table/group, etc.)
      that is created when first eswitch represetor is attached to new bridge and
      deleted when last representor is removed from the bridge as a result of
      NETDEV_CHANGEUPPER event.
      
      The bridge tables are created with new priority FDB_BR_OFFLOAD in FDB
      namespace. The new priority is between tc-miss and slow path priorities.
      Priority consist of two levels: the ingress table that is global per
      eswitch and matches incoming packets by src_mac/vid and redirects them to
      next level (egress table) that is chosen according to ingress port bridge
      membership and matches on dst_mac/vid in order to redirect packet to vport
      according to the following diagram:
      
                      +
                      |
            +---------v----------+
            |                    |
            |   FDB_TC_OFFLOAD   |
            |                    |
            +---------+----------+
                      |
                      |
            +---------v----------+
            |                    |
            |   FDB_FT_OFFLOAD   |
            |                    |
            +---------+----------+
                      |
                      |
            +---------v----------+
            |                    |
            |    FDB_TC_MISS     |
            |                    |
            +---------+----------+
                      |
      +--------------------------------------+
      |               |                      |
      |        +------+                      |
      |        |                             |
      | +------v--------+   FDB_BR_OFFLOAD   |
      | | INGRESS_TABLE |                    |
      | +------+---+----+                    |
      |        |   |      match              |
      |        |   +---------+               |
      |        |             |               |    +-------+
      |        |     +-------v-------+ match |    |       |
      |        |     | EGRESS_TABLE  +------------> vport |
      |        |     +-------+-------+       |    |       |
      |        |             |               |    +-------+
      |        |    miss     |               |
      |        +------+------+               |
      |               |                      |
      +--------------------------------------+
                      |
                      |
            +---------v----------+
            |                    |
            |   FDB_SLOW_PATH    |
            |                    |
            +---------+----------+
                      |
                      v
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Reviewed-by: default avatarJianbo Liu <jianbol@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      19e9bfa0
    • Vlad Buslov's avatar
      net/mlx5e: Refactor mlx5e_eswitch_{*}rep() helpers · 07810152
      Vlad Buslov authored
      Change the helper to functions to accept constant pointer to struct
      net_device. This is necessary for following patches in series that pass
      mlx5e_eswitch_rep() as a callback to kernel bridge infrastructure code.
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Reviewed-by: default avatarJianbo Liu <jianbol@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      07810152
    • Vlad Buslov's avatar
      net/mlx5: Create TC-miss priority and table · ec3be887
      Vlad Buslov authored
      In order to adhere to kernel software datapath model bridge offloads must
      come after TC and NF FDBs. Following patches in this series add new FDB
      priority for bridge after FDB_FT_OFFLOAD. However, since netfilter offload
      is implemented with unmanaged tables, its miss path is not automatically
      connected to next priority and requires the code to manually connect with
      slow table. To keep bridge offloads encapsulated and not mix it with
      eswitch offloads, create a new FDB_TC_MISS priority between FDB_FT_OFFLOAD
      and FDB_SLOW_PATH:
      
                +
                |
      +---------v----------+
      |                    |
      |   FDB_TC_OFFLOAD   |
      |                    |
      +---------+----------+
                |
                |
                |
      +---------v----------+
      |                    |
      |   FDB_FT_OFFLOAD   |
      |                    |
      +---------+----------+
                |
                |
                |
      +---------v----------+
      |                    |
      |    FDB_TC_MISS     |
      |                    |
      +---------+----------+
                |
                |
                |
      +---------v----------+
      |                    |
      |   FDB_SLOW_PATH    |
      |                    |
      +---------+----------+
                |
                v
      
      Initialize the new priority with single default empty managed table and use
      the table as TC/NF miss patch instead of slow table. This approach allows
      bridge offloads to be created as new FDB namespace priority between
      FDB_TC_MISS and FDB_SLOW_PATH without exposing its internal tables to any
      other modules since miss path of managed TC-miss table is automatically
      wired to next priority.
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Reviewed-by: default avatarJianbo Liu <jianbol@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      ec3be887
    • Yevgeny Kliteynik's avatar
      net/mlx5: DR, Support EMD tag in modify header for STEv1 · ded6a877
      Yevgeny Kliteynik authored
      Add support for EMD tag in modify header set/copy actions
      on device that supports STEv1.
      Signed-off-by: default avatarYevgeny Kliteynik <kliteyn@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      ded6a877
    • Yevgeny Kliteynik's avatar
      net/mlx5: DR, Added support for INSERT_HEADER reformat type · 7ea9b398
      Yevgeny Kliteynik authored
      Add support for INSERT_HEADER packet reformat context type
      Signed-off-by: default avatarYevgeny Kliteynik <kliteyn@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      7ea9b398
    • Yevgeny Kliteynik's avatar
      net/mlx5: Added new parameters to reformat context · 3f3f05ab
      Yevgeny Kliteynik authored
      Adding new reformat context type (INSERT_HEADER) requires adding two new
      parameters to reformat context - reformat_param_0 and reformat_param_1.
      As defined by HW spec, these parameters have different meaning for
      different reformat context type.
      
      The first parameter (reformat_param_0) is not new to HW spec, but it
      wasn't used by any of the supported reformats. The second parameter
      (reformat_param_1) is new to the HW spec - it was added to allow
      supporting INSERT_HEADER.
      
      For NSERT_HEADER, reformat_param_0 indicates the header used to
      reference the location of the inserted header, and reformat_param_1
      indicates the offset of the inserted header from the reference point
      defined by reformat_param_0.
      Signed-off-by: default avatarYevgeny Kliteynik <kliteyn@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      3f3f05ab
    • Yevgeny Kliteynik's avatar
      net/mlx5: DR, Allow encap action for RX for supporting devices · d7418b4e
      Yevgeny Kliteynik authored
      Encap actions on RX flow were not supported on older devices.
      However, this is no longer the case in devices that support STEv1.
      This patch adds support for encap l3/l2 on RX flow for supported
      devices: update actions state machine by adding the newely supported
      transitions and add the required support in STEv0/1 files.
      The new transitions that are supported are:
       - from decap/modify-header/pop-vlan to encap
       - from encap to termination table
      Signed-off-by: default avatarErez Shitrit <erezsh@nvidia.com>
      Signed-off-by: default avatarYevgeny Kliteynik <kliteyn@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      d7418b4e
    • Yevgeny Kliteynik's avatar
      net/mlx5: DR, Split reformat state to Encap and Decap · 28de41a4
      Yevgeny Kliteynik authored
      Split single reformat state into two separate states for encap and decap.
      This will allow adding actions to the specific domain, such as encap on RX.
      Signed-off-by: default avatarErez Shitrit <erezsh@nvidia.com>
      Signed-off-by: default avatarYevgeny Kliteynik <kliteyn@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      28de41a4
    • Yevgeny Kliteynik's avatar
      net/mlx5: mlx5_ifc support for header insert/remove · 67133eaa
      Yevgeny Kliteynik authored
      Add support for HCA caps 2 that contains capabilities for the new
      insert/remove header actions.
      
      Added the required definitions for supporting the new reformat type:
      added packet reformat parameters, reformat anchors and definitions
      to allow copy/set into the inserted EMD (Embedded MetaData) tag.
      Signed-off-by: default avatarYevgeny Kliteynik <kliteyn@nvidia.com>
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Reviewed-by: default avatarJianbo Liu <jianbol@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      67133eaa
  2. 09 Jun, 2021 30 commits