netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH 19/64] Bluetooth: Handle all cases of receipt of RNR-frames into L2CAP
Date: Mon, 10 May 2010 11:37:09 +0200	[thread overview]
Message-ID: <99b0d4b7b09edeacf4542bced5c01239375b51a9.1273484096.git.marcel@holtmann.org> (raw)
In-Reply-To: <e072745f4adb01b909bd08a0cfc8f79348f4d2c6.1273484096.git.marcel@holtmann.org>
In-Reply-To: <cover.1273484094.git.marcel@holtmann.org>

From: Gustavo F. Padovan <padovan@profusion.mobi>

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>
---
 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 068edf7..8937a84 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -1448,6 +1448,22 @@ static int l2cap_send_ack(struct l2cap_pinfo *pi)
 	return 0;
 }
 
+static int l2cap_send_srejtail(struct sock *sk)
+{
+	struct srej_list *tail;
+	u16 control;
+
+	control = L2CAP_SUPER_SELECT_REJECT;
+	control |= L2CAP_CTRL_FINAL;
+
+	tail = list_entry(SREJ_LIST(sk)->prev, struct srej_list, list);
+	control |= tail->tx_seq << L2CAP_CTRL_REQSEQ_SHIFT;
+
+	l2cap_send_sframe(l2cap_pi(sk), control);
+
+	return 0;
+}
+
 static inline int l2cap_skbuff_fromiovec(struct sock *sk, struct msghdr *msg, int len, int count, struct sk_buff *skb)
 {
 	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)
 	pi->expected_ack_seq = tx_seq;
 	l2cap_drop_acked_frames(sk);
 
-	del_timer(&pi->retrans_timer);
-	if (rx_control & L2CAP_CTRL_POLL) {
-		u16 control = L2CAP_CTRL_FINAL;
-		l2cap_send_rr_or_rnr(pi, control);
+	if (!(pi->conn_state & L2CAP_CONN_SREJ_SENT)) {
+		del_timer(&pi->retrans_timer);
+		if (rx_control & L2CAP_CTRL_POLL) {
+			u16 control = L2CAP_CTRL_FINAL;
+			l2cap_send_rr_or_rnr(pi, control);
+		}
+		return;
 	}
+
+	if (rx_control & L2CAP_CTRL_POLL)
+		l2cap_send_srejtail(sk);
+	else
+		l2cap_send_sframe(pi, L2CAP_SUPER_RCV_READY);
 }
 
 static inline int l2cap_data_channel_sframe(struct sock *sk, u16 rx_control, struct sk_buff *skb)
-- 
1.6.6.1


  reply	other threads:[~2010-05-10  9:38 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-10  9:36 Pull request: bluetooth-next-2.6 2010-05-10 Marcel Holtmann
2010-05-10  9:36 ` [PATCH 01/64] Bluetooth: Fix return value when bt_skb_alloc fails Marcel Holtmann
2010-05-10  9:36   ` [PATCH 02/64] Bluetooth: Use the proper function cast to get hdr data Marcel Holtmann
2010-05-10  9:36     ` [PATCH 03/64] Bluetooth: Fix wrong packet type count increment Marcel Holtmann
2010-05-10  9:36       ` [PATCH 04/64] Bluetooth: Make hci_send_sco() void Marcel Holtmann
2010-05-10  9:36         ` [PATCH 05/64] Bluetooth: Trivial clean ups to SCO Marcel Holtmann
2010-05-10  9:36           ` [PATCH 06/64] Bluetooth: Move specific Basic Mode code to the right place Marcel Holtmann
2010-05-10  9:36             ` [PATCH 07/64] Bluetooth: Fix memory leak of S-frames into L2CAP Marcel Holtmann
2010-05-10  9:36               ` [PATCH 08/64] Bluetooth: Fix expected_tx_seq calculation on L2CAP Marcel Holtmann
2010-05-10  9:36                 ` [PATCH 09/64] Bluetooth: Fix ACL MTU issue Marcel Holtmann
2010-05-10  9:37                   ` [PATCH 10/64] Bluetooth: Use a l2cap_pinfo struct instead l2cap_pi() macro Marcel Holtmann
2010-05-10  9:37                     ` [PATCH 11/64] Bluetooth: Implement 'Send IorRRorRNR' event Marcel Holtmann
2010-05-10  9:37                       ` [PATCH 12/64] Bluetooth: Support case with F bit set under WAIT_F state Marcel Holtmann
2010-05-10  9:37                         ` [PATCH 13/64] Bluetooth: Check the minimum {I,S}-frame size into L2CAP Marcel Holtmann
2010-05-10  9:37                           ` [PATCH 14/64] Bluetooth: Check if SDU size is greater than MTU on L2CAP Marcel Holtmann
2010-05-10  9:37                             ` [PATCH 15/64] Bluetooth: Implement SendAck() Action on ERTM Marcel Holtmann
2010-05-10  9:37                               ` [PATCH 16/64] Bluetooth: Move set of P-bit to l2cap_send_sframe() Marcel Holtmann
2010-05-10  9:37                                 ` [PATCH 17/64] Bluetooth: Add Recv RR (P=0)(F=0) for SREJ_SENT state on ERTM Marcel Holtmann
2010-05-10  9:37                                   ` [PATCH 18/64] Bluetooth: Split l2cap_data_channel_sframe() Marcel Holtmann
2010-05-10  9:37                                     ` Marcel Holtmann [this message]
2010-05-10  9:37                                       ` [PATCH 20/64] Bluetooth: Group the ack of I-frames into l2cap_data_channel_rrframe() Marcel Holtmann
2010-05-10  9:37                                         ` [PATCH 21/64] Bluetooth: Remove duplicate use of __get_reqseq() macro on L2CAP Marcel Holtmann
2010-05-10  9:37                                           ` [PATCH 22/64] Bluetooth: Finish implementation for Rec RR (P=1) on ERTM Marcel Holtmann
2010-05-10  9:37                                             ` [PATCH 23/64] Bluetooth: Add timer to Acknowledge I-frames Marcel Holtmann
2010-05-10  9:37                                               ` [PATCH 24/64] Bluetooth: Ignore Tx Window value with Streaming mode Marcel Holtmann
2010-05-10  9:37                                                 ` [PATCH 25/64] Bluetooth: Read RFC conf option on a successful Conf RSP Marcel Holtmann
2010-05-10  9:37                                                   ` [PATCH 26/64] Bluetooth: Fix configuration of the MPS value Marcel Holtmann
2010-05-10  9:37                                                     ` [PATCH 27/64] Bluetooth: Add le16 macro to Retransmission and Monitor Timeouts values Marcel Holtmann
2010-05-10  9:37                                                       ` [PATCH 28/64] Bluetooth: Check the SDU size against the MTU value Marcel Holtmann
2010-05-10  9:37                                                         ` [PATCH 29/64] Bluetooth: Send Ack after clear the SREJ list Marcel Holtmann
2010-05-10  9:37                                                           ` [PATCH 30/64] Bluetooth: Add sockopt configuration for txWindow on L2CAP Marcel Holtmann
2010-05-10  9:37                                                             ` [PATCH 31/64] Bluetooth: Change acknowledgement to use the value of txWindow Marcel Holtmann
2010-05-10  9:37                                                               ` [PATCH 32/64] Bluetooth: Add module parameter for txWindow size on L2CAP Marcel Holtmann
2010-05-10  9:37                                                                 ` [PATCH 33/64] Bluetooth: Enable option to configure Max Transmission value via sockopt Marcel Holtmann
2010-05-10  9:37                                                                   ` [PATCH 34/64] Bluetooth: Fix bug when retransmitting I-frames Marcel Holtmann
2010-05-10  9:37                                                                     ` [PATCH 35/64] Bluetooth: Fix crash when monitor timeout expires Marcel Holtmann
2010-05-10  9:37                                                                       ` [PATCH 36/64] Bluetooth: Fix drop of acked packets on ERTM Marcel Holtmann
2010-05-10  9:37                                                                         ` [PATCH 37/64] Bluetooth: Optimize SREJ_QUEUE append Marcel Holtmann
2010-05-10  9:37                                                                           ` [PATCH 38/64] Bluetooth: Add Kconfig option for L2CAP Extended Features Marcel Holtmann
2010-05-10  9:37                                                                             ` [PATCH 39/64] Bluetooth: Add SOCK_STREAM support to L2CAP Marcel Holtmann
2010-05-10  9:37                                                                               ` [PATCH 40/64] Bluetooth: Check if mode is supported on getsockopt Marcel Holtmann
2010-05-10  9:37                                                                                 ` [PATCH 41/64] Bluetooth: Fix SDU reassembly under SREJ Marcel Holtmann
2010-05-10  9:37                                                                                   ` [PATCH 42/64] Bluetooth: Close L2CAP channel on invalid ReqSeq Marcel Holtmann
2010-05-10  9:37                                                                                     ` [PATCH 43/64] Bluetooth: Don't set control bits to zero first Marcel Holtmann
2010-05-10  9:37                                                                                       ` [PATCH 44/64] Bluetooth: Fix errors reported by checkpatch.pl Marcel Holtmann
2010-05-10  9:37                                                                                         ` [PATCH 45/64] Bluetooth: Remove set of SrejSaveReqSeq under receipt of REJ frame Marcel Holtmann
2010-05-10  9:37                                                                                           ` [PATCH 46/64] Bluetooth: Remove unneeded control vars Marcel Holtmann
2010-05-10  9:37                                                                                             ` [PATCH 47/64] Bluetooth: Check if we really are in WAIT_F when F bit comes Marcel Holtmann
2010-05-10  9:37                                                                                               ` [PATCH 48/64] Bluetooth: Fix lockdep annotation on ERTM Marcel Holtmann
2010-05-10  9:37                                                                                                 ` [PATCH 49/64] Bluetooth: Make hci_send_acl() void Marcel Holtmann
2010-05-10  9:37                                                                                                   ` [PATCH 50/64] Bluetooth: Refactor l2cap_retransmit_frame() Marcel Holtmann
2010-05-10  9:37                                                                                                     ` [PATCH 51/64] Bluetooth: Implement missing parts of the Invalid Frame Detection Marcel Holtmann
2010-05-10  9:37                                                                                                       ` [PATCH 52/64] Bluetooth: Completes the I-frame tx_seq check logic on RECV Marcel Holtmann
2010-05-10  9:37                                                                                                         ` [PATCH 53/64] Bluetooth: Implement Local Busy Condition handling Marcel Holtmann
2010-05-10  9:37                                                                                                           ` [PATCH 54/64] Bluetooth: Add wait_queue to wait ack of all sent packets Marcel Holtmann
2010-05-10  9:37                                                                                                             ` [PATCH 55/64] Bluetooth: Fix race condition on l2cap_ertm_send() Marcel Holtmann
2010-05-10  9:37                                                                                                               ` [PATCH 56/64] Bluetooth: Prevents buffer overflow on l2cap_ertm_reassembly_sdu() Marcel Holtmann
2010-05-10  9:37                                                                                                                 ` [PATCH 57/64] Bluetooth: Fix spec error in the RemoteBusy Logic Marcel Holtmann
2010-05-10  9:37                                                                                                                   ` [PATCH 58/64] Bluetooth: Create per controller workqueue Marcel Holtmann
2010-05-10  9:37                                                                                                                     ` [PATCH 59/64] Bluetooth: Fix storing negative values as unsigned char Marcel Holtmann
2010-05-10  9:37                                                                                                                       ` [PATCH 60/64] Bluetooth: Decode btmrvl MODULE_BRINGUP_REG response correctly Marcel Holtmann
2010-05-10  9:37                                                                                                                         ` [PATCH 61/64] Bluetooth: Separate btmrvl_register_hdev() from btmrvl_add_card() Marcel Holtmann
2010-05-10  9:37                                                                                                                           ` [PATCH 62/64] Bluetooth: Set hdev->dev_type based on Marvell device type Marcel Holtmann
2010-05-10  9:37                                                                                                                             ` [PATCH 63/64] Bluetooth: Use strict_strtoul instead of simple_strtoul Marcel Holtmann
2010-05-10  9:37                                                                                                                               ` [PATCH 64/64] Bluetooth: Fix issues where sk_sleep() helper is needed now Marcel Holtmann
2010-05-10  9:47 ` Pull request: bluetooth-next-2.6 2010-05-10 David Miller
2010-05-10 10:41   ` Marcel Holtmann
2010-05-10 11:08     ` David Miller
2010-05-10 11:20 ` David Miller
2010-05-10 11:26   ` Marcel Holtmann
2010-05-10 11:28   ` David Miller
2010-05-10 11:32     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=99b0d4b7b09edeacf4542bced5c01239375b51a9.1273484096.git.marcel@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).