Bluetooth: Add H/W TX timeout error MGMT event
authorSudha Bheemanna <b.sudha@samsung.com>
Wed, 7 Sep 2016 11:17:58 +0000 (16:47 +0530)
committerJaehoon Chung <jh80.chung@samsung.com>
Tue, 29 Apr 2025 03:38:23 +0000 (12:38 +0900)
This patch sends the H/W TX timeout error MGMT event if HCI command
timeout occurs after sending HCI commands.

Change-Id: Ia95350282e37d2b15b7b0225d14f547f4a6fc18a
Signed-off-by: Sudha Bheemanna <b.sudha@samsung.com>
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
include/net/bluetooth/hci.h
include/net/bluetooth/hci_core.h
include/net/bluetooth/mgmt_tizen.h
net/bluetooth/hci_core.c
net/bluetooth/mgmt.c

index 0f850ad9b3fc207dc26c3a159af07505483a6e57..b1a350baa34b493e6fa09471f4e9f3e0389d4a97 100644 (file)
@@ -440,7 +440,11 @@ enum {
 #define HCI_DISCONN_TIMEOUT    msecs_to_jiffies(2000)  /* 2 seconds */
 #define HCI_PAIRING_TIMEOUT    msecs_to_jiffies(60000) /* 60 seconds */
 #define HCI_INIT_TIMEOUT       msecs_to_jiffies(10000) /* 10 seconds */
+#ifdef TIZEN_BT
+#define HCI_CMD_TIMEOUT                msecs_to_jiffies(5000)  /* 5 seconds */
+#else
 #define HCI_CMD_TIMEOUT                msecs_to_jiffies(2000)  /* 2 seconds */
+#endif
 #define HCI_NCMD_TIMEOUT       msecs_to_jiffies(4000)  /* 4 seconds */
 #define HCI_ACL_TX_TIMEOUT     msecs_to_jiffies(45000) /* 45 seconds */
 #define HCI_AUTO_OFF_TIMEOUT   msecs_to_jiffies(2000)  /* 2 seconds */
index 79822a0eeb65b8038d160791d4e4033f4e0b6a1a..0018256359cdc8d2569fb03b1ea18d8cae943f02 100644 (file)
@@ -2418,6 +2418,7 @@ int mgmt_le_conn_updated(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type,
 int mgmt_le_conn_update_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
                u8 link_type, u8 addr_type, u8 status);
 void mgmt_hardware_error(struct hci_dev *hdev, u8 err_code);
+void mgmt_tx_timeout_error(struct hci_dev *hdev);
 #endif
 
 int hci_abort_conn(struct hci_conn *conn, u8 reason);
index 680ad8b9b1a00d3eb04b7e0e5854c9d71ff1b588..fd5a9fe3f39089ac5bb71d47b2e638f945b04768 100644 (file)
@@ -169,6 +169,10 @@ struct mgmt_ev_hardware_error {
 } __packed;
 /* handling of hardware error event */
 
+/* For HCI TX Timeout Error */
+#define MGMT_EV_TX_TIMEOUT_ERROR               (TIZEN_EV_BASE + 0x03)
+/* HCI TX Timeout Error */
+
 /* For handling of RSSI Events */
 #define MGMT_EV_RSSI_ALERT                     (TIZEN_EV_BASE + 0x04)
 struct mgmt_ev_vendor_specific_rssi_alert {
index 19fe41e798bf44ebe7cee1f95c8b2d85da83afc4..7697b621b57446b3d67f1a1184bdbae6469d44f7 100644 (file)
@@ -174,6 +174,13 @@ void hci_le_discovery_set_state(struct hci_dev *hdev, int state)
 
        hdev->le_discovery.state = state;
 }
+
+static void hci_tx_timeout_error_evt(struct hci_dev *hdev)
+{
+       BT_ERR("%s H/W TX Timeout error", hdev->name);
+
+       mgmt_tx_timeout_error(hdev);
+}
 #endif
 
 void hci_inquiry_cache_flush(struct hci_dev *hdev)
@@ -1499,6 +1506,10 @@ static void hci_cmd_timeout(struct work_struct *work)
        if (hdev->cmd_timeout)
                hdev->cmd_timeout(hdev);
 
+#ifdef TIZEN_BT
+       hci_tx_timeout_error_evt(hdev);
+#endif
+
        atomic_set(&hdev->cmd_cnt, 1);
        queue_work(hdev->workqueue, &hdev->cmd_work);
 }
index 162d57c21bcd8275a9b70692e7dabcf0cbd45f1d..563a306de7b36cb6834acb80763316c82d95dea8 100644 (file)
@@ -8816,6 +8816,11 @@ void mgmt_hardware_error(struct hci_dev *hdev, u8 err_code)
        ev.error_code = err_code;
        mgmt_event(MGMT_EV_HARDWARE_ERROR, hdev, &ev, sizeof(ev), NULL);
 }
+
+void mgmt_tx_timeout_error(struct hci_dev *hdev)
+{
+       mgmt_event(MGMT_EV_TX_TIMEOUT_ERROR, hdev, NULL, 0, NULL);
+}
 #endif /* TIZEN_BT */
 
 static bool ltk_is_valid(struct mgmt_ltk_info *key)