bluetooth: controller: removing 'no-brainer' TODOs from refactored LLCP

Getting rid of TODOs that are fairly straight forward to resolve
* introduce role checks in ENC API
* Remove ASSERT on re-rx of LL_VERSION_IND, ignore instead
* in tests/.../ctrl_chmu: rename variable and initialize initial ch map
* in tests/.../mock_ctrl/util.c: Changing TODO into FYI
* in tests/.../helper_features.h update mask and remove TODO comment
* in ull_llcp_remote.c: re-order cases in proc_with_instant switch
* in ull_conn_upd.c: PARAM REQ only uses REJECT_EXT_IND
* in ull_llcp_common.c: in CENTRAL on rx of LL_MIN_USED_CHANNELS_IND
     chose to do nothing re. channel map. Update unit test accordingly

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
This commit is contained in:
Erik Brockhoff 2022-03-07 14:51:28 +01:00 committed by Carles Cufí
commit 045735787d
8 changed files with 44 additions and 63 deletions

View file

@ -237,13 +237,8 @@
/*
* The following two are defined as per
* Core Spec V5.2 Volume 6, Part B, chapter 4.6
* LL_FEAT_BIT_MASK_VALID does not account for the bits
* for the new features in V5.2
* TODO: EXPECTED_FEAT_EXCH_VALID is not used at the moment
* but probably LL_FEAT_BIT_MASK_VALID should get this
* value in ll_feat.h
* Core Spec V5.3 Volume 6, Part B, chapter 4.6
*/
#define EXPECTED_FEAT_EXCH_VALID 0x0000000FF787CF2F
#define EXPECTED_FEAT_EXCH_VALID 0x000000EFF787CF2F
#define FEAT_FILTER_OCTET0 0xFFFFFFFFFFFFFF00
#define COMMON_FEAT_OCTET0(x) (FEAT_FILTER_OCTET0 | ((x) & ~FEAT_FILTER_OCTET0))

View file

@ -53,8 +53,7 @@ static bool is_instant_reached(struct ll_conn *conn, uint16_t instant)
void test_channel_map_update_central_loc(void)
{
uint8_t chm[5] = { 0x00, 0x04, 0x05, 0x06, 0x00 };
/* TODO should test setup set this to valid value? */
uint8_t defchm[5] = {};
uint8_t initial_chm[5];
uint8_t err;
struct node_tx *tx;
struct pdu_data *pdu;
@ -64,6 +63,9 @@ void test_channel_map_update_central_loc(void)
.chm = { 0x00, 0x04, 0x05, 0x06, 0x00 },
};
/* Store initial channel map */
memcpy(initial_chm, conn.lll.data_chan_map, sizeof(conn.lll.data_chan_map));
/* Role */
test_set_role(&conn, BT_HCI_ROLE_CENTRAL);
@ -104,8 +106,9 @@ void test_channel_map_update_central_loc(void)
/* There should NOT be a host notification */
ut_rx_q_is_empty();
/* check if using old channel map */
zassert_mem_equal(conn.lll.data_chan_map, defchm, sizeof(conn.lll.data_chan_map),
/* check if still using initial channel map */
zassert_mem_equal(conn.lll.data_chan_map, initial_chm,
sizeof(conn.lll.data_chan_map),
"Channel map invalid");
}
@ -132,14 +135,16 @@ void test_channel_map_update_central_loc(void)
void test_channel_map_update_periph_rem(void)
{
uint8_t chm[5] = { 0x00, 0x04, 0x05, 0x06, 0x00 };
/* TODO should test setup set this to valid value? */
uint8_t defchm[5] = {};
uint8_t initial_chm[5];
struct pdu_data_llctrl_chan_map_ind chmu_ind = {
.instant = 6,
.chm = { 0x00, 0x04, 0x05, 0x06, 0x00 },
};
uint16_t instant = 6;
/* Store initial channel map */
memcpy(initial_chm, conn.lll.data_chan_map, sizeof(conn.lll.data_chan_map));
/* Role */
test_set_role(&conn, BT_HCI_ROLE_PERIPHERAL);
@ -173,7 +178,8 @@ void test_channel_map_update_periph_rem(void)
ut_rx_q_is_empty();
/* check if using old channel map */
zassert_mem_equal(conn.lll.data_chan_map, defchm, sizeof(conn.lll.data_chan_map),
zassert_mem_equal(conn.lll.data_chan_map, initial_chm,
sizeof(conn.lll.data_chan_map),
"Channel map invalid");
}

View file

@ -126,10 +126,6 @@ void test_min_used_chans_central_rem(void)
{
struct pdu_data_llctrl_min_used_chans_ind remote_muc_ind = { .phys = 1,
.min_used_chans = 2 };
struct pdu_data_llctrl_chan_map_ind ch_map_ind = { .chm = { 0xff, 0xff, 0xff, 0xff, 0x1f },
.instant = 7 };
struct node_tx *tx;
/* Role */
test_set_role(&conn, BT_HCI_ROLE_CENTRAL);
@ -143,17 +139,13 @@ void test_min_used_chans_central_rem(void)
/* Rx */
lt_tx(LL_MIN_USED_CHANS_IND, &conn, &remote_muc_ind);
/* Emulate a phy to trigger channel map update */
conn.lll.phy_tx = 0x7;
/* Done */
event_done(&conn);
/* Prepare */
event_prepare(&conn);
/* Tx Queue should have one LL Control PDU */
lt_rx(LL_CHAN_MAP_UPDATE_IND, &conn, &tx, &ch_map_ind);
/* Tx Queue should have no LL Control PDU */
lt_rx_q_is_empty(&conn);
/* Done */
@ -162,7 +154,7 @@ void test_min_used_chans_central_rem(void)
/* There should not be a host notifications */
ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt() - 1,
zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free());
}

View file

@ -17,9 +17,6 @@
/**
* @brief Population count: Count the number of bits set to 1
* @details
* TODO: Faster methods available at [1].
* [1] http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel
*
* @param octets Data to count over
* @param octets_len Must not be bigger than 255/8 = 31 bytes