• Home
  • Raw
  • Download

Lines Matching refs:ax25

67 static void ax25_cb_del(ax25_cb *ax25)  in ax25_cb_del()  argument
69 if (!hlist_unhashed(&ax25->ax25_node)) { in ax25_cb_del()
71 hlist_del_init(&ax25->ax25_node); in ax25_cb_del()
73 ax25_cb_put(ax25); in ax25_cb_del()
145 void ax25_cb_add(ax25_cb *ax25) in ax25_cb_add() argument
148 ax25_cb_hold(ax25); in ax25_cb_add()
149 hlist_add_head(&ax25->ax25_node, &ax25_list); in ax25_cb_add()
279 ax25_cb *ax25=(ax25_cb *)data; in ax25_destroy_timer() local
282 sk=ax25->sk; in ax25_destroy_timer()
286 ax25_destroy_socket(ax25); in ax25_destroy_timer()
297 void ax25_destroy_socket(ax25_cb *ax25) in ax25_destroy_socket() argument
301 ax25_cb_del(ax25); in ax25_destroy_socket()
303 ax25_stop_heartbeat(ax25); in ax25_destroy_socket()
304 ax25_stop_t1timer(ax25); in ax25_destroy_socket()
305 ax25_stop_t2timer(ax25); in ax25_destroy_socket()
306 ax25_stop_t3timer(ax25); in ax25_destroy_socket()
307 ax25_stop_idletimer(ax25); in ax25_destroy_socket()
309 ax25_clear_queues(ax25); /* Flush the queues */ in ax25_destroy_socket()
311 if (ax25->sk != NULL) { in ax25_destroy_socket()
312 while ((skb = skb_dequeue(&ax25->sk->sk_receive_queue)) != NULL) { in ax25_destroy_socket()
313 if (skb->sk != ax25->sk) { in ax25_destroy_socket()
329 skb_queue_purge(&ax25->sk->sk_write_queue); in ax25_destroy_socket()
332 if (ax25->sk != NULL) { in ax25_destroy_socket()
333 if (atomic_read(&ax25->sk->sk_wmem_alloc) || in ax25_destroy_socket()
334 atomic_read(&ax25->sk->sk_rmem_alloc)) { in ax25_destroy_socket()
336 setup_timer(&ax25->dtimer, ax25_destroy_timer, in ax25_destroy_socket()
337 (unsigned long)ax25); in ax25_destroy_socket()
338 ax25->dtimer.expires = jiffies + 2 * HZ; in ax25_destroy_socket()
339 add_timer(&ax25->dtimer); in ax25_destroy_socket()
341 struct sock *sk=ax25->sk; in ax25_destroy_socket()
342 ax25->sk=NULL; in ax25_destroy_socket()
346 ax25_cb_put(ax25); in ax25_destroy_socket()
360 ax25_cb *ax25; in ax25_ctl_ioctl() local
376 …if ((ax25 = ax25_find_cb(&ax25_ctl.source_addr, &ax25_ctl.dest_addr, &digi, ax25_dev->dev)) == NUL… in ax25_ctl_ioctl()
381 ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND); in ax25_ctl_ioctl()
383 if (ax25_dev->dama.slave && ax25->ax25_dev->values[AX25_VALUES_PROTOCOL] == AX25_PROTO_DAMA_SLAVE) in ax25_ctl_ioctl()
384 ax25_dama_off(ax25); in ax25_ctl_ioctl()
386 ax25_disconnect(ax25, ENETRESET); in ax25_ctl_ioctl()
390 if (ax25->modulus == AX25_MODULUS) { in ax25_ctl_ioctl()
397 ax25->window = ax25_ctl.arg; in ax25_ctl_ioctl()
403 ax25->rtt = (ax25_ctl.arg * HZ) / 2; in ax25_ctl_ioctl()
404 ax25->t1 = ax25_ctl.arg * HZ; in ax25_ctl_ioctl()
410 ax25->t2 = ax25_ctl.arg * HZ; in ax25_ctl_ioctl()
416 ax25->n2count = 0; in ax25_ctl_ioctl()
417 ax25->n2 = ax25_ctl.arg; in ax25_ctl_ioctl()
423 ax25->t3 = ax25_ctl.arg * HZ; in ax25_ctl_ioctl()
429 ax25->idle = ax25_ctl.arg * 60 * HZ; in ax25_ctl_ioctl()
435 ax25->paclen = ax25_ctl.arg; 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 atomic_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
549 ax25 = ax25_sk(sk); in ax25_setsockopt()
553 if (ax25->modulus == AX25_MODULUS) { in ax25_setsockopt()
564 ax25->window = opt; in ax25_setsockopt()
572 ax25->rtt = (opt * HZ) >> 1; in ax25_setsockopt()
573 ax25->t1 = opt * HZ; in ax25_setsockopt()
581 ax25->t2 = opt * HZ; in ax25_setsockopt()
589 ax25->n2 = opt; in ax25_setsockopt()
597 ax25->t3 = opt * HZ; in ax25_setsockopt()
605 ax25->idle = opt * 60 * HZ; in ax25_setsockopt()
613 ax25->backoff = opt; in ax25_setsockopt()
617 ax25->modulus = opt ? AX25_EMODULUS : AX25_MODULUS; in ax25_setsockopt()
621 ax25->pidincl = opt ? 1 : 0; in ax25_setsockopt()
625 ax25->iamdigi = opt ? 1 : 0; in ax25_setsockopt()
633 ax25->paclen = opt; in ax25_setsockopt()
658 ax25->ax25_dev = ax25_dev_ax25dev(dev); in ax25_setsockopt()
659 ax25_fillin_cb(ax25, ax25->ax25_dev); in ax25_setsockopt()
674 ax25_cb *ax25; in ax25_getsockopt() local
694 ax25 = ax25_sk(sk); in ax25_getsockopt()
698 val = ax25->window; in ax25_getsockopt()
702 val = ax25->t1 / HZ; in ax25_getsockopt()
706 val = ax25->t2 / HZ; in ax25_getsockopt()
710 val = ax25->n2; in ax25_getsockopt()
714 val = ax25->t3 / HZ; in ax25_getsockopt()
718 val = ax25->idle / (60 * HZ); in ax25_getsockopt()
722 val = ax25->backoff; in ax25_getsockopt()
726 val = (ax25->modulus == AX25_EMODULUS); in ax25_getsockopt()
730 val = ax25->pidincl; in ax25_getsockopt()
734 val = ax25->iamdigi; in ax25_getsockopt()
738 val = ax25->paclen; in ax25_getsockopt()
742 ax25_dev = ax25->ax25_dev; in ax25_getsockopt()
799 ax25_cb *ax25; in ax25_create() local
853 ax25 = sk->sk_protinfo = ax25_create_cb(); in ax25_create()
854 if (!ax25) { in ax25_create()
865 ax25->sk = sk; in ax25_create()
873 ax25_cb *ax25, *oax25; in ax25_make_new() local
879 if ((ax25 = ax25_create_cb()) == NULL) { in ax25_make_new()
891 ax25_cb_put(ax25); in ax25_make_new()
908 ax25->modulus = oax25->modulus; in ax25_make_new()
909 ax25->backoff = oax25->backoff; in ax25_make_new()
910 ax25->pidincl = oax25->pidincl; in ax25_make_new()
911 ax25->iamdigi = oax25->iamdigi; in ax25_make_new()
912 ax25->rtt = oax25->rtt; in ax25_make_new()
913 ax25->t1 = oax25->t1; in ax25_make_new()
914 ax25->t2 = oax25->t2; in ax25_make_new()
915 ax25->t3 = oax25->t3; in ax25_make_new()
916 ax25->n2 = oax25->n2; in ax25_make_new()
917 ax25->idle = oax25->idle; in ax25_make_new()
918 ax25->paclen = oax25->paclen; in ax25_make_new()
919 ax25->window = oax25->window; in ax25_make_new()
921 ax25->ax25_dev = ax25_dev; in ax25_make_new()
922 ax25->source_addr = oax25->source_addr; in ax25_make_new()
925 ax25->digipeat = kmemdup(oax25->digipeat, sizeof(ax25_digi), in ax25_make_new()
927 if (ax25->digipeat == NULL) { in ax25_make_new()
929 ax25_cb_put(ax25); in ax25_make_new()
934 sk->sk_protinfo = ax25; in ax25_make_new()
935 ax25->sk = sk; in ax25_make_new()
943 ax25_cb *ax25; in ax25_release() local
951 ax25 = ax25_sk(sk); in ax25_release()
954 switch (ax25->state) { in ax25_release()
957 ax25_disconnect(ax25, 0); in ax25_release()
959 ax25_destroy_socket(ax25); in ax25_release()
964 ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND); in ax25_release()
966 ax25_disconnect(ax25, 0); in ax25_release()
968 ax25_destroy_socket(ax25); in ax25_release()
973 ax25_clear_queues(ax25); in ax25_release()
974 ax25->n2count = 0; in ax25_release()
976 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_release()
979 ax25_send_control(ax25, in ax25_release()
983 ax25_stop_t2timer(ax25); in ax25_release()
984 ax25_stop_t3timer(ax25); in ax25_release()
985 ax25_stop_idletimer(ax25); in ax25_release()
989 ax25_stop_t3timer(ax25); in ax25_release()
990 ax25_stop_idletimer(ax25); in ax25_release()
994 ax25_calculate_t1(ax25); in ax25_release()
995 ax25_start_t1timer(ax25); in ax25_release()
996 ax25->state = AX25_STATE_2; in ax25_release()
1010 ax25_destroy_socket(ax25); in ax25_release()
1033 ax25_cb *ax25; in ax25_bind() local
1061 ax25 = ax25_sk(sk); in ax25_bind()
1067 ax25->source_addr = call; in ax25_bind()
1072 if (ax25->ax25_dev != NULL) in ax25_bind()
1089 ax25_fillin_cb(ax25, ax25_dev); in ax25_bind()
1092 ax25_cb_add(ax25); in ax25_bind()
1108 ax25_cb *ax25 = ax25_sk(sk), *ax25t; in ax25_connect() local
1162 kfree(ax25->digipeat); in ax25_connect()
1163 ax25->digipeat = NULL; in ax25_connect()
1186 AX25_HBIT) && ax25->iamdigi) { in ax25_connect()
1206 if ((err = ax25_rt_autobind(ax25, &fsa->fsa_ax25.sax25_call)) < 0) { in ax25_connect()
1211 ax25_fillin_cb(ax25, ax25->ax25_dev); in ax25_connect()
1212 ax25_cb_add(ax25); in ax25_connect()
1214 if (ax25->ax25_dev == NULL) { in ax25_connect()
1222 (ax25t=ax25_find_cb(&ax25->source_addr, &fsa->fsa_ax25.sax25_call, digi, in ax25_connect()
1223 ax25->ax25_dev->dev))) { in ax25_connect()
1230 ax25->dest_addr = fsa->fsa_ax25.sax25_call; in ax25_connect()
1231 ax25->digipeat = digi; in ax25_connect()
1244 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_connect()
1247 ax25_std_establish_data_link(ax25); in ax25_connect()
1252 ax25->modulus = AX25_MODULUS; in ax25_connect()
1253 ax25->window = ax25->ax25_dev->values[AX25_VALUES_WINDOW]; in ax25_connect()
1254 if (ax25->ax25_dev->dama.slave) in ax25_connect()
1255 ax25_ds_establish_data_link(ax25); in ax25_connect()
1257 ax25_std_establish_data_link(ax25); in ax25_connect()
1262 ax25->state = AX25_STATE_1; in ax25_connect()
1264 ax25_start_heartbeat(ax25); in ax25_connect()
1384 ax25_cb *ax25; in ax25_getname() local
1388 ax25 = ax25_sk(sk); in ax25_getname()
1397 fsa->fsa_ax25.sax25_call = ax25->dest_addr; in ax25_getname()
1400 if (ax25->digipeat != NULL) { in ax25_getname()
1401 ndigi = ax25->digipeat->ndigi; in ax25_getname()
1405 ax25->digipeat->calls[i]; in ax25_getname()
1409 fsa->fsa_ax25.sax25_call = ax25->source_addr; in ax25_getname()
1411 if (ax25->ax25_dev != NULL) { in ax25_getname()
1413 ax25->ax25_dev->dev->dev_addr, AX25_ADDR_LEN); in ax25_getname()
1434 ax25_cb *ax25; in ax25_sendmsg() local
1442 ax25 = ax25_sk(sk); in ax25_sendmsg()
1455 if (ax25->ax25_dev == NULL) { in ax25_sendmsg()
1460 if (len > ax25->ax25_dev->dev->mtu) { in ax25_sendmsg()
1509 ax25cmp(&ax25->dest_addr, &sax.sax25_call)) { in ax25_sendmsg()
1528 sax.sax25_call = ax25->dest_addr; in ax25_sendmsg()
1529 dp = ax25->digipeat; in ax25_sendmsg()
1538 size = len + ax25->ax25_dev->dev->hard_header_len; in ax25_sendmsg()
1558 if (!ax25->pidincl) in ax25_sendmsg()
1572 ax25_output(ax25, ax25->paclen, skb); in ax25_sendmsg()
1586 lv = ax25_addr_build(skb->data, &ax25->source_addr, &sax.sax25_call, in ax25_sendmsg()
1599 ax25_queue_xmit(skb, ax25->ax25_dev->dev); in ax25_sendmsg()
1772 ax25_cb *ax25 = ax25_sk(sk); in ax25_ioctl() local
1775 ax25_info.t1 = ax25->t1 / HZ; in ax25_ioctl()
1776 ax25_info.t2 = ax25->t2 / HZ; in ax25_ioctl()
1777 ax25_info.t3 = ax25->t3 / HZ; in ax25_ioctl()
1778 ax25_info.idle = ax25->idle / (60 * HZ); in ax25_ioctl()
1779 ax25_info.n2 = ax25->n2; in ax25_ioctl()
1780 ax25_info.t1timer = ax25_display_timer(&ax25->t1timer) / HZ; in ax25_ioctl()
1781 ax25_info.t2timer = ax25_display_timer(&ax25->t2timer) / HZ; in ax25_ioctl()
1782 ax25_info.t3timer = ax25_display_timer(&ax25->t3timer) / HZ; in ax25_ioctl()
1783 ax25_info.idletimer = ax25_display_timer(&ax25->idletimer) / (60 * HZ); in ax25_ioctl()
1784 ax25_info.n2count = ax25->n2count; in ax25_ioctl()
1785 ax25_info.state = ax25->state; in ax25_ioctl()
1788 ax25_info.vs = ax25->vs; in ax25_ioctl()
1789 ax25_info.vr = ax25->vr; in ax25_ioctl()
1790 ax25_info.va = ax25->va; in ax25_ioctl()
1791 ax25_info.vs_max = ax25->vs; /* reserved */ in ax25_ioctl()
1792 ax25_info.paclen = ax25->paclen; in ax25_ioctl()
1793 ax25_info.window = ax25->window; in ax25_ioctl()
1860 struct ax25_cb *ax25; in ax25_info_start() local
1865 ax25_for_each(ax25, node, &ax25_list) { in ax25_info_start()
1867 return ax25; in ax25_info_start()
1889 ax25_cb *ax25 = v; in ax25_info_show() local
1900 (long) ax25, in ax25_info_show()
1901 ax25->ax25_dev == NULL? "???" : ax25->ax25_dev->dev->name, in ax25_info_show()
1902 ax2asc(buf, &ax25->source_addr), in ax25_info_show()
1903 ax25->iamdigi? "*":""); in ax25_info_show()
1904 seq_printf(seq, "%s", ax2asc(buf, &ax25->dest_addr)); in ax25_info_show()
1906 for (k=0; (ax25->digipeat != NULL) && (k < ax25->digipeat->ndigi); k++) { in ax25_info_show()
1908 ax2asc(buf, &ax25->digipeat->calls[k]), in ax25_info_show()
1909 ax25->digipeat->repeated[k]? "*":""); in ax25_info_show()
1913 ax25->state, in ax25_info_show()
1914 ax25->vs, ax25->vr, ax25->va, in ax25_info_show()
1915 ax25_display_timer(&ax25->t1timer) / HZ, ax25->t1 / HZ, in ax25_info_show()
1916 ax25_display_timer(&ax25->t2timer) / HZ, ax25->t2 / HZ, in ax25_info_show()
1917 ax25_display_timer(&ax25->t3timer) / HZ, ax25->t3 / HZ, in ax25_info_show()
1918 ax25_display_timer(&ax25->idletimer) / (60 * HZ), in ax25_info_show()
1919 ax25->idle / (60 * HZ), in ax25_info_show()
1920 ax25->n2count, ax25->n2, in ax25_info_show()
1921 ax25->rtt / HZ, in ax25_info_show()
1922 ax25->window, in ax25_info_show()
1923 ax25->paclen); in ax25_info_show()
1925 if (ax25->sk != NULL) { in ax25_info_show()
1927 atomic_read(&ax25->sk->sk_wmem_alloc), in ax25_info_show()
1928 atomic_read(&ax25->sk->sk_rmem_alloc), in ax25_info_show()
1929 sock_i_ino(ax25->sk)); in ax25_info_show()