1. 06 6月, 2022 1 次提交
  2. 23 5月, 2022 1 次提交
  3. 13 5月, 2022 1 次提交
  4. 23 12月, 2021 2 次提交
  5. 08 12月, 2021 1 次提交
  6. 04 12月, 2021 2 次提交
  7. 16 11月, 2021 3 次提交
  8. 29 10月, 2021 5 次提交
    • L
      Bluetooth: hci_sync: Rework hci_suspend_notifier · 182ee45d
      Luiz Augusto von Dentz 提交于
      This makes hci_suspend_notifier use the hci_*_sync which can be
      executed synchronously which is allowed in the suspend_notifier and
      simplifies a lot of the handling since the status of each command can
      be checked inline so no other work need to be scheduled thus can be
      performed without using of a state machine.
      Signed-off-by: NLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      182ee45d
    • L
      Bluetooth: hci_sync: Convert MGMT_SET_POWERED · cf75ad8b
      Luiz Augusto von Dentz 提交于
      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: NLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      cf75ad8b
    • L
      Bluetooth: hci_sync: Enable advertising when LL privacy is enabled · ad383c2c
      Luiz Augusto von Dentz 提交于
      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: NLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      ad383c2c
    • L
      Bluetooth: hci_sync: Make use of hci_cmd_sync_queue set 1 · 161510cc
      Luiz Augusto von Dentz 提交于
      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: NLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      161510cc
    • M
      Bluetooth: Add helper for serialized HCI command execution · 6a98e383
      Marcel Holtmann 提交于
      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: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      6a98e383
  9. 28 9月, 2021 1 次提交
    • M
      Bluetooth: Fix Advertisement Monitor Suspend/Resume · ce81843b
      Manish Mandlik 提交于
      During system suspend, advertisement monitoring is disabled by setting
      the HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable to False. This
      disables the monitoring during suspend, however, if the controller is
      monitoring a device, it sends HCI_VS_MSFT_LE_Monitor_Device_Event to
      indicate that the monitoring has been stopped for that particular
      device. This event may occur after suspend depending on the
      low_threshold_timeout and peer device advertisement frequency, which
      causes early wake up.
      
      Right way to disable the monitoring for suspend is by removing all the
      monitors before suspend and re-monitor after resume to ensure no events
      are received during suspend. This patch fixes this suspend/resume issue.
      
      Following tests are performed:
      - Add monitors before suspend and make sure DeviceFound gets triggered
      - Suspend the system and verify that all monitors are removed by kernel
        but not Released by bluetoothd
      - Wake up and verify that all monitors are added again and DeviceFound
        gets triggered
      Signed-off-by: NManish Mandlik <mmandlik@google.com>
      Reviewed-by: NArchie Pusaka <apusaka@google.com>
      Reviewed-by: NMiao-chen Chou <mcchou@google.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      ce81843b
  10. 21 9月, 2021 1 次提交
  11. 08 9月, 2021 1 次提交
  12. 04 8月, 2021 1 次提交
  13. 26 6月, 2021 4 次提交
  14. 23 4月, 2021 1 次提交
    • L
      bluetooth: eliminate the potential race condition when removing the HCI controller · e2cb6b89
      Lin Ma 提交于
      There is a possible race condition vulnerability between issuing a HCI
      command and removing the cont.  Specifically, functions hci_req_sync()
      and hci_dev_do_close() can race each other like below:
      
      thread-A in hci_req_sync()      |   thread-B in hci_dev_do_close()
                                      |   hci_req_sync_lock(hdev);
      test_bit(HCI_UP, &hdev->flags); |
      ...                             |   test_and_clear_bit(HCI_UP, &hdev->flags)
      hci_req_sync_lock(hdev);        |
                                      |
      In this commit we alter the sequence in function hci_req_sync(). Hence,
      the thread-A cannot issue th.
      Signed-off-by: NLin Ma <linma@zju.edu.cn>
      Cc: Marcel Holtmann <marcel@holtmann.org>
      Fixes: 7c6a329e ("[Bluetooth] Fix regression from using default link policy")
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e2cb6b89
  15. 06 4月, 2021 2 次提交
  16. 02 4月, 2021 2 次提交
  17. 16 3月, 2021 1 次提交
    • S
      Bluetooth: Cancel le_scan_restart work when stopping discovery · c06632a4
      Sonny Sasaka 提交于
      Not cancelling it has caused a bug where passive background scanning is
      disabled out of the blue, preventing BLE keyboards/mice to reconnect.
      Here is how it happens:
      After hci_req_stop_discovery, there is still le_scan_restart_work
      scheduled. Invocation of le_scan_restart_work causes a harmful
      le_scan_disable_work to be scheduled. This le_scan_disable_work will
      eventually disable passive scanning when the timer fires.
      
      Sample btmon trace:
      
      < HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7
              Type: Passive (0x00)
              Interval: 367.500 msec (0x024c)
              Window: 37.500 msec (0x003c)
              Own address type: Public (0x00)
              Filter policy: Accept all advertisement (0x00)
      > HCI Event: Command Complete (0x0e) plen 4
            LE Set Scan Parameters (0x08|0x000b) ncmd 1
              Status: Success (0x00)
      < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
              Scanning: Enabled (0x01)
              Filter duplicates: Disabled (0x00)
      > HCI Event: Command Complete (0x0e) plen 4
            LE Set Scan Enable (0x08|0x000c) ncmd 2
              Status: Success (0x00)
      ...
      < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
              Scanning: Disabled (0x00)
              Filter duplicates: Disabled (0x00)
      > HCI Event: Command Complete (0x0e) plen 4
            LE Set Scan Enable (0x08|0x000c) ncmd 2
              Status: Success (0x00)
      // Background scanning is not working here onwards.
      Reviewed-by: NAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
      Signed-off-by: NSonny Sasaka <sonnysasaka@chromium.org>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      c06632a4
  18. 04 3月, 2021 2 次提交
  19. 25 1月, 2021 2 次提交
  20. 19 12月, 2020 1 次提交
  21. 07 12月, 2020 5 次提交