diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2009-05-03 02:07:53 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-08-22 17:50:07 -0400 |
commit | 65c7c4918450f8c4545ccb02a9c7a3d77e073535 (patch) | |
tree | ceacb79cdf46b74bad8429dd06d32ba96f9c31f9 /net/bluetooth/l2cap.c | |
parent | c6b03cf986eab00e20d0dbc852b233bb83472138 (diff) |
Bluetooth: Add L2CAP RFC option if ERTM is enabled
When trying to establish a connection with Enhanced Retransmission mode
enabled, the RFC option needs to be added to the configuration.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/l2cap.c')
-rw-r--r-- | net/bluetooth/l2cap.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 8a59e57d9df1..7ce1a24735c8 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -1743,12 +1743,29 @@ static int l2cap_build_conf_req(struct sock *sk, void *data) | |||
1743 | { | 1743 | { |
1744 | struct l2cap_pinfo *pi = l2cap_pi(sk); | 1744 | struct l2cap_pinfo *pi = l2cap_pi(sk); |
1745 | struct l2cap_conf_req *req = data; | 1745 | struct l2cap_conf_req *req = data; |
1746 | struct l2cap_conf_rfc rfc = { .mode = L2CAP_MODE_BASIC }; | ||
1746 | void *ptr = req->data; | 1747 | void *ptr = req->data; |
1747 | 1748 | ||
1748 | BT_DBG("sk %p", sk); | 1749 | BT_DBG("sk %p", sk); |
1749 | 1750 | ||
1750 | if (pi->imtu != L2CAP_DEFAULT_MTU) | 1751 | switch (pi->mode) { |
1751 | l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->imtu); | 1752 | case L2CAP_MODE_BASIC: |
1753 | if (pi->imtu != L2CAP_DEFAULT_MTU) | ||
1754 | l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->imtu); | ||
1755 | break; | ||
1756 | |||
1757 | case L2CAP_MODE_ERTM: | ||
1758 | rfc.mode = L2CAP_MODE_ERTM; | ||
1759 | rfc.txwin_size = L2CAP_DEFAULT_RX_WINDOW; | ||
1760 | rfc.max_transmit = L2CAP_DEFAULT_MAX_RECEIVE; | ||
1761 | rfc.retrans_timeout = cpu_to_le16(L2CAP_DEFAULT_RETRANS_TO); | ||
1762 | rfc.monitor_timeout = cpu_to_le16(L2CAP_DEFAULT_MONITOR_TO); | ||
1763 | rfc.max_pdu_size = cpu_to_le16(L2CAP_DEFAULT_MAX_RX_APDU); | ||
1764 | |||
1765 | l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, | ||
1766 | sizeof(rfc), (unsigned long) &rfc); | ||
1767 | break; | ||
1768 | } | ||
1752 | 1769 | ||
1753 | /* FIXME: Need actual value of the flush timeout */ | 1770 | /* FIXME: Need actual value of the flush timeout */ |
1754 | //if (flush_to != L2CAP_DEFAULT_FLUSH_TO) | 1771 | //if (flush_to != L2CAP_DEFAULT_FLUSH_TO) |
@@ -1828,7 +1845,7 @@ static int l2cap_parse_conf_req(struct sock *sk, void *data) | |||
1828 | rfc.mode = L2CAP_MODE_BASIC; | 1845 | rfc.mode = L2CAP_MODE_BASIC; |
1829 | 1846 | ||
1830 | l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, | 1847 | l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, |
1831 | sizeof(rfc), (unsigned long) &rfc); | 1848 | sizeof(rfc), (unsigned long) &rfc); |
1832 | } | 1849 | } |
1833 | } | 1850 | } |
1834 | 1851 | ||