1. 29 Oct, 2021 8 commits
    • Luiz Augusto von Dentz's avatar
      Bluetooth: hci_sync: Convert MGMT_OP_START_DISCOVERY · abfeea47
      Luiz Augusto von Dentz authored
      This make use of hci_cmd_sync_queue for MGMT_OP_START_DISCOVERY,
      MGMT_OP_START_SERVICE_DISCOVERY and MGMT_OP_STOP_DISCOVERY to use
      hci_cmd_sync_queue so they no longer depend on hdev->discov_update work
      to send any commands.
      
      Tested with:
      
      tools/mgmt-tester -s "Start Discovery"
      
      Test Summary
      ------------
      Start Discovery - Not powered 1                      Passed
      Start Discovery - Invalid parameters 1               Passed
      Start Discovery - Not supported 1                    Passed
      Start Discovery - Success 1                          Passed
      Start Discovery - Success 2                          Passed
      Start Discovery - Power Off 1                        Passed
      Start Discovery BREDR LE - (Ext Scan Enable)         Passed
      Start Discovery LE - (Ext Scan Enable)               Passed
      Start Discovery LE - (Ext Scan Param)                Passed
      Start Discovery - (2m, Scan Param)                   Passed
      Start Discovery - (coded, Scan Param)                Passed
      Start Discovery - (1m, 2m, coded, Scan Param)        Passed
      LL Privacy - Start Discovery 1 (Disable RL)          Passed
      LL Privacy - Start Discovery 2 (Disable RL)          Passed
      Total: 14, Passed: 14 (100.0%), Failed: 0, Not Run: 0
      
      tools/mgmt-tester -s "Start Service"
      
      Test Summary
      ------------
      Start Service Discovery - Not powered 1              Passed
      Start Service Discovery - Invalid parameters 1       Passed
      Start Service Discovery - Not supported 1            Passed
      Start Service Discovery - Success 1                  Passed
      Start Service Discovery - Success 2                  Passed
      Total: 5, Passed: 5 (100.0%), Failed: 0, Not Run: 0
      
      tools/mgmt-tester -s "Stop Discovery"
      
      Test Summary
      ------------
      Stop Discovery - Success 1                           Passed
      Stop Discovery - BR/EDR (Inquiry) Success 1          Passed
      Stop Discovery - Rejected 1                          Passed
      Stop Discovery - Invalid parameters 1                Passed
      Stop Discovery - (Ext Scan Disable)                  Passed
      Total: 5, Passed: 5 (100.0%), Failed: 0, Not Run: 0
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      abfeea47
    • Luiz Augusto von Dentz's avatar
      Bluetooth: hci_sync: Convert MGMT_SET_POWERED · cf75ad8b
      Luiz Augusto von Dentz authored
      This make use of hci_cmd_sync_queue when MGMT_SET_POWERED is used so all
      commands are run within hdev->cmd_sync_work instead of
      hdev->power_on_work and hdev->power_off_work.
      
      In addition to that the power on sequence now takes into account if
      local IRK needs to be programmed in the resolving list.
      
      Tested with:
      
      tools/mgmt-tester -s "Set powered"
      
      Test Summary
      ------------
      Set powered on - Success                             Passed
      Set powered on - Invalid parameters 1                Passed
      Set powered on - Invalid parameters 2                Passed
      Set powered on - Invalid parameters 3                Passed
      Set powered on - Invalid index                       Passed
      Set powered on - Privacy and Advertising             Passed
      Set powered off - Success                            Passed
      Set powered off - Class of Device                    Passed
      Set powered off - Invalid parameters 1               Passed
      Set powered off - Invalid parameters 2               Passed
      Set powered off - Invalid parameters 3               Passed
      Total: 11, Passed: 11 (100.0%), Failed: 0, Not Run: 0
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      cf75ad8b
    • Luiz Augusto von Dentz's avatar
      Bluetooth: hci_sync: Rework background scan · 5bee2fd6
      Luiz Augusto von Dentz authored
      This replaces the use of hci_update_background_scan with
      hci_update_passive_scan which runs from cmd_work_sync and deal properly
      with resolving list when LL privacy is enabled.
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      5bee2fd6
    • Luiz Augusto von Dentz's avatar
      Bluetooth: hci_sync: Enable advertising when LL privacy is enabled · ad383c2c
      Luiz Augusto von Dentz authored
      This enables advertising when LL privacy is enabled and changes the
      command sequence when resolving list is updated to also account for when
      advertising is enabled using the following sequence:
      
      If there are devices to scan:
      
      Disable Scanning -> Update Accept List ->
      use_ll_privacy((Disable Advertising) -> Disable Resolving List ->
      Update Resolving List -> Enable Resolving List -> (Enable Advertising)) ->
      Enable Scanning
      
      Otherwise:
      
      Disable Scanning
      
      Errors during the Update Accept List stage are handled gracefully by
      restoring any previous state (e.g. advertising) and disabling the use of
      accept list as either accept list or resolving list could not be
      updated.
      
      Tested with:
      
      mgmt-tester -s "LL Privacy"
      
      Test Summary
      ------------
      LL Privacy - Add Device 1 (Add to WL)                Passed
      LL Privacy - Add Device 2 (Add to RL)                Passed
      LL Privacy - Add Device 3 (Enable RL)                Passed
      LL Privacy - Add Device 4 (2 Devices to WL)          Passed
      LL Privacy - Add Device 5 (2 Devices to RL)          Passed
      LL Privacy - Add Device 6 (RL is full)               Passed
      LL Privacy - Add Device 7 (WL is full)               Passed
      LL Privacy - Add Device 8 (Disable Adv)              Passed
      LL Privacy - Add Device 9 (Multi Adv)                Passed
      LL Privacy - Add Device 10 (Multi Dev and Multi Adv) Passed
      LL Privacy - Remove Device 1 (Remove from WL)        Passed
      LL Privacy - Remove Device 2 (Remove from RL)        Passed
      LL Privacy - Remove Device 3 (Disable RL)            Passed
      LL Privacy - Remove Device 4 (Disable Adv)           Passed
      LL Privacy - Remove Device 5 (Multi Adv)             Passed
      LL Privacy - Start Discovery 1 (Disable RL)          Passed
      LL Privacy - Start Discovery 2 (Disable RL)          Passed
      Total: 18, Passed: 18 (100.0%), Failed: 0, Not Run: 0
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      ad383c2c
    • Luiz Augusto von Dentz's avatar
      Bluetooth: hci_sync: Make use of hci_cmd_sync_queue set 3 · e8907f76
      Luiz Augusto von Dentz authored
      This make use of hci_cmd_sync_queue for the following MGMT commands:
      
          Add Device
          Remove Device
      
      Tested with:
      
      mgmt-tester -s "Add Device"
      
      Test Summary
      ------------
      Add Device - Invalid Params 1                        Passed
      Add Device - Invalid Params 2                        Passed
      Add Device - Invalid Params 3                        Passed
      Add Device - Invalid Params 4                        Passed
      Add Device - Success 1                               Passed
      Add Device - Success 2                               Passed
      Add Device - Success 3                               Passed
      Add Device - Success 4                               Passed
      Add Device - Success 5                               Passed
      Add Device - Success 6 - Add to whitelist            Passed
      Add Device - Success 7 - Add to resolv list          Passed
      Add Device - Success 8 - Enable resolv list          Passed
      Total: 12, Passed: 12 (100.0%), Failed: 0, Not Run: 0
      Overall execution time: 0.209 seconds
      
      mgmt-tester -s "Remove Device"
      
      Test Summary
      ------------
      Remove Device - Invalid Params 1                     Passed
      Remove Device - Invalid Params 2                     Passed
      Remove Device - Invalid Params 3                     Passed
      Remove Device - Success 1                            Passed
      Remove Device - Success 2                            Passed
      Remove Device - Success 3                            Passed
      Remove Device - Success 4                            Passed
      Remove Device - Success 5                            Passed
      Remove Device - Success 6 - All Devices              Passed
      Remove Device - Success 7 - Remove from whitelist    Passed
      Remove Device - Success 8 - Remove from resolv list  Passed
      Total: 11, Passed: 11 (100.0%), Failed: 0, Not Run: 0
      Overall execution time: 4.26 seconds
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      e8907f76
    • Luiz Augusto von Dentz's avatar
      Bluetooth: hci_sync: Make use of hci_cmd_sync_queue set 2 · cba6b758
      Luiz Augusto von Dentz authored
      This make use of hci_cmd_sync_queue for the following MGMT commands:
      
      Add Advertising
      Remove Advertising
      Add Extended Advertising Parameters
      Add Extended Advertising Data
      
      mgmt-tester -s "Add Advertising"
      
      Test Summary
      ------------
      Add Advertising - Failure: LE off                    Passed
      Add Advertising - Invalid Params 1 (AD too long)     Passed
      Add Advertising - Invalid Params 2 (Malformed len)   Passed
      Add Advertising - Invalid Params 3 (Malformed len)   Passed
      Add Advertising - Invalid Params 4 (Malformed len)   Passed
      Add Advertising - Invalid Params 5 (AD too long)     Passed
      Add Advertising - Invalid Params 6 (ScRsp too long)  Passed
      Add Advertising - Invalid Params 7 (Malformed len)   Passed
      Add Advertising - Invalid Params 8 (Malformed len)   Passed
      Add Advertising - Invalid Params 9 (Malformed len)   Passed
      Add Advertising - Invalid Params 10 (ScRsp too long) Passed
      Add Advertising - Rejected (Timeout, !Powered)       Passed
      Add Advertising - Success 1 (Powered, Add Adv Inst)  Passed
      Add Advertising - Success 2 (!Powered, Add Adv Inst) Passed
      Add Advertising - Success 3 (!Powered, Adv Enable)   Passed
      Add Advertising - Success 4 (Set Adv on override)    Passed
      Add Advertising - Success 5 (Set Adv off override)   Passed
      Add Advertising - Success 6 (Scan Rsp Dta, Adv ok)   Passed
      Add Advertising - Success 7 (Scan Rsp Dta, Scan ok)  Passed
      Add Advertising - Success 8 (Connectable Flag)       Passed
      Add Advertising - Success 9 (General Discov Flag)    Passed
      Add Advertising - Success 10 (Limited Discov Flag)   Passed
      Add Advertising - Success 11 (Managed Flags)         Passed
      Add Advertising - Success 12 (TX Power Flag)         Passed
      Add Advertising - Success 13 (ADV_SCAN_IND)          Passed
      Add Advertising - Success 14 (ADV_NONCONN_IND)       Passed
      Add Advertising - Success 15 (ADV_IND)               Passed
      Add Advertising - Success 16 (Connectable -> on)     Passed
      Add Advertising - Success 17 (Connectable -> off)    Passed
      Add Advertising - Success 18 (Power -> off, Remove)  Passed
      Add Advertising - Success 19 (Power -> off, Keep)    Passed
      Add Advertising - Success 20 (Add Adv override)      Passed
      Add Advertising - Success 21 (Timeout expires)       Passed
      Add Advertising - Success 22 (LE -> off, Remove)     Passed
      Add Advertising - Success (Empty ScRsp)              Passed
      Add Advertising - Success (ScRsp only)               Passed
      Add Advertising - Invalid Params (ScRsp too long)    Passed
      Add Advertising - Success (ScRsp appear)             Passed
      Add Advertising - Invalid Params (ScRsp appear long) Passed
      Add Advertising - Success (Appear is null)           Passed
      Add Advertising - Success (Name is null)             Passed
      Add Advertising - Success (Complete name)            Passed
      Add Advertising - Success (Shortened name)           Passed
      Add Advertising - Success (Short name)               Passed
      Add Advertising - Success (Name + data)              Passed
      Add Advertising - Invalid Params (Name + data)       Passed
      Add Advertising - Success (Name+data+appear)         Passed
      Total: 47, Passed: 47 (100.0%), Failed: 0, Not Run: 0
      Overall execution time: 2.17 seconds
      
      mgmt-tester -s "Remove Advertising"
      
      Test Summary
      ------------
      Remove Advertising - Invalid Params 1                Passed
      Remove Advertising - Success 1                       Passed
      Remove Advertising - Success 2                       Passed
      Total: 3, Passed: 3 (100.0%), Failed: 0, Not Run: 0
      Overall execution time: 0.0585 seconds
      
      mgmt-tester -s "Ext Adv MGMT Params"
      
      Test Summary:
      ------------
      Ext Adv MGMT Params - Unpowered                      Passed
      Ext Adv MGMT Params - Invalid parameters             Passed
      Ext Adv MGMT Params - Success                        Passed
      Ext Adv MGMT Params - (5.0) Success                  Passed
      Total: 4, Passed: 4 (100.0%), Failed: 0, Not Run: 0
      Overall execution time: 0.0746 seconds
      
      mgmt-tester -s "Ext Adv MGMT -"
      
      Test Summary
      ------------
      Ext Adv MGMT - Data set without Params               Passed
      Ext Adv MGMT - AD Data (5.0) Invalid parameters      Passed
      Ext Adv MGMT - AD Data (5.0) Success                 Passed
      Ext Adv MGMT - AD Scan Response (5.0) Success        Passed
      Total: 4, Passed: 4 (100.0%), Failed: 0, Not Run: 0
      Overall execution time: 0.0805 seconds
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      cba6b758
    • Luiz Augusto von Dentz's avatar
      Bluetooth: hci_sync: Make use of hci_cmd_sync_queue set 1 · 161510cc
      Luiz Augusto von Dentz authored
      This make use of hci_cmd_sync_queue for the following MGMT commands:
      
      Set Device Class
      Set Device ID
      Add UUID
      Remove UUID
      
      tools/mgmt-tester -s "Set Device Class"
      
      Test Summary
      ------------
      Set Device Class - Success 1                         Passed
      Set Device Class - Success 2                         Passed
      Set Device Class - Invalid parameters 1              Passed
      Total: 3, Passed: 3 (100.0%), Failed: 0, Not Run: 0
      Overall execution time: 0.0599 seconds
      
      tools/mgmt-tester -s "Set Device ID"
      
      Test Summary
      ------------
      Set Device ID - Success 1                            Passed
      Set Device ID - Success 2                            Passed
      Set Device ID - Disable                              Passed
      Set Device ID - Power off and Power on               Passed
      Set Device ID - SSP off and Power on                 Passed
      Set Device ID - Invalid Parameter                    Passed
      Total: 6, Passed: 6 (100.0%), Failed: 0, Not Run: 0
      Overall execution time: 0.107 seconds
      
      tools/mgmt-tester -s "Add UUID"
      
      Test Summary
      ------------
      Add UUID - UUID-16 1                                 Passed
      Add UUID - UUID-16 multiple 1                        Passed
      Add UUID - UUID-16 partial 1                         Passed
      Add UUID - UUID-32 1                                 Passed
      Add UUID - UUID-32 multiple 1                        Passed
      Add UUID - UUID-32 partial 1                         Passed
      Add UUID - UUID-128 1                                Passed
      Add UUID - UUID-128 multiple 1                       Passed
      Add UUID - UUID-128 partial 1                        Passed
      Add UUID - UUID mix                                  Passed
      Total: 10, Passed: 10 (100.0%), Failed: 0, Not Run: 0
      Overall execution time: 0.198 seconds
      
      tools/mgmt-tester -s "Remove UUID"
      
      Test Summary
      ------------
      Remove UUID - Success 1                              Passed
      Remove UUID - All UUID - Success 2                   Passed
      Remove UUID - Power Off - Success 3                  Passed
      Remove UUID - Power Off and On - Success 4           Passed
      Remove UUID - Not Exist - Invalid Params 1           Passed
      Total: 5, Passed: 5 (100.0%), Failed: 0, Not Run: 0
      Overall execution time: 0.0908 seconds
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      161510cc
    • Marcel Holtmann's avatar
      Bluetooth: Add helper for serialized HCI command execution · 6a98e383
      Marcel Holtmann authored
      The usage of __hci_cmd_sync() within the hdev->setup() callback allows for
      a nice and simple serialized execution of HCI commands. More importantly
      it allows for result processing before issueing the next command.
      
      With the current usage of hci_req_run() it is possible to batch up
      commands and execute them, but it is impossible to react to their
      results or errors.
      
      This is an attempt to generalize the hdev->setup() handling and provide
      a simple way of running multiple HCI commands from a single function
      context.
      
      There are multiple struct work that are decdicated to certain tasks
      already used right now. It is add a lot of bloat to hci_dev struct and
      extra handling code. So it might be possible to put all of these behind
      a common HCI command infrastructure and just execute the HCI commands
      from the same work context in a serialized fashion.
      
      For example updating the white list and resolving list can be done now
      without having to know the list size ahead of time. Also preparing for
      suspend or resume shouldn't require a state machine anymore. There are
      other tasks that should be simplified as well.
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      6a98e383
  2. 28 Oct, 2021 1 commit
  3. 25 Oct, 2021 13 commits
  4. 22 Oct, 2021 1 commit
  5. 20 Oct, 2021 2 commits
  6. 14 Oct, 2021 1 commit
  7. 13 Oct, 2021 5 commits
    • Mark-YW.Chen's avatar
      Bluetooth: btusb: fix memory leak in btusb_mtk_submit_wmt_recv_urb() · 60c6a63a
      Mark-YW.Chen authored
      Driver should free `usb->setup_packet` to avoid the leak.
      
      $ cat /sys/kernel/debug/kmemleak
      unreferenced object 0xffffffa564a58080 (size 128):
          backtrace:
              [<000000007eb8dd70>] kmem_cache_alloc_trace+0x22c/0x384
              [<000000008a44191d>] btusb_mtk_hci_wmt_sync+0x1ec/0x994
          [btusb]
              [<00000000ca7189a3>] btusb_mtk_setup+0x6b8/0x13cc
          [btusb]
              [<00000000c6105069>] hci_dev_do_open+0x290/0x974
          [bluetooth]
              [<00000000a583f8b8>] hci_power_on+0xdc/0x3cc [bluetooth]
              [<000000005d80e687>] process_one_work+0x514/0xc80
              [<00000000f4d57637>] worker_thread+0x818/0xd0c
              [<00000000dc7bdb55>] kthread+0x2f8/0x3b8
              [<00000000f9999513>] ret_from_fork+0x10/0x30
      
      Fixes: a1c49c43 ("Bluetooth: btusb: Add protocol support for MediaTek MT7668U USB devices")
      Signed-off-by: default avatarMark-YW.Chen <mark-yw.chen@mediatek.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      60c6a63a
    • Wei Yongjun's avatar
      Bluetooth: Fix memory leak of hci device · 75d9b855
      Wei Yongjun authored
      Fault injection test reported memory leak of hci device as follows:
      
      unreferenced object 0xffff88800b858000 (size 8192):
        comm "kworker/0:2", pid 167, jiffies 4294955747 (age 557.148s)
        hex dump (first 32 bytes):
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
          00 00 00 00 00 00 00 00 00 00 00 00 ad 4e ad de  .............N..
        backtrace:
          [<0000000070eb1059>] kmem_cache_alloc_trace mm/slub.c:3208
          [<00000000015eb521>] hci_alloc_dev_priv include/linux/slab.h:591
          [<00000000dcfc1e21>] bpa10x_probe include/net/bluetooth/hci_core.h:1240
          [<000000005d3028c7>] usb_probe_interface drivers/usb/core/driver.c:397
          [<00000000cbac9243>] really_probe drivers/base/dd.c:517
          [<0000000024cab3f0>] __driver_probe_device drivers/base/dd.c:751
          [<00000000202135cb>] driver_probe_device drivers/base/dd.c:782
          [<000000000761f2bc>] __device_attach_driver drivers/base/dd.c:899
          [<00000000f7d63134>] bus_for_each_drv drivers/base/bus.c:427
          [<00000000c9551f0b>] __device_attach drivers/base/dd.c:971
          [<000000007f79bd16>] bus_probe_device drivers/base/bus.c:487
          [<000000007bb8b95a>] device_add drivers/base/core.c:3364
          [<000000009564d9ea>] usb_set_configuration drivers/usb/core/message.c:2171
          [<00000000e4657087>] usb_generic_driver_probe drivers/usb/core/generic.c:239
          [<0000000071ede518>] usb_probe_device drivers/usb/core/driver.c:294
          [<00000000cbac9243>] really_probe drivers/base/dd.c:517
      
      hci_alloc_dev() do not init the device's flag. And hci_free_dev()
      using put_device() to free the memory allocated for this device,
      but it calls just put_device(dev) only in case of HCI_UNREGISTER
      flag is set, So any error handing before hci_register_dev() success
      will cause memory leak.
      
      To avoid this behaviour we can using kfree() to release dev before
      hci_register_dev() success.
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      75d9b855
    • Kiran K's avatar
      Bluetooth: btintel: Fix bdaddress comparison with garbage value · 89350531
      Kiran K authored
      Intel Read Verision(TLV) data is parsed into a local structure variable
      and it contains a field for bd address. Bd address is returned only in
      bootloader mode and hence bd address in TLV structure needs to be validated
      only if controller is present in boot loader mode.
      Signed-off-by: default avatarKiran K <kiran.k@intel.com>
      Reviewed-by: default avatarTedd Ho-Jeong An <tedd.an@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      89350531
    • Wei Yongjun's avatar
      Bluetooth: Fix debugfs entry leak in hci_register_dev() · 5a4bb6a8
      Wei Yongjun authored
      Fault injection test report debugfs entry leak as follows:
      
      debugfs: Directory 'hci0' with parent 'bluetooth' already present!
      
      When register_pm_notifier() failed in hci_register_dev(), the debugfs
      create by debugfs_create_dir() do not removed in the error handing path.
      
      Add the remove debugfs code to fix it.
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      5a4bb6a8
    • David Yang's avatar
      Bluetooth: btusb: Fix application of sizeof to pointer · dc1650fc
      David Yang authored
      The coccinelle check report:
      "./drivers/bluetooth/btusb.c:2239:36-42:
      ERROR: application of sizeof to pointer".
      Using the real size to fix it.
      
      Fixes: 5a87679f ("Bluetooth: btusb: Support public address configuration for MediaTek Chip.")
      Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
      Signed-off-by: default avatarDavid Yang <davidcomponentone@gmail.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      dc1650fc
  8. 12 Oct, 2021 2 commits
  9. 07 Oct, 2021 3 commits
  10. 06 Oct, 2021 2 commits
    • Luiz Augusto von Dentz's avatar
      Bluetooth: Fix handling of SUSPEND_DISCONNECTING · 83775456
      Luiz Augusto von Dentz authored
      When SUSPEND_DISCONNECTING bit is set that means Disconnect is pending
      but the code was evaluating if the list is empty before calling
      hci_conn_del which does the actual cleanup and remove the connection
      from the list thus the bit is never cleared causing the suspend
      procedure to always timeout when there are connections to be
      disconnected:
      
      Suspend/Resume - Success 5 (Pairing - Legacy) - waiting done
        Set the system into Suspend via force_suspend
      = mgmt-tester: Suspend/Resume - Success 5 (Pairing -..   17:03:13.200458
      = mgmt-tester: Set the system into Suspend via force_suspend    17:03:13.205812
      < HCI Command: Write Scan E.. (0x03|0x001a) plen 1  #122 [hci0] 17:03:13.213561
              Scan enable: No Scans (0x00)
      > HCI Event: Command Complete (0x0e) plen 4         #123 [hci0] 17:03:13.214710
            Write Scan Enable (0x03|0x001a) ncmd 1
              Status: Success (0x00)
      < HCI Command: Disconnect (0x01|0x0006) plen 3      #124 [hci0] 17:03:13.215830
              Handle: 42
              Reason: Remote Device Terminated due to Power Off (0x15)
      > HCI Event: Command Status (0x0f) plen 4           #125 [hci0] 17:03:13.216602
            Disconnect (0x01|0x0006) ncmd 1
              Status: Success (0x00)
      > HCI Event: Disconnect Complete (0x05) plen 4      #126 [hci0] 17:03:13.217342
              Status: Success (0x00)
              Handle: 42
              Reason: Remote Device Terminated due to Power Off (0x15)
      @ MGMT Event: Device Disconn.. (0x000c) plen 8  {0x0002} [hci0] 17:03:13.217688
              BR/EDR Address: 00:AA:01:01:00:00 (Intel Corporation)
              Reason: Connection terminated by local host for suspend (0x05)
      @ MGMT Event: Device Disconn.. (0x000c) plen 8  {0x0001} [hci0] 17:03:13.217688
              BR/EDR Address: 00:AA:01:01:00:00 (Intel Corporation)
              Reason: Connection terminated by local host for suspend (0x05)
      Suspend/Resume - Success 5 (Pairing - Legacy) - test timed out
      = mgmt-tester: Suspend/Resume - Success 5 (Pairing -..   17:03:13.939317
      Suspend/Resume - Success 5 (Pairing - Legacy) - teardown
      = mgmt-tester: Suspend/Resume - Success 5 (Pairing -..   17:03:13.947267
      [   13.284291] Bluetooth: hci0: Timed out waiting for suspend events
      [   13.287324] Bluetooth: hci0: Suspend timeout bit: 6
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      83775456
    • Luiz Augusto von Dentz's avatar
      Bluetooth: hci_vhci: Fix calling hci_{suspend,resume}_dev · d16e6d19
      Luiz Augusto von Dentz authored
      Defer calls to hci_{suspend,resume}_dev to work so it doesn't block the
      processing of the events.
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      d16e6d19
  11. 05 Oct, 2021 2 commits