bcsp              136 drivers/bluetooth/hci_bcsp.c 	struct bcsp_struct *bcsp = hu->priv;
bcsp              147 drivers/bluetooth/hci_bcsp.c 		skb_queue_tail(&bcsp->rel, skb);
bcsp              151 drivers/bluetooth/hci_bcsp.c 		skb_queue_tail(&bcsp->unrel, skb);
bcsp              163 drivers/bluetooth/hci_bcsp.c static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data,
bcsp              226 drivers/bluetooth/hci_bcsp.c 	hdr[0] = bcsp->rxseq_txack << 3;
bcsp              227 drivers/bluetooth/hci_bcsp.c 	bcsp->txack_req = 0;
bcsp              228 drivers/bluetooth/hci_bcsp.c 	BT_DBG("We request packet no %u to card", bcsp->rxseq_txack);
bcsp              231 drivers/bluetooth/hci_bcsp.c 		hdr[0] |= 0x80 + bcsp->msgq_txseq;
bcsp              232 drivers/bluetooth/hci_bcsp.c 		BT_DBG("Sending packet with seqno %u", bcsp->msgq_txseq);
bcsp              233 drivers/bluetooth/hci_bcsp.c 		bcsp->msgq_txseq = (bcsp->msgq_txseq + 1) & 0x07;
bcsp              236 drivers/bluetooth/hci_bcsp.c 	if (bcsp->use_crc)
bcsp              247 drivers/bluetooth/hci_bcsp.c 		if (bcsp->use_crc)
bcsp              255 drivers/bluetooth/hci_bcsp.c 		if (bcsp->use_crc)
bcsp              260 drivers/bluetooth/hci_bcsp.c 	if (bcsp->use_crc) {
bcsp              273 drivers/bluetooth/hci_bcsp.c 	struct bcsp_struct *bcsp = hu->priv;
bcsp              281 drivers/bluetooth/hci_bcsp.c 	skb = skb_dequeue(&bcsp->unrel);
bcsp              285 drivers/bluetooth/hci_bcsp.c 		nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len,
bcsp              291 drivers/bluetooth/hci_bcsp.c 			skb_queue_head(&bcsp->unrel, skb);
bcsp              301 drivers/bluetooth/hci_bcsp.c 	spin_lock_irqsave_nested(&bcsp->unack.lock, flags, SINGLE_DEPTH_NESTING);
bcsp              303 drivers/bluetooth/hci_bcsp.c 	if (bcsp->unack.qlen < BCSP_TXWINSIZE) {
bcsp              304 drivers/bluetooth/hci_bcsp.c 		skb = skb_dequeue(&bcsp->rel);
bcsp              308 drivers/bluetooth/hci_bcsp.c 			nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len,
bcsp              311 drivers/bluetooth/hci_bcsp.c 				__skb_queue_tail(&bcsp->unack, skb);
bcsp              312 drivers/bluetooth/hci_bcsp.c 				mod_timer(&bcsp->tbcsp, jiffies + HZ / 4);
bcsp              313 drivers/bluetooth/hci_bcsp.c 				spin_unlock_irqrestore(&bcsp->unack.lock, flags);
bcsp              316 drivers/bluetooth/hci_bcsp.c 				skb_queue_head(&bcsp->rel, skb);
bcsp              322 drivers/bluetooth/hci_bcsp.c 	spin_unlock_irqrestore(&bcsp->unack.lock, flags);
bcsp              329 drivers/bluetooth/hci_bcsp.c 	if (bcsp->txack_req) {
bcsp              333 drivers/bluetooth/hci_bcsp.c 		struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, NULL, 0, BCSP_ACK_PKT);
bcsp              348 drivers/bluetooth/hci_bcsp.c static void bcsp_pkt_cull(struct bcsp_struct *bcsp)
bcsp              355 drivers/bluetooth/hci_bcsp.c 	spin_lock_irqsave(&bcsp->unack.lock, flags);
bcsp              357 drivers/bluetooth/hci_bcsp.c 	pkts_to_be_removed = skb_queue_len(&bcsp->unack);
bcsp              358 drivers/bluetooth/hci_bcsp.c 	seqno = bcsp->msgq_txseq;
bcsp              361 drivers/bluetooth/hci_bcsp.c 		if (bcsp->rxack == seqno)
bcsp              367 drivers/bluetooth/hci_bcsp.c 	if (bcsp->rxack != seqno)
bcsp              371 drivers/bluetooth/hci_bcsp.c 	       pkts_to_be_removed, skb_queue_len(&bcsp->unack),
bcsp              375 drivers/bluetooth/hci_bcsp.c 	skb_queue_walk_safe(&bcsp->unack, skb, tmp) {
bcsp              380 drivers/bluetooth/hci_bcsp.c 		__skb_unlink(skb, &bcsp->unack);
bcsp              384 drivers/bluetooth/hci_bcsp.c 	if (skb_queue_empty(&bcsp->unack))
bcsp              385 drivers/bluetooth/hci_bcsp.c 		del_timer(&bcsp->tbcsp);
bcsp              387 drivers/bluetooth/hci_bcsp.c 	spin_unlock_irqrestore(&bcsp->unack.lock, flags);
bcsp              399 drivers/bluetooth/hci_bcsp.c 	struct bcsp_struct *bcsp = hu->priv;
bcsp              405 drivers/bluetooth/hci_bcsp.c 	if (bcsp->rx_skb->data[1] >> 4 == 4 && bcsp->rx_skb->data[2] == 0 &&
bcsp              406 drivers/bluetooth/hci_bcsp.c 	    !memcmp(&bcsp->rx_skb->data[4], conf_pkt, 4)) {
bcsp              415 drivers/bluetooth/hci_bcsp.c 		skb_queue_head(&bcsp->unrel, nskb);
bcsp              419 drivers/bluetooth/hci_bcsp.c 	else if (bcsp->rx_skb->data[1] >> 4 == 4 && bcsp->rx_skb->data[2] == 0 &&
bcsp              420 drivers/bluetooth/hci_bcsp.c 		 !memcmp(&bcsp->rx_skb->data[4], sync_pkt, 4)) {
bcsp              425 drivers/bluetooth/hci_bcsp.c static inline void bcsp_unslip_one_byte(struct bcsp_struct *bcsp, unsigned char byte)
bcsp              429 drivers/bluetooth/hci_bcsp.c 	switch (bcsp->rx_esc_state) {
bcsp              433 drivers/bluetooth/hci_bcsp.c 			bcsp->rx_esc_state = BCSP_ESCSTATE_ESC;
bcsp              436 drivers/bluetooth/hci_bcsp.c 			skb_put_data(bcsp->rx_skb, &byte, 1);
bcsp              437 drivers/bluetooth/hci_bcsp.c 			if ((bcsp->rx_skb->data[0] & 0x40) != 0 &&
bcsp              438 drivers/bluetooth/hci_bcsp.c 			    bcsp->rx_state != BCSP_W4_CRC)
bcsp              439 drivers/bluetooth/hci_bcsp.c 				bcsp_crc_update(&bcsp->message_crc, byte);
bcsp              440 drivers/bluetooth/hci_bcsp.c 			bcsp->rx_count--;
bcsp              447 drivers/bluetooth/hci_bcsp.c 			skb_put_data(bcsp->rx_skb, &c0, 1);
bcsp              448 drivers/bluetooth/hci_bcsp.c 			if ((bcsp->rx_skb->data[0] & 0x40) != 0 &&
bcsp              449 drivers/bluetooth/hci_bcsp.c 			    bcsp->rx_state != BCSP_W4_CRC)
bcsp              450 drivers/bluetooth/hci_bcsp.c 				bcsp_crc_update(&bcsp->message_crc, 0xc0);
bcsp              451 drivers/bluetooth/hci_bcsp.c 			bcsp->rx_esc_state = BCSP_ESCSTATE_NOESC;
bcsp              452 drivers/bluetooth/hci_bcsp.c 			bcsp->rx_count--;
bcsp              456 drivers/bluetooth/hci_bcsp.c 			skb_put_data(bcsp->rx_skb, &db, 1);
bcsp              457 drivers/bluetooth/hci_bcsp.c 			if ((bcsp->rx_skb->data[0] & 0x40) != 0 &&
bcsp              458 drivers/bluetooth/hci_bcsp.c 			    bcsp->rx_state != BCSP_W4_CRC)
bcsp              459 drivers/bluetooth/hci_bcsp.c 				bcsp_crc_update(&bcsp->message_crc, 0xdb);
bcsp              460 drivers/bluetooth/hci_bcsp.c 			bcsp->rx_esc_state = BCSP_ESCSTATE_NOESC;
bcsp              461 drivers/bluetooth/hci_bcsp.c 			bcsp->rx_count--;
bcsp              466 drivers/bluetooth/hci_bcsp.c 			kfree_skb(bcsp->rx_skb);
bcsp              467 drivers/bluetooth/hci_bcsp.c 			bcsp->rx_skb = NULL;
bcsp              468 drivers/bluetooth/hci_bcsp.c 			bcsp->rx_state = BCSP_W4_PKT_DELIMITER;
bcsp              469 drivers/bluetooth/hci_bcsp.c 			bcsp->rx_count = 0;
bcsp              476 drivers/bluetooth/hci_bcsp.c 	struct bcsp_struct *bcsp = hu->priv;
bcsp              479 drivers/bluetooth/hci_bcsp.c 	if (bcsp->rx_skb->data[0] & 0x80) {	/* reliable pkt */
bcsp              480 drivers/bluetooth/hci_bcsp.c 		BT_DBG("Received seqno %u from card", bcsp->rxseq_txack);
bcsp              483 drivers/bluetooth/hci_bcsp.c 		if ((bcsp->rx_skb->data[0] & 0x07) == bcsp->rxseq_txack) {
bcsp              484 drivers/bluetooth/hci_bcsp.c 			bcsp->rxseq_txack++;
bcsp              485 drivers/bluetooth/hci_bcsp.c 			bcsp->rxseq_txack %= 0x8;
bcsp              491 drivers/bluetooth/hci_bcsp.c 			       bcsp->rx_skb->data[0] & 0x07, bcsp->rxseq_txack);
bcsp              498 drivers/bluetooth/hci_bcsp.c 		bcsp->txack_req = 1;
bcsp              504 drivers/bluetooth/hci_bcsp.c 	bcsp->rxack = (bcsp->rx_skb->data[0] >> 3) & 0x07;
bcsp              505 drivers/bluetooth/hci_bcsp.c 	BT_DBG("Request for pkt %u from card", bcsp->rxack);
bcsp              510 drivers/bluetooth/hci_bcsp.c 	bcsp_pkt_cull(bcsp);
bcsp              513 drivers/bluetooth/hci_bcsp.c 		if ((bcsp->rx_skb->data[1] & 0x0f) == 6 &&
bcsp              514 drivers/bluetooth/hci_bcsp.c 		    (bcsp->rx_skb->data[0] & 0x80)) {
bcsp              515 drivers/bluetooth/hci_bcsp.c 			hci_skb_pkt_type(bcsp->rx_skb) = HCI_ACLDATA_PKT;
bcsp              517 drivers/bluetooth/hci_bcsp.c 		} else if ((bcsp->rx_skb->data[1] & 0x0f) == 5 &&
bcsp              518 drivers/bluetooth/hci_bcsp.c 			   (bcsp->rx_skb->data[0] & 0x80)) {
bcsp              519 drivers/bluetooth/hci_bcsp.c 			hci_skb_pkt_type(bcsp->rx_skb) = HCI_EVENT_PKT;
bcsp              521 drivers/bluetooth/hci_bcsp.c 		} else if ((bcsp->rx_skb->data[1] & 0x0f) == 7) {
bcsp              522 drivers/bluetooth/hci_bcsp.c 			hci_skb_pkt_type(bcsp->rx_skb) = HCI_SCODATA_PKT;
bcsp              524 drivers/bluetooth/hci_bcsp.c 		} else if ((bcsp->rx_skb->data[1] & 0x0f) == 1 &&
bcsp              525 drivers/bluetooth/hci_bcsp.c 			   !(bcsp->rx_skb->data[0] & 0x80)) {
bcsp              535 drivers/bluetooth/hci_bcsp.c 		u8 desc = (bcsp->rx_skb->data[1] & 0x0f);
bcsp              540 drivers/bluetooth/hci_bcsp.c 				skb_pull(bcsp->rx_skb, 4);
bcsp              541 drivers/bluetooth/hci_bcsp.c 				memcpy(skb_push(bcsp->rx_skb, 1), &desc, 1);
bcsp              544 drivers/bluetooth/hci_bcsp.c 				hdr.plen = bcsp->rx_skb->len;
bcsp              545 drivers/bluetooth/hci_bcsp.c 				memcpy(skb_push(bcsp->rx_skb, HCI_EVENT_HDR_SIZE), &hdr, HCI_EVENT_HDR_SIZE);
bcsp              546 drivers/bluetooth/hci_bcsp.c 				hci_skb_pkt_type(bcsp->rx_skb) = HCI_EVENT_PKT;
bcsp              548 drivers/bluetooth/hci_bcsp.c 				hci_recv_frame(hu->hdev, bcsp->rx_skb);
bcsp              551 drivers/bluetooth/hci_bcsp.c 				       bcsp->rx_skb->data[1] & 0x0f,
bcsp              552 drivers/bluetooth/hci_bcsp.c 				       bcsp->rx_skb->data[0] & 0x80 ?
bcsp              554 drivers/bluetooth/hci_bcsp.c 				kfree_skb(bcsp->rx_skb);
bcsp              557 drivers/bluetooth/hci_bcsp.c 			kfree_skb(bcsp->rx_skb);
bcsp              560 drivers/bluetooth/hci_bcsp.c 		skb_pull(bcsp->rx_skb, 4);
bcsp              562 drivers/bluetooth/hci_bcsp.c 		hci_recv_frame(hu->hdev, bcsp->rx_skb);
bcsp              567 drivers/bluetooth/hci_bcsp.c 		kfree_skb(bcsp->rx_skb);
bcsp              570 drivers/bluetooth/hci_bcsp.c 	bcsp->rx_state = BCSP_W4_PKT_DELIMITER;
bcsp              571 drivers/bluetooth/hci_bcsp.c 	bcsp->rx_skb = NULL;
bcsp              574 drivers/bluetooth/hci_bcsp.c static u16 bscp_get_crc(struct bcsp_struct *bcsp)
bcsp              576 drivers/bluetooth/hci_bcsp.c 	return get_unaligned_be16(&bcsp->rx_skb->data[bcsp->rx_skb->len - 2]);
bcsp              582 drivers/bluetooth/hci_bcsp.c 	struct bcsp_struct *bcsp = hu->priv;
bcsp              586 drivers/bluetooth/hci_bcsp.c 	       hu, count, bcsp->rx_state, bcsp->rx_count);
bcsp              590 drivers/bluetooth/hci_bcsp.c 		if (bcsp->rx_count) {
bcsp              593 drivers/bluetooth/hci_bcsp.c 				kfree_skb(bcsp->rx_skb);
bcsp              594 drivers/bluetooth/hci_bcsp.c 				bcsp->rx_skb = NULL;
bcsp              595 drivers/bluetooth/hci_bcsp.c 				bcsp->rx_state = BCSP_W4_PKT_START;
bcsp              596 drivers/bluetooth/hci_bcsp.c 				bcsp->rx_count = 0;
bcsp              598 drivers/bluetooth/hci_bcsp.c 				bcsp_unslip_one_byte(bcsp, *ptr);
bcsp              604 drivers/bluetooth/hci_bcsp.c 		switch (bcsp->rx_state) {
bcsp              606 drivers/bluetooth/hci_bcsp.c 			if ((0xff & (u8)~(bcsp->rx_skb->data[0] + bcsp->rx_skb->data[1] +
bcsp              607 drivers/bluetooth/hci_bcsp.c 			    bcsp->rx_skb->data[2])) != bcsp->rx_skb->data[3]) {
bcsp              609 drivers/bluetooth/hci_bcsp.c 				kfree_skb(bcsp->rx_skb);
bcsp              610 drivers/bluetooth/hci_bcsp.c 				bcsp->rx_skb = NULL;
bcsp              611 drivers/bluetooth/hci_bcsp.c 				bcsp->rx_state = BCSP_W4_PKT_DELIMITER;
bcsp              612 drivers/bluetooth/hci_bcsp.c 				bcsp->rx_count = 0;
bcsp              615 drivers/bluetooth/hci_bcsp.c 			bcsp->rx_state = BCSP_W4_DATA;
bcsp              616 drivers/bluetooth/hci_bcsp.c 			bcsp->rx_count = (bcsp->rx_skb->data[1] >> 4) +
bcsp              617 drivers/bluetooth/hci_bcsp.c 					(bcsp->rx_skb->data[2] << 4);	/* May be 0 */
bcsp              621 drivers/bluetooth/hci_bcsp.c 			if (bcsp->rx_skb->data[0] & 0x40) {	/* pkt with crc */
bcsp              622 drivers/bluetooth/hci_bcsp.c 				bcsp->rx_state = BCSP_W4_CRC;
bcsp              623 drivers/bluetooth/hci_bcsp.c 				bcsp->rx_count = 2;
bcsp              629 drivers/bluetooth/hci_bcsp.c 			if (bitrev16(bcsp->message_crc) != bscp_get_crc(bcsp)) {
bcsp              631 drivers/bluetooth/hci_bcsp.c 				       bitrev16(bcsp->message_crc),
bcsp              632 drivers/bluetooth/hci_bcsp.c 				       bscp_get_crc(bcsp));
bcsp              634 drivers/bluetooth/hci_bcsp.c 				kfree_skb(bcsp->rx_skb);
bcsp              635 drivers/bluetooth/hci_bcsp.c 				bcsp->rx_skb = NULL;
bcsp              636 drivers/bluetooth/hci_bcsp.c 				bcsp->rx_state = BCSP_W4_PKT_DELIMITER;
bcsp              637 drivers/bluetooth/hci_bcsp.c 				bcsp->rx_count = 0;
bcsp              640 drivers/bluetooth/hci_bcsp.c 			skb_trim(bcsp->rx_skb, bcsp->rx_skb->len - 2);
bcsp              647 drivers/bluetooth/hci_bcsp.c 				bcsp->rx_state = BCSP_W4_PKT_START;
bcsp              663 drivers/bluetooth/hci_bcsp.c 				bcsp->rx_state = BCSP_W4_BCSP_HDR;
bcsp              664 drivers/bluetooth/hci_bcsp.c 				bcsp->rx_count = 4;
bcsp              665 drivers/bluetooth/hci_bcsp.c 				bcsp->rx_esc_state = BCSP_ESCSTATE_NOESC;
bcsp              666 drivers/bluetooth/hci_bcsp.c 				BCSP_CRC_INIT(bcsp->message_crc);
bcsp              673 drivers/bluetooth/hci_bcsp.c 				bcsp->rx_skb = bt_skb_alloc(0x1005, GFP_ATOMIC);
bcsp              674 drivers/bluetooth/hci_bcsp.c 				if (!bcsp->rx_skb) {
bcsp              676 drivers/bluetooth/hci_bcsp.c 					bcsp->rx_state = BCSP_W4_PKT_DELIMITER;
bcsp              677 drivers/bluetooth/hci_bcsp.c 					bcsp->rx_count = 0;
bcsp              691 drivers/bluetooth/hci_bcsp.c 	struct bcsp_struct *bcsp = from_timer(bcsp, t, tbcsp);
bcsp              692 drivers/bluetooth/hci_bcsp.c 	struct hci_uart *hu = bcsp->hu;
bcsp              696 drivers/bluetooth/hci_bcsp.c 	BT_DBG("hu %p retransmitting %u pkts", hu, bcsp->unack.qlen);
bcsp              698 drivers/bluetooth/hci_bcsp.c 	spin_lock_irqsave_nested(&bcsp->unack.lock, flags, SINGLE_DEPTH_NESTING);
bcsp              700 drivers/bluetooth/hci_bcsp.c 	while ((skb = __skb_dequeue_tail(&bcsp->unack)) != NULL) {
bcsp              701 drivers/bluetooth/hci_bcsp.c 		bcsp->msgq_txseq = (bcsp->msgq_txseq - 1) & 0x07;
bcsp              702 drivers/bluetooth/hci_bcsp.c 		skb_queue_head(&bcsp->rel, skb);
bcsp              705 drivers/bluetooth/hci_bcsp.c 	spin_unlock_irqrestore(&bcsp->unack.lock, flags);
bcsp              712 drivers/bluetooth/hci_bcsp.c 	struct bcsp_struct *bcsp;
bcsp              716 drivers/bluetooth/hci_bcsp.c 	bcsp = kzalloc(sizeof(*bcsp), GFP_KERNEL);
bcsp              717 drivers/bluetooth/hci_bcsp.c 	if (!bcsp)
bcsp              720 drivers/bluetooth/hci_bcsp.c 	hu->priv = bcsp;
bcsp              721 drivers/bluetooth/hci_bcsp.c 	bcsp->hu = hu;
bcsp              722 drivers/bluetooth/hci_bcsp.c 	skb_queue_head_init(&bcsp->unack);
bcsp              723 drivers/bluetooth/hci_bcsp.c 	skb_queue_head_init(&bcsp->rel);
bcsp              724 drivers/bluetooth/hci_bcsp.c 	skb_queue_head_init(&bcsp->unrel);
bcsp              726 drivers/bluetooth/hci_bcsp.c 	timer_setup(&bcsp->tbcsp, bcsp_timed_event, 0);
bcsp              728 drivers/bluetooth/hci_bcsp.c 	bcsp->rx_state = BCSP_W4_PKT_DELIMITER;
bcsp              731 drivers/bluetooth/hci_bcsp.c 		bcsp->use_crc = 1;
bcsp              738 drivers/bluetooth/hci_bcsp.c 	struct bcsp_struct *bcsp = hu->priv;
bcsp              740 drivers/bluetooth/hci_bcsp.c 	del_timer_sync(&bcsp->tbcsp);
bcsp              746 drivers/bluetooth/hci_bcsp.c 	skb_queue_purge(&bcsp->unack);
bcsp              747 drivers/bluetooth/hci_bcsp.c 	skb_queue_purge(&bcsp->rel);
bcsp              748 drivers/bluetooth/hci_bcsp.c 	skb_queue_purge(&bcsp->unrel);
bcsp              750 drivers/bluetooth/hci_bcsp.c 	if (bcsp->rx_skb) {
bcsp              751 drivers/bluetooth/hci_bcsp.c 		kfree_skb(bcsp->rx_skb);
bcsp              752 drivers/bluetooth/hci_bcsp.c 		bcsp->rx_skb = NULL;
bcsp              755 drivers/bluetooth/hci_bcsp.c 	kfree(bcsp);
bcsp              759 drivers/bluetooth/hci_bcsp.c static const struct hci_uart_proto bcsp = {
bcsp              772 drivers/bluetooth/hci_bcsp.c 	return hci_uart_register_proto(&bcsp);
bcsp              777 drivers/bluetooth/hci_bcsp.c 	return hci_uart_unregister_proto(&bcsp);