Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
	andrew+netdev@lunn.ch, horms@kernel.org,
	Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next 3/3] net_shaper: add some notes on re-parenting
Date: Fri, 24 Jul 2026 14:07:56 -0700	[thread overview]
Message-ID: <20260724210756.1553565-4-kuba@kernel.org> (raw)
In-Reply-To: <20260724210756.1553565-1-kuba@kernel.org>

Clarify the re-parenting expectations. Specifically that @delete
on a queue removes it from the hierarchy which is a bit unusual
in the overall API structure.

IIRC the implicit delete behavior was introduced because otherwise
it would not be possible to remove a queue from the hierarchy
without changing at least one handle of the shapers. Normally
"removal" is done by "adding" to the new parent, but "outside
the hierarchy" does not have a parent we can point at.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 include/net/net_shaper.h | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/net/net_shaper.h b/include/net/net_shaper.h
index c14eb87efe5e..05cb625b0fe5 100644
--- a/include/net/net_shaper.h
+++ b/include/net/net_shaper.h
@@ -107,7 +107,12 @@ struct net_shaper_ops {
 	 * The @leaves array's size is specified by @leaves_count.
 	 *
 	 * @node and @leaves may or may not already exist
-	 * (see the "Implicit creation" note).
+	 * (see the "Implicit creation" note). If @node already exists,
+	 * the @leaves should be *added* to its children. In this case,
+	 * the @leaves array only holds new/modified leaves, not the full list.
+	 *
+	 * Re-parenting @leaves is implemented by a @group call on a new parent.
+	 * There's no explicit call to remove the children from the old parent.
 	 */
 	int (*group)(struct net_shaper_binding *binding, int leaves_count,
 		     const struct net_shaper *leaves,
@@ -128,6 +133,13 @@ struct net_shaper_ops {
 	 *
 	 * Removes the shaper configuration as identified by the given @handle
 	 * on the device specified by @binding, restoring the default behavior.
+	 *
+	 * Note that a @delete call on a NET_SHAPER_SCOPE_QUEUE shaper also
+	 * implicitly removes the associated queue from the scheduling
+	 * hierarchy. The driver must take care of that step.
+	 * @delete calls on NET_SHAPER_SCOPE_NODE should not require any
+	 * implicit re-parenting in the driver as core will re-parent the leaves
+	 * first, before deleting the SCOPE_NODE shaper.
 	 */
 	int (*delete)(struct net_shaper_binding *binding,
 		      const struct net_shaper_handle *handle,
-- 
2.55.0


      parent reply	other threads:[~2026-07-24 21:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24 21:07 [PATCH net-next 0/3] net_shaper: clarify kernel API docs Jakub Kicinski
2026-07-24 21:07 ` [PATCH net-next 1/3] net_shaper: remove incorrect comment about group leaves Jakub Kicinski
2026-07-24 21:07 ` [PATCH net-next 2/3] net_shaper: clarify the kernel API / comments Jakub Kicinski
2026-07-24 21:07 ` Jakub Kicinski [this message]

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=20260724210756.1553565-4-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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