From patchwork Wed Feb 21 14:38:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 13565633 Received: from mail-oa1-f48.google.com (mail-oa1-f48.google.com [209.85.160.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 915C17C0B8 for ; Wed, 21 Feb 2024 14:38:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708526296; cv=none; b=diTrH0XpKQBqPib82UrxfxyB0oNQH0q/SjjXzRHS7C6mc5X94XFRD/0TCu5KzEeNQIwSIyxKy24LE5VMyH9ezCIKBKoPx6UH2oVx6gfvNm7Z1UUIZ0EraiAPPkmNnettT36Qi2PWqpAanP4tfA4i2XTCOGwJSILmX9GgTa7GCg8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708526296; c=relaxed/simple; bh=yAwVjnii4gOdKjVBPRKqszUhbHC1xKlL80xFSv2WaF0=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=QbFLfWeFmmvTBzv1B1QPrUt8aOJOm1S0mGpgITZ7qio2sNBmawo7x4oeBhgUEw7C3w+2Sd7ajr7XgW0YNkgrbY1dnAgjDXB4GnLKt+Co99d2qmOZAuKfYciicVqBTROWEKMY0e8kjdc6IS1TRBH6orLlf810Nr9Ae18Ie9YDo0Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DMAkORW3; arc=none smtp.client-ip=209.85.160.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DMAkORW3" Received: by mail-oa1-f48.google.com with SMTP id 586e51a60fabf-21f0c82e97fso434690fac.2 for ; Wed, 21 Feb 2024 06:38:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708526292; x=1709131092; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=ef5cxWS/DHX003FFu3ZV3XHChZLsTqEMaAm7lSIlAsk=; b=DMAkORW3Et+oHOnfIRa+XoeA0exEV4HevgJOopnQOYmA4mUdFTHPPO3/nKuJpsOkNR 13xluK/yYwesWXiIYhsGZBD+euDpNokFvj5N7nIOTz4KK+H07/mFw4HIropjk7Xf2UNQ ABKTWww5KWdMe1r5GvdVYtGVi2qpNo4wc4YJFslDa3ku3iLhYOuYBS5oew07CxrG8Ol4 hlk4Fi2tzDwp0UCY3vRbVZfqbuk/hUplIV6RVa5sPRWcXPxZ6V39y49Ocb0E0Jt3J7jY 3Onc3LPAA1slERzfgFzPkOaszM4hkiBsvTEHfuVG6jFSAmutKC6SwJzqObsNKjyHsm+x 32Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708526292; x=1709131092; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ef5cxWS/DHX003FFu3ZV3XHChZLsTqEMaAm7lSIlAsk=; b=LkkO9wXaOwM351QZhDAFxjRd8v3mKD+dM+I6/vhYfdlGvOCjvT1kYHxAJDHkEVevbo 60TI66BTi3gkIiLJmFlVcS7J9J3Sng7bcn8XD/tWatW3jHYyoxtJVenTdqOSt43fEkCj rDuTMVl1t071pPFiemUk6/9z7WRJYnKsoLIFsihL+n/uJlX1Nuhu78sNYObdVTeyyxQY +ZeEZSmJbTuqKY658Ko8TV9arPpXCAyvhYHd1PDKAHjfdDZJ4Y2q1de5WPCg1fB6wz1q pck5wHoO6HySXnP+06J2jTpOfTcwMYzrvlOSnBIPLeRWorR7oXanItUP4vUvviz2XZVj 7RGw== X-Gm-Message-State: AOJu0YxG1C6P1EB9Nor8lfqgPH5WVEoHYfZFm1lxKBjXnw8wAnNZMvU2 d34B16JU7Gor171HSfu6aSRBMkKpbUX6WhglxKdm+8gijqsgQIknKHMwsyAr X-Google-Smtp-Source: AGHT+IFnY7mLEqneOqeh15kRWAJjDIitE8DI0WHpcjOL4tqZjJe9gCmR5HzcgNR9uiQnK4E30/jHng== X-Received: by 2002:a05:6870:8a0d:b0:21e:8cd7:50de with SMTP id p13-20020a0568708a0d00b0021e8cd750demr14672194oaq.28.1708526292389; Wed, 21 Feb 2024 06:38:12 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id db22-20020a056130239600b007d9150e1596sm1807716uab.33.2024.02.21.06.38.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 06:38:11 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v1 1/2] Bluetooth: hci_sync: Use address filtering when HCI_PA_SYNC is set Date: Wed, 21 Feb 2024 09:38:09 -0500 Message-ID: <20240221143810.531710-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Luiz Augusto von Dentz If HCI_PA_SYNC flag is set it means there is a Periodic Advertising Synchronization pending, so this attempts to locate the address passed to HCI_OP_LE_PA_CREATE_SYNC and program it in the accept list so only reports with that address are processed. Signed-off-by: Luiz Augusto von Dentz --- net/bluetooth/hci_sync.c | 45 +++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index 669099cf9b1a..ab609089ac4c 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -2566,6 +2566,16 @@ static struct conn_params *conn_params_copy(struct list_head *list, size_t *n) return p; } +/* Clear LE Accept List */ +static int hci_le_clear_accept_list_sync(struct hci_dev *hdev) +{ + if (!(hdev->commands[26] & 0x80)) + return 0; + + return __hci_cmd_sync_status(hdev, HCI_OP_LE_CLEAR_ACCEPT_LIST, 0, NULL, + HCI_CMD_TIMEOUT); +} + /* Device must not be scanning when updating the accept list. * * Update is done using the following sequence: @@ -2614,6 +2624,31 @@ static u8 hci_update_accept_list_sync(struct hci_dev *hdev) goto done; } + /* Force address filtering if PA Sync is in progress */ + if (hci_dev_test_flag(hdev, HCI_PA_SYNC)) { + struct hci_cp_le_pa_create_sync *sent; + + sent = hci_sent_cmd_data(hdev, HCI_OP_LE_PA_CREATE_SYNC); + if (sent) { + struct conn_params pa; + + memset(&pa, 0, sizeof(pa)); + + bacpy(&pa.addr, &sent->addr); + pa.addr_type = sent->addr_type; + + /* Clear first since there could be addresses left + * behind. + */ + hci_le_clear_accept_list_sync(hdev); + + num_entries = 1; + err = hci_le_add_accept_list_sync(hdev, &pa, + &num_entries); + goto done; + } + } + /* Go through the current accept list programmed into the * controller one by one and check if that address is connected or is * still in the list of pending connections or list of devices to @@ -4220,16 +4255,6 @@ static int hci_le_read_accept_list_size_sync(struct hci_dev *hdev) 0, NULL, HCI_CMD_TIMEOUT); } -/* Clear LE Accept List */ -static int hci_le_clear_accept_list_sync(struct hci_dev *hdev) -{ - if (!(hdev->commands[26] & 0x80)) - return 0; - - return __hci_cmd_sync_status(hdev, HCI_OP_LE_CLEAR_ACCEPT_LIST, 0, NULL, - HCI_CMD_TIMEOUT); -} - /* Read LE Resolving List Size */ static int hci_le_read_resolv_list_size_sync(struct hci_dev *hdev) { From patchwork Wed Feb 21 14:38:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 13565634 Received: from mail-ua1-f54.google.com (mail-ua1-f54.google.com [209.85.222.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59FD37F7FF for ; Wed, 21 Feb 2024 14:38:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708526299; cv=none; b=bjwerqVu4vXLPJHoBGZqArAe4SstzNAQzzYE75ZMzyrgMILS9cpjLa+RKEau3wJP8FPbEzcgqNQlZ2wF1CnS1msY2bKfGAV/zReFfRsNaZTjELQ0BdVzdpFr+JjFz9pbomkNNXSk8/oEghpaOCO6EAiOhAKhn1+tgWfG0blhJxA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708526299; c=relaxed/simple; bh=DM6JF+QL2M3d/jC2Z9vqrIxg02qCUo8rLp2G+5UDybM=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TH5OB7yef2rdf20/X8YDmTJL2oOV92CxyOZxFadN8SRVPor2VWXzNVb/Dn/GxPRCWu7zAfwsz/VMYRbbE8TcYHs+4dqIyKjdhkvorAtQxcYTNQRh8MNRe7C2+WUW1zDt3EJhzbSDDebphWn2rJ9kbM4evxLeau4SmHzcp9u8fuA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mBwKFr1L; arc=none smtp.client-ip=209.85.222.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mBwKFr1L" Received: by mail-ua1-f54.google.com with SMTP id a1e0cc1a2514c-7d698a8d93cso4682842241.3 for ; Wed, 21 Feb 2024 06:38:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708526296; x=1709131096; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=N1tGRYuxSFtXOP2N+3nyu8coKSL2XnN9J/yyXp1uPW4=; b=mBwKFr1LvN8t191BZBd0+g9Ou3xe/7aaK9voeyma5q0Fzi31kxnVpFOV1o1PqwBSKz /FeBp9u2ZuCmMnXbFmxX9shVU06AsPyBushhqSQ3+eQXnV2AUoh7uT7oRBtHxepI3Rwc 9ayZLAPDI1Yi4P5xUSGp4srnLqVJPW3UQ3x+2AHu67gtYofYYKKmI/RRRZPF5DJTDuyp d61fzZpC++k8hP0PU1W4Byq8cUou/OIkNu8zkSdRDZQ8/dEv9ExfdWDv9q5WnECmVBEr AgtOSemU0PIZ9sDLH21sdWNTYhq1gEtvk5WvI6QHRMASov2tXk+w/wLnYvUNZR/r1DRA Mruw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708526296; x=1709131096; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N1tGRYuxSFtXOP2N+3nyu8coKSL2XnN9J/yyXp1uPW4=; b=hKVdTW9fUmwW1QcrSaQeK0jwu5Zpt5Tg44lp7ZVp43VPAub4JXbC1xNAabeK5lXYeD BzYUrKqMe6tvaF9U7D3e7hzjopxspPsOr0QQjg3t5oc1I/JXN794Fm+fUHhGFLHyyckO 7QNn8L2APAy4XS2Zi9C2I/ivSxKPG+6Cgv7/3P+hBFejy8xwqT8DGHbEWoqASc85+bga XWjSaVao1dqIHxzpXE5yERVPP+1h59xOhjLEVXolzYRkvVYsFn3eHGmw+2JcY+/mnn8G MElLAOeMkjjuF0iwRb9LGjIg1+Cgvs2Exw4KX1zSYbetzf794c4ln8Tfs2I6mx/T/k4q fXrw== X-Gm-Message-State: AOJu0Yx1F+EEwj82ZrybOuD39RJmu+soT3KtGppCTf/tTjGQHEgYS/5W /7MIYgCmgzRJRX2EsSeOLlbrB2dQPz9n7DgTPREocwKc1FuOYChA5UFsWEos X-Google-Smtp-Source: AGHT+IHckf3qPCrh34XoLAMa4Qj68JCoehsdevtUtTS/XBDPgXwaVALYsnXi9qSPEM0md7hPWypL6w== X-Received: by 2002:a05:6102:492:b0:470:5b6f:5ee9 with SMTP id n18-20020a056102049200b004705b6f5ee9mr8081178vsa.17.1708526295880; Wed, 21 Feb 2024 06:38:15 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id db22-20020a056130239600b007d9150e1596sm1807716uab.33.2024.02.21.06.38.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 06:38:12 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v1 2/2] Bluetooth: hci_sync: Don't scan on Coded PHY when HCI_PA_SYNC is set Date: Wed, 21 Feb 2024 09:38:10 -0500 Message-ID: <20240221143810.531710-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240221143810.531710-1-luiz.dentz@gmail.com> References: <20240221143810.531710-1-luiz.dentz@gmail.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Luiz Augusto von Dentz This disables Coded PHY when HCI_PA_SYNC is enabled. Signed-off-by: Luiz Augusto von Dentz --- net/bluetooth/hci_sync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index ab609089ac4c..e7ac9a993a07 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -2786,7 +2786,7 @@ static int hci_le_set_ext_scan_param_sync(struct hci_dev *hdev, u8 type, phy++; } - if (scan_coded(hdev)) { + if (scan_coded(hdev) && !hci_dev_test_flag(hdev, HCI_PA_SYNC)) { cp->scanning_phys |= LE_SCAN_PHY_CODED; phy->type = type;