Subject: Re: [PATCH net-next 1/5] netlink: spec: add shaper YAML spec

From: Jakub Kicinski <[email-masked]>
Date: Tue, 2 Jul 2024 08:04:52 -0700

On Tue, 02 Jul 2024 16:21:38 +0200 Paolo Abeni wrote:
> > I see, I had a look at patch 2 now.
> > But that's really "Andrew's use-case" it doesn't cover deletion, right?
> > Sorry that I don't have a perfect suggestion either but it seems like
> > a half-measure. It's a partial support for transactions. If we want
> > transactions we should group ops like nftables. Have normal ops (add,
> > delete, modify) and control ops (start, commit) which clone the entire
> > tree, then ops change it, and commit presents new tree to the device.  
> 
> Yes, it does not cover deletion _and_ update/add/move within the same
> atomic operation.
> 
> Still any configuration could be reached from default/initial state
> with set(<possibly many shapers>). Additionally, given any arbitrary
> configuration, the default/initial state could be restored with a
> single delete(<possibly many handlers>).

From:

q0 -. RR \
q1 /      > SP
q2 -. RR /
q3 /

To:

q0 ------\
q1 -------> SP
q2 -. RR /
q3 /

You have to both delete an RR node, and set SP params on Q0 and Q1.

> The above covers any possible limitation enforced by the H/W, not just
> the DSA use-case.
> 
> Do you have a strong feeling for atomic transactions from any arbitrary
> state towards any other? If so, I’d like to understand why?

I don't believe this is covers all cases.

> Dealing with transactions allowing arbitrary any state <> any state
> atomic changes will involve some complex logic that seems better
> assigned to user-space.

Complex logic in which part of the code?
It's just a full clone of the xarray, then do whatever ops user is
asking to do, then tree walk to render diff as a set of ops.
If you mean the tree walk to convert tree diff into ops, I think we
need that anyway, otherwise we may get into a situation where there's
a dependency between the user space implementation and driver
expectations.