Lines Matching defs:ax25

19 #include <net/ax25.h>
33 void ax25_clear_queues(ax25_cb *ax25)
35 skb_queue_purge(&ax25->write_queue);
36 skb_queue_purge(&ax25->ack_queue);
37 skb_queue_purge(&ax25->reseq_queue);
38 skb_queue_purge(&ax25->frag_queue);
46 void ax25_frames_acked(ax25_cb *ax25, unsigned short nr)
53 if (ax25->va != nr) {
54 while (skb_peek(&ax25->ack_queue) != NULL && ax25->va != nr) {
55 skb = skb_dequeue(&ax25->ack_queue);
57 ax25->va = (ax25->va + 1) % ax25->modulus;
62 void ax25_requeue_frames(ax25_cb *ax25)
71 while ((skb = skb_dequeue_tail(&ax25->ack_queue)) != NULL)
72 skb_queue_head(&ax25->write_queue, skb);
79 int ax25_validate_nr(ax25_cb *ax25, unsigned short nr)
81 unsigned short vc = ax25->va;
83 while (vc != ax25->vs) {
85 vc = (vc + 1) % ax25->modulus;
88 if (nr == ax25->vs) return 1;
97 int ax25_decode(ax25_cb *ax25, struct sk_buff *skb, int *ns, int *nr, int *pf)
105 if (ax25->modulus == AX25_MODULUS) {
147 void ax25_send_control(ax25_cb *ax25, int frametype, int poll_bit, int type)
152 if ((skb = alloc_skb(ax25->ax25_dev->dev->hard_header_len + 2, GFP_ATOMIC)) == NULL)
155 skb_reserve(skb, ax25->ax25_dev->dev->hard_header_len);
160 if (ax25->modulus == AX25_MODULUS) {
165 *dptr |= (ax25->vr << 5);
174 dptr[1] = (ax25->vr << 1);
179 ax25_transmit_buffer(ax25, skb, type);
220 void ax25_calculate_t1(ax25_cb *ax25)
224 switch (ax25->backoff) {
229 t += 2 * ax25->n2count;
233 for (n = 0; n < ax25->n2count; n++)
239 ax25->t1 = t * ax25->rtt;
245 void ax25_calculate_rtt(ax25_cb *ax25)
247 if (ax25->backoff == 0)
250 if (ax25_t1timer_running(ax25) && ax25->n2count == 0)
251 ax25->rtt = (9 * ax25->rtt + ax25->t1 - ax25_display_timer(&ax25->t1timer)) / 10;
253 if (ax25->rtt < AX25_T1CLAMPLO)
254 ax25->rtt = AX25_T1CLAMPLO;
256 if (ax25->rtt > AX25_T1CLAMPHI)
257 ax25->rtt = AX25_T1CLAMPHI;
260 void ax25_disconnect(ax25_cb *ax25, int reason)
262 ax25_clear_queues(ax25);
265 timer_delete_sync(&ax25->timer);
266 timer_delete_sync(&ax25->t1timer);
267 timer_delete_sync(&ax25->t2timer);
268 timer_delete_sync(&ax25->t3timer);
269 timer_delete_sync(&ax25->idletimer);
271 if (ax25->sk && !sock_flag(ax25->sk, SOCK_DESTROY))
272 ax25_stop_heartbeat(ax25);
273 ax25_stop_t1timer(ax25);
274 ax25_stop_t2timer(ax25);
275 ax25_stop_t3timer(ax25);
276 ax25_stop_idletimer(ax25);
279 ax25->state = AX25_STATE_0;
281 ax25_link_failed(ax25, reason);
283 if (ax25->sk != NULL) {
285 bh_lock_sock(ax25->sk);
286 ax25->sk->sk_state = TCP_CLOSE;
287 ax25->sk->sk_err = reason;
288 ax25->sk->sk_shutdown |= SEND_SHUTDOWN;
289 if (!sock_flag(ax25->sk, SOCK_DEAD)) {
290 ax25->sk->sk_state_change(ax25->sk);
291 sock_set_flag(ax25->sk, SOCK_DEAD);
293 bh_unlock_sock(ax25->sk);