FROMGIT: Bluetooth: Limit duration of Remote Name Resolve

When doing remote name request, we cannot scan. In the normal case it's
OK since we can expect it to finish within a short amount of time.
However, there is a possibility to scan lots of devices that
(1) requires Remote Name Resolve
(2) is unresponsive to Remote Name Resolve
When this happens, we are stuck to do Remote Name Resolve until all is
done before continue scanning.

This patch adds a time limit to stop us spending too long on remote
name request.

Signed-off-by: Archie Pusaka <apusaka@chromium.org>
Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
(cherry picked from commit dbf6811abbfcc79d3cd5ce1ff53fe1c741167a1f https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master)

BUG=b:201527418
TEST=Do the following tests with 3 or more peer devices.
     (1) Purposefully remove the extended inquiry response for peer
         devices by using "hcitool cmd 0x03 0x0052".
     (2) Use these peer devices to force the DUT to to RNR.
     (3) When the DUT is about to RNR, turn the peer device off.
     (4) Observe that the DUT will only make 1 or 2 RNRs (all timed
         out), then it will give up RNRing, and proceed to start the
         next cycle of scanning instead.

Change-Id: I35b7f3a496f834de6b43a32f94b6160cb1467c94
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/3310084
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
Commit-Queue: Archie Pusaka <apusaka@chromium.org>
Tested-by: Archie Pusaka <apusaka@chromium.org>
2 files changed