Lines Matching refs:att
104 struct bt_att *att; member
302 struct bt_conn *conn = att_chan->att->conn; in att_sent()
399 err = bt_smp_sign(chan->att->conn, buf); in chan_send()
565 struct bt_att *att = chan->att; in bt_att_sent() local
572 if (!att) { in bt_att_sent()
582 if (!chan->req && !sys_slist_is_empty(&att->reqs)) { in bt_att_sent()
583 sys_snode_t *node = sys_slist_get(&att->reqs); in bt_att_sent()
590 sys_slist_prepend(&att->reqs, node); in bt_att_sent()
600 (void)process_queue(chan, &att->tx_queue); in bt_att_sent()
627 struct bt_conn *conn = chan->att->conn; in chan_req_notif_sent()
653 !meta->att_chan->att || in att_on_sent_cb()
654 !meta->att_chan->att->conn) { in att_on_sent_cb()
749 static void att_send_process(struct bt_att *att) in att_send_process() argument
754 SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&att->chans, chan, tmp, node) { in att_send_process()
764 err = process_queue(chan, &att->tx_queue); in att_send_process()
863 atomic_set_bit(chan->att->conn->flags, BT_CONN_ATT_MTU_EXCHANGED); in att_mtu_req()
884 static void att_req_send_process(struct bt_att *att) in att_req_send_process() argument
889 SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&att->chans, chan, tmp, node) { in att_req_send_process()
906 req = get_first_req_matching_chan(&att->reqs, chan); in att_req_send_process()
916 sys_slist_prepend(&att->reqs, &req->node); in att_req_send_process()
953 att_req_send_process(chan->att); in att_handle_rsp()
955 func(chan->att->conn, err, pdu, len, params); in att_handle_rsp()
1628 if (!bt_gatt_change_aware(chan->att->conn, true)) { in att_read_rsp()
1705 if (!bt_gatt_change_aware(chan->att->conn, true)) { in att_read_mult_req()
1809 if (!bt_gatt_change_aware(chan->att->conn, true)) { in att_read_mult_vl_req()
2090 if (!bt_gatt_change_aware(chan->att->conn, req ? true : false)) { in att_write_rsp()
2112 data.conn = chan->att->conn; in att_write_rsp()
2220 if (!bt_gatt_change_aware(chan->att->conn, true)) { in att_prep_write_rsp()
2234 data.conn = chan->att->conn; in att_prep_write_rsp()
2252 net_buf_slist_put(&chan->att->prep_queue, data.buf); in att_prep_write_rsp()
2355 while (!sys_slist_is_empty(&chan->att->prep_queue)) { in att_exec_write_rsp()
2363 buf = net_buf_slist_get(&chan->att->prep_queue); in att_exec_write_rsp()
2373 &chan->att->prep_queue, in att_exec_write_rsp()
2693 bt_gatt_notification(chan->att->conn, handle, buf->data, buf->len); in att_notify()
2706 bt_gatt_notification(chan->att->conn, handle, buf->data, buf->len); in att_indicate()
2722 bt_gatt_mult_notification(chan->att->conn, buf->data, buf->len); in att_notify_mult()
2957 if (!att_chan->att) { in bt_att_recv()
3016 return att_chan->att; in att_get()
3021 struct bt_att *att; in bt_att_create_pdu() local
3024 att = att_get(conn); in bt_att_create_pdu()
3025 if (!att) { in bt_att_create_pdu()
3030 SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&att->chans, chan, tmp, node) { in bt_att_create_pdu()
3073 static void att_reset(struct bt_att *att) in att_reset() argument
3079 while ((buf = net_buf_slist_get(&att->prep_queue))) { in att_reset()
3087 (void)k_work_cancel_delayable_sync(&att->eatt.connection_work, &sync); in att_reset()
3090 while ((buf = k_fifo_get(&att->tx_queue, K_NO_WAIT))) { in att_reset()
3095 while (!sys_slist_is_empty(&att->reqs)) { in att_reset()
3099 node = sys_slist_get_not_empty(&att->reqs); in att_reset()
3102 req->func(att->conn, -ECONNRESET, NULL, 0, in att_reset()
3112 att->conn = NULL; in att_reset()
3113 k_mem_slab_free(&att_slab, (void *)att); in att_reset()
3122 sys_slist_find_and_remove(&chan->att->chans, &chan->node); in att_chan_detach()
3134 chan->att = NULL; in att_chan_detach()
3146 bt_addr_le_to_str(bt_conn_get_dst(chan->att->conn), addr, sizeof(addr)); in att_timeout()
3180 static void att_chan_attach(struct bt_att *att, struct bt_att_chan *chan) in att_chan_attach() argument
3182 LOG_DBG("att %p chan %p flags %lu", att, chan, atomic_get(chan->flags)); in att_chan_attach()
3184 if (sys_slist_is_empty(&att->chans)) { in att_chan_attach()
3186 k_fifo_init(&att->tx_queue); in att_chan_attach()
3188 sys_slist_init(&att->prep_queue); in att_chan_attach()
3192 sys_slist_prepend(&att->chans, &chan->node); in att_chan_attach()
3214 struct bt_att *att = att_chan->att; in bt_att_disconnected() local
3219 if (!att_chan->att) { in bt_att_disconnected()
3227 if (!sys_slist_is_empty(&att->chans)) { in bt_att_disconnected()
3231 att_reset(att); in bt_att_disconnected()
3278 if (!att_chan->att) { in bt_att_encrypt_change()
3327 if (!chan->att) { in bt_att_status()
3338 node = sys_slist_get(&chan->att->reqs); in bt_att_status()
3348 sys_slist_prepend(&chan->att->reqs, node); in bt_att_status()
3371 static struct bt_att_chan *att_chan_new(struct bt_att *att, atomic_val_t flags) in att_chan_new() argument
3390 SYS_SLIST_FOR_EACH_CONTAINER(&att->chans, chan, node) { in att_chan_new()
3391 if (chan->att == att) { in att_chan_new()
3402 LOG_WRN("No available ATT channel for conn %p", att->conn); in att_chan_new()
3410 chan->att = att; in att_chan_new()
3411 att_chan_attach(att, chan); in att_chan_new()
3433 struct bt_att *att; in bt_eatt_count() local
3441 att = att_get(conn); in bt_eatt_count()
3442 if (!att) { in bt_eatt_count()
3446 SYS_SLIST_FOR_EACH_CONTAINER(&att->chans, chan, node) { in bt_eatt_count()
3459 const struct bt_att *att = CONTAINER_OF(dwork, struct bt_att, eatt.connection_work); in att_enhanced_connection_work_handler() local
3460 const int err = bt_eatt_connect(att->conn, att->eatt.chans_to_connect); in att_enhanced_connection_work_handler()
3465 att->eatt.chans_to_connect); in att_enhanced_connection_work_handler()
3467 LOG_WRN("Failed to connect %d EATT channels (err: %d)", att->eatt.chans_to_connect, in att_enhanced_connection_work_handler()
3476 struct bt_att *att; in bt_att_accept() local
3481 if (k_mem_slab_alloc(&att_slab, (void **)&att, K_NO_WAIT)) { in bt_att_accept()
3488 (void)memset(att, 0, sizeof(*att)); in bt_att_accept()
3489 att->conn = conn; in bt_att_accept()
3490 sys_slist_init(&att->reqs); in bt_att_accept()
3491 sys_slist_init(&att->chans); in bt_att_accept()
3494 k_work_init_delayable(&att->eatt.connection_work, in bt_att_accept()
3498 chan = att_chan_new(att, 0); in bt_att_accept()
3556 struct bt_att *att = att_get(conn); in att_schedule_eatt_connect() local
3558 if (!att) { in att_schedule_eatt_connect()
3562 att->eatt.chans_to_connect = chans_to_connect; in att_schedule_eatt_connect()
3564 return k_work_reschedule(&att->eatt.connection_work, in att_schedule_eatt_connect()
3568 static void handle_potential_collision(struct bt_att *att) in handle_potential_collision() argument
3570 __ASSERT_NO_MSG(att); in handle_potential_collision()
3573 size_t to_connect = att->eatt.prev_conn_req_missing_chans; in handle_potential_collision()
3575 if (att->eatt.prev_conn_rsp_result == BT_L2CAP_LE_ERR_NO_RESOURCES && in handle_potential_collision()
3576 att->eatt.prev_conn_req_result == BT_L2CAP_LE_ERR_NO_RESOURCES) { in handle_potential_collision()
3580 att->eatt.prev_conn_rsp_result = 0; in handle_potential_collision()
3581 att->eatt.prev_conn_req_result = 0; in handle_potential_collision()
3582 att->eatt.prev_conn_req_missing_chans = 0; in handle_potential_collision()
3588 err = att_schedule_eatt_connect(att->conn, to_connect); in handle_potential_collision()
3597 struct bt_att *att = att_get(conn); in ecred_connect_req_cb() local
3599 if (!att) { in ecred_connect_req_cb()
3608 att->eatt.prev_conn_rsp_result = result; in ecred_connect_req_cb()
3610 handle_potential_collision(att); in ecred_connect_req_cb()
3617 struct bt_att *att = att_get(conn); in ecred_connect_rsp_cb() local
3619 if (!att) { in ecred_connect_rsp_cb()
3628 att->eatt.prev_conn_req_result = result; in ecred_connect_rsp_cb()
3629 att->eatt.prev_conn_req_missing_chans = in ecred_connect_rsp_cb()
3632 handle_potential_collision(att); in ecred_connect_rsp_cb()
3638 struct bt_att *att; in bt_eatt_connect() local
3661 att = att_chan->att; in bt_eatt_connect()
3664 att_chan = att_chan_new(att, BIT(ATT_ENHANCED)); in bt_eatt_connect()
3719 struct bt_att *att; in bt_eatt_disconnect() local
3727 att = chan->att; in bt_eatt_disconnect()
3729 SYS_SLIST_FOR_EACH_CONTAINER(&att->chans, chan, node) { in bt_eatt_disconnect()
3741 struct bt_att *att; in bt_eatt_disconnect_one() local
3749 att = chan->att; in bt_eatt_disconnect_one()
3751 SYS_SLIST_FOR_EACH_CONTAINER(&att->chans, chan, node) { in bt_eatt_disconnect_one()
3763 struct bt_att *att = att_chan->att; in bt_eatt_reconfigure() local
3769 SYS_SLIST_FOR_EACH_CONTAINER(&att->chans, att_chan, node) { in bt_eatt_reconfigure()
3797 struct bt_att *att = att_chan->att; in bt_eatt_accept() local
3801 att_chan = att_chan_new(att, BIT(ATT_ENHANCED)); in bt_eatt_accept()
3853 struct bt_att *att; in bt_att_get_mtu() local
3856 att = att_get(conn); in bt_att_get_mtu()
3857 if (!att) { in bt_att_get_mtu()
3861 SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&att->chans, chan, tmp, node) { in bt_att_get_mtu()
3873 struct bt_att *att; in bt_att_get_uatt_mtu() local
3875 att = att_get(conn); in bt_att_get_uatt_mtu()
3876 if (!att) { in bt_att_get_uatt_mtu()
3880 SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&att->chans, chan, tmp, node) { in bt_att_get_uatt_mtu()
3893 struct bt_att *att = updated_chan->att; in att_chan_mtu_updated() local
3898 SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&att->chans, chan, tmp, node) { in att_chan_mtu_updated()
3911 bt_gatt_att_max_mtu_changed(att->conn, max_tx, max_rx); in att_chan_mtu_updated()
3954 struct bt_att *att; in bt_att_send() local
3959 att = att_get(conn); in bt_att_send()
3960 if (!att) { in bt_att_send()
3965 k_fifo_put(&att->tx_queue, buf); in bt_att_send()
3966 att_send_process(att); in bt_att_send()
3973 struct bt_att *att; in bt_att_req_send() local
3982 att = att_get(conn); in bt_att_req_send()
3983 if (!att) { in bt_att_req_send()
3988 sys_slist_append(&att->reqs, &req->node); in bt_att_req_send()
3989 att_req_send_process(att); in bt_att_req_send()
4012 struct bt_att *att; in bt_att_req_cancel() local
4021 att = att_get(conn); in bt_att_req_cancel()
4022 if (!att) { in bt_att_req_cancel()
4026 SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&att->chans, chan, tmp, node) { in bt_att_req_cancel()
4034 sys_slist_find_and_remove(&att->reqs, &req->node); in bt_att_req_cancel()
4041 struct bt_att *att; in bt_att_find_req_by_user_data() local
4045 att = att_get(conn); in bt_att_find_req_by_user_data()
4046 if (!att) { in bt_att_find_req_by_user_data()
4050 SYS_SLIST_FOR_EACH_CONTAINER(&att->chans, chan, node) { in bt_att_find_req_by_user_data()
4056 SYS_SLIST_FOR_EACH_CONTAINER(&att->reqs, req, node) { in bt_att_find_req_by_user_data()
4076 struct bt_att *att = att_get(conn); in bt_att_clear_out_of_sync_sent() local
4079 if (!att) { in bt_att_clear_out_of_sync_sent()
4083 SYS_SLIST_FOR_EACH_CONTAINER(&att->chans, chan, node) { in bt_att_clear_out_of_sync_sent()