@@ -275,7 +275,7 @@ u8_t ll_conn_update(u16_t handle, u8_t cmd, u8_t status, u16_t interval_min,
275
275
#if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ )
276
276
if (!conn -> llcp_conn_param .disabled &&
277
277
(!conn -> common .fex_valid ||
278
- (conn -> llcp_feature .features &
278
+ (conn -> llcp_feature .features_conn &
279
279
BIT (BT_LE_FEAT_BIT_CONN_PARAM_REQ )))) {
280
280
cmd ++ ;
281
281
} else if (conn -> lll .role ) {
@@ -2499,7 +2499,8 @@ static inline void event_enc_reject_prep(struct ll_conn *conn,
2499
2499
pdu -> ll_id = PDU_DATA_LLID_CTRL ;
2500
2500
2501
2501
if (conn -> common .fex_valid &&
2502
- (conn -> llcp_feature .features & BIT (BT_LE_FEAT_BIT_EXT_REJ_IND ))) {
2502
+ (conn -> llcp_feature .features_conn &
2503
+ BIT (BT_LE_FEAT_BIT_EXT_REJ_IND ))) {
2503
2504
struct pdu_data_llctrl_reject_ext_ind * p ;
2504
2505
2505
2506
pdu -> llctrl .opcode = PDU_DATA_LLCTRL_TYPE_REJECT_EXT_IND ;
@@ -2727,7 +2728,7 @@ static inline void event_fex_prep(struct ll_conn *conn)
2727
2728
pdu -> llctrl .opcode = PDU_DATA_LLCTRL_TYPE_FEATURE_RSP ;
2728
2729
(void )memset (& pdu -> llctrl .feature_rsp .features [0 ], 0x00 ,
2729
2730
sizeof (pdu -> llctrl .feature_rsp .features ));
2730
- sys_put_le24 (conn -> llcp_feature .features ,
2731
+ sys_put_le24 (conn -> llcp_feature .features_peer ,
2731
2732
pdu -> llctrl .feature_req .features );
2732
2733
2733
2734
/* enqueue feature rsp structure into rx queue */
@@ -2745,7 +2746,7 @@ static inline void event_fex_prep(struct ll_conn *conn)
2745
2746
conn -> llcp_feature .ack -- ;
2746
2747
2747
2748
/* use initial feature bitmap */
2748
- conn -> llcp_feature .features = LL_FEAT ;
2749
+ conn -> llcp_feature .features_conn = LL_FEAT ;
2749
2750
2750
2751
/* place the feature exchange req packet as next in tx queue */
2751
2752
pdu -> ll_id = PDU_DATA_LLID_CTRL ;
@@ -2757,7 +2758,7 @@ static inline void event_fex_prep(struct ll_conn *conn)
2757
2758
(void )memset (& pdu -> llctrl .feature_req .features [0 ],
2758
2759
0x00 ,
2759
2760
sizeof (pdu -> llctrl .feature_req .features ));
2760
- sys_put_le24 (conn -> llcp_feature .features ,
2761
+ sys_put_le24 (conn -> llcp_feature .features_conn ,
2761
2762
pdu -> llctrl .feature_req .features );
2762
2763
2763
2764
ctrl_tx_enqueue (conn , tx );
@@ -3162,14 +3163,14 @@ static inline void dle_max_time_get(const struct ll_conn *conn,
3162
3163
3163
3164
#if defined(CONFIG_BT_CTLR_PHY )
3164
3165
#if defined(CONFIG_BT_CTLR_PHY_CODED )
3165
- feature_coded_phy = (conn -> llcp_feature .features &
3166
+ feature_coded_phy = (conn -> llcp_feature .features_conn &
3166
3167
BIT (BT_LE_FEAT_BIT_PHY_CODED ));
3167
3168
#else
3168
3169
feature_coded_phy = 0 ;
3169
3170
#endif
3170
3171
3171
3172
#if defined(CONFIG_BT_CTLR_PHY_2M )
3172
- feature_phy_2m = (conn -> llcp_feature .features &
3173
+ feature_phy_2m = (conn -> llcp_feature .features_conn &
3173
3174
BIT (BT_LE_FEAT_BIT_PHY_2M ));
3174
3175
#else
3175
3176
feature_phy_2m = 0 ;
@@ -4007,12 +4008,28 @@ static inline u32_t feat_get(u8_t *features)
4007
4008
return feat ;
4008
4009
}
4009
4010
4011
+ /*
4012
+ * Perform a logical and on octet0 and keep the remaining bits of the
4013
+ * first input parameter
4014
+ */
4015
+ static inline u32_t feat_land_octet0 (u32_t feat_to_keep , u32_t feat_octet0 )
4016
+ {
4017
+ u32_t feat_result ;
4018
+
4019
+ feat_result = feat_to_keep & feat_octet0 ;
4020
+ feat_result &= 0xFF ;
4021
+ feat_result |= feat_to_keep & LL_FEAT_FILTER_OCTET0 ;
4022
+
4023
+ return feat_result ;
4024
+ }
4025
+
4010
4026
static int feature_rsp_send (struct ll_conn * conn , struct node_rx_pdu * rx ,
4011
4027
struct pdu_data * pdu_rx )
4012
4028
{
4013
4029
struct pdu_data_llctrl_feature_req * req ;
4014
4030
struct node_tx * tx ;
4015
4031
struct pdu_data * pdu_tx ;
4032
+ u32_t feat ;
4016
4033
4017
4034
/* acquire tx mem */
4018
4035
tx = mem_acquire (& mem_conn_tx_ctrl .free );
@@ -4022,7 +4039,14 @@ static int feature_rsp_send(struct ll_conn *conn, struct node_rx_pdu *rx,
4022
4039
4023
4040
/* AND the feature set to get Feature USED */
4024
4041
req = & pdu_rx -> llctrl .feature_req ;
4025
- conn -> llcp_feature .features &= feat_get (& req -> features [0 ]);
4042
+ conn -> llcp_feature .features_conn &= feat_get (& req -> features [0 ]);
4043
+ /*
4044
+ * Get all the features of peer, except octet 0.
4045
+ * Octet 0 is the actual features used on the link
4046
+ * See BTCore V5.2, Vol. 6, Part B, chapter 5.1.4
4047
+ */
4048
+ conn -> llcp_feature .features_peer =
4049
+ feat_land_octet0 (feat_get (& req -> features [0 ]), LL_FEAT );
4026
4050
4027
4051
/* features exchanged */
4028
4052
conn -> common .fex_valid = 1U ;
@@ -4031,12 +4055,16 @@ static int feature_rsp_send(struct ll_conn *conn, struct node_rx_pdu *rx,
4031
4055
pdu_tx = (void * )tx -> pdu ;
4032
4056
pdu_tx -> ll_id = PDU_DATA_LLID_CTRL ;
4033
4057
pdu_tx -> len = offsetof(struct pdu_data_llctrl , feature_rsp ) +
4034
- sizeof (struct pdu_data_llctrl_feature_rsp );
4058
+ sizeof (struct pdu_data_llctrl_feature_rsp );
4035
4059
pdu_tx -> llctrl .opcode = PDU_DATA_LLCTRL_TYPE_FEATURE_RSP ;
4036
4060
(void )memset (& pdu_tx -> llctrl .feature_rsp .features [0 ], 0x00 ,
4037
4061
sizeof (pdu_tx -> llctrl .feature_rsp .features ));
4038
- sys_put_le24 (conn -> llcp_feature .features ,
4039
- pdu_tx -> llctrl .feature_req .features );
4062
+ /*
4063
+ * On feature response we send the local supported features.
4064
+ * See BTCore V5.2 VOl 6 Part B, chapter 5.1.4
4065
+ */
4066
+ feat = feat_land_octet0 (LL_FEAT , conn -> llcp_feature .features_conn );
4067
+ sys_put_le24 (feat , pdu_tx -> llctrl .feature_rsp .features );
4040
4068
4041
4069
ctrl_tx_sec_enqueue (conn , tx );
4042
4070
@@ -4053,7 +4081,14 @@ static void feature_rsp_recv(struct ll_conn *conn, struct pdu_data *pdu_rx)
4053
4081
rsp = & pdu_rx -> llctrl .feature_rsp ;
4054
4082
4055
4083
/* AND the feature set to get Feature USED */
4056
- conn -> llcp_feature .features &= feat_get (& rsp -> features [0 ]);
4084
+ conn -> llcp_feature .features_conn &= feat_get (& rsp -> features [0 ]);
4085
+ /*
4086
+ * Get all the features of peer, except octet 0.
4087
+ * Octet 0 is the actual features used on the link
4088
+ * See BTCore V5.2, Vol. 6, Part B, chapter 5.1.4
4089
+ */
4090
+ conn -> llcp_feature .features_peer =
4091
+ feat_land_octet0 (feat_get (& rsp -> features [0 ]), LL_FEAT );
4057
4092
4058
4093
/* features exchanged */
4059
4094
conn -> common .fex_valid = 1U ;
0 commit comments