Bluetooth: controller: Fixes for ISO from IAL testing
- Prevent NULL-pointer dereferencing if datapath is created late - Support SDU fragment complete-counting for framed case Signed-off-by: Morten Priess <mtpr@oticon.com>
This commit is contained in:
parent
fc107a0775
commit
ca8457d882
|
@ -130,6 +130,7 @@ isoal_status_t sink_sdu_emit_hci(const struct isoal_sink *sink_ctx,
|
|||
return ISOAL_STATUS_OK;
|
||||
}
|
||||
#endif /* CONFIG_BT_CTLR_CONN_ISO_HCI_DATAPATH_SKIP_INVALID_DATA */
|
||||
|
||||
pb = sink_ctx->sdu_production.sdu_state;
|
||||
len = sink_ctx->sdu_production.sdu_written;
|
||||
packet_status_flag = valid_sdu->status;
|
||||
|
@ -379,9 +380,8 @@ static inline struct net_buf *encode_node(struct node_rx_pdu *node_rx,
|
|||
}
|
||||
|
||||
struct ll_iso_datapath *dp = hdr->datapath_out;
|
||||
isoal_sink_handle_t sink = dp->sink_hdl;
|
||||
|
||||
if (dp->path_id == BT_HCI_DATAPATH_ID_HCI) {
|
||||
if (dp && dp->path_id == BT_HCI_DATAPATH_ID_HCI) {
|
||||
/* If HCI datapath pass to ISO AL here */
|
||||
struct isoal_pdu_rx pckt_meta = {
|
||||
.meta = &node_rx->hdr.rx_iso_meta,
|
||||
|
@ -390,7 +390,7 @@ static inline struct net_buf *encode_node(struct node_rx_pdu *node_rx,
|
|||
|
||||
/* Pass the ISO PDU through ISO-AL */
|
||||
isoal_status_t err =
|
||||
isoal_rx_pdu_recombine(sink, &pckt_meta);
|
||||
isoal_rx_pdu_recombine(dp->sink_hdl, &pckt_meta);
|
||||
|
||||
LL_ASSERT(err == ISOAL_STATUS_OK); /* TODO handle err */
|
||||
}
|
||||
|
|
|
@ -2463,29 +2463,22 @@ static uint8_t tx_cmplt_get(uint16_t *handle, uint8_t *first, uint8_t last)
|
|||
IS_ADV_ISO_HANDLE(tx->handle)) {
|
||||
struct node_tx_iso *tx_node_iso;
|
||||
struct pdu_data *p;
|
||||
uint8_t fragments;
|
||||
|
||||
tx_node_iso = tx->node;
|
||||
p = (void *)tx_node_iso->pdu;
|
||||
/* TODO: We may need something more advanced for framed */
|
||||
if (p->ll_id == PDU_CIS_LLID_COMPLETE_END ||
|
||||
p->ll_id == PDU_BIS_LLID_COMPLETE_END) {
|
||||
/* We must count each SDU HCI fragment */
|
||||
fragments = tx_node_iso->sdu_fragments;
|
||||
if (fragments == 0) {
|
||||
/* FIXME: If ISOAL is not used for TX,
|
||||
* sdu_fragments is not incremented. In
|
||||
* that case we assume unfragmented for
|
||||
* now.
|
||||
*/
|
||||
fragments = 1;
|
||||
}
|
||||
cmplt += fragments;
|
||||
|
||||
if (IS_ADV_ISO_HANDLE(tx->handle)) {
|
||||
/* FIXME: ADV_ISO shall be updated to use ISOAL for
|
||||
* TX. Until then, assume 1 node equals 1 fragment.
|
||||
*/
|
||||
cmplt += 1;
|
||||
} else {
|
||||
/* We count each SDU fragment completed by this PDU */
|
||||
cmplt += tx_node_iso->sdu_fragments;
|
||||
}
|
||||
|
||||
ll_iso_link_tx_release(tx_node_iso->link);
|
||||
ll_iso_tx_mem_release(tx_node_iso);
|
||||
|
||||
goto next_ack;
|
||||
#endif /* CONFIG_BT_CTLR_ADV_ISO || CONFIG_BT_CTLR_CONN_ISO */
|
||||
|
||||
|
|
Loading…
Reference in a new issue