mbox series

[pull,request,net-next,00/12] mlx5 updates-2020-11-03

Message ID 20201103194738.64061-1-saeedm@nvidia.com
Headers show
Series mlx5 updates-2020-11-03 | expand

Message

Saeed Mahameed Nov. 3, 2020, 7:47 p.m. UTC
Hi Jakub,

This series makes some updates to mlx5 software steering.
and some other misc trivial changes.

For more information please see tag log below.

For the DR memory buddy allocator series, Yevgeny has updated
the implementation according to Dave's request [1] and got rid of
the bit array optimization and moved back to standard buddy
allocator implementation.

[1] https://patchwork.ozlabs.org/project/netdev/patch/20200925193809.463047-2-saeed@kernel.org/

Please pull and let me know if there is any problem.

Thanks,
Saeed.

---
The following changes since commit 6d89076e6ef09337a29a7b1ea4fdf2d892be9650:

  Merge branch 'net-mac80211-kernel-enable-kcov-remote-coverage-collection-for-802-11-frame-handling' (2020-11-02 18:01:46 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-updates-2020-11-03

for you to fetch changes up to 1c4cdf9aca10e949829ae56f4ab2f7dfa8098096:

  net: mlx5: Replace in_irq() usage (2020-11-03 11:40:03 -0800)

----------------------------------------------------------------
mlx5-updates-2020-11-03

This series includes updates to mlx5 software steering component.

1) Few improvements in the DR area, such as removing unneeded checks,
  renaming to better general names, refactor in some places, etc.

2) Software steering (DR) Memory management improvements

This patch series contains SW Steering memory management improvements:
using buddy allocator instead of an existing bucket allocator, and
several other optimizations.

The buddy system is a memory allocation and management algorithm
that manages memory in power of two increments.

The algorithm is well-known and well-described, such as here:
https://en.wikipedia.org/wiki/Buddy_memory_allocation

Linux uses this algorithm for managing and allocating physical pages,
as described here:
https://www.kernel.org/doc/gorman/html/understand/understand009.html

In our case, although the algorithm in principal is similar to the
Linux physical page allocator, the "building blocks" and the circumstances
are different: in SW steering, buddy allocator doesn't really allocates
a memory, but rather manages ICM (Interconnect Context Memory) that was
previously allocated and registered.

The ICM memory that is used in SW steering is always power
of 2 (order), so buddy system is a good fit for this.

Patches in this series:

[PATH 4] net/mlx5: DR, Add buddy allocator utilities
  This patch adds a modified implementation of a well-known buddy allocator,
  adjusted for SW steering needs: the algorithm in principal is similar to
  the Linux physical page allocator, but in our case buddy allocator doesn't
  really allocate a memory, but rather manages ICM memory that was previously
  allocated and registered.

[PATH 5] net/mlx5: DR, Handle ICM memory via buddy allocation instead of bucket management
  This patch changes ICM management of SW steering to use buddy-system mechanism
  Instead of the previous bucket management.

[PATH 6] net/mlx5: DR, Sync chunks only during free
  This patch makes syncing happen only when freeing memory chunks.

[PATH 7] net/mlx5: DR, ICM memory pools sync optimization
  This patch adds tracking of pool's "hot" memory and makes the
  check whether steering sync is required much shorter and faster.

[PATH 8] net/mlx5: DR, Free buddy ICM memory if it is unused
  This patch adds tracking buddy's used ICM memory,
  and frees the buddy if all its memory becomes unused.

3) Misc code cleanups

----------------------------------------------------------------
Saeed Mahameed (2):
      net/mlx4: Cleanup kernel-doc warnings
      net/mlx5: Cleanup kernel-doc warnings

Sebastian Andrzej Siewior (1):
      net: mlx5: Replace in_irq() usage

Vladyslav Tarasiuk (1):
      net/mlx5e: Validate stop_room size upon user input

Yevgeny Kliteynik (8):
      net/mlx5: DR, Remove unused member of action struct
      net/mlx5: DR, Rename builders HW specific names
      net/mlx5: DR, Rename matcher functions to be more HW agnostic
      net/mlx5: DR, Add buddy allocator utilities
      net/mlx5: DR, Handle ICM memory via buddy allocation instead of buckets
      net/mlx5: DR, Sync chunks only during free
      net/mlx5: DR, ICM memory pools sync optimization
      net/mlx5: DR, Free unused buddy ICM memory

 drivers/net/ethernet/mellanox/mlx4/fw_qos.h        |   2 +-
 drivers/net/ethernet/mellanox/mlx5/core/Makefile   |   2 +-
 .../net/ethernet/mellanox/mlx5/core/en/params.c    |  34 ++
 .../net/ethernet/mellanox/mlx5/core/en/params.h    |   4 +
 .../ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c |   8 +-
 .../mellanox/mlx5/core/en_accel/ktls_txrx.h        |   2 +-
 .../mellanox/mlx5/core/en_accel/tls_rxtx.c         |   6 +-
 .../mellanox/mlx5/core/en_accel/tls_rxtx.h         |   4 +-
 .../net/ethernet/mellanox/mlx5/core/en_ethtool.c   |   5 +
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c  |  30 +-
 drivers/net/ethernet/mellanox/mlx5/core/eq.c       |  18 +-
 drivers/net/ethernet/mellanox/mlx5/core/fpga/sdk.h |   8 +-
 .../mellanox/mlx5/core/steering/dr_buddy.c         | 170 +++++++
 .../ethernet/mellanox/mlx5/core/steering/dr_cmd.c  |   4 +-
 .../mellanox/mlx5/core/steering/dr_icm_pool.c      | 501 ++++++++-------------
 .../mellanox/mlx5/core/steering/dr_matcher.c       | 107 +++--
 .../ethernet/mellanox/mlx5/core/steering/dr_ste.c  |  42 +-
 .../mellanox/mlx5/core/steering/dr_types.h         |  79 ++--
 .../ethernet/mellanox/mlx5/core/steering/mlx5dr.h  |  32 ++
 19 files changed, 591 insertions(+), 467 deletions(-)
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/steering/dr_buddy.c

Comments

Jakub Kicinski Nov. 4, 2020, 10:02 p.m. UTC | #1
On Tue, 3 Nov 2020 11:47:35 -0800 Saeed Mahameed wrote:
> From: Vladyslav Tarasiuk <vladyslavt@nvidia.com>

> 

> Stop room is a space that may be taken by WQEs in the SQ during a packet

> transmit. It is used to check if next packet has enough room in the SQ.

> Stop room guarantees this packet can be served and if not, the queue is

> stopped, so no more packets are passed to the driver until it's ready.

> 

> Currently, stop_room size is calculated and validated upon tx queues

> allocation. This makes it impossible to know if user provided valid

> input for certain parameters when interface is down.

> 

> Instead, store stop_room in mlx5e_sq_param and create

> mlx5e_validate_params(), to validate its fields upon user input even

> when the interface is down.

> 

> Signed-off-by: Vladyslav Tarasiuk <vladyslavt@nvidia.com>

> Reviewed-by: Tariq Toukan <tariqt@nvidia.com>

> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>


32 bit build wants you to use %zd or such: 

drivers/net/ethernet/mellanox/mlx5/core/en/params.c: In function ‘mlx5e_validate_params’:
drivers/net/ethernet/mellanox/mlx5/core/en/params.c:182:72: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘size_t’ {aka ‘unsigned int’} [-Wformat=]
  182 |   netdev_err(priv->netdev, "Stop room %hu is bigger than the SQ size %lu\n",
      |                                                                      ~~^
      |                                                                        |
      |                                                                        long unsigned int
      |                                                                      %u
  183 |       stop_room, sq_size);
      |                  ~~~~~~~                                                
      |                  |
      |                  size_t {aka unsigned int}
Saeed Mahameed Nov. 5, 2020, 12:38 a.m. UTC | #2
On Wed, 2020-11-04 at 14:02 -0800, Jakub Kicinski wrote:
> On Tue, 3 Nov 2020 11:47:35 -0800 Saeed Mahameed wrote:

> > From: Vladyslav Tarasiuk <vladyslavt@nvidia.com>

> > 

> > Stop room is a space that may be taken by WQEs in the SQ during a

> > packet

> > transmit. It is used to check if next packet has enough room in the

> > SQ.

> > Stop room guarantees this packet can be served and if not, the

> > queue is

> > stopped, so no more packets are passed to the driver until it's

> > ready.

> > 

> > Currently, stop_room size is calculated and validated upon tx

> > queues

> > allocation. This makes it impossible to know if user provided valid

> > input for certain parameters when interface is down.

> > 

> > Instead, store stop_room in mlx5e_sq_param and create

> > mlx5e_validate_params(), to validate its fields upon user input

> > even

> > when the interface is down.

> > 

> > Signed-off-by: Vladyslav Tarasiuk <vladyslavt@nvidia.com>

> > Reviewed-by: Tariq Toukan <tariqt@nvidia.com>

> > Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>

> 

> 32 bit build wants you to use %zd or such: 

> 


We do not test 32 bit. Will fix this,
Thanks.

> drivers/net/ethernet/mellanox/mlx5/core/en/params.c: In function

> ‘mlx5e_validate_params’:

> drivers/net/ethernet/mellanox/mlx5/core/en/params.c:182:72: warning:

> format ‘%lu’ expects argument of type ‘long unsigned int’, but

> argument 4 has type ‘size_t’ {aka ‘unsigned int’} [-Wformat=]

>   182 |   netdev_err(priv->netdev, "Stop room %hu is bigger than the

> SQ size %lu\n",

>       |                                                              

>         ~~^

>       |                                                              

>           |

>       |                                                              

>           long unsigned int

>       |                                                              

>         %u

>   183 |       stop_room, sq_size);

>       |                  ~~~~~~~                                     

>            

>       |                  |

>       |                  size_t {aka unsigned int}