Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp690549lqh; Thu, 28 Mar 2024 13:16:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV64VAtRszXIkmN+/r0efrqAKbbbiEL+dBnzm6fgzSZ4rDEhqVjPOXxaJjgrHiKexodyakfQVzjrLe8410AEUAJ5Q0ROKB8WW1w7ZkKwQ== X-Google-Smtp-Source: AGHT+IGxgQpUTTaJaRUsYr4u35Pkz4Uvn38H2vK521xLFvQioZTb5nXnFLPiQBMMxgyAM9HRX+dF X-Received: by 2002:a0c:e3cf:0:b0:696:aee9:9cc8 with SMTP id e15-20020a0ce3cf000000b00696aee99cc8mr298268qvl.60.1711656967182; Thu, 28 Mar 2024 13:16:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711656967; cv=pass; d=google.com; s=arc-20160816; b=iPPQEiMLFm9SaAMZcEAcHW/xSv1qD8LslpEHVkKWIyw9GAO7kryy4BxpzszXkEKrL7 fQnR74kFfVZfEaqrmVkJ5Fa9EjlyoZ0+Vufu7CtI6isioCmjD1SSCqd08gYUvReq0sDy yxc23QdbkTu5SjxaN2ANemZldzA0bPKV/p7spzODrnDnakMEZzk2dmxIa8Lc1q5nmKr4 fqG5dqnx8a+ZPLtZp1T48D819m+rRKVlvNN1r8h2uTVsNCECUW/BSJLO2IeaRPwc7crp TQA/9lIdY5gSSmJgJGKtjaV32Y3gqD5JIOU1XY3EJwALXIy7pDSk6t/BigQrxH52RNtn 7u/w== ARC-Message-Signature: i=2; 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:to:from :dkim-signature; bh=koxyfcljbc+4qob8iwFKZ9Uki21GCwrzqQVYwhlFxwY=; fh=4lGQI6056MBa4/oovMyIYaKLn+Wz/24RGvUivMmQP8E=; b=oZMCdZouvTALifQSsJLeqH9eGPpQUcYaH3FPRn5trtK1l2vWvoQGlaiGT+L9dqQl8C 04acrwsockDYIL+6rZofCwO+RwJHwnO+14kNMSlYFVHYeXti2v7EFqqA5GbGabVLaItc rXd53Aqlrvh6SKnIu++85JkkxmGTL3rIax4RjSMiP0tj86tAxUqSSLEO7Rbkt4xkjLcM K/HGBUrosUnmTqnGi534wph3JXtleMcNtTui/CDjF5ECIk0fT9KD7WG0P8cpIE0F7rj1 h2q8misXXgk++PH3Xjc9fNeJFvuCAMOQC882vExKZe+xT6x3jtQ4Vc1FXalicKlvD5u7 Hu9Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=afY+HVg9; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-2925-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-2925-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id m6-20020a0cbf06000000b00690b67ee92asi2124897qvi.460.2024.03.28.13.16.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 13:16:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-2925-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=afY+HVg9; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-2925-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-2925-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 881C11C27F70 for ; Thu, 28 Mar 2024 20:16:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E3C3137C4B; Thu, 28 Mar 2024 20:16:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="afY+HVg9" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) (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 91A25446A1 for ; Thu, 28 Mar 2024 20:15:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711656961; cv=none; b=fcD5C4VJhOvKWfSZ8pd8pPV+ypZAMwgrITD71/McKsjS3WPaWy2eK+eKpvCiC3ZtKD3lvlT28GBqqPathuX7Nm/+7/1dliHwPjCQeHvxBPUM8+uOHTDpGYa9l2ZPiKuQpUKPOL4umAtwD9cg7AmB1lFvWz8NIAj7bxCBDFqbRlo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711656961; c=relaxed/simple; bh=4LWHeiE/Hf8yRfxrrk6GiVGT/3AcapRnOio8QZ/oz7E=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=MoqSwYlgr8LwsaR43QNP6leKaH5XKCqps/yW8XL9B7eAp/I4qrA4Qh2o2DvEvFBB7OVhgQaIoHjtjZboYYQgsFjK2mgTqrVplhL6HcFCnL8szQXj1xoQt9c4xqTu0lNbfBp6EvpsyaFaRrBkoPpyP7PCTN1OrfyvHz5rnrJFLBU= 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=afY+HVg9; arc=none smtp.client-ip=209.85.219.171 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 Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-dc6d8bd618eso1347507276.3 for ; Thu, 28 Mar 2024 13:15:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711656957; x=1712261757; 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=koxyfcljbc+4qob8iwFKZ9Uki21GCwrzqQVYwhlFxwY=; b=afY+HVg971px/vVnrPOIiRThz9cBkVt8vezVEPJqGBMJ2xWZLhrW4mhE3qQglGgG1V 4ZviFt2XKPzcWdwl6vWSC2U2nYvEFQsN2zGUGzg8l/He3JQTCPt7nI7r4Iwcx7ABeFGo kxLuOI2uXCbUohc3HvZT/kjQqyyCPgC6AFCpZ+HnmsKPJ+uODWKHWgvWCGxH5o7HoS7T WKxhNq9gJvR3Gsfwc4qrt3sRI6fuou+EuBEud88hYr/Z8fQlqB9CuxMq7+m4To7YE59y LHWgLZ/jjpwCGuMuTnGdh7KKI+zk09HE+h6fDWmWgESPH56z7RpRACS8Y81Wvw6h9UAJ JaiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711656957; x=1712261757; 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=koxyfcljbc+4qob8iwFKZ9Uki21GCwrzqQVYwhlFxwY=; b=a6vKhNIAh0cCLgwfvRPkOcqQ9UkUhGSm2CFkjH/+PFtMGqOqPH4+oycjqb+rSE4vF5 QQZ2TV1ck5bVEv9lfJnq8N38jkSS7fZZG26MLEScqtYFhEaF4zWtGqTib+sUWlbHugpV Jo6pSzea8taTFe8d2Pt5V7cBWH3+9JG5P80vMaFuQUZgbVt8F23IrtkrjyO6Emkpz89M eZ8JnEjh2F9bpbwosYi/xvJruGjzB/ecGyIn4w0TCarXtPmUcaQOrK/5lbRCIQayMiY3 6rkmBa547sJA1Xn5xdg2zh41m3gST9VnGd4HEhlvhrdN0AaHKJnL0YV7OKzDdOWcs7un jhNQ== X-Gm-Message-State: AOJu0Yz/y0KjOw4xeNs6lY6m1NDs4vVEyZxZQsaV+gypqUMdlNOvdjP9 mvNiMeUKIgF/jIb1okBOLUaQMiN3k9O7wd83QWAVGAfeXNek9NrjwYwNLyH6 X-Received: by 2002:a05:6902:c2:b0:dcc:9e88:b1b with SMTP id i2-20020a05690200c200b00dcc9e880b1bmr397966ybs.37.1711656957381; Thu, 28 Mar 2024 13:15:57 -0700 (PDT) Received: from lvondent-mobl4.. (107-146-107-067.biz.spectrum.com. [107.146.107.67]) by smtp.gmail.com with ESMTPSA id v10-20020a2583ca000000b00dcc620f4139sm453750ybm.14.2024.03.28.13.15.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 13:15:55 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v1 1/2] Bluetooth: Add proper definitions for scan interval and window Date: Thu, 28 Mar 2024 16:15:53 -0400 Message-ID: <20240328201554.1791904-1-luiz.dentz@gmail.com> 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 From: Luiz Augusto von Dentz This adds proper definitions for scan interval and window and then make use of them instead their values. Signed-off-by: Luiz Augusto von Dentz --- include/net/bluetooth/hci_core.h | 18 ++++++++++++++++-- net/bluetooth/hci_core.c | 16 ++++++++-------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 56fb42df44a3..90da28209ca9 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -2229,8 +2229,22 @@ void hci_mgmt_chan_unregister(struct hci_mgmt_chan *c); /* These LE scan and inquiry parameters were chosen according to LE General * Discovery Procedure specification. */ -#define DISCOV_LE_SCAN_WIN 0x12 -#define DISCOV_LE_SCAN_INT 0x12 +#define DISCOV_LE_SCAN_WIN 0x0012 /* 11.25 msec */ +#define DISCOV_LE_SCAN_INT 0x0012 /* 11.25 msec */ +#define DISCOV_LE_SCAN_INT_FAST 0x0060 /* 60 msec */ +#define DISCOV_LE_SCAN_WIN_FAST 0x0030 /* 30 msec */ +#define DISCOV_LE_SCAN_INT_CONN 0x0060 /* 60 msec */ +#define DISCOV_LE_SCAN_WIN_CONN 0x0060 /* 60 msec */ +#define DISCOV_LE_SCAN_INT_SLOW1 0x0800 /* 1.28 sec */ +#define DISCOV_LE_SCAN_WIN_SLOW1 0x0012 /* 11.25 msec */ +#define DISCOV_LE_SCAN_INT_SLOW2 0x1000 /* 2.56 sec */ +#define DISCOV_LE_SCAN_WIN_SLOW2 0x0024 /* 22.5 msec */ +#define DISCOV_CODED_SCAN_INT_FAST 0x0120 /* 180 msec */ +#define DISCOV_CODED_SCAN_WIN_FAST 0x0090 /* 90 msec */ +#define DISCOV_CODED_SCAN_INT_SLOW1 0x1800 /* 3.84 sec */ +#define DISCOV_CODED_SCAN_WIN_SLOW1 0x0036 /* 33.75 msec */ +#define DISCOV_CODED_SCAN_INT_SLOW2 0x3000 /* 7.68 sec */ +#define DISCOV_CODED_SCAN_WIN_SLOW2 0x006c /* 67.5 msec */ #define DISCOV_LE_TIMEOUT 10240 /* msec */ #define DISCOV_INTERLEAVED_TIMEOUT 5120 /* msec */ #define DISCOV_INTERLEAVED_INQUIRY_LEN 0x04 diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index a7028d38c1f5..dde333d9cfc1 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -2523,16 +2523,16 @@ struct hci_dev *hci_alloc_dev_priv(int sizeof_priv) hdev->le_adv_channel_map = 0x07; hdev->le_adv_min_interval = 0x0800; hdev->le_adv_max_interval = 0x0800; - hdev->le_scan_interval = 0x0060; - hdev->le_scan_window = 0x0030; - hdev->le_scan_int_suspend = 0x0400; - hdev->le_scan_window_suspend = 0x0012; + hdev->le_scan_interval = DISCOV_LE_SCAN_INT_FAST; + hdev->le_scan_window = DISCOV_LE_SCAN_WIN_FAST; + hdev->le_scan_int_suspend = DISCOV_LE_SCAN_INT_SLOW1; + hdev->le_scan_window_suspend = DISCOV_LE_SCAN_WIN_SLOW1; hdev->le_scan_int_discovery = DISCOV_LE_SCAN_INT; hdev->le_scan_window_discovery = DISCOV_LE_SCAN_WIN; - hdev->le_scan_int_adv_monitor = 0x0060; - hdev->le_scan_window_adv_monitor = 0x0030; - hdev->le_scan_int_connect = 0x0060; - hdev->le_scan_window_connect = 0x0060; + hdev->le_scan_int_adv_monitor = DISCOV_LE_SCAN_INT_FAST; + hdev->le_scan_window_adv_monitor = DISCOV_LE_SCAN_WIN_FAST; + hdev->le_scan_int_connect = DISCOV_LE_SCAN_INT_CONN; + hdev->le_scan_window_connect = DISCOV_LE_SCAN_WIN_CONN; hdev->le_conn_min_interval = 0x0018; hdev->le_conn_max_interval = 0x0028; hdev->le_conn_latency = 0x0000; -- 2.44.0