1. 27 Jul, 2018 4 commits
  2. 26 Jul, 2018 30 commits
  3. 25 Jul, 2018 6 commits
    • David S. Miller's avatar
      Merge branch 'mlxsw-Introduce-algorithmic-TCAM-support' · 756cd366
      David S. Miller authored
      Ido Schimmel says:
      
      ====================
      mlxsw: Introduce algorithmic TCAM support
      
      The Spectrum-2 ASIC uses an algorithmic TCAM (A-TCAM) where multiple
      exact matches lookups are performed instead of a single lookup as with
      standard circuit TCAM (C-TCAM) memory. This allows for higher scale and
      reduced power consumption.
      
      The lookups are performed by masking a packet using different masks
      (e.g., {dst_ip/24, ethtype}) defined for the region and looking for an
      exact match. Eventually, the rule with the highest priority will be
      picked.
      
      Since the number of masks per-region is limited, the ASIC includes a
      C-TCAM that can be used as a spill area for rules that do not fit into
      the A-TCAM.
      
      The driver currently uses a C-TCAM only mode which is similar to
      Spectrum-1. However, this mode severely limits both the number of
      supported ACL rules and the performance of the ACL lookup.
      
      This patch set introduces initial support for the A-TCAM mode where the
      C-TCAM is only used for rule spillage.
      
      The first five patches add the registers and ASIC resources needed in
      order to make use of the A-TCAM.
      
      Next three patches are the "meat" and add the eRP core which is used to
      manage the masks used by each ACL region. The individual commit messages
      are lengthy and aim to thoroughly explain the subject.
      
      The next seven patches perform small adjustments in the code and the
      related data structures and are meant to prepare the code base to the
      introduction of the A-TCAM in the last two patches.
      
      Various A-TCAM optimization will be the focus of follow-up patch sets:
      
      * Pruning - Used to reduce the number of lookups. Each rule will include
        a prune vector that indicates which masks should not be considered for
        further lookups as they cannot result in a higher priority match
      
      * Bloom filter - Used to reduce the number of lookups. Before performing
        a lookup with a given mask the ASIC will consult a bloom filter
        (managed by the driver) that indicates whether a match might exist using
        the considered mask
      
      * Masks aggregation - Used to increase scale and reduce lookups. Masks
        that only differ by up to eight consecutive bits (delta bits) can be
        aggregated into a single mask. The delta bits then become a part of the
        rule's key. For example, dst_ip/16 and dst_ip/17 can be represented as
        dst_ip/16 with a delta bit of one. Rules using the aggregated mask then
        specify whether the 17-th bit should be masked or not and its value
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      756cd366
    • Ido Schimmel's avatar
      mlxsw: spectrum_acl: Start using A-TCAM · a0a777b9
      Ido Schimmel authored
      Now that all the pieces are in place we can start using the A-TCAM
      instead of only using the C-TCAM. This allows for much higher scale and
      better performance (to be improved further by follow-up patch sets).
      
      Perform the integration with the A-TCAM and the eRP core by reverting
      the changes introduced by "mlxsw: spectrum_acl: Enable C-TCAM only mode
      in eRP core" and add calls from the C-TCAM code into the eRP core.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a0a777b9
    • Ido Schimmel's avatar
      mlxsw: spectrum_acl: Add A-TCAM rule insertion and deletion · a8758b67
      Ido Schimmel authored
      Implement rule insertion and deletion into the A-TCAM before we flip the
      driver to start using the A-TCAM.
      
      Rule insertion into the A-TCAM is very similar to C-TCAM, but there are
      subtle differences between regions of different sizes (i.e., different
      number of key blocks).
      
      Specifically, as explained in "mlxsw: spectrum_acl: Allow encoding a
      partial key", in 12 key blocks regions a rule is split into two and the
      two halves of the rule are linked using a "large entry key ID".
      
      Such differences are abstracted away by using different region
      operations per region type.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a8758b67
    • Ido Schimmel's avatar
      mlxsw: spectrum_acl: Pass C-TCAM region and entry to insert function · a20ff8eb
      Ido Schimmel authored
      When A-TCAM will be used together with C-TCAM, the C-TCAM code will need
      to call into the eRP core in order to get an eRP for an inserted entry.
      
      The eRP core takes an A-TCAM region as one of its arguments, so pass the
      C-TCAM region to the insertion function which will later allow us to
      derive the A-TCAM region, given it contains the C-TCAM one.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a20ff8eb
    • Ido Schimmel's avatar
      mlxsw: spectrum_acl: Add A-TCAM region initialization · 6d240650
      Ido Schimmel authored
      Before we start using the A-TCAM we need to make sure the region is
      properly initialized.
      
      This includes the setting of its type (which affects the size of its eRP
      table, for example) and its registration with the eRP core.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6d240650
    • Ido Schimmel's avatar
      mlxsw: spectrum_acl: Make global TCAM resources available to regions · f58df510
      Ido Schimmel authored
      Each TCAM region currently uses its own resources and there is no
      sharing between the different regions.
      
      This is going to change with A-TCAM as each region will need to allocate
      an eRP table from the global eRP tables array.
      
      Make the global TCAM resources available to each region by passing the
      TCAM private data to the region initialization routine.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f58df510