Skip to contentSkip to conversation

devlink: rate objects API

PATCH Jakub Kicinski 2 participants 4 messages Apr 20, 2021 – May 5, 2021 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#1 lore raw
In reply to a message not in the archive
Quoted 8 lines · On Tue, 20 Apr 2021 14:33:36 +0300 [email protected] wrote:

From: Dmytro Linkin <[email protected]>

Currently kernel provides a way to change tx rate of single VF in switchdev mode via tc-police action. When lots of VFs are configured management of theirs rates becomes non-trivial task and some grouping mechanism is required. Implementing such grouping in tc-police will bring flow related limitations and unwanted complications, like:
- flows requires net device to be placed on

Meaning they are only usable in "switchdev mode"?

Quoted 2 lines

- effect of limiting depends on the position of tc-police action in the pipeline

Could you expand? tc-police is usually expected to be first.

Quoted 1 line

- etc.

Please expand.

Quoted 17 lines

According to that devlink is the most appropriate place.

This series introduces devlink API for managing tx rate of single devlink port or of a group by invoking callbacks (see below) of corresponding driver. Also devlink port or a group can be added to the parent group, where driver responsible to handle rates of a group elements. To achieve all of that new rate object is added. It can be one of the two types:
- leaf - represents a single devlink port; created/destroyed by the driver and bound to the devlink port. As example, some driver may create leaf rate object for every devlink port associated with VF. Since leaf have 1to1 mapping to it's devlink port, in user space it is referred as pci/<bus_addr>/<port_index>;
- node - represents a group of rate objects; created/deleted by request from the userspace; initially empty (no rate objects added). In userspace it is referred as pci/<bus_addr>/<node_name>, where node name can be any, except decimal number, to avoid collisions with leafs.

Quoted 4 lines

devlink_ops extended with following callbacks:
- rate_{leaf|node}_tx_{share|max}_set
- rate_node_{new|del}
- rate_{leaf|node}_parent_set

Tx is incorrect. You're setting an admission rate limiter on the port.

Quoted 11 lines

KAPI provides:
- creation/destruction of the leaf rate object associated with devlink port
- storing/retrieving driver specific data in rate object

UAPI provides:
- dumping all or single rate objects
- setting tx_{share|max} of rate object of any type
- creating/deleting node rate object
- setting/unsetting parent of any rate object

Quoted 8 lines

Add devlink rate object support for netdevsim driver.
To support devlink rate objects implement VF ports and eswitch mode selector for netdevsim driver.

Issues/open questions:
- Does user need DEVLINK_CMD_RATE_DEL_ALL_CHILD command to clean all children of particular parent node? For example:

  $ devlink port func rate flush netdevsim/netdevsim10/group

Is this an RFC? There is no real user in this set.

#2 lore raw
Quoted 11 lines · Jakub Kicinski
Quoted 8 lines · On Tue, 20 Apr 2021 14:33:36 +0300 [email protected] wrote:

From: Dmytro Linkin <[email protected]>

Currently kernel provides a way to change tx rate of single VF in switchdev mode via tc-police action. When lots of VFs are configured management of theirs rates becomes non-trivial task and some grouping mechanism is required. Implementing such grouping in tc-police will bring flow related limitations and unwanted complications, like:
- flows requires net device to be placed on

Meaning they are only usable in "switchdev mode"?

Meaning, "groups" wouldn't have corresponding net devices and needs somehow to deal with that. I'll rephrase this line.

Quoted 5 lines
Quoted 3 lines

- effect of limiting depends on the position of tc-police action in the pipeline

Could you expand? tc-police is usually expected to be first.

Ok

Quoted 4 lines
Quoted 2 lines

- etc.

Please expand.

Ok

Quoted 40 lines
Quoted 18 lines

According to that devlink is the most appropriate place.

This series introduces devlink API for managing tx rate of single devlink port or of a group by invoking callbacks (see below) of corresponding driver. Also devlink port or a group can be added to the parent group, where driver responsible to handle rates of a group elements. To achieve all of that new rate object is added. It can be one of the two types:
- leaf - represents a single devlink port; created/destroyed by the driver and bound to the devlink port. As example, some driver may create leaf rate object for every devlink port associated with VF. Since leaf have 1to1 mapping to it's devlink port, in user space it is referred as pci/<bus_addr>/<port_index>;
- node - represents a group of rate objects; created/deleted by request from the userspace; initially empty (no rate objects added). In userspace it is referred as pci/<bus_addr>/<node_name>, where node name can be any, except decimal number, to avoid collisions with leafs.

Quoted 4 lines

devlink_ops extended with following callbacks:
- rate_{leaf|node}_tx_{share|max}_set
- rate_node_{new|del}
- rate_{leaf|node}_parent_set

Tx is incorrect. You're setting an admission rate limiter on the port.

Quoted 15 lines

KAPI provides:
- creation/destruction of the leaf rate object associated with devlink port
- storing/retrieving driver specific data in rate object

UAPI provides:
- dumping all or single rate objects
- setting tx_{share|max} of rate object of any type
- creating/deleting node rate object
- setting/unsetting parent of any rate object

Add devlink rate object support for netdevsim driver.
To support devlink rate objects implement VF ports and eswitch mode selector for netdevsim driver.

Quoted 6 lines
Quoted 4 lines

Issues/open questions:
- Does user need DEVLINK_CMD_RATE_DEL_ALL_CHILD command to clean all children of particular parent node? For example:

  $ devlink port func rate flush netdevsim/netdevsim10/group

Is this an RFC? There is no real user in this set.

Yes. I'll resend patches anyway, because of issue with smtp server

Quoted 1 line
author maintainer
#3 lore raw
Quoted 11 lines · On Wed, 21 Apr 2021 15:08:07 +0300 Dmytro Linkin wrote:
Quoted 10 lines · Jakub Kicinski
Quoted 8 lines · On Tue, 20 Apr 2021 14:33:36 +0300 [email protected] wrote:

From: Dmytro Linkin <[email protected]>

Currently kernel provides a way to change tx rate of single VF in switchdev mode via tc-police action. When lots of VFs are configured management of theirs rates becomes non-trivial task and some grouping mechanism is required. Implementing such grouping in tc-police will bring flow related limitations and unwanted complications, like:
- flows requires net device to be placed on

Quoted 4 lines
Quoted 1 line

Meaning they are only usable in "switchdev mode"?

Meaning, "groups" wouldn't have corresponding net devices and needs somehow to deal with that. I'll rephrase this line.

But you can share a police action across netdevs. A deeper analysis of the capabilities of the current subsystem would be appreciated before we commit to this (less expressive) implementation.

#4 lore raw
Quoted 12 lines · Jakub Kicinski
Quoted 11 lines · On Wed, 21 Apr 2021 15:08:07 +0300 Dmytro Linkin wrote:
Quoted 10 lines · Jakub Kicinski
Quoted 8 lines · On Tue, 20 Apr 2021 14:33:36 +0300 [email protected] wrote:

From: Dmytro Linkin <[email protected]>

Currently kernel provides a way to change tx rate of single VF in switchdev mode via tc-police action. When lots of VFs are configured management of theirs rates becomes non-trivial task and some grouping mechanism is required. Implementing such grouping in tc-police will bring flow related limitations and unwanted complications, like:
- flows requires net device to be placed on

Quoted 9 lines
Quoted 4 lines
Quoted 1 line

Meaning they are only usable in "switchdev mode"?

Meaning, "groups" wouldn't have corresponding net devices and needs somehow to deal with that. I'll rephrase this line.

But you can share a police action across netdevs. A deeper analysis of the capabilities of the current subsystem would be appreciated before we commit to this (less expressive) implementation.

Hi, Sorry for a delay in answering.

We have a customer request for a traffic shaper for a group of VFs. tc-police action is a policer, so shared action isn't suitable. Since request was more about group shaper, was reviewed a case when representor have a policer and the driver will use a shaper if qdisc action is continue and qdisc contains group of vf – but such approach ugly, complicated and misleading.
Also TC is ingress only, while configuring "other" side of the wire looks more like a “real” picture where shaping is outside of steering world.