Bluetooth: Add common Kconfig option to disable PHY Update

This adds common option to disable support for PHY Update
procedure in controller and host.
This will reduce flash usage by compiling out le_phy_update_complete
event handler that will never be called if controller has been
compiled with BT_CTLR_PHY option disabled.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This commit is contained in:
Mariusz Skamra 2018-11-21 10:52:18 +01:00 committed by Anas Nashif
parent 141cf0f2cb
commit be314d3af5
23 changed files with 37 additions and 25 deletions

View file

@ -26,7 +26,7 @@ CONFIG_BT_BROADCASTER=y
CONFIG_BT_CTLR_LE_ENC=n
CONFIG_BT_CTLR_LE_PING=n
CONFIG_BT_CTLR_DATA_LENGTH=n
CONFIG_BT_CTLR_PHY=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_CHAN_SEL_2=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_ADV_EXT=n

View file

@ -16,7 +16,7 @@ CONFIG_BT_CTLR_DUP_FILTER_LEN=0
CONFIG_BT_CTLR_LE_ENC=n
CONFIG_BT_CTLR_LE_PING=n
CONFIG_BT_CTLR_DATA_LENGTH=n
CONFIG_BT_CTLR_PHY=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_CHAN_SEL_2=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_ADV_EXT=n

View file

@ -25,7 +25,7 @@ CONFIG_BT_BROADCASTER=y
CONFIG_BT_CTLR_LE_ENC=n
CONFIG_BT_CTLR_LE_PING=n
CONFIG_BT_CTLR_DATA_LENGTH=n
CONFIG_BT_CTLR_PHY=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_CHAN_SEL_2=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_ADV_EXT=n

View file

@ -12,7 +12,7 @@ CONFIG_BT_CTLR_DUP_FILTER_LEN=0
CONFIG_BT_CTLR_LE_ENC=n
CONFIG_BT_CTLR_LE_PING=n
CONFIG_BT_CTLR_DATA_LENGTH=n
CONFIG_BT_CTLR_PHY=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_CHAN_SEL_2=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_ADV_EXT=n

View file

@ -19,7 +19,7 @@ CONFIG_BT_CTLR_DUP_FILTER_LEN=0
CONFIG_BT_CTLR_LE_ENC=n
CONFIG_BT_CTLR_LE_PING=n
CONFIG_BT_CTLR_DATA_LENGTH=n
CONFIG_BT_CTLR_PHY=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_CHAN_SEL_2=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_ADV_EXT=n

View file

@ -17,7 +17,7 @@ CONFIG_BT_CTLR_DUP_FILTER_LEN=0
CONFIG_BT_CTLR_LE_ENC=n
CONFIG_BT_CTLR_LE_PING=n
CONFIG_BT_CTLR_DATA_LENGTH=n
CONFIG_BT_CTLR_PHY=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_CHAN_SEL_2=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_ADV_EXT=n

View file

@ -85,6 +85,12 @@ config BT_OBSERVER
endmenu
config BT_PHY_UPDATE
bool "PHY Update"
default y
help
Enable support for Bluetooth 5.0 PHY Update Procedure.
source "subsys/bluetooth/services/Kconfig"
config BT_CONN

View file

@ -259,11 +259,11 @@ config BT_CTLR_DATA_LENGTH_MAX
Set the maximum data length of PDU supported in the Controller.
config BT_CTLR_PHY
bool "PHY Update"
# Hidden option to enable support for Bluetooth 5.0 PHY Update
# Procedure in the Controller.
bool
depends on BT_PHY_UPDATE
default y if SOC_COMPATIBLE_NRF52X
help
Enable support for Bluetooth 5.0 PHY Update Procedure in the
Controller.
endif # BT_CONN

View file

@ -258,6 +258,7 @@ config BT_ATT_TX_MAX
config BT_AUTO_PHY_UPDATE
bool "Auto-initiate PHY Update Procedure"
depends on BT_PHY_UPDATE
default y
help
Initiate PHY Update Procedure on connection establishment.

View file

@ -1070,6 +1070,7 @@ static void le_data_len_change(struct net_buf *buf)
bt_conn_unref(conn);
}
#if defined(CONFIG_BT_PHY_UPDATE)
static void le_phy_update_complete(struct net_buf *buf)
{
struct bt_hci_evt_le_phy_update_complete *evt = (void *)buf->data;
@ -1103,6 +1104,7 @@ static void le_phy_update_complete(struct net_buf *buf)
done:
bt_conn_unref(conn);
}
#endif /* CONFIG_BT_PHY_UPDATE */
bool bt_le_conn_params_valid(const struct bt_le_conn_param *param)
{
@ -3304,9 +3306,11 @@ static void hci_le_meta_event(struct net_buf *buf)
case BT_HCI_EVT_LE_DATA_LEN_CHANGE:
le_data_len_change(buf);
break;
#if defined(CONFIG_BT_PHY_UPDATE)
case BT_HCI_EVT_LE_PHY_UPDATE_COMPLETE:
le_phy_update_complete(buf);
break;
#endif /* CONFIG_BT_PHY_UPDATE */
#endif /* CONFIG_BT_CONN */
#if defined(CONFIG_BT_SMP)
case BT_HCI_EVT_LE_LTK_REQUEST:
@ -3791,8 +3795,9 @@ static int le_set_event_mask(void)
mask |= BT_EVT_MASK_LE_DATA_LEN_CHANGE;
}
if (BT_FEAT_LE_PHY_2M(bt_dev.le.features) ||
BT_FEAT_LE_PHY_CODED(bt_dev.le.features)) {
if (IS_ENABLED(CONFIG_BT_PHY_UPDATE) &&
(BT_FEAT_LE_PHY_2M(bt_dev.le.features) ||
BT_FEAT_LE_PHY_CODED(bt_dev.le.features))) {
mask |= BT_EVT_MASK_LE_PHY_UPDATE_COMPLETE;
}
}

View file

@ -6,7 +6,7 @@ CONFIG_BT_CTLR_LE_PING=n
CONFIG_BT_CTLR_PRIVACY=n
CONFIG_BT_CTLR_EXT_SCAN_FP=n
CONFIG_BT_CTLR_DATA_LENGTH=n
CONFIG_BT_CTLR_PHY=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_CHAN_SEL_2=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_ADV_EXT=n

View file

@ -6,7 +6,7 @@ CONFIG_BT_CTLR_LE_PING=y
CONFIG_BT_CTLR_PRIVACY=y
CONFIG_BT_CTLR_EXT_SCAN_FP=y
CONFIG_BT_CTLR_DATA_LENGTH=y
CONFIG_BT_CTLR_PHY=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_CHAN_SEL_2=y
CONFIG_BT_CTLR_MIN_USED_CHAN=y
CONFIG_BT_CTLR_ADV_EXT=y

View file

@ -6,7 +6,7 @@ CONFIG_BT_CTLR_LE_PING=n
CONFIG_BT_CTLR_PRIVACY=n
CONFIG_BT_CTLR_EXT_SCAN_FP=n
CONFIG_BT_CTLR_DATA_LENGTH=n
CONFIG_BT_CTLR_PHY=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_CHAN_SEL_2=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_ADV_EXT=n

View file

@ -9,7 +9,7 @@ CONFIG_BT_CTLR_DUP_FILTER_LEN=0
CONFIG_BT_CTLR_LE_ENC=n
CONFIG_BT_CTLR_LE_PING=n
CONFIG_BT_CTLR_DATA_LENGTH=n
CONFIG_BT_CTLR_PHY=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_CHAN_SEL_2=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_ADV_EXT=n

View file

@ -9,7 +9,7 @@ CONFIG_BT_CTLR_DUP_FILTER_LEN=0
CONFIG_BT_CTLR_LE_ENC=n
CONFIG_BT_CTLR_LE_PING=n
CONFIG_BT_CTLR_DATA_LENGTH=n
CONFIG_BT_CTLR_PHY=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_CHAN_SEL_2=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_ADV_EXT=n

View file

@ -9,7 +9,7 @@ CONFIG_BT_CTLR_DUP_FILTER_LEN=0
CONFIG_BT_CTLR_LE_ENC=n
CONFIG_BT_CTLR_LE_PING=n
CONFIG_BT_CTLR_DATA_LENGTH=n
CONFIG_BT_CTLR_PHY=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_CHAN_SEL_2=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_ADV_EXT=n

View file

@ -9,7 +9,7 @@ CONFIG_BT_CTLR_DUP_FILTER_LEN=0
CONFIG_BT_CTLR_LE_ENC=n
CONFIG_BT_CTLR_LE_PING=n
CONFIG_BT_CTLR_DATA_LENGTH=n
CONFIG_BT_CTLR_PHY=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_CHAN_SEL_2=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_ADV_EXT=n

View file

@ -17,7 +17,7 @@ CONFIG_BT_BROADCASTER=y
CONFIG_BT_CTLR_LE_ENC=n
CONFIG_BT_CTLR_LE_PING=n
CONFIG_BT_CTLR_DATA_LENGTH=n
CONFIG_BT_CTLR_PHY=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_CHAN_SEL_2=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_ADV_EXT=n

View file

@ -25,7 +25,7 @@ CONFIG_BT_BROADCASTER=y
CONFIG_BT_CTLR_LE_ENC=n
CONFIG_BT_CTLR_LE_PING=n
CONFIG_BT_CTLR_DATA_LENGTH=n
CONFIG_BT_CTLR_PHY=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_CHAN_SEL_2=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_ADV_EXT=n

View file

@ -9,7 +9,7 @@ CONFIG_BT_CTLR_DUP_FILTER_LEN=0
CONFIG_BT_CTLR_LE_ENC=n
CONFIG_BT_CTLR_LE_PING=n
CONFIG_BT_CTLR_DATA_LENGTH=n
CONFIG_BT_CTLR_PHY=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_CHAN_SEL_2=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_ADV_EXT=n

View file

@ -9,7 +9,7 @@ CONFIG_BT_CTLR_DUP_FILTER_LEN=0
CONFIG_BT_CTLR_LE_ENC=n
CONFIG_BT_CTLR_LE_PING=n
CONFIG_BT_CTLR_DATA_LENGTH=n
CONFIG_BT_CTLR_PHY=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_CHAN_SEL_2=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_ADV_EXT=n

View file

@ -9,7 +9,7 @@ CONFIG_BT_CTLR_DUP_FILTER_LEN=0
CONFIG_BT_CTLR_LE_ENC=n
CONFIG_BT_CTLR_LE_PING=n
CONFIG_BT_CTLR_DATA_LENGTH=n
CONFIG_BT_CTLR_PHY=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_CHAN_SEL_2=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_ADV_EXT=n

View file

@ -25,7 +25,7 @@ CONFIG_BT_CTLR_DUP_FILTER_LEN=0
CONFIG_BT_CTLR_LE_ENC=n
CONFIG_BT_CTLR_LE_PING=n
CONFIG_BT_CTLR_DATA_LENGTH=n
CONFIG_BT_CTLR_PHY=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_CHAN_SEL_2=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_ADV_EXT=n