diff options
author | Gustavo F. Padovan <padovan@profusion.mobi> | 2010-05-01 15:15:38 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2010-05-10 03:28:47 -0400 |
commit | 99b0d4b7b09edeacf4542bced5c01239375b51a9 (patch) | |
tree | decc21dd55eb8189ac6fbd01e52ee3667070eb8a /net/bluetooth | |
parent | e072745f4adb01b909bd08a0cfc8f79348f4d2c6 (diff) |
Bluetooth: Handle all cases of receipt of RNR-frames into L2CAP
We weren't handling the receipt under SREJ_SENT state table.
It also introduce l2cap_send_srejtail(). It will be used in the nexts
commits too.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/l2cap.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 068edf7704bf..8937a842347a 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -1448,6 +1448,22 @@ static int l2cap_send_ack(struct l2cap_pinfo *pi) | |||
1448 | return 0; | 1448 | return 0; |
1449 | } | 1449 | } |
1450 | 1450 | ||
1451 | static int l2cap_send_srejtail(struct sock *sk) | ||
1452 | { | ||
1453 | struct srej_list *tail; | ||
1454 | u16 control; | ||
1455 | |||
1456 | control = L2CAP_SUPER_SELECT_REJECT; | ||
1457 | control |= L2CAP_CTRL_FINAL; | ||
1458 | |||
1459 | tail = list_entry(SREJ_LIST(sk)->prev, struct srej_list, list); | ||
1460 | control |= tail->tx_seq << L2CAP_CTRL_REQSEQ_SHIFT; | ||
1461 | |||
1462 | l2cap_send_sframe(l2cap_pi(sk), control); | ||
1463 | |||
1464 | return 0; | ||
1465 | } | ||
1466 | |||
1451 | static inline int l2cap_skbuff_fromiovec(struct sock *sk, struct msghdr *msg, int len, int count, struct sk_buff *skb) | 1467 | static inline int l2cap_skbuff_fromiovec(struct sock *sk, struct msghdr *msg, int len, int count, struct sk_buff *skb) |
1452 | { | 1468 | { |
1453 | struct l2cap_conn *conn = l2cap_pi(sk)->conn; | 1469 | struct l2cap_conn *conn = l2cap_pi(sk)->conn; |
@@ -3582,11 +3598,19 @@ static inline void l2cap_data_channel_rnrframe(struct sock *sk, u16 rx_control) | |||
3582 | pi->expected_ack_seq = tx_seq; | 3598 | pi->expected_ack_seq = tx_seq; |
3583 | l2cap_drop_acked_frames(sk); | 3599 | l2cap_drop_acked_frames(sk); |
3584 | 3600 | ||
3585 | del_timer(&pi->retrans_timer); | 3601 | if (!(pi->conn_state & L2CAP_CONN_SREJ_SENT)) { |
3586 | if (rx_control & L2CAP_CTRL_POLL) { | 3602 | del_timer(&pi->retrans_timer); |
3587 | u16 control = L2CAP_CTRL_FINAL; | 3603 | if (rx_control & L2CAP_CTRL_POLL) { |
3588 | l2cap_send_rr_or_rnr(pi, control); | 3604 | u16 control = L2CAP_CTRL_FINAL; |
3605 | l2cap_send_rr_or_rnr(pi, control); | ||
3606 | } | ||
3607 | return; | ||
3589 | } | 3608 | } |
3609 | |||
3610 | if (rx_control & L2CAP_CTRL_POLL) | ||
3611 | l2cap_send_srejtail(sk); | ||
3612 | else | ||
3613 | l2cap_send_sframe(pi, L2CAP_SUPER_RCV_READY); | ||
3590 | } | 3614 | } |
3591 | 3615 | ||
3592 | static inline int l2cap_data_channel_sframe(struct sock *sk, u16 rx_control, struct sk_buff *skb) | 3616 | static inline int l2cap_data_channel_sframe(struct sock *sk, u16 rx_control, struct sk_buff *skb) |