Skip to content

RFC mlx5: support per queue coalesce settings

Nabil S. Alramli lkml netdev 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest4 patches 3 repliesIn review
  2. v1 RFC1 patch 2 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4mlx5: Add mlx5e_param to individual mlx5e_channel and preserve them through mlx5e_open_channels()drivers/net/ethernet/mellanox/mlx5/core/en.h drivers/net/ethernet/mellanox/mlx5/core/en_main.c+28 -90 replies
2/4mlx5: Add queue number parameter to mlx5e_safe_switch_params()drivers/net/ethernet/mellanox/mlx5/core/en.h drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +2 more+42 -250 replies
3/4mlx5: Implement mlx5e_ethtool_{get,set}_per_queue_coalesce() to support per-queue operationsdrivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c+112 -400 replies
4/4mlx5: Add {get,set}_per_queue_coalesce()drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c+41 -50 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [net-next RFC v2 0/4] mlx5: support per queue coalesce settings

Hello,

This is v2 of my previous patch:
https://lore.kernel.org/lkml/[email protected]/.

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(-)
Signature · 1 line
2.35.1