Subject: Re: [PATCH v3 02/12] netlink: spec: add shaper YAML spec

From: Jakub Kicinski <[email-masked]>
Date: Tue, 13 Aug 2024 07:12:14 -0700

On Tue, 13 Aug 2024 07:38:46 +0200 Jiri Pirko wrote:
> >Parent / child is completely confusing. Let's not.
> >
> >User will classify traffic based on 'leaf' attributes.
> >Therefore in my mind traffic enters the tree at the "leaves", 
> >and travels towards the root (whether or not that's how HW 
> >evaluates the hierarchy).
> >
> >This is opposite to how trees as an data structure are normally
> >traversed. Hence I find the tree analogy to be imperfect.  
> 
> Normally?

Yes, normally, in sort and/or lookup algorithms the owner of the tree
has a pointer to root, and walks from root.

> Tree as a datastructure could be traversed freely, why it
> can't?

I didn't say it can't.

> In this case, it is traversed from leaf to root. It's still a
> tree. Why the tree analogy is imperfect. From what I see, it fits 100%.
> 
> >But yes, root and leaf are definitely better than parent / child.  
> 
> Node has 0-n children and 0-1 parents. In case it has 0 children, it's a
> leaf, in case it has 0 parents, it's a root.
> This is the common tree terminology, isn't it?

You're using tree terminology and then you're asking if it's the tree
terminology. What are you trying to prove?

To me using input / output is more intuitive, as it matches direction
of traffic flow. I'm fine with root / leaf tho, as I said.

> >> subtree_set() ?  
> >
> >The operation is grouping inputs and creating a scheduler node.  
> 
> Creating a node inside a tree, isn't it? Therefore subtree.

All nodes are inside the tree.

> But it could be unified to node_set() as Paolo suggested. That would
> work for any node, including leaf, tree, non-existent internal node.

A "set" operation which creates a node.