-
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: Controller: Simplified logic in dle_max_time_get #23370
Conversation
Combined RX and TX time calculation for different PHY cases Signed-off-by: Dag Bjarvin <Dag.Bjarvin@nordicsemi.no>
u16_t rx_time = 0; | ||
u16_t tx_time = 0; | ||
u16_t bit = 0; |
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.
u8_t phy = 0;
Use phy
elsewhere too
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.
or active_phy
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.
You mean use phy instead of bit?
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.
yes. phy
or phy_bitmask
#endif | ||
#endif /* CONFIG_BT_CTLR_PHY_CODED */ | ||
|
||
if (!conn->common.fex_valid) { |
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.
Move this above the if
at line 3157 and use else if
to reduce the number of compare-and-branch instructions.
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 agree.
#else | ||
feature_coded_phy = 0; | ||
feature_phy_2m = 0; | ||
if (conn->llcp_feature.features & BIT(BT_LE_FEAT_BIT_PHY_2M)) { |
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.
else if
local supports Coded PHY, but peer may not support Coded PHY and supports 2M.
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'll let Andries comment on this
|
||
if (!conn->common.fex_valid || | ||
(!feature_coded_phy && !feature_phy_2m)) { | ||
if (bit == 0) { |
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
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.
Remove the if (bit==0), and replace the 0 in the formulas for rx_time and tx_time with phy (or actual_phy)
Note that phy can only be non-zero if CONFIG_BT_CTLR_PHY is enabled, so the calculation for tx_time will still be correct
Fixed according to code review comments Signed-off-by: Bjarvin <dag.bjarvin@nordicsemi.no>
u16_t rx_time = 0; | ||
u16_t tx_time = 0; | ||
u16_t bit = 0; |
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.
or active_phy
|
||
if (!conn->common.fex_valid || | ||
(!feature_coded_phy && !feature_phy_2m)) { | ||
if (bit == 0) { |
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.
Remove the if (bit==0), and replace the 0 in the formulas for rx_time and tx_time with phy (or actual_phy)
Note that phy can only be non-zero if CONFIG_BT_CTLR_PHY is enabled, so the calculation for tx_time will still be correct
} | ||
|
||
if (bit == 0) { | ||
if (phy_bitmask == 0) { |
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.
You don't need the if-statement
u8_t phy_bitmask = 0; | ||
|
||
if (!conn->common.fex_valid) { | ||
phy_bitmask = 0; |
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.
Please squash the commits into one |
Combined RX and TX time calculation for different PHY cases
Signed-off-by: Dag Bjarvin Dag.Bjarvin@nordicsemi.no