Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6357110ybi; Mon, 8 Jul 2019 01:44:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqxjMVdcDWOiv3j3YKMGrNouC7b6xWSCpq4SRdK3Kic3AZWAhEQJyaejW48IjiZuXY2Ybel+ X-Received: by 2002:a17:902:e281:: with SMTP id cf1mr22147021plb.271.1562575490504; Mon, 08 Jul 2019 01:44:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562575490; cv=none; d=google.com; s=arc-20160816; b=iczXv4Wrgo1D+gW4F+kA6TV2ETAoZrc+q2iCYjpWRF0LNnkGoZcHuf6aXz33e3F9bo rn2s3cBpwnE3eGx3vuWQgLNkMrCiTR7sJx5q9BDZgdiHQljFfTYFy9j4+iMJnPCR7cFQ 45sMCRZowiIqvexzywxNq8Yo8lYFIL5/Ux7DiVS9RKRTbI6CHxjGfxhXFJUDrBOaAd9K 3qArvMJ25w6Ci9l1dBk933t++zWtmyiSejAeU8Xrei0zLaJCOkvbyRfXfjJ1bpuJcDCo HhqHngaSShl9D++VUfE9vsfz5BEg3Rfze9e3tX1RzMTKsQmRMwOCBJwX781yZAF2XWxC Gfpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from; bh=PA5gcEY3T9DgC6iAg5ALrUidk0737RRL3Vt5f6rz21Y=; b=FGYSJcIAxxf2/ouT+43wU+jwpVWPkz+NhXI70TxN9ykAwBG1WyjMIv2YSgm0jjTRFJ YwU9O0pQQIiaNuacVKggWXWI16ihMBnuZFkx54T9UslZlt/be2FMMnyqO1/kCXhd0A39 kkS5Xz4E5gRjsLnCE5tuVbqgQfVcAbFXHON3QjMWjxW46mTzR3pKy4oTFI+CZJJjCm9O Yi08VT9ckJLkM85c6kkhzY2VE0rohvbDsoGvnCVdwFN8TrWSxXbP8TnfvKpOBYczfbve TbqofH5e5w/OLE6JqL8yc28512FDi5O48pCzrfQfXAF1Bb7IGzWJufapt25ODdwDanfA 282g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e6si17739526pgl.305.2019.07.08.01.44.14; Mon, 08 Jul 2019 01:44:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727448AbfGHFz6 (ORCPT + 99 others); Mon, 8 Jul 2019 01:55:58 -0400 Received: from mga11.intel.com ([192.55.52.93]:11980 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727406AbfGHFz6 (ORCPT ); Mon, 8 Jul 2019 01:55:58 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jul 2019 22:55:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,465,1557212400"; d="scan'208";a="165371233" Received: from spoorthi-h97m-d3h.iind.intel.com ([10.223.96.21]) by fmsmga008.fm.intel.com with ESMTP; 07 Jul 2019 22:55:57 -0700 From: spoorthix.k@intel.com To: linux-bluetooth@vger.kernel.org Subject: [PATCH] Fast Advertising Interval Date: Mon, 8 Jul 2019 11:36:13 +0530 Message-Id: <1562565973-20657-1-git-send-email-spoorthix.k@intel.com> X-Mailer: git-send-email 1.9.1 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Spoorthi Ravishankar Koppad Changes made to add support for fast advertising interval as per core 4.1 specification, section 9.3.11.2. A peripheral device entering any of the following GAP modes and sending either non-connectable advertising events or scannable undirected advertising events should use adv_fast_interval2 (100ms - 150ms) for adv_fast_period(30s). - Non-Discoverable Mode - Non-Connectable Mode - Limited Discoverable Mode - General Discoverable Mode Signed-off-by: Spoorthi Ravishankar Koppad --- include/net/bluetooth/hci_core.h | 2 ++ net/bluetooth/hci_request.c | 25 +++++++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 7dfe6ff..a69534d 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1512,6 +1512,8 @@ struct hci_mgmt_chan { #define DISCOV_INTERLEAVED_INQUIRY_LEN 0x04 #define DISCOV_BREDR_INQUIRY_LEN 0x08 #define DISCOV_LE_RESTART_DELAY msecs_to_jiffies(200) /* msec */ +#define DISCOV_LE_FAST_ADV_INT_MIN 100 /* msec */ +#define DISCOV_LE_FAST_ADV_INT_MAX 150 /* msec */ void mgmt_fill_version_info(void *ver); int mgmt_new_settings(struct hci_dev *hdev); diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index d4ecf71..6d8ffcc 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c @@ -1199,15 +1199,24 @@ void __hci_req_enable_advertising(struct hci_request *req) return; memset(&cp, 0, sizeof(cp)); - cp.min_interval = cpu_to_le16(hdev->le_adv_min_interval); - cp.max_interval = cpu_to_le16(hdev->le_adv_max_interval); - - if (connectable) + if (connectable) { cp.type = LE_ADV_IND; - else if (get_cur_adv_instance_scan_rsp_len(hdev)) - cp.type = LE_ADV_SCAN_IND; - else - cp.type = LE_ADV_NONCONN_IND; + cp.min_interval = cpu_to_le16(hdev->le_adv_min_interval); + cp.max_interval = cpu_to_le16(hdev->le_adv_max_interval); + } else { + if (get_cur_adv_instance_scan_rsp_len(hdev)) + cp.type = LE_ADV_SCAN_IND; + else + cp.type = LE_ADV_NONCONN_IND; + + if (!hci_dev_test_flag(hdev, HCI_DISCOVERABLE) || + hci_dev_test_flag(hdev, HCI_LIMITED_DISCOVERABLE)) { + cp.min_interval = + cpu_to_le16(DISCOV_LE_FAST_ADV_INT_MIN); + cp.max_interval = + cpu_to_le16(DISCOV_LE_FAST_ADV_INT_MAX); + } + } cp.own_address_type = own_addr_type; cp.channel_map = hdev->le_adv_channel_map; -- 1.9.1