Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 277698
b: refs/heads/master
c: c8f7916
h: refs/heads/master
v: v3
  • Loading branch information
Andrei Emeltchenko authored and Gustavo F. Padovan committed Oct 17, 2011
1 parent 04949bd commit 15e66f0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 03a512137da58e18bec15b46c409a62e0250447e
refs/heads/master: c8f791626a8840fe60a05ab55468dfb3922cb35a
42 changes: 28 additions & 14 deletions trunk/net/bluetooth/l2cap_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1990,6 +1990,7 @@ static int l2cap_build_conf_req(struct l2cap_chan *chan, void *data)
struct l2cap_conf_req *req = data;
struct l2cap_conf_rfc rfc = { .mode = chan->mode };
void *ptr = req->data;
u16 size;

BT_DBG("chan %p", chan);

Expand Down Expand Up @@ -2037,9 +2038,12 @@ static int l2cap_build_conf_req(struct l2cap_chan *chan, void *data)
rfc.max_transmit = chan->max_tx;
rfc.retrans_timeout = 0;
rfc.monitor_timeout = 0;
rfc.max_pdu_size = cpu_to_le16(L2CAP_DEFAULT_MAX_PDU_SIZE);
if (L2CAP_DEFAULT_MAX_PDU_SIZE > chan->conn->mtu - 10)
rfc.max_pdu_size = cpu_to_le16(chan->conn->mtu - 10);

size = min_t(u16, L2CAP_DEFAULT_MAX_PDU_SIZE, chan->conn->mtu -
L2CAP_EXT_HDR_SIZE -
L2CAP_SDULEN_SIZE -
L2CAP_FCS_SIZE);
rfc.max_pdu_size = cpu_to_le16(size);

l2cap_txwin_setup(chan);

Expand Down Expand Up @@ -2072,9 +2076,12 @@ static int l2cap_build_conf_req(struct l2cap_chan *chan, void *data)
rfc.max_transmit = 0;
rfc.retrans_timeout = 0;
rfc.monitor_timeout = 0;
rfc.max_pdu_size = cpu_to_le16(L2CAP_DEFAULT_MAX_PDU_SIZE);
if (L2CAP_DEFAULT_MAX_PDU_SIZE > chan->conn->mtu - 10)
rfc.max_pdu_size = cpu_to_le16(chan->conn->mtu - 10);

size = min_t(u16, L2CAP_DEFAULT_MAX_PDU_SIZE, chan->conn->mtu -
L2CAP_EXT_HDR_SIZE -
L2CAP_SDULEN_SIZE -
L2CAP_FCS_SIZE);
rfc.max_pdu_size = cpu_to_le16(size);

l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, sizeof(rfc),
(unsigned long) &rfc);
Expand Down Expand Up @@ -2110,6 +2117,7 @@ static int l2cap_parse_conf_req(struct l2cap_chan *chan, void *data)
struct l2cap_conf_rfc rfc = { .mode = L2CAP_MODE_BASIC };
u16 mtu = L2CAP_DEFAULT_MTU;
u16 result = L2CAP_CONF_SUCCESS;
u16 size;

BT_DBG("chan %p", chan);

Expand Down Expand Up @@ -2219,10 +2227,13 @@ static int l2cap_parse_conf_req(struct l2cap_chan *chan, void *data)

chan->remote_max_tx = rfc.max_transmit;

if (le16_to_cpu(rfc.max_pdu_size) > chan->conn->mtu - 10)
rfc.max_pdu_size = cpu_to_le16(chan->conn->mtu - 10);

chan->remote_mps = le16_to_cpu(rfc.max_pdu_size);
size = min_t(u16, le16_to_cpu(rfc.max_pdu_size),
chan->conn->mtu -
L2CAP_EXT_HDR_SIZE -
L2CAP_SDULEN_SIZE -
L2CAP_FCS_SIZE);
rfc.max_pdu_size = cpu_to_le16(size);
chan->remote_mps = size;

rfc.retrans_timeout =
le16_to_cpu(L2CAP_DEFAULT_RETRANS_TO);
Expand All @@ -2237,10 +2248,13 @@ static int l2cap_parse_conf_req(struct l2cap_chan *chan, void *data)
break;

case L2CAP_MODE_STREAMING:
if (le16_to_cpu(rfc.max_pdu_size) > chan->conn->mtu - 10)
rfc.max_pdu_size = cpu_to_le16(chan->conn->mtu - 10);

chan->remote_mps = le16_to_cpu(rfc.max_pdu_size);
size = min_t(u16, le16_to_cpu(rfc.max_pdu_size),
chan->conn->mtu -
L2CAP_EXT_HDR_SIZE -
L2CAP_SDULEN_SIZE -
L2CAP_FCS_SIZE);
rfc.max_pdu_size = cpu_to_le16(size);
chan->remote_mps = size;

set_bit(CONF_MODE_DONE, &chan->conf_state);

Expand Down

0 comments on commit 15e66f0

Please sign in to comment.