netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nabil S. Alramli" <dev@nalramli.com>
To: netdev@vger.kernel.org, saeedm@nvidia.com, saeed@kernel.org,
	kuba@kernel.org, davem@davemloft.net, tariqt@nvidia.com,
	linux-kernel@vger.kernel.org, leon@kernel.org
Cc: jdamato@fastly.com, sbhogavilli@fastly.com, nalramli@fastly.com,
	"Nabil S. Alramli" <dev@nalramli.com>
Subject: [net-next RFC v2 0/4] mlx5: support per queue coalesce settings
Date: Mon, 18 Sep 2023 18:29:51 -0400	[thread overview]
Message-ID: <20230918222955.2066-1-dev@nalramli.com> (raw)
In-Reply-To: <ZOemz1HLp95aGXXQ@x130>

Hello,

This is v2 of my previous patch:
https://lore.kernel.org/lkml/20230823223121.58676-1-dev@nalramli.com/.

Saeed: Thanks for reviewing v1. I made significant changes to support
per-channel DIM settings. Is this ready for an official v1 submission or
are there other major changes you'd like to see before I do that?

***************************************************************************
Version History
---------------
* v1: Initial draft, individual channel DIM changes not supported.
* v2: Support individual channel DIM changes.
***************************************************************************

Currently, only gobal coalescing configuration queries or changes are
supported in the `mlx5` driver. However, per-queue operations are not, and
result in `EOPNOTSUPP` errors when attempted with `ethtool`. This patch
adds support for per-queue coalesce operations.

Here's an example use case:

- A mlx5 NIC is configured with 8 queues, each queue has its IRQ pinned to
  a unique CPU.
- Two custom RSS contexts are created: context 1 and context 2. Each
  context has a different set of queues where flows are distributed. For
  example, context 1 may distribute flows to queues 0-3, and context 2 may
  distribute flows to queues 4-7.
- A series of ntuple filters are installed which direct matching flows to
  RSS contexts. For example, perhaps port 80 is directed to context 1 and
  port 443 to context 2.
- Applications which receive network data associated with either context
  are pinned to the CPUs where the queues in the matching context have
  their IRQs pinned to maximize locality.

The apps themselves, however, may have different requirements on latency vs
CPU usage and so setting the per queue IRQ coalesce values would be very
helpful.

This patch would support this. In v1 DIM mode changes could only be changed
NIC-wide. However, in this iteration, DIM mode changes are supported
globally as well as on a per-queue basis.

Here's an example:

```
$ sudo ethtool --per-queue eth0 queue_mask 0x4 --show-coalesce
Queue: 2
Adaptive RX: on  TX: on
stats-block-usecs: 0
sample-interval: 0
pkt-rate-low: 0
pkt-rate-high: 0

rx-usecs: 8
rx-frames: 128
rx-usecs-irq: 0
rx-frames-irq: 0

tx-usecs: 8
tx-frames: 128
tx-usecs-irq: 0
tx-frames-irq: 0
```

Now, let's try to set adaptive-rx off rx-usecs 16 for queue 2:

```
$ sudo ethtool --per-queue eth0 queue_mask 0x4 --coalesce adaptive-rx off
$ sudo ethtool --per-queue eth0 queue_mask 0x4 --coalesce rx-usecs 16
```

Confirm that the operation succeeded:

```
$ sudo ethtool --per-queue eth0 queue_mask 0x4 --show-coalesce
Queue: 2
Adaptive RX: off  TX: on
stats-block-usecs: 0
sample-interval: 0
pkt-rate-low: 0
pkt-rate-high: 0

rx-usecs: 16
rx-frames: 32
rx-usecs-irq: 0
rx-frames-irq: 0

tx-usecs: 8
tx-frames: 128
tx-usecs-irq: 0
tx-frames-irq: 0
```

The individual channel settings do not overwrite the global ones. However
Setting the global parameters will also reset all of the individual channel
options. For example, after we set the options for queue 2, we'll see that
the global options remain unchanged:
```
$ sudo ethtool --show-coalesce eth0
Coalesce parameters for eth0:
Adaptive RX: on  TX: on
stats-block-usecs: 0
sample-interval: 0
pkt-rate-low: 0
pkt-rate-high: 0

rx-usecs: 8
rx-frames: 128
rx-usecs-irq: 0
rx-frames-irq: 0

tx-usecs: 16
tx-frames: 32
tx-usecs-irq: 0
tx-frames-irq: 0
```

But then if we set them, we'll see that the options for queue 2 have been
reset as well:
```
$ sudo ethtool --coalesce eth0 adaptive-tx off

$ sudo ethtool --show-coalesce eth0
Coalesce parameters for eth0:
Adaptive RX: on  TX: off
stats-block-usecs: 0
sample-interval: 0
pkt-rate-low: 0
pkt-rate-high: 0

rx-usecs: 8
rx-frames: 128
rx-usecs-irq: 0
rx-frames-irq: 0

tx-usecs: 16
tx-frames: 32
tx-usecs-irq: 0
tx-frames-irq: 0

$ sudo ethtool --per-queue eth0 queue_mask 0x4 --show-coalesce
Queue: 2
Adaptive RX: on  TX: off
stats-block-usecs: 0
sample-interval: 0
pkt-rate-low: 0
pkt-rate-high: 0

rx-usecs: 8
rx-frames: 128
rx-usecs-irq: 0
rx-frames-irq: 0

tx-usecs: 16
tx-frames: 32
tx-usecs-irq: 0
tx-frames-irq: 0
```

Previously a global `struct mlx5e_params` stored the options in
`struct mlx5e_priv.channels.params`. That was preserved, but a channel-
specific instance was added as well, in `struct mlx5e_channel.params`.

Best Regards,

***************************************************************************

Nabil S. Alramli (4):
  mlx5: Add mlx5e_param to individual mlx5e_channel and preserve them
    through mlx5e_open_channels()
  mlx5: Add queue number parameter to mlx5e_safe_switch_params()
  mlx5: Implement mlx5e_ethtool_{get,set}_per_queue_coalesce() to
    support per-queue operations
  mlx5: Add {get,set}_per_queue_coalesce()

 drivers/net/ethernet/mellanox/mlx5/core/en.h  |   6 +-
 .../ethernet/mellanox/mlx5/core/en_dcbnl.c    |   2 +-
 .../ethernet/mellanox/mlx5/core/en_ethtool.c  | 214 +++++++++++++-----
 .../net/ethernet/mellanox/mlx5/core/en_main.c |  76 +++++--
 .../ethernet/mellanox/mlx5/core/ipoib/ipoib.c |   2 +-
 5 files changed, 222 insertions(+), 78 deletions(-)

-- 
2.35.1


  parent reply	other threads:[~2023-09-18 22:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23 22:31 [net-next RFC 0/1] mlx5: support per queue coalesce settings Nabil S. Alramli
2023-08-23 22:31 ` [net-next RFC 1/1] mlx5: Add {get,set}_per_queue_coalesce() Nabil S. Alramli
2023-08-24 18:51 ` [net-next RFC 0/1] mlx5: support per queue coalesce settings Saeed Mahameed
2023-08-25  0:26   ` Nabil S. Alramli
2023-09-18 22:29   ` Nabil S. Alramli [this message]
2023-09-18 22:29     ` [net-next RFC v2 1/4] mlx5: Add mlx5e_param to individual mlx5e_channel and preserve them through mlx5e_open_channels() Nabil S. Alramli
2023-09-18 22:29     ` [net-next RFC v2 2/4] mlx5: Add queue number parameter to mlx5e_safe_switch_params() Nabil S. Alramli
2023-09-18 22:29     ` [net-next RFC v2 3/4] mlx5: Implement mlx5e_ethtool_{get,set}_per_queue_coalesce() to support per-queue operations Nabil S. Alramli
2023-09-18 22:29     ` [net-next RFC v2 4/4] mlx5: Add {get,set}_per_queue_coalesce() Nabil S. Alramli
2023-09-19 18:55     ` [net-next RFC v2 0/4] mlx5: support per queue coalesce settings Rahul Rameshbabu
2023-09-19 20:42       ` Nabil S. Alramli
2023-10-06 21:46         ` Rahul Rameshbabu

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=20230918222955.2066-1-dev@nalramli.com \
    --to=dev@nalramli.com \
    --cc=davem@davemloft.net \
    --cc=jdamato@fastly.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nalramli@fastly.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeed@kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=sbhogavilli@fastly.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;
as well as URLs for NNTP newsgroup(s).