* [PATCH] Bluetooth: increment TX timestamping tskey always for stream sockets
@ 2025-04-03 16:57 Pauli Virtanen
2025-04-03 19:04 ` bluez.test.bot
2025-04-03 20:20 ` [PATCH] " patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ messages in thread
From: Pauli Virtanen @ 2025-04-03 16:57 UTC (permalink / raw)
To: linux-bluetooth
Cc: Pauli Virtanen, netdev, willemdebruijn.kernel, kerneljasonxing
Documentation/networking/timestamping.rst implies TX timestamping OPT_ID
tskey increments for each sendmsg. In practice: TCP socket increments
it for all sendmsg, timestamping on or off, but UDP only when
timestamping is on. The user-visible counter resets when OPT_ID is
turned on, so difference can be seen only if timestamping is enabled for
some packets only (eg. via SO_TIMESTAMPING CMSG).
Fix BT sockets to work in the same way: stream sockets increment tskey
for all sendmsg (seqpacket already increment for timestamped only).
Fixes: 134f4b39df7b ("Bluetooth: add support for skb TX SND/COMPLETION timestamping")
Signed-off-by: Pauli Virtanen <pav@iki.fi>
---
net/bluetooth/hci_conn.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 95972fd4c784..7e1b53857648 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -3072,6 +3072,7 @@ void hci_setup_tx_timestamp(struct sk_buff *skb, size_t key_offset,
const struct sockcm_cookie *sockc)
{
struct sock *sk = skb ? skb->sk : NULL;
+ int key;
/* This shall be called on a single skb of those generated by user
* sendmsg(), and only when the sendmsg() does not return error to
@@ -3087,13 +3088,16 @@ void hci_setup_tx_timestamp(struct sk_buff *skb, size_t key_offset,
sock_tx_timestamp(sk, sockc, &skb_shinfo(skb)->tx_flags);
+ if (sk->sk_type == SOCK_STREAM)
+ key = atomic_add_return(key_offset, &sk->sk_tskey);
+
if (sockc->tsflags & SOF_TIMESTAMPING_OPT_ID &&
sockc->tsflags & SOF_TIMESTAMPING_TX_RECORD_MASK) {
if (sockc->tsflags & SOCKCM_FLAG_TS_OPT_ID) {
skb_shinfo(skb)->tskey = sockc->ts_opt_id;
} else {
- int key = atomic_add_return(key_offset, &sk->sk_tskey);
-
+ if (sk->sk_type != SOCK_STREAM)
+ key = atomic_inc_return(&sk->sk_tskey);
skb_shinfo(skb)->tskey = key - 1;
}
}
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: Bluetooth: increment TX timestamping tskey always for stream sockets
2025-04-03 16:57 [PATCH] Bluetooth: increment TX timestamping tskey always for stream sockets Pauli Virtanen
@ 2025-04-03 19:04 ` bluez.test.bot
2025-04-03 20:20 ` [PATCH] " patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2025-04-03 19:04 UTC (permalink / raw)
To: linux-bluetooth, pav
[-- Attachment #1: Type: text/plain, Size: 1949 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=949650
---Test result---
Test Summary:
CheckPatch PENDING 0.36 seconds
GitLint PENDING 0.27 seconds
SubjectPrefix PASS 0.07 seconds
BuildKernel PASS 24.17 seconds
CheckAllWarning PASS 26.55 seconds
CheckSparse PASS 29.49 seconds
BuildKernel32 PASS 24.12 seconds
TestRunnerSetup PASS 429.74 seconds
TestRunner_l2cap-tester PASS 20.91 seconds
TestRunner_iso-tester PASS 32.78 seconds
TestRunner_bnep-tester PASS 4.69 seconds
TestRunner_mgmt-tester FAIL 119.63 seconds
TestRunner_rfcomm-tester PASS 7.69 seconds
TestRunner_sco-tester PASS 12.55 seconds
TestRunner_ioctl-tester PASS 8.28 seconds
TestRunner_mesh-tester PASS 6.00 seconds
TestRunner_smp-tester PASS 7.15 seconds
TestRunner_userchan-tester PASS 4.93 seconds
IncrementalBuild PENDING 1.06 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 490, Passed: 485 (99.0%), Failed: 1, Not Run: 4
Failed Test Cases
LL Privacy - Set Flags 2 (Enable RL) Failed 0.145 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: increment TX timestamping tskey always for stream sockets
2025-04-03 16:57 [PATCH] Bluetooth: increment TX timestamping tskey always for stream sockets Pauli Virtanen
2025-04-03 19:04 ` bluez.test.bot
@ 2025-04-03 20:20 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2025-04-03 20:20 UTC (permalink / raw)
To: Pauli Virtanen
Cc: linux-bluetooth, netdev, willemdebruijn.kernel, kerneljasonxing
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Thu, 3 Apr 2025 19:57:59 +0300 you wrote:
> Documentation/networking/timestamping.rst implies TX timestamping OPT_ID
> tskey increments for each sendmsg. In practice: TCP socket increments
> it for all sendmsg, timestamping on or off, but UDP only when
> timestamping is on. The user-visible counter resets when OPT_ID is
> turned on, so difference can be seen only if timestamping is enabled for
> some packets only (eg. via SO_TIMESTAMPING CMSG).
>
> [...]
Here is the summary with links:
- Bluetooth: increment TX timestamping tskey always for stream sockets
https://git.kernel.org/bluetooth/bluetooth-next/c/2c1cf148c1fa
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-03 20:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-03 16:57 [PATCH] Bluetooth: increment TX timestamping tskey always for stream sockets Pauli Virtanen
2025-04-03 19:04 ` bluez.test.bot
2025-04-03 20:20 ` [PATCH] " patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox