aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorGustavo F. Padovan <padovan@profusion.mobi>2010-05-01 15:15:40 -0400
committerMarcel Holtmann <marcel@holtmann.org>2010-05-10 03:28:49 -0400
commit14b5aa71ec506f4e38ca6a1dc02ecd668ecfd902 (patch)
treeafd8fc766f81d1c436433ca010eb12a606538b47 /net
parent855666cccc939d392316de17512e17a08b2fa05a (diff)
Bluetooth: Add sockopt configuration for txWindow on L2CAP
Now we can set/get Transmission Window size via sockopt. Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi> Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/l2cap.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index c6bc1b9ed657..530079649b43 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -782,6 +782,7 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
782 pi->omtu = l2cap_pi(parent)->omtu; 782 pi->omtu = l2cap_pi(parent)->omtu;
783 pi->mode = l2cap_pi(parent)->mode; 783 pi->mode = l2cap_pi(parent)->mode;
784 pi->fcs = l2cap_pi(parent)->fcs; 784 pi->fcs = l2cap_pi(parent)->fcs;
785 pi->tx_win = l2cap_pi(parent)->tx_win;
785 pi->sec_level = l2cap_pi(parent)->sec_level; 786 pi->sec_level = l2cap_pi(parent)->sec_level;
786 pi->role_switch = l2cap_pi(parent)->role_switch; 787 pi->role_switch = l2cap_pi(parent)->role_switch;
787 pi->force_reliable = l2cap_pi(parent)->force_reliable; 788 pi->force_reliable = l2cap_pi(parent)->force_reliable;
@@ -790,6 +791,7 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
790 pi->omtu = 0; 791 pi->omtu = 0;
791 pi->mode = L2CAP_MODE_BASIC; 792 pi->mode = L2CAP_MODE_BASIC;
792 pi->fcs = L2CAP_FCS_CRC16; 793 pi->fcs = L2CAP_FCS_CRC16;
794 pi->tx_win = L2CAP_DEFAULT_TX_WINDOW;
793 pi->sec_level = BT_SECURITY_LOW; 795 pi->sec_level = BT_SECURITY_LOW;
794 pi->role_switch = 0; 796 pi->role_switch = 0;
795 pi->force_reliable = 0; 797 pi->force_reliable = 0;
@@ -1782,6 +1784,7 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us
1782 opts.flush_to = l2cap_pi(sk)->flush_to; 1784 opts.flush_to = l2cap_pi(sk)->flush_to;
1783 opts.mode = l2cap_pi(sk)->mode; 1785 opts.mode = l2cap_pi(sk)->mode;
1784 opts.fcs = l2cap_pi(sk)->fcs; 1786 opts.fcs = l2cap_pi(sk)->fcs;
1787 opts.txwin_size = (__u16)l2cap_pi(sk)->tx_win;
1785 1788
1786 len = min_t(unsigned int, sizeof(opts), optlen); 1789 len = min_t(unsigned int, sizeof(opts), optlen);
1787 if (copy_from_user((char *) &opts, optval, len)) { 1790 if (copy_from_user((char *) &opts, optval, len)) {
@@ -1793,6 +1796,7 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us
1793 l2cap_pi(sk)->omtu = opts.omtu; 1796 l2cap_pi(sk)->omtu = opts.omtu;
1794 l2cap_pi(sk)->mode = opts.mode; 1797 l2cap_pi(sk)->mode = opts.mode;
1795 l2cap_pi(sk)->fcs = opts.fcs; 1798 l2cap_pi(sk)->fcs = opts.fcs;
1799 l2cap_pi(sk)->tx_win = (__u8)opts.txwin_size;
1796 break; 1800 break;
1797 1801
1798 case L2CAP_LM: 1802 case L2CAP_LM:
@@ -1907,6 +1911,7 @@ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname, char __us
1907 opts.flush_to = l2cap_pi(sk)->flush_to; 1911 opts.flush_to = l2cap_pi(sk)->flush_to;
1908 opts.mode = l2cap_pi(sk)->mode; 1912 opts.mode = l2cap_pi(sk)->mode;
1909 opts.fcs = l2cap_pi(sk)->fcs; 1913 opts.fcs = l2cap_pi(sk)->fcs;
1914 opts.txwin_size = (__u16)l2cap_pi(sk)->tx_win;
1910 1915
1911 len = min_t(unsigned int, len, sizeof(opts)); 1916 len = min_t(unsigned int, len, sizeof(opts));
1912 if (copy_to_user(optval, (char *) &opts, len)) 1917 if (copy_to_user(optval, (char *) &opts, len))
@@ -2324,7 +2329,7 @@ done:
2324 2329
2325 case L2CAP_MODE_ERTM: 2330 case L2CAP_MODE_ERTM:
2326 rfc.mode = L2CAP_MODE_ERTM; 2331 rfc.mode = L2CAP_MODE_ERTM;
2327 rfc.txwin_size = L2CAP_DEFAULT_TX_WINDOW; 2332 rfc.txwin_size = pi->tx_win;
2328 rfc.max_transmit = max_transmit; 2333 rfc.max_transmit = max_transmit;
2329 rfc.retrans_timeout = 0; 2334 rfc.retrans_timeout = 0;
2330 rfc.monitor_timeout = 0; 2335 rfc.monitor_timeout = 0;