aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorMat Martineau <mathewm@codeaurora.org>2012-03-23 19:56:55 -0400
committerGustavo Padovan <gustavo@padovan.org>2012-05-08 23:41:35 -0400
commitd5f7ac38102c12069de247890cfdd357bf845a77 (patch)
treeace2361d4551f92d52a29cdfecee95c68d2da085 /include/net
parent6f74b6f36fc06fafb0c5868563385a59dc22b1b2 (diff)
Bluetooth: Add definitions and struct members for new ERTM state machine
Adds some missing values for control field parsing, additional data for the new state machine, and enumerations for states, incoming packet classification, and state machine events. Signed-off-by: Mat Martineau <mathewm@codeaurora.org> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/bluetooth/l2cap.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 35334a0de070..c988df6f63bf 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -139,6 +139,8 @@ struct l2cap_conninfo {
139 139
140#define L2CAP_CTRL_TXSEQ_SHIFT 1 140#define L2CAP_CTRL_TXSEQ_SHIFT 1
141#define L2CAP_CTRL_SUPER_SHIFT 2 141#define L2CAP_CTRL_SUPER_SHIFT 2
142#define L2CAP_CTRL_POLL_SHIFT 4
143#define L2CAP_CTRL_FINAL_SHIFT 7
142#define L2CAP_CTRL_REQSEQ_SHIFT 8 144#define L2CAP_CTRL_REQSEQ_SHIFT 8
143#define L2CAP_CTRL_SAR_SHIFT 14 145#define L2CAP_CTRL_SAR_SHIFT 14
144 146
@@ -152,9 +154,11 @@ struct l2cap_conninfo {
152#define L2CAP_EXT_CTRL_FINAL 0x00000002 154#define L2CAP_EXT_CTRL_FINAL 0x00000002
153#define L2CAP_EXT_CTRL_FRAME_TYPE 0x00000001 /* I- or S-Frame */ 155#define L2CAP_EXT_CTRL_FRAME_TYPE 0x00000001 /* I- or S-Frame */
154 156
157#define L2CAP_EXT_CTRL_FINAL_SHIFT 1
155#define L2CAP_EXT_CTRL_REQSEQ_SHIFT 2 158#define L2CAP_EXT_CTRL_REQSEQ_SHIFT 2
156#define L2CAP_EXT_CTRL_SAR_SHIFT 16 159#define L2CAP_EXT_CTRL_SAR_SHIFT 16
157#define L2CAP_EXT_CTRL_SUPER_SHIFT 16 160#define L2CAP_EXT_CTRL_SUPER_SHIFT 16
161#define L2CAP_EXT_CTRL_POLL_SHIFT 18
158#define L2CAP_EXT_CTRL_TXSEQ_SHIFT 18 162#define L2CAP_EXT_CTRL_TXSEQ_SHIFT 18
159 163
160/* L2CAP Supervisory Function */ 164/* L2CAP Supervisory Function */
@@ -186,6 +190,8 @@ struct l2cap_hdr {
186#define L2CAP_FCS_SIZE 2 190#define L2CAP_FCS_SIZE 2
187#define L2CAP_SDULEN_SIZE 2 191#define L2CAP_SDULEN_SIZE 2
188#define L2CAP_PSMLEN_SIZE 2 192#define L2CAP_PSMLEN_SIZE 2
193#define L2CAP_ENH_CTRL_SIZE 2
194#define L2CAP_EXT_CTRL_SIZE 4
189 195
190struct l2cap_cmd_hdr { 196struct l2cap_cmd_hdr {
191 __u8 code; 197 __u8 code;
@@ -446,6 +452,9 @@ struct l2cap_chan {
446 __u16 monitor_timeout; 452 __u16 monitor_timeout;
447 __u16 mps; 453 __u16 mps;
448 454
455 __u8 tx_state;
456 __u8 rx_state;
457
449 unsigned long conf_state; 458 unsigned long conf_state;
450 unsigned long conn_state; 459 unsigned long conn_state;
451 unsigned long flags; 460 unsigned long flags;
@@ -456,9 +465,11 @@ struct l2cap_chan {
456 __u16 buffer_seq; 465 __u16 buffer_seq;
457 __u16 buffer_seq_srej; 466 __u16 buffer_seq_srej;
458 __u16 srej_save_reqseq; 467 __u16 srej_save_reqseq;
468 __u16 last_acked_seq;
459 __u16 frames_sent; 469 __u16 frames_sent;
460 __u16 unacked_frames; 470 __u16 unacked_frames;
461 __u8 retry_count; 471 __u8 retry_count;
472 __u16 srej_queue_next;
462 __u8 num_acked; 473 __u8 num_acked;
463 __u16 sdu_len; 474 __u16 sdu_len;
464 struct sk_buff *sdu; 475 struct sk_buff *sdu;
@@ -600,6 +611,44 @@ enum {
600 FLAG_EFS_ENABLE, 611 FLAG_EFS_ENABLE,
601}; 612};
602 613
614enum {
615 L2CAP_TX_STATE_XMIT,
616 L2CAP_TX_STATE_WAIT_F,
617};
618
619enum {
620 L2CAP_RX_STATE_RECV,
621 L2CAP_RX_STATE_SREJ_SENT,
622};
623
624enum {
625 L2CAP_TXSEQ_EXPECTED,
626 L2CAP_TXSEQ_EXPECTED_SREJ,
627 L2CAP_TXSEQ_UNEXPECTED,
628 L2CAP_TXSEQ_UNEXPECTED_SREJ,
629 L2CAP_TXSEQ_DUPLICATE,
630 L2CAP_TXSEQ_DUPLICATE_SREJ,
631 L2CAP_TXSEQ_INVALID,
632 L2CAP_TXSEQ_INVALID_IGNORE,
633};
634
635enum {
636 L2CAP_EV_DATA_REQUEST,
637 L2CAP_EV_LOCAL_BUSY_DETECTED,
638 L2CAP_EV_LOCAL_BUSY_CLEAR,
639 L2CAP_EV_RECV_REQSEQ_AND_FBIT,
640 L2CAP_EV_RECV_FBIT,
641 L2CAP_EV_RETRANS_TO,
642 L2CAP_EV_MONITOR_TO,
643 L2CAP_EV_EXPLICIT_POLL,
644 L2CAP_EV_RECV_IFRAME,
645 L2CAP_EV_RECV_RR,
646 L2CAP_EV_RECV_REJ,
647 L2CAP_EV_RECV_RNR,
648 L2CAP_EV_RECV_SREJ,
649 L2CAP_EV_RECV_FRAME,
650};
651
603static inline void l2cap_chan_hold(struct l2cap_chan *c) 652static inline void l2cap_chan_hold(struct l2cap_chan *c)
604{ 653{
605 atomic_inc(&c->refcnt); 654 atomic_inc(&c->refcnt);