From: Johan Hedberg <johan.hedberg@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v2 4/4] Bluetooth: Merge ADV_IND/ADV_SCAN_IND and SCAN_RSP together
Date: Tue, 25 Mar 2014 10:23:21 +0200 [thread overview]
Message-ID: <20140325082321.GA5490@t440s.lan> (raw)
In-Reply-To: <713211EC-11CA-424C-93FD-AEF338D4FFD9@holtmann.org>
Hi Marcel,
On Mon, Mar 24, 2014, Marcel Holtmann wrote:
> > @@ -3944,6 +3962,8 @@ static void check_pending_le_conn(struct hci_dev *hdev, bdaddr_t *addr,
> > static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,
> > u8 bdaddr_type, s8 rssi, u8 *data, u8 len)
> > {
> > + struct discovery_state *d = &hdev->discovery;
> > +
> > /* Passive scanning shouldn't trigger any device found events */
> > if (hdev->le_scan_type == LE_SCAN_PASSIVE) {
> > if (type == LE_ADV_IND || type == LE_ADV_DIRECT_IND)
> > @@ -3951,8 +3971,60 @@ static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,
> > return;
> > }
> >
> > - mgmt_device_found(hdev, bdaddr, LE_LINK, bdaddr_type, NULL, rssi, 0, 1,
> > - data, len, NULL, 0);
> > + /* If there's nothing cached either cache the data from this
> > + * event or send an immediate device found event if the data is
> > + * not cachable.
> > + */
>
> I would not use the word cache since it is not really a cache. It is
> just a pending report.
>
> > + if (ADV_CACHE_EMPTY(d)) {
>
> Do we really need to check if the pending report is empty here. It
> will not match the bacmp() change anyway.
I agree with your other suggestions, but here I feel like the logic
stays more understandable with keeping this separate. E.g. one
difference between the two branches is the check for SCAN_RSP. It
prevents the code from trying to merge together two consecutive ADV_IND
from the same device. Furthermore, either way need to compare against
BDADDR_ANY first to know if a mismatch of bdaddrs means we should send
what's pending or not (if there's nothing pending).
I just have a hard time wrapping my head around a simpler solution
that's both understandable and correct. Feel free to suggest your own
solution, but this part of my patch will remain unchanged in the next
revision.
Johan
next prev parent reply other threads:[~2014-03-25 8:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-24 8:48 [PATCH v2 1/4] Bluetooth: Refactor advertising report processing into its own function johan.hedberg
2014-03-24 8:48 ` [PATCH v2 2/4] Bluetooth: Don't send device found events during passive scanning johan.hedberg
2014-03-24 14:41 ` Andre Guedes
2014-03-24 14:52 ` Johan Hedberg
2014-03-24 20:05 ` Marcel Holtmann
2014-03-24 8:48 ` [PATCH v2 3/4] Bluetooth: Add scan_rsp parameter to mgmt_device_found() johan.hedberg
2014-03-24 20:05 ` Marcel Holtmann
2014-03-24 8:48 ` [PATCH v2 4/4] Bluetooth: Merge ADV_IND/ADV_SCAN_IND and SCAN_RSP together johan.hedberg
2014-03-24 20:12 ` Marcel Holtmann
2014-03-25 8:23 ` Johan Hedberg [this message]
2014-03-24 20:05 ` [PATCH v2 1/4] Bluetooth: Refactor advertising report processing into its own function Marcel Holtmann
Reply instructions:
You may reply publicly 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=20140325082321.GA5490@t440s.lan \
--to=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=marcel@holtmann.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.