Skip to content

Commit

Permalink
Bluetooth: Move more channel info to struct l2cap_chan
Browse files Browse the repository at this point in the history
In this commit, omtu, imtu, flush_to, mode and sport. It also remove the
pi var from l2cap_sock_sendmsg().

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
  • Loading branch information
Gustavo F. Padovan committed Apr 28, 2011
1 parent 47d1ec6 commit 0c1bc5c
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 110 deletions.
14 changes: 7 additions & 7 deletions include/net/bluetooth/l2cap.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,13 @@ struct srej_list {
struct l2cap_chan {
struct sock *sk;

__u16 imtu;
__u16 omtu;
__u16 flush_to;
__u8 mode;

__le16 sport;

__u8 sec_level;
__u8 role_switch;
__u8 force_reliable;
Expand Down Expand Up @@ -379,13 +386,6 @@ struct l2cap_pinfo {
__u16 dcid;
__u16 scid;

__u16 imtu;
__u16 omtu;
__u16 flush_to;
__u8 mode;

__le16 sport;

struct l2cap_conn *conn;
struct l2cap_chan *chan;
};
Expand Down
3 changes: 2 additions & 1 deletion net/bluetooth/cmtp/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock)

bacpy(&session->bdaddr, &bt_sk(sock->sk)->dst);

session->mtu = min_t(uint, l2cap_pi(sock->sk)->omtu, l2cap_pi(sock->sk)->imtu);
session->mtu = min_t(uint, l2cap_pi(sock->sk)->chan->omtu,
l2cap_pi(sock->sk)->chan->imtu);

BT_DBG("mtu %d", session->mtu);

Expand Down
6 changes: 4 additions & 2 deletions net/bluetooth/hidp/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -979,8 +979,10 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock,

bacpy(&session->bdaddr, &bt_sk(ctrl_sock->sk)->dst);

session->ctrl_mtu = min_t(uint, l2cap_pi(ctrl_sock->sk)->omtu, l2cap_pi(ctrl_sock->sk)->imtu);
session->intr_mtu = min_t(uint, l2cap_pi(intr_sock->sk)->omtu, l2cap_pi(intr_sock->sk)->imtu);
session->ctrl_mtu = min_t(uint, l2cap_pi(ctrl_sock->sk)->chan->omtu,
l2cap_pi(ctrl_sock->sk)->chan->imtu);
session->intr_mtu = min_t(uint, l2cap_pi(intr_sock->sk)->chan->omtu,
l2cap_pi(intr_sock->sk)->chan->imtu);

BT_DBG("ctrl mtu %d intr mtu %d", session->ctrl_mtu, session->intr_mtu);

Expand Down
Loading

0 comments on commit 0c1bc5c

Please sign in to comment.