1. 16 Sep, 2020 7 commits
    • Petr Machata's avatar
      mlxsw: spectrum: Track buffer sizes in struct mlxsw_sp_hdroom · aa7c0621
      Petr Machata authored
      So far, port buffers were always autoconfigured. When dcbnl_setbuffer
      callback is implemented, it will allow the user to change the buffer size
      configuration by hand. The sizes therefore need to be a configuration
      parameter, not always deduced, and therefore belong to struct
      mlxsw_sp_hdroom, where the configuration routine should take them from.
      
      Update mlxsw_sp_port_headroom_set() to update these sizes. Have the
      function update the sizes even for the case that a given buffer is not
      used.
      
      Additionally, change the loop iteration end to DCBX_MAX_BUFFERS instead of
      IEEE_8021QAZ_MAX_TCS. The value is the same, but the semantics differ.
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      aa7c0621
    • Petr Machata's avatar
      mlxsw: spectrum: Track lossiness in struct mlxsw_sp_hdroom · ca21e84e
      Petr Machata authored
      Client-side configuration has lossiness as an attribute of a priority.
      Therefore add a "lossy" attribute to struct mlxsw_sp_hdroom_prio.
      
      To a Spectrum ASIC, lossiness is a feature of a port buffer. Therefore add
      struct mlxsw_sp_hdroom_buf, which in the following patches will get more
      attributes, but right now only use it to track port buffer lossiness.
      
      Instead of passing around the primary indicators of PFC and pause_en, add a
      function mlxsw_sp_hdroom_bufs_reset_lossiness() to compute the buffer
      lossiness from the priority map and priority lossiness. Change
      mlxsw_sp_port_headroom_set() to take the buffer lossy flag from the
      headroom configuration. Have the PFC and pause handlers configure priority
      lossiness in mlxsw_sp_hdroom, from where it will propagate.
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ca21e84e
    • Petr Machata's avatar
      mlxsw: spectrum: Track priorities in struct mlxsw_sp_hdroom · 5df825ed
      Petr Machata authored
      The mapping from priorities to buffers determines which buffers should be
      configured. Lossiness of these priorities combined with the mapping
      determines whether a given buffer should be lossy.
      
      Currently this configuration is stored implicitly in DCB ETS, PFC and
      ethtool PAUSE configuration. Keeping it together with the rest of the
      headroom configuration and deriving it as needed from PFC / ETS / PAUSE
      will make things clearer. To that end, add a field "prios" to struct
      mlxsw_sp_hdroom.
      
      Previously, __mlxsw_sp_port_headroom_set() took prio_tc as an argument, and
      assumed that the same mapping as we use on the egress should be used on
      ingress as well. Instead, track this configuration at each priority, so
      that it can be adjusted flexibly.
      
      In the following patches, as dcbnl_setbuffer is implemented, it will need
      to store its own mapping, and it will also be sometimes necessary to revert
      back to the original ETS mapping. Therefore track two buffer indices: the
      one for chip configuration (buf_idx), and the source one (ets_buf_idx).
      Introduce a function to configure the chip-level buffer index, and for now
      have it simply copy the ETS mapping over to the chip mapping.
      
      Update the ETS handler to project prio_tc to the ets_buf_idx and invoke the
      buf_idx recomputation.
      
      Now that there is a canonical place to look for this configuration,
      mlxsw_sp_port_headroom_set() does not need to invent def_prio_tc to use if
      DCB is compiled out.
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5df825ed
    • Petr Machata's avatar
      mlxsw: spectrum: Track MTU in struct mlxsw_sp_hdroom · 0103a3e4
      Petr Machata authored
      MTU influences sizes of auto-allocated buffers. Make it a part of port
      buffer configuration and have __mlxsw_sp_port_headroom_set() take it from
      there, instead of as an argument.
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0103a3e4
    • Petr Machata's avatar
      mlxsw: spectrum: Unify delay handling between PFC and pause · b7e07bbd
      Petr Machata authored
      When a priority is marked as lossless using DCB PFC, or when pause frames
      are enabled on a port, mlxsw adds to port buffers an extra space to cover
      the traffic that will arrive between the time that a pause or PFC frame is
      emitted, and the time traffic actually stops. This is called the delay. The
      concept is the same in PFC and pause, however the way the extra buffer
      space is calculated differs.
      
      In this patch, unify this handling. Delay is to be measured in bytes of
      extra space, and will not include MTU. PFC handler sets the delay directly
      from the parameter it gets through the DCB interface.
      
      To convert pause handler, move MLXSW_SP_PAUSE_DELAY to ethtool module,
      convert to bytes, and reduce it by maximum MTU, and divide by two. Then it
      has the same meaning as the delay_bytes set by the PFC handler.
      
      Keep the delay_bytes value in struct mlxsw_sp_hdroom introduced in the
      previous patch. Change PFC and pause handlers to store the new delay value
      there and have __mlxsw_sp_port_headroom_set() take it from there.
      
      Instead of mlxsw_sp_pfc_delay_get() and mlxsw_sp_pg_buf_delay_get(),
      introduce mlxsw_sp_hdroom_buf_delay_get() to calculate the delay provision.
      Drop the unnecessary MLXSW_SP_CELL_FACTOR, and instead add an explanatory
      comment describing the formula used.
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b7e07bbd
    • Petr Machata's avatar
      mlxsw: spectrum_buffers: Add struct mlxsw_sp_hdroom · 3a77f5a2
      Petr Machata authored
      The port headroom handling is currently strewn across several modules and
      tricky to follow: MTU, DCB PFC, DCB ETS and ethtool pause all influence the
      settings, and then there is the completely separate initial configuraion in
      spectrum_buffers. A following patch will implement the dcbnl_setbuffer
      callback, which is going to further complicate the landscape.
      
      In order to simplify work with port buffers, the following patches are
      going to centralize all port-buffer handling in spectrum_buffers. As a
      first step, introduce a (currently empty) struct mlxsw_sp_hdroom that will
      keep the configuration parameters, and allocate and free it in appropriate
      places.
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3a77f5a2
    • David S. Miller's avatar
      Merge tag 'mlx5-updates-2020-09-15' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux · 045e42f3
      David S. Miller authored
      Saeed Mahameed says:
      
      ====================
      mlx5-updates-2020-09-15
      
      Various updates to mlx5 driver,
      
      1) Eli adds support for TC trap action.
      2) Eran, minor improvements to clock.c code structure
      3) Better handling of error reporting in LAG from Jianbo
      4) IPv6 traffic class (DSCP) header rewrite support from Maor
      5) Ofer Levi adds support for CQE compression of multi-strides packets
      6) Vu, Enables use of vport meta data by default.
      7) Some minor code cleanup
      ====================
      Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      045e42f3
  2. 15 Sep, 2020 33 commits