@@ -199,7 +199,6 @@ static void hci_usb_tx_complete(struct urb *urb);
199199#define __pending_q (husb , type ) (&husb->pending_q[type-1])
200200#define __completed_q (husb , type ) (&husb->completed_q[type-1])
201201#define __transmit_q (husb , type ) (&husb->transmit_q[type-1])
202- #define __reassembly (husb , type ) (husb->reassembly[type-1])
203202
204203static inline struct _urb * __get_completed (struct hci_usb * husb , int type )
205204{
@@ -429,12 +428,6 @@ static void hci_usb_unlink_urbs(struct hci_usb *husb)
429428 kfree (urb -> transfer_buffer );
430429 _urb_free (_urb );
431430 }
432-
433- /* Release reassembly buffers */
434- if (husb -> reassembly [i ]) {
435- kfree_skb (husb -> reassembly [i ]);
436- husb -> reassembly [i ] = NULL ;
437- }
438431 }
439432}
440433
@@ -671,83 +664,6 @@ static int hci_usb_send_frame(struct sk_buff *skb)
671664 return 0 ;
672665}
673666
674- static inline int __recv_frame (struct hci_usb * husb , int type , void * data , int count )
675- {
676- BT_DBG ("%s type %d data %p count %d" , husb -> hdev -> name , type , data , count );
677-
678- husb -> hdev -> stat .byte_rx += count ;
679-
680- while (count ) {
681- struct sk_buff * skb = __reassembly (husb , type );
682- struct { int expect ; } * scb ;
683- int len = 0 ;
684-
685- if (!skb ) {
686- /* Start of the frame */
687-
688- switch (type ) {
689- case HCI_EVENT_PKT :
690- if (count >= HCI_EVENT_HDR_SIZE ) {
691- struct hci_event_hdr * h = data ;
692- len = HCI_EVENT_HDR_SIZE + h -> plen ;
693- } else
694- return - EILSEQ ;
695- break ;
696-
697- case HCI_ACLDATA_PKT :
698- if (count >= HCI_ACL_HDR_SIZE ) {
699- struct hci_acl_hdr * h = data ;
700- len = HCI_ACL_HDR_SIZE + __le16_to_cpu (h -> dlen );
701- } else
702- return - EILSEQ ;
703- break ;
704- #ifdef CONFIG_BT_HCIUSB_SCO
705- case HCI_SCODATA_PKT :
706- if (count >= HCI_SCO_HDR_SIZE ) {
707- struct hci_sco_hdr * h = data ;
708- len = HCI_SCO_HDR_SIZE + h -> dlen ;
709- } else
710- return - EILSEQ ;
711- break ;
712- #endif
713- }
714- BT_DBG ("new packet len %d" , len );
715-
716- skb = bt_skb_alloc (len , GFP_ATOMIC );
717- if (!skb ) {
718- BT_ERR ("%s no memory for the packet" , husb -> hdev -> name );
719- return - ENOMEM ;
720- }
721- skb -> dev = (void * ) husb -> hdev ;
722- bt_cb (skb )-> pkt_type = type ;
723-
724- __reassembly (husb , type ) = skb ;
725-
726- scb = (void * ) skb -> cb ;
727- scb -> expect = len ;
728- } else {
729- /* Continuation */
730- scb = (void * ) skb -> cb ;
731- len = scb -> expect ;
732- }
733-
734- len = min (len , count );
735-
736- memcpy (skb_put (skb , len ), data , len );
737-
738- scb -> expect -= len ;
739- if (!scb -> expect ) {
740- /* Complete frame */
741- __reassembly (husb , type ) = NULL ;
742- bt_cb (skb )-> pkt_type = type ;
743- hci_recv_frame (skb );
744- }
745-
746- count -= len ; data += len ;
747- }
748- return 0 ;
749- }
750-
751667static void hci_usb_rx_complete (struct urb * urb )
752668{
753669 struct _urb * _urb = container_of (urb , struct _urb , urb );
@@ -776,15 +692,15 @@ static void hci_usb_rx_complete(struct urb *urb)
776692 urb -> iso_frame_desc [i ].actual_length );
777693
778694 if (!urb -> iso_frame_desc [i ].status )
779- __recv_frame (husb , _urb -> type ,
695+ hci_recv_fragment (husb -> hdev , _urb -> type ,
780696 urb -> transfer_buffer + urb -> iso_frame_desc [i ].offset ,
781697 urb -> iso_frame_desc [i ].actual_length );
782698 }
783699#else
784700 ;
785701#endif
786702 } else {
787- err = __recv_frame (husb , _urb -> type , urb -> transfer_buffer , count );
703+ err = hci_recv_fragment (husb -> hdev , _urb -> type , urb -> transfer_buffer , count );
788704 if (err < 0 ) {
789705 BT_ERR ("%s corrupted packet: type %d count %d" ,
790706 husb -> hdev -> name , _urb -> type , count );
0 commit comments