1. 16 Sep, 2020 13 commits
    • Petr Machata's avatar
      mlxsw: spectrum_buffers: Inline mlxsw_sp_sb_max_headroom_cells() · bd3e86a5
      Petr Machata authored
      This function is now only used from the buffers module, and is a trivial
      field reference. Just inline it and drop the related artifacts.
      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>
      bd3e86a5
    • Petr Machata's avatar
      mlxsw: spectrum_buffers: Move here the new headroom code · 4c22f29f
      Petr Machata authored
      Move all the headroom code to the spectrum_buffers module, where it
      belongs.
      
      Rename mlxsw_sp_pg_buf_threshold_get() and mlxsw_sp_pg_buf_pack() to
      ..._hdroom_... to match the naming convention of the new headroom code.
      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>
      4c22f29f
    • Petr Machata's avatar
      mlxsw: spectrum: Move here the three-step headroom configuration from DCB · 7ace2c36
      Petr Machata authored
      The ETS handler performs the headroom configuration in three steps: first
      it resizes the buffers and adds any new ones. Then it redirects priorities
      to the new buffers. And finally it sets the size of the now-unused buffers
      to zero. This way no packet drops are introduced.
      
      This sort of careful approach will also be useful for configuring port
      buffer sizes and priority map by hand, through dcbnl_setbuffer. Therefore
      move the code from the DCB handler to the generic headroom function.
      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>
      7ace2c36
    • Petr Machata's avatar
      mlxsw: spectrum_dcb: Convert mlxsw_sp_port_pg_prio_map() to hdroom code · e9c97e0e
      Petr Machata authored
      The new hdroom code has certain conventions: iteration over priorities is
      done through a variable named `prio', configuration is not pushed unless it
      is dirty, but a `force' flag can be used to override this, updated
      configuration is written to port. Convert the function
      mlxsw_sp_port_pg_prio_map() to use these conventions and rename
      appropriately to fit in.
      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>
      e9c97e0e
    • Petr Machata's avatar
      mlxsw: spectrum_dcb: Convert ETS handler fully to mlxsw_sp_hdroom_configure() · 8ec5e6b9
      Petr Machata authored
      The ETS handler performs the headroom configuration in three steps: first
      it resizes the buffers and adds any new ones. Then it redirects priorities
      to the new buffers. And finally it sets the size of the now-unused buffers
      to zero. This way no packet drops are introduced.
      
      Both of the buffer size configuration operations are simply buffer size
      configurations, there is no material difference between setting buffers to
      zero and any other value. Therefore simply invoke the same
      mlxsw_sp_hdroom_configure(), and drop mlxsw_sp_port_pg_destroy() and
      mlxsw_sp_ets_has_pg() which are now unused.
      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>
      8ec5e6b9
    • Petr Machata's avatar
      mlxsw: spectrum: Split headroom autoresize out of buffer configuration · 2d9f703f
      Petr Machata authored
      Split mlxsw_sp_port_headroom_set() to three functions.
      mlxsw_sp_hdroom_bufs_reset_sizes() changes the sizes of the individual PG
      buffers, and mlxsw_sp_hdroom_configure_buffers() will actually apply the
      configuration. A third function, mlxsw_sp_hdroom_bufs_fit(), verifies that
      the requested buffer configuration matches total headroom size
      requirements.
      
      Add wrappers, mlxsw_sp_hdroom_configure() and __..., that will eventually
      perform full headroom configuration, but for now, only have them verify the
      configured headroom size, and invoke mlxsw_sp_hdroom_configure_buffers().
      Have them take the `force` argument to prepare for a later patch, even
      though it is currently unused.
      
      Note that the loop in mlxsw_sp_hdroom_configure_buffers() only goes through
      DCBX_MAX_BUFFERS. Since there is no logic to configure the control buffer,
      it needs to keep the values queried from the FW. Eventually this function
      should configure all the PGs.
      
      Note that conversion of __mlxsw_sp_dcbnl_ieee_setets() is not trivial. That
      function performs the headroom configuration in three steps: first it
      resizes the buffers and adds any new ones. Then it redirects priorities to
      the new buffers. And finally it sets the size of the now-unused buffers to
      zero. This way no packet drops are introduced.
      
      So after invoking mlxsw_sp_hdroom_bufs_reset_sizes(), tweak the
      configuration to keep the old sizes of PG buffers for those buffers whose
      size was set to zero.
      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>
      2d9f703f
    • 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 27 commits