<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">---------- Forwarded message ---------<br>From: <strong class="gmail_sendername" dir="auto">Paolo Abeni</strong> <span dir="auto"><<a href="mailto:pabeni@redhat.com">pabeni@redhat.com</a>></span><br>Date: Tue, Jul 30, 2024 at 1:41 PM<br>Subject: [PATCH v3 00/12] net: introduce TX H/W shaping API<br>To:  <<a href="mailto:netdev@vger.kernel.org">netdev@vger.kernel.org</a>><br>Cc: Jakub Kicinski <<a href="mailto:kuba@kernel.org">kuba@kernel.org</a>>, Jiri Pirko <<a href="mailto:jiri@resnulli.us">jiri@resnulli.us</a>>, Madhu Chittim <<a href="mailto:madhu.chittim@intel.com">madhu.chittim@intel.com</a>>, Sridhar Samudrala <<a href="mailto:sridhar.samudrala@intel.com">sridhar.samudrala@intel.com</a>>, Simon Horman <<a href="mailto:horms@kernel.org">horms@kernel.org</a>>, John Fastabend <<a href="mailto:john.fastabend@gmail.com">john.fastabend@gmail.com</a>>, Sunil Kovvuri Goutham <<a href="mailto:sgoutham@marvell.com">sgoutham@marvell.com</a>>, Jamal Hadi Salim <<a href="mailto:jhs@mojatatu.com">jhs@mojatatu.com</a>><br></div><br><br>We have a plurality of shaping-related drivers API, but none flexible<br>
enough to meet existing demand from vendors[1].<br>
<br>
This series introduces new device APIs to configure in a flexible way<br>
TX H/W shaping. The new functionalities are exposed via a newly<br>
defined generic netlink interface and include introspection<br>
capabilities. Some self-tests are included, on top of a dummy<br>
netdevsim implementation, and a basic implementation for the iavf<br>
driver.<br>
<br>
Some usage examples:<br>
<br>
* Configure shaping on a given queue:<br>
<br>
./tools/net/ynl/cli.py --spec Documentation/netlink/specs/shaper.yaml \<br>
        --do set --json '{"ifindex":'$IFINDEX',<br>
                        "shaper": {"handle":<br>
                                {"scope": "queue", "id":'$QUEUEID' },<br>
                        "bw-max": 2000000 }}'<br>
<br>
* Container B/W sharing<br>
<br>
The orchestration infrastructure wants to group the <br>
container-related queues under a RR scheduling and limit the aggregate<br>
bandwidth:<br>
<br>
./tools/net/ynl/cli.py --spec Documentation/netlink/specs/shaper.yaml \<br>
        --do group --json '{"ifindex":'$IFINDEX', <br>
                        "inputs": [ <br>
                          {"handle": {"scope": "queue", "id":'$QID1' },<br>
                           "weight": '$W1'}, <br>
                          {"handle": {"scope": "queue", "id":'$QID2' },<br>
                           "weight": '$W2'}], <br>
                          {"handle": {"scope": "queue", "id":'$QID3' },<br>
                           "weight": '$W3'}], <br>
                        "output": { "handle": {"scope":"netdev"},<br>
                        "output": { "handle": {"scope":"netdev"},<br>
                           "bw-max": 10000000}}'<br>
{'handle': {'id': 0, 'scope': 'netdev'}}<br>
<br>
* Delegation<br>
<br>
A container wants to set a B/W limit on 2 of its own queues:<br>
<br>
./tools/net/ynl/cli.py --spec Documentation/netlink/specs/shaper.yaml \<br>
        --do group --json '{"ifindex":'$IFINDEX', <br>
                        "inputs": [ <br>
                          {"handle": {"scope": "queue", "id":'$QID1' },<br>
                           "weight": '$W1'}, <br>
                          {"handle": {"scope": "queue", "id":'$QID2' },<br>
                           "weight": '$W2'}], <br>
                        "output": { "handle": {"scope":"detached"},<br>
                           "bw-max": 5000000}}'<br>
{'handle': {'id': 0, 'scope': 'detached'}}<br>
<br>
* Cleanup:<br>
<br>
Deleting a single queue shaper:<br>
<br>
./tools/net/ynl/cli.py --spec Documentation/netlink/specs/shaper.yaml \<br>
        --do delete --json \<br>
        '{"ifindex":'$IFINDEX', <br>
          "handle": {"scope": "queue", "id":'$QID1' }}'<br>
<br>
deleting the last shaper under a group deletes the group, too:<br>
<br>
./tools/net/ynl/cli.py --spec Documentation/netlink/specs/shaper.yaml \<br>
        --do delete --json \<br>
        '{"ifindex":'$IFINDEX', <br>
          "handle": {"scope": "queue", "id":'$QID2' }}'<br>
./tools/net/ynl/cli.py --spec Documentation/netlink/specs/shaper.yaml \<br>
        --do get --json '{"ifindex":'$IF', <br>
                          "handle": { "scope": "detached", "id": 0}}'<br>
Netlink error: Invalid argument<br>
nl_len = 80 (64) nl_flags = 0x300 nl_type = 2<br>
        error: -22<br>
        extack: {'msg': "Can't find shaper for handle 10000000"}<br>
<br>
Changes from RFC v2:<br>
 - added patch 1<br>
 - fixed deprecated API usage<br>
<br>
RFC v2: <a href="https://lore.kernel.org/netdev/cover.1721851988.git.pabeni@redhat.com/" rel="noreferrer" target="_blank">https://lore.kernel.org/netdev/cover.1721851988.git.pabeni@redhat.com/</a><br>
<br>
Changes from RFC v1:<br>
 - set() and delete() ops operate on a single shaper<br>
 - added group() op to allow grouping and nesting<br>
 - split the NL implementation into multiple patches to help reviewing<br>
<br>
RFC v1: <a href="https://lore.kernel.org/netdev/cover.1719518113.git.pabeni@redhat.com/" rel="noreferrer" target="_blank">https://lore.kernel.org/netdev/cover.1719518113.git.pabeni@redhat.com/</a><br>
<br>
[1] <a href="https://lore.kernel.org/netdev/20240405102313.GA310894@kernel.org/" rel="noreferrer" target="_blank">https://lore.kernel.org/netdev/20240405102313.GA310894@kernel.org/</a><br>
<br>
Paolo Abeni (8):<br>
  tools: ynl: lift an assumption about spec file name<br>
  netlink: spec: add shaper YAML spec<br>
  net-shapers: implement NL get operation<br>
  net-shapers: implement NL set and delete operations<br>
  net-shapers: implement NL group operation<br>
  netlink: spec: add shaper introspection support<br>
  net: shaper: implement introspection support<br>
  testing: net-drv: add basic shaper test<br>
<br>
Sudheer Mogilappagari (2):<br>
  iavf: Add net_shaper_ops support<br>
  iavf: add support to exchange qos capabilities<br>
<br>
Wenjun Wu (2):<br>
  virtchnl: support queue rate limit and quanta size configuration<br>
  ice: Support VF queue rate limit and quanta size configuration<br>
<br>
 Documentation/netlink/specs/shaper.yaml       | 337 ++++++<br>
 Documentation/networking/kapi.rst             |   3 +<br>
 MAINTAINERS                                   |   1 +<br>
 drivers/net/Kconfig                           |   1 +<br>
 drivers/net/ethernet/intel/Kconfig            |   1 +<br>
 drivers/net/ethernet/intel/iavf/iavf.h        |  13 +<br>
 drivers/net/ethernet/intel/iavf/iavf_main.c   | 215 +++-<br>
 drivers/net/ethernet/intel/iavf/iavf_txrx.h   |   2 +<br>
 .../net/ethernet/intel/iavf/iavf_virtchnl.c   | 157 ++-<br>
 drivers/net/ethernet/intel/ice/ice.h          |   2 +<br>
 drivers/net/ethernet/intel/ice/ice_base.c     |   2 +<br>
 drivers/net/ethernet/intel/ice/ice_common.c   |  21 +<br>
 .../net/ethernet/intel/ice/ice_hw_autogen.h   |   8 +<br>
 drivers/net/ethernet/intel/ice/ice_txrx.h     |   1 +<br>
 drivers/net/ethernet/intel/ice/ice_type.h     |   1 +<br>
 drivers/net/ethernet/intel/ice/ice_vf_lib.h   |   8 +<br>
 drivers/net/ethernet/intel/ice/ice_virtchnl.c | 333 ++++++<br>
 drivers/net/ethernet/intel/ice/ice_virtchnl.h |  11 +<br>
 .../intel/ice/ice_virtchnl_allowlist.c        |   6 +<br>
 drivers/net/netdevsim/netdev.c                |  37 +<br>
 include/linux/avf/virtchnl.h                  | 119 +++<br>
 include/linux/netdevice.h                     |  17 +<br>
 include/net/net_shaper.h                      | 169 +++<br>
 include/uapi/linux/net_shaper.h               |  91 ++<br>
 net/Kconfig                                   |   3 +<br>
 net/Makefile                                  |   1 +<br>
 net/core/dev.c                                |   2 +<br>
 net/core/dev.h                                |   6 +<br>
 net/shaper/Makefile                           |   9 +<br>
 net/shaper/shaper.c                           | 963 ++++++++++++++++++<br>
 net/shaper/shaper_nl_gen.c                    | 142 +++<br>
 net/shaper/shaper_nl_gen.h                    |  30 +<br>
 tools/net/ynl/ynl-gen-c.py                    |   6 +-<br>
 tools/testing/selftests/drivers/net/Makefile  |   1 +<br>
 tools/testing/selftests/drivers/net/shaper.py | 267 +++++<br>
 .../testing/selftests/net/lib/py/__init__.py  |   1 +<br>
 tools/testing/selftests/net/lib/py/ynl.py     |   5 +<br>
 37 files changed, 2988 insertions(+), 4 deletions(-)<br>
 create mode 100644 Documentation/netlink/specs/shaper.yaml<br>
 create mode 100644 include/net/net_shaper.h<br>
 create mode 100644 include/uapi/linux/net_shaper.h<br>
 create mode 100644 net/shaper/Makefile<br>
 create mode 100644 net/shaper/shaper.c<br>
 create mode 100644 net/shaper/shaper_nl_gen.c<br>
 create mode 100644 net/shaper/shaper_nl_gen.h<br>
 create mode 100755 tools/testing/selftests/drivers/net/shaper.py<br>
<br>
-- <br>
2.45.2<br>
<br>
<br>
</div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Artists/Musician Campout Aug 9-11</div><div><a href="https://www.eventbrite.com/e/healing-arts-event-tickets-928910826287" target="_blank">https://www.eventbrite.com/e/healing-arts-event-tickets-928910826287</a><br></div><div>Dave Täht CSO, LibreQos<br></div></div></div></div>