-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bluetooth: ISO: Add additional information for ISO streams #45077
Bluetooth: ISO: Add additional information for ISO streams #45077
Conversation
include/zephyr/bluetooth/iso.h
Outdated
/** The transport PHY */ | ||
uint8_t phy; | ||
|
||
/** The burst number */ | ||
uint8_t bn; | ||
|
||
/** The maximum PDU size in octets */ | ||
uint16_t max_pdu; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHY and PDU size is already stored as part of the struct bt_iso_chan_io_qos
struct. Should we omit them from these structs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that you get all the values from the established event in the same structure, hence I prefer this implementation. But do agree that it could be confusing that you have the value two places.
uint16_t interval; | ||
}; | ||
|
||
struct bt_iso_sync_receiver_info { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same as bt_iso_broadcaster_info
just without the sync_delay
. Should we use the same struct for both, and then just document that sync_delay
is for the broadcaster only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From an application data path point of view there is no difference between a broadcast and a unicast. Perhaps it would make sense to have the data common between unicast and broadcast in one structure (BN, PHY, max_pdu, number_of_subevents and interval) to have a generic data path handler - but there is also value in having simple structures with only valid members. Even if the documentation mentions a value is only valid in some cases a developer might miss that - especially during maintenance where you only modify the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference between unicast and broadcast is taht unicast may have 2 pairs of latency, flush timeout, etc. as it can be bidirectional.
include/zephyr/bluetooth/iso.h
Outdated
/** The flush timeout in ms */ | ||
uint32_t flush_timeout; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The flush timeout is typically given as a value in units of iso_interval
, but thought it made more sense to provide the value as a unit of MS by doing iso_interval * flush_timeout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we supply the value in time, I don't think ms is sufficient unless it is a float. 7.5ms is a standard iso-interval and that cannot be expressed in units of ms - except for even FT :-)
Unit could be micro seconds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The units from the event is 1.25ms. Using microseconds would unfortunately require a 64-bit value to hold this value (max FT * max iso_interval > 2^32-1).
Change to use unit of 1.25ms (we do that for many other interval issues).
include/zephyr/bluetooth/iso.h
Outdated
/** The ISO interval in ms */ | ||
uint16_t interval; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Values such as PHY, BN and interval are common between the 3 structs. Should we move them out of these and store them directly in struct bt_iso_info
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that - then you always have the values available where you need them (in the data path) and don't need for each application to implement it's own mapping from connection instance to connection parameters.
But again the unit of interval shall support x.25ms and x.5ms hence perhaps use micro seconds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #45077 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I move the NSE and interval to the outer struct, but the remaining fields are not easily moved. While all have e.g. max_pdu, the unicast struct have 2 values for that (given that it can be bidirectional).
The unicast and broadcast data path values (PDU, bn, latency, etc.) are also not the same, as e.g. broadcast has PTO and unicast has flush timeout
e432a41
to
88179cd
Compare
subsys/bluetooth/host/iso.c
Outdated
central->phy = evt->c_phy; | ||
central->latency = sys_get_le16(evt->c_latency); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think PHY is relevant even if c_max_pdu is 0. For example the phy in use is relevant to know when evaluating the link budget - you might need to increase TX power if a 2 mbit link is used for ACK/NACK, which might not be needed for a 1mbit link.
I expect a typical unidirectional stream will use 2mbit for upstream (audio data) whereas downstream (ack's) should be 1mbit to have robust acks/nack transfers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. I'll just leave the values as they come from the event then :)
subsys/bluetooth/host/iso.c
Outdated
info->irc = evt->irc; | ||
info->interval = sys_le16_to_cpu(evt->iso_interval); | ||
/* Transform to ms */ | ||
info->pto = info->interval * evt->pto; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for intervals of x.25, x.5 and x.75ms this calculation multiplies the error if the unit of evt->iso_interval
is ms - but I think the unit of that is slot-pairs (1.25ms). hence you need to multiply by 1.25ms to get ms. Maybe micro seconds is a better unit to use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #45077 (comment)
subsys/bluetooth/host/iso.c
Outdated
info->irc = evt->irc; | ||
info->interval = sys_le16_to_cpu(evt->iso_interval); | ||
/* Transform to ms */ | ||
info->pto = info->interval * evt->pto; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above - need to multiply by 1.25.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #45077 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ups, left my comments as independent comments rather than review comments - sorry.
Unit needs to be fixed - remaining is up to you.
4357773
to
6b94e29
Compare
6b94e29
to
0044688
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work Emil!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpick otherwise LGTM.
subsys/bluetooth/host/iso.c
Outdated
unicast_info->cig_sync_delay = sys_get_le24(evt->cig_sync_delay); | ||
unicast_info->cis_sync_delay = sys_get_le24(evt->cis_sync_delay); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Add all information from the ISO established events and provide the information in the get_info function. The use cases of each field heavily depends on what the ISO streams are used for. Most, if not all, of the field can be used by the higher layers to improve quality and/or reliability of e.g. audio streams that use ISO. Signed-off-by: Emil Gydesen <[email protected]>
0044688
to
d4428ff
Compare
Add all information from the ISO established events
and provide the information in the get_info function.
The use cases of each field heavily depends on what
the ISO streams are used for.
Most, if not all, of the field can be used by the
higher layers to improve quality and/or reliability
of e.g. audio streams that use ISO.
Signed-off-by: Emil Gydesen [email protected]
fixes #44546