Re: [PATCH net-next v2] net: Modify mono_delivery_time with clockid_delivery_time

From: Willem de Bruijn
Date: Wed Feb 28 2024 - 15:14:31 EST


Abhishek Chauhan (ABC) wrote:
>
>
> On 2/28/2024 7:53 AM, Willem de Bruijn wrote:
> > Abhishek Chauhan wrote:
> >> Bridge driver today has no support to forward the userspace timestamp
> >> packets and ends up resetting the timestamp. ETF qdisc checks the
> >> packet coming from userspace and encounters to be 0 thereby dropping
> >> time sensitive packets. These changes will allow userspace timestamps
> >> packets to be forwarded from the bridge to NIC drivers.
> >>
> >> Existing functionality of mono_delivery_time is not altered here
> >> instead just extended with userspace tstamp support for bridge
> >> forwarding path.
> >>
> >> Signed-off-by: Abhishek Chauhan <quic_abchauha@xxxxxxxxxxx>
> >> ---
> >> Changes since v1
> >> - Changed the commit subject as i am modifying the mono_delivery_time
> >> bit with clockid_delivery_time.
> >> - Took care of suggestion mentioned by Willem to use the same bit for
> >> userspace delivery time as there are no conflicts between TCP and
> >> SCM_TXTIME, because explicit cmsg makes no sense for TCP and only
> >> RAW and DGRAM sockets interprets it.
> >
> > The variable rename churn makes it hard to spot the functional
> > changes. Perhaps it makes sense just keep the variable name as is,
> > even though the "mono" is not always technically correct anymore.
> >
>
>
> I think a better approach would be to keep the variable as ease and add
> comments and documentation in the header file of skbuff.h like
> how i have done in this patch. The reason why i say this is
> a. We can avoid alot of code churn just to solve this basic problem of
> propagating timestamp through forwarding bridge path
> b. Re-use the same variable name and have better documentation
> c. Complexity will be as minimal as possible.
>
> Let me know what you think.

Agreed

> > Or else to split into two patches. One that renames the field.
> > And one that adds the new behavior of setting the bit for SO_TXTIME.
> >
>
> Regarding the sidenote. I dont see how they are using clock_id to determine
> if the skb->tstamp is set in monotonic. Please correct me or point me to
> the piece of code which is doing so.

That's really out of scope of this series anyway

>
> I hope the check against sock_flag is a better implementation as
> it clearly stats and is inline with the implementation that the tstamp is
> coming from userspace.
> skb->mono_delivery_time = sock_flag(sk, SOCK_TXTIME);

Enabling the socket flag is not sufficient to configure a delivery
time on a packet. A transmit time must be communicated per packet
with cork->transmit_time. And on top of that, it is cheaper to test.