Commit e3781735 authored by Andrei Emeltchenko's avatar Andrei Emeltchenko Committed by Gustavo F. Padovan

Bluetooth: EWS: rewrite handling POLL (P) bit

Handle POLL (P) bit in L2CAP ERTM using information about control field type.
Signed-off-by: default avatarAndrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent 03f6715d
...@@ -627,6 +627,22 @@ static inline bool __is_ctrl_final(struct l2cap_chan *chan, __u32 ctrl) ...@@ -627,6 +627,22 @@ static inline bool __is_ctrl_final(struct l2cap_chan *chan, __u32 ctrl)
else else
return ctrl & L2CAP_CTRL_FINAL; return ctrl & L2CAP_CTRL_FINAL;
} }
static inline __u32 __set_ctrl_poll(struct l2cap_chan *chan)
{
if (test_bit(FLAG_EXT_CTRL, &chan->flags))
return L2CAP_EXT_CTRL_POLL;
else
return L2CAP_CTRL_POLL;
}
static inline bool __is_ctrl_poll(struct l2cap_chan *chan, __u32 ctrl)
{
if (test_bit(FLAG_EXT_CTRL, &chan->flags))
return ctrl & L2CAP_EXT_CTRL_POLL;
else
return ctrl & L2CAP_CTRL_POLL;
}
extern int disable_ertm; extern int disable_ertm;
int l2cap_init_sockets(void); int l2cap_init_sockets(void);
......
...@@ -585,7 +585,7 @@ static inline void l2cap_send_sframe(struct l2cap_chan *chan, u16 control) ...@@ -585,7 +585,7 @@ static inline void l2cap_send_sframe(struct l2cap_chan *chan, u16 control)
control |= __set_ctrl_final(chan); control |= __set_ctrl_final(chan);
if (test_and_clear_bit(CONN_SEND_PBIT, &chan->conn_state)) if (test_and_clear_bit(CONN_SEND_PBIT, &chan->conn_state))
control |= L2CAP_CTRL_POLL; control |= __set_ctrl_poll(chan);
skb = bt_skb_alloc(count, GFP_ATOMIC); skb = bt_skb_alloc(count, GFP_ATOMIC);
if (!skb) if (!skb)
...@@ -3304,7 +3304,7 @@ static void l2cap_ertm_exit_local_busy(struct l2cap_chan *chan) ...@@ -3304,7 +3304,7 @@ static void l2cap_ertm_exit_local_busy(struct l2cap_chan *chan)
goto done; goto done;
control = __set_reqseq(chan, chan->buffer_seq); control = __set_reqseq(chan, chan->buffer_seq);
control |= L2CAP_CTRL_POLL; control |= __set_ctrl_poll(chan);
control |= __set_ctrl_super(chan, L2CAP_SUPER_RR); control |= __set_ctrl_super(chan, L2CAP_SUPER_RR);
l2cap_send_sframe(chan, control); l2cap_send_sframe(chan, control);
chan->retry_count = 1; chan->retry_count = 1;
...@@ -3538,7 +3538,7 @@ static inline void l2cap_data_channel_rrframe(struct l2cap_chan *chan, u16 rx_co ...@@ -3538,7 +3538,7 @@ static inline void l2cap_data_channel_rrframe(struct l2cap_chan *chan, u16 rx_co
chan->expected_ack_seq = __get_reqseq(chan, rx_control); chan->expected_ack_seq = __get_reqseq(chan, rx_control);
l2cap_drop_acked_frames(chan); l2cap_drop_acked_frames(chan);
if (rx_control & L2CAP_CTRL_POLL) { if (__is_ctrl_poll(chan, rx_control)) {
set_bit(CONN_SEND_FBIT, &chan->conn_state); set_bit(CONN_SEND_FBIT, &chan->conn_state);
if (test_bit(CONN_SREJ_SENT, &chan->conn_state)) { if (test_bit(CONN_SREJ_SENT, &chan->conn_state)) {
if (test_bit(CONN_REMOTE_BUSY, &chan->conn_state) && if (test_bit(CONN_REMOTE_BUSY, &chan->conn_state) &&
...@@ -3599,7 +3599,7 @@ static inline void l2cap_data_channel_srejframe(struct l2cap_chan *chan, u16 rx_ ...@@ -3599,7 +3599,7 @@ static inline void l2cap_data_channel_srejframe(struct l2cap_chan *chan, u16 rx_
clear_bit(CONN_REMOTE_BUSY, &chan->conn_state); clear_bit(CONN_REMOTE_BUSY, &chan->conn_state);
if (rx_control & L2CAP_CTRL_POLL) { if (__is_ctrl_poll(chan, rx_control)) {
chan->expected_ack_seq = tx_seq; chan->expected_ack_seq = tx_seq;
l2cap_drop_acked_frames(chan); l2cap_drop_acked_frames(chan);
...@@ -3637,17 +3637,17 @@ static inline void l2cap_data_channel_rnrframe(struct l2cap_chan *chan, u16 rx_c ...@@ -3637,17 +3637,17 @@ static inline void l2cap_data_channel_rnrframe(struct l2cap_chan *chan, u16 rx_c
chan->expected_ack_seq = tx_seq; chan->expected_ack_seq = tx_seq;
l2cap_drop_acked_frames(chan); l2cap_drop_acked_frames(chan);
if (rx_control & L2CAP_CTRL_POLL) if (__is_ctrl_poll(chan, rx_control))
set_bit(CONN_SEND_FBIT, &chan->conn_state); set_bit(CONN_SEND_FBIT, &chan->conn_state);
if (!test_bit(CONN_SREJ_SENT, &chan->conn_state)) { if (!test_bit(CONN_SREJ_SENT, &chan->conn_state)) {
__clear_retrans_timer(chan); __clear_retrans_timer(chan);
if (rx_control & L2CAP_CTRL_POLL) if (__is_ctrl_poll(chan, rx_control))
l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_FINAL); l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_FINAL);
return; return;
} }
if (rx_control & L2CAP_CTRL_POLL) { if (__is_ctrl_poll(chan, rx_control)) {
l2cap_send_srejtail(chan); l2cap_send_srejtail(chan);
} else { } else {
rx_control = __set_ctrl_super(chan, L2CAP_SUPER_RR); rx_control = __set_ctrl_super(chan, L2CAP_SUPER_RR);
......
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