Lines Matching refs:ax25
151 void ax25_free_cb(ax25_cb *ax25) in ax25_free_cb() argument
153 if (ax25->digipeat != NULL) { in ax25_free_cb()
154 kfree(ax25->digipeat); in ax25_free_cb()
155 ax25->digipeat = NULL; in ax25_free_cb()
158 kfree(ax25); in ax25_free_cb()
165 ax25_free_cb(sk->protinfo.ax25); in ax25_free_sock()
171 static void ax25_remove_socket(ax25_cb *ax25) in ax25_remove_socket() argument
178 if ((s = ax25_list) == ax25) { in ax25_remove_socket()
185 if (s->next == ax25) { in ax25_remove_socket()
186 s->next = ax25->next; in ax25_remove_socket()
246 void ax25_insert_socket(ax25_cb *ax25) in ax25_insert_socket() argument
253 ax25->next = ax25_list; in ax25_insert_socket()
254 ax25_list = ax25; in ax25_insert_socket()
408 void ax25_destroy_socket(ax25_cb *ax25) /* Not static as it's used by the timer */ in ax25_destroy_socket() argument
415 ax25_stop_heartbeat(ax25); in ax25_destroy_socket()
416 ax25_stop_t1timer(ax25); in ax25_destroy_socket()
417 ax25_stop_t2timer(ax25); in ax25_destroy_socket()
418 ax25_stop_t3timer(ax25); in ax25_destroy_socket()
419 ax25_stop_idletimer(ax25); in ax25_destroy_socket()
421 ax25_remove_socket(ax25); in ax25_destroy_socket()
422 ax25_clear_queues(ax25); /* Flush the queues */ in ax25_destroy_socket()
424 if (ax25->sk != NULL) { in ax25_destroy_socket()
425 while ((skb = skb_dequeue(&ax25->sk->receive_queue)) != NULL) { in ax25_destroy_socket()
426 if (skb->sk != ax25->sk) { /* A pending connection */ in ax25_destroy_socket()
428 ax25_start_heartbeat(skb->sk->protinfo.ax25); in ax25_destroy_socket()
429 skb->sk->protinfo.ax25->state = AX25_STATE_0; in ax25_destroy_socket()
436 if (ax25->sk != NULL) { in ax25_destroy_socket()
437 if (atomic_read(&ax25->sk->wmem_alloc) != 0 || in ax25_destroy_socket()
438 atomic_read(&ax25->sk->rmem_alloc) != 0) { in ax25_destroy_socket()
440 init_timer(&ax25->timer); in ax25_destroy_socket()
441 ax25->timer.expires = jiffies + 10 * HZ; in ax25_destroy_socket()
442 ax25->timer.function = ax25_destroy_timer; in ax25_destroy_socket()
443 ax25->timer.data = (unsigned long)ax25; in ax25_destroy_socket()
444 add_timer(&ax25->timer); in ax25_destroy_socket()
446 sk_free(ax25->sk); in ax25_destroy_socket()
449 ax25_free_cb(ax25); in ax25_destroy_socket()
465 ax25_cb *ax25; in ax25_ctl_ioctl() local
481 …if ((ax25 = ax25_find_cb(&ax25_ctl.source_addr, &ax25_ctl.dest_addr, &digi, ax25_dev->dev)) == NUL… in ax25_ctl_ioctl()
486 ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND); in ax25_ctl_ioctl()
488 … if (ax25_dev->dama.slave && ax25->ax25_dev->values[AX25_VALUES_PROTOCOL] == AX25_PROTO_DAMA_SLAVE) in ax25_ctl_ioctl()
489 ax25_dama_off(ax25); in ax25_ctl_ioctl()
491 ax25_disconnect(ax25, ENETRESET); in ax25_ctl_ioctl()
495 if (ax25->modulus == AX25_MODULUS) { in ax25_ctl_ioctl()
502 ax25->window = ax25_ctl.arg; in ax25_ctl_ioctl()
508 ax25->rtt = (ax25_ctl.arg * HZ) / 2; in ax25_ctl_ioctl()
509 ax25->t1 = ax25_ctl.arg * HZ; in ax25_ctl_ioctl()
515 ax25->t2 = ax25_ctl.arg * HZ; in ax25_ctl_ioctl()
521 ax25->n2count = 0; in ax25_ctl_ioctl()
522 ax25->n2 = ax25_ctl.arg; in ax25_ctl_ioctl()
528 ax25->t3 = ax25_ctl.arg * HZ; in ax25_ctl_ioctl()
534 ax25->idle = ax25_ctl.arg * 60 * HZ; in ax25_ctl_ioctl()
540 ax25->paclen = ax25_ctl.arg; in ax25_ctl_ioctl()
554 void ax25_fillin_cb(ax25_cb *ax25, ax25_dev *ax25_dev) in ax25_fillin_cb() argument
556 ax25->ax25_dev = ax25_dev; in ax25_fillin_cb()
558 if (ax25->ax25_dev != NULL) { in ax25_fillin_cb()
559 ax25->rtt = ax25_dev->values[AX25_VALUES_T1] / 2; in ax25_fillin_cb()
560 ax25->t1 = ax25_dev->values[AX25_VALUES_T1]; in ax25_fillin_cb()
561 ax25->t2 = ax25_dev->values[AX25_VALUES_T2]; in ax25_fillin_cb()
562 ax25->t3 = ax25_dev->values[AX25_VALUES_T3]; in ax25_fillin_cb()
563 ax25->n2 = ax25_dev->values[AX25_VALUES_N2]; in ax25_fillin_cb()
564 ax25->paclen = ax25_dev->values[AX25_VALUES_PACLEN]; in ax25_fillin_cb()
565 ax25->idle = ax25_dev->values[AX25_VALUES_IDLE]; in ax25_fillin_cb()
566 ax25->backoff = ax25_dev->values[AX25_VALUES_BACKOFF]; in ax25_fillin_cb()
569 ax25->modulus = AX25_EMODULUS; in ax25_fillin_cb()
570 ax25->window = ax25_dev->values[AX25_VALUES_EWINDOW]; in ax25_fillin_cb()
572 ax25->modulus = AX25_MODULUS; in ax25_fillin_cb()
573 ax25->window = ax25_dev->values[AX25_VALUES_WINDOW]; in ax25_fillin_cb()
576 ax25->rtt = AX25_DEF_T1 / 2; in ax25_fillin_cb()
577 ax25->t1 = AX25_DEF_T1; in ax25_fillin_cb()
578 ax25->t2 = AX25_DEF_T2; in ax25_fillin_cb()
579 ax25->t3 = AX25_DEF_T3; in ax25_fillin_cb()
580 ax25->n2 = AX25_DEF_N2; in ax25_fillin_cb()
581 ax25->paclen = AX25_DEF_PACLEN; in ax25_fillin_cb()
582 ax25->idle = AX25_DEF_IDLE; in ax25_fillin_cb()
583 ax25->backoff = AX25_DEF_BACKOFF; in ax25_fillin_cb()
586 ax25->modulus = AX25_EMODULUS; in ax25_fillin_cb()
587 ax25->window = AX25_DEF_EWINDOW; in ax25_fillin_cb()
589 ax25->modulus = AX25_MODULUS; in ax25_fillin_cb()
590 ax25->window = AX25_DEF_WINDOW; in ax25_fillin_cb()
600 ax25_cb *ax25; in ax25_create_cb() local
602 if ((ax25 = kmalloc(sizeof(*ax25), GFP_ATOMIC)) == NULL) in ax25_create_cb()
607 memset(ax25, 0x00, sizeof(*ax25)); in ax25_create_cb()
609 skb_queue_head_init(&ax25->write_queue); in ax25_create_cb()
610 skb_queue_head_init(&ax25->frag_queue); in ax25_create_cb()
611 skb_queue_head_init(&ax25->ack_queue); in ax25_create_cb()
612 skb_queue_head_init(&ax25->reseq_queue); in ax25_create_cb()
614 init_timer(&ax25->timer); in ax25_create_cb()
615 init_timer(&ax25->t1timer); in ax25_create_cb()
616 init_timer(&ax25->t2timer); in ax25_create_cb()
617 init_timer(&ax25->t3timer); in ax25_create_cb()
618 init_timer(&ax25->idletimer); in ax25_create_cb()
620 ax25_fillin_cb(ax25, NULL); in ax25_create_cb()
622 ax25->state = AX25_STATE_0; in ax25_create_cb()
624 return ax25; in ax25_create_cb()
650 if (sk->protinfo.ax25->modulus == AX25_MODULUS) { in ax25_setsockopt()
657 sk->protinfo.ax25->window = opt; in ax25_setsockopt()
663 sk->protinfo.ax25->rtt = (opt * HZ) / 2; in ax25_setsockopt()
664 sk->protinfo.ax25->t1 = opt * HZ; in ax25_setsockopt()
670 sk->protinfo.ax25->t2 = opt * HZ; in ax25_setsockopt()
676 sk->protinfo.ax25->n2 = opt; in ax25_setsockopt()
682 sk->protinfo.ax25->t3 = opt * HZ; in ax25_setsockopt()
688 sk->protinfo.ax25->idle = opt * 60 * HZ; in ax25_setsockopt()
694 sk->protinfo.ax25->backoff = opt; in ax25_setsockopt()
698 sk->protinfo.ax25->modulus = opt ? AX25_EMODULUS : AX25_MODULUS; in ax25_setsockopt()
702 sk->protinfo.ax25->pidincl = opt ? 1 : 0; in ax25_setsockopt()
706 sk->protinfo.ax25->iamdigi = opt ? 1 : 0; in ax25_setsockopt()
712 sk->protinfo.ax25->paclen = opt; in ax25_setsockopt()
727 sk->protinfo.ax25->ax25_dev = ax25_dev_ax25dev(dev); in ax25_setsockopt()
728 ax25_fillin_cb(sk->protinfo.ax25, sk->protinfo.ax25->ax25_dev); in ax25_setsockopt()
759 val = sk->protinfo.ax25->window; in ax25_getsockopt()
763 val = sk->protinfo.ax25->t1 / HZ; in ax25_getsockopt()
767 val = sk->protinfo.ax25->t2 / HZ; in ax25_getsockopt()
771 val = sk->protinfo.ax25->n2; in ax25_getsockopt()
775 val = sk->protinfo.ax25->t3 / HZ; in ax25_getsockopt()
779 val = sk->protinfo.ax25->idle / (60 * HZ); in ax25_getsockopt()
783 val = sk->protinfo.ax25->backoff; in ax25_getsockopt()
787 val = (sk->protinfo.ax25->modulus == AX25_EMODULUS); in ax25_getsockopt()
791 val = sk->protinfo.ax25->pidincl; in ax25_getsockopt()
795 val = sk->protinfo.ax25->iamdigi; in ax25_getsockopt()
799 val = sk->protinfo.ax25->paclen; in ax25_getsockopt()
803 ax25_dev = sk->protinfo.ax25->ax25_dev; in ax25_getsockopt()
843 ax25_cb *ax25; in ax25_create() local
891 if ((ax25 = ax25_create_cb()) == NULL) { in ax25_create()
902 ax25->sk = sk; in ax25_create()
903 sk->protinfo.ax25 = ax25; in ax25_create()
911 ax25_cb *ax25; in ax25_make_new() local
916 if ((ax25 = ax25_create_cb()) == NULL) { in ax25_make_new()
928 ax25_free_cb(ax25); in ax25_make_new()
946 ax25->modulus = osk->protinfo.ax25->modulus; in ax25_make_new()
947 ax25->backoff = osk->protinfo.ax25->backoff; in ax25_make_new()
948 ax25->pidincl = osk->protinfo.ax25->pidincl; in ax25_make_new()
949 ax25->iamdigi = osk->protinfo.ax25->iamdigi; in ax25_make_new()
950 ax25->rtt = osk->protinfo.ax25->rtt; in ax25_make_new()
951 ax25->t1 = osk->protinfo.ax25->t1; in ax25_make_new()
952 ax25->t2 = osk->protinfo.ax25->t2; in ax25_make_new()
953 ax25->t3 = osk->protinfo.ax25->t3; in ax25_make_new()
954 ax25->n2 = osk->protinfo.ax25->n2; in ax25_make_new()
955 ax25->idle = osk->protinfo.ax25->idle; in ax25_make_new()
956 ax25->paclen = osk->protinfo.ax25->paclen; in ax25_make_new()
957 ax25->window = osk->protinfo.ax25->window; in ax25_make_new()
959 ax25->ax25_dev = ax25_dev; in ax25_make_new()
960 ax25->source_addr = osk->protinfo.ax25->source_addr; in ax25_make_new()
962 if (osk->protinfo.ax25->digipeat != NULL) { in ax25_make_new()
963 if ((ax25->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) { in ax25_make_new()
968 memcpy(ax25->digipeat, osk->protinfo.ax25->digipeat, sizeof(ax25_digi)); in ax25_make_new()
971 sk->protinfo.ax25 = ax25; in ax25_make_new()
972 ax25->sk = sk; in ax25_make_new()
984 switch (sk->protinfo.ax25->state) { in ax25_release()
986 ax25_disconnect(sk->protinfo.ax25, 0); in ax25_release()
987 ax25_destroy_socket(sk->protinfo.ax25); in ax25_release()
992 ax25_send_control(sk->protinfo.ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND); in ax25_release()
993 ax25_disconnect(sk->protinfo.ax25, 0); in ax25_release()
994 ax25_destroy_socket(sk->protinfo.ax25); in ax25_release()
999 ax25_clear_queues(sk->protinfo.ax25); in ax25_release()
1000 sk->protinfo.ax25->n2count = 0; in ax25_release()
1001 switch (sk->protinfo.ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_release()
1004 ax25_send_control(sk->protinfo.ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND); in ax25_release()
1005 ax25_stop_t2timer(sk->protinfo.ax25); in ax25_release()
1006 ax25_stop_t3timer(sk->protinfo.ax25); in ax25_release()
1007 ax25_stop_idletimer(sk->protinfo.ax25); in ax25_release()
1011 ax25_stop_t3timer(sk->protinfo.ax25); in ax25_release()
1012 ax25_stop_idletimer(sk->protinfo.ax25); in ax25_release()
1016 ax25_calculate_t1(sk->protinfo.ax25); in ax25_release()
1017 ax25_start_t1timer(sk->protinfo.ax25); in ax25_release()
1018 sk->protinfo.ax25->state = AX25_STATE_2; in ax25_release()
1034 ax25_destroy_socket(sk->protinfo.ax25); in ax25_release()
1078 sk->protinfo.ax25->source_addr = addr->fsa_ax25.sax25_call; in ax25_bind()
1080 sk->protinfo.ax25->source_addr = *call; in ax25_bind()
1086 if (sk->protinfo.ax25->ax25_dev != NULL) in ax25_bind()
1099 ax25_fillin_cb(sk->protinfo.ax25, ax25_dev); in ax25_bind()
1102 ax25_insert_socket(sk->protinfo.ax25); in ax25_bind()
1161 if (sk->protinfo.ax25->digipeat != NULL) { in ax25_connect()
1162 kfree(sk->protinfo.ax25->digipeat); in ax25_connect()
1163 sk->protinfo.ax25->digipeat = NULL; in ax25_connect()
1181 if ((fsa->fsa_digipeater[ct].ax25_call[6] & AX25_HBIT) && sk->protinfo.ax25->iamdigi) { in ax25_connect()
1201 if ((err = ax25_rt_autobind(sk->protinfo.ax25, &fsa->fsa_ax25.sax25_call)) < 0) in ax25_connect()
1203 ax25_fillin_cb(sk->protinfo.ax25, sk->protinfo.ax25->ax25_dev); in ax25_connect()
1204 ax25_insert_socket(sk->protinfo.ax25); in ax25_connect()
1206 if (sk->protinfo.ax25->ax25_dev == NULL) in ax25_connect()
1210 …K_SEQPACKET && ax25_find_cb(&sk->protinfo.ax25->source_addr, &fsa->fsa_ax25.sax25_call, digi, sk->… in ax25_connect()
1215 sk->protinfo.ax25->dest_addr = fsa->fsa_ax25.sax25_call; in ax25_connect()
1216 sk->protinfo.ax25->digipeat = digi; in ax25_connect()
1229 switch (sk->protinfo.ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_connect()
1232 ax25_std_establish_data_link(sk->protinfo.ax25); in ax25_connect()
1237 sk->protinfo.ax25->modulus = AX25_MODULUS; in ax25_connect()
1238 sk->protinfo.ax25->window = sk->protinfo.ax25->ax25_dev->values[AX25_VALUES_WINDOW]; in ax25_connect()
1239 if (sk->protinfo.ax25->ax25_dev->dama.slave) in ax25_connect()
1240 ax25_ds_establish_data_link(sk->protinfo.ax25); in ax25_connect()
1242 ax25_std_establish_data_link(sk->protinfo.ax25); in ax25_connect()
1247 sk->protinfo.ax25->state = AX25_STATE_1; in ax25_connect()
1249 ax25_start_heartbeat(sk->protinfo.ax25); in ax25_connect()
1339 fsa->fsa_ax25.sax25_call = sk->protinfo.ax25->dest_addr; in ax25_getname()
1342 if (sk->protinfo.ax25->digipeat != NULL) { in ax25_getname()
1343 ndigi = sk->protinfo.ax25->digipeat->ndigi; in ax25_getname()
1346 fsa->fsa_digipeater[i] = sk->protinfo.ax25->digipeat->calls[i]; in ax25_getname()
1350 fsa->fsa_ax25.sax25_call = sk->protinfo.ax25->source_addr; in ax25_getname()
1352 if (sk->protinfo.ax25->ax25_dev != NULL) { in ax25_getname()
1353 memcpy(&fsa->fsa_digipeater[0], sk->protinfo.ax25->ax25_dev->dev->dev_addr, AX25_ADDR_LEN); in ax25_getname()
1387 if (sk->protinfo.ax25->ax25_dev == NULL) in ax25_sendmsg()
1428 if (sk->type == SOCK_SEQPACKET && ax25cmp(&sk->protinfo.ax25->dest_addr, &sax.sax25_call) != 0) in ax25_sendmsg()
1443 sax.sax25_call = sk->protinfo.ax25->dest_addr; in ax25_sendmsg()
1444 dp = sk->protinfo.ax25->digipeat; in ax25_sendmsg()
1467 if (!sk->protinfo.ax25->pidincl) { in ax25_sendmsg()
1481 …ax25_output(sk->protinfo.ax25, sk->protinfo.ax25->paclen, skb); /* Shove it onto the queue and kic… in ax25_sendmsg()
1493 …asmptr += (lv = ax25_addr_build(asmptr, &sk->protinfo.ax25->source_addr, &sax.sax25_call, dp, AX25… in ax25_sendmsg()
1504 skb->dev = sk->protinfo.ax25->ax25_dev->dev; in ax25_sendmsg()
1530 if (!sk->protinfo.ax25->pidincl) in ax25_recvmsg()
1645 ax25_info.t1 = sk->protinfo.ax25->t1 / HZ; in ax25_ioctl()
1646 ax25_info.t2 = sk->protinfo.ax25->t2 / HZ; in ax25_ioctl()
1647 ax25_info.t3 = sk->protinfo.ax25->t3 / HZ; in ax25_ioctl()
1648 ax25_info.idle = sk->protinfo.ax25->idle / (60 * HZ); in ax25_ioctl()
1649 ax25_info.n2 = sk->protinfo.ax25->n2; in ax25_ioctl()
1650 ax25_info.t1timer = ax25_display_timer(&sk->protinfo.ax25->t1timer) / HZ; in ax25_ioctl()
1651 ax25_info.t2timer = ax25_display_timer(&sk->protinfo.ax25->t2timer) / HZ; in ax25_ioctl()
1652 ax25_info.t3timer = ax25_display_timer(&sk->protinfo.ax25->t3timer) / HZ; in ax25_ioctl()
1653 ax25_info.idletimer = ax25_display_timer(&sk->protinfo.ax25->idletimer) / (60 * HZ); in ax25_ioctl()
1654 ax25_info.n2count = sk->protinfo.ax25->n2count; in ax25_ioctl()
1655 ax25_info.state = sk->protinfo.ax25->state; in ax25_ioctl()
1658 ax25_info.vs = sk->protinfo.ax25->vs; in ax25_ioctl()
1659 ax25_info.vr = sk->protinfo.ax25->vr; in ax25_ioctl()
1660 ax25_info.va = sk->protinfo.ax25->va; in ax25_ioctl()
1661 ax25_info.vs_max = sk->protinfo.ax25->vs; /* reserved */ in ax25_ioctl()
1662 ax25_info.paclen = sk->protinfo.ax25->paclen; in ax25_ioctl()
1663 ax25_info.window = sk->protinfo.ax25->window; in ax25_ioctl()
1715 ax25_cb *ax25; in ax25_get_info() local
1728 for (ax25 = ax25_list; ax25 != NULL; ax25 = ax25->next) { in ax25_get_info()
1730 (long) ax25, in ax25_get_info()
1731 ax25->ax25_dev == NULL? "???" : ax25->ax25_dev->dev->name, in ax25_get_info()
1732 ax2asc(&ax25->source_addr), in ax25_get_info()
1733 ax25->iamdigi? "*":""); in ax25_get_info()
1735 len += sprintf(buffer+len, "%s", ax2asc(&ax25->dest_addr)); in ax25_get_info()
1737 for (k=0; (ax25->digipeat != NULL) && (k < ax25->digipeat->ndigi); k++) { in ax25_get_info()
1739 ax2asc(&ax25->digipeat->calls[k]), in ax25_get_info()
1740 ax25->digipeat->repeated[k]? "*":""); in ax25_get_info()
1744 ax25->state, in ax25_get_info()
1745 ax25->vs, ax25->vr, ax25->va, in ax25_get_info()
1746 ax25_display_timer(&ax25->t1timer) / HZ, ax25->t1 / HZ, in ax25_get_info()
1747 ax25_display_timer(&ax25->t2timer) / HZ, ax25->t2 / HZ, in ax25_get_info()
1748 ax25_display_timer(&ax25->t3timer) / HZ, ax25->t3 / HZ, in ax25_get_info()
1749 ax25_display_timer(&ax25->idletimer) / (60 * HZ), in ax25_get_info()
1750 ax25->idle / (60 * HZ), in ax25_get_info()
1751 ax25->n2count, ax25->n2, in ax25_get_info()
1752 ax25->rtt / HZ, in ax25_get_info()
1753 ax25->window, in ax25_get_info()
1754 ax25->paclen); in ax25_get_info()
1756 if (ax25->sk != NULL) { in ax25_get_info()
1758 atomic_read(&ax25->sk->wmem_alloc), in ax25_get_info()
1759 atomic_read(&ax25->sk->rmem_alloc), in ax25_get_info()
1760 ax25->sk->socket != NULL ? ax25->sk->socket->inode->i_ino : 0L); in ax25_get_info()