• Ido Schimmel's avatar
    mlxsw: spectrum_port_range: Add port range core · b3eb04be
    Ido Schimmel authored
    The Spectrum ASICs have a fixed number of port range registers, each of
    which maintains the following parameters:
    
    * Minimum and maximum port.
    * Apply port range for source port, destination port or both.
    * Apply port range for TCP, UDP or both.
    * Apply port range for IPv4, IPv6 or both.
    
    Implement a port range core which takes care of the allocation and
    configuration of these registers and exposes an API that allows
    in-driver consumers (e.g., the ACL code) to request matching on a range
    of either source or destination port.
    
    These registers are going to be used for port range matching in the
    flower classifier that already matches on EtherType being IPv4 / IPv6 and
    IP protocol being TCP / UDP. As such, there is no need to limit these
    registers to a specific EtherType or IP protocol, which will increase
    the likelihood of a register being shared by multiple flower filters.
    
    It is unlikely that a filter will match on the same range of both source
    and destination ports, which is why each register is only configured to
    match on either source or destination port. If a filter requires
    matching on a range of both source and destination ports, it will
    utilize two port range registers and match on the output of both.
    
    For efficient lookup and traversal, use XArray to store the allocated
    port range registers. The XArray uses RCU and an internal spinlock to
    synchronise access, so there is no need for a dedicate lock.
    Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
    Reviewed-by: default avatarPetr Machata <petrm@nvidia.com>
    Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
    Link: https://lore.kernel.org/r/674f00539a0072d455847663b5feb504db51a259.1689092769.git.petrm@nvidia.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    b3eb04be
Makefile 1.55 KB