From: Benjamin Berg <benjamin@sipsolutions.net>
To: linux-bluetooth@vger.kernel.org
Cc: Benjamin Berg <bberg@redhat.com>
Subject: [PATCH 2/4] Bluetooth: Add new hci_tx_error function
Date: Tue, 9 Nov 2021 17:41:11 +0100 [thread overview]
Message-ID: <20211109164113.65981-3-benjamin@sipsolutions.net> (raw)
In-Reply-To: <20211109164113.65981-1-benjamin@sipsolutions.net>
From: Benjamin Berg <bberg@redhat.com>
Currently this function only cancels any synchronous operation that
might be ongoing. Adding this function allows aborting synchronous
commands in case of low level TX/RX issues. A common example for this is
that the device has been removed.
Signed-off-by: Benjamin Berg <bberg@redhat.com>
---
include/net/bluetooth/hci_core.h | 1 +
net/bluetooth/hci_core.c | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index dd8840e70e25..542f5a37b9d0 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1267,6 +1267,7 @@ void hci_release_dev(struct hci_dev *hdev);
int hci_suspend_dev(struct hci_dev *hdev);
int hci_resume_dev(struct hci_dev *hdev);
int hci_reset_dev(struct hci_dev *hdev);
+void hci_tx_error(struct hci_dev *hdev, int err);
int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb);
int hci_recv_diag(struct hci_dev *hdev, struct sk_buff *skb);
__printf(2, 3) void hci_set_hw_info(struct hci_dev *hdev, const char *fmt, ...);
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 8d33aa64846b..bbb35188e41f 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -4069,6 +4069,13 @@ int hci_reset_dev(struct hci_dev *hdev)
}
EXPORT_SYMBOL(hci_reset_dev);
+/* Reset HCI device */
+void hci_tx_error(struct hci_dev *hdev, int err)
+{
+ hci_req_sync_cancel(hdev, err);
+}
+EXPORT_SYMBOL(hci_tx_error);
+
/* Receive frame from HCI drivers */
int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
--
2.31.1
next prev parent reply other threads:[~2021-11-09 16:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-09 16:41 [PATCH 0/4] Cancel sync commands if a TX failure occurs Benjamin Berg
2021-11-09 16:41 ` [PATCH 1/4] Bluetooth: Reset more state when cancelling a sync command Benjamin Berg
2021-12-02 23:52 ` Luiz Augusto von Dentz
2021-11-09 16:41 ` Benjamin Berg [this message]
2021-11-09 23:06 ` [PATCH 2/4] Bluetooth: Add new hci_tx_error function Luiz Augusto von Dentz
2021-11-09 16:41 ` [PATCH 3/4] Bluetooth: hci_core: Signal TX failure if sending a frame failed Benjamin Berg
2021-11-09 23:13 ` Luiz Augusto von Dentz
2021-11-10 8:46 ` Benjamin Berg
2021-11-09 16:41 ` [PATCH 4/4] Bluetooth: btusb: Signal URB errors as TX failure Benjamin Berg
2021-11-09 23:25 ` Luiz Augusto von Dentz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211109164113.65981-3-benjamin@sipsolutions.net \
--to=benjamin@sipsolutions.net \
--cc=bberg@redhat.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox