Lines Matching refs:ax25
39 ax25_cb *ax25; in ax25_send_frame() local
55 if ((ax25 = ax25_find_cb(src, dest, digi, dev)) != NULL) { in ax25_send_frame()
56 ax25_output(ax25, paclen, skb); in ax25_send_frame()
57 return ax25; /* It already existed */ in ax25_send_frame()
63 if ((ax25 = ax25_create_cb()) == NULL) in ax25_send_frame()
66 ax25_fillin_cb(ax25, ax25_dev); in ax25_send_frame()
68 ax25->source_addr = *src; in ax25_send_frame()
69 ax25->dest_addr = *dest; in ax25_send_frame()
72 ax25->digipeat = kmemdup(digi, sizeof(*digi), GFP_ATOMIC); in ax25_send_frame()
73 if (ax25->digipeat == NULL) { in ax25_send_frame()
74 ax25_cb_put(ax25); in ax25_send_frame()
79 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_send_frame()
82 ax25_std_establish_data_link(ax25); in ax25_send_frame()
88 ax25_ds_establish_data_link(ax25); in ax25_send_frame()
90 ax25_std_establish_data_link(ax25); in ax25_send_frame()
99 ax25_cb_hold(ax25); in ax25_send_frame()
101 ax25_cb_add(ax25); in ax25_send_frame()
103 ax25->state = AX25_STATE_1; in ax25_send_frame()
105 ax25_start_heartbeat(ax25); in ax25_send_frame()
107 ax25_output(ax25, paclen, skb); in ax25_send_frame()
109 return ax25; /* We had to create it */ in ax25_send_frame()
120 void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb) in ax25_output() argument
185 skb_queue_tail(&ax25->write_queue, skbn); /* Throw it on the queue */ in ax25_output()
190 skb_queue_tail(&ax25->write_queue, skb); /* Throw it on the queue */ in ax25_output()
193 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_output()
196 ax25_kick(ax25); in ax25_output()
205 if (!ax25->ax25_dev->dama.slave) ax25_kick(ax25); in ax25_output()
215 static void ax25_send_iframe(ax25_cb *ax25, struct sk_buff *skb, int poll_bit) in ax25_send_iframe() argument
224 if (ax25->modulus == AX25_MODULUS) { in ax25_send_iframe()
229 *frame |= (ax25->vr << 5); in ax25_send_iframe()
230 *frame |= (ax25->vs << 1); in ax25_send_iframe()
235 frame[0] |= (ax25->vs << 1); in ax25_send_iframe()
237 frame[1] |= (ax25->vr << 1); in ax25_send_iframe()
240 ax25_start_idletimer(ax25); in ax25_send_iframe()
242 ax25_transmit_buffer(ax25, skb, AX25_COMMAND); in ax25_send_iframe()
245 void ax25_kick(ax25_cb *ax25) in ax25_kick() argument
251 if (ax25->state != AX25_STATE_3 && ax25->state != AX25_STATE_4) in ax25_kick()
254 if (ax25->condition & AX25_COND_PEER_RX_BUSY) in ax25_kick()
257 if (skb_peek(&ax25->write_queue) == NULL) in ax25_kick()
260 start = (skb_peek(&ax25->ack_queue) == NULL) ? ax25->va : ax25->vs; in ax25_kick()
261 end = (ax25->va + ax25->window) % ax25->modulus; in ax25_kick()
276 skb = skb_dequeue(&ax25->write_queue); in ax25_kick()
280 ax25->vs = start; in ax25_kick()
284 skb_queue_head(&ax25->write_queue, skb); in ax25_kick()
291 next = (ax25->vs + 1) % ax25->modulus; in ax25_kick()
299 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_kick()
302 ax25_send_iframe(ax25, skbn, (last) ? AX25_POLLON : AX25_POLLOFF); in ax25_kick()
307 ax25_send_iframe(ax25, skbn, AX25_POLLOFF); in ax25_kick()
312 ax25->vs = next; in ax25_kick()
317 skb_queue_tail(&ax25->ack_queue, skb); in ax25_kick()
319 } while (!last && (skb = skb_dequeue(&ax25->write_queue)) != NULL); in ax25_kick()
321 ax25->condition &= ~AX25_COND_ACK_PENDING; in ax25_kick()
323 if (!ax25_t1timer_running(ax25)) { in ax25_kick()
324 ax25_stop_t3timer(ax25); in ax25_kick()
325 ax25_calculate_t1(ax25); in ax25_kick()
326 ax25_start_t1timer(ax25); in ax25_kick()
330 void ax25_transmit_buffer(ax25_cb *ax25, struct sk_buff *skb, int type) in ax25_transmit_buffer() argument
336 if (ax25->ax25_dev == NULL) { in ax25_transmit_buffer()
337 ax25_disconnect(ax25, ENETUNREACH); in ax25_transmit_buffer()
341 headroom = ax25_addr_size(ax25->digipeat); in ax25_transmit_buffer()
359 ax25_addr_build(ptr, &ax25->source_addr, &ax25->dest_addr, ax25->digipeat, type, ax25->modulus); in ax25_transmit_buffer()
361 ax25_queue_xmit(skb, ax25->ax25_dev->dev); in ax25_transmit_buffer()
380 int ax25_check_iframes_acked(ax25_cb *ax25, unsigned short nr) in ax25_check_iframes_acked() argument
382 if (ax25->vs == nr) { in ax25_check_iframes_acked()
383 ax25_frames_acked(ax25, nr); in ax25_check_iframes_acked()
384 ax25_calculate_rtt(ax25); in ax25_check_iframes_acked()
385 ax25_stop_t1timer(ax25); in ax25_check_iframes_acked()
386 ax25_start_t3timer(ax25); in ax25_check_iframes_acked()
389 if (ax25->va != nr) { in ax25_check_iframes_acked()
390 ax25_frames_acked(ax25, nr); in ax25_check_iframes_acked()
391 ax25_calculate_t1(ax25); in ax25_check_iframes_acked()
392 ax25_start_t1timer(ax25); in ax25_check_iframes_acked()