Lines Matching refs:ax25
63 ax25_cb *ax25; in ax25_send_frame() local
79 if ((ax25 = ax25_find_cb(src, dest, digi, dev)) != NULL) { in ax25_send_frame()
80 ax25_output(ax25, paclen, skb); in ax25_send_frame()
81 return ax25; /* It already existed */ in ax25_send_frame()
87 if ((ax25 = ax25_create_cb()) == NULL) in ax25_send_frame()
90 ax25_fillin_cb(ax25, ax25_dev); in ax25_send_frame()
92 ax25->source_addr = *src; in ax25_send_frame()
93 ax25->dest_addr = *dest; in ax25_send_frame()
96 if ((ax25->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) { in ax25_send_frame()
97 ax25_free_cb(ax25); in ax25_send_frame()
100 memcpy(ax25->digipeat, digi, sizeof(ax25_digi)); in ax25_send_frame()
103 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_send_frame()
106 ax25_std_establish_data_link(ax25); in ax25_send_frame()
112 ax25_ds_establish_data_link(ax25); in ax25_send_frame()
114 ax25_std_establish_data_link(ax25); in ax25_send_frame()
119 ax25_insert_socket(ax25); in ax25_send_frame()
121 ax25->state = AX25_STATE_1; in ax25_send_frame()
123 ax25_start_heartbeat(ax25); in ax25_send_frame()
125 ax25_output(ax25, paclen, skb); in ax25_send_frame()
127 return ax25; /* We had to create it */ in ax25_send_frame()
136 void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb) in ax25_output() argument
196 skb_queue_tail(&ax25->write_queue, skbn); /* Throw it on the queue */ in ax25_output()
201 skb_queue_tail(&ax25->write_queue, skb); /* Throw it on the queue */ in ax25_output()
204 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_output()
207 ax25_kick(ax25); in ax25_output()
216 if (!ax25->ax25_dev->dama.slave) ax25_kick(ax25); in ax25_output()
226 static void ax25_send_iframe(ax25_cb *ax25, struct sk_buff *skb, int poll_bit) in ax25_send_iframe() argument
235 if (ax25->modulus == AX25_MODULUS) { in ax25_send_iframe()
240 *frame |= (ax25->vr << 5); in ax25_send_iframe()
241 *frame |= (ax25->vs << 1); in ax25_send_iframe()
246 frame[0] |= (ax25->vs << 1); in ax25_send_iframe()
248 frame[1] |= (ax25->vr << 1); in ax25_send_iframe()
251 ax25_start_idletimer(ax25); in ax25_send_iframe()
253 ax25_transmit_buffer(ax25, skb, AX25_COMMAND); in ax25_send_iframe()
256 void ax25_kick(ax25_cb *ax25) in ax25_kick() argument
262 if (ax25->state != AX25_STATE_3 && ax25->state != AX25_STATE_4) in ax25_kick()
265 if (ax25->condition & AX25_COND_PEER_RX_BUSY) in ax25_kick()
268 if (skb_peek(&ax25->write_queue) == NULL) in ax25_kick()
271 start = (skb_peek(&ax25->ack_queue) == NULL) ? ax25->va : ax25->vs; in ax25_kick()
272 end = (ax25->va + ax25->window) % ax25->modulus; in ax25_kick()
277 ax25->vs = start; in ax25_kick()
288 skb = skb_dequeue(&ax25->write_queue); in ax25_kick()
292 skb_queue_head(&ax25->write_queue, skb); in ax25_kick()
299 next = (ax25->vs + 1) % ax25->modulus; in ax25_kick()
307 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_kick()
310 ax25_send_iframe(ax25, skbn, (last) ? AX25_POLLON : AX25_POLLOFF); in ax25_kick()
315 ax25_send_iframe(ax25, skbn, AX25_POLLOFF); in ax25_kick()
320 ax25->vs = next; in ax25_kick()
325 skb_queue_tail(&ax25->ack_queue, skb); in ax25_kick()
327 } while (!last && (skb = skb_dequeue(&ax25->write_queue)) != NULL); in ax25_kick()
329 ax25->condition &= ~AX25_COND_ACK_PENDING; in ax25_kick()
331 if (!ax25_t1timer_running(ax25)) { in ax25_kick()
332 ax25_stop_t3timer(ax25); in ax25_kick()
333 ax25_calculate_t1(ax25); in ax25_kick()
334 ax25_start_t1timer(ax25); in ax25_kick()
338 void ax25_transmit_buffer(ax25_cb *ax25, struct sk_buff *skb, int type) in ax25_transmit_buffer() argument
344 if (ax25->ax25_dev == NULL) { in ax25_transmit_buffer()
345 ax25_disconnect(ax25, ENETUNREACH); in ax25_transmit_buffer()
349 headroom = ax25_addr_size(ax25->digipeat); in ax25_transmit_buffer()
367 ax25_addr_build(ptr, &ax25->source_addr, &ax25->dest_addr, ax25->digipeat, type, ax25->modulus); in ax25_transmit_buffer()
369 skb->dev = ax25->ax25_dev->dev; in ax25_transmit_buffer()
391 int ax25_check_iframes_acked(ax25_cb *ax25, unsigned short nr) in ax25_check_iframes_acked() argument
393 if (ax25->vs == nr) { in ax25_check_iframes_acked()
394 ax25_frames_acked(ax25, nr); in ax25_check_iframes_acked()
395 ax25_calculate_rtt(ax25); in ax25_check_iframes_acked()
396 ax25_stop_t1timer(ax25); in ax25_check_iframes_acked()
397 ax25_start_t3timer(ax25); in ax25_check_iframes_acked()
400 if (ax25->va != nr) { in ax25_check_iframes_acked()
401 ax25_frames_acked(ax25, nr); in ax25_check_iframes_acked()
402 ax25_calculate_t1(ax25); in ax25_check_iframes_acked()
403 ax25_start_t1timer(ax25); in ax25_check_iframes_acked()