Lines Matching refs:ax25

66 static void ax25_cb_del(ax25_cb *ax25)  in ax25_cb_del()  argument
68 if (!hlist_unhashed(&ax25->ax25_node)) { in ax25_cb_del()
70 hlist_del_init(&ax25->ax25_node); in ax25_cb_del()
72 ax25_cb_put(ax25); in ax25_cb_del()
143 void ax25_cb_add(ax25_cb *ax25) in ax25_cb_add() argument
146 ax25_cb_hold(ax25); in ax25_cb_add()
147 hlist_add_head(&ax25->ax25_node, &ax25_list); in ax25_cb_add()
273 ax25_cb *ax25=(ax25_cb *)data; in ax25_destroy_timer() local
276 sk=ax25->sk; in ax25_destroy_timer()
280 ax25_destroy_socket(ax25); in ax25_destroy_timer()
291 void ax25_destroy_socket(ax25_cb *ax25) in ax25_destroy_socket() argument
295 ax25_cb_del(ax25); in ax25_destroy_socket()
297 ax25_stop_heartbeat(ax25); in ax25_destroy_socket()
298 ax25_stop_t1timer(ax25); in ax25_destroy_socket()
299 ax25_stop_t2timer(ax25); in ax25_destroy_socket()
300 ax25_stop_t3timer(ax25); in ax25_destroy_socket()
301 ax25_stop_idletimer(ax25); in ax25_destroy_socket()
303 ax25_clear_queues(ax25); /* Flush the queues */ in ax25_destroy_socket()
305 if (ax25->sk != NULL) { in ax25_destroy_socket()
306 while ((skb = skb_dequeue(&ax25->sk->sk_receive_queue)) != NULL) { in ax25_destroy_socket()
307 if (skb->sk != ax25->sk) { in ax25_destroy_socket()
323 skb_queue_purge(&ax25->sk->sk_write_queue); in ax25_destroy_socket()
326 if (ax25->sk != NULL) { in ax25_destroy_socket()
327 if (sk_has_allocations(ax25->sk)) { in ax25_destroy_socket()
329 setup_timer(&ax25->dtimer, ax25_destroy_timer, in ax25_destroy_socket()
330 (unsigned long)ax25); in ax25_destroy_socket()
331 ax25->dtimer.expires = jiffies + 2 * HZ; in ax25_destroy_socket()
332 add_timer(&ax25->dtimer); in ax25_destroy_socket()
334 struct sock *sk=ax25->sk; in ax25_destroy_socket()
335 ax25->sk=NULL; in ax25_destroy_socket()
339 ax25_cb_put(ax25); in ax25_destroy_socket()
353 ax25_cb *ax25; in ax25_ctl_ioctl() local
373 …if ((ax25 = ax25_find_cb(&ax25_ctl.source_addr, &ax25_ctl.dest_addr, &digi, ax25_dev->dev)) == NUL… in ax25_ctl_ioctl()
378 ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND); in ax25_ctl_ioctl()
380 if (ax25_dev->dama.slave && ax25->ax25_dev->values[AX25_VALUES_PROTOCOL] == AX25_PROTO_DAMA_SLAVE) in ax25_ctl_ioctl()
381 ax25_dama_off(ax25); in ax25_ctl_ioctl()
383 ax25_disconnect(ax25, ENETRESET); in ax25_ctl_ioctl()
387 if (ax25->modulus == AX25_MODULUS) { in ax25_ctl_ioctl()
394 ax25->window = ax25_ctl.arg; in ax25_ctl_ioctl()
400 ax25->rtt = (ax25_ctl.arg * HZ) / 2; in ax25_ctl_ioctl()
401 ax25->t1 = ax25_ctl.arg * HZ; in ax25_ctl_ioctl()
407 ax25->t2 = ax25_ctl.arg * HZ; in ax25_ctl_ioctl()
413 ax25->n2count = 0; in ax25_ctl_ioctl()
414 ax25->n2 = ax25_ctl.arg; in ax25_ctl_ioctl()
420 ax25->t3 = ax25_ctl.arg * HZ; in ax25_ctl_ioctl()
427 ax25->idle = ax25_ctl.arg * 60 * HZ; in ax25_ctl_ioctl()
433 ax25->paclen = ax25_ctl.arg; in ax25_ctl_ioctl()
441 ax25_cb_put(ax25); in ax25_ctl_ioctl()
449 static void ax25_fillin_cb_from_dev(ax25_cb *ax25, ax25_dev *ax25_dev) in ax25_fillin_cb_from_dev() argument
451 ax25->rtt = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T1]) / 2; in ax25_fillin_cb_from_dev()
452 ax25->t1 = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T1]); in ax25_fillin_cb_from_dev()
453 ax25->t2 = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T2]); in ax25_fillin_cb_from_dev()
454 ax25->t3 = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T3]); in ax25_fillin_cb_from_dev()
455 ax25->n2 = ax25_dev->values[AX25_VALUES_N2]; in ax25_fillin_cb_from_dev()
456 ax25->paclen = ax25_dev->values[AX25_VALUES_PACLEN]; in ax25_fillin_cb_from_dev()
457 ax25->idle = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_IDLE]); in ax25_fillin_cb_from_dev()
458 ax25->backoff = ax25_dev->values[AX25_VALUES_BACKOFF]; in ax25_fillin_cb_from_dev()
461 ax25->modulus = AX25_EMODULUS; in ax25_fillin_cb_from_dev()
462 ax25->window = ax25_dev->values[AX25_VALUES_EWINDOW]; in ax25_fillin_cb_from_dev()
464 ax25->modulus = AX25_MODULUS; in ax25_fillin_cb_from_dev()
465 ax25->window = ax25_dev->values[AX25_VALUES_WINDOW]; in ax25_fillin_cb_from_dev()
473 void ax25_fillin_cb(ax25_cb *ax25, ax25_dev *ax25_dev) in ax25_fillin_cb() argument
475 ax25->ax25_dev = ax25_dev; in ax25_fillin_cb()
477 if (ax25->ax25_dev != NULL) { in ax25_fillin_cb()
478 ax25_fillin_cb_from_dev(ax25, ax25_dev); in ax25_fillin_cb()
485 ax25->rtt = msecs_to_jiffies(AX25_DEF_T1) / 2; in ax25_fillin_cb()
486 ax25->t1 = msecs_to_jiffies(AX25_DEF_T1); in ax25_fillin_cb()
487 ax25->t2 = msecs_to_jiffies(AX25_DEF_T2); in ax25_fillin_cb()
488 ax25->t3 = msecs_to_jiffies(AX25_DEF_T3); in ax25_fillin_cb()
489 ax25->n2 = AX25_DEF_N2; in ax25_fillin_cb()
490 ax25->paclen = AX25_DEF_PACLEN; in ax25_fillin_cb()
491 ax25->idle = msecs_to_jiffies(AX25_DEF_IDLE); in ax25_fillin_cb()
492 ax25->backoff = AX25_DEF_BACKOFF; in ax25_fillin_cb()
495 ax25->modulus = AX25_EMODULUS; in ax25_fillin_cb()
496 ax25->window = AX25_DEF_EWINDOW; in ax25_fillin_cb()
498 ax25->modulus = AX25_MODULUS; in ax25_fillin_cb()
499 ax25->window = AX25_DEF_WINDOW; in ax25_fillin_cb()
508 ax25_cb *ax25; in ax25_create_cb() local
510 if ((ax25 = kzalloc(sizeof(*ax25), GFP_ATOMIC)) == NULL) in ax25_create_cb()
513 atomic_set(&ax25->refcount, 1); in ax25_create_cb()
515 skb_queue_head_init(&ax25->write_queue); in ax25_create_cb()
516 skb_queue_head_init(&ax25->frag_queue); in ax25_create_cb()
517 skb_queue_head_init(&ax25->ack_queue); in ax25_create_cb()
518 skb_queue_head_init(&ax25->reseq_queue); in ax25_create_cb()
520 ax25_setup_timers(ax25); in ax25_create_cb()
522 ax25_fillin_cb(ax25, NULL); in ax25_create_cb()
524 ax25->state = AX25_STATE_0; in ax25_create_cb()
526 return ax25; in ax25_create_cb()
538 ax25_cb *ax25; in ax25_setsockopt() local
554 ax25 = sk_to_ax25(sk); in ax25_setsockopt()
558 if (ax25->modulus == AX25_MODULUS) { in ax25_setsockopt()
569 ax25->window = opt; in ax25_setsockopt()
577 ax25->rtt = (opt * HZ) >> 1; in ax25_setsockopt()
578 ax25->t1 = opt * HZ; in ax25_setsockopt()
586 ax25->t2 = opt * HZ; in ax25_setsockopt()
594 ax25->n2 = opt; in ax25_setsockopt()
602 ax25->t3 = opt * HZ; in ax25_setsockopt()
610 ax25->idle = opt * 60 * HZ; in ax25_setsockopt()
618 ax25->backoff = opt; in ax25_setsockopt()
622 ax25->modulus = opt ? AX25_EMODULUS : AX25_MODULUS; in ax25_setsockopt()
626 ax25->pidincl = opt ? 1 : 0; in ax25_setsockopt()
630 ax25->iamdigi = opt ? 1 : 0; in ax25_setsockopt()
638 ax25->paclen = opt; in ax25_setsockopt()
663 ax25->ax25_dev = ax25_dev_ax25dev(dev); in ax25_setsockopt()
664 ax25_fillin_cb(ax25, ax25->ax25_dev); in ax25_setsockopt()
680 ax25_cb *ax25; in ax25_getsockopt() local
700 ax25 = sk_to_ax25(sk); in ax25_getsockopt()
704 val = ax25->window; in ax25_getsockopt()
708 val = ax25->t1 / HZ; in ax25_getsockopt()
712 val = ax25->t2 / HZ; in ax25_getsockopt()
716 val = ax25->n2; in ax25_getsockopt()
720 val = ax25->t3 / HZ; in ax25_getsockopt()
724 val = ax25->idle / (60 * HZ); in ax25_getsockopt()
728 val = ax25->backoff; in ax25_getsockopt()
732 val = (ax25->modulus == AX25_EMODULUS); in ax25_getsockopt()
736 val = ax25->pidincl; in ax25_getsockopt()
740 val = ax25->iamdigi; in ax25_getsockopt()
744 val = ax25->paclen; in ax25_getsockopt()
748 ax25_dev = ax25->ax25_dev; in ax25_getsockopt()
806 ax25_cb *ax25; in ax25_create() local
864 ax25 = ax25_sk(sk)->cb = ax25_create_cb(); in ax25_create()
865 if (!ax25) { in ax25_create()
876 ax25->sk = sk; in ax25_create()
884 ax25_cb *ax25, *oax25; in ax25_make_new() local
890 if ((ax25 = ax25_create_cb()) == NULL) { in ax25_make_new()
902 ax25_cb_put(ax25); in ax25_make_new()
918 ax25->modulus = oax25->modulus; in ax25_make_new()
919 ax25->backoff = oax25->backoff; in ax25_make_new()
920 ax25->pidincl = oax25->pidincl; in ax25_make_new()
921 ax25->iamdigi = oax25->iamdigi; in ax25_make_new()
922 ax25->rtt = oax25->rtt; in ax25_make_new()
923 ax25->t1 = oax25->t1; in ax25_make_new()
924 ax25->t2 = oax25->t2; in ax25_make_new()
925 ax25->t3 = oax25->t3; in ax25_make_new()
926 ax25->n2 = oax25->n2; in ax25_make_new()
927 ax25->idle = oax25->idle; in ax25_make_new()
928 ax25->paclen = oax25->paclen; in ax25_make_new()
929 ax25->window = oax25->window; in ax25_make_new()
931 ax25->ax25_dev = ax25_dev; in ax25_make_new()
932 ax25->source_addr = oax25->source_addr; in ax25_make_new()
935 ax25->digipeat = kmemdup(oax25->digipeat, sizeof(ax25_digi), in ax25_make_new()
937 if (ax25->digipeat == NULL) { in ax25_make_new()
939 ax25_cb_put(ax25); in ax25_make_new()
944 ax25_sk(sk)->cb = ax25; in ax25_make_new()
946 ax25->sk = sk; in ax25_make_new()
954 ax25_cb *ax25; in ax25_release() local
962 ax25 = sk_to_ax25(sk); in ax25_release()
965 switch (ax25->state) { in ax25_release()
968 ax25_disconnect(ax25, 0); in ax25_release()
970 ax25_destroy_socket(ax25); in ax25_release()
975 ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND); in ax25_release()
977 ax25_disconnect(ax25, 0); in ax25_release()
979 ax25_destroy_socket(ax25); in ax25_release()
984 ax25_clear_queues(ax25); in ax25_release()
985 ax25->n2count = 0; in ax25_release()
987 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_release()
990 ax25_send_control(ax25, in ax25_release()
994 ax25_stop_t2timer(ax25); in ax25_release()
995 ax25_stop_t3timer(ax25); in ax25_release()
996 ax25_stop_idletimer(ax25); in ax25_release()
1000 ax25_stop_t3timer(ax25); in ax25_release()
1001 ax25_stop_idletimer(ax25); in ax25_release()
1005 ax25_calculate_t1(ax25); in ax25_release()
1006 ax25_start_t1timer(ax25); in ax25_release()
1007 ax25->state = AX25_STATE_2; in ax25_release()
1021 ax25_destroy_socket(ax25); in ax25_release()
1044 ax25_cb *ax25; in ax25_bind() local
1072 ax25 = sk_to_ax25(sk); in ax25_bind()
1078 ax25->source_addr = call; in ax25_bind()
1083 if (ax25->ax25_dev != NULL) in ax25_bind()
1100 ax25_fillin_cb(ax25, ax25_dev); in ax25_bind()
1103 ax25_cb_add(ax25); in ax25_bind()
1119 ax25_cb *ax25 = sk_to_ax25(sk), *ax25t; in ax25_connect() local
1173 kfree(ax25->digipeat); in ax25_connect()
1174 ax25->digipeat = NULL; in ax25_connect()
1197 AX25_HBIT) && ax25->iamdigi) { in ax25_connect()
1217 if ((err = ax25_rt_autobind(ax25, &fsa->fsa_ax25.sax25_call)) < 0) { in ax25_connect()
1222 ax25_fillin_cb(ax25, ax25->ax25_dev); in ax25_connect()
1223 ax25_cb_add(ax25); in ax25_connect()
1225 if (ax25->ax25_dev == NULL) { in ax25_connect()
1233 (ax25t=ax25_find_cb(&ax25->source_addr, &fsa->fsa_ax25.sax25_call, digi, in ax25_connect()
1234 ax25->ax25_dev->dev))) { in ax25_connect()
1241 ax25->dest_addr = fsa->fsa_ax25.sax25_call; in ax25_connect()
1242 ax25->digipeat = digi; in ax25_connect()
1255 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_connect()
1258 ax25_std_establish_data_link(ax25); in ax25_connect()
1263 ax25->modulus = AX25_MODULUS; in ax25_connect()
1264 ax25->window = ax25->ax25_dev->values[AX25_VALUES_WINDOW]; in ax25_connect()
1265 if (ax25->ax25_dev->dama.slave) in ax25_connect()
1266 ax25_ds_establish_data_link(ax25); in ax25_connect()
1268 ax25_std_establish_data_link(ax25); in ax25_connect()
1273 ax25->state = AX25_STATE_1; in ax25_connect()
1275 ax25_start_heartbeat(ax25); in ax25_connect()
1395 ax25_cb *ax25; in ax25_getname() local
1400 ax25 = sk_to_ax25(sk); in ax25_getname()
1409 fsa->fsa_ax25.sax25_call = ax25->dest_addr; in ax25_getname()
1411 if (ax25->digipeat != NULL) { in ax25_getname()
1412 ndigi = ax25->digipeat->ndigi; in ax25_getname()
1416 ax25->digipeat->calls[i]; in ax25_getname()
1420 fsa->fsa_ax25.sax25_call = ax25->source_addr; in ax25_getname()
1422 if (ax25->ax25_dev != NULL) { in ax25_getname()
1424 ax25->ax25_dev->dev->dev_addr, AX25_ADDR_LEN); in ax25_getname()
1444 ax25_cb *ax25; in ax25_sendmsg() local
1452 ax25 = sk_to_ax25(sk); in ax25_sendmsg()
1465 if (ax25->ax25_dev == NULL) { in ax25_sendmsg()
1470 if (len > ax25->ax25_dev->dev->mtu) { in ax25_sendmsg()
1519 ax25cmp(&ax25->dest_addr, &sax.sax25_call)) { in ax25_sendmsg()
1538 sax.sax25_call = ax25->dest_addr; in ax25_sendmsg()
1539 dp = ax25->digipeat; in ax25_sendmsg()
1544 size = len + ax25->ax25_dev->dev->hard_header_len; in ax25_sendmsg()
1562 if (!ax25->pidincl) in ax25_sendmsg()
1574 ax25_output(ax25, ax25->paclen, skb); in ax25_sendmsg()
1585 lv = ax25_addr_build(skb->data, &ax25->source_addr, &sax.sax25_call, in ax25_sendmsg()
1593 ax25_queue_xmit(skb, ax25->ax25_dev->dev); in ax25_sendmsg()
1768 ax25_cb *ax25 = sk_to_ax25(sk); in ax25_ioctl() local
1771 ax25_info.t1 = ax25->t1 / HZ; in ax25_ioctl()
1772 ax25_info.t2 = ax25->t2 / HZ; in ax25_ioctl()
1773 ax25_info.t3 = ax25->t3 / HZ; in ax25_ioctl()
1774 ax25_info.idle = ax25->idle / (60 * HZ); in ax25_ioctl()
1775 ax25_info.n2 = ax25->n2; in ax25_ioctl()
1776 ax25_info.t1timer = ax25_display_timer(&ax25->t1timer) / HZ; in ax25_ioctl()
1777 ax25_info.t2timer = ax25_display_timer(&ax25->t2timer) / HZ; in ax25_ioctl()
1778 ax25_info.t3timer = ax25_display_timer(&ax25->t3timer) / HZ; in ax25_ioctl()
1779 ax25_info.idletimer = ax25_display_timer(&ax25->idletimer) / (60 * HZ); in ax25_ioctl()
1780 ax25_info.n2count = ax25->n2count; in ax25_ioctl()
1781 ax25_info.state = ax25->state; in ax25_ioctl()
1784 ax25_info.vs = ax25->vs; in ax25_ioctl()
1785 ax25_info.vr = ax25->vr; in ax25_ioctl()
1786 ax25_info.va = ax25->va; in ax25_ioctl()
1787 ax25_info.vs_max = ax25->vs; /* reserved */ in ax25_ioctl()
1788 ax25_info.paclen = ax25->paclen; in ax25_ioctl()
1789 ax25_info.window = ax25->window; in ax25_ioctl()
1873 ax25_cb *ax25 = hlist_entry(v, struct ax25_cb, ax25_node); in ax25_info_show() local
1884 (long) ax25, in ax25_info_show()
1885 ax25->ax25_dev == NULL? "???" : ax25->ax25_dev->dev->name, in ax25_info_show()
1886 ax2asc(buf, &ax25->source_addr), in ax25_info_show()
1887 ax25->iamdigi? "*":""); in ax25_info_show()
1888 seq_printf(seq, "%s", ax2asc(buf, &ax25->dest_addr)); in ax25_info_show()
1890 for (k=0; (ax25->digipeat != NULL) && (k < ax25->digipeat->ndigi); k++) { in ax25_info_show()
1892 ax2asc(buf, &ax25->digipeat->calls[k]), in ax25_info_show()
1893 ax25->digipeat->repeated[k]? "*":""); in ax25_info_show()
1897 ax25->state, in ax25_info_show()
1898 ax25->vs, ax25->vr, ax25->va, in ax25_info_show()
1899 ax25_display_timer(&ax25->t1timer) / HZ, ax25->t1 / HZ, in ax25_info_show()
1900 ax25_display_timer(&ax25->t2timer) / HZ, ax25->t2 / HZ, in ax25_info_show()
1901 ax25_display_timer(&ax25->t3timer) / HZ, ax25->t3 / HZ, in ax25_info_show()
1902 ax25_display_timer(&ax25->idletimer) / (60 * HZ), in ax25_info_show()
1903 ax25->idle / (60 * HZ), in ax25_info_show()
1904 ax25->n2count, ax25->n2, in ax25_info_show()
1905 ax25->rtt / HZ, in ax25_info_show()
1906 ax25->window, in ax25_info_show()
1907 ax25->paclen); in ax25_info_show()
1909 if (ax25->sk != NULL) { in ax25_info_show()
1911 sk_wmem_alloc_get(ax25->sk), in ax25_info_show()
1912 sk_rmem_alloc_get(ax25->sk), in ax25_info_show()
1913 sock_i_ino(ax25->sk)); in ax25_info_show()