From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Jason Xing <kerneljasonxing@gmail.com>, Pauli Virtanen <pav@iki.fi>
Cc: linux-bluetooth@vger.kernel.org,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
willemdebruijn.kernel@gmail.com
Subject: Re: [PATCH v5 2/5] Bluetooth: add support for skb TX SND/COMPLETION timestamping
Date: Wed, 19 Mar 2025 10:44:51 -0400 [thread overview]
Message-ID: <67dad8635c22c_5948294ac@willemb.c.googlers.com.notmuch> (raw)
In-Reply-To: <CAL+tcoCr-Z_PrWMsERtsm98Q4f-RXkMVzTW3S1gnNY6cFQM0Sg@mail.gmail.com>
Jason Xing wrote:
> On Wed, Mar 19, 2025 at 3:10 AM Pauli Virtanen <pav@iki.fi> wrote:
> >
> > Support enabling TX timestamping for some skbs, and track them until
> > packet completion. Generate software SCM_TSTAMP_COMPLETION when getting
> > completion report from hardware.
> >
> > Generate software SCM_TSTAMP_SND before sending to driver. Sending from
> > driver requires changes in the driver API, and drivers mostly are going
> > to send the skb immediately.
> >
> > Make the default situation with no COMPLETION TX timestamping more
> > efficient by only counting packets in the queue when there is nothing to
> > track. When there is something to track, we need to make clones, since
> > the driver may modify sent skbs.
Why count packets at all? And if useful separate from completions,
should that be a separate patch?
> > +void hci_conn_tx_queue(struct hci_conn *conn, struct sk_buff *skb)
> > +{
> > + struct tx_queue *comp = &conn->tx_q;
> > + bool track = false;
> > +
> > + /* Emit SND now, ie. just before sending to driver */
> > + if (skb_shinfo(skb)->tx_flags & SKBTX_SW_TSTAMP)
> > + __skb_tstamp_tx(skb, NULL, NULL, skb->sk, SCM_TSTAMP_SND);
>
> It's a bit strange that SCM_TSTAMP_SND is under the control of
> SKBTX_SW_TSTAMP. Can we use the same flag for both lines here
> directly? I suppose I would use SKBTX_SW_TSTAMP then.
This is the established behavior.
>
> > +
> > + /* COMPLETION tstamp is emitted for tracked skb later in Number of
> > + * Completed Packets event. Available only for flow controlled cases.
> > + *
> > + * TODO: SCO support without flowctl (needs to be done in drivers)
> > + */
> > + switch (conn->type) {
> > + case ISO_LINK:
> > + case ACL_LINK:
> > + case LE_LINK:
> > + break;
> > + case SCO_LINK:
> > + case ESCO_LINK:
> > + if (!hci_dev_test_flag(conn->hdev, HCI_SCO_FLOWCTL))
> > + return;
> > + break;
> > + default:
> > + return;
> > + }
> > +
> > + if (skb->sk && (skb_shinfo(skb)->tx_flags & SKBTX_COMPLETION_TSTAMP))
> > + track = true;
> > +
> > + /* If nothing is tracked, just count extra skbs at the queue head */
> > + if (!track && !comp->tracked) {
> > + comp->extra++;
> > + return;
> > + }
> > +
> > + if (track) {
> > + skb = skb_clone_sk(skb);
> > + if (!skb)
> > + goto count_only;
> > +
> > + comp->tracked++;
> > + } else {
> > + skb = skb_clone(skb, GFP_KERNEL);
> > + if (!skb)
> > + goto count_only;
> > + }
What is the difference between track and comp->tracked
next prev parent reply other threads:[~2025-03-19 14:44 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-18 19:06 [PATCH v5 0/5] net: Bluetooth: add TX timestamping for ISO/L2CAP/SCO Pauli Virtanen
2025-03-18 19:06 ` [PATCH v5 1/5] net-timestamp: COMPLETION timestamp on packet tx completion Pauli Virtanen
2025-03-19 0:13 ` Jason Xing
2025-03-19 14:37 ` Willem de Bruijn
2025-03-19 15:48 ` Paul Menzel
2025-03-20 14:43 ` Luiz Augusto von Dentz
2025-03-20 14:49 ` Willem de Bruijn
2025-03-20 17:12 ` Pauli Virtanen
2025-03-20 17:51 ` Jason Xing
2025-03-18 19:06 ` [PATCH v5 2/5] Bluetooth: add support for skb TX SND/COMPLETION timestamping Pauli Virtanen
2025-03-19 0:39 ` Jason Xing
2025-03-19 14:44 ` Willem de Bruijn [this message]
2025-03-19 17:43 ` Pauli Virtanen
2025-03-19 20:00 ` Willem de Bruijn
2025-03-19 21:30 ` Pauli Virtanen
2025-03-19 21:35 ` Willem de Bruijn
2025-03-19 21:16 ` Luiz Augusto von Dentz
2025-03-19 18:21 ` Pauli Virtanen
2025-03-20 0:25 ` Jason Xing
2025-03-18 19:06 ` [PATCH v5 3/5] Bluetooth: ISO: add TX timestamping Pauli Virtanen
2025-03-19 14:49 ` Willem de Bruijn
2025-03-18 19:06 ` [PATCH v5 4/5] Bluetooth: L2CAP: " Pauli Virtanen
2025-03-18 19:06 ` [PATCH v5 5/5] Bluetooth: SCO: " Pauli Virtanen
2025-03-20 16:10 ` [PATCH v5 0/5] net: Bluetooth: add TX timestamping for ISO/L2CAP/SCO patchwork-bot+bluetooth
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=67dad8635c22c_5948294ac@willemb.c.googlers.com.notmuch \
--to=willemdebruijn.kernel@gmail.com \
--cc=davem@davemloft.net \
--cc=kerneljasonxing@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pav@iki.fi \
/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