Lines Matching refs:d
57 static int rfcomm_queue_disc(struct rfcomm_dlc *d);
59 static int rfcomm_send_pn(struct rfcomm_session *s, int cr, struct rfcomm_dlc *d);
212 static int rfcomm_check_security(struct rfcomm_dlc *d) in rfcomm_check_security() argument
214 struct sock *sk = d->session->sock->sk; in rfcomm_check_security()
219 switch (d->sec_level) { in rfcomm_check_security()
232 return hci_conn_security(conn->hcon, d->sec_level, auth_type, in rfcomm_check_security()
233 d->out); in rfcomm_check_security()
263 struct rfcomm_dlc *d = (void *) arg; in rfcomm_dlc_timeout() local
265 BT_DBG("dlc %p state %ld", d, d->state); in rfcomm_dlc_timeout()
267 set_bit(RFCOMM_TIMED_OUT, &d->flags); in rfcomm_dlc_timeout()
268 rfcomm_dlc_put(d); in rfcomm_dlc_timeout()
272 static void rfcomm_dlc_set_timer(struct rfcomm_dlc *d, long timeout) in rfcomm_dlc_set_timer() argument
274 BT_DBG("dlc %p state %ld timeout %ld", d, d->state, timeout); in rfcomm_dlc_set_timer()
276 if (!mod_timer(&d->timer, jiffies + timeout)) in rfcomm_dlc_set_timer()
277 rfcomm_dlc_hold(d); in rfcomm_dlc_set_timer()
280 static void rfcomm_dlc_clear_timer(struct rfcomm_dlc *d) in rfcomm_dlc_clear_timer() argument
282 BT_DBG("dlc %p state %ld", d, d->state); in rfcomm_dlc_clear_timer()
284 if (del_timer(&d->timer)) in rfcomm_dlc_clear_timer()
285 rfcomm_dlc_put(d); in rfcomm_dlc_clear_timer()
288 static void rfcomm_dlc_clear_state(struct rfcomm_dlc *d) in rfcomm_dlc_clear_state() argument
290 BT_DBG("%p", d); in rfcomm_dlc_clear_state()
292 d->state = BT_OPEN; in rfcomm_dlc_clear_state()
293 d->flags = 0; in rfcomm_dlc_clear_state()
294 d->mscex = 0; in rfcomm_dlc_clear_state()
295 d->sec_level = BT_SECURITY_LOW; in rfcomm_dlc_clear_state()
296 d->mtu = RFCOMM_DEFAULT_MTU; in rfcomm_dlc_clear_state()
297 d->v24_sig = RFCOMM_V24_RTC | RFCOMM_V24_RTR | RFCOMM_V24_DV; in rfcomm_dlc_clear_state()
299 d->cfc = RFCOMM_CFC_DISABLED; in rfcomm_dlc_clear_state()
300 d->rx_credits = RFCOMM_DEFAULT_CREDITS; in rfcomm_dlc_clear_state()
305 struct rfcomm_dlc *d = kzalloc(sizeof(*d), prio); in rfcomm_dlc_alloc() local
307 if (!d) in rfcomm_dlc_alloc()
310 setup_timer(&d->timer, rfcomm_dlc_timeout, (unsigned long)d); in rfcomm_dlc_alloc()
312 skb_queue_head_init(&d->tx_queue); in rfcomm_dlc_alloc()
313 mutex_init(&d->lock); in rfcomm_dlc_alloc()
314 atomic_set(&d->refcnt, 1); in rfcomm_dlc_alloc()
316 rfcomm_dlc_clear_state(d); in rfcomm_dlc_alloc()
318 BT_DBG("%p", d); in rfcomm_dlc_alloc()
320 return d; in rfcomm_dlc_alloc()
323 void rfcomm_dlc_free(struct rfcomm_dlc *d) in rfcomm_dlc_free() argument
325 BT_DBG("%p", d); in rfcomm_dlc_free()
327 skb_queue_purge(&d->tx_queue); in rfcomm_dlc_free()
328 kfree(d); in rfcomm_dlc_free()
331 static void rfcomm_dlc_link(struct rfcomm_session *s, struct rfcomm_dlc *d) in rfcomm_dlc_link() argument
333 BT_DBG("dlc %p session %p", d, s); in rfcomm_dlc_link()
336 rfcomm_dlc_hold(d); in rfcomm_dlc_link()
337 list_add(&d->list, &s->dlcs); in rfcomm_dlc_link()
338 d->session = s; in rfcomm_dlc_link()
341 static void rfcomm_dlc_unlink(struct rfcomm_dlc *d) in rfcomm_dlc_unlink() argument
343 struct rfcomm_session *s = d->session; in rfcomm_dlc_unlink()
345 BT_DBG("dlc %p refcnt %d session %p", d, atomic_read(&d->refcnt), s); in rfcomm_dlc_unlink()
347 list_del(&d->list); in rfcomm_dlc_unlink()
348 d->session = NULL; in rfcomm_dlc_unlink()
349 rfcomm_dlc_put(d); in rfcomm_dlc_unlink()
357 struct rfcomm_dlc *d; in rfcomm_dlc_get() local
359 list_for_each_entry(d, &s->dlcs, list) in rfcomm_dlc_get()
360 if (d->dlci == dlci) in rfcomm_dlc_get()
361 return d; in rfcomm_dlc_get()
371 static int __rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, u8 channel) in __rfcomm_dlc_open() argument
378 d, d->state, src, dst, channel); in __rfcomm_dlc_open()
383 if (d->state != BT_OPEN && d->state != BT_CLOSED) in __rfcomm_dlc_open()
388 s = rfcomm_session_create(src, dst, d->sec_level, &err); in __rfcomm_dlc_open()
399 rfcomm_dlc_clear_state(d); in __rfcomm_dlc_open()
401 d->dlci = dlci; in __rfcomm_dlc_open()
402 d->addr = __addr(s->initiator, dlci); in __rfcomm_dlc_open()
403 d->priority = 7; in __rfcomm_dlc_open()
405 d->state = BT_CONFIG; in __rfcomm_dlc_open()
406 rfcomm_dlc_link(s, d); in __rfcomm_dlc_open()
408 d->out = 1; in __rfcomm_dlc_open()
410 d->mtu = s->mtu; in __rfcomm_dlc_open()
411 d->cfc = (s->cfc == RFCOMM_CFC_UNKNOWN) ? 0 : s->cfc; in __rfcomm_dlc_open()
414 if (rfcomm_check_security(d)) in __rfcomm_dlc_open()
415 rfcomm_send_pn(s, 1, d); in __rfcomm_dlc_open()
417 set_bit(RFCOMM_AUTH_PENDING, &d->flags); in __rfcomm_dlc_open()
420 rfcomm_dlc_set_timer(d, RFCOMM_CONN_TIMEOUT); in __rfcomm_dlc_open()
425 int rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, u8 channel) in rfcomm_dlc_open() argument
431 r = __rfcomm_dlc_open(d, src, dst, channel); in rfcomm_dlc_open()
437 static void __rfcomm_dlc_disconn(struct rfcomm_dlc *d) in __rfcomm_dlc_disconn() argument
439 struct rfcomm_session *s = d->session; in __rfcomm_dlc_disconn()
441 d->state = BT_DISCONN; in __rfcomm_dlc_disconn()
442 if (skb_queue_empty(&d->tx_queue)) { in __rfcomm_dlc_disconn()
443 rfcomm_send_disc(s, d->dlci); in __rfcomm_dlc_disconn()
444 rfcomm_dlc_set_timer(d, RFCOMM_DISC_TIMEOUT); in __rfcomm_dlc_disconn()
446 rfcomm_queue_disc(d); in __rfcomm_dlc_disconn()
447 rfcomm_dlc_set_timer(d, RFCOMM_DISC_TIMEOUT * 2); in __rfcomm_dlc_disconn()
451 static int __rfcomm_dlc_close(struct rfcomm_dlc *d, int err) in __rfcomm_dlc_close() argument
453 struct rfcomm_session *s = d->session; in __rfcomm_dlc_close()
458 d, d->state, d->dlci, err, s); in __rfcomm_dlc_close()
460 switch (d->state) { in __rfcomm_dlc_close()
465 if (test_and_clear_bit(RFCOMM_DEFER_SETUP, &d->flags)) { in __rfcomm_dlc_close()
466 set_bit(RFCOMM_AUTH_REJECT, &d->flags); in __rfcomm_dlc_close()
472 switch (d->state) { in __rfcomm_dlc_close()
475 __rfcomm_dlc_disconn(d); in __rfcomm_dlc_close()
480 __rfcomm_dlc_disconn(d); in __rfcomm_dlc_close()
488 rfcomm_dlc_clear_timer(d); in __rfcomm_dlc_close()
490 rfcomm_dlc_lock(d); in __rfcomm_dlc_close()
491 d->state = BT_CLOSED; in __rfcomm_dlc_close()
492 d->state_change(d, err); in __rfcomm_dlc_close()
493 rfcomm_dlc_unlock(d); in __rfcomm_dlc_close()
495 skb_queue_purge(&d->tx_queue); in __rfcomm_dlc_close()
496 rfcomm_dlc_unlink(d); in __rfcomm_dlc_close()
502 int rfcomm_dlc_close(struct rfcomm_dlc *d, int err) in rfcomm_dlc_close() argument
508 BT_DBG("dlc %p state %ld dlci %d err %d", d, d->state, d->dlci, err); in rfcomm_dlc_close()
512 s = d->session; in rfcomm_dlc_close()
522 if (d_list == d) { in rfcomm_dlc_close()
523 r = __rfcomm_dlc_close(d, err); in rfcomm_dlc_close()
555 int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb) in rfcomm_dlc_send() argument
559 if (d->state != BT_CONNECTED) in rfcomm_dlc_send()
562 BT_DBG("dlc %p mtu %d len %d", d, d->mtu, len); in rfcomm_dlc_send()
564 if (len > d->mtu) in rfcomm_dlc_send()
567 rfcomm_make_uih(skb, d->addr); in rfcomm_dlc_send()
568 skb_queue_tail(&d->tx_queue, skb); in rfcomm_dlc_send()
570 if (!test_bit(RFCOMM_TX_THROTTLED, &d->flags)) in rfcomm_dlc_send()
575 void rfcomm_dlc_send_noerror(struct rfcomm_dlc *d, struct sk_buff *skb) in rfcomm_dlc_send_noerror() argument
579 BT_DBG("dlc %p mtu %d len %d", d, d->mtu, len); in rfcomm_dlc_send_noerror()
581 rfcomm_make_uih(skb, d->addr); in rfcomm_dlc_send_noerror()
582 skb_queue_tail(&d->tx_queue, skb); in rfcomm_dlc_send_noerror()
584 if (d->state == BT_CONNECTED && in rfcomm_dlc_send_noerror()
585 !test_bit(RFCOMM_TX_THROTTLED, &d->flags)) in rfcomm_dlc_send_noerror()
589 void __rfcomm_dlc_throttle(struct rfcomm_dlc *d) in __rfcomm_dlc_throttle() argument
591 BT_DBG("dlc %p state %ld", d, d->state); in __rfcomm_dlc_throttle()
593 if (!d->cfc) { in __rfcomm_dlc_throttle()
594 d->v24_sig |= RFCOMM_V24_FC; in __rfcomm_dlc_throttle()
595 set_bit(RFCOMM_MSC_PENDING, &d->flags); in __rfcomm_dlc_throttle()
600 void __rfcomm_dlc_unthrottle(struct rfcomm_dlc *d) in __rfcomm_dlc_unthrottle() argument
602 BT_DBG("dlc %p state %ld", d, d->state); in __rfcomm_dlc_unthrottle()
604 if (!d->cfc) { in __rfcomm_dlc_unthrottle()
605 d->v24_sig &= ~RFCOMM_V24_FC; in __rfcomm_dlc_unthrottle()
606 set_bit(RFCOMM_MSC_PENDING, &d->flags); in __rfcomm_dlc_unthrottle()
616 int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig) in rfcomm_dlc_set_modem_status() argument
619 d, d->state, v24_sig); in rfcomm_dlc_set_modem_status()
621 if (test_bit(RFCOMM_RX_THROTTLED, &d->flags)) in rfcomm_dlc_set_modem_status()
626 d->v24_sig = v24_sig; in rfcomm_dlc_set_modem_status()
628 if (!test_and_set_bit(RFCOMM_MSC_PENDING, &d->flags)) in rfcomm_dlc_set_modem_status()
634 int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig) in rfcomm_dlc_get_modem_status() argument
637 d, d->state, d->v24_sig); in rfcomm_dlc_get_modem_status()
639 *v24_sig = d->v24_sig; in rfcomm_dlc_get_modem_status()
712 struct rfcomm_dlc *d; in rfcomm_session_close() local
721 d = list_entry(p, struct rfcomm_dlc, list); in rfcomm_session_close()
722 d->state = BT_CLOSED; in rfcomm_session_close()
723 __rfcomm_dlc_close(d, err); in rfcomm_session_close()
859 static int rfcomm_queue_disc(struct rfcomm_dlc *d) in rfcomm_queue_disc() argument
864 BT_DBG("dlc %p dlci %d", d, d->dlci); in rfcomm_queue_disc()
871 cmd->addr = d->addr; in rfcomm_queue_disc()
876 skb_queue_tail(&d->tx_queue, skb); in rfcomm_queue_disc()
920 static int rfcomm_send_pn(struct rfcomm_session *s, int cr, struct rfcomm_dlc *d) in rfcomm_send_pn() argument
927 BT_DBG("%p cr %d dlci %d mtu %d", s, cr, d->dlci, d->mtu); in rfcomm_send_pn()
939 pn->dlci = d->dlci; in rfcomm_send_pn()
940 pn->priority = d->priority; in rfcomm_send_pn()
955 pn->mtu = cpu_to_le16(d->mtu); in rfcomm_send_pn()
1176 struct rfcomm_dlc *d = rfcomm_dlc_get(s, dlci); in rfcomm_recv_ua() local
1177 if (!d) { in rfcomm_recv_ua()
1182 switch (d->state) { in rfcomm_recv_ua()
1184 rfcomm_dlc_clear_timer(d); in rfcomm_recv_ua()
1186 rfcomm_dlc_lock(d); in rfcomm_recv_ua()
1187 d->state = BT_CONNECTED; in rfcomm_recv_ua()
1188 d->state_change(d, 0); in rfcomm_recv_ua()
1189 rfcomm_dlc_unlock(d); in rfcomm_recv_ua()
1191 rfcomm_send_msc(s, 1, dlci, d->v24_sig); in rfcomm_recv_ua()
1195 d->state = BT_CLOSED; in rfcomm_recv_ua()
1196 __rfcomm_dlc_close(d, 0); in rfcomm_recv_ua()
1230 struct rfcomm_dlc *d = rfcomm_dlc_get(s, dlci); in rfcomm_recv_dm() local
1231 if (d) { in rfcomm_recv_dm()
1232 if (d->state == BT_CONNECT || d->state == BT_CONFIG) in rfcomm_recv_dm()
1237 d->state = BT_CLOSED; in rfcomm_recv_dm()
1238 __rfcomm_dlc_close(d, err); in rfcomm_recv_dm()
1259 struct rfcomm_dlc *d = rfcomm_dlc_get(s, dlci); in rfcomm_recv_disc() local
1260 if (d) { in rfcomm_recv_disc()
1263 if (d->state == BT_CONNECT || d->state == BT_CONFIG) in rfcomm_recv_disc()
1268 d->state = BT_CLOSED; in rfcomm_recv_disc()
1269 __rfcomm_dlc_close(d, err); in rfcomm_recv_disc()
1286 void rfcomm_dlc_accept(struct rfcomm_dlc *d) in rfcomm_dlc_accept() argument
1288 struct sock *sk = d->session->sock->sk; in rfcomm_dlc_accept()
1291 BT_DBG("dlc %p", d); in rfcomm_dlc_accept()
1293 rfcomm_send_ua(d->session, d->dlci); in rfcomm_dlc_accept()
1295 rfcomm_dlc_clear_timer(d); in rfcomm_dlc_accept()
1297 rfcomm_dlc_lock(d); in rfcomm_dlc_accept()
1298 d->state = BT_CONNECTED; in rfcomm_dlc_accept()
1299 d->state_change(d, 0); in rfcomm_dlc_accept()
1300 rfcomm_dlc_unlock(d); in rfcomm_dlc_accept()
1302 if (d->role_switch) in rfcomm_dlc_accept()
1305 rfcomm_send_msc(d->session, 1, d->dlci, d->v24_sig); in rfcomm_dlc_accept()
1308 static void rfcomm_check_accept(struct rfcomm_dlc *d) in rfcomm_check_accept() argument
1310 if (rfcomm_check_security(d)) { in rfcomm_check_accept()
1311 if (d->defer_setup) { in rfcomm_check_accept()
1312 set_bit(RFCOMM_DEFER_SETUP, &d->flags); in rfcomm_check_accept()
1313 rfcomm_dlc_set_timer(d, RFCOMM_AUTH_TIMEOUT); in rfcomm_check_accept()
1315 rfcomm_dlc_lock(d); in rfcomm_check_accept()
1316 d->state = BT_CONNECT2; in rfcomm_check_accept()
1317 d->state_change(d, 0); in rfcomm_check_accept()
1318 rfcomm_dlc_unlock(d); in rfcomm_check_accept()
1320 rfcomm_dlc_accept(d); in rfcomm_check_accept()
1322 set_bit(RFCOMM_AUTH_PENDING, &d->flags); in rfcomm_check_accept()
1323 rfcomm_dlc_set_timer(d, RFCOMM_AUTH_TIMEOUT); in rfcomm_check_accept()
1329 struct rfcomm_dlc *d; in rfcomm_recv_sabm() local
1345 d = rfcomm_dlc_get(s, dlci); in rfcomm_recv_sabm()
1346 if (d) { in rfcomm_recv_sabm()
1347 if (d->state == BT_OPEN) { in rfcomm_recv_sabm()
1349 rfcomm_check_accept(d); in rfcomm_recv_sabm()
1356 if (rfcomm_connect_ind(s, channel, &d)) { in rfcomm_recv_sabm()
1357 d->dlci = dlci; in rfcomm_recv_sabm()
1358 d->addr = __addr(s->initiator, dlci); in rfcomm_recv_sabm()
1359 rfcomm_dlc_link(s, d); in rfcomm_recv_sabm()
1361 rfcomm_check_accept(d); in rfcomm_recv_sabm()
1369 static int rfcomm_apply_pn(struct rfcomm_dlc *d, int cr, struct rfcomm_pn *pn) in rfcomm_apply_pn() argument
1371 struct rfcomm_session *s = d->session; in rfcomm_apply_pn()
1374 d, d->state, d->dlci, pn->mtu, pn->flow_ctrl, pn->credits); in rfcomm_apply_pn()
1378 d->cfc = RFCOMM_CFC_ENABLED; in rfcomm_apply_pn()
1379 d->tx_credits = pn->credits; in rfcomm_apply_pn()
1381 d->cfc = RFCOMM_CFC_DISABLED; in rfcomm_apply_pn()
1382 set_bit(RFCOMM_TX_THROTTLED, &d->flags); in rfcomm_apply_pn()
1386 s->cfc = d->cfc; in rfcomm_apply_pn()
1388 d->priority = pn->priority; in rfcomm_apply_pn()
1390 d->mtu = __le16_to_cpu(pn->mtu); in rfcomm_apply_pn()
1392 if (cr && d->mtu > s->mtu) in rfcomm_apply_pn()
1393 d->mtu = s->mtu; in rfcomm_apply_pn()
1401 struct rfcomm_dlc *d; in rfcomm_recv_pn() local
1409 d = rfcomm_dlc_get(s, dlci); in rfcomm_recv_pn()
1410 if (d) { in rfcomm_recv_pn()
1413 rfcomm_apply_pn(d, cr, pn); in rfcomm_recv_pn()
1414 rfcomm_send_pn(s, 0, d); in rfcomm_recv_pn()
1417 switch (d->state) { in rfcomm_recv_pn()
1419 rfcomm_apply_pn(d, cr, pn); in rfcomm_recv_pn()
1421 d->state = BT_CONNECT; in rfcomm_recv_pn()
1422 rfcomm_send_sabm(s, d->dlci); in rfcomm_recv_pn()
1434 if (rfcomm_connect_ind(s, channel, &d)) { in rfcomm_recv_pn()
1435 d->dlci = dlci; in rfcomm_recv_pn()
1436 d->addr = __addr(s->initiator, dlci); in rfcomm_recv_pn()
1437 rfcomm_dlc_link(s, d); in rfcomm_recv_pn()
1439 rfcomm_apply_pn(d, cr, pn); in rfcomm_recv_pn()
1441 d->state = BT_OPEN; in rfcomm_recv_pn()
1442 rfcomm_send_pn(s, 0, d); in rfcomm_recv_pn()
1578 struct rfcomm_dlc *d; in rfcomm_recv_msc() local
1583 d = rfcomm_dlc_get(s, dlci); in rfcomm_recv_msc()
1584 if (!d) in rfcomm_recv_msc()
1588 if (msc->v24_sig & RFCOMM_V24_FC && !d->cfc) in rfcomm_recv_msc()
1589 set_bit(RFCOMM_TX_THROTTLED, &d->flags); in rfcomm_recv_msc()
1591 clear_bit(RFCOMM_TX_THROTTLED, &d->flags); in rfcomm_recv_msc()
1593 rfcomm_dlc_lock(d); in rfcomm_recv_msc()
1595 d->remote_v24_sig = msc->v24_sig; in rfcomm_recv_msc()
1597 if (d->modem_status) in rfcomm_recv_msc()
1598 d->modem_status(d, msc->v24_sig); in rfcomm_recv_msc()
1600 rfcomm_dlc_unlock(d); in rfcomm_recv_msc()
1604 d->mscex |= RFCOMM_MSCEX_RX; in rfcomm_recv_msc()
1606 d->mscex |= RFCOMM_MSCEX_TX; in rfcomm_recv_msc()
1673 struct rfcomm_dlc *d; in rfcomm_recv_data() local
1677 d = rfcomm_dlc_get(s, dlci); in rfcomm_recv_data()
1678 if (!d) { in rfcomm_recv_data()
1683 if (pf && d->cfc) { in rfcomm_recv_data()
1686 d->tx_credits += credits; in rfcomm_recv_data()
1687 if (d->tx_credits) in rfcomm_recv_data()
1688 clear_bit(RFCOMM_TX_THROTTLED, &d->flags); in rfcomm_recv_data()
1691 if (skb->len && d->state == BT_CONNECTED) { in rfcomm_recv_data()
1692 rfcomm_dlc_lock(d); in rfcomm_recv_data()
1693 d->rx_credits--; in rfcomm_recv_data()
1694 d->data_ready(d, skb); in rfcomm_recv_data()
1695 rfcomm_dlc_unlock(d); in rfcomm_recv_data()
1774 struct rfcomm_dlc *d; in rfcomm_process_connect() local
1780 d = list_entry(p, struct rfcomm_dlc, list); in rfcomm_process_connect()
1781 if (d->state == BT_CONFIG) { in rfcomm_process_connect()
1782 d->mtu = s->mtu; in rfcomm_process_connect()
1783 if (rfcomm_check_security(d)) { in rfcomm_process_connect()
1784 rfcomm_send_pn(s, 1, d); in rfcomm_process_connect()
1786 set_bit(RFCOMM_AUTH_PENDING, &d->flags); in rfcomm_process_connect()
1787 rfcomm_dlc_set_timer(d, RFCOMM_AUTH_TIMEOUT); in rfcomm_process_connect()
1796 static int rfcomm_process_tx(struct rfcomm_dlc *d) in rfcomm_process_tx() argument
1802 d, d->state, d->cfc, d->rx_credits, d->tx_credits); in rfcomm_process_tx()
1805 if (test_and_clear_bit(RFCOMM_MSC_PENDING, &d->flags)) in rfcomm_process_tx()
1806 rfcomm_send_msc(d->session, 1, d->dlci, d->v24_sig); in rfcomm_process_tx()
1808 if (d->cfc) { in rfcomm_process_tx()
1811 if (!test_bit(RFCOMM_RX_THROTTLED, &d->flags) && in rfcomm_process_tx()
1812 d->rx_credits <= (d->cfc >> 2)) { in rfcomm_process_tx()
1813 rfcomm_send_credits(d->session, d->addr, d->cfc - d->rx_credits); in rfcomm_process_tx()
1814 d->rx_credits = d->cfc; in rfcomm_process_tx()
1819 d->tx_credits = 5; in rfcomm_process_tx()
1822 if (test_bit(RFCOMM_TX_THROTTLED, &d->flags)) in rfcomm_process_tx()
1823 return skb_queue_len(&d->tx_queue); in rfcomm_process_tx()
1825 while (d->tx_credits && (skb = skb_dequeue(&d->tx_queue))) { in rfcomm_process_tx()
1826 err = rfcomm_send_frame(d->session, skb->data, skb->len); in rfcomm_process_tx()
1828 skb_queue_head(&d->tx_queue, skb); in rfcomm_process_tx()
1832 d->tx_credits--; in rfcomm_process_tx()
1835 if (d->cfc && !d->tx_credits) { in rfcomm_process_tx()
1838 set_bit(RFCOMM_TX_THROTTLED, &d->flags); in rfcomm_process_tx()
1841 return skb_queue_len(&d->tx_queue); in rfcomm_process_tx()
1846 struct rfcomm_dlc *d; in rfcomm_process_dlcs() local
1852 d = list_entry(p, struct rfcomm_dlc, list); in rfcomm_process_dlcs()
1854 if (test_bit(RFCOMM_TIMED_OUT, &d->flags)) { in rfcomm_process_dlcs()
1855 __rfcomm_dlc_close(d, ETIMEDOUT); in rfcomm_process_dlcs()
1859 if (test_bit(RFCOMM_ENC_DROP, &d->flags)) { in rfcomm_process_dlcs()
1860 __rfcomm_dlc_close(d, ECONNREFUSED); in rfcomm_process_dlcs()
1864 if (test_and_clear_bit(RFCOMM_AUTH_ACCEPT, &d->flags)) { in rfcomm_process_dlcs()
1865 rfcomm_dlc_clear_timer(d); in rfcomm_process_dlcs()
1866 if (d->out) { in rfcomm_process_dlcs()
1867 rfcomm_send_pn(s, 1, d); in rfcomm_process_dlcs()
1868 rfcomm_dlc_set_timer(d, RFCOMM_CONN_TIMEOUT); in rfcomm_process_dlcs()
1870 if (d->defer_setup) { in rfcomm_process_dlcs()
1871 set_bit(RFCOMM_DEFER_SETUP, &d->flags); in rfcomm_process_dlcs()
1872 rfcomm_dlc_set_timer(d, RFCOMM_AUTH_TIMEOUT); in rfcomm_process_dlcs()
1874 rfcomm_dlc_lock(d); in rfcomm_process_dlcs()
1875 d->state = BT_CONNECT2; in rfcomm_process_dlcs()
1876 d->state_change(d, 0); in rfcomm_process_dlcs()
1877 rfcomm_dlc_unlock(d); in rfcomm_process_dlcs()
1879 rfcomm_dlc_accept(d); in rfcomm_process_dlcs()
1882 } else if (test_and_clear_bit(RFCOMM_AUTH_REJECT, &d->flags)) { in rfcomm_process_dlcs()
1883 rfcomm_dlc_clear_timer(d); in rfcomm_process_dlcs()
1884 if (!d->out) in rfcomm_process_dlcs()
1885 rfcomm_send_dm(s, d->dlci); in rfcomm_process_dlcs()
1887 d->state = BT_CLOSED; in rfcomm_process_dlcs()
1888 __rfcomm_dlc_close(d, ECONNREFUSED); in rfcomm_process_dlcs()
1892 if (test_bit(RFCOMM_SEC_PENDING, &d->flags)) in rfcomm_process_dlcs()
1898 if ((d->state == BT_CONNECTED || d->state == BT_DISCONN) && in rfcomm_process_dlcs()
1899 d->mscex == RFCOMM_MSCEX_OK) in rfcomm_process_dlcs()
1900 rfcomm_process_tx(d); in rfcomm_process_dlcs()
2116 struct rfcomm_dlc *d; in rfcomm_security_cfm() local
2126 d = list_entry(p, struct rfcomm_dlc, list); in rfcomm_security_cfm()
2128 if (test_and_clear_bit(RFCOMM_SEC_PENDING, &d->flags)) { in rfcomm_security_cfm()
2129 rfcomm_dlc_clear_timer(d); in rfcomm_security_cfm()
2131 set_bit(RFCOMM_ENC_DROP, &d->flags); in rfcomm_security_cfm()
2136 if (d->state == BT_CONNECTED && !status && encrypt == 0x00) { in rfcomm_security_cfm()
2137 if (d->sec_level == BT_SECURITY_MEDIUM) { in rfcomm_security_cfm()
2138 set_bit(RFCOMM_SEC_PENDING, &d->flags); in rfcomm_security_cfm()
2139 rfcomm_dlc_set_timer(d, RFCOMM_AUTH_TIMEOUT); in rfcomm_security_cfm()
2141 } else if (d->sec_level == BT_SECURITY_HIGH || in rfcomm_security_cfm()
2142 d->sec_level == BT_SECURITY_FIPS) { in rfcomm_security_cfm()
2143 set_bit(RFCOMM_ENC_DROP, &d->flags); in rfcomm_security_cfm()
2148 if (!test_and_clear_bit(RFCOMM_AUTH_PENDING, &d->flags)) in rfcomm_security_cfm()
2151 if (!status && hci_conn_check_secure(conn, d->sec_level)) in rfcomm_security_cfm()
2152 set_bit(RFCOMM_AUTH_ACCEPT, &d->flags); in rfcomm_security_cfm()
2154 set_bit(RFCOMM_AUTH_REJECT, &d->flags); in rfcomm_security_cfm()
2173 struct rfcomm_dlc *d; in rfcomm_dlc_debugfs_show() local
2174 list_for_each_entry(d, &s->dlcs, list) { in rfcomm_dlc_debugfs_show()
2177 d->state, d->dlci, d->mtu, in rfcomm_dlc_debugfs_show()
2178 d->rx_credits, d->tx_credits); in rfcomm_dlc_debugfs_show()