Lines Matching refs:s
53 static int rfcomm_send_frame(struct rfcomm_session *s, u8 *data, int len);
54 static int rfcomm_send_sabm(struct rfcomm_session *s, u8 dlci);
55 static int rfcomm_send_disc(struct rfcomm_session *s, u8 dlci);
57 static int rfcomm_send_nsc(struct rfcomm_session *s, int cr, u8 type);
58 static int rfcomm_send_pn(struct rfcomm_session *s, int cr, struct rfcomm_dlc *d);
59 static int rfcomm_send_msc(struct rfcomm_session *s, int cr, u8 dlci, u8 v24_sig);
60 static int rfcomm_send_test(struct rfcomm_session *s, int cr, u8 *pattern, int len);
61 static int rfcomm_send_credits(struct rfcomm_session *s, u8 addr, u8 credits);
64 static void rfcomm_process_connect(struct rfcomm_session *s);
71 static struct rfcomm_session *rfcomm_session_del(struct rfcomm_session *s);
81 #define __session_dir(s) ((s)->initiator ? 0x00 : 0x01) argument
234 struct rfcomm_session *s = from_timer(s, t, timer); in rfcomm_session_timeout() local
236 BT_DBG("session %p state %ld", s, s->state); in rfcomm_session_timeout()
238 set_bit(RFCOMM_TIMED_OUT, &s->flags); in rfcomm_session_timeout()
242 static void rfcomm_session_set_timer(struct rfcomm_session *s, long timeout) in rfcomm_session_set_timer() argument
244 BT_DBG("session %p state %ld timeout %ld", s, s->state, timeout); in rfcomm_session_set_timer()
246 mod_timer(&s->timer, jiffies + timeout); in rfcomm_session_set_timer()
249 static void rfcomm_session_clear_timer(struct rfcomm_session *s) in rfcomm_session_clear_timer() argument
251 BT_DBG("session %p state %ld", s, s->state); in rfcomm_session_clear_timer()
253 del_timer_sync(&s->timer); in rfcomm_session_clear_timer()
327 static void rfcomm_dlc_link(struct rfcomm_session *s, struct rfcomm_dlc *d) in rfcomm_dlc_link() argument
329 BT_DBG("dlc %p session %p", d, s); in rfcomm_dlc_link()
331 rfcomm_session_clear_timer(s); in rfcomm_dlc_link()
333 list_add(&d->list, &s->dlcs); in rfcomm_dlc_link()
334 d->session = s; in rfcomm_dlc_link()
339 struct rfcomm_session *s = d->session; in rfcomm_dlc_unlink() local
341 BT_DBG("dlc %p refcnt %d session %p", d, refcount_read(&d->refcnt), s); in rfcomm_dlc_unlink()
347 if (list_empty(&s->dlcs)) in rfcomm_dlc_unlink()
348 rfcomm_session_set_timer(s, RFCOMM_IDLE_TIMEOUT); in rfcomm_dlc_unlink()
351 static struct rfcomm_dlc *rfcomm_dlc_get(struct rfcomm_session *s, u8 dlci) in rfcomm_dlc_get() argument
355 list_for_each_entry(d, &s->dlcs, list) in rfcomm_dlc_get()
369 struct rfcomm_session *s; in __rfcomm_dlc_open() local
382 s = rfcomm_session_get(src, dst); in __rfcomm_dlc_open()
383 if (!s) { in __rfcomm_dlc_open()
384 s = rfcomm_session_create(src, dst, d->sec_level, &err); in __rfcomm_dlc_open()
385 if (!s) in __rfcomm_dlc_open()
389 dlci = __dlci(__session_dir(s), channel); in __rfcomm_dlc_open()
392 if (rfcomm_dlc_get(s, dlci)) in __rfcomm_dlc_open()
398 d->addr = __addr(s->initiator, dlci); in __rfcomm_dlc_open()
402 rfcomm_dlc_link(s, d); in __rfcomm_dlc_open()
406 d->mtu = s->mtu; in __rfcomm_dlc_open()
407 d->cfc = (s->cfc == RFCOMM_CFC_UNKNOWN) ? 0 : s->cfc; in __rfcomm_dlc_open()
409 if (s->state == BT_CONNECTED) { in __rfcomm_dlc_open()
411 rfcomm_send_pn(s, 1, d); in __rfcomm_dlc_open()
435 struct rfcomm_session *s = d->session; in __rfcomm_dlc_disconn() local
439 rfcomm_send_disc(s, d->dlci); in __rfcomm_dlc_disconn()
449 struct rfcomm_session *s = d->session; in __rfcomm_dlc_close() local
450 if (!s) in __rfcomm_dlc_close()
454 d, d->state, d->dlci, err, s); in __rfcomm_dlc_close()
475 if (s->state != BT_BOUND) { in __rfcomm_dlc_close()
503 struct rfcomm_session *s, *s_list; in rfcomm_dlc_close() local
509 s = d->session; in rfcomm_dlc_close()
510 if (!s) in rfcomm_dlc_close()
517 if (s_list == s) { in rfcomm_dlc_close()
518 list_for_each_entry(d_list, &s->dlcs, list) { in rfcomm_dlc_close()
535 struct rfcomm_session *s; in rfcomm_dlc_exists() local
543 s = rfcomm_session_get(src, dst); in rfcomm_dlc_exists()
544 if (s) { in rfcomm_dlc_exists()
545 dlci = __dlci(__session_dir(s), channel); in rfcomm_dlc_exists()
546 dlc = rfcomm_dlc_get(s, dlci); in rfcomm_dlc_exists()
679 struct rfcomm_session *s = kzalloc(sizeof(*s), GFP_KERNEL); in rfcomm_session_add() local
681 if (!s) in rfcomm_session_add()
684 BT_DBG("session %p sock %p", s, sock); in rfcomm_session_add()
686 timer_setup(&s->timer, rfcomm_session_timeout, 0); in rfcomm_session_add()
688 INIT_LIST_HEAD(&s->dlcs); in rfcomm_session_add()
689 s->state = state; in rfcomm_session_add()
690 s->sock = sock; in rfcomm_session_add()
692 s->mtu = RFCOMM_DEFAULT_MTU; in rfcomm_session_add()
693 s->cfc = disable_cfc ? RFCOMM_CFC_DISABLED : RFCOMM_CFC_UNKNOWN; in rfcomm_session_add()
699 kfree(s); in rfcomm_session_add()
703 list_add(&s->list, &session_list); in rfcomm_session_add()
705 return s; in rfcomm_session_add()
708 static struct rfcomm_session *rfcomm_session_del(struct rfcomm_session *s) in rfcomm_session_del() argument
710 int state = s->state; in rfcomm_session_del()
712 BT_DBG("session %p state %ld", s, s->state); in rfcomm_session_del()
714 list_del(&s->list); in rfcomm_session_del()
716 rfcomm_session_clear_timer(s); in rfcomm_session_del()
717 sock_release(s->sock); in rfcomm_session_del()
718 kfree(s); in rfcomm_session_del()
728 struct rfcomm_session *s, *n; in rfcomm_session_get() local
730 list_for_each_entry_safe(s, n, &session_list, list) { in rfcomm_session_get()
731 chan = l2cap_pi(s->sock->sk)->chan; in rfcomm_session_get()
735 return s; in rfcomm_session_get()
740 static struct rfcomm_session *rfcomm_session_close(struct rfcomm_session *s, in rfcomm_session_close() argument
745 s->state = BT_CLOSED; in rfcomm_session_close()
747 BT_DBG("session %p state %ld err %d", s, s->state, err); in rfcomm_session_close()
750 list_for_each_entry_safe(d, n, &s->dlcs, list) { in rfcomm_session_close()
755 rfcomm_session_clear_timer(s); in rfcomm_session_close()
756 return rfcomm_session_del(s); in rfcomm_session_close()
764 struct rfcomm_session *s = NULL; in rfcomm_session_create() local
794 s = rfcomm_session_add(sock, BT_BOUND); in rfcomm_session_create()
795 if (!s) { in rfcomm_session_create()
800 s->initiator = 1; in rfcomm_session_create()
809 return s; in rfcomm_session_create()
811 return rfcomm_session_del(s); in rfcomm_session_create()
818 void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src, bdaddr_t *dst) in rfcomm_session_getaddr() argument
820 struct l2cap_chan *chan = l2cap_pi(s->sock->sk)->chan; in rfcomm_session_getaddr()
828 static int rfcomm_send_frame(struct rfcomm_session *s, u8 *data, int len) in rfcomm_send_frame() argument
833 BT_DBG("session %p len %d", s, len); in rfcomm_send_frame()
837 return kernel_sendmsg(s->sock, &msg, &iv, 1, len); in rfcomm_send_frame()
840 static int rfcomm_send_cmd(struct rfcomm_session *s, struct rfcomm_cmd *cmd) in rfcomm_send_cmd() argument
842 BT_DBG("%p cmd %u", s, cmd->ctrl); in rfcomm_send_cmd()
844 return rfcomm_send_frame(s, (void *) cmd, sizeof(*cmd)); in rfcomm_send_cmd()
847 static int rfcomm_send_sabm(struct rfcomm_session *s, u8 dlci) in rfcomm_send_sabm() argument
851 BT_DBG("%p dlci %d", s, dlci); in rfcomm_send_sabm()
853 cmd.addr = __addr(s->initiator, dlci); in rfcomm_send_sabm()
858 return rfcomm_send_cmd(s, &cmd); in rfcomm_send_sabm()
861 static int rfcomm_send_ua(struct rfcomm_session *s, u8 dlci) in rfcomm_send_ua() argument
865 BT_DBG("%p dlci %d", s, dlci); in rfcomm_send_ua()
867 cmd.addr = __addr(!s->initiator, dlci); in rfcomm_send_ua()
872 return rfcomm_send_cmd(s, &cmd); in rfcomm_send_ua()
875 static int rfcomm_send_disc(struct rfcomm_session *s, u8 dlci) in rfcomm_send_disc() argument
879 BT_DBG("%p dlci %d", s, dlci); in rfcomm_send_disc()
881 cmd.addr = __addr(s->initiator, dlci); in rfcomm_send_disc()
886 return rfcomm_send_cmd(s, &cmd); in rfcomm_send_disc()
911 static int rfcomm_send_dm(struct rfcomm_session *s, u8 dlci) in rfcomm_send_dm() argument
915 BT_DBG("%p dlci %d", s, dlci); in rfcomm_send_dm()
917 cmd.addr = __addr(!s->initiator, dlci); in rfcomm_send_dm()
922 return rfcomm_send_cmd(s, &cmd); in rfcomm_send_dm()
925 static int rfcomm_send_nsc(struct rfcomm_session *s, int cr, u8 type) in rfcomm_send_nsc() argument
931 BT_DBG("%p cr %d type %d", s, cr, type); in rfcomm_send_nsc()
934 hdr->addr = __addr(s->initiator, 0); in rfcomm_send_nsc()
947 return rfcomm_send_frame(s, buf, ptr - buf); in rfcomm_send_nsc()
950 static int rfcomm_send_pn(struct rfcomm_session *s, int cr, struct rfcomm_dlc *d) in rfcomm_send_pn() argument
957 BT_DBG("%p cr %d dlci %d mtu %d", s, cr, d->dlci, d->mtu); in rfcomm_send_pn()
960 hdr->addr = __addr(s->initiator, 0); in rfcomm_send_pn()
974 if (s->cfc) { in rfcomm_send_pn()
989 return rfcomm_send_frame(s, buf, ptr - buf); in rfcomm_send_pn()
992 int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, in rfcomm_send_rpn() argument
1004 s, cr, dlci, bit_rate, data_bits, stop_bits, parity, in rfcomm_send_rpn()
1008 hdr->addr = __addr(s->initiator, 0); in rfcomm_send_rpn()
1027 return rfcomm_send_frame(s, buf, ptr - buf); in rfcomm_send_rpn()
1030 static int rfcomm_send_rls(struct rfcomm_session *s, int cr, u8 dlci, u8 status) in rfcomm_send_rls() argument
1037 BT_DBG("%p cr %d status 0x%x", s, cr, status); in rfcomm_send_rls()
1040 hdr->addr = __addr(s->initiator, 0); in rfcomm_send_rls()
1054 return rfcomm_send_frame(s, buf, ptr - buf); in rfcomm_send_rls()
1057 static int rfcomm_send_msc(struct rfcomm_session *s, int cr, u8 dlci, u8 v24_sig) in rfcomm_send_msc() argument
1064 BT_DBG("%p cr %d v24 0x%x", s, cr, v24_sig); in rfcomm_send_msc()
1067 hdr->addr = __addr(s->initiator, 0); in rfcomm_send_msc()
1081 return rfcomm_send_frame(s, buf, ptr - buf); in rfcomm_send_msc()
1084 static int rfcomm_send_fcoff(struct rfcomm_session *s, int cr) in rfcomm_send_fcoff() argument
1090 BT_DBG("%p cr %d", s, cr); in rfcomm_send_fcoff()
1093 hdr->addr = __addr(s->initiator, 0); in rfcomm_send_fcoff()
1103 return rfcomm_send_frame(s, buf, ptr - buf); in rfcomm_send_fcoff()
1106 static int rfcomm_send_fcon(struct rfcomm_session *s, int cr) in rfcomm_send_fcon() argument
1112 BT_DBG("%p cr %d", s, cr); in rfcomm_send_fcon()
1115 hdr->addr = __addr(s->initiator, 0); in rfcomm_send_fcon()
1125 return rfcomm_send_frame(s, buf, ptr - buf); in rfcomm_send_fcon()
1128 static int rfcomm_send_test(struct rfcomm_session *s, int cr, u8 *pattern, int len) in rfcomm_send_test() argument
1130 struct socket *sock = s->sock; in rfcomm_send_test()
1138 BT_DBG("%p cr %d", s, cr); in rfcomm_send_test()
1140 hdr[0] = __addr(s->initiator, 0); in rfcomm_send_test()
1160 static int rfcomm_send_credits(struct rfcomm_session *s, u8 addr, u8 credits) in rfcomm_send_credits() argument
1165 BT_DBG("%p addr %d credits %d", s, addr, credits); in rfcomm_send_credits()
1176 return rfcomm_send_frame(s, buf, ptr - buf); in rfcomm_send_credits()
1200 static struct rfcomm_session *rfcomm_recv_ua(struct rfcomm_session *s, u8 dlci) in rfcomm_recv_ua() argument
1202 BT_DBG("session %p state %ld dlci %d", s, s->state, dlci); in rfcomm_recv_ua()
1206 struct rfcomm_dlc *d = rfcomm_dlc_get(s, dlci); in rfcomm_recv_ua()
1208 rfcomm_send_dm(s, dlci); in rfcomm_recv_ua()
1209 return s; in rfcomm_recv_ua()
1221 rfcomm_send_msc(s, 1, dlci, d->v24_sig); in rfcomm_recv_ua()
1228 if (list_empty(&s->dlcs)) { in rfcomm_recv_ua()
1229 s->state = BT_DISCONN; in rfcomm_recv_ua()
1230 rfcomm_send_disc(s, 0); in rfcomm_recv_ua()
1231 rfcomm_session_clear_timer(s); in rfcomm_recv_ua()
1238 switch (s->state) { in rfcomm_recv_ua()
1240 s->state = BT_CONNECTED; in rfcomm_recv_ua()
1241 rfcomm_process_connect(s); in rfcomm_recv_ua()
1245 s = rfcomm_session_close(s, ECONNRESET); in rfcomm_recv_ua()
1249 return s; in rfcomm_recv_ua()
1252 static struct rfcomm_session *rfcomm_recv_dm(struct rfcomm_session *s, u8 dlci) in rfcomm_recv_dm() argument
1256 BT_DBG("session %p state %ld dlci %d", s, s->state, dlci); in rfcomm_recv_dm()
1260 struct rfcomm_dlc *d = rfcomm_dlc_get(s, dlci); in rfcomm_recv_dm()
1271 if (s->state == BT_CONNECT) in rfcomm_recv_dm()
1276 s = rfcomm_session_close(s, err); in rfcomm_recv_dm()
1278 return s; in rfcomm_recv_dm()
1281 static struct rfcomm_session *rfcomm_recv_disc(struct rfcomm_session *s, in rfcomm_recv_disc() argument
1286 BT_DBG("session %p state %ld dlci %d", s, s->state, dlci); in rfcomm_recv_disc()
1289 struct rfcomm_dlc *d = rfcomm_dlc_get(s, dlci); in rfcomm_recv_disc()
1291 rfcomm_send_ua(s, dlci); in rfcomm_recv_disc()
1301 rfcomm_send_dm(s, dlci); in rfcomm_recv_disc()
1304 rfcomm_send_ua(s, 0); in rfcomm_recv_disc()
1306 if (s->state == BT_CONNECT) in rfcomm_recv_disc()
1311 s = rfcomm_session_close(s, err); in rfcomm_recv_disc()
1313 return s; in rfcomm_recv_disc()
1357 static int rfcomm_recv_sabm(struct rfcomm_session *s, u8 dlci) in rfcomm_recv_sabm() argument
1362 BT_DBG("session %p state %ld dlci %d", s, s->state, dlci); in rfcomm_recv_sabm()
1365 rfcomm_send_ua(s, 0); in rfcomm_recv_sabm()
1367 if (s->state == BT_OPEN) { in rfcomm_recv_sabm()
1368 s->state = BT_CONNECTED; in rfcomm_recv_sabm()
1369 rfcomm_process_connect(s); in rfcomm_recv_sabm()
1375 d = rfcomm_dlc_get(s, dlci); in rfcomm_recv_sabm()
1386 if (rfcomm_connect_ind(s, channel, &d)) { in rfcomm_recv_sabm()
1388 d->addr = __addr(s->initiator, dlci); in rfcomm_recv_sabm()
1389 rfcomm_dlc_link(s, d); in rfcomm_recv_sabm()
1393 rfcomm_send_dm(s, dlci); in rfcomm_recv_sabm()
1401 struct rfcomm_session *s = d->session; in rfcomm_apply_pn() local
1406 if ((pn->flow_ctrl == 0xf0 && s->cfc != RFCOMM_CFC_DISABLED) || in rfcomm_apply_pn()
1415 if (s->cfc == RFCOMM_CFC_UNKNOWN) in rfcomm_apply_pn()
1416 s->cfc = d->cfc; in rfcomm_apply_pn()
1422 if (cr && d->mtu > s->mtu) in rfcomm_apply_pn()
1423 d->mtu = s->mtu; in rfcomm_apply_pn()
1428 static int rfcomm_recv_pn(struct rfcomm_session *s, int cr, struct sk_buff *skb) in rfcomm_recv_pn() argument
1434 BT_DBG("session %p state %ld dlci %d", s, s->state, dlci); in rfcomm_recv_pn()
1439 d = rfcomm_dlc_get(s, dlci); in rfcomm_recv_pn()
1444 rfcomm_send_pn(s, 0, d); in rfcomm_recv_pn()
1452 rfcomm_send_sabm(s, d->dlci); in rfcomm_recv_pn()
1464 if (rfcomm_connect_ind(s, channel, &d)) { in rfcomm_recv_pn()
1466 d->addr = __addr(s->initiator, dlci); in rfcomm_recv_pn()
1467 rfcomm_dlc_link(s, d); in rfcomm_recv_pn()
1472 rfcomm_send_pn(s, 0, d); in rfcomm_recv_pn()
1474 rfcomm_send_dm(s, dlci); in rfcomm_recv_pn()
1480 static int rfcomm_recv_rpn(struct rfcomm_session *s, int cr, int len, struct sk_buff *skb) in rfcomm_recv_rpn() argument
1580 rfcomm_send_rpn(s, 0, dlci, bit_rate, data_bits, stop_bits, in rfcomm_recv_rpn()
1586 static int rfcomm_recv_rls(struct rfcomm_session *s, int cr, struct sk_buff *skb) in rfcomm_recv_rls() argument
1600 rfcomm_send_rls(s, 0, dlci, rls->status); in rfcomm_recv_rls()
1605 static int rfcomm_recv_msc(struct rfcomm_session *s, int cr, struct sk_buff *skb) in rfcomm_recv_msc() argument
1613 d = rfcomm_dlc_get(s, dlci); in rfcomm_recv_msc()
1632 rfcomm_send_msc(s, 0, dlci, msc->v24_sig); in rfcomm_recv_msc()
1641 static int rfcomm_recv_mcc(struct rfcomm_session *s, struct sk_buff *skb) in rfcomm_recv_mcc() argument
1650 BT_DBG("%p type 0x%x cr %d", s, type, cr); in rfcomm_recv_mcc()
1656 rfcomm_recv_pn(s, cr, skb); in rfcomm_recv_mcc()
1660 rfcomm_recv_rpn(s, cr, len, skb); in rfcomm_recv_mcc()
1664 rfcomm_recv_rls(s, cr, skb); in rfcomm_recv_mcc()
1668 rfcomm_recv_msc(s, cr, skb); in rfcomm_recv_mcc()
1673 set_bit(RFCOMM_TX_THROTTLED, &s->flags); in rfcomm_recv_mcc()
1674 rfcomm_send_fcoff(s, 0); in rfcomm_recv_mcc()
1680 clear_bit(RFCOMM_TX_THROTTLED, &s->flags); in rfcomm_recv_mcc()
1681 rfcomm_send_fcon(s, 0); in rfcomm_recv_mcc()
1687 rfcomm_send_test(s, 0, skb->data, skb->len); in rfcomm_recv_mcc()
1695 rfcomm_send_nsc(s, cr, type); in rfcomm_recv_mcc()
1701 static int rfcomm_recv_data(struct rfcomm_session *s, u8 dlci, int pf, struct sk_buff *skb) in rfcomm_recv_data() argument
1705 BT_DBG("session %p state %ld dlci %d pf %d", s, s->state, dlci, pf); in rfcomm_recv_data()
1707 d = rfcomm_dlc_get(s, dlci); in rfcomm_recv_data()
1709 rfcomm_send_dm(s, dlci); in rfcomm_recv_data()
1734 static struct rfcomm_session *rfcomm_recv_frame(struct rfcomm_session *s, in rfcomm_recv_frame() argument
1740 if (!s) { in rfcomm_recv_frame()
1743 return s; in rfcomm_recv_frame()
1756 return s; in rfcomm_recv_frame()
1767 rfcomm_recv_sabm(s, dlci); in rfcomm_recv_frame()
1772 s = rfcomm_recv_disc(s, dlci); in rfcomm_recv_frame()
1777 s = rfcomm_recv_ua(s, dlci); in rfcomm_recv_frame()
1781 s = rfcomm_recv_dm(s, dlci); in rfcomm_recv_frame()
1786 rfcomm_recv_data(s, dlci, __test_pf(hdr->ctrl), skb); in rfcomm_recv_frame()
1787 return s; in rfcomm_recv_frame()
1789 rfcomm_recv_mcc(s, skb); in rfcomm_recv_frame()
1797 return s; in rfcomm_recv_frame()
1802 static void rfcomm_process_connect(struct rfcomm_session *s) in rfcomm_process_connect() argument
1806 BT_DBG("session %p state %ld", s, s->state); in rfcomm_process_connect()
1808 list_for_each_entry_safe(d, n, &s->dlcs, list) { in rfcomm_process_connect()
1810 d->mtu = s->mtu; in rfcomm_process_connect()
1812 rfcomm_send_pn(s, 1, d); in rfcomm_process_connect()
1872 static void rfcomm_process_dlcs(struct rfcomm_session *s) in rfcomm_process_dlcs() argument
1876 BT_DBG("session %p state %ld", s, s->state); in rfcomm_process_dlcs()
1878 list_for_each_entry_safe(d, n, &s->dlcs, list) { in rfcomm_process_dlcs()
1892 rfcomm_send_pn(s, 1, d); in rfcomm_process_dlcs()
1910 rfcomm_send_dm(s, d->dlci); in rfcomm_process_dlcs()
1920 if (test_bit(RFCOMM_TX_THROTTLED, &s->flags)) in rfcomm_process_dlcs()
1929 static struct rfcomm_session *rfcomm_process_rx(struct rfcomm_session *s) in rfcomm_process_rx() argument
1931 struct socket *sock = s->sock; in rfcomm_process_rx()
1935 BT_DBG("session %p state %ld qlen %d", s, s->state, skb_queue_len(&sk->sk_receive_queue)); in rfcomm_process_rx()
1941 s = rfcomm_recv_frame(s, skb); in rfcomm_process_rx()
1942 if (!s) in rfcomm_process_rx()
1949 if (s && (sk->sk_state == BT_CLOSED)) in rfcomm_process_rx()
1950 s = rfcomm_session_close(s, sk->sk_err); in rfcomm_process_rx()
1952 return s; in rfcomm_process_rx()
1955 static void rfcomm_accept_connection(struct rfcomm_session *s) in rfcomm_accept_connection() argument
1957 struct socket *sock = s->sock, *nsock; in rfcomm_accept_connection()
1965 BT_DBG("session %p", s); in rfcomm_accept_connection()
1975 s = rfcomm_session_add(nsock, BT_OPEN); in rfcomm_accept_connection()
1976 if (s) { in rfcomm_accept_connection()
1979 s->mtu = min(l2cap_pi(nsock->sk)->chan->omtu, in rfcomm_accept_connection()
1987 static struct rfcomm_session *rfcomm_check_connection(struct rfcomm_session *s) in rfcomm_check_connection() argument
1989 struct sock *sk = s->sock->sk; in rfcomm_check_connection()
1991 BT_DBG("%p state %ld", s, s->state); in rfcomm_check_connection()
1995 s->state = BT_CONNECT; in rfcomm_check_connection()
1999 s->mtu = min(l2cap_pi(sk)->chan->omtu, l2cap_pi(sk)->chan->imtu) - 5; in rfcomm_check_connection()
2001 rfcomm_send_sabm(s, 0); in rfcomm_check_connection()
2005 s = rfcomm_session_close(s, sk->sk_err); in rfcomm_check_connection()
2008 return s; in rfcomm_check_connection()
2013 struct rfcomm_session *s, *n; in rfcomm_process_sessions() local
2017 list_for_each_entry_safe(s, n, &session_list, list) { in rfcomm_process_sessions()
2018 if (test_and_clear_bit(RFCOMM_TIMED_OUT, &s->flags)) { in rfcomm_process_sessions()
2019 s->state = BT_DISCONN; in rfcomm_process_sessions()
2020 rfcomm_send_disc(s, 0); in rfcomm_process_sessions()
2024 switch (s->state) { in rfcomm_process_sessions()
2026 rfcomm_accept_connection(s); in rfcomm_process_sessions()
2030 s = rfcomm_check_connection(s); in rfcomm_process_sessions()
2034 s = rfcomm_process_rx(s); in rfcomm_process_sessions()
2038 if (s) in rfcomm_process_sessions()
2039 rfcomm_process_dlcs(s); in rfcomm_process_sessions()
2050 struct rfcomm_session *s; in rfcomm_add_listener() local
2087 s = rfcomm_session_add(sock, BT_LISTEN); in rfcomm_add_listener()
2088 if (!s) { in rfcomm_add_listener()
2101 struct rfcomm_session *s, *n; in rfcomm_kill_listener() local
2105 list_for_each_entry_safe(s, n, &session_list, list) in rfcomm_kill_listener()
2106 rfcomm_session_del(s); in rfcomm_kill_listener()
2135 struct rfcomm_session *s; in rfcomm_security_cfm() local
2140 s = rfcomm_session_get(&conn->hdev->bdaddr, &conn->dst); in rfcomm_security_cfm()
2141 if (!s) in rfcomm_security_cfm()
2144 list_for_each_entry_safe(d, n, &s->dlcs, list) { in rfcomm_security_cfm()
2184 struct rfcomm_session *s; in rfcomm_dlc_debugfs_show() local
2188 list_for_each_entry(s, &session_list, list) { in rfcomm_dlc_debugfs_show()
2189 struct l2cap_chan *chan = l2cap_pi(s->sock->sk)->chan; in rfcomm_dlc_debugfs_show()
2191 list_for_each_entry(d, &s->dlcs, list) { in rfcomm_dlc_debugfs_show()