Bluetooth: Change remote version event from prio to normal event type

This commit reverts the change that moved the remote version event from
a priority event to a normal event. This is done because the strategy
for using this event has been changed and will be used with a callback
instead of a semaphore that could be locked from the RX thread.

This commit retains the infrastructure that was added in the controller
so that moving events to priority processing is still possible.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2019-12-12 19:44:31 +01:00 committed by Johan Hedberg
commit 40c20b1f18
3 changed files with 30 additions and 46 deletions

View file

@ -3352,6 +3352,29 @@ static void le_data_len_change(struct pdu_data *pdu_data, u16_t handle,
}
#endif /* CONFIG_BT_CTLR_DATA_LENGTH */
#if defined(CONFIG_BT_REMOTE_VERSION)
void hci_remote_version_info_encode(struct pdu_data *pdu_data, u16_t handle,
struct net_buf *buf)
{
struct pdu_data_llctrl_version_ind *ver_ind;
struct bt_hci_evt_remote_version_info *ep;
if (!(event_mask & BT_EVT_MASK_REMOTE_VERSION_INFO)) {
return;
}
hci_evt_create(buf, BT_HCI_EVT_REMOTE_VERSION_INFO, sizeof(*ep));
ep = net_buf_add(buf, sizeof(*ep));
ver_ind = &pdu_data->llctrl.version_ind;
ep->status = 0x00;
ep->handle = sys_cpu_to_le16(handle);
ep->version = ver_ind->version_number;
ep->manufacturer = ver_ind->company_id;
ep->subversion = ver_ind->sub_version_number;
}
#endif /* CONFIG_BT_REMOTE_VERSION */
static void encode_data_ctrl(struct node_rx_pdu *node_rx,
struct pdu_data *pdu_data, struct net_buf *buf)
{
@ -3369,6 +3392,12 @@ static void encode_data_ctrl(struct node_rx_pdu *node_rx,
break;
#endif /* CONFIG_BT_CTLR_LE_ENC */
#if defined(CONFIG_BT_REMOTE_VERSION)
case PDU_DATA_LLCTRL_TYPE_VERSION_IND:
hci_remote_version_info_encode(pdu_data, handle, buf);
break;
#endif /* defined(CONFIG_BT_REMOTE_VERSION) */
case PDU_DATA_LLCTRL_TYPE_FEATURE_RSP:
le_remote_feat_complete(0x00, pdu_data, handle, buf);
break;
@ -3478,29 +3507,6 @@ void hci_num_cmplt_encode(struct net_buf *buf, u16_t handle, u8_t num)
hc->handle = sys_cpu_to_le16(handle);
hc->count = sys_cpu_to_le16(num);
}
#if defined(CONFIG_BT_REMOTE_VERSION)
void hci_remote_version_info_encode(struct net_buf *buf,
struct pdu_data *pdu_data, u16_t handle)
{
struct pdu_data_llctrl_version_ind *ver_ind;
struct bt_hci_evt_remote_version_info *ep;
if (!(event_mask & BT_EVT_MASK_REMOTE_VERSION_INFO)) {
return;
}
hci_evt_create(buf, BT_HCI_EVT_REMOTE_VERSION_INFO, sizeof(*ep));
ep = net_buf_add(buf, sizeof(*ep));
ver_ind = &pdu_data->llctrl.version_ind;
ep->status = 0x00;
ep->handle = sys_cpu_to_le16(handle);
ep->version = ver_ind->version_number;
ep->manufacturer = ver_ind->company_id;
ep->subversion = ver_ind->sub_version_number;
}
#endif /* CONFIG_BT_REMOTE_VERSION */
#endif /* CONFIG_BT_CONN */
u8_t hci_get_class(struct node_rx_pdu *node_rx)

View file

@ -76,27 +76,7 @@ static s32_t hbuf_count;
static struct net_buf *process_prio_evt(struct node_rx_pdu *node_rx)
{
/* Currently the only event processed */
#if defined(CONFIG_BT_REMOTE_VERSION)
struct pdu_data *pdu_data = PDU_DATA(node_rx);
struct net_buf *buf;
u16_t handle;
/* Avoid using hci_get_class() to speed things up */
if (node_rx->hdr.user_meta == HCI_CLASS_EVT_LLCP) {
handle = node_rx->hdr.handle;
if (pdu_data->llctrl.opcode ==
PDU_DATA_LLCTRL_TYPE_VERSION_IND) {
buf = bt_buf_get_evt(BT_HCI_EVT_REMOTE_VERSION_INFO,
false, K_FOREVER);
hci_remote_version_info_encode(buf, pdu_data, handle);
return buf;
}
}
#endif /* CONFIG_BT_CONN */
/* Currently there are no events processed */
return NULL;
}

View file

@ -46,8 +46,6 @@ u8_t hci_get_class(struct node_rx_pdu *node_rx);
int hci_acl_handle(struct net_buf *acl, struct net_buf **evt);
void hci_acl_encode(struct node_rx_pdu *node_rx, struct net_buf *buf);
void hci_num_cmplt_encode(struct net_buf *buf, u16_t handle, u8_t num);
void hci_remote_version_info_encode(struct net_buf *buf,
struct pdu_data *pdu_data, u16_t handle);
#endif
int hci_vendor_cmd_handle(u16_t ocf, struct net_buf *cmd,
struct net_buf **evt);