mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yang Li <yang.li@amlogic.com>
To: Jason Xing <kerneljasonxing@gmail.com>
Cc: Marcel Holtmann <marcel@holtmann.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] Bluetooth: ISO: Support SCM_TIMESTAMPING for ISO TS
Date: Mon, 7 Jul 2025 09:52:59 +0800	[thread overview]
Message-ID: <978c6925-c8c0-4cb0-9184-723c3cd1af73@amlogic.com> (raw)
In-Reply-To: <CAL+tcoAXCbhNG2-Pdd7C3iJD9h=GvM1PNstyMJXO8KE7XKAzDw@mail.gmail.com>

Hi Jason,
> [ EXTERNAL EMAIL ]
>
> Hi Yang,
>
> On Fri, Jul 4, 2025 at 1:36 PM Yang Li via B4 Relay
> <devnull+yang.li.amlogic.com@kernel.org> wrote:
>> From: Yang Li <yang.li@amlogic.com>
>>
>> User-space applications (e.g., PipeWire) depend on
>> ISO-formatted timestamps for precise audio sync.
>>
>> Signed-off-by: Yang Li <yang.li@amlogic.com>
>> ---
>> Changes in v3:
>> - Change to use hwtimestamp
>> - Link to v2: https://lore.kernel.org/r/20250702-iso_ts-v2-1-723d199c8068@amlogic.com
>>
>> Changes in v2:
>> - Support SOCK_RCVTSTAMPNS via CMSG for ISO sockets
>> - Link to v1: https://lore.kernel.org/r/20250429-iso_ts-v1-1-e586f30de6cb@amlogic.com
>> ---
>>   net/bluetooth/iso.c | 10 +++++++++-
>>   1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c
>> index fc22782cbeeb..67ff355167d8 100644
>> --- a/net/bluetooth/iso.c
>> +++ b/net/bluetooth/iso.c
>> @@ -2301,13 +2301,21 @@ void iso_recv(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
>>                  if (ts) {
>>                          struct hci_iso_ts_data_hdr *hdr;
>>
>> -                       /* TODO: add timestamp to the packet? */
>>                          hdr = skb_pull_data(skb, HCI_ISO_TS_DATA_HDR_SIZE);
>>                          if (!hdr) {
>>                                  BT_ERR("Frame is too short (len %d)", skb->len);
>>                                  goto drop;
>>                          }
>>
>> +                       /* The ISO ts is based on the controller’s clock domain,
>> +                        * so hardware timestamping (hwtimestamp) must be used.
>> +                        * Ref: Documentation/networking/timestamping.rst,
>> +                        * chapter 3.1 Hardware Timestamping.
>> +                        */
> I think the above comment is not necessary as it's a common usage for
> all kinds of drivers. If you reckon the information could be helpful,
> then you could clarify it in the commit message :)


Okay, I got it.

>
>> +                       struct skb_shared_hwtstamps *hwts = skb_hwtstamps(skb);
> The above line should be moved underneath the 'if (ts) {' line because
> we need to group all the declarations altogether at the beginning.


Yes, I will do.

>
>> +                       if (hwts)
>> +                               hwts->hwtstamp = us_to_ktime(le32_to_cpu(hdr->ts));
>> +
> I'm definitely not a bluetooth expert, so I'm here only to check the
> timestamping usage. According to your prior v2 patch, the
> reader/receiver to turn on the timestamping feature is implemented in
> PipeWire? If so, so far the kernel part looks good to me.


Yes, please reference reply:

https://lore.kernel.org/all/df9f6977-0d63-41b3-8d9b-c3a293ed78ec@amlogic.com/


>
> Thanks,
> Jason

  reply	other threads:[~2025-07-07  1:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-04  5:36 Yang Li via B4 Relay
2025-07-04  8:49 ` Bastien Nocera
2025-07-07  1:35   ` Yang Li
2025-07-05  1:59 ` Jason Xing
2025-07-07  1:52   ` Yang Li [this message]
2025-07-05 20:39 ` Pauli Virtanen
2025-07-07  1:48   ` Yang Li
2025-07-07  7:41     ` Pauli Virtanen
2025-07-07  8:18       ` Yang Li
2025-07-08 15:40         ` Pauli Virtanen

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=978c6925-c8c0-4cb0-9184-723c3cd1af73@amlogic.com \
    --to=yang.li@amlogic.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=johan.hedberg@gmail.com \
    --cc=kerneljasonxing@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.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

all inboxes | Powered by JetHome®