Bluetooth: HCI: Rename to bt_hci_iso_sdu_hdr and bt_hci_iso_sdu_ts_hdr

Rename struct bt_hci_iso_data_hdr to bt_hci_iso_sdu_hdr, and
struct bt_hci_iso_ts_data_hdr to bt_hci_iso_sdu_ts_hdr.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2024-05-08 14:24:04 +02:00 committed by Carles Cufí
commit 3997479b49
6 changed files with 31 additions and 31 deletions

View file

@ -68,7 +68,7 @@ struct bt_buf_data {
/** Helper to calculate needed buffer size for HCI ISO packets. */ /** Helper to calculate needed buffer size for HCI ISO packets. */
#define BT_BUF_ISO_SIZE(size) BT_BUF_SIZE(BT_HCI_ISO_HDR_SIZE + \ #define BT_BUF_ISO_SIZE(size) BT_BUF_SIZE(BT_HCI_ISO_HDR_SIZE + \
BT_HCI_ISO_TS_DATA_HDR_SIZE + \ BT_HCI_ISO_SDU_TS_HDR_SIZE + \
(size)) (size))
/** Data size needed for HCI ACL RX buffers */ /** Data size needed for HCI ACL RX buffers */

View file

@ -108,17 +108,17 @@ struct bt_hci_acl_hdr {
#define bt_iso_pkt_flags(h) ((h) >> 14) #define bt_iso_pkt_flags(h) ((h) >> 14)
#define bt_iso_pkt_len_pack(h, f) (((h) & BIT_MASK(12)) | ((f) << 14)) #define bt_iso_pkt_len_pack(h, f) (((h) & BIT_MASK(12)) | ((f) << 14))
struct bt_hci_iso_data_hdr { struct bt_hci_iso_sdu_hdr {
uint16_t sn; uint16_t sn;
uint16_t slen; /* 12 bit len, 2 bit RFU, 2 bit packet status */ uint16_t slen; /* 12 bit len, 2 bit RFU, 2 bit packet status */
} __packed; } __packed;
#define BT_HCI_ISO_DATA_HDR_SIZE 4 #define BT_HCI_ISO_SDU_HDR_SIZE 4
struct bt_hci_iso_ts_data_hdr { struct bt_hci_iso_sdu_ts_hdr {
uint32_t ts; uint32_t ts;
struct bt_hci_iso_data_hdr data; struct bt_hci_iso_sdu_hdr sdu;
} __packed; } __packed;
#define BT_HCI_ISO_TS_DATA_HDR_SIZE 8 #define BT_HCI_ISO_SDU_TS_HDR_SIZE 8
/* Bluetooth spec v5.4 Vol 4, Part E - 5.4.5 HCI ISO Data Packets */ /* Bluetooth spec v5.4 Vol 4, Part E - 5.4.5 HCI ISO Data Packets */
struct bt_hci_iso_hdr { struct bt_hci_iso_hdr {

View file

@ -110,7 +110,7 @@ config BT_ISO_TX_MTU
help help
Maximum MTU for Isochronous channels TX buffers. Maximum MTU for Isochronous channels TX buffers.
This is the actual data payload. It doesn't include the optional This is the actual data payload. It doesn't include the optional
HCI ISO Data packet fields (e.g. `struct bt_hci_iso_ts_data_hdr`). HCI ISO Data packet fields (e.g. `struct bt_hci_iso_sdu_ts_hdr`).
Set this value to 247 to fit 247 bytes of data within a single Set this value to 247 to fit 247 bytes of data within a single
HCI ISO Data packet with a size of 255, without utilizing timestamps. HCI ISO Data packet with a size of 255, without utilizing timestamps.
@ -128,7 +128,7 @@ config BT_ISO_RX_MTU
help help
Maximum MTU for Isochronous channels RX buffers. Maximum MTU for Isochronous channels RX buffers.
This is the actual data payload. It doesn't include the optional This is the actual data payload. It doesn't include the optional
HCI ISO Data packet fields (e.g. `struct bt_hci_iso_ts_data_hdr`) HCI ISO Data packet fields (e.g. `struct bt_hci_iso_sdu_ts_hdr`)
config BT_ISO_TEST_PARAMS config BT_ISO_TEST_PARAMS
bool "ISO test parameters support" bool "ISO test parameters support"

View file

@ -5709,7 +5709,7 @@ int hci_acl_handle(struct net_buf *buf, struct net_buf **evt)
#if defined(CONFIG_BT_CTLR_ADV_ISO) || defined(CONFIG_BT_CTLR_CONN_ISO) #if defined(CONFIG_BT_CTLR_ADV_ISO) || defined(CONFIG_BT_CTLR_CONN_ISO)
int hci_iso_handle(struct net_buf *buf, struct net_buf **evt) int hci_iso_handle(struct net_buf *buf, struct net_buf **evt)
{ {
struct bt_hci_iso_data_hdr *iso_data_hdr; struct bt_hci_iso_sdu_hdr *iso_sdu_hdr;
struct isoal_sdu_tx sdu_frag_tx; struct isoal_sdu_tx sdu_frag_tx;
struct bt_hci_iso_hdr *iso_hdr; struct bt_hci_iso_hdr *iso_hdr;
uint32_t *time_stamp; uint32_t *time_stamp;
@ -5719,7 +5719,7 @@ int hci_iso_handle(struct net_buf *buf, struct net_buf **evt)
uint8_t flags; uint8_t flags;
uint16_t len; uint16_t len;
iso_data_hdr = NULL; iso_sdu_hdr = NULL;
*evt = NULL; *evt = NULL;
if (buf->len < sizeof(*iso_hdr)) { if (buf->len < sizeof(*iso_hdr)) {
@ -5770,11 +5770,11 @@ int hci_iso_handle(struct net_buf *buf, struct net_buf **evt)
/* Extract ISO data header if included (PB_Flag 0b00 or 0b10) */ /* Extract ISO data header if included (PB_Flag 0b00 or 0b10) */
if ((pb_flag & 0x01) == 0) { if ((pb_flag & 0x01) == 0) {
iso_data_hdr = net_buf_pull_mem(buf, sizeof(*iso_data_hdr)); iso_sdu_hdr = net_buf_pull_mem(buf, sizeof(*iso_sdu_hdr));
len -= sizeof(*iso_data_hdr); len -= sizeof(*iso_sdu_hdr);
sdu_frag_tx.packet_sn = sys_le16_to_cpu(iso_data_hdr->sn); sdu_frag_tx.packet_sn = sys_le16_to_cpu(iso_sdu_hdr->sn);
sdu_frag_tx.iso_sdu_length = sdu_frag_tx.iso_sdu_length =
sys_le16_to_cpu(bt_iso_pkt_len(iso_data_hdr->slen)); sys_le16_to_cpu(bt_iso_pkt_len(iso_sdu_hdr->slen));
} else { } else {
sdu_frag_tx.packet_sn = 0; sdu_frag_tx.packet_sn = 0;
sdu_frag_tx.iso_sdu_length = 0; sdu_frag_tx.iso_sdu_length = 0;

View file

@ -138,7 +138,7 @@ static int bt_recv_prio(struct net_buf *buf)
#if defined(CONFIG_BT_CTLR_ISO) #if defined(CONFIG_BT_CTLR_ISO)
#define SDU_HCI_HDR_SIZE (BT_HCI_ISO_HDR_SIZE + BT_HCI_ISO_TS_DATA_HDR_SIZE) #define SDU_HCI_HDR_SIZE (BT_HCI_ISO_HDR_SIZE + BT_HCI_ISO_SDU_TS_HDR_SIZE)
isoal_status_t sink_sdu_alloc_hci(const struct isoal_sink *sink_ctx, isoal_status_t sink_sdu_alloc_hci(const struct isoal_sink *sink_ctx,
const struct isoal_pdu_rx *valid_pdu, const struct isoal_pdu_rx *valid_pdu,
@ -167,7 +167,7 @@ isoal_status_t sink_sdu_emit_hci(const struct isoal_sink *sink_ctx,
const struct isoal_emitted_sdu_frag *sdu_frag, const struct isoal_emitted_sdu_frag *sdu_frag,
const struct isoal_emitted_sdu *sdu) const struct isoal_emitted_sdu *sdu)
{ {
struct bt_hci_iso_ts_data_hdr *data_hdr; struct bt_hci_iso_sdu_ts_hdr *sdu_hdr;
uint16_t packet_status_flag; uint16_t packet_status_flag;
struct bt_hci_iso_hdr *hdr; struct bt_hci_iso_hdr *hdr;
uint16_t handle_packed; uint16_t handle_packed;
@ -230,14 +230,14 @@ isoal_status_t sink_sdu_emit_hci(const struct isoal_sink *sink_ctx,
ts = (pb & 0x1) == 0x0; ts = (pb & 0x1) == 0x0;
if (ts) { if (ts) {
data_hdr = net_buf_push(buf, BT_HCI_ISO_TS_DATA_HDR_SIZE); sdu_hdr = net_buf_push(buf, BT_HCI_ISO_SDU_TS_HDR_SIZE);
slen_packed = bt_iso_pkt_len_pack(total_len, packet_status_flag); slen_packed = bt_iso_pkt_len_pack(total_len, packet_status_flag);
data_hdr->ts = sys_cpu_to_le32((uint32_t) sdu_frag->sdu.timestamp); sdu_hdr->ts = sys_cpu_to_le32((uint32_t) sdu_frag->sdu.timestamp);
data_hdr->data.sn = sys_cpu_to_le16((uint16_t) sdu_frag->sdu.sn); sdu_hdr->sdu.sn = sys_cpu_to_le16((uint16_t) sdu_frag->sdu.sn);
data_hdr->data.slen = sys_cpu_to_le16(slen_packed); sdu_hdr->sdu.slen = sys_cpu_to_le16(slen_packed);
len += BT_HCI_ISO_TS_DATA_HDR_SIZE; len += BT_HCI_ISO_SDU_TS_HDR_SIZE;
} }
hdr = net_buf_push(buf, BT_HCI_ISO_HDR_SIZE); hdr = net_buf_push(buf, BT_HCI_ISO_HDR_SIZE);

View file

@ -168,7 +168,7 @@ struct net_buf *bt_iso_create_pdu_timeout(struct net_buf_pool *pool,
pool = &iso_tx_pool; pool = &iso_tx_pool;
} }
reserve += sizeof(struct bt_hci_iso_data_hdr); reserve += sizeof(struct bt_hci_iso_sdu_hdr);
#if defined(CONFIG_NET_BUF_LOG) #if defined(CONFIG_NET_BUF_LOG)
return bt_conn_create_pdu_timeout_debug(pool, reserve, timeout, func, return bt_conn_create_pdu_timeout_debug(pool, reserve, timeout, func,
@ -585,7 +585,7 @@ struct net_buf *bt_iso_get_rx(k_timeout_t timeout)
void bt_iso_recv(struct bt_conn *iso, struct net_buf *buf, uint8_t flags) void bt_iso_recv(struct bt_conn *iso, struct net_buf *buf, uint8_t flags)
{ {
struct bt_hci_iso_data_hdr *hdr; struct bt_hci_iso_sdu_hdr *hdr;
struct bt_iso_chan *chan; struct bt_iso_chan *chan;
uint8_t pb, ts; uint8_t pb, ts;
uint16_t len, pkt_seq_no; uint16_t len, pkt_seq_no;
@ -609,12 +609,12 @@ void bt_iso_recv(struct bt_conn *iso, struct net_buf *buf, uint8_t flags)
* of an SDU or a complete SDU. * of an SDU or a complete SDU.
*/ */
if (ts) { if (ts) {
struct bt_hci_iso_ts_data_hdr *ts_hdr; struct bt_hci_iso_sdu_ts_hdr *ts_hdr;
ts_hdr = net_buf_pull_mem(buf, sizeof(*ts_hdr)); ts_hdr = net_buf_pull_mem(buf, sizeof(*ts_hdr));
iso_info(buf)->ts = sys_le32_to_cpu(ts_hdr->ts); iso_info(buf)->ts = sys_le32_to_cpu(ts_hdr->ts);
hdr = &ts_hdr->data; hdr = &ts_hdr->sdu;
iso_info(buf)->flags |= BT_ISO_FLAGS_TS; iso_info(buf)->flags |= BT_ISO_FLAGS_TS;
} else { } else {
hdr = net_buf_pull_mem(buf, sizeof(*hdr)); hdr = net_buf_pull_mem(buf, sizeof(*hdr));
@ -791,11 +791,11 @@ static int validate_send(const struct bt_iso_chan *chan, const struct net_buf *b
int bt_iso_chan_send(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num) int bt_iso_chan_send(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num)
{ {
struct bt_hci_iso_data_hdr *hdr; struct bt_hci_iso_sdu_hdr *hdr;
struct bt_conn *iso_conn; struct bt_conn *iso_conn;
int err; int err;
err = validate_send(chan, buf, BT_HCI_ISO_DATA_HDR_SIZE); err = validate_send(chan, buf, BT_HCI_ISO_SDU_HDR_SIZE);
if (err != 0) { if (err != 0) {
return err; return err;
} }
@ -815,11 +815,11 @@ int bt_iso_chan_send(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq
int bt_iso_chan_send_ts(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num, int bt_iso_chan_send_ts(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num,
uint32_t ts) uint32_t ts)
{ {
struct bt_hci_iso_ts_data_hdr *hdr; struct bt_hci_iso_sdu_ts_hdr *hdr;
struct bt_conn *iso_conn; struct bt_conn *iso_conn;
int err; int err;
err = validate_send(chan, buf, BT_HCI_ISO_TS_DATA_HDR_SIZE); err = validate_send(chan, buf, BT_HCI_ISO_SDU_TS_HDR_SIZE);
if (err != 0) { if (err != 0) {
return err; return err;
} }
@ -828,8 +828,8 @@ int bt_iso_chan_send_ts(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t
hdr = net_buf_push(buf, sizeof(*hdr)); hdr = net_buf_push(buf, sizeof(*hdr));
hdr->ts = ts; hdr->ts = ts;
hdr->data.sn = sys_cpu_to_le16(seq_num); hdr->sdu.sn = sys_cpu_to_le16(seq_num);
hdr->data.slen = sys_cpu_to_le16( hdr->sdu.slen = sys_cpu_to_le16(
bt_iso_pkt_len_pack(net_buf_frags_len(buf) - sizeof(*hdr), BT_ISO_DATA_VALID)); bt_iso_pkt_len_pack(net_buf_frags_len(buf) - sizeof(*hdr), BT_ISO_DATA_VALID));
iso_conn = chan->iso; iso_conn = chan->iso;