Lines Matching refs:ll

97 	struct ll_struct *ll = hu->priv;  in send_hcill_cmd()  local
115 skb_queue_tail(&ll->txq, skb); in send_hcill_cmd()
123 struct ll_struct *ll; in ll_open() local
127 ll = kzalloc(sizeof(*ll), GFP_KERNEL); in ll_open()
128 if (!ll) in ll_open()
131 skb_queue_head_init(&ll->txq); in ll_open()
132 skb_queue_head_init(&ll->tx_wait_q); in ll_open()
133 spin_lock_init(&ll->hcill_lock); in ll_open()
135 ll->hcill_state = HCILL_AWAKE; in ll_open()
137 hu->priv = ll; in ll_open()
145 struct ll_struct *ll = hu->priv; in ll_flush() local
149 skb_queue_purge(&ll->tx_wait_q); in ll_flush()
150 skb_queue_purge(&ll->txq); in ll_flush()
158 struct ll_struct *ll = hu->priv; in ll_close() local
162 skb_queue_purge(&ll->tx_wait_q); in ll_close()
163 skb_queue_purge(&ll->txq); in ll_close()
165 kfree_skb(ll->rx_skb); in ll_close()
169 kfree(ll); in ll_close()
181 static void __ll_do_awake(struct ll_struct *ll) in __ll_do_awake() argument
185 while ((skb = skb_dequeue(&ll->tx_wait_q))) in __ll_do_awake()
186 skb_queue_tail(&ll->txq, skb); in __ll_do_awake()
188 ll->hcill_state = HCILL_AWAKE; in __ll_do_awake()
197 struct ll_struct *ll = hu->priv; in ll_device_want_to_wakeup() local
202 spin_lock_irqsave(&ll->hcill_lock, flags); in ll_device_want_to_wakeup()
204 switch (ll->hcill_state) { in ll_device_want_to_wakeup()
227 BT_ERR("received HCILL_WAKE_UP_IND in state %ld", ll->hcill_state); in ll_device_want_to_wakeup()
232 __ll_do_awake(ll); in ll_device_want_to_wakeup()
235 spin_unlock_irqrestore(&ll->hcill_lock, flags); in ll_device_want_to_wakeup()
247 struct ll_struct *ll = hu->priv; in ll_device_want_to_sleep() local
252 spin_lock_irqsave(&ll->hcill_lock, flags); in ll_device_want_to_sleep()
255 if (ll->hcill_state != HCILL_AWAKE) in ll_device_want_to_sleep()
256 BT_ERR("ERR: HCILL_GO_TO_SLEEP_IND in state %ld", ll->hcill_state); in ll_device_want_to_sleep()
265 ll->hcill_state = HCILL_ASLEEP; in ll_device_want_to_sleep()
268 spin_unlock_irqrestore(&ll->hcill_lock, flags); in ll_device_want_to_sleep()
280 struct ll_struct *ll = hu->priv; in ll_device_woke_up() local
285 spin_lock_irqsave(&ll->hcill_lock, flags); in ll_device_woke_up()
288 if (ll->hcill_state != HCILL_ASLEEP_TO_AWAKE) in ll_device_woke_up()
289 BT_ERR("received HCILL_WAKE_UP_ACK in state %ld", ll->hcill_state); in ll_device_woke_up()
292 __ll_do_awake(ll); in ll_device_woke_up()
294 spin_unlock_irqrestore(&ll->hcill_lock, flags); in ll_device_woke_up()
305 struct ll_struct *ll = hu->priv; in ll_enqueue() local
313 spin_lock_irqsave(&ll->hcill_lock, flags); in ll_enqueue()
316 switch (ll->hcill_state) { in ll_enqueue()
319 skb_queue_tail(&ll->txq, skb); in ll_enqueue()
324 skb_queue_tail(&ll->tx_wait_q, skb); in ll_enqueue()
330 ll->hcill_state = HCILL_ASLEEP_TO_AWAKE; in ll_enqueue()
335 skb_queue_tail(&ll->tx_wait_q, skb); in ll_enqueue()
338 BT_ERR("illegal hcill state: %ld (losing packet)", ll->hcill_state); in ll_enqueue()
343 spin_unlock_irqrestore(&ll->hcill_lock, flags); in ll_enqueue()
348 static inline int ll_check_data_len(struct hci_dev *hdev, struct ll_struct *ll, int len) in ll_check_data_len() argument
350 int room = skb_tailroom(ll->rx_skb); in ll_check_data_len()
355 hci_recv_frame(hdev, ll->rx_skb); in ll_check_data_len()
358 kfree_skb(ll->rx_skb); in ll_check_data_len()
360 ll->rx_state = HCILL_W4_DATA; in ll_check_data_len()
361 ll->rx_count = len; in ll_check_data_len()
365 ll->rx_state = HCILL_W4_PACKET_TYPE; in ll_check_data_len()
366 ll->rx_skb = NULL; in ll_check_data_len()
367 ll->rx_count = 0; in ll_check_data_len()
375 struct ll_struct *ll = hu->priv; in ll_recv() local
382 BT_DBG("hu %p count %d rx_state %ld rx_count %ld", hu, count, ll->rx_state, ll->rx_count); in ll_recv()
386 if (ll->rx_count) { in ll_recv()
387 len = min_t(unsigned int, ll->rx_count, count); in ll_recv()
388 memcpy(skb_put(ll->rx_skb, len), ptr, len); in ll_recv()
389 ll->rx_count -= len; count -= len; ptr += len; in ll_recv()
391 if (ll->rx_count) in ll_recv()
394 switch (ll->rx_state) { in ll_recv()
397 hci_recv_frame(hu->hdev, ll->rx_skb); in ll_recv()
399 ll->rx_state = HCILL_W4_PACKET_TYPE; in ll_recv()
400 ll->rx_skb = NULL; in ll_recv()
404 eh = hci_event_hdr(ll->rx_skb); in ll_recv()
408 ll_check_data_len(hu->hdev, ll, eh->plen); in ll_recv()
412 ah = hci_acl_hdr(ll->rx_skb); in ll_recv()
417 ll_check_data_len(hu->hdev, ll, dlen); in ll_recv()
421 sh = hci_sco_hdr(ll->rx_skb); in ll_recv()
425 ll_check_data_len(hu->hdev, ll, sh->dlen); in ll_recv()
434 ll->rx_state = HCILL_W4_EVENT_HDR; in ll_recv()
435 ll->rx_count = HCI_EVENT_HDR_SIZE; in ll_recv()
441 ll->rx_state = HCILL_W4_ACL_HDR; in ll_recv()
442 ll->rx_count = HCI_ACL_HDR_SIZE; in ll_recv()
448 ll->rx_state = HCILL_W4_SCO_HDR; in ll_recv()
449 ll->rx_count = HCI_SCO_HDR_SIZE; in ll_recv()
462 BT_ERR("received HCILL_GO_TO_SLEEP_ACK (in state %ld)", ll->hcill_state); in ll_recv()
488 ll->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC); in ll_recv()
489 if (!ll->rx_skb) { in ll_recv()
491 ll->rx_state = HCILL_W4_PACKET_TYPE; in ll_recv()
492 ll->rx_count = 0; in ll_recv()
496 bt_cb(ll->rx_skb)->pkt_type = type; in ll_recv()
504 struct ll_struct *ll = hu->priv; in ll_dequeue() local
505 return skb_dequeue(&ll->txq); in ll_dequeue()