Lines Matching refs:buf

74 	struct net_buf *buf;  in bt_buf_get_rx()  local
85 buf = net_buf_alloc(&hci_rx_pool, timeout); in bt_buf_get_rx()
86 if (!buf) { in bt_buf_get_rx()
87 return buf; in bt_buf_get_rx()
90 net_buf_reserve(buf, BT_BUF_RESERVE); in bt_buf_get_rx()
91 bt_buf_set_type(buf, type); in bt_buf_get_rx()
93 return buf; in bt_buf_get_rx()
100 struct net_buf *buf; in bt_buf_get_tx() local
137 buf = net_buf_alloc(pool, timeout); in bt_buf_get_tx()
138 if (!buf) { in bt_buf_get_tx()
139 return buf; in bt_buf_get_tx()
142 net_buf_reserve(buf, BT_BUF_RESERVE); in bt_buf_get_tx()
143 bt_buf_set_type(buf, type); in bt_buf_get_tx()
146 net_buf_add_mem(buf, data, size); in bt_buf_get_tx()
149 return buf; in bt_buf_get_tx()
162 int bt_recv(struct net_buf *buf) in bt_recv() argument
164 BT_DBG("buf %p len %u", buf, buf->len); in bt_recv()
166 bt_monitor_send(bt_monitor_opcode(buf), buf->data, buf->len); in bt_recv()
170 switch (bt_buf_get_type(buf)) { in bt_recv()
172 net_buf_push_u8(buf, H4_EVT); in bt_recv()
175 net_buf_push_u8(buf, H4_ACL); in bt_recv()
178 BT_ERR("Unknown type %u", bt_buf_get_type(buf)); in bt_recv()
184 net_buf_put(raw_rx, buf); in bt_recv()
189 int bt_recv_prio(struct net_buf *buf) in bt_recv_prio() argument
191 return bt_recv(buf); in bt_recv_prio()
196 struct net_buf *buf; in bt_cmd_complete_ext() local
203 buf = bt_hci_cmd_complete_create(op, sizeof(*cc)); in bt_cmd_complete_ext()
204 cc = net_buf_add(buf, sizeof(*cc)); in bt_cmd_complete_ext()
207 bt_recv(buf); in bt_cmd_complete_ext()
210 static u8_t bt_send_ext(struct net_buf *buf) in bt_send_ext() argument
224 net_buf_simple_save(&buf->b, &state); in bt_send_ext()
226 if (buf->len < sizeof(*hdr)) { in bt_send_ext()
231 hdr = net_buf_pull_mem(buf, sizeof(*hdr)); in bt_send_ext()
232 if (buf->len < hdr->param_len) { in bt_send_ext()
243 if (buf->len < cmd->min_len) { in bt_send_ext()
246 status = cmd->func(buf); in bt_send_ext()
258 net_buf_simple_restore(&buf->b, &state); in bt_send_ext()
263 int bt_send(struct net_buf *buf) in bt_send() argument
265 BT_DBG("buf %p len %u", buf, buf->len); in bt_send()
267 bt_monitor_send(bt_monitor_opcode(buf), buf->data, buf->len); in bt_send()
270 bt_buf_get_type(buf) == BT_BUF_CMD) { in bt_send()
273 status = bt_send_ext(buf); in bt_send()
280 return bt_hci_ecc_send(buf); in bt_send()
283 return bt_dev.drv->send(buf); in bt_send()