Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-net-next-2025-07-23' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next

Luiz Augusto von Dentz says:

====================
bluetooth-next pull request for net-next:

core:

- hci_sync: fix double free in 'hci_discovery_filter_clear()'
- hci_event: Mask data status from LE ext adv reports
- hci_devcd_dump: fix out-of-bounds via dev_coredumpv
- ISO: add socket option to report packet seqnum via CMSG
- hci_event: Add support for handling LE BIG Sync Lost event
- ISO: Support SCM_TIMESTAMPING for ISO TS
- hci_core: Add PA_LINK to distinguish BIG sync and PA sync connections
- hci_sock: Reset cookie to zero in hci_sock_free_cookie()

drivers:

- btusb: Add new VID/PID 0489/e14e for MT7925
- btusb: Add a new VID/PID 2c7c/7009 for MT7925
- btusb: Add RTL8852BE device 0x13d3:0x3618
- btusb: Add support for variant of RTL8851BE (USB ID 13d3:3601)
- btusb: Add USB ID 3625:010b for TP-LINK Archer TX10UB Nano
- btusb: QCA: Support downloading custom-made firmwares
- btusb: Add one more ID 0x28de:0x1401 for Qualcomm WCN6855
- nxp: add support for supply and reset
- btnxpuart: Add support for 4M baudrate
- btnxpuart: Correct the Independent Reset handling after FW dump
- btnxpuart: Add uevents for FW dump and FW download complete
- btintel: Define a macro for Intel Reset vendor command
- btintel_pcie: Support Function level reset
- btintel_pcie: Add support for device 0x4d76
- btintel_pcie: Make driver wait for alive interrupt
- btintel_pcie: Fix Alive Context State Handling
- hci_qca: Enable ISO data packet RX

* tag 'for-net-next-2025-07-23' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next: (42 commits)
Bluetooth: Add PA_LINK to distinguish BIG sync and PA sync connections
Bluetooth: hci_event: Mask data status from LE ext adv reports
Bluetooth: btintel_pcie: Fix Alive Context State Handling
Bluetooth: btintel_pcie: Make driver wait for alive interrupt
Bluetooth: hci_devcd_dump: fix out-of-bounds via dev_coredumpv
Bluetooth: hci_sync: fix double free in 'hci_discovery_filter_clear()'
Bluetooth: btusb: Add one more ID 0x28de:0x1401 for Qualcomm WCN6855
Bluetooth: btusb: Sort WCN6855 device IDs by VID and PID
Bluetooth: btusb: QCA: Support downloading custom-made firmwares
Bluetooth: btnxpuart: Add uevents for FW dump and FW download complete
Bluetooth: btnxpuart: Correct the Independent Reset handling after FW dump
Bluetooth: ISO: Support SCM_TIMESTAMPING for ISO TS
Bluetooth: ISO: add socket option to report packet seqnum via CMSG
Bluetooth: btintel: Define a macro for Intel Reset vendor command
Bluetooth: Fix typos in comments
Bluetooth: RFCOMM: Fix typos in comments
Bluetooth: aosp: Fix typo in comment
Bluetooth: hci_bcm4377: Fix typo in comment
Bluetooth: btrtl: Fix typo in comment
Bluetooth: btmtk: Fix typo in log string
...
====================

Link: https://patch.msgid.link/20250723190233.166823-1-luiz.dentz@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+726 -229
+18
Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-bt.yaml
··· 34 34 This property depends on the module vendor's 35 35 configuration. 36 36 37 + max-speed: 38 + $ref: /schemas/types.yaml#/definitions/uint32 39 + enum: 40 + - 3000000 41 + - 4000000 42 + default: 3000000 43 + 37 44 firmware-name: 38 45 maxItems: 1 39 46 ··· 72 65 description: 73 66 The GPIO number of the NXP chipset used for BT_WAKE_OUT. 74 67 68 + vcc-supply: 69 + description: 70 + phandle of the regulator that provides the supply voltage. 71 + 72 + reset-gpios: 73 + description: 74 + Chip powerdown/reset signal (PDn). 75 + 75 76 required: 76 77 - compatible 77 78 ··· 93 78 bluetooth { 94 79 compatible = "nxp,88w8987-bt"; 95 80 fw-init-baudrate = <3000000>; 81 + max-speed = <4000000>; 96 82 firmware-name = "uartuart8987_bt_v0.bin"; 97 83 device-wakeup-gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; 98 84 nxp,wakein-pin = /bits/ 8 <18>; 99 85 nxp,wakeout-pin = /bits/ 8 <19>; 86 + vcc-supply = <&nxp_iw612_supply>; 87 + reset-gpios = <&gpioctrl 2 GPIO_ACTIVE_LOW>; 100 88 local-bd-address = [66 55 44 33 22 11]; 101 89 interrupt-parent = <&gpio>; 102 90 interrupts = <8 IRQ_TYPE_EDGE_FALLING>;
+3 -3
drivers/bluetooth/btintel.c
··· 555 555 /* Consume Command Complete Status field */ 556 556 skb_pull(skb, 1); 557 557 558 - /* Event parameters contatin multiple TLVs. Read each of them 558 + /* Event parameters contain multiple TLVs. Read each of them 559 559 * and only keep the required data. Also, it use existing legacy 560 560 * version field like hw_platform, hw_variant, and fw_variant 561 561 * to keep the existing setup flow ··· 889 889 890 890 params.boot_param = cpu_to_le32(boot_param); 891 891 892 - skb = __hci_cmd_sync(hdev, 0xfc01, sizeof(params), &params, 892 + skb = __hci_cmd_sync(hdev, BTINTEL_HCI_OP_RESET, sizeof(params), &params, 893 893 HCI_INIT_TIMEOUT); 894 894 if (IS_ERR(skb)) { 895 895 bt_dev_err(hdev, "Failed to send Intel Reset command"); ··· 1287 1287 params.boot_option = 0x00; 1288 1288 params.boot_param = cpu_to_le32(0x00000000); 1289 1289 1290 - skb = __hci_cmd_sync(hdev, 0xfc01, sizeof(params), 1290 + skb = __hci_cmd_sync(hdev, BTINTEL_HCI_OP_RESET, sizeof(params), 1291 1291 &params, HCI_INIT_TIMEOUT); 1292 1292 if (IS_ERR(skb)) { 1293 1293 bt_dev_err(hdev, "FW download error recovery failed (%ld)",
+2
drivers/bluetooth/btintel.h
··· 52 52 u8 val[]; 53 53 } __packed; 54 54 55 + #define BTINTEL_HCI_OP_RESET 0xfc01 56 + 55 57 #define BTINTEL_CNVI_BLAZARI 0x900 56 58 #define BTINTEL_CNVI_BLAZARIW 0x901 57 59 #define BTINTEL_CNVI_GAP 0x910
+288 -59
drivers/bluetooth/btintel_pcie.c
··· 35 35 36 36 /* Intel Bluetooth PCIe device id table */ 37 37 static const struct pci_device_id btintel_pcie_table[] = { 38 + { BTINTEL_PCI_DEVICE(0x4D76, PCI_ANY_ID) }, 38 39 { BTINTEL_PCI_DEVICE(0xA876, PCI_ANY_ID) }, 39 40 { BTINTEL_PCI_DEVICE(0xE476, PCI_ANY_ID) }, 40 41 { 0 } 41 42 }; 42 43 MODULE_DEVICE_TABLE(pci, btintel_pcie_table); 44 + 45 + struct btintel_pcie_dev_recovery { 46 + struct list_head list; 47 + u8 count; 48 + time64_t last_error; 49 + char name[]; 50 + }; 43 51 44 52 /* Intel PCIe uses 4 bytes of HCI type instead of 1 byte BT SIG HCI type */ 45 53 #define BTINTEL_PCIE_HCI_TYPE_LEN 4 ··· 69 61 70 62 #define BTINTEL_PCIE_TRIGGER_REASON_USER_TRIGGER 0x17A2 71 63 #define BTINTEL_PCIE_TRIGGER_REASON_FW_ASSERT 0x1E61 64 + 65 + #define BTINTEL_PCIE_RESET_WINDOW_SECS 5 66 + #define BTINTEL_PCIE_FLR_MAX_RETRY 1 72 67 73 68 /* Alive interrupt context */ 74 69 enum { ··· 109 98 u32 num_buf; 110 99 struct btintel_pcie_dbgc_ctxt_buf bufs[BTINTEL_PCIE_DBGC_BUFFER_COUNT]; 111 100 }; 101 + 102 + struct btintel_pcie_removal { 103 + struct pci_dev *pdev; 104 + struct work_struct work; 105 + }; 106 + 107 + static LIST_HEAD(btintel_pcie_recovery_list); 108 + static DEFINE_SPINLOCK(btintel_pcie_recovery_lock); 109 + 110 + static inline char *btintel_pcie_alivectxt_state2str(u32 alive_intr_ctxt) 111 + { 112 + switch (alive_intr_ctxt) { 113 + case BTINTEL_PCIE_ROM: 114 + return "rom"; 115 + case BTINTEL_PCIE_FW_DL: 116 + return "fw_dl"; 117 + case BTINTEL_PCIE_D0: 118 + return "d0"; 119 + case BTINTEL_PCIE_D3: 120 + return "d3"; 121 + case BTINTEL_PCIE_HCI_RESET: 122 + return "hci_reset"; 123 + case BTINTEL_PCIE_INTEL_HCI_RESET1: 124 + return "intel_reset1"; 125 + case BTINTEL_PCIE_INTEL_HCI_RESET2: 126 + return "intel_reset2"; 127 + default: 128 + return "unknown"; 129 + } 130 + } 112 131 113 132 /* This function initializes the memory for DBGC buffers and formats the 114 133 * DBGC fragment which consists header info and DBGC buffer's LSB, MSB and ··· 340 299 } 341 300 342 301 static int btintel_pcie_send_sync(struct btintel_pcie_data *data, 343 - struct sk_buff *skb) 302 + struct sk_buff *skb, u32 pkt_type, u16 opcode) 344 303 { 345 304 int ret; 346 305 u16 tfd_index; 306 + u32 old_ctxt; 307 + bool wait_on_alive = false; 308 + struct hci_dev *hdev = data->hdev; 309 + 347 310 struct txq *txq = &data->txq; 348 311 349 312 tfd_index = data->ia.tr_hia[BTINTEL_PCIE_TXQ_NUM]; 350 313 351 314 if (tfd_index > txq->count) 352 315 return -ERANGE; 316 + 317 + /* Firmware raises alive interrupt on HCI_OP_RESET or 318 + * BTINTEL_HCI_OP_RESET 319 + */ 320 + wait_on_alive = (pkt_type == BTINTEL_PCIE_HCI_CMD_PKT && 321 + (opcode == BTINTEL_HCI_OP_RESET || opcode == HCI_OP_RESET)); 322 + 323 + if (wait_on_alive) { 324 + data->gp0_received = false; 325 + old_ctxt = data->alive_intr_ctxt; 326 + data->alive_intr_ctxt = 327 + (opcode == BTINTEL_HCI_OP_RESET ? BTINTEL_PCIE_INTEL_HCI_RESET1 : 328 + BTINTEL_PCIE_HCI_RESET); 329 + bt_dev_dbg(data->hdev, "sending cmd: 0x%4.4x alive context changed: %s -> %s", 330 + opcode, btintel_pcie_alivectxt_state2str(old_ctxt), 331 + btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt)); 332 + } 333 + 334 + memcpy(skb_push(skb, BTINTEL_PCIE_HCI_TYPE_LEN), &pkt_type, 335 + BTINTEL_PCIE_HCI_TYPE_LEN); 353 336 354 337 /* Prepare for TX. It updates the TFD with the length of data and 355 338 * address of the DMA buffer, and copy the data to the DMA buffer ··· 393 328 ret = wait_event_timeout(data->tx_wait_q, data->tx_wait_done, 394 329 msecs_to_jiffies(BTINTEL_PCIE_TX_WAIT_TIMEOUT_MS)); 395 330 if (!ret) { 396 - bt_dev_err(data->hdev, "tx completion timeout"); 331 + bt_dev_err(data->hdev, "Timeout (%u ms) on tx completion", 332 + BTINTEL_PCIE_TX_WAIT_TIMEOUT_MS); 397 333 btintel_pcie_dump_debug_registers(data->hdev); 398 334 return -ETIME; 399 335 } 400 336 337 + if (wait_on_alive) { 338 + ret = wait_event_timeout(data->gp0_wait_q, 339 + data->gp0_received, 340 + msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS)); 341 + if (!ret) { 342 + hdev->stat.err_tx++; 343 + bt_dev_err(hdev, "Timeout (%u ms) on alive interrupt, alive context: %s", 344 + BTINTEL_DEFAULT_INTR_TIMEOUT_MS, 345 + btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt)); 346 + return -ETIME; 347 + } 348 + } 401 349 return 0; 402 350 } 403 351 ··· 889 811 btintel_pcie_wr_reg32(data, BTINTEL_PCIE_CSR_IPC_SLEEP_CTL_REG, dxstate); 890 812 } 891 813 892 - static inline char *btintel_pcie_alivectxt_state2str(u32 alive_intr_ctxt) 893 - { 894 - switch (alive_intr_ctxt) { 895 - case BTINTEL_PCIE_ROM: 896 - return "rom"; 897 - case BTINTEL_PCIE_FW_DL: 898 - return "fw_dl"; 899 - case BTINTEL_PCIE_D0: 900 - return "d0"; 901 - case BTINTEL_PCIE_D3: 902 - return "d3"; 903 - case BTINTEL_PCIE_HCI_RESET: 904 - return "hci_reset"; 905 - case BTINTEL_PCIE_INTEL_HCI_RESET1: 906 - return "intel_reset1"; 907 - case BTINTEL_PCIE_INTEL_HCI_RESET2: 908 - return "intel_reset2"; 909 - default: 910 - return "unknown"; 911 - } 912 - } 913 - 914 814 static int btintel_pcie_read_device_mem(struct btintel_pcie_data *data, 915 815 void *buf, u32 dev_addr, int len) 916 816 { ··· 984 928 case BTINTEL_PCIE_INTEL_HCI_RESET1: 985 929 if (btintel_pcie_in_op(data)) { 986 930 submit_rx = true; 931 + signal_waitq = true; 987 932 break; 988 933 } 989 934 990 935 if (btintel_pcie_in_iml(data)) { 991 936 submit_rx = true; 937 + signal_waitq = true; 992 938 data->alive_intr_ctxt = BTINTEL_PCIE_FW_DL; 993 939 break; 994 940 } ··· 1988 1930 __u16 opcode = ~0; 1989 1931 int ret; 1990 1932 u32 type; 1991 - u32 old_ctxt; 1933 + 1934 + if (test_bit(BTINTEL_PCIE_CORE_HALTED, &data->flags)) 1935 + return -ENODEV; 1992 1936 1993 1937 /* Due to the fw limitation, the type header of the packet should be 1994 1938 * 4 bytes unlike 1 byte for UART. In UART, the firmware can read ··· 2015 1955 struct hci_command_hdr *cmd = (void *)skb->data; 2016 1956 __u16 opcode = le16_to_cpu(cmd->opcode); 2017 1957 2018 - /* When the 0xfc01 command is issued to boot into 2019 - * the operational firmware, it will actually not 2020 - * send a command complete event. To keep the flow 1958 + /* When the BTINTEL_HCI_OP_RESET command is issued to 1959 + * boot into the operational firmware, it will actually 1960 + * not send a command complete event. To keep the flow 2021 1961 * control working inject that event here. 2022 1962 */ 2023 - if (opcode == 0xfc01) 1963 + if (opcode == BTINTEL_HCI_OP_RESET) 2024 1964 btintel_pcie_inject_cmd_complete(hdev, opcode); 2025 1965 } 2026 - /* Firmware raises alive interrupt on HCI_OP_RESET */ 2027 - if (opcode == HCI_OP_RESET) 2028 - data->gp0_received = false; 2029 1966 2030 1967 hdev->stat.cmd_tx++; 2031 1968 break; ··· 2041 1984 bt_dev_err(hdev, "Unknown HCI packet type"); 2042 1985 return -EILSEQ; 2043 1986 } 2044 - memcpy(skb_push(skb, BTINTEL_PCIE_HCI_TYPE_LEN), &type, 2045 - BTINTEL_PCIE_HCI_TYPE_LEN); 2046 1987 2047 - ret = btintel_pcie_send_sync(data, skb); 1988 + ret = btintel_pcie_send_sync(data, skb, type, opcode); 2048 1989 if (ret) { 2049 1990 hdev->stat.err_tx++; 2050 1991 bt_dev_err(hdev, "Failed to send frame (%d)", ret); 2051 1992 goto exit_error; 2052 1993 } 2053 1994 2054 - if (type == BTINTEL_PCIE_HCI_CMD_PKT && 2055 - (opcode == HCI_OP_RESET || opcode == 0xfc01)) { 2056 - old_ctxt = data->alive_intr_ctxt; 2057 - data->alive_intr_ctxt = 2058 - (opcode == 0xfc01 ? BTINTEL_PCIE_INTEL_HCI_RESET1 : 2059 - BTINTEL_PCIE_HCI_RESET); 2060 - bt_dev_dbg(data->hdev, "sent cmd: 0x%4.4x alive context changed: %s -> %s", 2061 - opcode, btintel_pcie_alivectxt_state2str(old_ctxt), 2062 - btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt)); 2063 - if (opcode == HCI_OP_RESET) { 2064 - ret = wait_event_timeout(data->gp0_wait_q, 2065 - data->gp0_received, 2066 - msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS)); 2067 - if (!ret) { 2068 - hdev->stat.err_tx++; 2069 - bt_dev_err(hdev, "No alive interrupt received for %s", 2070 - btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt)); 2071 - ret = -ETIME; 2072 - goto exit_error; 2073 - } 2074 - } 2075 - } 2076 1995 hdev->stat.byte_tx += skb->len; 2077 1996 kfree_skb(skb); 2078 1997 ··· 2225 2192 } 2226 2193 btintel_pcie_start_rx(data); 2227 2194 } 2195 + 2196 + if (!err) 2197 + set_bit(BTINTEL_PCIE_SETUP_DONE, &data->flags); 2228 2198 return err; 2199 + } 2200 + 2201 + static struct btintel_pcie_dev_recovery * 2202 + btintel_pcie_get_recovery(struct pci_dev *pdev, struct device *dev) 2203 + { 2204 + struct btintel_pcie_dev_recovery *tmp, *data = NULL; 2205 + const char *name = pci_name(pdev); 2206 + struct hci_dev *hdev = to_hci_dev(dev); 2207 + 2208 + spin_lock(&btintel_pcie_recovery_lock); 2209 + list_for_each_entry(tmp, &btintel_pcie_recovery_list, list) { 2210 + if (strcmp(tmp->name, name)) 2211 + continue; 2212 + data = tmp; 2213 + break; 2214 + } 2215 + spin_unlock(&btintel_pcie_recovery_lock); 2216 + 2217 + if (data) { 2218 + bt_dev_dbg(hdev, "Found restart data for BDF: %s", data->name); 2219 + return data; 2220 + } 2221 + 2222 + data = kzalloc(struct_size(data, name, strlen(name) + 1), GFP_ATOMIC); 2223 + if (!data) 2224 + return NULL; 2225 + 2226 + strscpy_pad(data->name, name, strlen(name) + 1); 2227 + spin_lock(&btintel_pcie_recovery_lock); 2228 + list_add_tail(&data->list, &btintel_pcie_recovery_list); 2229 + spin_unlock(&btintel_pcie_recovery_lock); 2230 + 2231 + return data; 2232 + } 2233 + 2234 + static void btintel_pcie_free_restart_list(void) 2235 + { 2236 + struct btintel_pcie_dev_recovery *tmp; 2237 + 2238 + while ((tmp = list_first_entry_or_null(&btintel_pcie_recovery_list, 2239 + typeof(*tmp), list))) { 2240 + list_del(&tmp->list); 2241 + kfree(tmp); 2242 + } 2243 + } 2244 + 2245 + static void btintel_pcie_inc_recovery_count(struct pci_dev *pdev, 2246 + struct device *dev) 2247 + { 2248 + struct btintel_pcie_dev_recovery *data; 2249 + time64_t retry_window; 2250 + 2251 + data = btintel_pcie_get_recovery(pdev, dev); 2252 + if (!data) 2253 + return; 2254 + 2255 + retry_window = ktime_get_boottime_seconds() - data->last_error; 2256 + if (data->count == 0) { 2257 + data->last_error = ktime_get_boottime_seconds(); 2258 + data->count++; 2259 + } else if (retry_window < BTINTEL_PCIE_RESET_WINDOW_SECS && 2260 + data->count <= BTINTEL_PCIE_FLR_MAX_RETRY) { 2261 + data->count++; 2262 + } else if (retry_window > BTINTEL_PCIE_RESET_WINDOW_SECS) { 2263 + data->last_error = 0; 2264 + data->count = 0; 2265 + } 2266 + } 2267 + 2268 + static int btintel_pcie_setup_hdev(struct btintel_pcie_data *data); 2269 + 2270 + static void btintel_pcie_removal_work(struct work_struct *wk) 2271 + { 2272 + struct btintel_pcie_removal *removal = 2273 + container_of(wk, struct btintel_pcie_removal, work); 2274 + struct pci_dev *pdev = removal->pdev; 2275 + struct btintel_pcie_data *data; 2276 + int err; 2277 + 2278 + pci_lock_rescan_remove(); 2279 + 2280 + if (!pdev->bus) 2281 + goto error; 2282 + 2283 + data = pci_get_drvdata(pdev); 2284 + 2285 + btintel_pcie_disable_interrupts(data); 2286 + btintel_pcie_synchronize_irqs(data); 2287 + 2288 + flush_work(&data->rx_work); 2289 + flush_work(&data->hdev->dump.dump_rx); 2290 + 2291 + bt_dev_dbg(data->hdev, "Release bluetooth interface"); 2292 + btintel_pcie_release_hdev(data); 2293 + 2294 + err = pci_reset_function(pdev); 2295 + if (err) { 2296 + BT_ERR("Failed resetting the pcie device (%d)", err); 2297 + goto error; 2298 + } 2299 + 2300 + btintel_pcie_enable_interrupts(data); 2301 + btintel_pcie_config_msix(data); 2302 + 2303 + err = btintel_pcie_enable_bt(data); 2304 + if (err) { 2305 + BT_ERR("Failed to enable bluetooth hardware after reset (%d)", 2306 + err); 2307 + goto error; 2308 + } 2309 + 2310 + btintel_pcie_reset_ia(data); 2311 + btintel_pcie_start_rx(data); 2312 + data->flags = 0; 2313 + 2314 + err = btintel_pcie_setup_hdev(data); 2315 + if (err) { 2316 + BT_ERR("Failed registering hdev (%d)", err); 2317 + goto error; 2318 + } 2319 + error: 2320 + pci_dev_put(pdev); 2321 + pci_unlock_rescan_remove(); 2322 + kfree(removal); 2323 + } 2324 + 2325 + static void btintel_pcie_reset(struct hci_dev *hdev) 2326 + { 2327 + struct btintel_pcie_removal *removal; 2328 + struct btintel_pcie_data *data; 2329 + 2330 + data = hci_get_drvdata(hdev); 2331 + 2332 + if (!test_bit(BTINTEL_PCIE_SETUP_DONE, &data->flags)) 2333 + return; 2334 + 2335 + if (test_and_set_bit(BTINTEL_PCIE_RECOVERY_IN_PROGRESS, &data->flags)) 2336 + return; 2337 + 2338 + removal = kzalloc(sizeof(*removal), GFP_ATOMIC); 2339 + if (!removal) 2340 + return; 2341 + 2342 + removal->pdev = data->pdev; 2343 + INIT_WORK(&removal->work, btintel_pcie_removal_work); 2344 + pci_dev_get(removal->pdev); 2345 + schedule_work(&removal->work); 2346 + } 2347 + 2348 + static void btintel_pcie_hw_error(struct hci_dev *hdev, u8 code) 2349 + { 2350 + struct btintel_pcie_dev_recovery *data; 2351 + struct btintel_pcie_data *dev_data = hci_get_drvdata(hdev); 2352 + struct pci_dev *pdev = dev_data->pdev; 2353 + time64_t retry_window; 2354 + 2355 + if (code == 0x13) { 2356 + bt_dev_err(hdev, "Encountered top exception"); 2357 + return; 2358 + } 2359 + 2360 + data = btintel_pcie_get_recovery(pdev, &hdev->dev); 2361 + if (!data) 2362 + return; 2363 + 2364 + retry_window = ktime_get_boottime_seconds() - data->last_error; 2365 + 2366 + if (retry_window < BTINTEL_PCIE_RESET_WINDOW_SECS && 2367 + data->count >= BTINTEL_PCIE_FLR_MAX_RETRY) { 2368 + bt_dev_err(hdev, "Exhausted maximum: %d recovery attempts: %d", 2369 + BTINTEL_PCIE_FLR_MAX_RETRY, data->count); 2370 + bt_dev_dbg(hdev, "Boot time: %lld seconds", 2371 + ktime_get_boottime_seconds()); 2372 + bt_dev_dbg(hdev, "last error at: %lld seconds", 2373 + data->last_error); 2374 + return; 2375 + } 2376 + btintel_pcie_inc_recovery_count(pdev, &hdev->dev); 2377 + btintel_pcie_reset(hdev); 2229 2378 } 2230 2379 2231 2380 static int btintel_pcie_setup_hdev(struct btintel_pcie_data *data) ··· 2431 2216 hdev->send = btintel_pcie_send_frame; 2432 2217 hdev->setup = btintel_pcie_setup; 2433 2218 hdev->shutdown = btintel_shutdown_combined; 2434 - hdev->hw_error = btintel_hw_error; 2219 + hdev->hw_error = btintel_pcie_hw_error; 2435 2220 hdev->set_diag = btintel_set_diag; 2436 2221 hdev->set_bdaddr = btintel_set_bdaddr; 2222 + hdev->reset = btintel_pcie_reset; 2437 2223 2438 2224 err = hci_register_dev(hdev); 2439 2225 if (err < 0) { ··· 2582 2366 .driver.coredump = btintel_pcie_coredump 2583 2367 #endif 2584 2368 }; 2585 - module_pci_driver(btintel_pcie_driver); 2369 + 2370 + static int __init btintel_pcie_init(void) 2371 + { 2372 + return pci_register_driver(&btintel_pcie_driver); 2373 + } 2374 + 2375 + static void __exit btintel_pcie_exit(void) 2376 + { 2377 + pci_unregister_driver(&btintel_pcie_driver); 2378 + btintel_pcie_free_restart_list(); 2379 + } 2380 + 2381 + module_init(btintel_pcie_init); 2382 + module_exit(btintel_pcie_exit); 2586 2383 2587 2384 MODULE_AUTHOR("Tedd Ho-Jeong An <tedd.an@intel.com>"); 2588 2385 MODULE_DESCRIPTION("Intel Bluetooth PCIe transport driver ver " VERSION);
+3 -1
drivers/bluetooth/btintel_pcie.h
··· 117 117 enum { 118 118 BTINTEL_PCIE_CORE_HALTED, 119 119 BTINTEL_PCIE_HWEXP_INPROGRESS, 120 - BTINTEL_PCIE_COREDUMP_INPROGRESS 120 + BTINTEL_PCIE_COREDUMP_INPROGRESS, 121 + BTINTEL_PCIE_RECOVERY_IN_PROGRESS, 122 + BTINTEL_PCIE_SETUP_DONE 121 123 }; 122 124 123 125 enum btintel_pcie_tlv_type {
+1 -1
drivers/bluetooth/btmtkuart.c
··· 316 316 317 317 /* Resync STP when unexpected data is being read */ 318 318 if (shdr->prefix != 0x80 || bdev->stp_dlen > 2048) { 319 - bt_dev_err(bdev->hdev, "stp format unexpect (%d, %d)", 319 + bt_dev_err(bdev->hdev, "stp format unexpected (%d, %d)", 320 320 shdr->prefix, bdev->stp_dlen); 321 321 bdev->stp_cursor = 2; 322 322 bdev->stp_dlen = 0;
+112 -19
drivers/bluetooth/btnxpuart.c
··· 18 18 #include <linux/string_helpers.h> 19 19 #include <linux/gpio/consumer.h> 20 20 #include <linux/of_irq.h> 21 + #include <linux/regulator/consumer.h> 22 + #include <linux/reset.h> 21 23 22 24 #include <net/bluetooth/bluetooth.h> 23 25 #include <net/bluetooth/hci_core.h> ··· 75 73 #define FW_AUTH_ENC 0xc0 76 74 77 75 #define HCI_NXP_PRI_BAUDRATE 115200 78 - #define HCI_NXP_SEC_BAUDRATE 3000000 76 + #define HCI_NXP_SEC_BAUDRATE_3M 3000000 77 + #define HCI_NXP_SEC_BAUDRATE_4M 4000000 79 78 80 79 #define MAX_FW_FILE_NAME_LEN 50 81 80 ··· 204 201 u32 new_baudrate; 205 202 u32 current_baudrate; 206 203 u32 fw_init_baudrate; 204 + u32 secondary_baudrate; 207 205 enum bootloader_param_change timeout_changed; 208 206 enum bootloader_param_change baudrate_changed; 209 207 bool helper_downloaded; 210 208 211 209 struct ps_data psdata; 212 210 struct btnxpuart_data *nxp_data; 211 + struct reset_control *pdn; 213 212 }; 214 213 215 214 #define NXP_V1_FW_REQ_PKT 0xa5 ··· 370 365 371 366 static struct sk_buff *nxp_drv_send_cmd(struct hci_dev *hdev, u16 opcode, 372 367 u32 plen, 373 - void *param) 368 + void *param, 369 + bool resp) 374 370 { 375 371 struct btnxpuart_dev *nxpdev = hci_get_drvdata(hdev); 376 372 struct ps_data *psdata = &nxpdev->psdata; 377 - struct sk_buff *skb; 373 + struct sk_buff *skb = NULL; 378 374 379 375 /* set flag to prevent nxp_enqueue from parsing values from this command and 380 376 * calling hci_cmd_sync_queue() again. 381 377 */ 382 378 psdata->driver_sent_cmd = true; 383 - skb = __hci_cmd_sync(hdev, opcode, plen, param, HCI_CMD_TIMEOUT); 379 + if (resp) { 380 + skb = __hci_cmd_sync(hdev, opcode, plen, param, HCI_CMD_TIMEOUT); 381 + } else { 382 + __hci_cmd_send(hdev, opcode, plen, param); 383 + /* Allow command to be sent before tx_work is cancelled 384 + * by btnxpuart_flush() 385 + */ 386 + msleep(20); 387 + } 384 388 psdata->driver_sent_cmd = false; 385 389 386 390 return skb; ··· 609 595 pcmd.ps_cmd = BT_PS_DISABLE; 610 596 pcmd.c2h_ps_interval = __cpu_to_le16(psdata->c2h_ps_interval); 611 597 612 - skb = nxp_drv_send_cmd(hdev, HCI_NXP_AUTO_SLEEP_MODE, sizeof(pcmd), &pcmd); 598 + skb = nxp_drv_send_cmd(hdev, HCI_NXP_AUTO_SLEEP_MODE, sizeof(pcmd), 599 + &pcmd, true); 613 600 if (IS_ERR(skb)) { 614 601 bt_dev_err(hdev, "Setting Power Save mode failed (%ld)", PTR_ERR(skb)); 615 602 return PTR_ERR(skb); ··· 659 644 break; 660 645 } 661 646 662 - skb = nxp_drv_send_cmd(hdev, HCI_NXP_WAKEUP_METHOD, sizeof(pcmd), &pcmd); 647 + skb = nxp_drv_send_cmd(hdev, HCI_NXP_WAKEUP_METHOD, sizeof(pcmd), 648 + &pcmd, true); 663 649 if (IS_ERR(skb)) { 664 650 bt_dev_err(hdev, "Setting wake-up method failed (%ld)", PTR_ERR(skb)); 665 651 return PTR_ERR(skb); ··· 818 802 nxpdev->fw_v3_offset_correction += req_len; 819 803 } else if (req_len == sizeof(uart_config)) { 820 804 uart_config.clkdiv.address = __cpu_to_le32(clkdivaddr); 821 - uart_config.clkdiv.value = __cpu_to_le32(0x00c00000); 805 + if (nxpdev->new_baudrate == HCI_NXP_SEC_BAUDRATE_4M) 806 + uart_config.clkdiv.value = __cpu_to_le32(0x01000000); 807 + else 808 + uart_config.clkdiv.value = __cpu_to_le32(0x00c00000); 822 809 uart_config.uartdiv.address = __cpu_to_le32(uartdivaddr); 823 810 uart_config.uartdiv.value = __cpu_to_le32(1); 824 811 uart_config.mcr.address = __cpu_to_le32(uartmcraddr); ··· 985 966 goto free_skb; 986 967 } 987 968 if (nxpdev->baudrate_changed != changed) { 969 + nxpdev->new_baudrate = nxpdev->secondary_baudrate; 988 970 if (nxp_fw_change_baudrate(hdev, len)) { 989 971 nxpdev->baudrate_changed = changed; 990 972 serdev_device_set_baudrate(nxpdev->serdev, 991 - HCI_NXP_SEC_BAUDRATE); 973 + nxpdev->secondary_baudrate); 992 974 serdev_device_set_flow_control(nxpdev->serdev, true); 993 - nxpdev->current_baudrate = HCI_NXP_SEC_BAUDRATE; 975 + nxpdev->current_baudrate = nxpdev->secondary_baudrate; 994 976 } 995 977 goto free_skb; 996 978 } ··· 1012 992 nxpdev->helper_downloaded = true; 1013 993 serdev_device_wait_until_sent(nxpdev->serdev, 0); 1014 994 serdev_device_set_baudrate(nxpdev->serdev, 1015 - HCI_NXP_SEC_BAUDRATE); 995 + HCI_NXP_SEC_BAUDRATE_3M); 1016 996 serdev_device_set_flow_control(nxpdev->serdev, true); 1017 997 } else { 1018 998 clear_bit(BTNXPUART_FW_DOWNLOADING, &nxpdev->tx_state); ··· 1236 1216 } 1237 1217 1238 1218 if (nxpdev->baudrate_changed != changed) { 1219 + nxpdev->new_baudrate = nxpdev->secondary_baudrate; 1239 1220 if (nxp_fw_change_baudrate(hdev, len)) { 1240 1221 nxpdev->baudrate_changed = cmd_sent; 1241 1222 serdev_device_set_baudrate(nxpdev->serdev, 1242 - HCI_NXP_SEC_BAUDRATE); 1223 + nxpdev->secondary_baudrate); 1243 1224 serdev_device_set_flow_control(nxpdev->serdev, true); 1244 - nxpdev->current_baudrate = HCI_NXP_SEC_BAUDRATE; 1225 + nxpdev->current_baudrate = nxpdev->secondary_baudrate; 1245 1226 } 1246 1227 goto free_skb; 1247 1228 } ··· 1286 1265 if (!psdata) 1287 1266 return 0; 1288 1267 1289 - skb = nxp_drv_send_cmd(hdev, HCI_NXP_SET_OPER_SPEED, 4, (u8 *)&new_baudrate); 1268 + skb = nxp_drv_send_cmd(hdev, HCI_NXP_SET_OPER_SPEED, 4, 1269 + (u8 *)&new_baudrate, true); 1290 1270 if (IS_ERR(skb)) { 1291 1271 bt_dev_err(hdev, "Setting baudrate failed (%ld)", PTR_ERR(skb)); 1292 1272 return PTR_ERR(skb); ··· 1345 1323 struct sk_buff *skb; 1346 1324 u8 pcmd = 2; 1347 1325 1348 - skb = nxp_drv_send_cmd(hdev, HCI_NXP_TRIGGER_DUMP, 1, &pcmd); 1326 + skb = nxp_drv_send_cmd(hdev, HCI_NXP_TRIGGER_DUMP, 1, &pcmd, true); 1349 1327 if (IS_ERR(skb)) 1350 1328 bt_dev_err(hdev, "Failed to trigger FW Dump. (%ld)", PTR_ERR(skb)); 1351 1329 else ··· 1387 1365 1388 1366 if (buf_len == 0) { 1389 1367 bt_dev_warn(hdev, "==== FW dump complete ==="); 1390 - clear_bit(BTNXPUART_FW_DUMP_IN_PROGRESS, &nxpdev->tx_state); 1391 1368 hci_devcd_complete(hdev); 1392 1369 nxp_set_ind_reset(hdev, NULL); 1393 1370 } ··· 1440 1419 static int nxp_setup(struct hci_dev *hdev) 1441 1420 { 1442 1421 struct btnxpuart_dev *nxpdev = hci_get_drvdata(hdev); 1422 + struct serdev_device *serdev = nxpdev->serdev; 1423 + char device_string[30]; 1424 + char event_string[50]; 1425 + char *envp[] = {device_string, event_string, NULL}; 1443 1426 int err = 0; 1444 1427 1445 1428 if (nxp_check_boot_sign(nxpdev)) { ··· 1455 1430 bt_dev_info(hdev, "FW already running."); 1456 1431 clear_bit(BTNXPUART_FW_DOWNLOADING, &nxpdev->tx_state); 1457 1432 } 1433 + 1434 + snprintf(device_string, 30, "BTNXPUART_DEV=%s", dev_name(&serdev->dev)); 1435 + snprintf(event_string, 50, "BTNXPUART_STATE=FW_READY"); 1436 + bt_dev_dbg(hdev, "==== Send uevent: %s:%s ===", device_string, 1437 + event_string); 1438 + kobject_uevent_env(&serdev->dev.kobj, KOBJ_CHANGE, envp); 1458 1439 1459 1440 serdev_device_set_baudrate(nxpdev->serdev, nxpdev->fw_init_baudrate); 1460 1441 nxpdev->current_baudrate = nxpdev->fw_init_baudrate; ··· 1478 1447 struct btnxpuart_dev *nxpdev = hci_get_drvdata(hdev); 1479 1448 struct ps_data *psdata = &nxpdev->psdata; 1480 1449 1481 - if (nxpdev->current_baudrate != HCI_NXP_SEC_BAUDRATE) { 1482 - nxpdev->new_baudrate = HCI_NXP_SEC_BAUDRATE; 1450 + if (nxpdev->current_baudrate != nxpdev->secondary_baudrate) { 1451 + nxpdev->new_baudrate = nxpdev->secondary_baudrate; 1483 1452 nxp_set_baudrate_cmd(hdev, NULL); 1484 1453 } 1485 1454 if (psdata->cur_h2c_wakeupmode != psdata->h2c_wakeupmode) ··· 1510 1479 u8 pcmd = 0; 1511 1480 1512 1481 if (ind_reset_in_progress(nxpdev)) { 1513 - skb = nxp_drv_send_cmd(hdev, HCI_NXP_IND_RESET, 1, &pcmd); 1482 + if (test_and_clear_bit(BTNXPUART_FW_DUMP_IN_PROGRESS, 1483 + &nxpdev->tx_state)) 1484 + skb = nxp_drv_send_cmd(hdev, HCI_NXP_IND_RESET, 1, 1485 + &pcmd, false); 1486 + else 1487 + skb = nxp_drv_send_cmd(hdev, HCI_NXP_IND_RESET, 1, 1488 + &pcmd, true); 1514 1489 serdev_device_set_flow_control(nxpdev->serdev, false); 1515 1490 set_bit(BTNXPUART_FW_DOWNLOADING, &nxpdev->tx_state); 1516 1491 /* HCI_NXP_IND_RESET command may not returns any response */ ··· 1782 1745 .write_wakeup = btnxpuart_write_wakeup, 1783 1746 }; 1784 1747 1748 + static void nxp_coredump_notify(struct hci_dev *hdev, int state) 1749 + { 1750 + struct btnxpuart_dev *nxpdev = hci_get_drvdata(hdev); 1751 + struct serdev_device *serdev = nxpdev->serdev; 1752 + char device_string[30]; 1753 + char event_string[50]; 1754 + char *envp[] = {device_string, event_string, NULL}; 1755 + 1756 + snprintf(device_string, 30, "BTNXPUART_DEV=%s", dev_name(&serdev->dev)); 1757 + switch (state) { 1758 + case HCI_DEVCOREDUMP_ACTIVE: 1759 + snprintf(event_string, 50, "BTNXPUART_STATE=FW_DUMP_ACTIVE"); 1760 + break; 1761 + case HCI_DEVCOREDUMP_DONE: 1762 + snprintf(event_string, 50, "BTNXPUART_STATE=FW_DUMP_DONE"); 1763 + break; 1764 + case HCI_DEVCOREDUMP_TIMEOUT: 1765 + snprintf(event_string, 50, "BTNXPUART_STATE=FW_DUMP_TIMEOUT"); 1766 + break; 1767 + default: 1768 + snprintf(event_string, 50, "BTNXPUART_STATE=FW_DUMP_STATE_%d", 1769 + state); 1770 + break; 1771 + } 1772 + bt_dev_dbg(hdev, "==== Send uevent: %s:%s ===", device_string, 1773 + event_string); 1774 + kobject_uevent_env(&serdev->dev.kobj, KOBJ_CHANGE, envp); 1775 + } 1776 + 1785 1777 static int nxp_serdev_probe(struct serdev_device *serdev) 1786 1778 { 1787 1779 struct hci_dev *hdev; 1788 1780 struct btnxpuart_dev *nxpdev; 1789 1781 bdaddr_t ba = {0}; 1782 + int err; 1790 1783 1791 1784 nxpdev = devm_kzalloc(&serdev->dev, sizeof(*nxpdev), GFP_KERNEL); 1792 1785 if (!nxpdev) ··· 1840 1773 if (!nxpdev->fw_init_baudrate) 1841 1774 nxpdev->fw_init_baudrate = FW_INIT_BAUDRATE; 1842 1775 1776 + device_property_read_u32(&nxpdev->serdev->dev, "max-speed", 1777 + &nxpdev->secondary_baudrate); 1778 + if (!nxpdev->secondary_baudrate || 1779 + (nxpdev->secondary_baudrate != HCI_NXP_SEC_BAUDRATE_3M && 1780 + nxpdev->secondary_baudrate != HCI_NXP_SEC_BAUDRATE_4M)) { 1781 + if (nxpdev->secondary_baudrate) 1782 + dev_err(&serdev->dev, 1783 + "Invalid max-speed. Using default 3000000."); 1784 + nxpdev->secondary_baudrate = HCI_NXP_SEC_BAUDRATE_3M; 1785 + } 1786 + 1843 1787 set_bit(BTNXPUART_FW_DOWNLOADING, &nxpdev->tx_state); 1844 1788 1845 1789 crc8_populate_msb(crc8_table, POLYNOMIAL8); 1790 + 1791 + nxpdev->pdn = devm_reset_control_get_optional_shared(&serdev->dev, NULL); 1792 + if (IS_ERR(nxpdev->pdn)) 1793 + return PTR_ERR(nxpdev->pdn); 1794 + 1795 + err = devm_regulator_get_enable(&serdev->dev, "vcc"); 1796 + if (err) { 1797 + dev_err(&serdev->dev, "Failed to enable vcc regulator\n"); 1798 + return err; 1799 + } 1846 1800 1847 1801 /* Initialize and register HCI device */ 1848 1802 hdev = hci_alloc_dev(); ··· 1871 1783 dev_err(&serdev->dev, "Can't allocate HCI device\n"); 1872 1784 return -ENOMEM; 1873 1785 } 1786 + 1787 + reset_control_deassert(nxpdev->pdn); 1874 1788 1875 1789 nxpdev->hdev = hdev; 1876 1790 ··· 1907 1817 if (ps_setup(hdev)) 1908 1818 goto probe_fail; 1909 1819 1910 - hci_devcd_register(hdev, nxp_coredump, nxp_coredump_hdr, NULL); 1820 + hci_devcd_register(hdev, nxp_coredump, nxp_coredump_hdr, 1821 + nxp_coredump_notify); 1911 1822 1912 1823 return 0; 1913 1824 1914 1825 probe_fail: 1826 + reset_control_assert(nxpdev->pdn); 1915 1827 hci_free_dev(hdev); 1916 1828 return -ENODEV; 1917 1829 } ··· 1941 1849 1942 1850 ps_cleanup(nxpdev); 1943 1851 hci_unregister_dev(hdev); 1852 + reset_control_assert(nxpdev->pdn); 1944 1853 hci_free_dev(hdev); 1945 1854 } 1946 1855
+1 -1
drivers/bluetooth/btrtl.c
··· 693 693 694 694 /* Loop from the end of the firmware parsing instructions, until 695 695 * we find an instruction that identifies the "project ID" for the 696 - * hardware supported by this firwmare file. 696 + * hardware supported by this firmware file. 697 697 * Once we have that, we double-check that project_id is suitable 698 698 * for the hardware we are working with. 699 699 */
+106 -47
drivers/bluetooth/btusb.c
··· 298 298 BTUSB_WIDEBAND_SPEECH }, 299 299 300 300 /* QCA WCN6855 chipset */ 301 - { USB_DEVICE(0x0cf3, 0xe600), .driver_info = BTUSB_QCA_WCN6855 | 302 - BTUSB_WIDEBAND_SPEECH }, 303 - { USB_DEVICE(0x0489, 0xe0cc), .driver_info = BTUSB_QCA_WCN6855 | 304 - BTUSB_WIDEBAND_SPEECH }, 305 - { USB_DEVICE(0x0489, 0xe0d6), .driver_info = BTUSB_QCA_WCN6855 | 306 - BTUSB_WIDEBAND_SPEECH }, 307 - { USB_DEVICE(0x0489, 0xe0e3), .driver_info = BTUSB_QCA_WCN6855 | 308 - BTUSB_WIDEBAND_SPEECH }, 309 - { USB_DEVICE(0x10ab, 0x9309), .driver_info = BTUSB_QCA_WCN6855 | 310 - BTUSB_WIDEBAND_SPEECH }, 311 - { USB_DEVICE(0x10ab, 0x9409), .driver_info = BTUSB_QCA_WCN6855 | 312 - BTUSB_WIDEBAND_SPEECH }, 313 - { USB_DEVICE(0x0489, 0xe0d0), .driver_info = BTUSB_QCA_WCN6855 | 314 - BTUSB_WIDEBAND_SPEECH }, 315 - { USB_DEVICE(0x10ab, 0x9108), .driver_info = BTUSB_QCA_WCN6855 | 316 - BTUSB_WIDEBAND_SPEECH }, 317 - { USB_DEVICE(0x10ab, 0x9109), .driver_info = BTUSB_QCA_WCN6855 | 318 - BTUSB_WIDEBAND_SPEECH }, 319 - { USB_DEVICE(0x10ab, 0x9208), .driver_info = BTUSB_QCA_WCN6855 | 320 - BTUSB_WIDEBAND_SPEECH }, 321 - { USB_DEVICE(0x10ab, 0x9209), .driver_info = BTUSB_QCA_WCN6855 | 322 - BTUSB_WIDEBAND_SPEECH }, 323 - { USB_DEVICE(0x10ab, 0x9308), .driver_info = BTUSB_QCA_WCN6855 | 324 - BTUSB_WIDEBAND_SPEECH }, 325 - { USB_DEVICE(0x10ab, 0x9408), .driver_info = BTUSB_QCA_WCN6855 | 326 - BTUSB_WIDEBAND_SPEECH }, 327 - { USB_DEVICE(0x10ab, 0x9508), .driver_info = BTUSB_QCA_WCN6855 | 328 - BTUSB_WIDEBAND_SPEECH }, 329 - { USB_DEVICE(0x10ab, 0x9509), .driver_info = BTUSB_QCA_WCN6855 | 330 - BTUSB_WIDEBAND_SPEECH }, 331 - { USB_DEVICE(0x10ab, 0x9608), .driver_info = BTUSB_QCA_WCN6855 | 332 - BTUSB_WIDEBAND_SPEECH }, 333 - { USB_DEVICE(0x10ab, 0x9609), .driver_info = BTUSB_QCA_WCN6855 | 334 - BTUSB_WIDEBAND_SPEECH }, 335 - { USB_DEVICE(0x10ab, 0x9f09), .driver_info = BTUSB_QCA_WCN6855 | 336 - BTUSB_WIDEBAND_SPEECH }, 337 - { USB_DEVICE(0x04ca, 0x3022), .driver_info = BTUSB_QCA_WCN6855 | 338 - BTUSB_WIDEBAND_SPEECH }, 339 301 { USB_DEVICE(0x0489, 0xe0c7), .driver_info = BTUSB_QCA_WCN6855 | 340 302 BTUSB_WIDEBAND_SPEECH }, 341 303 { USB_DEVICE(0x0489, 0xe0c9), .driver_info = BTUSB_QCA_WCN6855 | ··· 306 344 BTUSB_WIDEBAND_SPEECH }, 307 345 { USB_DEVICE(0x0489, 0xe0cb), .driver_info = BTUSB_QCA_WCN6855 | 308 346 BTUSB_WIDEBAND_SPEECH }, 347 + { USB_DEVICE(0x0489, 0xe0cc), .driver_info = BTUSB_QCA_WCN6855 | 348 + BTUSB_WIDEBAND_SPEECH }, 309 349 { USB_DEVICE(0x0489, 0xe0ce), .driver_info = BTUSB_QCA_WCN6855 | 350 + BTUSB_WIDEBAND_SPEECH }, 351 + { USB_DEVICE(0x0489, 0xe0d0), .driver_info = BTUSB_QCA_WCN6855 | 352 + BTUSB_WIDEBAND_SPEECH }, 353 + { USB_DEVICE(0x0489, 0xe0d6), .driver_info = BTUSB_QCA_WCN6855 | 310 354 BTUSB_WIDEBAND_SPEECH }, 311 355 { USB_DEVICE(0x0489, 0xe0de), .driver_info = BTUSB_QCA_WCN6855 | 312 356 BTUSB_WIDEBAND_SPEECH }, ··· 320 352 BTUSB_WIDEBAND_SPEECH }, 321 353 { USB_DEVICE(0x0489, 0xe0e1), .driver_info = BTUSB_QCA_WCN6855 | 322 354 BTUSB_WIDEBAND_SPEECH }, 355 + { USB_DEVICE(0x0489, 0xe0e3), .driver_info = BTUSB_QCA_WCN6855 | 356 + BTUSB_WIDEBAND_SPEECH }, 323 357 { USB_DEVICE(0x0489, 0xe0ea), .driver_info = BTUSB_QCA_WCN6855 | 324 358 BTUSB_WIDEBAND_SPEECH }, 325 359 { USB_DEVICE(0x0489, 0xe0ec), .driver_info = BTUSB_QCA_WCN6855 | 360 + BTUSB_WIDEBAND_SPEECH }, 361 + { USB_DEVICE(0x04ca, 0x3022), .driver_info = BTUSB_QCA_WCN6855 | 326 362 BTUSB_WIDEBAND_SPEECH }, 327 363 { USB_DEVICE(0x04ca, 0x3023), .driver_info = BTUSB_QCA_WCN6855 | 328 364 BTUSB_WIDEBAND_SPEECH }, ··· 339 367 { USB_DEVICE(0x04ca, 0x3a26), .driver_info = BTUSB_QCA_WCN6855 | 340 368 BTUSB_WIDEBAND_SPEECH }, 341 369 { USB_DEVICE(0x04ca, 0x3a27), .driver_info = BTUSB_QCA_WCN6855 | 370 + BTUSB_WIDEBAND_SPEECH }, 371 + { USB_DEVICE(0x0cf3, 0xe600), .driver_info = BTUSB_QCA_WCN6855 | 372 + BTUSB_WIDEBAND_SPEECH }, 373 + { USB_DEVICE(0x10ab, 0x9108), .driver_info = BTUSB_QCA_WCN6855 | 374 + BTUSB_WIDEBAND_SPEECH }, 375 + { USB_DEVICE(0x10ab, 0x9109), .driver_info = BTUSB_QCA_WCN6855 | 376 + BTUSB_WIDEBAND_SPEECH }, 377 + { USB_DEVICE(0x10ab, 0x9208), .driver_info = BTUSB_QCA_WCN6855 | 378 + BTUSB_WIDEBAND_SPEECH }, 379 + { USB_DEVICE(0x10ab, 0x9209), .driver_info = BTUSB_QCA_WCN6855 | 380 + BTUSB_WIDEBAND_SPEECH }, 381 + { USB_DEVICE(0x10ab, 0x9308), .driver_info = BTUSB_QCA_WCN6855 | 382 + BTUSB_WIDEBAND_SPEECH }, 383 + { USB_DEVICE(0x10ab, 0x9309), .driver_info = BTUSB_QCA_WCN6855 | 384 + BTUSB_WIDEBAND_SPEECH }, 385 + { USB_DEVICE(0x10ab, 0x9408), .driver_info = BTUSB_QCA_WCN6855 | 386 + BTUSB_WIDEBAND_SPEECH }, 387 + { USB_DEVICE(0x10ab, 0x9409), .driver_info = BTUSB_QCA_WCN6855 | 388 + BTUSB_WIDEBAND_SPEECH }, 389 + { USB_DEVICE(0x10ab, 0x9508), .driver_info = BTUSB_QCA_WCN6855 | 390 + BTUSB_WIDEBAND_SPEECH }, 391 + { USB_DEVICE(0x10ab, 0x9509), .driver_info = BTUSB_QCA_WCN6855 | 392 + BTUSB_WIDEBAND_SPEECH }, 393 + { USB_DEVICE(0x10ab, 0x9608), .driver_info = BTUSB_QCA_WCN6855 | 394 + BTUSB_WIDEBAND_SPEECH }, 395 + { USB_DEVICE(0x10ab, 0x9609), .driver_info = BTUSB_QCA_WCN6855 | 396 + BTUSB_WIDEBAND_SPEECH }, 397 + { USB_DEVICE(0x10ab, 0x9f09), .driver_info = BTUSB_QCA_WCN6855 | 398 + BTUSB_WIDEBAND_SPEECH }, 399 + { USB_DEVICE(0x28de, 0x1401), .driver_info = BTUSB_QCA_WCN6855 | 342 400 BTUSB_WIDEBAND_SPEECH }, 343 401 344 402 /* QCA WCN785x chipset */ ··· 517 515 /* Realtek 8851BE Bluetooth devices */ 518 516 { USB_DEVICE(0x0bda, 0xb850), .driver_info = BTUSB_REALTEK }, 519 517 { USB_DEVICE(0x13d3, 0x3600), .driver_info = BTUSB_REALTEK }, 518 + { USB_DEVICE(0x13d3, 0x3601), .driver_info = BTUSB_REALTEK }, 519 + 520 + /* Realtek 8851BU Bluetooth devices */ 521 + { USB_DEVICE(0x3625, 0x010b), .driver_info = BTUSB_REALTEK | 522 + BTUSB_WIDEBAND_SPEECH }, 520 523 521 524 /* Realtek 8852AE Bluetooth devices */ 522 525 { USB_DEVICE(0x0bda, 0x2852), .driver_info = BTUSB_REALTEK | ··· 571 564 { USB_DEVICE(0x13d3, 0x3572), .driver_info = BTUSB_REALTEK | 572 565 BTUSB_WIDEBAND_SPEECH }, 573 566 { USB_DEVICE(0x13d3, 0x3591), .driver_info = BTUSB_REALTEK | 567 + BTUSB_WIDEBAND_SPEECH }, 568 + { USB_DEVICE(0x13d3, 0x3618), .driver_info = BTUSB_REALTEK | 574 569 BTUSB_WIDEBAND_SPEECH }, 575 570 { USB_DEVICE(0x0489, 0xe123), .driver_info = BTUSB_REALTEK | 576 571 BTUSB_WIDEBAND_SPEECH }, ··· 714 705 BTUSB_WIDEBAND_SPEECH }, 715 706 { USB_DEVICE(0x0489, 0xe139), .driver_info = BTUSB_MEDIATEK | 716 707 BTUSB_WIDEBAND_SPEECH }, 708 + { USB_DEVICE(0x0489, 0xe14e), .driver_info = BTUSB_MEDIATEK | 709 + BTUSB_WIDEBAND_SPEECH }, 717 710 { USB_DEVICE(0x0489, 0xe14f), .driver_info = BTUSB_MEDIATEK | 718 711 BTUSB_WIDEBAND_SPEECH }, 719 712 { USB_DEVICE(0x0489, 0xe150), .driver_info = BTUSB_MEDIATEK | ··· 735 724 { USB_DEVICE(0x13d3, 0x3628), .driver_info = BTUSB_MEDIATEK | 736 725 BTUSB_WIDEBAND_SPEECH }, 737 726 { USB_DEVICE(0x13d3, 0x3630), .driver_info = BTUSB_MEDIATEK | 727 + BTUSB_WIDEBAND_SPEECH }, 728 + { USB_DEVICE(0x2c7c, 0x7009), .driver_info = BTUSB_MEDIATEK | 738 729 BTUSB_WIDEBAND_SPEECH }, 739 730 740 731 /* Additional Realtek 8723AE Bluetooth devices */ ··· 2607 2594 else 2608 2595 urb = alloc_ctrl_urb(hdev, skb); 2609 2596 2610 - /* When the 0xfc01 command is issued to boot into 2611 - * the operational firmware, it will actually not 2612 - * send a command complete event. To keep the flow 2597 + /* When the BTINTEL_HCI_OP_RESET command is issued to 2598 + * boot into the operational firmware, it will actually 2599 + * not send a command complete event. To keep the flow 2613 2600 * control working inject that event here. 2614 2601 */ 2615 - if (opcode == 0xfc01) 2602 + if (opcode == BTINTEL_HCI_OP_RESET) 2616 2603 inject_cmd_complete(hdev, opcode); 2617 2604 } else { 2618 2605 urb = alloc_ctrl_urb(hdev, skb); ··· 3192 3179 u8 ver_offset; /* offset of version structure in rampatch */ 3193 3180 }; 3194 3181 3182 + struct qca_custom_firmware { 3183 + u32 rom_version; 3184 + u16 board_id; 3185 + const char *subdirectory; 3186 + }; 3187 + 3195 3188 static const struct qca_device_info qca_devices_table[] = { 3196 3189 { 0x00000100, 20, 4, 8 }, /* Rome 1.0 */ 3197 3190 { 0x00000101, 20, 4, 8 }, /* Rome 1.1 */ ··· 3209 3190 { 0x00130200, 40, 4, 16 }, /* WCN6855 2.0 */ 3210 3191 { 0x00130201, 40, 4, 16 }, /* WCN6855 2.1 */ 3211 3192 { 0x00190200, 40, 4, 16 }, /* WCN785x 2.0 */ 3193 + }; 3194 + 3195 + static const struct qca_custom_firmware qca_custom_btfws[] = { 3196 + { 0x00130201, 0x030A, "QCA2066" }, 3197 + { }, 3212 3198 }; 3213 3199 3214 3200 static u16 qca_extract_board_id(const struct qca_version *ver) ··· 3240 3216 board_id = 0; 3241 3217 3242 3218 return board_id; 3219 + } 3220 + 3221 + static const char *qca_get_fw_subdirectory(const struct qca_version *ver) 3222 + { 3223 + const struct qca_custom_firmware *ptr; 3224 + u32 rom_ver; 3225 + u16 board_id; 3226 + 3227 + rom_ver = le32_to_cpu(ver->rom_version); 3228 + board_id = qca_extract_board_id(ver); 3229 + if (!board_id) 3230 + return NULL; 3231 + 3232 + for (ptr = qca_custom_btfws; ptr->rom_version; ptr++) { 3233 + if (ptr->rom_version == rom_ver && 3234 + ptr->board_id == board_id) 3235 + return ptr->subdirectory; 3236 + } 3237 + 3238 + return NULL; 3243 3239 } 3244 3240 3245 3241 static int btusb_qca_send_vendor_req(struct usb_device *udev, u8 request, ··· 3366 3322 { 3367 3323 struct qca_rampatch_version *rver; 3368 3324 const struct firmware *fw; 3325 + const char *fw_subdir; 3369 3326 u32 ver_rom, ver_patch, rver_rom; 3370 3327 u16 rver_rom_low, rver_rom_high, rver_patch; 3371 - char fwname[64]; 3328 + char fwname[80]; 3372 3329 int err; 3373 3330 3374 3331 ver_rom = le32_to_cpu(ver->rom_version); 3375 3332 ver_patch = le32_to_cpu(ver->patch_version); 3376 3333 3377 - snprintf(fwname, sizeof(fwname), "qca/rampatch_usb_%08x.bin", ver_rom); 3334 + fw_subdir = qca_get_fw_subdirectory(ver); 3335 + if (fw_subdir) 3336 + snprintf(fwname, sizeof(fwname), "qca/%s/rampatch_usb_%08x.bin", 3337 + fw_subdir, ver_rom); 3338 + else 3339 + snprintf(fwname, sizeof(fwname), "qca/rampatch_usb_%08x.bin", 3340 + ver_rom); 3378 3341 3379 3342 err = request_firmware(&fw, fwname, &hdev->dev); 3380 3343 if (err) { ··· 3425 3374 const struct qca_version *ver) 3426 3375 { 3427 3376 u32 rom_version = le32_to_cpu(ver->rom_version); 3428 - const char *variant; 3377 + const char *variant, *fw_subdir; 3429 3378 int len; 3430 3379 u16 board_id; 3431 3380 3381 + fw_subdir = qca_get_fw_subdirectory(ver); 3432 3382 board_id = qca_extract_board_id(ver); 3433 3383 3434 3384 switch (le32_to_cpu(ver->ram_version)) { ··· 3442 3390 break; 3443 3391 } 3444 3392 3445 - len = snprintf(fwname, max_size, "qca/nvm_usb_%08x", rom_version); 3393 + if (fw_subdir) 3394 + len = snprintf(fwname, max_size, "qca/%s/nvm_usb_%08x", 3395 + fw_subdir, rom_version); 3396 + else 3397 + len = snprintf(fwname, max_size, "qca/nvm_usb_%08x", 3398 + rom_version); 3446 3399 if (variant) 3447 3400 len += snprintf(fwname + len, max_size - len, "%s", variant); 3448 3401 if (board_id) ··· 3460 3403 const struct qca_device_info *info) 3461 3404 { 3462 3405 const struct firmware *fw; 3463 - char fwname[64]; 3406 + char fwname[80]; 3464 3407 int err; 3465 3408 3466 3409 btusb_generate_qca_nvm_name(fwname, sizeof(fwname), ver); ··· 3859 3802 3860 3803 /* There are at most 7 alt (0 - 6) */ 3861 3804 rp = kmalloc(sizeof(*rp) + 7, GFP_KERNEL); 3805 + if (!rp) 3806 + return -ENOMEM; 3862 3807 3863 3808 rp->num = 0; 3864 3809 if (!drvdata->isoc)
+1 -1
drivers/bluetooth/hci_bcm4377.c
··· 420 420 * payloads_dma:DMA address for payload buffer 421 421 * events: pointer to array of completions if waiting is allowed 422 422 * msgids: bitmap to keep track of used message ids 423 - * lock: Spinlock to protect access to ring structurs used in the irq handler 423 + * lock: Spinlock to protect access to ring structures used in the irq handler 424 424 */ 425 425 struct bcm4377_transfer_ring { 426 426 enum bcm4377_transfer_ring_id ring_id;
+5 -5
drivers/bluetooth/hci_intel.c
··· 1029 1029 struct hci_command_hdr *cmd = (void *)skb->data; 1030 1030 __u16 opcode = le16_to_cpu(cmd->opcode); 1031 1031 1032 - /* When the 0xfc01 command is issued to boot into 1033 - * the operational firmware, it will actually not 1034 - * send a command complete event. To keep the flow 1035 - * control working inject that event here. 1032 + /* When the BTINTEL_HCI_OP_RESET command is issued to boot into 1033 + * the operational firmware, it will actually not send a command 1034 + * complete event. To keep the flow control working inject that 1035 + * event here. 1036 1036 */ 1037 - if (opcode == 0xfc01) 1037 + if (opcode == BTINTEL_HCI_OP_RESET) 1038 1038 inject_cmd_complete(hu->hdev, opcode); 1039 1039 } 1040 1040
+1
drivers/bluetooth/hci_qca.c
··· 1264 1264 { H4_RECV_ACL, .recv = qca_recv_acl_data }, 1265 1265 { H4_RECV_SCO, .recv = hci_recv_frame }, 1266 1266 { H4_RECV_EVENT, .recv = qca_recv_event }, 1267 + { H4_RECV_ISO, .recv = hci_recv_frame }, 1267 1268 { QCA_IBS_WAKE_IND_EVENT, .recv = qca_ibs_wake_ind }, 1268 1269 { QCA_IBS_WAKE_ACK_EVENT, .recv = qca_ibs_wake_ack }, 1269 1270 { QCA_IBS_SLEEP_IND_EVENT, .recv = qca_ibs_sleep_ind },
+10 -1
include/net/bluetooth/bluetooth.h
··· 244 244 245 245 #define BT_ISO_BASE 20 246 246 247 + /* Socket option value 21 reserved */ 248 + 249 + #define BT_PKT_SEQNUM 22 250 + 251 + #define BT_SCM_PKT_SEQNUM 0x05 252 + 247 253 __printf(1, 2) 248 254 void bt_info(const char *fmt, ...); 249 255 __printf(1, 2) ··· 397 391 enum { 398 392 BT_SK_DEFER_SETUP, 399 393 BT_SK_SUSPEND, 400 - BT_SK_PKT_STATUS 394 + BT_SK_PKT_STATUS, 395 + BT_SK_PKT_SEQNUM, 401 396 }; 402 397 403 398 struct bt_sock_list { ··· 482 475 u8 pkt_type; 483 476 u8 force_active; 484 477 u16 expect; 478 + u16 pkt_seqnum; 485 479 u8 incoming:1; 486 480 u8 pkt_status:2; 487 481 union { ··· 496 488 497 489 #define hci_skb_pkt_type(skb) bt_cb((skb))->pkt_type 498 490 #define hci_skb_pkt_status(skb) bt_cb((skb))->pkt_status 491 + #define hci_skb_pkt_seqnum(skb) bt_cb((skb))->pkt_seqnum 499 492 #define hci_skb_expect(skb) bt_cb((skb))->expect 500 493 #define hci_skb_opcode(skb) bt_cb((skb))->hci.opcode 501 494 #define hci_skb_event(skb) bt_cb((skb))->hci.req_event
+9 -1
include/net/bluetooth/hci.h
··· 562 562 #define LE_LINK 0x80 563 563 #define CIS_LINK 0x82 564 564 #define BIS_LINK 0x83 565 + #define PA_LINK 0x84 565 566 #define INVALID_LINK 0xff 566 567 567 568 /* LMP features */ ··· 2635 2634 #define LE_EXT_ADV_DIRECT_IND 0x0004 2636 2635 #define LE_EXT_ADV_SCAN_RSP 0x0008 2637 2636 #define LE_EXT_ADV_LEGACY_PDU 0x0010 2637 + #define LE_EXT_ADV_DATA_STATUS_MASK 0x0060 2638 2638 #define LE_EXT_ADV_EVT_TYPE_MASK 0x007f 2639 2639 2640 2640 #define ADDR_LE_DEV_PUBLIC 0x00 ··· 2839 2837 } __packed; 2840 2838 2841 2839 #define HCI_EVT_LE_BIG_SYNC_ESTABLISHED 0x1d 2842 - struct hci_evt_le_big_sync_estabilished { 2840 + struct hci_evt_le_big_sync_established { 2843 2841 __u8 status; 2844 2842 __u8 handle; 2845 2843 __u8 latency[3]; ··· 2851 2849 __le16 interval; 2852 2850 __u8 num_bis; 2853 2851 __le16 bis[]; 2852 + } __packed; 2853 + 2854 + #define HCI_EVT_LE_BIG_SYNC_LOST 0x1e 2855 + struct hci_evt_le_big_sync_lost { 2856 + __u8 handle; 2857 + __u8 reason; 2854 2858 } __packed; 2855 2859 2856 2860 #define HCI_EVT_LE_BIG_INFO_ADV_REPORT 0x22
+16 -25
include/net/bluetooth/hci_core.h
··· 29 29 #include <linux/idr.h> 30 30 #include <linux/leds.h> 31 31 #include <linux/rculist.h> 32 + #include <linux/spinlock.h> 32 33 #include <linux/srcu.h> 33 34 34 35 #include <net/bluetooth/hci.h> ··· 95 94 u16 uuid_count; 96 95 u8 (*uuids)[16]; 97 96 unsigned long name_resolve_timeout; 97 + spinlock_t lock; 98 98 }; 99 99 100 100 #define SUSPEND_NOTIFIER_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ ··· 891 889 892 890 static inline void discovery_init(struct hci_dev *hdev) 893 891 { 892 + spin_lock_init(&hdev->discovery.lock); 894 893 hdev->discovery.state = DISCOVERY_STOPPED; 895 894 INIT_LIST_HEAD(&hdev->discovery.all); 896 895 INIT_LIST_HEAD(&hdev->discovery.unknown); ··· 906 903 hdev->discovery.report_invalid_rssi = true; 907 904 hdev->discovery.rssi = HCI_RSSI_INVALID; 908 905 hdev->discovery.uuid_count = 0; 906 + 907 + spin_lock(&hdev->discovery.lock); 909 908 kfree(hdev->discovery.uuids); 910 909 hdev->discovery.uuids = NULL; 910 + spin_unlock(&hdev->discovery.lock); 911 911 } 912 912 913 913 bool hci_discovery_active(struct hci_dev *hdev); ··· 1015 1009 break; 1016 1010 case CIS_LINK: 1017 1011 case BIS_LINK: 1012 + case PA_LINK: 1018 1013 h->iso_num++; 1019 1014 break; 1020 1015 } ··· 1043 1036 break; 1044 1037 case CIS_LINK: 1045 1038 case BIS_LINK: 1039 + case PA_LINK: 1046 1040 h->iso_num--; 1047 1041 break; 1048 1042 } ··· 1062 1054 return h->sco_num; 1063 1055 case CIS_LINK: 1064 1056 case BIS_LINK: 1057 + case PA_LINK: 1065 1058 return h->iso_num; 1066 1059 default: 1067 1060 return 0; ··· 1145 1136 rcu_read_lock(); 1146 1137 1147 1138 list_for_each_entry_rcu(c, &h->list, list) { 1148 - if (c->type != BIS_LINK) 1139 + if (c->type != PA_LINK) 1149 1140 continue; 1150 1141 1151 1142 if (!test_bit(HCI_CONN_CREATE_PA_SYNC, &c->flags)) ··· 1340 1331 rcu_read_lock(); 1341 1332 1342 1333 list_for_each_entry_rcu(c, &h->list, list) { 1343 - if (c->type != BIS_LINK) 1334 + if (c->type != PA_LINK) 1344 1335 continue; 1345 1336 1346 1337 if (handle == c->iso_qos.bcast.big && num_bis == c->num_bis) { ··· 1355 1346 } 1356 1347 1357 1348 static inline struct hci_conn * 1358 - hci_conn_hash_lookup_big_state(struct hci_dev *hdev, __u8 handle, __u16 state) 1349 + hci_conn_hash_lookup_big_state(struct hci_dev *hdev, __u8 handle, __u16 state, 1350 + __u8 role) 1359 1351 { 1360 1352 struct hci_conn_hash *h = &hdev->conn_hash; 1361 1353 struct hci_conn *c; ··· 1364 1354 rcu_read_lock(); 1365 1355 1366 1356 list_for_each_entry_rcu(c, &h->list, list) { 1367 - if (c->type != BIS_LINK || c->state != state) 1357 + if (c->type != BIS_LINK || c->state != state || c->role != role) 1368 1358 continue; 1369 1359 1370 1360 if (handle == c->iso_qos.bcast.big) { ··· 1410 1400 rcu_read_lock(); 1411 1401 1412 1402 list_for_each_entry_rcu(c, &h->list, list) { 1413 - if (c->type != BIS_LINK) 1403 + if (c->type != PA_LINK) 1414 1404 continue; 1415 1405 1416 1406 /* Ignore the listen hcon, we are looking ··· 1425 1415 return c; 1426 1416 } 1427 1417 } 1428 - rcu_read_unlock(); 1429 - 1430 - return NULL; 1431 - } 1432 - 1433 - static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev, 1434 - __u8 type, __u16 state) 1435 - { 1436 - struct hci_conn_hash *h = &hdev->conn_hash; 1437 - struct hci_conn *c; 1438 - 1439 - rcu_read_lock(); 1440 - 1441 - list_for_each_entry_rcu(c, &h->list, list) { 1442 - if (c->type == type && c->state == state) { 1443 - rcu_read_unlock(); 1444 - return c; 1445 - } 1446 - } 1447 - 1448 1418 rcu_read_unlock(); 1449 1419 1450 1420 return NULL; ··· 2009 2019 2010 2020 case CIS_LINK: 2011 2021 case BIS_LINK: 2022 + case PA_LINK: 2012 2023 return iso_connect_ind(hdev, bdaddr, flags); 2013 2024 2014 2025 default:
+7
net/bluetooth/af_bluetooth.c
··· 364 364 put_cmsg(msg, SOL_BLUETOOTH, BT_SCM_PKT_STATUS, 365 365 sizeof(pkt_status), &pkt_status); 366 366 } 367 + 368 + if (test_bit(BT_SK_PKT_SEQNUM, &bt_sk(sk)->flags)) { 369 + u16 pkt_seqnum = hci_skb_pkt_seqnum(skb); 370 + 371 + put_cmsg(msg, SOL_BLUETOOTH, BT_SCM_PKT_SEQNUM, 372 + sizeof(pkt_seqnum), &pkt_seqnum); 373 + } 367 374 } 368 375 369 376 skb_free_datagram(sk, skb);
+1 -1
net/bluetooth/aosp.c
··· 70 70 rp = (struct aosp_rp_le_get_vendor_capa *)skb->data; 71 71 72 72 version_supported = le16_to_cpu(rp->version_supported); 73 - /* AOSP displays the verion number like v0.98, v1.00, etc. */ 73 + /* AOSP displays the version number like v0.98, v1.00, etc. */ 74 74 bt_dev_info(hdev, "AOSP extensions version v%u.%02u", 75 75 version_supported >> 8, version_supported & 0xff); 76 76
+3 -3
net/bluetooth/coredump.c
··· 249 249 250 250 size = hdev->dump.tail - hdev->dump.head; 251 251 252 - /* Emit a devcoredump with the available data */ 253 - dev_coredumpv(&hdev->dev, hdev->dump.head, size, GFP_KERNEL); 254 - 255 252 /* Send a copy to monitor as a diagnostic packet */ 256 253 skb = bt_skb_alloc(size, GFP_ATOMIC); 257 254 if (skb) { 258 255 skb_put_data(skb, hdev->dump.head, size); 259 256 hci_recv_diag(hdev, skb); 260 257 } 258 + 259 + /* Emit a devcoredump with the available data */ 260 + dev_coredumpv(&hdev->dev, hdev->dump.head, size, GFP_KERNEL); 261 261 } 262 262 263 263 static void hci_devcd_handle_pkt_complete(struct hci_dev *hdev,
+12 -7
net/bluetooth/hci_conn.c
··· 785 785 d->sync_handle = conn->sync_handle; 786 786 787 787 if (test_and_clear_bit(HCI_CONN_PA_SYNC, &conn->flags)) { 788 - hci_conn_hash_list_flag(hdev, find_bis, BIS_LINK, 788 + hci_conn_hash_list_flag(hdev, find_bis, PA_LINK, 789 789 HCI_CONN_PA_SYNC, d); 790 790 791 791 if (!d->count) ··· 814 814 * 815 815 * Detects if there any BIS left connected in a BIG 816 816 * broadcaster: Remove advertising instance and terminate BIG. 817 - * broadcaster receiver: Teminate BIG sync and terminate PA sync. 817 + * broadcaster receiver: Terminate BIG sync and terminate PA sync. 818 818 */ 819 819 static void bis_cleanup(struct hci_conn *conn) 820 820 { ··· 914 914 break; 915 915 case CIS_LINK: 916 916 case BIS_LINK: 917 + case PA_LINK: 917 918 if (hdev->iso_mtu) 918 919 /* Dedicated ISO Buffer exists */ 919 920 break; ··· 980 979 break; 981 980 case CIS_LINK: 982 981 case BIS_LINK: 982 + case PA_LINK: 983 983 /* conn->src should reflect the local identity address */ 984 984 hci_copy_identity_address(hdev, &conn->src, &conn->src_type); 985 985 ··· 1035 1033 } 1036 1034 1037 1035 hci_conn_init_sysfs(conn); 1038 - 1039 1036 return conn; 1040 1037 } 1041 1038 ··· 1078 1077 break; 1079 1078 case CIS_LINK: 1080 1079 case BIS_LINK: 1080 + case PA_LINK: 1081 1081 if ((conn->state != BT_CONNECTED && 1082 1082 !test_bit(HCI_CONN_CREATE_CIS, &conn->flags)) || 1083 1083 test_bit(HCI_CONN_BIG_CREATED, &conn->flags)) ··· 1154 1152 } else { 1155 1153 /* Unacked ISO frames */ 1156 1154 if (conn->type == CIS_LINK || 1157 - conn->type == BIS_LINK) { 1155 + conn->type == BIS_LINK || 1156 + conn->type == PA_LINK) { 1158 1157 if (hdev->iso_pkts) 1159 1158 hdev->iso_cnt += conn->sent; 1160 1159 else if (hdev->le_pkts) ··· 2084 2081 2085 2082 bt_dev_dbg(hdev, "dst %pMR type %d sid %d", dst, dst_type, sid); 2086 2083 2087 - conn = hci_conn_add_unset(hdev, BIS_LINK, dst, HCI_ROLE_SLAVE); 2084 + conn = hci_conn_add_unset(hdev, PA_LINK, dst, HCI_ROLE_SLAVE); 2088 2085 if (IS_ERR(conn)) 2089 2086 return conn; 2090 2087 ··· 2149 2146 struct hci_link *link; 2150 2147 2151 2148 /* Look for any BIS that is open for rebinding */ 2152 - conn = hci_conn_hash_lookup_big_state(hdev, qos->bcast.big, BT_OPEN); 2149 + conn = hci_conn_hash_lookup_big_state(hdev, qos->bcast.big, BT_OPEN, 2150 + HCI_ROLE_MASTER); 2153 2151 if (conn) { 2154 2152 memcpy(qos, &conn->iso_qos, sizeof(*qos)); 2155 2153 conn->state = BT_CONNECTED; ··· 2249 2245 * the start periodic advertising and create BIG commands have 2250 2246 * been queued 2251 2247 */ 2252 - hci_conn_hash_list_state(hdev, bis_mark_per_adv, BIS_LINK, 2248 + hci_conn_hash_list_state(hdev, bis_mark_per_adv, PA_LINK, 2253 2249 BT_BOUND, &data); 2254 2250 2255 2251 /* Queue start periodic advertising and create BIG */ ··· 2983 2979 switch (conn->type) { 2984 2980 case CIS_LINK: 2985 2981 case BIS_LINK: 2982 + case PA_LINK: 2986 2983 case ACL_LINK: 2987 2984 case LE_LINK: 2988 2985 break;
+16 -15
net/bluetooth/hci_core.c
··· 1256 1256 if (addr_type == irk->addr_type && 1257 1257 bacmp(bdaddr, &irk->bdaddr) == 0) { 1258 1258 irk_to_return = irk; 1259 - goto done; 1259 + break; 1260 1260 } 1261 1261 } 1262 - 1263 - done: 1264 1262 1265 1263 if (irk_to_return && hci_is_blocked_key(hdev, HCI_BLOCKED_KEY_TYPE_IRK, 1266 1264 irk_to_return->val)) { ··· 2936 2938 case HCI_ACLDATA_PKT: 2937 2939 /* Detect if ISO packet has been sent as ACL */ 2938 2940 if (hci_conn_num(hdev, CIS_LINK) || 2939 - hci_conn_num(hdev, BIS_LINK)) { 2941 + hci_conn_num(hdev, BIS_LINK) || 2942 + hci_conn_num(hdev, PA_LINK)) { 2940 2943 __u16 handle = __le16_to_cpu(hci_acl_hdr(skb)->handle); 2941 2944 __u8 type; 2942 2945 2943 2946 type = hci_conn_lookup_type(hdev, hci_handle(handle)); 2944 - if (type == CIS_LINK || type == BIS_LINK) 2947 + if (type == CIS_LINK || type == BIS_LINK || 2948 + type == PA_LINK) 2945 2949 hci_skb_pkt_type(skb) = HCI_ISODATA_PKT; 2946 2950 } 2947 2951 break; ··· 3398 3398 break; 3399 3399 case CIS_LINK: 3400 3400 case BIS_LINK: 3401 + case PA_LINK: 3401 3402 cnt = hdev->iso_mtu ? hdev->iso_cnt : 3402 3403 hdev->le_mtu ? hdev->le_cnt : hdev->acl_cnt; 3403 3404 break; ··· 3412 3411 } 3413 3412 3414 3413 static struct hci_conn *hci_low_sent(struct hci_dev *hdev, __u8 type, 3415 - __u8 type2, int *quote) 3414 + int *quote) 3416 3415 { 3417 3416 struct hci_conn_hash *h = &hdev->conn_hash; 3418 3417 struct hci_conn *conn = NULL, *c; ··· 3424 3423 rcu_read_lock(); 3425 3424 3426 3425 list_for_each_entry_rcu(c, &h->list, list) { 3427 - if ((c->type != type && c->type != type2) || 3426 + if (c->type != type || 3428 3427 skb_queue_empty(&c->data_q)) 3429 3428 continue; 3430 3429 ··· 3628 3627 else 3629 3628 cnt = &hdev->sco_cnt; 3630 3629 3631 - while (*cnt && (conn = hci_low_sent(hdev, type, type, &quote))) { 3630 + while (*cnt && (conn = hci_low_sent(hdev, type, &quote))) { 3632 3631 while (quote-- && (skb = skb_dequeue(&conn->data_q))) { 3633 3632 BT_DBG("skb %p len %d", skb, skb->len); 3634 3633 hci_send_conn_frame(hdev, conn, skb); ··· 3747 3746 hci_prio_recalculate(hdev, LE_LINK); 3748 3747 } 3749 3748 3750 - /* Schedule CIS */ 3751 - static void hci_sched_iso(struct hci_dev *hdev) 3749 + /* Schedule iso */ 3750 + static void hci_sched_iso(struct hci_dev *hdev, __u8 type) 3752 3751 { 3753 3752 struct hci_conn *conn; 3754 3753 struct sk_buff *skb; ··· 3756 3755 3757 3756 BT_DBG("%s", hdev->name); 3758 3757 3759 - if (!hci_conn_num(hdev, CIS_LINK) && 3760 - !hci_conn_num(hdev, BIS_LINK)) 3758 + if (!hci_conn_num(hdev, type)) 3761 3759 return; 3762 3760 3763 3761 cnt = hdev->iso_pkts ? &hdev->iso_cnt : 3764 3762 hdev->le_pkts ? &hdev->le_cnt : &hdev->acl_cnt; 3765 - while (*cnt && (conn = hci_low_sent(hdev, CIS_LINK, BIS_LINK, 3766 - &quote))) { 3763 + while (*cnt && (conn = hci_low_sent(hdev, type, &quote))) { 3767 3764 while (quote-- && (skb = skb_dequeue(&conn->data_q))) { 3768 3765 BT_DBG("skb %p len %d", skb, skb->len); 3769 3766 hci_send_conn_frame(hdev, conn, skb); ··· 3786 3787 /* Schedule queues and send stuff to HCI driver */ 3787 3788 hci_sched_sco(hdev, SCO_LINK); 3788 3789 hci_sched_sco(hdev, ESCO_LINK); 3789 - hci_sched_iso(hdev); 3790 + hci_sched_iso(hdev, CIS_LINK); 3791 + hci_sched_iso(hdev, BIS_LINK); 3792 + hci_sched_iso(hdev, PA_LINK); 3790 3793 hci_sched_acl(hdev); 3791 3794 hci_sched_le(hdev); 3792 3795 }
+59 -17
net/bluetooth/hci_event.c
··· 4432 4432 4433 4433 case CIS_LINK: 4434 4434 case BIS_LINK: 4435 + case PA_LINK: 4435 4436 if (hdev->iso_pkts) { 4436 4437 hdev->iso_cnt += count; 4437 4438 if (hdev->iso_cnt > hdev->iso_pkts) ··· 5718 5717 conn->state = BT_CONFIG; 5719 5718 5720 5719 /* Store current advertising instance as connection advertising instance 5721 - * when sotfware rotation is in use so it can be re-enabled when 5720 + * when software rotation is in use so it can be re-enabled when 5722 5721 * disconnected. 5723 5722 */ 5724 5723 if (!ext_adv_capable(hdev)) ··· 6240 6239 6241 6240 static u8 ext_evt_type_to_legacy(struct hci_dev *hdev, u16 evt_type) 6242 6241 { 6242 + u16 pdu_type = evt_type & ~LE_EXT_ADV_DATA_STATUS_MASK; 6243 + 6244 + if (!pdu_type) 6245 + return LE_ADV_NONCONN_IND; 6246 + 6243 6247 if (evt_type & LE_EXT_ADV_LEGACY_PDU) { 6244 6248 switch (evt_type) { 6245 6249 case LE_LEGACY_ADV_IND: ··· 6276 6270 if (evt_type & LE_EXT_ADV_SCAN_IND) 6277 6271 return LE_ADV_SCAN_IND; 6278 6272 6279 - if (evt_type == LE_EXT_ADV_NON_CONN_IND || 6280 - evt_type & LE_EXT_ADV_DIRECT_IND) 6273 + if (evt_type & LE_EXT_ADV_DIRECT_IND) 6281 6274 return LE_ADV_NONCONN_IND; 6282 6275 6283 6276 invalid: ··· 6355 6350 return hci_send_cmd(hdev, HCI_OP_LE_PA_TERM_SYNC, sizeof(cp), &cp); 6356 6351 } 6357 6352 6358 - static void hci_le_pa_sync_estabilished_evt(struct hci_dev *hdev, void *data, 6359 - struct sk_buff *skb) 6353 + static void hci_le_pa_sync_established_evt(struct hci_dev *hdev, void *data, 6354 + struct sk_buff *skb) 6360 6355 { 6361 6356 struct hci_ev_le_pa_sync_established *ev = data; 6362 6357 int mask = hdev->link_mode; ··· 6382 6377 conn->sync_handle = le16_to_cpu(ev->handle); 6383 6378 conn->sid = HCI_SID_INVALID; 6384 6379 6385 - mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, BIS_LINK, 6380 + mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, PA_LINK, 6386 6381 &flags); 6387 6382 if (!(mask & HCI_LM_ACCEPT)) { 6388 6383 hci_le_pa_term_sync(hdev, ev->handle); ··· 6393 6388 goto unlock; 6394 6389 6395 6390 /* Add connection to indicate PA sync event */ 6396 - pa_sync = hci_conn_add_unset(hdev, BIS_LINK, BDADDR_ANY, 6391 + pa_sync = hci_conn_add_unset(hdev, PA_LINK, BDADDR_ANY, 6397 6392 HCI_ROLE_SLAVE); 6398 6393 6399 6394 if (IS_ERR(pa_sync)) ··· 6424 6419 6425 6420 hci_dev_lock(hdev); 6426 6421 6427 - mask |= hci_proto_connect_ind(hdev, BDADDR_ANY, BIS_LINK, &flags); 6422 + mask |= hci_proto_connect_ind(hdev, BDADDR_ANY, PA_LINK, &flags); 6428 6423 if (!(mask & HCI_LM_ACCEPT)) 6429 6424 goto unlock; 6430 6425 ··· 6686 6681 hci_dev_unlock(hdev); 6687 6682 } 6688 6683 6689 - static void hci_le_cis_estabilished_evt(struct hci_dev *hdev, void *data, 6690 - struct sk_buff *skb) 6684 + static void hci_le_cis_established_evt(struct hci_dev *hdev, void *data, 6685 + struct sk_buff *skb) 6691 6686 { 6692 6687 struct hci_evt_le_cis_established *ev = data; 6693 6688 struct hci_conn *conn; ··· 6881 6876 6882 6877 /* Connect all BISes that are bound to the BIG */ 6883 6878 while ((conn = hci_conn_hash_lookup_big_state(hdev, ev->handle, 6884 - BT_BOUND))) { 6879 + BT_BOUND, 6880 + HCI_ROLE_MASTER))) { 6885 6881 if (ev->status) { 6886 6882 hci_connect_cfm(conn, ev->status); 6887 6883 hci_conn_del(conn); ··· 6915 6909 static void hci_le_big_sync_established_evt(struct hci_dev *hdev, void *data, 6916 6910 struct sk_buff *skb) 6917 6911 { 6918 - struct hci_evt_le_big_sync_estabilished *ev = data; 6912 + struct hci_evt_le_big_sync_established *ev = data; 6919 6913 struct hci_conn *bis, *conn; 6920 6914 int i; 6921 6915 ··· 6998 6992 hci_dev_unlock(hdev); 6999 6993 } 7000 6994 6995 + static void hci_le_big_sync_lost_evt(struct hci_dev *hdev, void *data, 6996 + struct sk_buff *skb) 6997 + { 6998 + struct hci_evt_le_big_sync_lost *ev = data; 6999 + struct hci_conn *bis, *conn; 7000 + 7001 + bt_dev_dbg(hdev, "big handle 0x%2.2x", ev->handle); 7002 + 7003 + hci_dev_lock(hdev); 7004 + 7005 + /* Delete the pa sync connection */ 7006 + bis = hci_conn_hash_lookup_pa_sync_big_handle(hdev, ev->handle); 7007 + if (bis) { 7008 + conn = hci_conn_hash_lookup_pa_sync_handle(hdev, 7009 + bis->sync_handle); 7010 + if (conn) 7011 + hci_conn_del(conn); 7012 + } 7013 + 7014 + /* Delete each bis connection */ 7015 + while ((bis = hci_conn_hash_lookup_big_state(hdev, ev->handle, 7016 + BT_CONNECTED, 7017 + HCI_ROLE_SLAVE))) { 7018 + clear_bit(HCI_CONN_BIG_SYNC, &bis->flags); 7019 + hci_disconn_cfm(bis, ev->reason); 7020 + hci_conn_del(bis); 7021 + } 7022 + 7023 + hci_dev_unlock(hdev); 7024 + } 7025 + 7001 7026 static void hci_le_big_info_adv_report_evt(struct hci_dev *hdev, void *data, 7002 7027 struct sk_buff *skb) 7003 7028 { ··· 7080 7043 /* Entries in this table shall have their position according to the subevent 7081 7044 * opcode they handle so the use of the macros above is recommend since it does 7082 7045 * attempt to initialize at its proper index using Designated Initializers that 7083 - * way events without a callback function can be ommited. 7046 + * way events without a callback function can be omitted. 7084 7047 */ 7085 7048 static const struct hci_le_ev { 7086 7049 void (*func)(struct hci_dev *hdev, void *data, struct sk_buff *skb); ··· 7126 7089 HCI_MAX_EVENT_SIZE), 7127 7090 /* [0x0e = HCI_EV_LE_PA_SYNC_ESTABLISHED] */ 7128 7091 HCI_LE_EV(HCI_EV_LE_PA_SYNC_ESTABLISHED, 7129 - hci_le_pa_sync_estabilished_evt, 7092 + hci_le_pa_sync_established_evt, 7130 7093 sizeof(struct hci_ev_le_pa_sync_established)), 7131 7094 /* [0x0f = HCI_EV_LE_PER_ADV_REPORT] */ 7132 7095 HCI_LE_EV_VL(HCI_EV_LE_PER_ADV_REPORT, ··· 7137 7100 HCI_LE_EV(HCI_EV_LE_EXT_ADV_SET_TERM, hci_le_ext_adv_term_evt, 7138 7101 sizeof(struct hci_evt_le_ext_adv_set_term)), 7139 7102 /* [0x19 = HCI_EVT_LE_CIS_ESTABLISHED] */ 7140 - HCI_LE_EV(HCI_EVT_LE_CIS_ESTABLISHED, hci_le_cis_estabilished_evt, 7103 + HCI_LE_EV(HCI_EVT_LE_CIS_ESTABLISHED, hci_le_cis_established_evt, 7141 7104 sizeof(struct hci_evt_le_cis_established)), 7142 7105 /* [0x1a = HCI_EVT_LE_CIS_REQ] */ 7143 7106 HCI_LE_EV(HCI_EVT_LE_CIS_REQ, hci_le_cis_req_evt, ··· 7150 7113 /* [0x1d = HCI_EV_LE_BIG_SYNC_ESTABLISHED] */ 7151 7114 HCI_LE_EV_VL(HCI_EVT_LE_BIG_SYNC_ESTABLISHED, 7152 7115 hci_le_big_sync_established_evt, 7153 - sizeof(struct hci_evt_le_big_sync_estabilished), 7116 + sizeof(struct hci_evt_le_big_sync_established), 7117 + HCI_MAX_EVENT_SIZE), 7118 + /* [0x1e = HCI_EVT_LE_BIG_SYNC_LOST] */ 7119 + HCI_LE_EV_VL(HCI_EVT_LE_BIG_SYNC_LOST, 7120 + hci_le_big_sync_lost_evt, 7121 + sizeof(struct hci_evt_le_big_sync_lost), 7154 7122 HCI_MAX_EVENT_SIZE), 7155 7123 /* [0x22 = HCI_EVT_LE_BIG_INFO_ADV_REPORT] */ 7156 7124 HCI_LE_EV_VL(HCI_EVT_LE_BIG_INFO_ADV_REPORT, ··· 7441 7399 /* [0x2c = HCI_EV_SYNC_CONN_COMPLETE] */ 7442 7400 HCI_EV(HCI_EV_SYNC_CONN_COMPLETE, hci_sync_conn_complete_evt, 7443 7401 sizeof(struct hci_ev_sync_conn_complete)), 7444 - /* [0x2d = HCI_EV_EXTENDED_INQUIRY_RESULT] */ 7402 + /* [0x2f = HCI_EV_EXTENDED_INQUIRY_RESULT] */ 7445 7403 HCI_EV_VL(HCI_EV_EXTENDED_INQUIRY_RESULT, 7446 7404 hci_extended_inquiry_result_evt, 7447 7405 sizeof(struct hci_ev_ext_inquiry_result), HCI_MAX_EVENT_SIZE),
+1 -1
net/bluetooth/hci_sock.c
··· 118 118 int id = hci_pi(sk)->cookie; 119 119 120 120 if (id) { 121 - hci_pi(sk)->cookie = 0xffffffff; 121 + hci_pi(sk)->cookie = 0; 122 122 ida_free(&sock_cookie_ida, id); 123 123 } 124 124 }
+7 -7
net/bluetooth/hci_sync.c
··· 2929 2929 if (sent) { 2930 2930 struct hci_conn *conn; 2931 2931 2932 - conn = hci_conn_hash_lookup_ba(hdev, BIS_LINK, 2932 + conn = hci_conn_hash_lookup_ba(hdev, PA_LINK, 2933 2933 &sent->bdaddr); 2934 2934 if (conn) { 2935 2935 struct bt_iso_qos *qos = &conn->iso_qos; ··· 5493 5493 { 5494 5494 struct hci_cp_disconnect cp; 5495 5495 5496 - if (conn->type == BIS_LINK) { 5496 + if (conn->type == BIS_LINK || conn->type == PA_LINK) { 5497 5497 /* This is a BIS connection, hci_conn_del will 5498 5498 * do the necessary cleanup. 5499 5499 */ ··· 5562 5562 return HCI_ERROR_LOCAL_HOST_TERM; 5563 5563 } 5564 5564 5565 - if (conn->type == BIS_LINK) { 5565 + if (conn->type == BIS_LINK || conn->type == PA_LINK) { 5566 5566 /* There is no way to cancel a BIS without terminating the BIG 5567 5567 * which is done later on connection cleanup. 5568 5568 */ ··· 5627 5627 if (conn->type == CIS_LINK) 5628 5628 return hci_le_reject_cis_sync(hdev, conn, reason); 5629 5629 5630 - if (conn->type == BIS_LINK) 5630 + if (conn->type == BIS_LINK || conn->type == PA_LINK) 5631 5631 return -EINVAL; 5632 5632 5633 5633 if (conn->type == SCO_LINK || conn->type == ESCO_LINK) ··· 5677 5677 } 5678 5678 5679 5679 /* Cleanup hci_conn object if it cannot be cancelled as it 5680 - * likelly means the controller and host stack are out of sync 5680 + * likely means the controller and host stack are out of sync 5681 5681 * or in case of LE it was still scanning so it can be cleanup 5682 5682 * safely. 5683 5683 */ ··· 6116 6116 &b->bdaddr, 6117 6117 HCI_CONN_SETUP_AUTO_ON); 6118 6118 if (err) 6119 - bt_dev_dbg(hdev, "Failed to set event filter for %pMR", 6119 + bt_dev_err(hdev, "Failed to set event filter for %pMR", 6120 6120 &b->bdaddr); 6121 6121 else 6122 6122 scan = SCAN_PAGE; ··· 6994 6994 goto unlock; 6995 6995 6996 6996 /* Add connection to indicate PA sync error */ 6997 - pa_sync = hci_conn_add_unset(hdev, BIS_LINK, BDADDR_ANY, 6997 + pa_sync = hci_conn_add_unset(hdev, PA_LINK, BDADDR_ANY, 6998 6998 HCI_ROLE_SLAVE); 6999 6999 7000 7000 if (IS_ERR(pa_sync))
+38 -10
net/bluetooth/iso.c
··· 1687 1687 clear_bit(BT_SK_PKT_STATUS, &bt_sk(sk)->flags); 1688 1688 break; 1689 1689 1690 + case BT_PKT_SEQNUM: 1691 + err = copy_safe_from_sockptr(&opt, sizeof(opt), optval, optlen); 1692 + if (err) 1693 + break; 1694 + 1695 + if (opt) 1696 + set_bit(BT_SK_PKT_SEQNUM, &bt_sk(sk)->flags); 1697 + else 1698 + clear_bit(BT_SK_PKT_SEQNUM, &bt_sk(sk)->flags); 1699 + break; 1700 + 1690 1701 case BT_ISO_QOS: 1691 1702 if (sk->sk_state != BT_OPEN && sk->sk_state != BT_BOUND && 1692 1703 sk->sk_state != BT_CONNECT2 && ··· 1902 1891 1903 1892 static bool iso_match_big(struct sock *sk, void *data) 1904 1893 { 1905 - struct hci_evt_le_big_sync_estabilished *ev = data; 1894 + struct hci_evt_le_big_sync_established *ev = data; 1906 1895 1907 1896 return ev->handle == iso_pi(sk)->qos.bcast.big; 1908 1897 } ··· 1923 1912 { 1924 1913 struct sock *parent = NULL; 1925 1914 struct sock *sk = conn->sk; 1926 - struct hci_ev_le_big_sync_estabilished *ev = NULL; 1915 + struct hci_ev_le_big_sync_established *ev = NULL; 1927 1916 struct hci_ev_le_pa_sync_established *ev2 = NULL; 1928 1917 struct hci_ev_le_per_adv_report *ev3 = NULL; 1929 1918 struct hci_conn *hcon; ··· 2034 2023 hci_conn_hold(hcon); 2035 2024 iso_chan_add(conn, sk, parent); 2036 2025 2037 - if ((ev && ((struct hci_evt_le_big_sync_estabilished *)ev)->status) || 2026 + if ((ev && ((struct hci_evt_le_big_sync_established *)ev)->status) || 2038 2027 (ev2 && ev2->status)) { 2039 2028 /* Trigger error signal on child socket */ 2040 2029 sk->sk_err = ECONNREFUSED; ··· 2093 2082 * proceed to establishing a BIG sync: 2094 2083 * 2095 2084 * 1. HCI_EV_LE_PA_SYNC_ESTABLISHED: The socket may specify a specific 2096 - * SID to listen to and once sync is estabilished its handle needs to 2085 + * SID to listen to and once sync is established its handle needs to 2097 2086 * be stored in iso_pi(sk)->sync_handle so it can be matched once 2098 2087 * receiving the BIG Info. 2099 2088 * 2. HCI_EVT_LE_BIG_INFO_ADV_REPORT: When connect_ind is triggered by a ··· 2237 2226 2238 2227 static void iso_connect_cfm(struct hci_conn *hcon, __u8 status) 2239 2228 { 2240 - if (hcon->type != CIS_LINK && hcon->type != BIS_LINK) { 2229 + if (hcon->type != CIS_LINK && hcon->type != BIS_LINK && 2230 + hcon->type != PA_LINK) { 2241 2231 if (hcon->type != LE_LINK) 2242 2232 return; 2243 2233 ··· 2279 2267 2280 2268 static void iso_disconn_cfm(struct hci_conn *hcon, __u8 reason) 2281 2269 { 2282 - if (hcon->type != CIS_LINK && hcon->type != BIS_LINK) 2270 + if (hcon->type != CIS_LINK && hcon->type != BIS_LINK && 2271 + hcon->type != PA_LINK) 2283 2272 return; 2284 2273 2285 2274 BT_DBG("hcon %p reason %d", hcon, reason); ··· 2291 2278 void iso_recv(struct hci_conn *hcon, struct sk_buff *skb, u16 flags) 2292 2279 { 2293 2280 struct iso_conn *conn = hcon->iso_data; 2294 - __u16 pb, ts, len; 2281 + struct skb_shared_hwtstamps *hwts; 2282 + __u16 pb, ts, len, sn; 2295 2283 2296 2284 if (!conn) 2297 2285 goto drop; ··· 2315 2301 if (ts) { 2316 2302 struct hci_iso_ts_data_hdr *hdr; 2317 2303 2318 - /* TODO: add timestamp to the packet? */ 2319 2304 hdr = skb_pull_data(skb, HCI_ISO_TS_DATA_HDR_SIZE); 2320 2305 if (!hdr) { 2321 2306 BT_ERR("Frame is too short (len %d)", skb->len); 2322 2307 goto drop; 2323 2308 } 2324 2309 2310 + /* Record the timestamp to skb */ 2311 + hwts = skb_hwtstamps(skb); 2312 + hwts->hwtstamp = us_to_ktime(le32_to_cpu(hdr->ts)); 2313 + 2314 + sn = __le16_to_cpu(hdr->sn); 2325 2315 len = __le16_to_cpu(hdr->slen); 2326 2316 } else { 2327 2317 struct hci_iso_data_hdr *hdr; ··· 2336 2318 goto drop; 2337 2319 } 2338 2320 2321 + sn = __le16_to_cpu(hdr->sn); 2339 2322 len = __le16_to_cpu(hdr->slen); 2340 2323 } 2341 2324 2342 2325 flags = hci_iso_data_flags(len); 2343 2326 len = hci_iso_data_len(len); 2344 2327 2345 - BT_DBG("Start: total len %d, frag len %d flags 0x%4.4x", len, 2346 - skb->len, flags); 2328 + BT_DBG("Start: total len %d, frag len %d flags 0x%4.4x sn %d", 2329 + len, skb->len, flags, sn); 2347 2330 2348 2331 if (len == skb->len) { 2349 2332 /* Complete frame received */ 2350 2333 hci_skb_pkt_status(skb) = flags & 0x03; 2334 + hci_skb_pkt_seqnum(skb) = sn; 2351 2335 iso_recv_frame(conn, skb); 2352 2336 return; 2353 2337 } ··· 2372 2352 goto drop; 2373 2353 2374 2354 hci_skb_pkt_status(conn->rx_skb) = flags & 0x03; 2355 + hci_skb_pkt_seqnum(conn->rx_skb) = sn; 2375 2356 skb_copy_from_linear_data(skb, skb_put(conn->rx_skb, skb->len), 2376 2357 skb->len); 2377 2358 conn->rx_len = len - skb->len; 2359 + 2360 + /* Copy hw timestamp from skb to rx_skb if present */ 2361 + if (ts) { 2362 + hwts = skb_hwtstamps(conn->rx_skb); 2363 + hwts->hwtstamp = skb_hwtstamps(skb)->hwtstamp; 2364 + } 2365 + 2378 2366 break; 2379 2367 2380 2368 case ISO_CONT:
+1 -1
net/bluetooth/lib.c
··· 54 54 * bt_to_errno() - Bluetooth error codes to standard errno 55 55 * @code: Bluetooth error code to be converted 56 56 * 57 - * This function takes a Bluetooth error code as input and convets 57 + * This function takes a Bluetooth error code as input and converts 58 58 * it to an equivalent Unix/standard errno value. 59 59 * 60 60 * Return:
+1
net/bluetooth/mgmt.c
··· 3237 3237 switch (link_type) { 3238 3238 case CIS_LINK: 3239 3239 case BIS_LINK: 3240 + case PA_LINK: 3240 3241 case LE_LINK: 3241 3242 switch (addr_type) { 3242 3243 case ADDR_LE_DEV_PUBLIC:
+2 -1
net/bluetooth/rfcomm/core.c
··· 1962 1962 int err; 1963 1963 1964 1964 /* Fast check for a new connection. 1965 - * Avoids unnesesary socket allocations. */ 1965 + * Avoids unnecessary socket allocations. 1966 + */ 1966 1967 if (list_empty(&bt_sk(sock->sk)->accept_q)) 1967 1968 return; 1968 1969
+1 -1
net/bluetooth/rfcomm/tty.c
··· 980 980 baud = RFCOMM_RPN_BR_230400; 981 981 break; 982 982 default: 983 - /* 9600 is standard accordinag to the RFCOMM specification */ 983 + /* 9600 is standard according to the RFCOMM specification */ 984 984 baud = RFCOMM_RPN_BR_9600; 985 985 break; 986 986
+1 -1
net/bluetooth/smp.c
··· 3189 3189 /* No need to call l2cap_chan_hold() here since we already own 3190 3190 * the reference taken in smp_new_conn_cb(). This is just the 3191 3191 * first time that we tie it to a specific pointer. The code in 3192 - * l2cap_core.c ensures that there's no risk this function wont 3192 + * l2cap_core.c ensures that there's no risk this function won't 3193 3193 * get called if smp_new_conn_cb was previously called. 3194 3194 */ 3195 3195 conn->smp = chan;