@@ -957,8 +957,10 @@ static int btintel_pcie_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
957
957
/* This is a debug event that comes from IML and OP image when it
958
958
* starts execution. There is no need pass this event to stack.
959
959
*/
960
- if (skb -> data [2 ] == 0x97 )
960
+ if (skb -> data [2 ] == 0x97 ) {
961
+ hci_recv_diag (hdev , skb );
961
962
return 0 ;
963
+ }
962
964
}
963
965
964
966
return hci_recv_frame (hdev , skb );
@@ -974,7 +976,6 @@ static int btintel_pcie_recv_frame(struct btintel_pcie_data *data,
974
976
u8 pkt_type ;
975
977
u16 plen ;
976
978
u32 pcie_pkt_type ;
977
- struct sk_buff * new_skb ;
978
979
void * pdata ;
979
980
struct hci_dev * hdev = data -> hdev ;
980
981
@@ -1051,24 +1052,20 @@ static int btintel_pcie_recv_frame(struct btintel_pcie_data *data,
1051
1052
1052
1053
bt_dev_dbg (hdev , "pkt_type: 0x%2.2x len: %u" , pkt_type , plen );
1053
1054
1054
- new_skb = bt_skb_alloc (plen , GFP_ATOMIC );
1055
- if (!new_skb ) {
1056
- bt_dev_err (hdev , "Failed to allocate memory for skb of len: %u" ,
1057
- skb -> len );
1058
- ret = - ENOMEM ;
1059
- goto exit_error ;
1060
- }
1061
-
1062
- hci_skb_pkt_type (new_skb ) = pkt_type ;
1063
- skb_put_data (new_skb , skb -> data , plen );
1055
+ hci_skb_pkt_type (skb ) = pkt_type ;
1064
1056
hdev -> stat .byte_rx += plen ;
1057
+ skb_trim (skb , plen );
1065
1058
1066
1059
if (pcie_pkt_type == BTINTEL_PCIE_HCI_EVT_PKT )
1067
- ret = btintel_pcie_recv_event (hdev , new_skb );
1060
+ ret = btintel_pcie_recv_event (hdev , skb );
1068
1061
else
1069
- ret = hci_recv_frame (hdev , new_skb );
1062
+ ret = hci_recv_frame (hdev , skb );
1063
+ skb = NULL ; /* skb is freed in the callee */
1070
1064
1071
1065
exit_error :
1066
+ if (skb )
1067
+ kfree_skb (skb );
1068
+
1072
1069
if (ret )
1073
1070
hdev -> stat .err_rx ++ ;
1074
1071
@@ -1202,8 +1199,6 @@ static void btintel_pcie_rx_work(struct work_struct *work)
1202
1199
struct btintel_pcie_data * data = container_of (work ,
1203
1200
struct btintel_pcie_data , rx_work );
1204
1201
struct sk_buff * skb ;
1205
- int err ;
1206
- struct hci_dev * hdev = data -> hdev ;
1207
1202
1208
1203
if (test_bit (BTINTEL_PCIE_HWEXP_INPROGRESS , & data -> flags )) {
1209
1204
/* Unlike usb products, controller will not send hardware
@@ -1224,11 +1219,7 @@ static void btintel_pcie_rx_work(struct work_struct *work)
1224
1219
1225
1220
/* Process the sk_buf in queue and send to the HCI layer */
1226
1221
while ((skb = skb_dequeue (& data -> rx_skb_q ))) {
1227
- err = btintel_pcie_recv_frame (data , skb );
1228
- if (err )
1229
- bt_dev_err (hdev , "Failed to send received frame: %d" ,
1230
- err );
1231
- kfree_skb (skb );
1222
+ btintel_pcie_recv_frame (data , skb );
1232
1223
}
1233
1224
}
1234
1225
0 commit comments