diff options
author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2011-10-17 05:19:56 -0400 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-10-17 15:58:08 -0400 |
commit | 88843ab06b6f279bff1c32e4218541ac7efe2600 (patch) | |
tree | c0c5deba9b605b05039bccfc1d36b6919b5706e1 /include/net/bluetooth/l2cap.h | |
parent | e5b82e58922749e79b84b85cfc6845cbfd1908ed (diff) |
Bluetooth: EWS: handling different Control fields
There are three different Control Field formats: the Standard Control
Field, the Enhanced Control Field, and the Extended Control Field.
Patch adds function to handle all those fields seamlessly.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'include/net/bluetooth/l2cap.h')
-rw-r--r-- | include/net/bluetooth/l2cap.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index e67ecd12df8c..41f0906649ee 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -27,6 +27,8 @@ | |||
27 | #ifndef __L2CAP_H | 27 | #ifndef __L2CAP_H |
28 | #define __L2CAP_H | 28 | #define __L2CAP_H |
29 | 29 | ||
30 | #include <asm/unaligned.h> | ||
31 | |||
30 | /* L2CAP defaults */ | 32 | /* L2CAP defaults */ |
31 | #define L2CAP_DEFAULT_MTU 672 | 33 | #define L2CAP_DEFAULT_MTU 672 |
32 | #define L2CAP_DEFAULT_MIN_MTU 48 | 34 | #define L2CAP_DEFAULT_MIN_MTU 48 |
@@ -684,6 +686,32 @@ static inline bool __is_ctrl_poll(struct l2cap_chan *chan, __u32 ctrl) | |||
684 | else | 686 | else |
685 | return ctrl & L2CAP_CTRL_POLL; | 687 | return ctrl & L2CAP_CTRL_POLL; |
686 | } | 688 | } |
689 | |||
690 | static inline __u32 __get_control(struct l2cap_chan *chan, void *p) | ||
691 | { | ||
692 | if (test_bit(FLAG_EXT_CTRL, &chan->flags)) | ||
693 | return get_unaligned_le32(p); | ||
694 | else | ||
695 | return get_unaligned_le16(p); | ||
696 | } | ||
697 | |||
698 | static inline void __put_control(struct l2cap_chan *chan, __u32 control, | ||
699 | void *p) | ||
700 | { | ||
701 | if (test_bit(FLAG_EXT_CTRL, &chan->flags)) | ||
702 | return put_unaligned_le32(control, p); | ||
703 | else | ||
704 | return put_unaligned_le16(control, p); | ||
705 | } | ||
706 | |||
707 | static inline __u8 __ctrl_size(struct l2cap_chan *chan) | ||
708 | { | ||
709 | if (test_bit(FLAG_EXT_CTRL, &chan->flags)) | ||
710 | return L2CAP_EXT_HDR_SIZE - L2CAP_HDR_SIZE; | ||
711 | else | ||
712 | return L2CAP_ENH_HDR_SIZE - L2CAP_HDR_SIZE; | ||
713 | } | ||
714 | |||
687 | extern int disable_ertm; | 715 | extern int disable_ertm; |
688 | 716 | ||
689 | int l2cap_init_sockets(void); | 717 | int l2cap_init_sockets(void); |