Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1034278lqg; Sat, 2 Mar 2024 12:08:00 -0800 (PST) X-Forwarded-Encrypted: i=4; AJvYcCVzN8vjXe/wNE3Ph5fl/JbLmkqN17BEF4l/X6syoSstwZlknI8SmUhZJ+scA4sWlIaQ2hFZxc93Ghf9gQvK9b1Fh5TZcSHdhIL8JtZyQA== X-Google-Smtp-Source: AGHT+IGhgkpZfO1cyK4fUb6eZpffc4aGoCFlWjkrsGVIzECN4o5aCGEbQGhJ3KqJxIlKtop8tM8P X-Received: by 2002:a05:651c:149:b0:2d1:276b:860 with SMTP id c9-20020a05651c014900b002d1276b0860mr3702075ljd.31.1709410079939; Sat, 02 Mar 2024 12:07:59 -0800 (PST) ARC-Seal: i=3; a=rsa-sha256; t=1709410079; cv=pass; d=google.com; s=arc-20160816; b=wRMioPnuvoXJ2Hi2My+kV1wV71ft8S41qcYp4iKcJ9x2/Wot31vuj6jJ1K+nPbT1uF 5Zb0glJlUqwczaYYWldoxjbbQBO2N9I+bHi065x12O0kXeLs4Thu7hNqYaiZoiZ2UhHy 4YHw2Q07zQg18WKzqsum1UcH1KwucNUxKhL8/dfhmRDQLk19zigKoFdus7lKPt93XWy3 D5Bfwh2hNrQIuyKME73Wn5bmS1/P0p8ZXTfWRC2xewwPMetboWfsgExdz0oATCbqZHJA fBG+Ep+4iJSr6+3ASfJZ5BHFNfTVDUyVgHka8PV5yhahYnGQ/b8OJKoEOvYQwr0ZEgmH lYng== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=QN6myTiIcoyY+Z1fB22n/nBwEMBaqmYdHkyPQAuU8qs=; fh=ExGhjNQEFJgRqHmYATVc5UXZbS7abAmaHDitrfHKOuE=; b=i9apq6iys27091z7uQ1lt7CZw6Y0Q6jJSTC0NKUgnFR+Zmlr6bBIaOp6PoU8aWNc+z g9juv4lPuwB56fvgQ8Ha4m/WpwRI4tKKQSjS9BR31D5LHBtkOSzeLjKFVh1buuI+mjBa zfFPgSbyqW5syfZaNZUm7bk+8bxSqJQqxfcP1LKosi/Wd4DqcU0nYvltvq9lLy/+gwTQ zJYGW7rmsF6llJ8TFirHHcasn+k6956491fuMO+j1VDZ9t25IqKnhNZikJ3SG0krbw4f ruRd6q6+H0/O6OTFtjDSJp9XYU6T3/gq0O+Uj9TE6ZlOaazMOQ6M23wjrxyXXC4LZfjk dwMA==; dara=google.com ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@iki.fi header.s=meesny header.b=enytfx8N; arc=pass (i=2 spf=pass spfdomain=iki.fi dkim=pass dkdomain=iki.fi); spf=pass (google.com: domain of linux-bluetooth+bounces-2253-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-2253-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id dz20-20020a0564021d5400b00564098c4c23si2615785edb.541.2024.03.02.12.07.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 12:07:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-2253-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@iki.fi header.s=meesny header.b=enytfx8N; arc=pass (i=2 spf=pass spfdomain=iki.fi dkim=pass dkdomain=iki.fi); spf=pass (google.com: domain of linux-bluetooth+bounces-2253-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-2253-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6A0C71F21E7C for ; Sat, 2 Mar 2024 20:07:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F3BA4405FB; Sat, 2 Mar 2024 20:07:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=iki.fi header.i=@iki.fi header.b="enytfx8N" X-Original-To: linux-bluetooth@vger.kernel.org Received: from meesny.iki.fi (meesny.iki.fi [195.140.195.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FE3E3AC0F for ; Sat, 2 Mar 2024 20:07:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=195.140.195.201 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709410072; cv=pass; b=ARpDx8xnt5C+tCM6e6cf8byn+JmZhaxgS7tO/0ih0CE1p1jU6GVZQWM817i9eDgT35gStVmsBqso5ic5iUhJyog+/0qNAscCcPMN6kS7jaCpbQ9fwkq4pldYbU4/XVAleWnffxhfHGaSfbyfhH1wBg4apKQpboKSJFlXjJ+JAcM= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709410072; c=relaxed/simple; bh=psFKxsMfU1g0ogncJi0o+QZ9IC7wMORshlA6722Sdk0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=L2SLBK9I+dWRVFZvILQPbTXyj4XqmadcZrlu9fX6W7ae3ZDPkkt4Q3cod8SytZ+LM03vQV9CEzzz4ZyDikDE0TWeB8ZKPgDavkhDXufLZWWhKuepzFepQnnwda1rVxUxGlYgY+SNJgzXURJaRxffwukApX+itX6LzPLY0lvEvGM= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iki.fi; spf=pass smtp.mailfrom=iki.fi; dkim=pass (1024-bit key) header.d=iki.fi header.i=@iki.fi header.b=enytfx8N; arc=pass smtp.client-ip=195.140.195.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iki.fi Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iki.fi Received: from monolith.lan (unknown [193.138.7.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pav) by meesny.iki.fi (Postfix) with ESMTPSA id 4TnGGV0vmGzyxR; Sat, 2 Mar 2024 22:07:44 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1709410066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=QN6myTiIcoyY+Z1fB22n/nBwEMBaqmYdHkyPQAuU8qs=; b=enytfx8NlPQNPpWzBYVvJKdQKLpC73fWWKS3sN1b021nWEIsVxSmAMT6nhf6xskeZSWi65 8d/I+r/45wfbfKoG2YV1FNg4QQQEs6F6Po9+8WzTRbkBv4pF0HjXJspEeCgQL2QKu1kqzL ea7VHX0emvhgIYHJlQ7SnoPkvUezc+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1709410066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=QN6myTiIcoyY+Z1fB22n/nBwEMBaqmYdHkyPQAuU8qs=; b=eyYht/qiNYk2wRs6EZV/gmTjKaXq6PhDga/KQJUOQj8s6J5qon0nJveLsKPOYnJTmSGCLN /EAAKcfWVNMzH6u9V0RSdGYk9TPZZdJnoN1NuQSsrmMntT5lJWO4omgENIEW+ru7JXck5Q 0Tvu5QKxiAQyYCFRcF+Iu/BHtsBwNKc= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=pav smtp.mailfrom=pav@iki.fi ARC-Seal: i=1; s=meesny; d=iki.fi; t=1709410066; a=rsa-sha256; cv=none; b=Aa+sGyCWTc+VOj92e4Bmpv2ejjRfUAZSckKJOhvpE2ooWprk8Xb0VhGj7W6/kmA116AnlB MbqatV0N8Bi12w1ljIkBC5zXsFCJY+d+aMk7XNFKy/GmTYPzZ/bFh6BJfImjD4WYY7v38L r8eSUjDEW8nfI8o5aDHfOV1pUrgD+e4= From: Pauli Virtanen To: linux-bluetooth@vger.kernel.org Cc: Pauli Virtanen Subject: [PATCH 0/3] Bluetooth: add TX timestamping for ISO and L2CAP Date: Sat, 2 Mar 2024 22:07:35 +0200 Message-ID: X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add support for TX timestamping in ISO/L2CAP sockets. These patches allow fixing / working around controller(?) issue where two ISO streams in same group get desynchronized. Having accurate knowledge of the packet queue lengths, user application can drop packets if it detects the ISO streams are not in sync. For using this for audio, BlueZ needs to be changed to not unconditionally terminate connections on POLLERR. It currently thinks the TX timestamp POLLERR is an error, and closes the audio channel. For BAP, BlueZ only closes the fd in this case so it accidentally works there, but for A2DP it is more thorough in tearing down the connection. Pipewire side: https://gitlab.freedesktop.org/pvir/pipewire/-/commits/iso-ts-test2 With this change, https://github.com/bluez/bluez/issues/515 is more or less fixed, and the sound server can figure out the total latency to audio rendering (tx latency + transport latency + presentation delay). For ISO, we can later use LE Read ISO TX Sync to provide hardware timestamps, but this requires figuring out the sequence number synchronization first. Pauli Virtanen (3): Bluetooth: add support for skb TX timestamping Bluetooth: ISO: add TX timestamping Bluetooth: L2CAP: add TX timestamping include/net/bluetooth/bluetooth.h | 1 + include/net/bluetooth/hci_core.h | 12 +++++ include/net/bluetooth/l2cap.h | 3 +- net/bluetooth/6lowpan.c | 2 +- net/bluetooth/hci_conn.c | 78 +++++++++++++++++++++++++++++++ net/bluetooth/hci_core.c | 5 ++ net/bluetooth/hci_event.c | 4 ++ net/bluetooth/iso.c | 24 ++++++++-- net/bluetooth/l2cap_core.c | 11 ++++- net/bluetooth/l2cap_sock.c | 15 +++++- net/bluetooth/smp.c | 2 +- 11 files changed, 148 insertions(+), 9 deletions(-) -- 2.44.0