Skip to content

Commit 0c1bc5c

Browse files
author
Gustavo F. Padovan
committed
Bluetooth: Move more channel info to struct l2cap_chan
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>
1 parent 47d1ec6 commit 0c1bc5c

6 files changed

Lines changed: 121 additions & 110 deletions

File tree

‎include/net/bluetooth/l2cap.h‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,13 @@ struct srej_list {
285285
struct l2cap_chan {
286286
struct sock *sk;
287287

288+
__u16 imtu;
289+
__u16 omtu;
290+
__u16 flush_to;
291+
__u8 mode;
292+
293+
__le16 sport;
294+
288295
__u8 sec_level;
289296
__u8 role_switch;
290297
__u8 force_reliable;
@@ -379,13 +386,6 @@ struct l2cap_pinfo {
379386
__u16 dcid;
380387
__u16 scid;
381388

382-
__u16 imtu;
383-
__u16 omtu;
384-
__u16 flush_to;
385-
__u8 mode;
386-
387-
__le16 sport;
388-
389389
struct l2cap_conn *conn;
390390
struct l2cap_chan *chan;
391391
};

‎net/bluetooth/cmtp/core.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,8 @@ int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock)
346346

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

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

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

‎net/bluetooth/hidp/core.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -979,8 +979,10 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock,
979979

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

982-
session->ctrl_mtu = min_t(uint, l2cap_pi(ctrl_sock->sk)->omtu, l2cap_pi(ctrl_sock->sk)->imtu);
983-
session->intr_mtu = min_t(uint, l2cap_pi(intr_sock->sk)->omtu, l2cap_pi(intr_sock->sk)->imtu);
982+
session->ctrl_mtu = min_t(uint, l2cap_pi(ctrl_sock->sk)->chan->omtu,
983+
l2cap_pi(ctrl_sock->sk)->chan->imtu);
984+
session->intr_mtu = min_t(uint, l2cap_pi(intr_sock->sk)->chan->omtu,
985+
l2cap_pi(intr_sock->sk)->chan->imtu);
984986

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

0 commit comments

Comments
 (0)