Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Mark Bloch <mbloch@nvidia.com>
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	Simon Horman <horms@kernel.org>
Cc: <saeedm@nvidia.com>, <gal@nvidia.com>, <leonro@nvidia.com>,
	<tariqt@nvidia.com>, Leon Romanovsky <leon@kernel.org>,
	<netdev@vger.kernel.org>, <linux-rdma@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, Mark Bloch <mbloch@nvidia.com>
Subject: [PATCH net-next v3 00/10] net/mlx5: HWS, Optimize matchers ICM usage
Date: Thu, 3 Jul 2025 21:54:21 +0300	[thread overview]
Message-ID: <20250703185431.445571-1-mbloch@nvidia.com> (raw)

This series optimizes ICM usage for unidirectional rules and
empty matchers and with the last patch we make hardware steering
the default FDB steering provider for NICs that don't support software
steering.

Hardware steering (HWS) uses a type of rule table container (RTC) that
is unidirectional, so matchers consist of two RTCs to accommodate
bidirectional rules.

This small series enables resizing the two RTCs independently by
tracking the number of rules separately. For extreme cases where all
rules are unidirectional, this results in saving close to half the
memory footprint.

Results for inserting 1M unidirectional rules using a simple module:

			Pages		Memory
Before this patch:	300k		1.5GiB
After this patch:	160k		900MiB

The 'Pages' column measures the number of 4KiB pages the device requests
for itself (the ICM).

The 'Memory' column is the difference between peak usage and baseline
usage (before starting the test) as reported by `free -h`.

In addition, second to last patch of the series handles a case where all
the matcher's rules were deleted: the large RTCs of the matcher are no
longer required, and we can save some more ICM by shrinking the matcher
to its initial size.

Finally the last patch makes hardware steering the default mode
when in swichdev for NICs that don't have software steering support.

Changelog
=========
Changes from v1:
- Fixed author on patches 5 and 6.
Changes from v2:
 - Added patch 4 that does only code refactoring.
 - Patch 5: this patch now contains the functional change only,
   w/o refactoring.
 - Patch 7: tracking flow_source in the BWC rule to resolve issue
   with rule_update of a unidirectional rule.
 - Added patch 8 that does code rearranging to prevent forward
   declaration in the following patch.
 - Patch 9: removed forward declaration of function.

Moshe Shemesh (1):
  net/mlx5: Add HWS as secondary steering mode

Vlad Dogaru (6):
  net/mlx5: HWS, remove unused create_dest_array parameter
  net/mlx5: HWS, Export rule skip logic
  net/mlx5: HWS, Refactor rule skip logic
  net/mlx5: HWS, Create STEs directly from matcher
  net/mlx5: HWS, Decouple matcher RX and TX sizes
  net/mlx5: HWS, Track matcher sizes individually

Yevgeny Kliteynik (3):
  net/mlx5: HWS, remove incorrect comment
  net/mlx5: HWS, Rearrange to prevent forward declaration
  net/mlx5: HWS, Shrink empty matchers

 .../net/ethernet/mellanox/mlx5/core/fs_core.c |   2 +
 .../mellanox/mlx5/core/steering/hws/action.c  |   7 +-
 .../mellanox/mlx5/core/steering/hws/bwc.c     | 529 ++++++++++++------
 .../mellanox/mlx5/core/steering/hws/bwc.h     |  15 +-
 .../mellanox/mlx5/core/steering/hws/debug.c   |  20 +-
 .../mellanox/mlx5/core/steering/hws/fs_hws.c  |  15 +-
 .../mellanox/mlx5/core/steering/hws/matcher.c | 166 ++++--
 .../mellanox/mlx5/core/steering/hws/matcher.h |   3 +-
 .../mellanox/mlx5/core/steering/hws/mlx5hws.h |  36 +-
 .../mellanox/mlx5/core/steering/hws/rule.c    |  34 +-
 .../mellanox/mlx5/core/steering/hws/rule.h    |   3 +
 11 files changed, 526 insertions(+), 304 deletions(-)


base-commit: 5f712c3877f99d5b5e4d011955c6467ae0e535a6
-- 
2.34.1


             reply	other threads:[~2025-07-03 18:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-03 18:54 Mark Bloch [this message]
2025-07-03 18:54 ` [PATCH net-next v3 01/10] net/mlx5: HWS, remove unused create_dest_array parameter Mark Bloch
2025-07-03 18:54 ` [PATCH net-next v3 02/10] net/mlx5: HWS, remove incorrect comment Mark Bloch
2025-07-03 18:54 ` [PATCH net-next v3 03/10] net/mlx5: HWS, Export rule skip logic Mark Bloch
2025-07-07 11:08   ` Simon Horman
2025-07-03 18:54 ` [PATCH net-next v3 04/10] net/mlx5: HWS, Refactor " Mark Bloch
2025-07-07 11:08   ` Simon Horman
2025-07-03 18:54 ` [PATCH net-next v3 05/10] net/mlx5: HWS, Create STEs directly from matcher Mark Bloch
2025-07-03 18:54 ` [PATCH net-next v3 06/10] net/mlx5: HWS, Decouple matcher RX and TX sizes Mark Bloch
2025-07-03 18:54 ` [PATCH net-next v3 07/10] net/mlx5: HWS, Track matcher sizes individually Mark Bloch
2025-07-07 11:09   ` Simon Horman
2025-07-03 18:54 ` [PATCH net-next v3 08/10] net/mlx5: HWS, Rearrange to prevent forward declaration Mark Bloch
2025-07-07 11:09   ` Simon Horman
2025-07-03 18:54 ` [PATCH net-next v3 09/10] net/mlx5: HWS, Shrink empty matchers Mark Bloch
2025-07-07 11:09   ` Simon Horman
2025-07-03 18:54 ` [PATCH net-next v3 10/10] net/mlx5: Add HWS as secondary steering mode Mark Bloch
2025-07-07 11:10   ` Simon Horman
2025-07-08  2:20 ` [PATCH net-next v3 00/10] net/mlx5: HWS, Optimize matchers ICM usage patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250703185431.445571-1-mbloch@nvidia.com \
    --to=mbloch@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=leonro@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox