Lines Matching refs:ax25
63 static void ax25_cb_del(ax25_cb *ax25) in ax25_cb_del() argument
65 if (!hlist_unhashed(&ax25->ax25_node)) { in ax25_cb_del()
67 hlist_del_init(&ax25->ax25_node); in ax25_cb_del()
69 ax25_cb_put(ax25); in ax25_cb_del()
140 void ax25_cb_add(ax25_cb *ax25) in ax25_cb_add() argument
143 ax25_cb_hold(ax25); in ax25_cb_add()
144 hlist_add_head(&ax25->ax25_node, &ax25_list); in ax25_cb_add()
270 ax25_cb *ax25 = from_timer(ax25, t, dtimer); in ax25_destroy_timer() local
273 sk=ax25->sk; in ax25_destroy_timer()
277 ax25_destroy_socket(ax25); in ax25_destroy_timer()
288 void ax25_destroy_socket(ax25_cb *ax25) in ax25_destroy_socket() argument
292 ax25_cb_del(ax25); in ax25_destroy_socket()
294 ax25_stop_heartbeat(ax25); in ax25_destroy_socket()
295 ax25_stop_t1timer(ax25); in ax25_destroy_socket()
296 ax25_stop_t2timer(ax25); in ax25_destroy_socket()
297 ax25_stop_t3timer(ax25); in ax25_destroy_socket()
298 ax25_stop_idletimer(ax25); in ax25_destroy_socket()
300 ax25_clear_queues(ax25); /* Flush the queues */ in ax25_destroy_socket()
302 if (ax25->sk != NULL) { in ax25_destroy_socket()
303 while ((skb = skb_dequeue(&ax25->sk->sk_receive_queue)) != NULL) { in ax25_destroy_socket()
304 if (skb->sk != ax25->sk) { in ax25_destroy_socket()
320 skb_queue_purge(&ax25->sk->sk_write_queue); in ax25_destroy_socket()
323 if (ax25->sk != NULL) { in ax25_destroy_socket()
324 if (sk_has_allocations(ax25->sk)) { in ax25_destroy_socket()
326 timer_setup(&ax25->dtimer, ax25_destroy_timer, 0); in ax25_destroy_socket()
327 ax25->dtimer.expires = jiffies + 2 * HZ; in ax25_destroy_socket()
328 add_timer(&ax25->dtimer); in ax25_destroy_socket()
330 struct sock *sk=ax25->sk; in ax25_destroy_socket()
331 ax25->sk=NULL; in ax25_destroy_socket()
335 ax25_cb_put(ax25); in ax25_destroy_socket()
349 ax25_cb *ax25; in ax25_ctl_ioctl() local
369 …if ((ax25 = ax25_find_cb(&ax25_ctl.source_addr, &ax25_ctl.dest_addr, &digi, ax25_dev->dev)) == NUL… in ax25_ctl_ioctl()
374 ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND); in ax25_ctl_ioctl()
376 if (ax25_dev->dama.slave && ax25->ax25_dev->values[AX25_VALUES_PROTOCOL] == AX25_PROTO_DAMA_SLAVE) in ax25_ctl_ioctl()
377 ax25_dama_off(ax25); in ax25_ctl_ioctl()
379 ax25_disconnect(ax25, ENETRESET); in ax25_ctl_ioctl()
383 if (ax25->modulus == AX25_MODULUS) { in ax25_ctl_ioctl()
390 ax25->window = ax25_ctl.arg; in ax25_ctl_ioctl()
396 ax25->rtt = (ax25_ctl.arg * HZ) / 2; in ax25_ctl_ioctl()
397 ax25->t1 = ax25_ctl.arg * HZ; in ax25_ctl_ioctl()
403 ax25->t2 = ax25_ctl.arg * HZ; in ax25_ctl_ioctl()
409 ax25->n2count = 0; in ax25_ctl_ioctl()
410 ax25->n2 = ax25_ctl.arg; in ax25_ctl_ioctl()
416 ax25->t3 = ax25_ctl.arg * HZ; in ax25_ctl_ioctl()
423 ax25->idle = ax25_ctl.arg * 60 * HZ; in ax25_ctl_ioctl()
429 ax25->paclen = ax25_ctl.arg; in ax25_ctl_ioctl()
437 ax25_cb_put(ax25); in ax25_ctl_ioctl()
445 static void ax25_fillin_cb_from_dev(ax25_cb *ax25, ax25_dev *ax25_dev) in ax25_fillin_cb_from_dev() argument
447 ax25->rtt = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T1]) / 2; in ax25_fillin_cb_from_dev()
448 ax25->t1 = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T1]); in ax25_fillin_cb_from_dev()
449 ax25->t2 = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T2]); in ax25_fillin_cb_from_dev()
450 ax25->t3 = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T3]); in ax25_fillin_cb_from_dev()
451 ax25->n2 = ax25_dev->values[AX25_VALUES_N2]; in ax25_fillin_cb_from_dev()
452 ax25->paclen = ax25_dev->values[AX25_VALUES_PACLEN]; in ax25_fillin_cb_from_dev()
453 ax25->idle = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_IDLE]); in ax25_fillin_cb_from_dev()
454 ax25->backoff = ax25_dev->values[AX25_VALUES_BACKOFF]; in ax25_fillin_cb_from_dev()
457 ax25->modulus = AX25_EMODULUS; in ax25_fillin_cb_from_dev()
458 ax25->window = ax25_dev->values[AX25_VALUES_EWINDOW]; in ax25_fillin_cb_from_dev()
460 ax25->modulus = AX25_MODULUS; in ax25_fillin_cb_from_dev()
461 ax25->window = ax25_dev->values[AX25_VALUES_WINDOW]; in ax25_fillin_cb_from_dev()
469 void ax25_fillin_cb(ax25_cb *ax25, ax25_dev *ax25_dev) in ax25_fillin_cb() argument
471 ax25->ax25_dev = ax25_dev; in ax25_fillin_cb()
473 if (ax25->ax25_dev != NULL) { in ax25_fillin_cb()
474 ax25_fillin_cb_from_dev(ax25, ax25_dev); in ax25_fillin_cb()
481 ax25->rtt = msecs_to_jiffies(AX25_DEF_T1) / 2; in ax25_fillin_cb()
482 ax25->t1 = msecs_to_jiffies(AX25_DEF_T1); in ax25_fillin_cb()
483 ax25->t2 = msecs_to_jiffies(AX25_DEF_T2); in ax25_fillin_cb()
484 ax25->t3 = msecs_to_jiffies(AX25_DEF_T3); in ax25_fillin_cb()
485 ax25->n2 = AX25_DEF_N2; in ax25_fillin_cb()
486 ax25->paclen = AX25_DEF_PACLEN; in ax25_fillin_cb()
487 ax25->idle = msecs_to_jiffies(AX25_DEF_IDLE); in ax25_fillin_cb()
488 ax25->backoff = AX25_DEF_BACKOFF; in ax25_fillin_cb()
491 ax25->modulus = AX25_EMODULUS; in ax25_fillin_cb()
492 ax25->window = AX25_DEF_EWINDOW; in ax25_fillin_cb()
494 ax25->modulus = AX25_MODULUS; in ax25_fillin_cb()
495 ax25->window = AX25_DEF_WINDOW; in ax25_fillin_cb()
504 ax25_cb *ax25; in ax25_create_cb() local
506 if ((ax25 = kzalloc(sizeof(*ax25), GFP_ATOMIC)) == NULL) in ax25_create_cb()
509 refcount_set(&ax25->refcount, 1); in ax25_create_cb()
511 skb_queue_head_init(&ax25->write_queue); in ax25_create_cb()
512 skb_queue_head_init(&ax25->frag_queue); in ax25_create_cb()
513 skb_queue_head_init(&ax25->ack_queue); in ax25_create_cb()
514 skb_queue_head_init(&ax25->reseq_queue); in ax25_create_cb()
516 ax25_setup_timers(ax25); in ax25_create_cb()
518 ax25_fillin_cb(ax25, NULL); in ax25_create_cb()
520 ax25->state = AX25_STATE_0; in ax25_create_cb()
522 return ax25; in ax25_create_cb()
534 ax25_cb *ax25; in ax25_setsockopt() local
550 ax25 = sk_to_ax25(sk); in ax25_setsockopt()
554 if (ax25->modulus == AX25_MODULUS) { in ax25_setsockopt()
565 ax25->window = opt; in ax25_setsockopt()
573 ax25->rtt = (opt * HZ) >> 1; in ax25_setsockopt()
574 ax25->t1 = opt * HZ; in ax25_setsockopt()
582 ax25->t2 = opt * HZ; in ax25_setsockopt()
590 ax25->n2 = opt; in ax25_setsockopt()
598 ax25->t3 = opt * HZ; in ax25_setsockopt()
606 ax25->idle = opt * 60 * HZ; in ax25_setsockopt()
614 ax25->backoff = opt; in ax25_setsockopt()
618 ax25->modulus = opt ? AX25_EMODULUS : AX25_MODULUS; in ax25_setsockopt()
622 ax25->pidincl = opt ? 1 : 0; in ax25_setsockopt()
626 ax25->iamdigi = opt ? 1 : 0; in ax25_setsockopt()
634 ax25->paclen = opt; in ax25_setsockopt()
661 ax25->ax25_dev = ax25_dev_ax25dev(dev); in ax25_setsockopt()
662 if (!ax25->ax25_dev) { in ax25_setsockopt()
667 ax25_fillin_cb(ax25, ax25->ax25_dev); in ax25_setsockopt()
683 ax25_cb *ax25; in ax25_getsockopt() local
703 ax25 = sk_to_ax25(sk); in ax25_getsockopt()
707 val = ax25->window; in ax25_getsockopt()
711 val = ax25->t1 / HZ; in ax25_getsockopt()
715 val = ax25->t2 / HZ; in ax25_getsockopt()
719 val = ax25->n2; in ax25_getsockopt()
723 val = ax25->t3 / HZ; in ax25_getsockopt()
727 val = ax25->idle / (60 * HZ); in ax25_getsockopt()
731 val = ax25->backoff; in ax25_getsockopt()
735 val = (ax25->modulus == AX25_EMODULUS); in ax25_getsockopt()
739 val = ax25->pidincl; in ax25_getsockopt()
743 val = ax25->iamdigi; in ax25_getsockopt()
747 val = ax25->paclen; in ax25_getsockopt()
751 ax25_dev = ax25->ax25_dev; in ax25_getsockopt()
809 ax25_cb *ax25; in ax25_create() local
869 ax25 = ax25_sk(sk)->cb = ax25_create_cb(); in ax25_create()
870 if (!ax25) { in ax25_create()
881 ax25->sk = sk; in ax25_create()
889 ax25_cb *ax25, *oax25; in ax25_make_new() local
895 if ((ax25 = ax25_create_cb()) == NULL) { in ax25_make_new()
907 ax25_cb_put(ax25); in ax25_make_new()
923 ax25->modulus = oax25->modulus; in ax25_make_new()
924 ax25->backoff = oax25->backoff; in ax25_make_new()
925 ax25->pidincl = oax25->pidincl; in ax25_make_new()
926 ax25->iamdigi = oax25->iamdigi; in ax25_make_new()
927 ax25->rtt = oax25->rtt; in ax25_make_new()
928 ax25->t1 = oax25->t1; in ax25_make_new()
929 ax25->t2 = oax25->t2; in ax25_make_new()
930 ax25->t3 = oax25->t3; in ax25_make_new()
931 ax25->n2 = oax25->n2; in ax25_make_new()
932 ax25->idle = oax25->idle; in ax25_make_new()
933 ax25->paclen = oax25->paclen; in ax25_make_new()
934 ax25->window = oax25->window; in ax25_make_new()
936 ax25->ax25_dev = ax25_dev; in ax25_make_new()
937 ax25->source_addr = oax25->source_addr; in ax25_make_new()
940 ax25->digipeat = kmemdup(oax25->digipeat, sizeof(ax25_digi), in ax25_make_new()
942 if (ax25->digipeat == NULL) { in ax25_make_new()
944 ax25_cb_put(ax25); in ax25_make_new()
949 ax25_sk(sk)->cb = ax25; in ax25_make_new()
951 ax25->sk = sk; in ax25_make_new()
959 ax25_cb *ax25; in ax25_release() local
967 ax25 = sk_to_ax25(sk); in ax25_release()
970 switch (ax25->state) { in ax25_release()
973 ax25_disconnect(ax25, 0); in ax25_release()
975 ax25_destroy_socket(ax25); in ax25_release()
980 ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND); in ax25_release()
982 ax25_disconnect(ax25, 0); in ax25_release()
984 if (!sock_flag(ax25->sk, SOCK_DESTROY)) in ax25_release()
985 ax25_destroy_socket(ax25); in ax25_release()
990 ax25_clear_queues(ax25); in ax25_release()
991 ax25->n2count = 0; in ax25_release()
993 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_release()
996 ax25_send_control(ax25, in ax25_release()
1000 ax25_stop_t2timer(ax25); in ax25_release()
1001 ax25_stop_t3timer(ax25); in ax25_release()
1002 ax25_stop_idletimer(ax25); in ax25_release()
1006 ax25_stop_t3timer(ax25); in ax25_release()
1007 ax25_stop_idletimer(ax25); in ax25_release()
1011 ax25_calculate_t1(ax25); in ax25_release()
1012 ax25_start_t1timer(ax25); in ax25_release()
1013 ax25->state = AX25_STATE_2; in ax25_release()
1027 ax25_destroy_socket(ax25); in ax25_release()
1050 ax25_cb *ax25; in ax25_bind() local
1078 ax25 = sk_to_ax25(sk); in ax25_bind()
1084 ax25->source_addr = call; in ax25_bind()
1089 if (ax25->ax25_dev != NULL) in ax25_bind()
1106 ax25_fillin_cb(ax25, ax25_dev); in ax25_bind()
1109 ax25_cb_add(ax25); in ax25_bind()
1125 ax25_cb *ax25 = sk_to_ax25(sk), *ax25t; in ax25_connect() local
1179 kfree(ax25->digipeat); in ax25_connect()
1180 ax25->digipeat = NULL; in ax25_connect()
1203 AX25_HBIT) && ax25->iamdigi) { in ax25_connect()
1223 if ((err = ax25_rt_autobind(ax25, &fsa->fsa_ax25.sax25_call)) < 0) { in ax25_connect()
1228 ax25_fillin_cb(ax25, ax25->ax25_dev); in ax25_connect()
1229 ax25_cb_add(ax25); in ax25_connect()
1231 if (ax25->ax25_dev == NULL) { in ax25_connect()
1239 (ax25t=ax25_find_cb(&ax25->source_addr, &fsa->fsa_ax25.sax25_call, digi, in ax25_connect()
1240 ax25->ax25_dev->dev))) { in ax25_connect()
1247 ax25->dest_addr = fsa->fsa_ax25.sax25_call; in ax25_connect()
1248 ax25->digipeat = digi; in ax25_connect()
1261 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_connect()
1264 ax25_std_establish_data_link(ax25); in ax25_connect()
1269 ax25->modulus = AX25_MODULUS; in ax25_connect()
1270 ax25->window = ax25->ax25_dev->values[AX25_VALUES_WINDOW]; in ax25_connect()
1271 if (ax25->ax25_dev->dama.slave) in ax25_connect()
1272 ax25_ds_establish_data_link(ax25); in ax25_connect()
1274 ax25_std_establish_data_link(ax25); in ax25_connect()
1279 ax25->state = AX25_STATE_1; in ax25_connect()
1281 ax25_start_heartbeat(ax25); in ax25_connect()
1402 ax25_cb *ax25; in ax25_getname() local
1407 ax25 = sk_to_ax25(sk); in ax25_getname()
1416 fsa->fsa_ax25.sax25_call = ax25->dest_addr; in ax25_getname()
1418 if (ax25->digipeat != NULL) { in ax25_getname()
1419 ndigi = ax25->digipeat->ndigi; in ax25_getname()
1423 ax25->digipeat->calls[i]; in ax25_getname()
1427 fsa->fsa_ax25.sax25_call = ax25->source_addr; in ax25_getname()
1429 if (ax25->ax25_dev != NULL) { in ax25_getname()
1431 ax25->ax25_dev->dev->dev_addr, AX25_ADDR_LEN); in ax25_getname()
1451 ax25_cb *ax25; in ax25_sendmsg() local
1459 ax25 = sk_to_ax25(sk); in ax25_sendmsg()
1472 if (ax25->ax25_dev == NULL) { in ax25_sendmsg()
1477 if (len > ax25->ax25_dev->dev->mtu) { in ax25_sendmsg()
1526 ax25cmp(&ax25->dest_addr, &sax.sax25_call)) { in ax25_sendmsg()
1545 sax.sax25_call = ax25->dest_addr; in ax25_sendmsg()
1546 dp = ax25->digipeat; in ax25_sendmsg()
1551 size = len + ax25->ax25_dev->dev->hard_header_len; in ax25_sendmsg()
1569 if (!ax25->pidincl) in ax25_sendmsg()
1581 ax25_output(ax25, ax25->paclen, skb); in ax25_sendmsg()
1592 lv = ax25_addr_build(skb->data, &ax25->source_addr, &sax.sax25_call, in ax25_sendmsg()
1600 ax25_queue_xmit(skb, ax25->ax25_dev->dev); in ax25_sendmsg()
1767 ax25_cb *ax25 = sk_to_ax25(sk); in ax25_ioctl() local
1770 ax25_info.t1 = ax25->t1 / HZ; in ax25_ioctl()
1771 ax25_info.t2 = ax25->t2 / HZ; in ax25_ioctl()
1772 ax25_info.t3 = ax25->t3 / HZ; in ax25_ioctl()
1773 ax25_info.idle = ax25->idle / (60 * HZ); in ax25_ioctl()
1774 ax25_info.n2 = ax25->n2; in ax25_ioctl()
1775 ax25_info.t1timer = ax25_display_timer(&ax25->t1timer) / HZ; in ax25_ioctl()
1776 ax25_info.t2timer = ax25_display_timer(&ax25->t2timer) / HZ; in ax25_ioctl()
1777 ax25_info.t3timer = ax25_display_timer(&ax25->t3timer) / HZ; in ax25_ioctl()
1778 ax25_info.idletimer = ax25_display_timer(&ax25->idletimer) / (60 * HZ); in ax25_ioctl()
1779 ax25_info.n2count = ax25->n2count; in ax25_ioctl()
1780 ax25_info.state = ax25->state; in ax25_ioctl()
1783 ax25_info.vs = ax25->vs; in ax25_ioctl()
1784 ax25_info.vr = ax25->vr; in ax25_ioctl()
1785 ax25_info.va = ax25->va; in ax25_ioctl()
1786 ax25_info.vs_max = ax25->vs; /* reserved */ in ax25_ioctl()
1787 ax25_info.paclen = ax25->paclen; in ax25_ioctl()
1788 ax25_info.window = ax25->window; in ax25_ioctl()
1872 ax25_cb *ax25 = hlist_entry(v, struct ax25_cb, ax25_node); in ax25_info_show() local
1883 ax25, in ax25_info_show()
1884 ax25->ax25_dev == NULL? "???" : ax25->ax25_dev->dev->name, in ax25_info_show()
1885 ax2asc(buf, &ax25->source_addr), in ax25_info_show()
1886 ax25->iamdigi? "*":""); in ax25_info_show()
1887 seq_printf(seq, "%s", ax2asc(buf, &ax25->dest_addr)); in ax25_info_show()
1889 for (k=0; (ax25->digipeat != NULL) && (k < ax25->digipeat->ndigi); k++) { in ax25_info_show()
1891 ax2asc(buf, &ax25->digipeat->calls[k]), in ax25_info_show()
1892 ax25->digipeat->repeated[k]? "*":""); in ax25_info_show()
1896 ax25->state, in ax25_info_show()
1897 ax25->vs, ax25->vr, ax25->va, in ax25_info_show()
1898 ax25_display_timer(&ax25->t1timer) / HZ, ax25->t1 / HZ, in ax25_info_show()
1899 ax25_display_timer(&ax25->t2timer) / HZ, ax25->t2 / HZ, in ax25_info_show()
1900 ax25_display_timer(&ax25->t3timer) / HZ, ax25->t3 / HZ, in ax25_info_show()
1901 ax25_display_timer(&ax25->idletimer) / (60 * HZ), in ax25_info_show()
1902 ax25->idle / (60 * HZ), in ax25_info_show()
1903 ax25->n2count, ax25->n2, in ax25_info_show()
1904 ax25->rtt / HZ, in ax25_info_show()
1905 ax25->window, in ax25_info_show()
1906 ax25->paclen); in ax25_info_show()
1908 if (ax25->sk != NULL) { in ax25_info_show()
1910 sk_wmem_alloc_get(ax25->sk), in ax25_info_show()
1911 sk_rmem_alloc_get(ax25->sk), in ax25_info_show()
1912 sock_i_ino(ax25->sk)); in ax25_info_show()