diff options
author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2011-10-11 06:37:44 -0400 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-10-13 15:44:47 -0400 |
commit | ab784b7383735681660ccbdda4569fff196c2672 (patch) | |
tree | 4a66e85b5e65695d0cdfd190a3aadefa035edcba /include/net/bluetooth | |
parent | 57253fd8c91e76780e9628451f680efcbcc52c85 (diff) |
Bluetooth: EWS: rewrite handling Supervisory (S) bits
Supervisory bits occupy different windows in standard / extended control
fields. Convert hardcoded masks to relative ones and use shift to access
S-bit window.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'include/net/bluetooth')
-rw-r--r-- | include/net/bluetooth/l2cap.h | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index fa7edabde4d9..f24f5cf820d7 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -140,10 +140,10 @@ struct l2cap_conninfo { | |||
140 | #define L2CAP_EXT_CTRL_TXSEQ_SHIFT 18 | 140 | #define L2CAP_EXT_CTRL_TXSEQ_SHIFT 18 |
141 | 141 | ||
142 | /* L2CAP Supervisory Function */ | 142 | /* L2CAP Supervisory Function */ |
143 | #define L2CAP_SUPER_RCV_READY 0x0000 | 143 | #define L2CAP_SUPER_RR 0x00 |
144 | #define L2CAP_SUPER_REJECT 0x0004 | 144 | #define L2CAP_SUPER_REJ 0x01 |
145 | #define L2CAP_SUPER_RCV_NOT_READY 0x0008 | 145 | #define L2CAP_SUPER_RNR 0x02 |
146 | #define L2CAP_SUPER_SELECT_REJECT 0x000C | 146 | #define L2CAP_SUPER_SREJ 0x03 |
147 | 147 | ||
148 | /* L2CAP Segmentation and Reassembly */ | 148 | /* L2CAP Segmentation and Reassembly */ |
149 | #define L2CAP_SDU_UNSEGMENTED 0x0000 | 149 | #define L2CAP_SDU_UNSEGMENTED 0x0000 |
@@ -518,6 +518,25 @@ static inline int l2cap_tx_window_full(struct l2cap_chan *ch) | |||
518 | #define __is_sframe(ctrl) ((ctrl) & L2CAP_CTRL_FRAME_TYPE) | 518 | #define __is_sframe(ctrl) ((ctrl) & L2CAP_CTRL_FRAME_TYPE) |
519 | #define __is_sar_start(ctrl) (((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START) | 519 | #define __is_sar_start(ctrl) (((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START) |
520 | 520 | ||
521 | static inline __u8 __get_ctrl_super(struct l2cap_chan *chan, __u32 ctrl) | ||
522 | { | ||
523 | if (test_bit(FLAG_EXT_CTRL, &chan->flags)) | ||
524 | return (ctrl & L2CAP_EXT_CTRL_SUPERVISE) >> | ||
525 | L2CAP_EXT_CTRL_SUPER_SHIFT; | ||
526 | else | ||
527 | return (ctrl & L2CAP_CTRL_SUPERVISE) >> L2CAP_CTRL_SUPER_SHIFT; | ||
528 | } | ||
529 | |||
530 | static inline __u32 __set_ctrl_super(struct l2cap_chan *chan, __u32 super) | ||
531 | { | ||
532 | if (test_bit(FLAG_EXT_CTRL, &chan->flags)) | ||
533 | return (super << L2CAP_EXT_CTRL_SUPER_SHIFT) & | ||
534 | L2CAP_EXT_CTRL_SUPERVISE; | ||
535 | else | ||
536 | return (super << L2CAP_CTRL_SUPER_SHIFT) & | ||
537 | L2CAP_CTRL_SUPERVISE; | ||
538 | } | ||
539 | |||
521 | extern int disable_ertm; | 540 | extern int disable_ertm; |
522 | 541 | ||
523 | int l2cap_init_sockets(void); | 542 | int l2cap_init_sockets(void); |