Linux-Bluetooth Archive on lore.kernel.org
 help / color / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: SpoorthiX K <spoorthix.k@intel.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] Fast Advertising Interval
Date: Fri, 12 Jul 2019 21:03:42 +0200
Message-ID: <1822906D-5F88-47E5-A4BD-FC3E8656DCDA@holtmann.org> (raw)
In-Reply-To: <1562565973-20657-1-git-send-email-spoorthix.k@intel.com>

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 <spoorthix.k@intel.com>
> ---
> 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


  reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-08  6:06 spoorthix.k
2019-07-12 19:03 ` Marcel Holtmann [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-06-21  9:22 [PATCH] Fast advertising interval spoorthix.k
2019-06-22  7:29 ` spoorthix.k
2019-07-06 10:42 ` Marcel Holtmann

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1822906D-5F88-47E5-A4BD-FC3E8656DCDA@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=spoorthix.k@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Bluetooth Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-bluetooth/0 linux-bluetooth/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-bluetooth linux-bluetooth/ https://lore.kernel.org/linux-bluetooth \
		linux-bluetooth@vger.kernel.org linux-bluetooth@archiver.kernel.org
	public-inbox-index linux-bluetooth


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-bluetooth


AGPL code for this site: git clone https://public-inbox.org/ public-inbox