netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v9 0/9] Implement devlink-rate API and extend it
@ 2022-11-04 14:30 Michal Wilczynski
  2022-11-04 14:30 ` [PATCH net-next v9 1/9] devlink: Introduce new attribute 'tx_priority' to devlink-rate Michal Wilczynski
                   ` (9 more replies)
  0 siblings, 10 replies; 28+ messages in thread
From: Michal Wilczynski @ 2022-11-04 14:30 UTC (permalink / raw)
  To: netdev
  Cc: alexandr.lobakin, jacob.e.keller, jesse.brandeburg,
	przemyslaw.kitszel, anthony.l.nguyen, kuba, ecree.xilinx, jiri,
	Michal Wilczynski

This patch series implements devlink-rate for ice driver. Unfortunately
current API isn't flexible enough for our use case, so there is a need to
extend it. Some functions have been introduced to enable the driver to
export current Tx scheduling configuration.

Pasting justification for this series from commit implementing devlink-rate
in ice driver(that is a part of this series):

There is a need to support modification of Tx scheduler tree, in the
ice driver. This will allow user to control Tx settings of each node in
the internal hierarchy of nodes. As a result user will be able to use
Hierarchy QoS implemented entirely in the hardware.

This patch implemenents devlink-rate API. It also exports initial
default hierarchy. It's mostly dictated by the fact that the tree
can't be removed entirely, all we can do is enable the user to modify
it. For example root node shouldn't ever be removed, also nodes that
have children are off-limits.

Example initial tree with 2 VF's:

[root@fedora ~]# devlink port function rate show
pci/0000:4b:00.0/node_27: type node parent node_26
pci/0000:4b:00.0/node_26: type node parent node_0
pci/0000:4b:00.0/node_34: type node parent node_33
pci/0000:4b:00.0/node_33: type node parent node_32
pci/0000:4b:00.0/node_32: type node parent node_16
pci/0000:4b:00.0/node_19: type node parent node_18
pci/0000:4b:00.0/node_18: type node parent node_17
pci/0000:4b:00.0/node_17: type node parent node_16
pci/0000:4b:00.0/node_21: type node parent node_20
pci/0000:4b:00.0/node_20: type node parent node_3
pci/0000:4b:00.0/node_14: type node parent node_5
pci/0000:4b:00.0/node_5: type node parent node_3
pci/0000:4b:00.0/node_13: type node parent node_4
pci/0000:4b:00.0/node_12: type node parent node_4
pci/0000:4b:00.0/node_11: type node parent node_4
pci/0000:4b:00.0/node_10: type node parent node_4
pci/0000:4b:00.0/node_9: type node parent node_4
pci/0000:4b:00.0/node_8: type node parent node_4
pci/0000:4b:00.0/node_7: type node parent node_4
pci/0000:4b:00.0/node_6: type node parent node_4
pci/0000:4b:00.0/node_4: type node parent node_3
pci/0000:4b:00.0/node_3: type node parent node_16
pci/0000:4b:00.0/node_16: type node parent node_15
pci/0000:4b:00.0/node_15: type node parent node_0
pci/0000:4b:00.0/node_2: type node parent node_1
pci/0000:4b:00.0/node_1: type node parent node_0
pci/0000:4b:00.0/node_0: type node
pci/0000:4b:00.0/1: type leaf parent node_27
pci/0000:4b:00.0/2: type leaf parent node_27


Let me visualize part of the tree:

                        +---------+
                        |  node_0 |
                        +---------+
                             |
                        +----v----+
                        | node_26 |
                        +----+----+
                             |
                        +----v----+
                        | node_27 |
                        +----+----+
                             |
                    |-----------------|
               +----v----+       +----v----+
               |   VF 1  |       |   VF 2  |
               +----+----+       +----+----+

So at this point there is a couple things that can be done.
For example we could only assign parameters to VF's.

[root@fedora ~]# devlink port function rate set pci/0000:4b:00.0/1 \
                 tx_max 5Gbps

This would cap the VF 1 BW to 5Gbps.

But let's say you would like to create a completely new branch.
This can be done like this:

[root@fedora ~]# devlink port function rate add \
                 pci/0000:4b:00.0/node_custom parent node_0
[root@fedora ~]# devlink port function rate add \
                 pci/0000:4b:00.0/node_custom_1 parent node_custom
[root@fedora ~]# devlink port function rate set \
                 pci/0000:4b:00.0/1 parent node_custom_1

This creates a completely new branch and reassigns VF 1 to it.

A number of parameters is supported per each node: tx_max, tx_share,
tx_priority and tx_weight.


V9:
 - changed misleading name from 'parameter' to 'attribute'
 - removed mechanism referring for kernel object by string,
   now it's referring to them as pointers
 - removed limiting name size in devl_rate_node_create()
 - removed commit that allowed for change of priv in set_parent
   callback
 - added commit that allows for pre-allocation of ice_sched
   elements


V8:
- address minor formatting issues
- fix memory leak
- address warnings

V7:
- split into smaller commits
- paste justification for this series to cover letter

V6:
- replaced strncpy with strscpy
- renamed rate_vport -> rate_leaf

V5:
- removed queue support per community request
- fix division of 64bit variable with 32bit divisor by using div_u64()
- remove RDMA, ADQ exlusion as it's not necessary anymore
- changed how driver exports configuration, as queues are not supported
  anymore
- changed IDA to Xarray for unique node identification


V4:
- changed static variable counter to per port IDA to
  uniquely identify nodes

V3:
- removed shift macros, since FIELD_PREP is used
- added static_assert for struct
- removed unnecessary functions
- used tab instead of space in define

V2:
- fixed Alexandr comments
- refactored code to fix checkpatch issues
- added mutual exclusion for RDMA, DCB


Michal Wilczynski (9):
  devlink: Introduce new attribute 'tx_priority' to devlink-rate
  devlink: Introduce new attribute 'tx_weight' to devlink-rate
  devlink: Enable creation of the devlink-rate nodes from the driver
  devlink: Allow for devlink-rate nodes parent reassignment
  devlink: Allow to set up parent in devl_rate_leaf_create()
  ice: Introduce new parameters in ice_sched_node
  ice: Add an option to pre-allocate memory for ice_sched_node
  ice: Implement devlink-rate API
  ice: Prevent ADQ, DCB coexistence with Custom Tx scheduler

 .../net/ethernet/intel/ice/ice_adminq_cmd.h   |   4 +-
 drivers/net/ethernet/intel/ice/ice_common.c   |   7 +-
 drivers/net/ethernet/intel/ice/ice_dcb.c      |   2 +-
 drivers/net/ethernet/intel/ice/ice_dcb_lib.c  |   4 +
 drivers/net/ethernet/intel/ice/ice_devlink.c  | 483 ++++++++++++++++++
 drivers/net/ethernet/intel/ice/ice_devlink.h  |   2 +
 drivers/net/ethernet/intel/ice/ice_repr.c     |  13 +
 drivers/net/ethernet/intel/ice/ice_sched.c    | 101 +++-
 drivers/net/ethernet/intel/ice/ice_sched.h    |  31 +-
 drivers/net/ethernet/intel/ice/ice_type.h     |   9 +
 .../mellanox/mlx5/core/esw/devlink_port.c     |  14 +-
 drivers/net/netdevsim/dev.c                   |   9 +-
 include/net/devlink.h                         |  18 +-
 include/uapi/linux/devlink.h                  |   3 +
 net/core/devlink.c                            | 133 ++++-
 15 files changed, 799 insertions(+), 34 deletions(-)

-- 
2.37.2


^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2022-11-08 22:35 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-04 14:30 [PATCH net-next v9 0/9] Implement devlink-rate API and extend it Michal Wilczynski
2022-11-04 14:30 ` [PATCH net-next v9 1/9] devlink: Introduce new attribute 'tx_priority' to devlink-rate Michal Wilczynski
2022-11-04 15:35   ` Jiri Pirko
2022-11-05  2:07   ` Jakub Kicinski
2022-11-07 18:15     ` Wilczynski, Michal
2022-11-05  2:10   ` Jakub Kicinski
2022-11-07 18:15     ` Wilczynski, Michal
2022-11-08 16:48     ` Jacob Keller
2022-11-04 14:30 ` [PATCH net-next v9 2/9] devlink: Introduce new attribute 'tx_weight' " Michal Wilczynski
2022-11-04 15:36   ` Jiri Pirko
2022-11-04 14:30 ` [PATCH net-next v9 3/9] devlink: Enable creation of the devlink-rate nodes from the driver Michal Wilczynski
2022-11-04 15:39   ` Jiri Pirko
2022-11-04 14:30 ` [PATCH net-next v9 4/9] devlink: Allow for devlink-rate nodes parent reassignment Michal Wilczynski
2022-11-04 14:30 ` [PATCH net-next v9 5/9] devlink: Allow to set up parent in devl_rate_leaf_create() Michal Wilczynski
2022-11-04 15:40   ` Jiri Pirko
2022-11-04 14:30 ` [PATCH net-next v9 6/9] ice: Introduce new parameters in ice_sched_node Michal Wilczynski
2022-11-04 14:31 ` [PATCH net-next v9 7/9] ice: Add an option to pre-allocate memory for ice_sched_node Michal Wilczynski
2022-11-05  2:12   ` Jakub Kicinski
2022-11-04 14:31 ` [PATCH net-next v9 8/9] ice: Implement devlink-rate API Michal Wilczynski
2022-11-04 14:31 ` [PATCH net-next v9 9/9] ice: Prevent ADQ, DCB coexistence with Custom Tx scheduler Michal Wilczynski
2022-11-05  2:05 ` [PATCH net-next v9 0/9] Implement devlink-rate API and extend it Jakub Kicinski
2022-11-07 18:18   ` Wilczynski, Michal
2022-11-07 18:31     ` Jakub Kicinski
2022-11-08  8:08       ` Wilczynski, Michal
2022-11-08  8:36         ` Wilczynski, Michal
2022-11-08 22:34           ` Jakub Kicinski
2022-11-08 16:54         ` Jacob Keller
2022-11-08 18:10           ` Wilczynski, Michal

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).