From: Zijun Hu <zijun.hu@oss.qualcomm.com>
To: Marcel Holtmann <marcel@holtmann.org>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Zijun Hu <zijun_hu@icloud.com>,
linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
Zijun Hu <zijun.hu@oss.qualcomm.com>
Subject: [PATCH 2/6] Bluetooth: coredump: Allow drivers to pad dump header to fixed size
Date: Wed, 08 Jul 2026 23:14:59 -0700 [thread overview]
Message-ID: <20260708-btusb_prep_qcc2072-v1-2-d835b187fd01@oss.qualcomm.com> (raw)
In-Reply-To: <20260708-btusb_prep_qcc2072-v1-0-d835b187fd01@oss.qualcomm.com>
To let a driver easily separate header and data in the generated
coredump, allow a vendor driver to pad its header to a fixed size by:
- exposing MAX_HCI_DEVCD_HDR_SIZE as the max header size
- exposing HCI_DEVCD_HDR_END as the header-ending marker
Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
include/net/bluetooth/coredump.h | 4 ++++
net/bluetooth/coredump.c | 7 ++-----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/include/net/bluetooth/coredump.h b/include/net/bluetooth/coredump.h
index ab85a6adfffd..b668277bdb76 100644
--- a/include/net/bluetooth/coredump.h
+++ b/include/net/bluetooth/coredump.h
@@ -8,6 +8,10 @@
#define DEVCOREDUMP_TIMEOUT msecs_to_jiffies(10000) /* 10 sec */
+/* total size shared by coredump and driver's dmp_hdr() */
+#define MAX_HCI_DEVCD_HDR_SIZE 512
+#define HCI_DEVCD_HDR_END "--- Start dump ---\n"
+
typedef void (*coredump_t)(struct hci_dev *hdev);
typedef void (*dmp_hdr_t)(struct hci_dev *hdev, struct sk_buff *skb);
typedef void (*notify_change_t)(struct hci_dev *hdev, int state);
diff --git a/net/bluetooth/coredump.c b/net/bluetooth/coredump.c
index 3d4c2194ef43..c77bf511679d 100644
--- a/net/bluetooth/coredump.c
+++ b/net/bluetooth/coredump.c
@@ -34,8 +34,6 @@ struct hci_devcoredump_skb_pattern {
hci_dmp_cb(skb)->pkt_type, \
hci_devcd_state_name(hdev->dump.state))
-#define MAX_DEVCOREDUMP_HDR_SIZE 512 /* bytes */
-
static int hci_devcd_update_hdr_state(char *buf, size_t size, int state)
{
int len = 0;
@@ -63,7 +61,6 @@ static int hci_devcd_update_state(struct hci_dev *hdev, int state)
static int hci_devcd_mkheader(struct hci_dev *hdev, struct sk_buff *skb)
{
- char dump_start[] = "--- Start dump ---\n";
char hdr[80];
int hdr_len;
@@ -74,7 +71,7 @@ static int hci_devcd_mkheader(struct hci_dev *hdev, struct sk_buff *skb)
if (hdev->dump.dmp_hdr)
hdev->dump.dmp_hdr(hdev, skb);
- skb_put_data(skb, dump_start, strlen(dump_start));
+ skb_put_data(skb, HCI_DEVCD_HDR_END, strlen(HCI_DEVCD_HDR_END));
return skb->len;
}
@@ -154,7 +151,7 @@ static int hci_devcd_prepare(struct hci_dev *hdev, u32 dump_size)
int dump_hdr_size;
int err = 0;
- skb = alloc_skb(MAX_DEVCOREDUMP_HDR_SIZE, GFP_ATOMIC);
+ skb = alloc_skb(MAX_HCI_DEVCD_HDR_SIZE, GFP_ATOMIC);
if (!skb)
return -ENOMEM;
--
2.34.1
next prev parent reply other threads:[~2026-07-09 6:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 6:14 [PATCH 0/6] Bluetooth: btusb: Preparation for upcoming Qualcomm QCC2072 support Zijun Hu
2026-07-09 6:14 ` [PATCH 1/6] Bluetooth: coredump: Introduce and apply hci_devcd_state_name() Zijun Hu
2026-07-09 9:29 ` Bluetooth: btusb: Preparation for upcoming Qualcomm QCC2072 support bluez.test.bot
2026-07-09 6:14 ` Zijun Hu [this message]
2026-07-09 6:15 ` [PATCH 3/6] Bluetooth: btusb: Add an indirect recv_intr() hook to btusb_data Zijun Hu
2026-07-09 6:15 ` [PATCH 4/6] Bluetooth: btusb: Add wrappers btusb_recv_{event,acl}_hdev() Zijun Hu
2026-07-09 6:15 ` [PATCH 5/6] Bluetooth: btusb: Add a simple static btusb_prepare_reset() Zijun Hu
2026-07-09 6:15 ` [PATCH 6/6] Bluetooth: btusb: Build the driver from multiple source files Zijun Hu
2026-07-09 13:40 ` Luiz Augusto von Dentz
2026-07-09 13:46 ` [PATCH 0/6] Bluetooth: btusb: Preparation for upcoming Qualcomm QCC2072 support 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=20260708-btusb_prep_qcc2072-v1-2-d835b187fd01@oss.qualcomm.com \
--to=zijun.hu@oss.qualcomm.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=zijun_hu@icloud.com \
/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