diff --git a/include/zephyr/bluetooth/buf.h b/include/zephyr/bluetooth/buf.h index 7429547ee41..b373ab5bd91 100644 --- a/include/zephyr/bluetooth/buf.h +++ b/include/zephyr/bluetooth/buf.h @@ -68,7 +68,7 @@ struct bt_buf_data { /** Helper to calculate needed buffer size for HCI ISO packets. */ #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)) /** Data size needed for HCI ACL RX buffers */ diff --git a/include/zephyr/bluetooth/hci_types.h b/include/zephyr/bluetooth/hci_types.h index f1ebf0c7d3e..cbcbf4ea503 100644 --- a/include/zephyr/bluetooth/hci_types.h +++ b/include/zephyr/bluetooth/hci_types.h @@ -108,17 +108,17 @@ struct bt_hci_acl_hdr { #define bt_iso_pkt_flags(h) ((h) >> 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 slen; /* 12 bit len, 2 bit RFU, 2 bit packet status */ } __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; - struct bt_hci_iso_data_hdr data; + struct bt_hci_iso_sdu_hdr sdu; } __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 */ struct bt_hci_iso_hdr { diff --git a/subsys/bluetooth/Kconfig.iso b/subsys/bluetooth/Kconfig.iso index 89955b70614..68119724f18 100644 --- a/subsys/bluetooth/Kconfig.iso +++ b/subsys/bluetooth/Kconfig.iso @@ -110,7 +110,7 @@ config BT_ISO_TX_MTU help Maximum MTU for Isochronous channels TX buffers. 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 HCI ISO Data packet with a size of 255, without utilizing timestamps. @@ -128,7 +128,7 @@ config BT_ISO_RX_MTU help Maximum MTU for Isochronous channels RX buffers. 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 bool "ISO test parameters support" diff --git a/subsys/bluetooth/controller/hci/hci.c b/subsys/bluetooth/controller/hci/hci.c index 36e062a0ad9..4fecb50de1a 100644 --- a/subsys/bluetooth/controller/hci/hci.c +++ b/subsys/bluetooth/controller/hci/hci.c @@ -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) 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 bt_hci_iso_hdr *iso_hdr; uint32_t *time_stamp; @@ -5719,7 +5719,7 @@ int hci_iso_handle(struct net_buf *buf, struct net_buf **evt) uint8_t flags; uint16_t len; - iso_data_hdr = NULL; + iso_sdu_hdr = NULL; *evt = NULL; 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) */ if ((pb_flag & 0x01) == 0) { - iso_data_hdr = net_buf_pull_mem(buf, sizeof(*iso_data_hdr)); - len -= sizeof(*iso_data_hdr); - sdu_frag_tx.packet_sn = sys_le16_to_cpu(iso_data_hdr->sn); + iso_sdu_hdr = net_buf_pull_mem(buf, sizeof(*iso_sdu_hdr)); + len -= sizeof(*iso_sdu_hdr); + sdu_frag_tx.packet_sn = sys_le16_to_cpu(iso_sdu_hdr->sn); 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 { sdu_frag_tx.packet_sn = 0; sdu_frag_tx.iso_sdu_length = 0; diff --git a/subsys/bluetooth/controller/hci/hci_driver.c b/subsys/bluetooth/controller/hci/hci_driver.c index 20b73b5b1d6..a7251748cca 100644 --- a/subsys/bluetooth/controller/hci/hci_driver.c +++ b/subsys/bluetooth/controller/hci/hci_driver.c @@ -138,7 +138,7 @@ static int bt_recv_prio(struct net_buf *buf) #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, 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 *sdu) { - struct bt_hci_iso_ts_data_hdr *data_hdr; + struct bt_hci_iso_sdu_ts_hdr *sdu_hdr; uint16_t packet_status_flag; struct bt_hci_iso_hdr *hdr; 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; 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); - data_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); - data_hdr->data.slen = sys_cpu_to_le16(slen_packed); + sdu_hdr->ts = sys_cpu_to_le32((uint32_t) sdu_frag->sdu.timestamp); + sdu_hdr->sdu.sn = sys_cpu_to_le16((uint16_t) sdu_frag->sdu.sn); + 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); diff --git a/subsys/bluetooth/host/iso.c b/subsys/bluetooth/host/iso.c index 7f1e0d01f70..ec0a5e8ceab 100644 --- a/subsys/bluetooth/host/iso.c +++ b/subsys/bluetooth/host/iso.c @@ -168,7 +168,7 @@ struct net_buf *bt_iso_create_pdu_timeout(struct net_buf_pool *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) 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) { - struct bt_hci_iso_data_hdr *hdr; + struct bt_hci_iso_sdu_hdr *hdr; struct bt_iso_chan *chan; uint8_t pb, ts; 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. */ 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)); 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; } else { 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) { - struct bt_hci_iso_data_hdr *hdr; + struct bt_hci_iso_sdu_hdr *hdr; struct bt_conn *iso_conn; 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) { 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, uint32_t ts) { - struct bt_hci_iso_ts_data_hdr *hdr; + struct bt_hci_iso_sdu_ts_hdr *hdr; struct bt_conn *iso_conn; 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) { 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->ts = ts; - hdr->data.sn = sys_cpu_to_le16(seq_num); - hdr->data.slen = sys_cpu_to_le16( + hdr->sdu.sn = sys_cpu_to_le16(seq_num); + hdr->sdu.slen = sys_cpu_to_le16( bt_iso_pkt_len_pack(net_buf_frags_len(buf) - sizeof(*hdr), BT_ISO_DATA_VALID)); iso_conn = chan->iso;