aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_sock.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-08-09 23:30:28 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2005-08-29 18:55:13 -0400
commit0d48d93947dd9ea21c5cdc76a8581b06a4a39281 (patch)
tree96a1cbfe83a02e27fed3d30f1ac9f2fe05c17506 /net/bluetooth/hci_sock.c
parent2eb25a6c34504254760e67172f7518d6bfdd7676 (diff)
[Bluetooth]: Move packet type into the SKB control buffer
This patch moves the usage of packet type into the SKB control buffer. After this patch it is now possible to shrink the sk_buff structure and redefine its pkt_type. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bluetooth/hci_sock.c')
-rw-r--r--net/bluetooth/hci_sock.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index ebdcce5e7ca..eed9090d77f 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -110,11 +110,11 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb)
110 /* Apply filter */ 110 /* Apply filter */
111 flt = &hci_pi(sk)->filter; 111 flt = &hci_pi(sk)->filter;
112 112
113 if (!test_bit((skb->pkt_type == HCI_VENDOR_PKT) ? 113 if (!test_bit((bt_cb(skb)->pkt_type == HCI_VENDOR_PKT) ?
114 0 : (skb->pkt_type & HCI_FLT_TYPE_BITS), &flt->type_mask)) 114 0 : (bt_cb(skb)->pkt_type & HCI_FLT_TYPE_BITS), &flt->type_mask))
115 continue; 115 continue;
116 116
117 if (skb->pkt_type == HCI_EVENT_PKT) { 117 if (bt_cb(skb)->pkt_type == HCI_EVENT_PKT) {
118 register int evt = (*(__u8 *)skb->data & HCI_FLT_EVENT_BITS); 118 register int evt = (*(__u8 *)skb->data & HCI_FLT_EVENT_BITS);
119 119
120 if (!hci_test_bit(evt, &flt->event_mask)) 120 if (!hci_test_bit(evt, &flt->event_mask))
@@ -131,7 +131,7 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb)
131 continue; 131 continue;
132 132
133 /* Put type byte before the data */ 133 /* Put type byte before the data */
134 memcpy(skb_push(nskb, 1), &nskb->pkt_type, 1); 134 memcpy(skb_push(nskb, 1), &bt_cb(nskb)->pkt_type, 1);
135 135
136 if (sock_queue_rcv_skb(sk, nskb)) 136 if (sock_queue_rcv_skb(sk, nskb))
137 kfree_skb(nskb); 137 kfree_skb(nskb);
@@ -327,8 +327,10 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_
327{ 327{
328 __u32 mask = hci_pi(sk)->cmsg_mask; 328 __u32 mask = hci_pi(sk)->cmsg_mask;
329 329
330 if (mask & HCI_CMSG_DIR) 330 if (mask & HCI_CMSG_DIR) {
331 put_cmsg(msg, SOL_HCI, HCI_CMSG_DIR, sizeof(int), &bt_cb(skb)->incoming); 331 int incoming = bt_cb(skb)->incoming;
332 put_cmsg(msg, SOL_HCI, HCI_CMSG_DIR, sizeof(incoming), &incoming);
333 }
332 334
333 if (mask & HCI_CMSG_TSTAMP) 335 if (mask & HCI_CMSG_TSTAMP)
334 put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, sizeof(skb->stamp), &skb->stamp); 336 put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, sizeof(skb->stamp), &skb->stamp);
@@ -405,11 +407,11 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
405 goto drop; 407 goto drop;
406 } 408 }
407 409
408 skb->pkt_type = *((unsigned char *) skb->data); 410 bt_cb(skb)->pkt_type = *((unsigned char *) skb->data);
409 skb_pull(skb, 1); 411 skb_pull(skb, 1);
410 skb->dev = (void *) hdev; 412 skb->dev = (void *) hdev;
411 413
412 if (skb->pkt_type == HCI_COMMAND_PKT) { 414 if (bt_cb(skb)->pkt_type == HCI_COMMAND_PKT) {
413 u16 opcode = __le16_to_cpu(get_unaligned((u16 *)skb->data)); 415 u16 opcode = __le16_to_cpu(get_unaligned((u16 *)skb->data));
414 u16 ogf = hci_opcode_ogf(opcode); 416 u16 ogf = hci_opcode_ogf(opcode);
415 u16 ocf = hci_opcode_ocf(opcode); 417 u16 ocf = hci_opcode_ocf(opcode);