Commit 311bb895 authored by Gustavo F. Padovan's avatar Gustavo F. Padovan

Bluetooth: Move busy workqueue to struct l2cap_chan

As part of the moving channel stuff to l2cap_chan.
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent f1c6775b
...@@ -311,6 +311,7 @@ struct l2cap_chan { ...@@ -311,6 +311,7 @@ struct l2cap_chan {
struct timer_list ack_timer; struct timer_list ack_timer;
struct sk_buff_head srej_q; struct sk_buff_head srej_q;
struct sk_buff_head busy_q; struct sk_buff_head busy_q;
struct work_struct busy_work;
struct list_head list; struct list_head list;
}; };
...@@ -384,7 +385,6 @@ struct l2cap_pinfo { ...@@ -384,7 +385,6 @@ struct l2cap_pinfo {
__le16 sport; __le16 sport;
struct sk_buff_head tx_queue; struct sk_buff_head tx_queue;
struct work_struct busy_work;
struct srej_list srej_l; struct srej_list srej_l;
struct l2cap_conn *conn; struct l2cap_conn *conn;
struct l2cap_chan *chan; struct l2cap_chan *chan;
......
...@@ -1591,7 +1591,7 @@ static inline void l2cap_ertm_init(struct l2cap_chan *chan) ...@@ -1591,7 +1591,7 @@ static inline void l2cap_ertm_init(struct l2cap_chan *chan)
skb_queue_head_init(&chan->srej_q); skb_queue_head_init(&chan->srej_q);
skb_queue_head_init(&chan->busy_q); skb_queue_head_init(&chan->busy_q);
INIT_WORK(&l2cap_pi(sk)->busy_work, l2cap_busy_work); INIT_WORK(&chan->busy_work, l2cap_busy_work);
sk->sk_backlog_rcv = l2cap_ertm_data_rcv; sk->sk_backlog_rcv = l2cap_ertm_data_rcv;
} }
...@@ -3006,21 +3006,21 @@ static int l2cap_try_push_rx_skb(struct l2cap_chan *chan) ...@@ -3006,21 +3006,21 @@ static int l2cap_try_push_rx_skb(struct l2cap_chan *chan)
static void l2cap_busy_work(struct work_struct *work) static void l2cap_busy_work(struct work_struct *work)
{ {
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
struct l2cap_pinfo *pi = struct l2cap_chan *chan =
container_of(work, struct l2cap_pinfo, busy_work); container_of(work, struct l2cap_chan, busy_work);
struct sock *sk = (struct sock *)pi; struct sock *sk = chan->sk;
int n_tries = 0, timeo = HZ/5, err; int n_tries = 0, timeo = HZ/5, err;
struct sk_buff *skb; struct sk_buff *skb;
lock_sock(sk); lock_sock(sk);
add_wait_queue(sk_sleep(sk), &wait); add_wait_queue(sk_sleep(sk), &wait);
while ((skb = skb_peek(&pi->chan->busy_q))) { while ((skb = skb_peek(&chan->busy_q))) {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
if (n_tries++ > L2CAP_LOCAL_BUSY_TRIES) { if (n_tries++ > L2CAP_LOCAL_BUSY_TRIES) {
err = -EBUSY; err = -EBUSY;
l2cap_send_disconn_req(pi->conn, pi->chan, EBUSY); l2cap_send_disconn_req(l2cap_pi(sk)->conn, chan, EBUSY);
break; break;
} }
...@@ -3040,7 +3040,7 @@ static void l2cap_busy_work(struct work_struct *work) ...@@ -3040,7 +3040,7 @@ static void l2cap_busy_work(struct work_struct *work)
if (err) if (err)
break; break;
if (l2cap_try_push_rx_skb(l2cap_pi(sk)->chan) == 0) if (l2cap_try_push_rx_skb(chan) == 0)
break; break;
} }
...@@ -3052,8 +3052,6 @@ static void l2cap_busy_work(struct work_struct *work) ...@@ -3052,8 +3052,6 @@ static void l2cap_busy_work(struct work_struct *work)
static int l2cap_push_rx_skb(struct l2cap_chan *chan, struct sk_buff *skb, u16 control) static int l2cap_push_rx_skb(struct l2cap_chan *chan, struct sk_buff *skb, u16 control)
{ {
struct sock *sk = chan->sk;
struct l2cap_pinfo *pi = l2cap_pi(sk);
int sctrl, err; int sctrl, err;
if (chan->conn_state & L2CAP_CONN_LOCAL_BUSY) { if (chan->conn_state & L2CAP_CONN_LOCAL_BUSY) {
...@@ -3071,7 +3069,7 @@ static int l2cap_push_rx_skb(struct l2cap_chan *chan, struct sk_buff *skb, u16 c ...@@ -3071,7 +3069,7 @@ static int l2cap_push_rx_skb(struct l2cap_chan *chan, struct sk_buff *skb, u16 c
} }
/* Busy Condition */ /* Busy Condition */
BT_DBG("sk %p, Enter local busy", sk); BT_DBG("chan %p, Enter local busy", chan);
chan->conn_state |= L2CAP_CONN_LOCAL_BUSY; chan->conn_state |= L2CAP_CONN_LOCAL_BUSY;
bt_cb(skb)->sar = control >> L2CAP_CTRL_SAR_SHIFT; bt_cb(skb)->sar = control >> L2CAP_CTRL_SAR_SHIFT;
...@@ -3085,7 +3083,7 @@ static int l2cap_push_rx_skb(struct l2cap_chan *chan, struct sk_buff *skb, u16 c ...@@ -3085,7 +3083,7 @@ static int l2cap_push_rx_skb(struct l2cap_chan *chan, struct sk_buff *skb, u16 c
del_timer(&chan->ack_timer); del_timer(&chan->ack_timer);
queue_work(_busy_wq, &pi->busy_work); queue_work(_busy_wq, &chan->busy_work);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment