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()
156 void ax25_cb_add(ax25_cb *ax25) in ax25_cb_add() argument
159 ax25_cb_hold(ax25); in ax25_cb_add()
160 hlist_add_head(&ax25->ax25_node, &ax25_list); in ax25_cb_add()
286 ax25_cb *ax25 = from_timer(ax25, t, dtimer); in ax25_destroy_timer() local
289 sk=ax25->sk; in ax25_destroy_timer()
293 ax25_destroy_socket(ax25); in ax25_destroy_timer()
304 void ax25_destroy_socket(ax25_cb *ax25) in ax25_destroy_socket() argument
308 ax25_cb_del(ax25); in ax25_destroy_socket()
310 ax25_stop_heartbeat(ax25); in ax25_destroy_socket()
311 ax25_stop_t1timer(ax25); in ax25_destroy_socket()
312 ax25_stop_t2timer(ax25); in ax25_destroy_socket()
313 ax25_stop_t3timer(ax25); in ax25_destroy_socket()
314 ax25_stop_idletimer(ax25); in ax25_destroy_socket()
316 ax25_clear_queues(ax25); /* Flush the queues */ in ax25_destroy_socket()
318 if (ax25->sk != NULL) { in ax25_destroy_socket()
319 while ((skb = skb_dequeue(&ax25->sk->sk_receive_queue)) != NULL) { in ax25_destroy_socket()
320 if (skb->sk != ax25->sk) { in ax25_destroy_socket()
336 skb_queue_purge(&ax25->sk->sk_write_queue); in ax25_destroy_socket()
339 if (ax25->sk != NULL) { in ax25_destroy_socket()
340 if (sk_has_allocations(ax25->sk)) { in ax25_destroy_socket()
342 timer_setup(&ax25->dtimer, ax25_destroy_timer, 0); in ax25_destroy_socket()
343 ax25->dtimer.expires = jiffies + 2 * HZ; in ax25_destroy_socket()
344 add_timer(&ax25->dtimer); in ax25_destroy_socket()
346 struct sock *sk=ax25->sk; in ax25_destroy_socket()
347 ax25->sk=NULL; in ax25_destroy_socket()
351 ax25_cb_put(ax25); in ax25_destroy_socket()
365 ax25_cb *ax25; in ax25_ctl_ioctl() local
386 ax25 = ax25_find_cb(&ax25_ctl.source_addr, &ax25_ctl.dest_addr, &digi, ax25_dev->dev); in ax25_ctl_ioctl()
387 if (!ax25) { in ax25_ctl_ioctl()
394 ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND); in ax25_ctl_ioctl()
396 if (ax25_dev->dama.slave && ax25->ax25_dev->values[AX25_VALUES_PROTOCOL] == AX25_PROTO_DAMA_SLAVE) in ax25_ctl_ioctl()
397 ax25_dama_off(ax25); in ax25_ctl_ioctl()
399 ax25_disconnect(ax25, ENETRESET); in ax25_ctl_ioctl()
403 if (ax25->modulus == AX25_MODULUS) { in ax25_ctl_ioctl()
410 ax25->window = ax25_ctl.arg; in ax25_ctl_ioctl()
416 ax25->rtt = (ax25_ctl.arg * HZ) / 2; in ax25_ctl_ioctl()
417 ax25->t1 = ax25_ctl.arg * HZ; in ax25_ctl_ioctl()
423 ax25->t2 = ax25_ctl.arg * HZ; in ax25_ctl_ioctl()
429 ax25->n2count = 0; in ax25_ctl_ioctl()
430 ax25->n2 = ax25_ctl.arg; in ax25_ctl_ioctl()
436 ax25->t3 = ax25_ctl.arg * HZ; in ax25_ctl_ioctl()
443 ax25->idle = ax25_ctl.arg * 60 * HZ; in ax25_ctl_ioctl()
449 ax25->paclen = ax25_ctl.arg; in ax25_ctl_ioctl()
458 ax25_cb_put(ax25); in ax25_ctl_ioctl()
466 static void ax25_fillin_cb_from_dev(ax25_cb *ax25, ax25_dev *ax25_dev) in ax25_fillin_cb_from_dev() argument
468 ax25->rtt = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T1]) / 2; in ax25_fillin_cb_from_dev()
469 ax25->t1 = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T1]); in ax25_fillin_cb_from_dev()
470 ax25->t2 = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T2]); in ax25_fillin_cb_from_dev()
471 ax25->t3 = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T3]); in ax25_fillin_cb_from_dev()
472 ax25->n2 = ax25_dev->values[AX25_VALUES_N2]; in ax25_fillin_cb_from_dev()
473 ax25->paclen = ax25_dev->values[AX25_VALUES_PACLEN]; in ax25_fillin_cb_from_dev()
474 ax25->idle = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_IDLE]); in ax25_fillin_cb_from_dev()
475 ax25->backoff = ax25_dev->values[AX25_VALUES_BACKOFF]; in ax25_fillin_cb_from_dev()
478 ax25->modulus = AX25_EMODULUS; in ax25_fillin_cb_from_dev()
479 ax25->window = ax25_dev->values[AX25_VALUES_EWINDOW]; in ax25_fillin_cb_from_dev()
481 ax25->modulus = AX25_MODULUS; in ax25_fillin_cb_from_dev()
482 ax25->window = ax25_dev->values[AX25_VALUES_WINDOW]; in ax25_fillin_cb_from_dev()
490 void ax25_fillin_cb(ax25_cb *ax25, ax25_dev *ax25_dev) in ax25_fillin_cb() argument
492 ax25->ax25_dev = ax25_dev; in ax25_fillin_cb()
494 if (ax25->ax25_dev != NULL) { in ax25_fillin_cb()
495 ax25_fillin_cb_from_dev(ax25, ax25_dev); in ax25_fillin_cb()
502 ax25->rtt = msecs_to_jiffies(AX25_DEF_T1) / 2; in ax25_fillin_cb()
503 ax25->t1 = msecs_to_jiffies(AX25_DEF_T1); in ax25_fillin_cb()
504 ax25->t2 = msecs_to_jiffies(AX25_DEF_T2); in ax25_fillin_cb()
505 ax25->t3 = msecs_to_jiffies(AX25_DEF_T3); in ax25_fillin_cb()
506 ax25->n2 = AX25_DEF_N2; in ax25_fillin_cb()
507 ax25->paclen = AX25_DEF_PACLEN; in ax25_fillin_cb()
508 ax25->idle = msecs_to_jiffies(AX25_DEF_IDLE); in ax25_fillin_cb()
509 ax25->backoff = AX25_DEF_BACKOFF; in ax25_fillin_cb()
512 ax25->modulus = AX25_EMODULUS; in ax25_fillin_cb()
513 ax25->window = AX25_DEF_EWINDOW; in ax25_fillin_cb()
515 ax25->modulus = AX25_MODULUS; in ax25_fillin_cb()
516 ax25->window = AX25_DEF_WINDOW; in ax25_fillin_cb()
525 ax25_cb *ax25; in ax25_create_cb() local
527 if ((ax25 = kzalloc(sizeof(*ax25), GFP_ATOMIC)) == NULL) in ax25_create_cb()
530 refcount_set(&ax25->refcount, 1); in ax25_create_cb()
532 skb_queue_head_init(&ax25->write_queue); in ax25_create_cb()
533 skb_queue_head_init(&ax25->frag_queue); in ax25_create_cb()
534 skb_queue_head_init(&ax25->ack_queue); in ax25_create_cb()
535 skb_queue_head_init(&ax25->reseq_queue); in ax25_create_cb()
537 ax25_setup_timers(ax25); in ax25_create_cb()
539 ax25_fillin_cb(ax25, NULL); in ax25_create_cb()
541 ax25->state = AX25_STATE_0; in ax25_create_cb()
543 return ax25; in ax25_create_cb()
555 ax25_cb *ax25; in ax25_setsockopt() local
571 ax25 = sk_to_ax25(sk); in ax25_setsockopt()
575 if (ax25->modulus == AX25_MODULUS) { in ax25_setsockopt()
586 ax25->window = opt; in ax25_setsockopt()
594 ax25->rtt = (opt * HZ) >> 1; in ax25_setsockopt()
595 ax25->t1 = opt * HZ; in ax25_setsockopt()
603 ax25->t2 = opt * HZ; in ax25_setsockopt()
611 ax25->n2 = opt; in ax25_setsockopt()
619 ax25->t3 = opt * HZ; in ax25_setsockopt()
627 ax25->idle = opt * 60 * HZ; in ax25_setsockopt()
635 ax25->backoff = opt; in ax25_setsockopt()
639 ax25->modulus = opt ? AX25_EMODULUS : AX25_MODULUS; in ax25_setsockopt()
643 ax25->pidincl = opt ? 1 : 0; in ax25_setsockopt()
647 ax25->iamdigi = opt ? 1 : 0; in ax25_setsockopt()
655 ax25->paclen = opt; in ax25_setsockopt()
684 ax25->ax25_dev = ax25_dev_ax25dev(dev); in ax25_setsockopt()
685 if (!ax25->ax25_dev) { in ax25_setsockopt()
690 ax25_fillin_cb(ax25, ax25->ax25_dev); in ax25_setsockopt()
706 ax25_cb *ax25; in ax25_getsockopt() local
726 ax25 = sk_to_ax25(sk); in ax25_getsockopt()
730 val = ax25->window; in ax25_getsockopt()
734 val = ax25->t1 / HZ; in ax25_getsockopt()
738 val = ax25->t2 / HZ; in ax25_getsockopt()
742 val = ax25->n2; in ax25_getsockopt()
746 val = ax25->t3 / HZ; in ax25_getsockopt()
750 val = ax25->idle / (60 * HZ); in ax25_getsockopt()
754 val = ax25->backoff; in ax25_getsockopt()
758 val = (ax25->modulus == AX25_EMODULUS); in ax25_getsockopt()
762 val = ax25->pidincl; in ax25_getsockopt()
766 val = ax25->iamdigi; in ax25_getsockopt()
770 val = ax25->paclen; in ax25_getsockopt()
774 ax25_dev = ax25->ax25_dev; in ax25_getsockopt()
832 ax25_cb *ax25; in ax25_create() local
892 ax25 = ax25_sk(sk)->cb = ax25_create_cb(); in ax25_create()
893 if (!ax25) { in ax25_create()
904 ax25->sk = sk; in ax25_create()
912 ax25_cb *ax25, *oax25; in ax25_make_new() local
918 if ((ax25 = ax25_create_cb()) == NULL) { in ax25_make_new()
930 ax25_cb_put(ax25); in ax25_make_new()
946 ax25->modulus = oax25->modulus; in ax25_make_new()
947 ax25->backoff = oax25->backoff; in ax25_make_new()
948 ax25->pidincl = oax25->pidincl; in ax25_make_new()
949 ax25->iamdigi = oax25->iamdigi; in ax25_make_new()
950 ax25->rtt = oax25->rtt; in ax25_make_new()
951 ax25->t1 = oax25->t1; in ax25_make_new()
952 ax25->t2 = oax25->t2; in ax25_make_new()
953 ax25->t3 = oax25->t3; in ax25_make_new()
954 ax25->n2 = oax25->n2; in ax25_make_new()
955 ax25->idle = oax25->idle; in ax25_make_new()
956 ax25->paclen = oax25->paclen; in ax25_make_new()
957 ax25->window = oax25->window; in ax25_make_new()
959 ax25->ax25_dev = ax25_dev; in ax25_make_new()
960 ax25->source_addr = oax25->source_addr; in ax25_make_new()
963 ax25->digipeat = kmemdup(oax25->digipeat, sizeof(ax25_digi), in ax25_make_new()
965 if (ax25->digipeat == NULL) { in ax25_make_new()
967 ax25_cb_put(ax25); in ax25_make_new()
972 ax25_sk(sk)->cb = ax25; in ax25_make_new()
974 ax25->sk = sk; in ax25_make_new()
982 ax25_cb *ax25; in ax25_release() local
991 ax25 = sk_to_ax25(sk); in ax25_release()
992 ax25_dev = ax25->ax25_dev; in ax25_release()
995 switch (ax25->state) { in ax25_release()
998 ax25_disconnect(ax25, 0); in ax25_release()
1000 ax25_destroy_socket(ax25); in ax25_release()
1005 ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND); in ax25_release()
1007 ax25_disconnect(ax25, 0); in ax25_release()
1009 if (!sock_flag(ax25->sk, SOCK_DESTROY)) in ax25_release()
1010 ax25_destroy_socket(ax25); in ax25_release()
1015 ax25_clear_queues(ax25); in ax25_release()
1016 ax25->n2count = 0; in ax25_release()
1018 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_release()
1021 ax25_send_control(ax25, in ax25_release()
1025 ax25_stop_t2timer(ax25); in ax25_release()
1026 ax25_stop_t3timer(ax25); in ax25_release()
1027 ax25_stop_idletimer(ax25); in ax25_release()
1031 ax25_stop_t3timer(ax25); in ax25_release()
1032 ax25_stop_idletimer(ax25); in ax25_release()
1036 ax25_calculate_t1(ax25); in ax25_release()
1037 ax25_start_t1timer(ax25); in ax25_release()
1038 ax25->state = AX25_STATE_2; in ax25_release()
1052 ax25_destroy_socket(ax25); in ax25_release()
1055 del_timer_sync(&ax25->timer); in ax25_release()
1056 del_timer_sync(&ax25->t1timer); in ax25_release()
1057 del_timer_sync(&ax25->t2timer); in ax25_release()
1058 del_timer_sync(&ax25->t3timer); in ax25_release()
1059 del_timer_sync(&ax25->idletimer); in ax25_release()
1084 ax25_cb *ax25; in ax25_bind() local
1112 ax25 = sk_to_ax25(sk); in ax25_bind()
1118 ax25->source_addr = call; in ax25_bind()
1123 if (ax25->ax25_dev != NULL) in ax25_bind()
1140 ax25_fillin_cb(ax25, ax25_dev); in ax25_bind()
1145 ax25_cb_add(ax25); in ax25_bind()
1161 ax25_cb *ax25 = sk_to_ax25(sk), *ax25t; in ax25_connect() local
1215 kfree(ax25->digipeat); in ax25_connect()
1216 ax25->digipeat = NULL; in ax25_connect()
1242 AX25_HBIT) && ax25->iamdigi) { in ax25_connect()
1262 if ((err = ax25_rt_autobind(ax25, &fsa->fsa_ax25.sax25_call)) < 0) { in ax25_connect()
1267 ax25_fillin_cb(ax25, ax25->ax25_dev); in ax25_connect()
1268 ax25_cb_add(ax25); in ax25_connect()
1270 if (ax25->ax25_dev == NULL) { in ax25_connect()
1278 (ax25t=ax25_find_cb(&ax25->source_addr, &fsa->fsa_ax25.sax25_call, digi, in ax25_connect()
1279 ax25->ax25_dev->dev))) { in ax25_connect()
1286 ax25->dest_addr = fsa->fsa_ax25.sax25_call; in ax25_connect()
1287 ax25->digipeat = digi; in ax25_connect()
1300 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_connect()
1303 ax25_std_establish_data_link(ax25); in ax25_connect()
1308 ax25->modulus = AX25_MODULUS; in ax25_connect()
1309 ax25->window = ax25->ax25_dev->values[AX25_VALUES_WINDOW]; in ax25_connect()
1310 if (ax25->ax25_dev->dama.slave) in ax25_connect()
1311 ax25_ds_establish_data_link(ax25); in ax25_connect()
1313 ax25_std_establish_data_link(ax25); in ax25_connect()
1318 ax25->state = AX25_STATE_1; in ax25_connect()
1320 ax25_start_heartbeat(ax25); in ax25_connect()
1441 ax25_cb *ax25; in ax25_getname() local
1446 ax25 = sk_to_ax25(sk); in ax25_getname()
1455 fsa->fsa_ax25.sax25_call = ax25->dest_addr; in ax25_getname()
1457 if (ax25->digipeat != NULL) { in ax25_getname()
1458 ndigi = ax25->digipeat->ndigi; in ax25_getname()
1462 ax25->digipeat->calls[i]; in ax25_getname()
1466 fsa->fsa_ax25.sax25_call = ax25->source_addr; in ax25_getname()
1468 if (ax25->ax25_dev != NULL) { in ax25_getname()
1470 ax25->ax25_dev->dev->dev_addr, AX25_ADDR_LEN); in ax25_getname()
1490 ax25_cb *ax25; in ax25_sendmsg() local
1498 ax25 = sk_to_ax25(sk); in ax25_sendmsg()
1511 if (ax25->ax25_dev == NULL) { in ax25_sendmsg()
1516 if (len > ax25->ax25_dev->dev->mtu) { in ax25_sendmsg()
1568 ax25cmp(&ax25->dest_addr, &sax.sax25_call)) { in ax25_sendmsg()
1587 sax.sax25_call = ax25->dest_addr; in ax25_sendmsg()
1588 dp = ax25->digipeat; in ax25_sendmsg()
1593 size = len + ax25->ax25_dev->dev->hard_header_len; in ax25_sendmsg()
1611 if (!ax25->pidincl) in ax25_sendmsg()
1623 ax25_output(ax25, ax25->paclen, skb); in ax25_sendmsg()
1634 lv = ax25_addr_build(skb->data, &ax25->source_addr, &sax.sax25_call, in ax25_sendmsg()
1642 ax25_queue_xmit(skb, ax25->ax25_dev->dev); in ax25_sendmsg()
1831 ax25_cb *ax25 = sk_to_ax25(sk); in ax25_ioctl() local
1834 ax25_info.t1 = ax25->t1 / HZ; in ax25_ioctl()
1835 ax25_info.t2 = ax25->t2 / HZ; in ax25_ioctl()
1836 ax25_info.t3 = ax25->t3 / HZ; in ax25_ioctl()
1837 ax25_info.idle = ax25->idle / (60 * HZ); in ax25_ioctl()
1838 ax25_info.n2 = ax25->n2; in ax25_ioctl()
1839 ax25_info.t1timer = ax25_display_timer(&ax25->t1timer) / HZ; in ax25_ioctl()
1840 ax25_info.t2timer = ax25_display_timer(&ax25->t2timer) / HZ; in ax25_ioctl()
1841 ax25_info.t3timer = ax25_display_timer(&ax25->t3timer) / HZ; in ax25_ioctl()
1842 ax25_info.idletimer = ax25_display_timer(&ax25->idletimer) / (60 * HZ); in ax25_ioctl()
1843 ax25_info.n2count = ax25->n2count; in ax25_ioctl()
1844 ax25_info.state = ax25->state; in ax25_ioctl()
1847 ax25_info.vs = ax25->vs; in ax25_ioctl()
1848 ax25_info.vr = ax25->vr; in ax25_ioctl()
1849 ax25_info.va = ax25->va; in ax25_ioctl()
1850 ax25_info.vs_max = ax25->vs; /* reserved */ in ax25_ioctl()
1851 ax25_info.paclen = ax25->paclen; in ax25_ioctl()
1852 ax25_info.window = ax25->window; in ax25_ioctl()
1936 ax25_cb *ax25 = hlist_entry(v, struct ax25_cb, ax25_node); in ax25_info_show() local
1947 ax25, in ax25_info_show()
1948 ax25->ax25_dev == NULL? "???" : ax25->ax25_dev->dev->name, in ax25_info_show()
1949 ax2asc(buf, &ax25->source_addr), in ax25_info_show()
1950 ax25->iamdigi? "*":""); in ax25_info_show()
1951 seq_printf(seq, "%s", ax2asc(buf, &ax25->dest_addr)); in ax25_info_show()
1953 for (k=0; (ax25->digipeat != NULL) && (k < ax25->digipeat->ndigi); k++) { in ax25_info_show()
1955 ax2asc(buf, &ax25->digipeat->calls[k]), in ax25_info_show()
1956 ax25->digipeat->repeated[k]? "*":""); in ax25_info_show()
1960 ax25->state, in ax25_info_show()
1961 ax25->vs, ax25->vr, ax25->va, in ax25_info_show()
1962 ax25_display_timer(&ax25->t1timer) / HZ, ax25->t1 / HZ, in ax25_info_show()
1963 ax25_display_timer(&ax25->t2timer) / HZ, ax25->t2 / HZ, in ax25_info_show()
1964 ax25_display_timer(&ax25->t3timer) / HZ, ax25->t3 / HZ, in ax25_info_show()
1965 ax25_display_timer(&ax25->idletimer) / (60 * HZ), in ax25_info_show()
1966 ax25->idle / (60 * HZ), in ax25_info_show()
1967 ax25->n2count, ax25->n2, in ax25_info_show()
1968 ax25->rtt / HZ, in ax25_info_show()
1969 ax25->window, in ax25_info_show()
1970 ax25->paclen); in ax25_info_show()
1972 if (ax25->sk != NULL) { in ax25_info_show()
1974 sk_wmem_alloc_get(ax25->sk), in ax25_info_show()
1975 sk_rmem_alloc_get(ax25->sk), in ax25_info_show()
1976 sock_i_ino(ax25->sk)); in ax25_info_show()