diff options
| author | Jakub Kicinski <kuba@kernel.org> | 2026-07-24 14:07:55 -0700 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-07-28 18:27:47 -0700 |
| commit | 26bc4cfb17374f69717970699b4ccbdb1fd2a027 (patch) | |
| tree | 6bc3dbdd12f5d40cf2bdd0657486779295bbb9d9 | |
| parent | 16812d9674d4991ebbae80769b15f7342dbfa988 (diff) | |
| download | linux-next-26bc4cfb17374f69717970699b4ccbdb1fd2a027.tar.gz linux-next-26bc4cfb17374f69717970699b4ccbdb1fd2a027.zip | |
net_shaper: clarify the kernel API / comments
The shaper API takes some getting used to. Try to improve
the doc on struct net_shaper_ops to help driver developers.
Link: https://patch.msgid.link/20260724210756.1553565-3-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
| -rw-r--r-- | include/net/net_shaper.h | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/include/net/net_shaper.h b/include/net/net_shaper.h index 0fcca29207ac..c14eb87efe5e 100644 --- a/include/net/net_shaper.h +++ b/include/net/net_shaper.h @@ -68,7 +68,7 @@ struct net_shaper { * The operations are serialized via a per device lock. * * Device not supporting any kind of nesting should not provide the - * group operation. + * @group operation. * * Each shaper is uniquely identified within the device with a 'handle' * comprising the shaper scope and a scope-specific id. @@ -84,16 +84,30 @@ struct net_shaper { * only allowed to construct groups with queues as leaves) * - @group calls may update leaf's parent if the parent is about * to be removed (re-parenting nodes explicitly is not supported in the uAPI) + * + * Implicit creation + * ----------------- + * Shapers are created implicitly, meaning that @set and @group operations + * are called both for existing and new shapers. The driver has to infer + * whether the operation is an update or a creation by tracking the handles. + * Removal of shapers is explicit and done with a @delete call. + * + * The @set operation implicitly creates NET_SHAPER_SCOPE_NETDEV and + * NET_SHAPER_SCOPE_QUEUE shapers. + * The @group operation implicitly creates NET_SHAPER_SCOPE_NETDEV and + * NET_SHAPER_SCOPE_NODE shapers (the group shaper itself), as well as + * NET_SHAPER_SCOPE_QUEUE shapers (leaves). */ struct net_shaper_ops { /** - * @group: create the specified shapers scheduling group + * @group: create a scheduling group or add leaves * - * Nest the @leaves shapers identified under the * @node shaper. + * Nest the @leaves shapers identified under the @node shaper. * All the shapers belong to the device specified by @binding. - * The @leaves arrays size is specified by @leaves_count. - * Create either the @leaves and the @node shaper; or if they already - * exists, links them together in the desired way. + * The @leaves array's size is specified by @leaves_count. + * + * @node and @leaves may or may not already exist + * (see the "Implicit creation" note). */ int (*group)(struct net_shaper_binding *binding, int leaves_count, const struct net_shaper *leaves, |
