Lines Matching defs:ax25

22 #include <net/ax25.h>
36 void ax25_clear_queues(ax25_cb *ax25)
38 skb_queue_purge(&ax25->write_queue);
39 skb_queue_purge(&ax25->ack_queue);
40 skb_queue_purge(&ax25->reseq_queue);
41 skb_queue_purge(&ax25->frag_queue);
49 void ax25_frames_acked(ax25_cb *ax25, unsigned short nr)
56 if (ax25->va != nr) {
57 while (skb_peek(&ax25->ack_queue) != NULL && ax25->va != nr) {
58 skb = skb_dequeue(&ax25->ack_queue);
60 ax25->va = (ax25->va + 1) % ax25->modulus;
65 void ax25_requeue_frames(ax25_cb *ax25)
74 while ((skb = skb_dequeue_tail(&ax25->ack_queue)) != NULL)
75 skb_queue_head(&ax25->write_queue, skb);
82 int ax25_validate_nr(ax25_cb *ax25, unsigned short nr)
84 unsigned short vc = ax25->va;
86 while (vc != ax25->vs) {
88 vc = (vc + 1) % ax25->modulus;
91 if (nr == ax25->vs) return 1;
100 int ax25_decode(ax25_cb *ax25, struct sk_buff *skb, int *ns, int *nr, int *pf)
108 if (ax25->modulus == AX25_MODULUS) {
150 void ax25_send_control(ax25_cb *ax25, int frametype, int poll_bit, int type)
155 if ((skb = alloc_skb(ax25->ax25_dev->dev->hard_header_len + 2, GFP_ATOMIC)) == NULL)
158 skb_reserve(skb, ax25->ax25_dev->dev->hard_header_len);
163 if (ax25->modulus == AX25_MODULUS) {
168 *dptr |= (ax25->vr << 5);
177 dptr[1] = (ax25->vr << 1);
182 ax25_transmit_buffer(ax25, skb, type);
223 void ax25_calculate_t1(ax25_cb *ax25)
227 switch (ax25->backoff) {
232 t += 2 * ax25->n2count;
236 for (n = 0; n < ax25->n2count; n++)
242 ax25->t1 = t * ax25->rtt;
248 void ax25_calculate_rtt(ax25_cb *ax25)
250 if (ax25->backoff == 0)
253 if (ax25_t1timer_running(ax25) && ax25->n2count == 0)
254 ax25->rtt = (9 * ax25->rtt + ax25->t1 - ax25_display_timer(&ax25->t1timer)) / 10;
256 if (ax25->rtt < AX25_T1CLAMPLO)
257 ax25->rtt = AX25_T1CLAMPLO;
259 if (ax25->rtt > AX25_T1CLAMPHI)
260 ax25->rtt = AX25_T1CLAMPHI;
263 void ax25_disconnect(ax25_cb *ax25, int reason)
265 ax25_clear_queues(ax25);
267 ax25_stop_t1timer(ax25);
268 ax25_stop_t2timer(ax25);
269 ax25_stop_t3timer(ax25);
270 ax25_stop_idletimer(ax25);
272 ax25->state = AX25_STATE_0;
274 ax25_link_failed(ax25, reason);
276 if (ax25->sk != NULL) {
278 bh_lock_sock(ax25->sk);
279 ax25->sk->sk_state = TCP_CLOSE;
280 ax25->sk->sk_err = reason;
281 ax25->sk->sk_shutdown |= SEND_SHUTDOWN;
282 if (!sock_flag(ax25->sk, SOCK_DEAD)) {
283 ax25->sk->sk_state_change(ax25->sk);
284 sock_set_flag(ax25->sk, SOCK_DEAD);
286 bh_unlock_sock(ax25->sk);