1. 14 May, 2024 40 commits
    • Kiran K's avatar
      Bluetooth: btintel: Add support for BlazarI · 87ad06a2
      Kiran K authored
      Add support for BlazarI (cnvi) bluetooth core.
      Signed-off-by: default avatarKiran K <kiran.k@intel.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      87ad06a2
    • Mahesh Talewad's avatar
      LE Create Connection command timeout increased to 20 secs · 21d74b6b
      Mahesh Talewad authored
      On our DUT, we can see that the host issues create connection cancel
      command after 4-sec if there is no connection complete event for
      LE create connection cmd.
      As per core spec v5.3 section 7.8.5, advertisement interval range is-
      
      Advertising_Interval_Min
      Default : 0x0800(1.28s)
      Time Range: 20ms to 10.24s
      
      Advertising_Interval_Max
      Default : 0x0800(1.28s)
      Time Range: 20ms to 10.24s
      
      If the remote device is using adv interval of > 4 sec, it is
      difficult to make a connection with the current timeout value.
      Also, with the default interval of 1.28 sec, we will get only
      3 chances to capture the adv packets with the 4 sec window.
      Hence we want to increase this timeout to 20sec.
      Signed-off-by: default avatarMahesh Talewad <mahesh.talewad@nxp.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      21d74b6b
    • Chen-Yu Tsai's avatar
      dt-bindings: net: bluetooth: Add MediaTek MT7921S SDIO Bluetooth · defa9cca
      Chen-Yu Tsai authored
      The MediaTek MT7921S is a WiFi/Bluetooth combo chip that works over
      SDIO. WiFi and Bluetooth are separate SDIO functions within the chip.
      While the Bluetooth SDIO function is fully discoverable, the chip has
      a pin that can reset just the Bluetooth core, as opposed to the full
      chip. This should be described in the device tree.
      
      Add a device tree binding for the Bluetooth SDIO function of the MT7921S
      specifically to document the reset line. This binding is based on the MMC
      controller binding, which specifies one device node per SDIO function.
      
      Cc: Sean Wang <sean.wang@mediatek.com>
      Signed-off-by: default avatarChen-Yu Tsai <wenst@chromium.org>
      Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      defa9cca
    • Sebastian Urban's avatar
      Bluetooth: compute LE flow credits based on recvbuf space · ce60b923
      Sebastian Urban authored
      Previously LE flow credits were returned to the
      sender even if the socket's receive buffer was
      full. This meant that no back-pressure
      was applied to the sender, thus it continued to
      send data, resulting in data loss without any
      error being reported. Furthermore, the amount
      of credits was essentially fixed to a small
      amount, leading to reduced performance.
      
      This is fixed by computing the number of returned
      LE flow credits based on the estimated available
      space in the receive buffer of an L2CAP socket.
      Consequently, if the receive buffer is full, no
      credits are returned until the buffer is read and
      thus cleared by user-space.
      
      Since the computation of available receive buffer
      space can only be performed approximately (due to
      sk_buff overhead) and the receive buffer size may
      be changed by user-space after flow credits have
      been sent, superfluous received data is temporary
      stored within l2cap_pinfo. This is necessary
      because Bluetooth LE provides no retransmission
      mechanism once the data has been acked by the
      physical layer.
      
      If receive buffer space estimation is not possible
      at the moment, we fall back to providing credits
      for one full packet as before. This is currently
      the case during connection setup, when MPS is not
      yet available.
      
      Fixes: b1c325c2 ("Bluetooth: Implement returning of LE L2CAP credits")
      Signed-off-by: default avatarSebastian Urban <surban@surban.net>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      ce60b923
    • Gustavo A. R. Silva's avatar
      Bluetooth: hci_sync: Use cmd->num_cis instead of magic number · 73b2652c
      Gustavo A. R. Silva authored
      At the moment of the check, `cmd->num_cis` holds the value of 0x1f,
      which is the max number of elements in the `cmd->cis[]` array at
      declaration, which is 0x1f.
      
      So, avoid using 0x1f directly, and instead use `cmd->num_cis`. Similarly
      to this other patch[1].
      
      Link: https://lore.kernel.org/linux-hardening/ZivaHUQyDDK9fXEk@neat/ [1]
      Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      73b2652c
    • Gustavo A. R. Silva's avatar
      Bluetooth: hci_conn: Use struct_size() in hci_le_big_create_sync() · d6bb8782
      Gustavo A. R. Silva authored
      Use struct_size() instead of the open-coded version. Similarly to
      this other patch[1].
      
      Link: https://lore.kernel.org/linux-hardening/ZiwwPmCvU25YzWek@neat/ [1]
      Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      d6bb8782
    • Johan Hovold's avatar
      Bluetooth: qca: clean up defines · 4322502f
      Johan Hovold authored
      Clean up the QCA driver defines by dropping redundant parentheses around
      values and making sure they are aligned (using tabs only).
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      4322502f
    • Johan Hovold's avatar
      Bluetooth: qca: drop bogus module version · 83d8e815
      Johan Hovold authored
      Random module versions serves no purpose, what matters is the kernel
      version.
      
      Drop the bogus module version which has never been updated.
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      83d8e815
    • Johan Hovold's avatar
      Bluetooth: qca: drop bogus edl header checks · 280939bd
      Johan Hovold authored
      The skb->data pointer is never NULL so drop the bogus sanity checks when
      initialising the EDL header pointer.
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      280939bd
    • Marek Vasut's avatar
      dt-bindings: net: broadcom-bluetooth: Add CYW43439 DT binding · b33a0d29
      Marek Vasut authored
      CYW43439 is a Wi-Fi + Bluetooth combo device from Infineon.
      The Bluetooth part is capable of Bluetooth 5.2 BR/EDR/LE .
      This chip is present e.g. on muRata 1YN module.
      
      Extend the binding with its DT compatible using fallback
      compatible string to "brcm,bcm4329-bt" which seems to be
      the oldest compatible device. This should also prevent the
      growth of compatible string tables in drivers. The existing
      block of compatible strings is retained.
      Acked-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      b33a0d29
    • Gustavo A. R. Silva's avatar
      Bluetooth: hci_conn: Use __counted_by() to avoid -Wfamnae warning · c90748b8
      Gustavo A. R. Silva authored
      Prepare for the coming implementation by GCC and Clang of the
      __counted_by attribute. Flexible array members annotated with
      __counted_by can have their accesses bounds-checked at run-time
      via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE
      (for strcpy/memcpy-family functions).
      
      Also, -Wflex-array-member-not-at-end is coming in GCC-14, and we are
      getting ready to enable it globally.
      
      So, use the `DEFINE_FLEX()` helper for an on-stack definition of
      a flexible structure where the size of the flexible-array member
      is known at compile-time, and refactor the rest of the code,
      accordingly.
      
      With these changes, fix the following warning:
      net/bluetooth/hci_conn.c:2116:50: warning: structure containing a flexible
      array member is not at the end of another structure
      [-Wflex-array-member-not-at-end]
      
      Link: https://github.com/KSPP/linux/issues/202Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      c90748b8
    • Gustavo A. R. Silva's avatar
      Bluetooth: hci_conn, hci_sync: Use __counted_by() to avoid -Wfamnae warnings · c4585edf
      Gustavo A. R. Silva authored
      Prepare for the coming implementation by GCC and Clang of the
      __counted_by attribute. Flexible array members annotated with
      __counted_by can have their accesses bounds-checked at run-time
      via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE
      (for strcpy/memcpy-family functions).
      
      Also, -Wflex-array-member-not-at-end is coming in GCC-14, and we are
      getting ready to enable it globally.
      
      So, use the `DEFINE_FLEX()` helper for multiple on-stack definitions
      of a flexible structure where the size of the flexible-array member
      is known at compile-time, and refactor the rest of the code,
      accordingly.
      
      Notice that, due to the use of `__counted_by()` in `struct
      hci_cp_le_create_cis`, the for loop in function `hci_cs_le_create_cis()`
      had to be modified. Once the index `i`, through which `cp->cis[i]` is
      accessed, falls in the interval [0, cp->num_cis), `cp->num_cis` cannot
      be decremented all the way down to zero while accessing `cp->cis[]`:
      
      net/bluetooth/hci_event.c:4310:
      4310    for (i = 0; cp->num_cis; cp->num_cis--, i++) {
                      ...
      4314            handle = __le16_to_cpu(cp->cis[i].cis_handle);
      
      otherwise, only half (one iteration before `cp->num_cis == i`) or half
      plus one (one iteration before `cp->num_cis < i`) of the items in the
      array will be accessed before running into an out-of-bounds issue. So,
      in order to avoid this, set `cp->num_cis` to zero just after the for
      loop.
      
      Also, make use of `aux_num_cis` variable to update `cmd->num_cis` after
      a `list_for_each_entry_rcu()` loop.
      
      With these changes, fix the following warnings:
      net/bluetooth/hci_sync.c:1239:56: warning: structure containing a flexible
      array member is not at the end of another structure
      [-Wflex-array-member-not-at-end]
      net/bluetooth/hci_sync.c:1415:51: warning: structure containing a flexible
      array member is not at the end of another structure
      [-Wflex-array-member-not-at-end]
      net/bluetooth/hci_sync.c:1731:51: warning: structure containing a flexible
      array member is not at the end of another structure
      [-Wflex-array-member-not-at-end]
      net/bluetooth/hci_sync.c:6497:45: warning: structure containing a flexible
      array member is not at the end of another structure
      [-Wflex-array-member-not-at-end]
      
      Link: https://github.com/KSPP/linux/issues/202Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      c4585edf
    • Jiande Lu's avatar
      Bluetooth: btusb: Sort usb_device_id table by the ID · 3487cda2
      Jiande Lu authored
      Sort usb device id table for enhanced readability.
      Signed-off-by: default avatarJiande Lu <jiande.lu@mediatek.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      3487cda2
    • Jiande Lu's avatar
      Bluetooth: btusb: Add USB HW IDs for MT7921/MT7922/MT7925 · 129d3292
      Jiande Lu authored
      Add HW IDs for wireless module specific to Acer/ASUS
      notebook models to ensure proper recognition and functionality.
      These HW IDs are extracted from Windows driver inf file.
      Note some HW IDs without official drivers, still in testing phase.
      Thus, we update module HW ID and test ensure consistent boot success.
      Signed-off-by: default avatarJiande Lu <jiande.lu@mediatek.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      129d3292
    • Zijun Hu's avatar
      Bluetooth: qca: Support downloading board id specific NVM for WCN7850 · e41137d8
      Zijun Hu authored
      Download board id specific NVM instead of default for WCN7850 if board id
      is available.
      Signed-off-by: default avatarZijun Hu <quic_zijuhu@quicinc.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      e41137d8
    • Archie Pusaka's avatar
      Bluetooth: Populate hci_set_hw_info for Intel and Realtek · b39910bb
      Archie Pusaka authored
      The hardware information surfaced via debugfs might be usable by the
      userspace to set some configuration knobs. This patch sets the hw_info
      for Intel and Realtek chipsets.
      
      Below are some possible output of the hardware_info debugfs file.
      INTEL platform=55 variant=24
      RTL lmp_subver=34898 hci_rev=10 hci_ver=11 hci_bus=1
      Signed-off-by: default avatarArchie Pusaka <apusaka@chromium.org>
      Reviewed-by: default avatarAbhishek Pandit-Subedi <abhishekpandit@google.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      b39910bb
    • Zijun Hu's avatar
      Bluetooth: Remove 3 repeated macro definitions · 94c603c2
      Zijun Hu authored
      Macros HCI_REQ_DONE, HCI_REQ_PEND and HCI_REQ_CANCELED are repeatedly
      defined twice with hci_request.h, so remove a copy of definition.
      Signed-off-by: default avatarZijun Hu <quic_zijuhu@quicinc.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      94c603c2
    • Zijun Hu's avatar
      Bluetooth: hci_conn: Remove a redundant check for HFP offload · d68d8a7a
      Zijun Hu authored
      Remove a redundant check !hdev->get_codec_config_data.
      Signed-off-by: default avatarZijun Hu <quic_zijuhu@quicinc.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      d68d8a7a
    • Zijun Hu's avatar
      Bluetooth: btusb: Correct timeout macro argument used to receive control message · c48439fc
      Zijun Hu authored
      USB driver defines macro @USB_CTRL_SET_TIMEOUT for sending control message
      timeout and @USB_CTRL_GET_TIMEOUT for receiving, but usb_control_msg()
      uses wrong macro @USB_CTRL_SET_TIMEOUT as argument to receive control
      message, fixed by using @USB_CTRL_GET_TIMEOUT to receive message.
      Signed-off-by: default avatarZijun Hu <quic_zijuhu@quicinc.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      c48439fc
    • Peter Tsao's avatar
      Bluetooth: btusb: Fix the patch for MT7920 the affected to MT7921 · 958cd6be
      Peter Tsao authored
      Because both MT7920 and MT7921 use the same chip ID.
      We use the 8th bit of fw_flavor to distingush MT7920.
      The original patch made a mistake to check whole fw_flavor,
      that makes the condition both true (dev_id == 0x7961 && fw_flavor),
      and makes MT7921 flow wrong.
      
      In this patch, we correct the flow to get the 8th bit value for MT7920.
      And the patch is verified pass with both MT7920 and MT7921.
      Signed-off-by: default avatarPeter Tsao <peter.tsao@mediatek.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      958cd6be
    • Uri Arev's avatar
      Bluetooth: ath3k: Fix multiple issues reported by checkpatch.pl · 68aa2105
      Uri Arev authored
      This fixes some CHECKs reported by the checkpatch script.
      
      Issues reported in ath3k.c:
      -------
      ath3k.c
      -------
      CHECK: Please don't use multiple blank lines
      +
      +
      
      CHECK: Blank lines aren't necessary after an open brace '{'
      +static const struct usb_device_id ath3k_blist_tbl[] = {
      +
      
      CHECK: Alignment should match open parenthesis
      +static int ath3k_load_firmware(struct usb_device *udev,
      +                               const struct firmware *firmware)
      
      CHECK: Alignment should match open parenthesis
      +               err = usb_bulk_msg(udev, pipe, send_buf, size,
      +                                       &len, 3000);
      
      CHECK: Unnecessary parentheses around 'len != size'
      +               if (err || (len != size)) {
      
      CHECK: Alignment should match open parenthesis
      +static int ath3k_get_version(struct usb_device *udev,
      +                       struct ath3k_version *version)
      
      CHECK: Alignment should match open parenthesis
      +static int ath3k_load_fwfile(struct usb_device *udev,
      +               const struct firmware *firmware)
      
      CHECK: Alignment should match open parenthesis
      +               err = usb_bulk_msg(udev, pipe, send_buf, size,
      +                                       &len, 3000);
      
      CHECK: Unnecessary parentheses around 'len != size'
      +               if (err || (len != size)) {
      
      CHECK: Blank lines aren't necessary after an open brace '{'
      +       switch (fw_version.ref_clock) {
      +
      
      CHECK: Alignment should match open parenthesis
      +       snprintf(filename, ATH3K_NAME_LEN, "ar3k/ramps_0x%08x_%d%s",
      +               le32_to_cpu(fw_version.rom_version), clk_value, ".dfu");
      
      CHECK: Alignment should match open parenthesis
      +static int ath3k_probe(struct usb_interface *intf,
      +                       const struct usb_device_id *id)
      
      CHECK: Alignment should match open parenthesis
      +                       BT_ERR("Firmware file \"%s\" not found",
      +                                                       ATH3K_FIRMWARE);
      
      CHECK: Alignment should match open parenthesis
      +               BT_ERR("Firmware file \"%s\" request failed (err=%d)",
      +                                               ATH3K_FIRMWARE, ret);
      
      total: 0 errors, 0 warnings, 14 checks, 540 lines checked
      Signed-off-by: default avatarUri Arev <me@wantyapps.xyz>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      68aa2105
    • Hans de Goede's avatar
      Bluetooth: hci_bcm: Limit bcm43455 baudrate to 2000000 · 51931c55
      Hans de Goede authored
      Like the bcm43430a0 the bcm43455 BT does not support the 0xfc45 command
      to set the UART clock to 48 MHz and because of this it does not work
      at 4000000 baud.
      
      These chips are found on ACPI/x86 devices where the operating baudrate
      does not come from the firmware but is hardcoded at 4000000, which does
      not work.
      
      Make the driver_data for the "BCM2EA4" ACPI HID which is used for
      the bcm43455 BT point to bcm43430_device_data which limits the baudrate
      to 2000000.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      51931c55
    • Gustavo A. R. Silva's avatar
      Bluetooth: L2CAP: Avoid -Wflex-array-member-not-at-end warnings · 1c08108f
      Gustavo A. R. Silva authored
      -Wflex-array-member-not-at-end is coming in GCC-14, and we are getting
      ready to enable it globally.
      
      There are currently a couple of objects (`req` and `rsp`), in a couple
      of structures, that contain flexible structures (`struct l2cap_ecred_conn_req`
      and `struct l2cap_ecred_conn_rsp`), for example:
      
      struct l2cap_ecred_rsp_data {
              struct {
                      struct l2cap_ecred_conn_rsp rsp;
                      __le16 scid[L2CAP_ECRED_MAX_CID];
              } __packed pdu;
              int count;
      };
      
      in the struct above, `struct l2cap_ecred_conn_rsp` is a flexible
      structure:
      
      struct l2cap_ecred_conn_rsp {
              __le16 mtu;
              __le16 mps;
              __le16 credits;
              __le16 result;
              __le16 dcid[];
      };
      
      So, in order to avoid ending up with a flexible-array member in the
      middle of another structure, we use the `struct_group_tagged()` (and
      `__struct_group()` when the flexible structure is `__packed`) helper
      to separate the flexible array from the rest of the members in the
      flexible structure:
      
      struct l2cap_ecred_conn_rsp {
              struct_group_tagged(l2cap_ecred_conn_rsp_hdr, hdr,
      
      	... the rest of members
      
              );
              __le16 dcid[];
      };
      
      With the change described above, we now declare objects of the type of
      the tagged struct, in this example `struct l2cap_ecred_conn_rsp_hdr`,
      without embedding flexible arrays in the middle of other structures:
      
      struct l2cap_ecred_rsp_data {
              struct {
                      struct l2cap_ecred_conn_rsp_hdr rsp;
                      __le16 scid[L2CAP_ECRED_MAX_CID];
              } __packed pdu;
              int count;
      };
      
      Also, when the flexible-array member needs to be accessed, we use
      `container_of()` to retrieve a pointer to the flexible structure.
      
      We also use the `DEFINE_RAW_FLEX()` helper for a couple of on-stack
      definitions of a flexible structure where the size of the flexible-array
      member is known at compile-time.
      
      So, with these changes, fix the following warnings:
      net/bluetooth/l2cap_core.c:1260:45: warning: structure containing a
      flexible array member is not at the end of another structure
      [-Wflex-array-member-not-at-end]
      net/bluetooth/l2cap_core.c:3740:45: warning: structure containing a
      flexible array member is not at the end of another structure
      [-Wflex-array-member-not-at-end]
      net/bluetooth/l2cap_core.c:4999:45: warning: structure containing a
      flexible array member is not at the end of another structure
      [-Wflex-array-member-not-at-end]
      net/bluetooth/l2cap_core.c:7116:47: warning: structure containing a
      flexible array member is not at the end of another structure
      [-Wflex-array-member-not-at-end]
      
      Link: https://github.com/KSPP/linux/issues/202Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      1c08108f
    • Uri Arev's avatar
      Bluetooth: hci_intel: Fix multiple issues reported by checkpatch.pl · 62f7de37
      Uri Arev authored
      This fixes the following CHECKs, WARNINGs, and ERRORs reported in
      hci_intel.c
      
      Reported by checkpatch.pl:
      -----------
      hci_intel.c
      -----------
      WARNING: Prefer using '"%s...", __func__' to using 'intel_setup', this
              function's name, in a string
      +       bt_dev_dbg(hdev, "start intel_setup");
      
      ERROR: code indent should use tabs where possible
      +        /* Check for supported iBT hardware variants of this firmware$
      
      ERROR: code indent should use tabs where possible
      +         * loading method.$
      
      ERROR: code indent should use tabs where possible
      +         *$
      
      ERROR: code indent should use tabs where possible
      +         * This check has been put in place to ensure correct forward$
      
      ERROR: code indent should use tabs where possible
      +         * compatibility options when newer hardware variants come along.$
      
      ERROR: code indent should use tabs where possible
      +         */$
      
      CHECK: No space is necessary after a cast
      +       duration = (unsigned long long) ktime_to_ns(delta) >> 10;
      
      CHECK: No space is necessary after a cast
      +       duration = (unsigned long long) ktime_to_ns(delta) >> 10;
      
      WARNING: Missing a blank line after declarations
      +               int err = PTR_ERR(intel->rx_skb);
      +               bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err);
      Signed-off-by: default avatarUri Arev <me@wantyapps.xyz>
      Suggested-by: default avatarLuiz Augusto von Dentz <luiz.dentz@gmail.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      62f7de37
    • Iulia Tanasescu's avatar
      Bluetooth: ISO: Handle PA sync when no BIGInfo reports are generated · d356c924
      Iulia Tanasescu authored
      In case of a Broadcast Source that has PA enabled but no active BIG,
      a Broadcast Sink needs to establish PA sync and parse BASE from PA
      reports.
      
      This commit moves the allocation of a PA sync hcon from the BIGInfo
      advertising report event to the PA sync established event. After the
      first complete PA report, the hcon is notified to the ISO layer. A
      child socket is allocated and enqueued in the parent's accept queue.
      
      BIGInfo reports also need to be processed, to extract the encryption
      field and inform userspace. After the first BIGInfo report is received,
      the PA sync hcon is notified again to the ISO layer. Since a socket will
      be found this time, the socket state will transition to BT_CONNECTED and
      the userspace will be woken up using sk_state_change.
      Signed-off-by: default avatarIulia Tanasescu <iulia.tanasescu@nxp.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      d356c924
    • Iulia Tanasescu's avatar
      Bluetooth: ISO: Make iso_get_sock_listen generic · 311527e9
      Iulia Tanasescu authored
      This makes iso_get_sock_listen more generic, to return matching socket
      in the state provided as argument.
      Signed-off-by: default avatarIulia Tanasescu <iulia.tanasescu@nxp.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      311527e9
    • Luiz Augusto von Dentz's avatar
      Bluetooth: hci_event: Set DISCOVERY_FINDING on SCAN_ENABLED · 2e2515c1
      Luiz Augusto von Dentz authored
      This makes sure that discovery state is properly synchronized otherwise
      reports may not generate MGMT DeviceFound events as it would be assumed
      that it was not initiated by a discovery session.
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      2e2515c1
    • Luiz Augusto von Dentz's avatar
      Bluetooth: Add proper definitions for scan interval and window · 7c2cc5b1
      Luiz Augusto von Dentz authored
      This adds proper definitions for scan interval and window and then make
      use of them instead their values.
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      7c2cc5b1
    • Uwe Kleine-König's avatar
      Bluetooth: hci_intel: Convert to platform remove callback returning void · 2efbac88
      Uwe Kleine-König authored
      The .remove() callback for a platform driver returns an int which makes
      many driver authors wrongly assume it's possible to do error handling by
      returning an error code. However the value returned is ignored (apart
      from emitting a warning) and this typically results in resource leaks.
      
      To improve here there is a quest to make the remove callback return
      void. In the first step of this quest all drivers are converted to
      .remove_new(), which already returns void. Eventually after all drivers
      are converted, .remove_new() will be renamed to .remove().
      
      Trivially convert this driver from always returning zero in the remove
      callback to the void returning variant.
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      2efbac88
    • Uwe Kleine-König's avatar
      Bluetooth: hci_bcm: Convert to platform remove callback returning void · 536a0ad6
      Uwe Kleine-König authored
      The .remove() callback for a platform driver returns an int which makes
      many driver authors wrongly assume it's possible to do error handling by
      returning an error code. However the value returned is ignored (apart
      from emitting a warning) and this typically results in resource leaks.
      
      To improve here there is a quest to make the remove callback return
      void. In the first step of this quest all drivers are converted to
      .remove_new(), which already returns void. Eventually after all drivers
      are converted, .remove_new() will be renamed to .remove().
      
      Trivially convert this driver from always returning zero in the remove
      callback to the void returning variant.
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      536a0ad6
    • Uwe Kleine-König's avatar
      Bluetooth: btqcomsmd: Convert to platform remove callback returning void · 4a62832f
      Uwe Kleine-König authored
      The .remove() callback for a platform driver returns an int which makes
      many driver authors wrongly assume it's possible to do error handling by
      returning an error code. However the value returned is ignored (apart
      from emitting a warning) and this typically results in resource leaks.
      
      To improve here there is a quest to make the remove callback return
      void. In the first step of this quest all drivers are converted to
      .remove_new(), which already returns void. Eventually after all drivers
      are converted, .remove_new() will be renamed to .remove().
      
      Trivially convert this driver from always returning zero in the remove
      callback to the void returning variant.
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      4a62832f
    • Ian W MORRISON's avatar
      Bluetooth: Add support for MediaTek MT7922 device · 8c0401b7
      Ian W MORRISON authored
      This patch adds support for the MediaTek MT7922 Bluetooth device.
      
      The information in /sys/kernel/debug/usb/devices about the MT7922
      is as follows:
      
      T:  Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 0
      D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=13d3 ProdID=3585 Rev= 1.00
      S:  Manufacturer=MediaTek Inc.
      S:  Product=Wireless_Device
      S:  SerialNumber=000000000
      C:* #Ifs= 3 Cfg#= 1 Atr=e0 MxPwr=100mA
      A:  FirstIf#= 0 IfCount= 3 Cls=e0(wlcon) Sub=01 Prot=01
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=125us
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
      I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
      I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
      I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
      I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      I:  If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  63 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  63 Ivl=1ms
      I:* If#= 2 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
      E:  Ad=8a(I) Atr=03(Int.) MxPS=  64 Ivl=125us
      E:  Ad=0a(O) Atr=03(Int.) MxPS=  64 Ivl=125us
      I:  If#= 2 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
      E:  Ad=8a(I) Atr=03(Int.) MxPS= 512 Ivl=125us
      E:  Ad=0a(O) Atr=03(Int.) MxPS= 512 Ivl=125us
      Signed-off-by: default avatarIan W MORRISON <ianwmorrison@live.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      8c0401b7
    • Kiran K's avatar
      Bluetooth: btintel: Add support to download intermediate loader · f3b845e0
      Kiran K authored
      Some variants of Intel controllers like BlazarI supports downloading of
      Intermediate bootloader (IML) image. IML gives flexibility to fix issues as its
      not possible to fix issue in Primary bootloader once flashed to ROM. This patch
      adds the support to download IML before downloading operational firmware image.
      
      dmesg logs:
      [13.399003] Bluetooth: Core ver 2.22
      [13.399006] Bluetooth: Starting self testing
      [13.401194] Bluetooth: ECDH test passed in 2135 usecs
      [13.421175] Bluetooth: SMP test passed in 597 usecs
      [13.421184] Bluetooth: Finished self testing
      [13.422919] Bluetooth: HCI device and connection manager initialized
      [13.422923] Bluetooth: HCI socket layer initialized
      [13.422925] Bluetooth: L2CAP socket layer initialized
      [13.422930] Bluetooth: SCO socket layer initialized
      [13.458065] Bluetooth: hci0: Device revision is 0
      [13.458071] Bluetooth: hci0: Secure boot is disabled
      [13.458072] Bluetooth: hci0: OTP lock is disabled
      [13.458072] Bluetooth: hci0: API lock is enabled
      [13.458073] Bluetooth: hci0: Debug lock is disabled
      [13.458073] Bluetooth: hci0: Minimum firmware build 1 week 10 2014
      [13.458075] Bluetooth: hci0: Bootloader timestamp 2022.46 buildtype 1 build 26590
      [13.458324] Bluetooth: hci0: DSM reset method type: 0x00
      [13.460678] Bluetooth: hci0: Found device firmware: intel/ibt-0090-0291-iml.sfi
      [13.460684] Bluetooth: hci0: Boot Address: 0x30099000
      [13.460685] Bluetooth: hci0: Firmware Version: 227-11.24
      [13.562554] Bluetooth: hci0: Waiting for firmware download to complete
      [13.563023] Bluetooth: hci0: Firmware loaded in 99941 usecs
      [13.563057] Bluetooth: hci0: Waiting for device to boot
      [13.565029] Bluetooth: hci0: Malformed MSFT vendor event: 0x02
      [13.565148] Bluetooth: hci0: Device booted in 2064 usecs
      [13.567065] Bluetooth: hci0: No device address configured
      [13.569010] Bluetooth: hci0: Found device firmware: intel/ibt-0090-0291.sfi
      [13.569061] Bluetooth: hci0: Boot Address: 0x10000800
      [13.569062] Bluetooth: hci0: Firmware Version: 227-11.24
      [13.788891] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
      [13.788897] Bluetooth: BNEP filters: protocol multicast
      [13.788902] Bluetooth: BNEP socket layer initialized
      [15.435905] Bluetooth: hci0: Waiting for firmware download to complete
      [15.436016] Bluetooth: hci0: Firmware loaded in 1823233 usecs
      [15.436258] Bluetooth: hci0: Waiting for device to boot
      [15.471140] Bluetooth: hci0: Device booted in 34277 usecs
      [15.471201] Bluetooth: hci0: Malformed MSFT vendor event: 0x02
      [15.471487] Bluetooth: hci0: Found Intel DDC parameters: intel/ibt-0090-0291.ddc
      [15.474353] Bluetooth: hci0: Applying Intel DDC parameters completed
      [15.474486] Bluetooth: hci0: Found Intel DDC parameters: intel/bdaddress.cfg
      [15.475299] Bluetooth: hci0: Applying Intel DDC parameters completed
      [15.479381] Bluetooth: hci0: Firmware timestamp 2024.10 buildtype 3 build 58595
      [15.479385] Bluetooth: hci0: Firmware SHA1: 0xb4f3cc46
      [15.483243] Bluetooth: hci0: Fseq status: Success (0x00)
      [15.483246] Bluetooth: hci0: Fseq executed: 00.00.00.00
      [15.483247] Bluetooth: hci0: Fseq BT Top: 00.00.00.00
      [15.578712] Bluetooth: MGMT ver 1.22
      [15.822682] Bluetooth: RFCOMM TTY layer initialized
      [15.822690] Bluetooth: RFCOMM socket layer initialized
      [15.822695] Bluetooth: RFCOMM ver 1.11
      Signed-off-by: default avatarKiran K <kiran.k@intel.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      f3b845e0
    • Kiran K's avatar
      Bluetooth: btintel: Define macros for image types · 5ec6feb1
      Kiran K authored
      Use macro for image type instead of using hard code number.
      Signed-off-by: default avatarKiran K <kiran.k@intel.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      5ec6feb1
    • Jakub Kicinski's avatar
      net: revert partially applied PHY topology series · 5c167270
      Jakub Kicinski authored
      The series is causing issues with PHY drivers built as modules.
      Since it was only partially applied and the merge window has
      opened let's revert and try again for v6.11.
      
      Revert 6916e461 ("net: phy: Introduce ethernet link topology representation")
      Revert 0ec5ed6c ("net: sfp: pass the phy_device when disconnecting an sfp module's PHY")
      Revert e75e4e07 ("net: phy: add helpers to handle sfp phy connect/disconnect")
      Revert fdd35396 ("net: sfp: Add helper to return the SFP bus name")
      Revert 841942bc ("net: ethtool: Allow passing a phy index for some commands")
      
      Link: https://lore.kernel.org/all/171242462917.4000.9759453824684907063.git-patchwork-notify@kernel.org/
      Link: https://lore.kernel.org/all/20240507102822.2023826-1-maxime.chevallier@bootlin.com/
      Link: https://lore.kernel.org/r/20240513154156.104281-1-kuba@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      5c167270
    • Jakub Kicinski's avatar
      Merge branch 'move-est-lock-and-est-structure-to-struct-stmmac_priv' · b08191d8
      Jakub Kicinski authored
      Xiaolei Wang says:
      
      ====================
      Move EST lock and EST structure to struct stmmac_priv
      
      1. Pulling the mutex protecting the EST structure out to avoid
          clearing it during reinit/memset of the EST structure,and
          reacquire the mutex lock when doing this initialization.
      
      2. Moving the EST structure to a more logical location
      ====================
      
      Link: https://lore.kernel.org/r/20240513014346.1718740-1-xiaolei.wang@windriver.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b08191d8
    • Xiaolei Wang's avatar
      net: stmmac: move the EST structure to struct stmmac_priv · bd17382a
      Xiaolei Wang authored
      Move the EST structure to struct stmmac_priv, because the
      EST configs don't look like platform config, but EST is
      enabled in runtime with the settings retrieved for the TC
      TAPRIO feature also in runtime. So it's better to have the
      EST-data preserved in the driver private data instead of
      the platform data storage.
      Signed-off-by: default avatarXiaolei Wang <xiaolei.wang@windriver.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Reviewed-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Reviewed-by: default avatarAndrew Halaney <ahalaney@redhat.com>
      Link: https://lore.kernel.org/r/20240513014346.1718740-3-xiaolei.wang@windriver.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      bd17382a
    • Xiaolei Wang's avatar
      net: stmmac: move the EST lock to struct stmmac_priv · 36ac9e7f
      Xiaolei Wang authored
      Reinitialize the whole EST structure would also reset the mutex
      lock which is embedded in the EST structure, and then trigger
      the following warning. To address this, move the lock to struct
      stmmac_priv. We also need to reacquire the mutex lock when doing
      this initialization.
      
      DEBUG_LOCKS_WARN_ON(lock->magic != lock)
      WARNING: CPU: 3 PID: 505 at kernel/locking/mutex.c:587 __mutex_lock+0xd84/0x1068
       Modules linked in:
       CPU: 3 PID: 505 Comm: tc Not tainted 6.9.0-rc6-00053-g01066798-dirty #29
       Hardware name: NXP i.MX8MPlus EVK board (DT)
       pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
       pc : __mutex_lock+0xd84/0x1068
       lr : __mutex_lock+0xd84/0x1068
       sp : ffffffc0864e3570
       x29: ffffffc0864e3570 x28: ffffffc0817bdc78 x27: 0000000000000003
       x26: ffffff80c54f1808 x25: ffffff80c9164080 x24: ffffffc080d723ac
       x23: 0000000000000000 x22: 0000000000000002 x21: 0000000000000000
       x20: 0000000000000000 x19: ffffffc083bc3000 x18: ffffffffffffffff
       x17: ffffffc08117b080 x16: 0000000000000002 x15: ffffff80d2d40000
       x14: 00000000000002da x13: ffffff80d2d404b8 x12: ffffffc082b5a5c8
       x11: ffffffc082bca680 x10: ffffffc082bb2640 x9 : ffffffc082bb2698
       x8 : 0000000000017fe8 x7 : c0000000ffffefff x6 : 0000000000000001
       x5 : ffffff8178fe0d48 x4 : 0000000000000000 x3 : 0000000000000027
       x2 : ffffff8178fe0d50 x1 : 0000000000000000 x0 : 0000000000000000
       Call trace:
        __mutex_lock+0xd84/0x1068
        mutex_lock_nested+0x28/0x34
        tc_setup_taprio+0x118/0x68c
        stmmac_setup_tc+0x50/0xf0
        taprio_change+0x868/0xc9c
      
      Fixes: b2aae654 ("net: stmmac: add mutex lock to protect est parameters")
      Signed-off-by: default avatarXiaolei Wang <xiaolei.wang@windriver.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Reviewed-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Reviewed-by: default avatarAndrew Halaney <ahalaney@redhat.com>
      Link: https://lore.kernel.org/r/20240513014346.1718740-2-xiaolei.wang@windriver.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      36ac9e7f
    • Jakub Kicinski's avatar
      Merge branch 'mptcp-small-improvements-fix-and-clean-ups' · 95125152
      Jakub Kicinski authored
      Mat Martineau says:
      
      ====================
      mptcp: small improvements, fix and clean-ups
      
      This series contain mostly unrelated patches:
      
      - The two first patches can be seen as "fixes". They are part of this
        series for -next because it looks like the last batch of fixes for
        v6.9 has already been sent. These fixes are not urgent, so they can
        wait if an unlikely v6.9-rc8 is published. About the two patches:
          - Patch 1 fixes getsockopt(SO_KEEPALIVE) support on MPTCP sockets
          - Patch 2 makes sure the full TCP keep-alive feature is supported,
            not just SO_KEEPALIVE.
      
      - Patch 3 is a small optimisation when getsockopt(MPTCP_INFO) is used
        without buffer, just to check if MPTCP is still being used: no
        fallback to TCP.
      
      - Patch 4 adds net.mptcp.available_schedulers sysctl knob to list packet
        schedulers, similar to net.ipv4.tcp_available_congestion_control.
      
      - Patch 5 and 6 fix CheckPatch warnings: "prefer strscpy over strcpy"
        and "else is not generally useful after a break or return".
      
      - Patch 7 and 8 remove and add header includes to avoid unused ones, and
        add missing ones to be self-contained.
      ====================
      
      Link: https://lore.kernel.org/r/20240514011335.176158-1-martineau@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      95125152
    • Matthieu Baerts (NGI0)'s avatar
      mptcp: include inet_common in mib.h · 7fad5b37
      Matthieu Baerts (NGI0) authored
      So this file is now self-contained: it can be compiled alone with
      analytic tools.
      Reviewed-by: default avatarGeliang Tang <geliang@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Signed-off-by: default avatarMat Martineau <martineau@kernel.org>
      Link: https://lore.kernel.org/r/20240514011335.176158-9-martineau@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7fad5b37