netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: netdev@vger.kernel.org
Cc: Jakub Kicinski <kuba@kernel.org>, Jiri Pirko <jiri@resnulli.us>,
	Madhu Chittim <madhu.chittim@intel.com>,
	Sridhar Samudrala <sridhar.samudrala@intel.com>,
	Simon Horman <horms@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	Sunil Kovvuri Goutham <sgoutham@marvell.com>,
	Jamal Hadi Salim <jhs@mojatatu.com>
Subject: [PATCH v3 00/12] net: introduce TX H/W shaping API
Date: Tue, 30 Jul 2024 22:39:43 +0200	[thread overview]
Message-ID: <cover.1722357745.git.pabeni@redhat.com> (raw)

We have a plurality of shaping-related drivers API, but none flexible
enough to meet existing demand from vendors[1].

This series introduces new device APIs to configure in a flexible way
TX H/W shaping. The new functionalities are exposed via a newly
defined generic netlink interface and include introspection
capabilities. Some self-tests are included, on top of a dummy
netdevsim implementation, and a basic implementation for the iavf
driver.

Some usage examples:

* Configure shaping on a given queue:

./tools/net/ynl/cli.py --spec Documentation/netlink/specs/shaper.yaml \
	--do set --json '{"ifindex":'$IFINDEX',
			"shaper": {"handle":
				{"scope": "queue", "id":'$QUEUEID' },
			"bw-max": 2000000 }}'

* Container B/W sharing

The orchestration infrastructure wants to group the 
container-related queues under a RR scheduling and limit the aggregate
bandwidth:

./tools/net/ynl/cli.py --spec Documentation/netlink/specs/shaper.yaml \
	--do group --json '{"ifindex":'$IFINDEX', 
			"inputs": [ 
			  {"handle": {"scope": "queue", "id":'$QID1' },
			   "weight": '$W1'}, 
			  {"handle": {"scope": "queue", "id":'$QID2' },
			   "weight": '$W2'}], 
			  {"handle": {"scope": "queue", "id":'$QID3' },
			   "weight": '$W3'}], 
			"output": { "handle": {"scope":"netdev"},
			"output": { "handle": {"scope":"netdev"},
			   "bw-max": 10000000}}'
{'handle': {'id': 0, 'scope': 'netdev'}}

* Delegation

A container wants to set a B/W limit on 2 of its own queues:

./tools/net/ynl/cli.py --spec Documentation/netlink/specs/shaper.yaml \
	--do group --json '{"ifindex":'$IFINDEX', 
			"inputs": [ 
			  {"handle": {"scope": "queue", "id":'$QID1' },
			   "weight": '$W1'}, 
			  {"handle": {"scope": "queue", "id":'$QID2' },
			   "weight": '$W2'}], 
			"output": { "handle": {"scope":"detached"},
			   "bw-max": 5000000}}'
{'handle': {'id': 0, 'scope': 'detached'}}

* Cleanup:

Deleting a single queue shaper:

./tools/net/ynl/cli.py --spec Documentation/netlink/specs/shaper.yaml \
	--do delete --json \
	'{"ifindex":'$IFINDEX', 
	  "handle": {"scope": "queue", "id":'$QID1' }}'

deleting the last shaper under a group deletes the group, too:

./tools/net/ynl/cli.py --spec Documentation/netlink/specs/shaper.yaml \
	--do delete --json \
	'{"ifindex":'$IFINDEX', 
	  "handle": {"scope": "queue", "id":'$QID2' }}'
./tools/net/ynl/cli.py --spec Documentation/netlink/specs/shaper.yaml \
        --do get --json '{"ifindex":'$IF', 
			  "handle": { "scope": "detached", "id": 0}}'
Netlink error: Invalid argument
nl_len = 80 (64) nl_flags = 0x300 nl_type = 2
	error: -22
	extack: {'msg': "Can't find shaper for handle 10000000"}

Changes from RFC v2:
 - added patch 1
 - fixed deprecated API usage

RFC v2: https://lore.kernel.org/netdev/cover.1721851988.git.pabeni@redhat.com/

Changes from RFC v1:
 - set() and delete() ops operate on a single shaper
 - added group() op to allow grouping and nesting
 - split the NL implementation into multiple patches to help reviewing

RFC v1: https://lore.kernel.org/netdev/cover.1719518113.git.pabeni@redhat.com/

[1] https://lore.kernel.org/netdev/20240405102313.GA310894@kernel.org/

Paolo Abeni (8):
  tools: ynl: lift an assumption about spec file name
  netlink: spec: add shaper YAML spec
  net-shapers: implement NL get operation
  net-shapers: implement NL set and delete operations
  net-shapers: implement NL group operation
  netlink: spec: add shaper introspection support
  net: shaper: implement introspection support
  testing: net-drv: add basic shaper test

Sudheer Mogilappagari (2):
  iavf: Add net_shaper_ops support
  iavf: add support to exchange qos capabilities

Wenjun Wu (2):
  virtchnl: support queue rate limit and quanta size configuration
  ice: Support VF queue rate limit and quanta size configuration

 Documentation/netlink/specs/shaper.yaml       | 337 ++++++
 Documentation/networking/kapi.rst             |   3 +
 MAINTAINERS                                   |   1 +
 drivers/net/Kconfig                           |   1 +
 drivers/net/ethernet/intel/Kconfig            |   1 +
 drivers/net/ethernet/intel/iavf/iavf.h        |  13 +
 drivers/net/ethernet/intel/iavf/iavf_main.c   | 215 +++-
 drivers/net/ethernet/intel/iavf/iavf_txrx.h   |   2 +
 .../net/ethernet/intel/iavf/iavf_virtchnl.c   | 157 ++-
 drivers/net/ethernet/intel/ice/ice.h          |   2 +
 drivers/net/ethernet/intel/ice/ice_base.c     |   2 +
 drivers/net/ethernet/intel/ice/ice_common.c   |  21 +
 .../net/ethernet/intel/ice/ice_hw_autogen.h   |   8 +
 drivers/net/ethernet/intel/ice/ice_txrx.h     |   1 +
 drivers/net/ethernet/intel/ice/ice_type.h     |   1 +
 drivers/net/ethernet/intel/ice/ice_vf_lib.h   |   8 +
 drivers/net/ethernet/intel/ice/ice_virtchnl.c | 333 ++++++
 drivers/net/ethernet/intel/ice/ice_virtchnl.h |  11 +
 .../intel/ice/ice_virtchnl_allowlist.c        |   6 +
 drivers/net/netdevsim/netdev.c                |  37 +
 include/linux/avf/virtchnl.h                  | 119 +++
 include/linux/netdevice.h                     |  17 +
 include/net/net_shaper.h                      | 169 +++
 include/uapi/linux/net_shaper.h               |  91 ++
 net/Kconfig                                   |   3 +
 net/Makefile                                  |   1 +
 net/core/dev.c                                |   2 +
 net/core/dev.h                                |   6 +
 net/shaper/Makefile                           |   9 +
 net/shaper/shaper.c                           | 963 ++++++++++++++++++
 net/shaper/shaper_nl_gen.c                    | 142 +++
 net/shaper/shaper_nl_gen.h                    |  30 +
 tools/net/ynl/ynl-gen-c.py                    |   6 +-
 tools/testing/selftests/drivers/net/Makefile  |   1 +
 tools/testing/selftests/drivers/net/shaper.py | 267 +++++
 .../testing/selftests/net/lib/py/__init__.py  |   1 +
 tools/testing/selftests/net/lib/py/ynl.py     |   5 +
 37 files changed, 2988 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/netlink/specs/shaper.yaml
 create mode 100644 include/net/net_shaper.h
 create mode 100644 include/uapi/linux/net_shaper.h
 create mode 100644 net/shaper/Makefile
 create mode 100644 net/shaper/shaper.c
 create mode 100644 net/shaper/shaper_nl_gen.c
 create mode 100644 net/shaper/shaper_nl_gen.h
 create mode 100755 tools/testing/selftests/drivers/net/shaper.py

-- 
2.45.2


             reply	other threads:[~2024-07-30 20:41 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-30 20:39 Paolo Abeni [this message]
2024-07-30 20:39 ` [PATCH v3 01/12] tools: ynl: lift an assumption about spec file name Paolo Abeni
2024-07-30 20:39 ` [PATCH v3 02/12] netlink: spec: add shaper YAML spec Paolo Abeni
2024-07-31 21:13   ` Donald Hunter
2024-08-01 14:31     ` Paolo Abeni
2024-08-02 10:57       ` Jiri Pirko
2024-08-02 11:15       ` Donald Hunter
2024-08-05 14:35         ` Paolo Abeni
2024-08-05 20:37           ` Jakub Kicinski
2024-08-01 13:10   ` Jiri Pirko
2024-08-01 14:40     ` Jakub Kicinski
2024-08-01 15:12     ` Paolo Abeni
2024-08-02 10:49       ` Jiri Pirko
2024-08-05 15:11         ` Paolo Abeni
2024-08-06  7:06           ` Jiri Pirko
2024-08-12 14:58             ` Paolo Abeni
2024-08-12 15:25               ` Jakub Kicinski
2024-08-12 16:50                 ` Jiri Pirko
2024-08-12 17:42                   ` Jakub Kicinski
2024-08-13  5:38                     ` Jiri Pirko
2024-08-13 14:12                       ` Jakub Kicinski
2024-08-13 14:47                         ` Paolo Abeni
2024-08-13 14:58                           ` Jakub Kicinski
2024-08-13 15:31                             ` Paolo Abeni
2024-08-13 15:43                               ` Jakub Kicinski
2024-08-14  8:56                           ` Donald Hunter
2024-08-13 17:12                 ` Donald Hunter
2024-08-14 14:21                   ` Paolo Abeni
2024-08-15  9:07                     ` Donald Hunter
2024-08-02 11:19   ` Jiri Pirko
2024-08-02 11:26   ` Jiri Pirko
2024-08-02 16:04   ` Jiri Pirko
2024-07-30 20:39 ` [PATCH v3 03/12] net-shapers: implement NL get operation Paolo Abeni
2024-08-01 13:42   ` Jiri Pirko
2024-08-13 15:17     ` Paolo Abeni
2024-08-14  8:37       ` Jiri Pirko
2024-08-16  8:52         ` Paolo Abeni
2024-08-16  9:16           ` Jiri Pirko
2024-08-19  9:33             ` Paolo Abeni
2024-08-19 11:53               ` Jiri Pirko
2024-08-19 16:52                 ` Paolo Abeni
2024-08-22 12:02                   ` Jiri Pirko
2024-08-22 14:41                     ` Jakub Kicinski
2024-08-22 20:30                       ` Paolo Abeni
2024-08-22 22:56                         ` Jakub Kicinski
2024-08-23 11:50                           ` Jiri Pirko
2024-08-23 12:58                             ` Paolo Abeni
2024-08-23 13:36                               ` Jiri Pirko
2024-08-23 14:23                                 ` Paolo Abeni
2024-08-26  9:31                                   ` Jiri Pirko
2024-08-27 14:37                                     ` Paolo Abeni
2024-08-27 14:54                                       ` Jakub Kicinski
2024-08-27 20:43                                         ` Paolo Abeni
2024-08-27 21:03                                           ` Jakub Kicinski
2024-08-27 21:54                                             ` Paolo Abeni
2024-08-28  6:40                                               ` Jiri Pirko
2024-08-28 10:55                                                 ` Paolo Abeni
2024-08-28 13:02                                                   ` Jiri Pirko
2024-08-28 20:30                                                   ` Jakub Kicinski
2024-08-28 21:13                                                     ` Paolo Abeni
2024-08-29 11:45                                                       ` Jiri Pirko
2024-08-01 15:09   ` Jakub Kicinski
2024-08-02 11:53   ` Jiri Pirko
2024-07-30 20:39 ` [PATCH v3 04/12] net-shapers: implement NL set and delete operations Paolo Abeni
2024-08-01 15:00   ` Jakub Kicinski
2024-08-01 15:25     ` Paolo Abeni
2024-08-01 15:39       ` Jakub Kicinski
2024-08-02 16:15         ` Jiri Pirko
2024-08-02 22:01           ` Jakub Kicinski
2024-08-05 15:23           ` Paolo Abeni
2024-07-30 20:39 ` [PATCH v3 05/12] net-shapers: implement NL group operation Paolo Abeni
2024-07-30 20:39 ` [PATCH v3 06/12] netlink: spec: add shaper introspection support Paolo Abeni
2024-08-02 11:21   ` Donald Hunter
2024-07-30 20:39 ` [PATCH v3 07/12] net: shaper: implement " Paolo Abeni
2024-07-30 20:39 ` [PATCH v3 08/12] testing: net-drv: add basic shaper test Paolo Abeni
2024-07-31  7:52   ` Paolo Abeni
2024-08-01  1:55     ` Jakub Kicinski
2024-08-05 14:22       ` Simon Horman
2024-08-05 19:36         ` Jakub Kicinski
2024-08-06 15:21           ` Simon Horman
2024-08-08 12:20             ` Simon Horman
2024-08-08 14:17               ` Jakub Kicinski
2024-08-08 14:34                 ` Simon Horman
2024-08-11 12:40                   ` Simon Horman
2024-08-12 15:31                     ` Jakub Kicinski
2024-08-12 16:03                 ` Paolo Abeni
2024-07-30 20:39 ` [PATCH v3 09/12] virtchnl: support queue rate limit and quanta size configuration Paolo Abeni
2024-07-30 20:39 ` [PATCH v3 10/12] ice: Support VF " Paolo Abeni
2024-07-30 20:39 ` [PATCH v3 11/12] iavf: Add net_shaper_ops support Paolo Abeni
2024-07-30 20:39 ` [PATCH v3 12/12] iavf: add support to exchange qos capabilities Paolo Abeni
2024-08-01 12:57 ` [PATCH v3 00/12] net: introduce TX H/W shaping API Jiri Pirko

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=cover.1722357745.git.pabeni@redhat.com \
    --to=pabeni@redhat.com \
    --cc=horms@kernel.org \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=madhu.chittim@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=sgoutham@marvell.com \
    --cc=sridhar.samudrala@intel.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).