summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorGustavo F. Padovan <padovan@profusion.mobi>2011-04-01 05:38:50 +0200
committerGustavo F. Padovan <padovan@profusion.mobi>2011-04-07 23:06:27 +0200
commit6a026610eee2c53ff59598905fcbaa979aec68d1 (patch)
tree53b0ea90f9d93de1d933c96a90f8d1d5e38f23aa /net
parentBluetooth: Move of ERTM *_seq vars to struct l2cap_chan (diff)
downloadlinux-6a026610eee2c53ff59598905fcbaa979aec68d1.tar.xz
linux-6a026610eee2c53ff59598905fcbaa979aec68d1.zip
Bluetooth: Move more ERTM stuff to struct l2cap_chan
As part of the moving channel stuff to l2cap_chan. Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/l2cap_core.c51
1 files changed, 24 insertions, 27 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index d975092904c1..3f601d1c164a 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -924,7 +924,7 @@ int __l2cap_wait_ack(struct sock *sk)
int timeo = HZ/5;
add_wait_queue(sk_sleep(sk), &wait);
- while ((l2cap_pi(sk)->unacked_frames > 0 && l2cap_pi(sk)->conn)) {
+ while ((l2cap_pi(sk)->chan->unacked_frames > 0 && l2cap_pi(sk)->conn)) {
set_current_state(TASK_INTERRUPTIBLE);
if (!timeo)
@@ -956,13 +956,13 @@ static void l2cap_monitor_timeout(unsigned long arg)
BT_DBG("chan %p", chan);
bh_lock_sock(sk);
- if (l2cap_pi(sk)->retry_count >= l2cap_pi(sk)->remote_max_tx) {
+ if (chan->retry_count >= l2cap_pi(sk)->remote_max_tx) {
l2cap_send_disconn_req(l2cap_pi(sk)->conn, sk, ECONNABORTED);
bh_unlock_sock(sk);
return;
}
- l2cap_pi(sk)->retry_count++;
+ chan->retry_count++;
__mod_monitor_timer();
l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL);
@@ -977,7 +977,7 @@ static void l2cap_retrans_timeout(unsigned long arg)
BT_DBG("sk %p", sk);
bh_lock_sock(sk);
- l2cap_pi(sk)->retry_count = 1;
+ chan->retry_count = 1;
__mod_monitor_timer();
chan->conn_state |= L2CAP_CONN_WAIT_F;
@@ -992,17 +992,17 @@ static void l2cap_drop_acked_frames(struct l2cap_chan *chan)
struct sk_buff *skb;
while ((skb = skb_peek(TX_QUEUE(sk))) &&
- l2cap_pi(sk)->unacked_frames) {
+ chan->unacked_frames) {
if (bt_cb(skb)->tx_seq == chan->expected_ack_seq)
break;
skb = skb_dequeue(TX_QUEUE(sk));
kfree_skb(skb);
- l2cap_pi(sk)->unacked_frames--;
+ chan->unacked_frames--;
}
- if (!l2cap_pi(sk)->unacked_frames)
+ if (!chan->unacked_frames)
del_timer(&l2cap_pi(sk)->retrans_timer);
}
@@ -1141,9 +1141,9 @@ int l2cap_ertm_send(struct l2cap_chan *chan)
chan->next_tx_seq = (chan->next_tx_seq + 1) % 64;
if (bt_cb(skb)->retries == 1)
- pi->unacked_frames++;
+ chan->unacked_frames++;
- pi->frames_sent++;
+ chan->frames_sent++;
if (skb_queue_is_last(TX_QUEUE(sk), skb))
sk->sk_send_head = NULL;
@@ -1574,10 +1574,10 @@ static inline void l2cap_ertm_init(struct l2cap_chan *chan)
struct sock *sk = chan->sk;
chan->expected_ack_seq = 0;
- l2cap_pi(sk)->unacked_frames = 0;
+ chan->unacked_frames = 0;
chan->buffer_seq = 0;
- l2cap_pi(sk)->num_acked = 0;
- l2cap_pi(sk)->frames_sent = 0;
+ chan->num_acked = 0;
+ chan->frames_sent = 0;
setup_timer(&l2cap_pi(sk)->retrans_timer,
l2cap_retrans_timeout, (unsigned long) chan);
@@ -2787,10 +2787,9 @@ static int l2cap_check_fcs(struct l2cap_pinfo *pi, struct sk_buff *skb)
static inline void l2cap_send_i_or_rr_or_rnr(struct l2cap_chan *chan)
{
- struct l2cap_pinfo *pi = l2cap_pi(chan->sk);
u16 control = 0;
- pi->frames_sent = 0;
+ chan->frames_sent = 0;
control |= chan->buffer_seq << L2CAP_CTRL_REQSEQ_SHIFT;
@@ -2806,7 +2805,7 @@ static inline void l2cap_send_i_or_rr_or_rnr(struct l2cap_chan *chan)
l2cap_ertm_send(chan);
if (!(chan->conn_state & L2CAP_CONN_LOCAL_BUSY) &&
- pi->frames_sent == 0) {
+ chan->frames_sent == 0) {
control |= L2CAP_SUPER_RCV_READY;
l2cap_send_sframe(chan, control);
}
@@ -2988,7 +2987,7 @@ static int l2cap_try_push_rx_skb(struct l2cap_chan *chan)
control = chan->buffer_seq << L2CAP_CTRL_REQSEQ_SHIFT;
control |= L2CAP_SUPER_RCV_READY | L2CAP_CTRL_POLL;
l2cap_send_sframe(chan, control);
- l2cap_pi(sk)->retry_count = 1;
+ chan->retry_count = 1;
del_timer(&pi->retrans_timer);
__mod_monitor_timer();
@@ -3260,7 +3259,7 @@ static inline int l2cap_data_channel_iframe(struct l2cap_chan *chan, u16 rx_cont
if (L2CAP_CTRL_FINAL & rx_control &&
chan->conn_state & L2CAP_CONN_WAIT_F) {
del_timer(&pi->monitor_timer);
- if (pi->unacked_frames > 0)
+ if (chan->unacked_frames > 0)
__mod_retrans_timer();
chan->conn_state &= ~L2CAP_CONN_WAIT_F;
}
@@ -3369,8 +3368,8 @@ expected:
__mod_ack_timer();
- pi->num_acked = (pi->num_acked + 1) % num_to_ack;
- if (pi->num_acked == num_to_ack - 1)
+ chan->num_acked = (chan->num_acked + 1) % num_to_ack;
+ if (chan->num_acked == num_to_ack - 1)
l2cap_send_ack(chan);
return 0;
@@ -3383,7 +3382,6 @@ drop:
static inline void l2cap_data_channel_rrframe(struct l2cap_chan *chan, u16 rx_control)
{
struct sock *sk = chan->sk;
- struct l2cap_pinfo *pi = l2cap_pi(sk);
BT_DBG("sk %p, req_seq %d ctrl 0x%4.4x", sk, __get_reqseq(rx_control),
rx_control);
@@ -3395,7 +3393,7 @@ static inline void l2cap_data_channel_rrframe(struct l2cap_chan *chan, u16 rx_co
chan->conn_state |= L2CAP_CONN_SEND_FBIT;
if (chan->conn_state & L2CAP_CONN_SREJ_SENT) {
if ((chan->conn_state & L2CAP_CONN_REMOTE_BUSY) &&
- (pi->unacked_frames > 0))
+ (chan->unacked_frames > 0))
__mod_retrans_timer();
chan->conn_state &= ~L2CAP_CONN_REMOTE_BUSY;
@@ -3414,7 +3412,7 @@ static inline void l2cap_data_channel_rrframe(struct l2cap_chan *chan, u16 rx_co
} else {
if ((chan->conn_state & L2CAP_CONN_REMOTE_BUSY) &&
- (pi->unacked_frames > 0))
+ (chan->unacked_frames > 0))
__mod_retrans_timer();
chan->conn_state &= ~L2CAP_CONN_REMOTE_BUSY;
@@ -3450,7 +3448,6 @@ static inline void l2cap_data_channel_rejframe(struct l2cap_chan *chan, u16 rx_c
}
static inline void l2cap_data_channel_srejframe(struct l2cap_chan *chan, u16 rx_control)
{
- struct l2cap_pinfo *pi = l2cap_pi(chan->sk);
u8 tx_seq = __get_reqseq(rx_control);
BT_DBG("chan %p, req_seq %d ctrl 0x%4.4x", chan, tx_seq, rx_control);
@@ -3467,19 +3464,19 @@ static inline void l2cap_data_channel_srejframe(struct l2cap_chan *chan, u16 rx_
l2cap_ertm_send(chan);
if (chan->conn_state & L2CAP_CONN_WAIT_F) {
- pi->srej_save_reqseq = tx_seq;
+ chan->srej_save_reqseq = tx_seq;
chan->conn_state |= L2CAP_CONN_SREJ_ACT;
}
} else if (rx_control & L2CAP_CTRL_FINAL) {
if ((chan->conn_state & L2CAP_CONN_SREJ_ACT) &&
- pi->srej_save_reqseq == tx_seq)
+ chan->srej_save_reqseq == tx_seq)
chan->conn_state &= ~L2CAP_CONN_SREJ_ACT;
else
l2cap_retransmit_one_frame(chan, tx_seq);
} else {
l2cap_retransmit_one_frame(chan, tx_seq);
if (chan->conn_state & L2CAP_CONN_WAIT_F) {
- pi->srej_save_reqseq = tx_seq;
+ chan->srej_save_reqseq = tx_seq;
chan->conn_state |= L2CAP_CONN_SREJ_ACT;
}
}
@@ -3521,7 +3518,7 @@ static inline int l2cap_data_channel_sframe(struct l2cap_chan *chan, u16 rx_cont
if (L2CAP_CTRL_FINAL & rx_control &&
chan->conn_state & L2CAP_CONN_WAIT_F) {
del_timer(&l2cap_pi(sk)->monitor_timer);
- if (l2cap_pi(sk)->unacked_frames > 0)
+ if (chan->unacked_frames > 0)
__mod_retrans_timer();
chan->conn_state &= ~L2CAP_CONN_WAIT_F;
}