aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2011-10-11 06:37:47 -0400
committerGustavo F. Padovan <padovan@profusion.mobi>2011-10-13 15:45:04 -0400
commitfb45de7dbaf2cf8eec43a88bdb98889f0d4d5d5f (patch)
treeb15ad98306e020f5f904847a1c65a297db6658c7 /net
parent0b209fae88c6e844f2ee9d4d791f0f31f7f42ae9 (diff)
Bluetooth: EWS: rewrite L2CAP ERTM txseq calculation
L2CAP ERTM txseq calculation uses now information about control field type. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/l2cap_core.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index f35eb73b25fd..1c367d6af995 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1270,7 +1270,7 @@ static void l2cap_streaming_send(struct l2cap_chan *chan)
1270 1270
1271 while ((skb = skb_dequeue(&chan->tx_q))) { 1271 while ((skb = skb_dequeue(&chan->tx_q))) {
1272 control = get_unaligned_le16(skb->data + L2CAP_HDR_SIZE); 1272 control = get_unaligned_le16(skb->data + L2CAP_HDR_SIZE);
1273 control |= chan->next_tx_seq << L2CAP_CTRL_TXSEQ_SHIFT; 1273 control |= __set_txseq(chan, chan->next_tx_seq);
1274 put_unaligned_le16(control, skb->data + L2CAP_HDR_SIZE); 1274 put_unaligned_le16(control, skb->data + L2CAP_HDR_SIZE);
1275 1275
1276 if (chan->fcs == L2CAP_FCS_CRC16) { 1276 if (chan->fcs == L2CAP_FCS_CRC16) {
@@ -1284,7 +1284,7 @@ static void l2cap_streaming_send(struct l2cap_chan *chan)
1284 } 1284 }
1285} 1285}
1286 1286
1287static void l2cap_retransmit_one_frame(struct l2cap_chan *chan, u8 tx_seq) 1287static void l2cap_retransmit_one_frame(struct l2cap_chan *chan, u16 tx_seq)
1288{ 1288{
1289 struct sk_buff *skb, *tx_skb; 1289 struct sk_buff *skb, *tx_skb;
1290 u16 control, fcs; 1290 u16 control, fcs;
@@ -1317,7 +1317,7 @@ static void l2cap_retransmit_one_frame(struct l2cap_chan *chan, u8 tx_seq)
1317 control |= L2CAP_CTRL_FINAL; 1317 control |= L2CAP_CTRL_FINAL;
1318 1318
1319 control |= __set_reqseq(chan, chan->buffer_seq); 1319 control |= __set_reqseq(chan, chan->buffer_seq);
1320 control |= tx_seq << L2CAP_CTRL_TXSEQ_SHIFT; 1320 control |= __set_txseq(chan, tx_seq);
1321 1321
1322 put_unaligned_le16(control, tx_skb->data + L2CAP_HDR_SIZE); 1322 put_unaligned_le16(control, tx_skb->data + L2CAP_HDR_SIZE);
1323 1323
@@ -1357,7 +1357,7 @@ static int l2cap_ertm_send(struct l2cap_chan *chan)
1357 control |= L2CAP_CTRL_FINAL; 1357 control |= L2CAP_CTRL_FINAL;
1358 1358
1359 control |= __set_reqseq(chan, chan->buffer_seq); 1359 control |= __set_reqseq(chan, chan->buffer_seq);
1360 control |= chan->next_tx_seq << L2CAP_CTRL_TXSEQ_SHIFT; 1360 control |= __set_txseq(chan, chan->next_tx_seq);
1361 put_unaligned_le16(control, tx_skb->data + L2CAP_HDR_SIZE); 1361 put_unaligned_le16(control, tx_skb->data + L2CAP_HDR_SIZE);
1362 1362
1363 1363
@@ -3136,7 +3136,7 @@ static inline void l2cap_send_i_or_rr_or_rnr(struct l2cap_chan *chan)
3136 } 3136 }
3137} 3137}
3138 3138
3139static int l2cap_add_to_srej_queue(struct l2cap_chan *chan, struct sk_buff *skb, u8 tx_seq, u8 sar) 3139static int l2cap_add_to_srej_queue(struct l2cap_chan *chan, struct sk_buff *skb, u16 tx_seq, u8 sar)
3140{ 3140{
3141 struct sk_buff *next_skb; 3141 struct sk_buff *next_skb;
3142 int tx_seq_offset, next_tx_seq_offset; 3142 int tx_seq_offset, next_tx_seq_offset;
@@ -3330,7 +3330,7 @@ void l2cap_chan_busy(struct l2cap_chan *chan, int busy)
3330 } 3330 }
3331} 3331}
3332 3332
3333static void l2cap_check_srej_gap(struct l2cap_chan *chan, u8 tx_seq) 3333static void l2cap_check_srej_gap(struct l2cap_chan *chan, u16 tx_seq)
3334{ 3334{
3335 struct sk_buff *skb; 3335 struct sk_buff *skb;
3336 u16 control; 3336 u16 control;
@@ -3357,7 +3357,7 @@ static void l2cap_check_srej_gap(struct l2cap_chan *chan, u8 tx_seq)
3357 } 3357 }
3358} 3358}
3359 3359
3360static void l2cap_resend_srejframe(struct l2cap_chan *chan, u8 tx_seq) 3360static void l2cap_resend_srejframe(struct l2cap_chan *chan, u16 tx_seq)
3361{ 3361{
3362 struct srej_list *l, *tmp; 3362 struct srej_list *l, *tmp;
3363 u16 control; 3363 u16 control;
@@ -3376,7 +3376,7 @@ static void l2cap_resend_srejframe(struct l2cap_chan *chan, u8 tx_seq)
3376 } 3376 }
3377} 3377}
3378 3378
3379static void l2cap_send_srejframe(struct l2cap_chan *chan, u8 tx_seq) 3379static void l2cap_send_srejframe(struct l2cap_chan *chan, u16 tx_seq)
3380{ 3380{
3381 struct srej_list *new; 3381 struct srej_list *new;
3382 u16 control; 3382 u16 control;
@@ -3396,7 +3396,7 @@ static void l2cap_send_srejframe(struct l2cap_chan *chan, u8 tx_seq)
3396 3396
3397static inline int l2cap_data_channel_iframe(struct l2cap_chan *chan, u16 rx_control, struct sk_buff *skb) 3397static inline int l2cap_data_channel_iframe(struct l2cap_chan *chan, u16 rx_control, struct sk_buff *skb)
3398{ 3398{
3399 u8 tx_seq = __get_txseq(rx_control); 3399 u16 tx_seq = __get_txseq(chan, rx_control);
3400 u16 req_seq = __get_reqseq(chan, rx_control); 3400 u16 req_seq = __get_reqseq(chan, rx_control);
3401 u8 sar = __get_ctrl_sar(chan, rx_control); 3401 u8 sar = __get_ctrl_sar(chan, rx_control);
3402 int tx_seq_offset, expected_tx_seq_offset; 3402 int tx_seq_offset, expected_tx_seq_offset;
@@ -3763,7 +3763,7 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk
3763 struct l2cap_chan *chan; 3763 struct l2cap_chan *chan;
3764 struct sock *sk = NULL; 3764 struct sock *sk = NULL;
3765 u16 control; 3765 u16 control;
3766 u8 tx_seq; 3766 u16 tx_seq;
3767 int len; 3767 int len;
3768 3768
3769 chan = l2cap_get_chan_by_scid(conn, cid); 3769 chan = l2cap_get_chan_by_scid(conn, cid);
@@ -3820,7 +3820,7 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk
3820 if (len > chan->mps || len < 0 || __is_sframe(control)) 3820 if (len > chan->mps || len < 0 || __is_sframe(control))
3821 goto drop; 3821 goto drop;
3822 3822
3823 tx_seq = __get_txseq(control); 3823 tx_seq = __get_txseq(chan, control);
3824 3824
3825 if (chan->expected_tx_seq != tx_seq) { 3825 if (chan->expected_tx_seq != tx_seq) {
3826 /* Frame(s) missing - must discard partial SDU */ 3826 /* Frame(s) missing - must discard partial SDU */