aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/l2cap.c
diff options
context:
space:
mode:
authorGustavo F. Padovan <padovan@profusion.mobi>2010-04-19 13:45:38 -0400
committerMarcel Holtmann <marcel@holtmann.org>2010-07-21 13:39:07 -0400
commit0e98958d4f827f814444757e0376546b462dfe6f (patch)
treefacae0c43c0267d432f1f06aafd14cedc1013f7e /net/bluetooth/l2cap.c
parent9b108fc0cf4e79c34a7d5626f5c2c4c529ef6d3f (diff)
Bluetooth: Add debug output to ERTM code
Use the dynamic debug to output info about ERTM protocol stuff. The following script can be used to enable debug for ERTM: DEBUGFS="/sys/kernel/debug/dynamic_debug/control" echo -n 'func l2cap_send_disconn_req +p' > $DEBUGFS echo -n 'func l2cap_monitor_timeout +p' > $DEBUGFS echo -n 'func l2cap_retrans_timeout +p' > $DEBUGFS echo -n 'func l2cap_busy_work +p' > $DEBUGFS echo -n 'func l2cap_push_rx_skb +p' > $DEBUGFS echo -n 'func l2cap_data_channel_iframe +p' > $DEBUGFS echo -n 'func l2cap_data_channel_rrframe +p' > $DEBUGFS echo -n 'func l2cap_data_channel_rejframe +p' > $DEBUGFS echo -n 'func l2cap_data_channel_srejframe +p' > $DEBUGFS echo -n 'func l2cap_data_channel_rnrframe +p' > $DEBUGFS 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/l2cap.c')
-rw-r--r--net/bluetooth/l2cap.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 1e39d72b80af..6e8a0512a9c9 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -1314,6 +1314,8 @@ static void l2cap_monitor_timeout(unsigned long arg)
1314{ 1314{
1315 struct sock *sk = (void *) arg; 1315 struct sock *sk = (void *) arg;
1316 1316
1317 BT_DBG("sk %p", sk);
1318
1317 bh_lock_sock(sk); 1319 bh_lock_sock(sk);
1318 if (l2cap_pi(sk)->retry_count >= l2cap_pi(sk)->remote_max_tx) { 1320 if (l2cap_pi(sk)->retry_count >= l2cap_pi(sk)->remote_max_tx) {
1319 l2cap_send_disconn_req(l2cap_pi(sk)->conn, sk, ECONNABORTED); 1321 l2cap_send_disconn_req(l2cap_pi(sk)->conn, sk, ECONNABORTED);
@@ -1332,6 +1334,8 @@ static void l2cap_retrans_timeout(unsigned long arg)
1332{ 1334{
1333 struct sock *sk = (void *) arg; 1335 struct sock *sk = (void *) arg;
1334 1336
1337 BT_DBG("sk %p", sk);
1338
1335 bh_lock_sock(sk); 1339 bh_lock_sock(sk);
1336 l2cap_pi(sk)->retry_count = 1; 1340 l2cap_pi(sk)->retry_count = 1;
1337 __mod_monitor_timer(); 1341 __mod_monitor_timer();
@@ -3645,6 +3649,8 @@ done:
3645 pi->conn_state &= ~L2CAP_CONN_LOCAL_BUSY; 3649 pi->conn_state &= ~L2CAP_CONN_LOCAL_BUSY;
3646 pi->conn_state &= ~L2CAP_CONN_RNR_SENT; 3650 pi->conn_state &= ~L2CAP_CONN_RNR_SENT;
3647 3651
3652 BT_DBG("sk %p, Exit local busy", sk);
3653
3648 set_current_state(TASK_RUNNING); 3654 set_current_state(TASK_RUNNING);
3649 remove_wait_queue(sk_sleep(sk), &wait); 3655 remove_wait_queue(sk_sleep(sk), &wait);
3650 3656
@@ -3669,6 +3675,8 @@ static int l2cap_push_rx_skb(struct sock *sk, struct sk_buff *skb, u16 control)
3669 } 3675 }
3670 3676
3671 /* Busy Condition */ 3677 /* Busy Condition */
3678 BT_DBG("sk %p, Enter local busy", sk);
3679
3672 pi->conn_state |= L2CAP_CONN_LOCAL_BUSY; 3680 pi->conn_state |= L2CAP_CONN_LOCAL_BUSY;
3673 bt_cb(skb)->sar = control >> L2CAP_CTRL_SAR_SHIFT; 3681 bt_cb(skb)->sar = control >> L2CAP_CTRL_SAR_SHIFT;
3674 __skb_queue_tail(BUSY_QUEUE(sk), skb); 3682 __skb_queue_tail(BUSY_QUEUE(sk), skb);
@@ -3847,7 +3855,8 @@ static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, str
3847 int num_to_ack = (pi->tx_win/6) + 1; 3855 int num_to_ack = (pi->tx_win/6) + 1;
3848 int err = 0; 3856 int err = 0;
3849 3857
3850 BT_DBG("sk %p rx_control 0x%4.4x len %d", sk, rx_control, skb->len); 3858 BT_DBG("sk %p len %d tx_seq %d rx_control 0x%4.4x", sk, skb->len, tx_seq,
3859 rx_control);
3851 3860
3852 if (L2CAP_CTRL_FINAL & rx_control && 3861 if (L2CAP_CTRL_FINAL & rx_control &&
3853 l2cap_pi(sk)->conn_state & L2CAP_CONN_WAIT_F) { 3862 l2cap_pi(sk)->conn_state & L2CAP_CONN_WAIT_F) {
@@ -3892,6 +3901,7 @@ static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, str
3892 pi->buffer_seq = pi->buffer_seq_srej; 3901 pi->buffer_seq = pi->buffer_seq_srej;
3893 pi->conn_state &= ~L2CAP_CONN_SREJ_SENT; 3902 pi->conn_state &= ~L2CAP_CONN_SREJ_SENT;
3894 l2cap_send_ack(pi); 3903 l2cap_send_ack(pi);
3904 BT_DBG("sk %p, Exit SREJ_SENT", sk);
3895 } 3905 }
3896 } else { 3906 } else {
3897 struct srej_list *l; 3907 struct srej_list *l;
@@ -3920,6 +3930,8 @@ static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, str
3920 3930
3921 pi->conn_state |= L2CAP_CONN_SREJ_SENT; 3931 pi->conn_state |= L2CAP_CONN_SREJ_SENT;
3922 3932
3933 BT_DBG("sk %p, Enter SREJ", sk);
3934
3923 INIT_LIST_HEAD(SREJ_LIST(sk)); 3935 INIT_LIST_HEAD(SREJ_LIST(sk));
3924 pi->buffer_seq_srej = pi->buffer_seq; 3936 pi->buffer_seq_srej = pi->buffer_seq;
3925 3937
@@ -3973,6 +3985,9 @@ static inline void l2cap_data_channel_rrframe(struct sock *sk, u16 rx_control)
3973{ 3985{
3974 struct l2cap_pinfo *pi = l2cap_pi(sk); 3986 struct l2cap_pinfo *pi = l2cap_pi(sk);
3975 3987
3988 BT_DBG("sk %p, req_seq %d ctrl 0x%4.4x", sk, __get_reqseq(rx_control),
3989 rx_control);
3990
3976 pi->expected_ack_seq = __get_reqseq(rx_control); 3991 pi->expected_ack_seq = __get_reqseq(rx_control);
3977 l2cap_drop_acked_frames(sk); 3992 l2cap_drop_acked_frames(sk);
3978 3993
@@ -4018,6 +4033,8 @@ static inline void l2cap_data_channel_rejframe(struct sock *sk, u16 rx_control)
4018 struct l2cap_pinfo *pi = l2cap_pi(sk); 4033 struct l2cap_pinfo *pi = l2cap_pi(sk);
4019 u8 tx_seq = __get_reqseq(rx_control); 4034 u8 tx_seq = __get_reqseq(rx_control);
4020 4035
4036 BT_DBG("sk %p, req_seq %d ctrl 0x%4.4x", sk, tx_seq, rx_control);
4037
4021 pi->conn_state &= ~L2CAP_CONN_REMOTE_BUSY; 4038 pi->conn_state &= ~L2CAP_CONN_REMOTE_BUSY;
4022 4039
4023 pi->expected_ack_seq = tx_seq; 4040 pi->expected_ack_seq = tx_seq;
@@ -4040,6 +4057,8 @@ static inline void l2cap_data_channel_srejframe(struct sock *sk, u16 rx_control)
4040 struct l2cap_pinfo *pi = l2cap_pi(sk); 4057 struct l2cap_pinfo *pi = l2cap_pi(sk);
4041 u8 tx_seq = __get_reqseq(rx_control); 4058 u8 tx_seq = __get_reqseq(rx_control);
4042 4059
4060 BT_DBG("sk %p, req_seq %d ctrl 0x%4.4x", sk, tx_seq, rx_control);
4061
4043 pi->conn_state &= ~L2CAP_CONN_REMOTE_BUSY; 4062 pi->conn_state &= ~L2CAP_CONN_REMOTE_BUSY;
4044 4063
4045 if (rx_control & L2CAP_CTRL_POLL) { 4064 if (rx_control & L2CAP_CTRL_POLL) {
@@ -4077,6 +4096,8 @@ static inline void l2cap_data_channel_rnrframe(struct sock *sk, u16 rx_control)
4077 struct l2cap_pinfo *pi = l2cap_pi(sk); 4096 struct l2cap_pinfo *pi = l2cap_pi(sk);
4078 u8 tx_seq = __get_reqseq(rx_control); 4097 u8 tx_seq = __get_reqseq(rx_control);
4079 4098
4099 BT_DBG("sk %p, req_seq %d ctrl 0x%4.4x", sk, tx_seq, rx_control);
4100
4080 pi->conn_state |= L2CAP_CONN_REMOTE_BUSY; 4101 pi->conn_state |= L2CAP_CONN_REMOTE_BUSY;
4081 pi->expected_ack_seq = tx_seq; 4102 pi->expected_ack_seq = tx_seq;
4082 l2cap_drop_acked_frames(sk); 4103 l2cap_drop_acked_frames(sk);