Commit 47d1ec61 authored by Gustavo F. Padovan's avatar Gustavo F. Padovan

Bluetooth: Move more vars to struct l2cap_chan

In this commit all ERTM and Streaming Mode specific vars.
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent 4343478f
...@@ -297,6 +297,14 @@ struct l2cap_chan { ...@@ -297,6 +297,14 @@ struct l2cap_chan {
__u8 num_conf_req; __u8 num_conf_req;
__u8 num_conf_rsp; __u8 num_conf_rsp;
__u8 fcs;
__u8 tx_win;
__u8 max_tx;
__u16 retrans_timeout;
__u16 monitor_timeout;
__u16 mps;
__u8 conf_state; __u8 conf_state;
__u16 conn_state; __u16 conn_state;
...@@ -376,14 +384,6 @@ struct l2cap_pinfo { ...@@ -376,14 +384,6 @@ struct l2cap_pinfo {
__u16 flush_to; __u16 flush_to;
__u8 mode; __u8 mode;
__u8 fcs;
__u8 tx_win;
__u8 max_tx;
__u16 retrans_timeout;
__u16 monitor_timeout;
__u16 mps;
__le16 sport; __le16 sport;
struct l2cap_conn *conn; struct l2cap_conn *conn;
...@@ -452,7 +452,7 @@ int __l2cap_wait_ack(struct sock *sk); ...@@ -452,7 +452,7 @@ int __l2cap_wait_ack(struct sock *sk);
struct sk_buff *l2cap_create_connless_pdu(struct sock *sk, struct msghdr *msg, size_t len); struct sk_buff *l2cap_create_connless_pdu(struct sock *sk, struct msghdr *msg, size_t len);
struct sk_buff *l2cap_create_basic_pdu(struct sock *sk, struct msghdr *msg, size_t len); struct sk_buff *l2cap_create_basic_pdu(struct sock *sk, struct msghdr *msg, size_t len);
struct sk_buff *l2cap_create_iframe_pdu(struct sock *sk, struct msghdr *msg, size_t len, u16 control, u16 sdulen); struct sk_buff *l2cap_create_iframe_pdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len, u16 control, u16 sdulen);
int l2cap_sar_segment_sdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len); int l2cap_sar_segment_sdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len);
void l2cap_do_send(struct l2cap_chan *chan, struct sk_buff *skb); void l2cap_do_send(struct l2cap_chan *chan, struct sk_buff *skb);
void l2cap_streaming_send(struct l2cap_chan *chan); void l2cap_streaming_send(struct l2cap_chan *chan);
......
This diff is collapsed.
...@@ -403,9 +403,9 @@ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname, char __us ...@@ -403,9 +403,9 @@ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname, char __us
opts.omtu = l2cap_pi(sk)->omtu; opts.omtu = l2cap_pi(sk)->omtu;
opts.flush_to = l2cap_pi(sk)->flush_to; opts.flush_to = l2cap_pi(sk)->flush_to;
opts.mode = l2cap_pi(sk)->mode; opts.mode = l2cap_pi(sk)->mode;
opts.fcs = l2cap_pi(sk)->fcs; opts.fcs = chan->fcs;
opts.max_tx = l2cap_pi(sk)->max_tx; opts.max_tx = chan->max_tx;
opts.txwin_size = (__u16)l2cap_pi(sk)->tx_win; opts.txwin_size = (__u16)chan->tx_win;
len = min_t(unsigned int, len, sizeof(opts)); len = min_t(unsigned int, len, sizeof(opts));
if (copy_to_user(optval, (char *) &opts, len)) if (copy_to_user(optval, (char *) &opts, len))
...@@ -551,9 +551,9 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us ...@@ -551,9 +551,9 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us
opts.omtu = l2cap_pi(sk)->omtu; opts.omtu = l2cap_pi(sk)->omtu;
opts.flush_to = l2cap_pi(sk)->flush_to; opts.flush_to = l2cap_pi(sk)->flush_to;
opts.mode = l2cap_pi(sk)->mode; opts.mode = l2cap_pi(sk)->mode;
opts.fcs = l2cap_pi(sk)->fcs; opts.fcs = chan->fcs;
opts.max_tx = l2cap_pi(sk)->max_tx; opts.max_tx = chan->max_tx;
opts.txwin_size = (__u16)l2cap_pi(sk)->tx_win; opts.txwin_size = (__u16)chan->tx_win;
len = min_t(unsigned int, sizeof(opts), optlen); len = min_t(unsigned int, sizeof(opts), optlen);
if (copy_from_user((char *) &opts, optval, len)) { if (copy_from_user((char *) &opts, optval, len)) {
...@@ -583,9 +583,9 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us ...@@ -583,9 +583,9 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us
l2cap_pi(sk)->imtu = opts.imtu; l2cap_pi(sk)->imtu = opts.imtu;
l2cap_pi(sk)->omtu = opts.omtu; l2cap_pi(sk)->omtu = opts.omtu;
l2cap_pi(sk)->fcs = opts.fcs; chan->fcs = opts.fcs;
l2cap_pi(sk)->max_tx = opts.max_tx; chan->max_tx = opts.max_tx;
l2cap_pi(sk)->tx_win = (__u8)opts.txwin_size; chan->tx_win = (__u8)opts.txwin_size;
break; break;
case L2CAP_LM: case L2CAP_LM:
...@@ -764,7 +764,8 @@ static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct ms ...@@ -764,7 +764,8 @@ static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct ms
/* Entire SDU fits into one PDU */ /* Entire SDU fits into one PDU */
if (len <= pi->chan->remote_mps) { if (len <= pi->chan->remote_mps) {
control = L2CAP_SDU_UNSEGMENTED; control = L2CAP_SDU_UNSEGMENTED;
skb = l2cap_create_iframe_pdu(sk, msg, len, control, 0); skb = l2cap_create_iframe_pdu(pi->chan, msg, len,
control, 0);
if (IS_ERR(skb)) { if (IS_ERR(skb)) {
err = PTR_ERR(skb); err = PTR_ERR(skb);
goto done; goto done;
...@@ -998,9 +999,9 @@ void l2cap_sock_init(struct sock *sk, struct sock *parent) ...@@ -998,9 +999,9 @@ void l2cap_sock_init(struct sock *sk, struct sock *parent)
pi->omtu = l2cap_pi(parent)->omtu; pi->omtu = l2cap_pi(parent)->omtu;
chan->conf_state = pchan->conf_state; chan->conf_state = pchan->conf_state;
pi->mode = l2cap_pi(parent)->mode; pi->mode = l2cap_pi(parent)->mode;
pi->fcs = l2cap_pi(parent)->fcs; chan->fcs = pchan->fcs;
pi->max_tx = l2cap_pi(parent)->max_tx; chan->max_tx = pchan->max_tx;
pi->tx_win = l2cap_pi(parent)->tx_win; chan->tx_win = pchan->tx_win;
chan->sec_level = pchan->sec_level; chan->sec_level = pchan->sec_level;
chan->role_switch = pchan->role_switch; chan->role_switch = pchan->role_switch;
chan->force_reliable = pchan->force_reliable; chan->force_reliable = pchan->force_reliable;
...@@ -1014,9 +1015,9 @@ void l2cap_sock_init(struct sock *sk, struct sock *parent) ...@@ -1014,9 +1015,9 @@ void l2cap_sock_init(struct sock *sk, struct sock *parent)
} else { } else {
pi->mode = L2CAP_MODE_BASIC; pi->mode = L2CAP_MODE_BASIC;
} }
pi->max_tx = L2CAP_DEFAULT_MAX_TX; chan->max_tx = L2CAP_DEFAULT_MAX_TX;
pi->fcs = L2CAP_FCS_CRC16; chan->fcs = L2CAP_FCS_CRC16;
pi->tx_win = L2CAP_DEFAULT_TX_WINDOW; chan->tx_win = L2CAP_DEFAULT_TX_WINDOW;
chan->sec_level = BT_SECURITY_LOW; chan->sec_level = BT_SECURITY_LOW;
chan->role_switch = 0; chan->role_switch = 0;
chan->force_reliable = 0; chan->force_reliable = 0;
......
...@@ -711,7 +711,7 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, ...@@ -711,7 +711,7 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src,
sk = sock->sk; sk = sock->sk;
lock_sock(sk); lock_sock(sk);
l2cap_pi(sk)->imtu = l2cap_mtu; l2cap_pi(sk)->imtu = l2cap_mtu;
l2cap_pi(sk)->sec_level = sec_level; l2cap_pi(sk)->chan->sec_level = sec_level;
if (l2cap_ertm) if (l2cap_ertm)
l2cap_pi(sk)->mode = L2CAP_MODE_ERTM; l2cap_pi(sk)->mode = L2CAP_MODE_ERTM;
release_sock(sk); release_sock(sk);
......
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