Bluetooth: Split sending for HCI raw and control sockets
Subsystems (2)
Marcel Holtmann
maintainerPATCH 2/8 Bluetooth: Split sending for HCI raw and control sockets
The sending functions for HCI raw and control sockets have nothing in common except that they iterate over the socket list. Split them into two so they can do their job more efficient. In addition the code becomes more readable.
Signed-off-by Marcel Holtmann <[email protected]>
--- include/net/bluetooth/hci_core.h | 4 +- net/bluetooth/hci_core.c | 4 +- net/bluetooth/hci_event.c | 2 +- net/bluetooth/hci_sock.c | 51 +++++++++++++++++++++++++++++--------- net/bluetooth/mgmt.c | 2 +- 5 files changed, 45 insertions(+), 18 deletions(-)
include/net/bluetooth/hci_core.h +2 -2
@@ -953,8 +953,8 @@ void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode);void hci_si_event (struct hci_dev *hdev,int type,int dlen,void *data);/* ----- HCI Sockets ----- */ -void hci_send_to_sock (struct hci_dev *hdev,struct sk_buff *skb, -struct sock *skip_sk); +void hci_send_to_sock (struct hci_dev *hdev,struct sk_buff *skb); +void hci_send_to_control (struct sk_buff *skb,struct sock *skip_sk);/* Management interface */ #define MGMT_ADDR_BREDR 0x00
net/bluetooth/hci_core.c +2 -2
@@ -2131,7 +2131,7 @@ static int hci_send_frame(struct sk_buff *skb)/* Time stamp */ __net_timestamp (skb); -hci_send_to_sock (hdev, skb,NULL ); +hci_send_to_sock (hdev, skb); }/* Get rid of skb owner, prior to sending to the driver. */
@@ -2818,7 +2818,7 @@ static void hci_rx_work(struct work_struct *work)while ((skb =skb_dequeue (&hdev->rx_q))) {if (atomic_read (&hdev->promisc)) {/* Send copy to the sockets */ -hci_send_to_sock (hdev, skb,NULL ); +hci_send_to_sock (hdev, skb); }if (test_bit (HCI_RAW , &hdev->flags)) {
net/bluetooth/hci_event.c +1 -1
@@ -3571,7 +3571,7 @@ void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data)bt_cb (skb)->pkt_type =HCI_EVENT_PKT ; skb->dev = (void *) hdev; -hci_send_to_sock (hdev, skb,NULL ); +hci_send_to_sock (hdev, skb);kfree_skb (skb); }
net/bluetooth/hci_sock.c +39 -12
90 lines not on this page · raw message
net/bluetooth/mgmt.c +1 -1
@@ -924,7 +924,7 @@ static int mgmt_event(u16 event, struct hci_dev *hdev, void *data,if (data)memcpy (skb_put (skb, data_len), data, data_len); -hci_send_to_sock (NULL , skb, skip_sk); +hci_send_to_control (skb, skip_sk);kfree_skb (skb);return 0 ;
Signature · 1 line
1.7.7.6