Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1237952ybi; Fri, 12 Jul 2019 12:04:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqyirnXsR+Gr2taK/FNIFjpgeMMhP0iYWvPFFDhuKWwOMDaHDNSHQ+tK/NQfM1g/Yp7tKCNy X-Received: by 2002:a17:902:8547:: with SMTP id d7mr13728380plo.171.1562958267442; Fri, 12 Jul 2019 12:04:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562958267; cv=none; d=google.com; s=arc-20160816; b=gKLh7i0/ypV4Dx/xycM/bI+mfs+krtYxdQ4V2UQlj2VuGzEC8oOzC0+DexjptyGAex HWahOdswmRap9Wb3OjwqK+FwXQJrt/39UeNxCno7y9WivBANT+0ujr6Q/7N9pKdxtogb LofsRZAfbVlEa1yukyLRMAayof58xfzSaSWFn/EmsEY0H7Jcscp/EcLwUoqAOOXPP3kE GOxPKTiZHFnh3g+wRHRpEuM1lP/N4t90Gv3nm7xSHHp75upwlLZlIMO+5RoOpO+Koadb wZWsJio+jUABUjrVKFguTbyCKc8LGSo2yxbvh60WwX7s96R5Ek1SuZSsBQfjwMHb2vVj 3viw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=4pZiuFaGtQq4nRH3nr9aJiWyKTWcx8OSFCUdiL00sac=; b=j9vVkjmF5KvasBqbZFaGYpW7JRBQu3pX4Ia4w1JJdvQKMz8eIbtVWALOUFa1laCJck IEZKziF1auwxj5DrJMBJSByT1QZ8vi76pwicfZCL+iOhaUfesj5OWvSjPrf/QW8dSCyL HP/ZSt2rw2jyLVaeVA6tg7Bc7rQv6a/M7P4q/hibiVPrVOIv8OC8f8q+fv2+BRnvbfuH QEzZ6s5/naPTnNbrv4UaVuD4az6J7DcHS8pbgbqlU9JP94VcCoEYHjA31sxW0E5paCyR u9O1nOr5pKiLf4aerGgEq8S0gLYjo+zFAYOGvxdAvFUq86h/+gODZxCT3htqCQcq21HJ wySA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j187si8701089pge.591.2019.07.12.12.04.12; Fri, 12 Jul 2019 12:04:27 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727186AbfGLTDt convert rfc822-to-8bit (ORCPT + 99 others); Fri, 12 Jul 2019 15:03:49 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:46099 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727053AbfGLTDt (ORCPT ); Fri, 12 Jul 2019 15:03:49 -0400 Received: from [192.168.22.73] (unknown [157.25.100.178]) by mail.holtmann.org (Postfix) with ESMTPSA id 3AB36CF2CB; Fri, 12 Jul 2019 21:12:19 +0200 (CEST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: [PATCH] Fast Advertising Interval From: Marcel Holtmann In-Reply-To: <1562565973-20657-1-git-send-email-spoorthix.k@intel.com> Date: Fri, 12 Jul 2019 21:03:42 +0200 Cc: linux-bluetooth@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: <1822906D-5F88-47E5-A4BD-FC3E8656DCDA@holtmann.org> References: <1562565973-20657-1-git-send-email-spoorthix.k@intel.com> To: SpoorthiX K X-Mailer: Apple Mail (2.3445.104.11) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Spoorthi, > 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); > + } isn’t this missing an else clause? > + } > > cp.own_address_type = own_addr_type; > cp.channel_map = hdev->le_adv_channel_map; I would move this block up right after the memset(). Regards Marcel